markstream-vue 2.0.11 → 2.0.14

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=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 E,normalizeStyle as O,withDirectives as P,mergeProps as S,toHandlers as R,createBlock as D,Teleport as F,createVNode as j,Transition as $,withCtx as z,withModifiers as A,vShow as L}from"vue";import{ay as H,aC as _,az as N,aB as I,ak as W,a9 as X,at as Y,G as q}from"./exports.js";import{p as U,b as V,g as Z,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={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Me={key:1,class:"relative"},Te={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Ce={class:"flex items-center gap-2 backdrop-blur rounded-lg"},Be={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Ee={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Oe="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",Pe=/* @__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","br"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Pe=d(!1),Se=d("undefined"==typeof window),Re=H(),De=_(),Fe=v(()=>i.isStrict?"strict":"loose"),je=v(()=>({startOnLoad:!1,securityLevel:Fe.value,dompurifyConfig:"strict"===Fe.value?q:void 0,htmlLabels:"strict"!==Fe.value&&void 0,flowchart:"strict"===Fe.value?{htmlLabels:!1}:void 0}));function $e(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function ze(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||$e(e),l}let Ae=null;function Le(e){if(i.enableMermaidInteractions&&(null==e?void 0:e.querySelector("svg")))try{null==Ae||Ae(e)}catch(t){}}const{t:He}=N();let _e=!1,Ne=0;function Ie(){return s(this,null,function*(){try{const e=yield te();return _e?null:(Pe.value=!!e,e)}catch(e){throw _e||(Pe.value=!1),e}finally{_e||(Se.value=!0)}})}const We=d(!1),Xe=d(!1),Ye=d(),qe=d(),Ue=d(),Ve=d(),Ze=d(null),Ke=I(),Ge=d(null),Je=d("undefined"==typeof window||!Re.value),Qe=m(),et=f(J,null);let tt="",nt=0,lt=0;const ot=v(()=>W(i,Qe));function rt(){const e=ot.value;e&&(tt&&tt!==e&&(null==et||et.markSettled(tt),nt=0),tt=e,nt+=1,lt+=1,1===nt&&(null==et||et.markPending(e)))}function at(){return s(this,null,function*(){const e=tt;if(!e)return;if(nt=Math.max(0,nt-1),nt>0)return;tt="";const t=++lt;yield p(),t===lt&&(function(e=ot.value){e&&Ye.value&&(null==et||et.reportHeight(e,Ye.value.offsetHeight))}(e),null==et||et.markSettled(e))})}function it(){const e=tt;e&&(tt="",nt=0,lt+=1,null==et||et.markSettled(e))}const ut=d(),st=v(()=>i.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function ct(e,t=st.value){const n=t,l={theme:"dark"===e?"dark":"default"};"strict"===Fe.value&&(l.htmlLabels=!1,l.flowchart={htmlLabels:!1});const o=`%%{init: ${JSON.stringify(l)}}%%\n`;return n.trim().startsWith("%%{")?n:o+n}const dt=v(()=>{var e;return null!=(e=U(i.estimatedPreviewHeightPx))?e:V(st.value)});function vt(){return function(e){const t=function(){var e;const t=qe.value?getComputedStyle(qe.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=U(t))?e:360}(),n=Ln();return K(e,t,n)}(dt.value)}function mt(){return`${vt()}px`}const ft=v(()=>{if(!1!==i.loading)return mt()}),ht=d(null);function gt(){var e;return!!(null==(e=Ue.value)?void 0:e.querySelector("svg"))}function pt(){return!1!==i.loading&&(gt()||!!ht.value)}const wt=d(1),yt=d(0),kt=d(0),xt=d(!1),bt=d({x:0,y:0}),Mt=d(!0),Tt=d(!1),Ct=d(!1),Bt=d(null);let Et="",Ot=!1,Pt="";const St=d(0),Rt=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)}),jt=v(()=>{var e;return Math.max(120,null!=(e=i.previewPollDelayMs)?e:800)}),$t=v(()=>{var e;return Math.max(jt.value,null!=(e=i.previewPollMaxDelayMs)?e:4e3)}),zt=v(()=>{var e;return Math.max(1,Math.trunc(null!=(e=i.previewPollMaxAttempts)?e:12))}),At=v(()=>!1!==i.loading);let Lt=null,Ht=null,_t=null,Nt=null,It=0;const Wt=null!=(o=globalThis.requestIdleCallback)?o:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Xt=null!=(r=globalThis.cancelIdleCallback)?r:e=>clearTimeout(e);function Yt(e=Ne){return!_e&&e===Ne}function qt(){return Yt()&&Je.value&&!Xe.value}function Ut(){null!=_t&&(globalThis.clearTimeout(_t),_t=null),null!=Nt&&(Xt(Nt),Nt=null)}function Vt(){_e||null==_t&&null==Nt&&(_t=globalThis.setTimeout(()=>{_t=null,qt()&&(Nt=Wt(()=>{Nt=null,qt()&&ul()},{timeout:500}))},Dt.value))}function Zt(){null!=Ht&&(globalThis.clearTimeout(Ht),Ht=null)}function Kt(e=600){if("undefined"==typeof globalThis||_e)return;const t=Math.max(0,e);Zt(),Ht=globalThis.setTimeout(()=>{if(Ht=null,!_e){if(i.loading||Ct.value||!qt())return void Kt(Math.min(1200,Math.max(300,1.2*t)));Vt()}},t)}const Gt=d(mt()),Jt=d(Gt.value);let Qt=null;const en=d(!1),tn=d(!1),nn=d({}),ln=d(0);let on=null,rn=null;const an=d(!1),un=v(()=>{var e,t;return!(Xe.value||Mt.value||Se.value&&!Ct.value&&!Bt.value&&(en.value||an.value&&Boolean(null==(t=null==(e=Ue.value)?void 0:e.textContent)?void 0:t.trim())))}),sn=d({zoom:1,translateX:0,translateY:0,containerHeight:Gt.value}),cn=v(()=>i.enableWheelZoom?{wheel:Gn}:{}),dn=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 vn=null,mn=null,fn=!1,hn=jt.value,gn=null,pn=0,wn=!0,yn=0;function kn(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 xn(e){if("undefined"==typeof document)return;if(!Ue.value)return;if("function"==typeof i.onRenderError&&!0===i.onRenderError(e,st.value,Ue.value))return an.value=!0,void sl();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),$e(Ue.value),Ue.value.appendChild(t);const l=Ue.value?getComputedStyle(Ue.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";Gt.value=l||"360px",Jt.value=Gt.value,an.value=!0,sl()}function bn(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 Mn(e){return"AbortError"===(null==e?void 0:e.name)}function Tn(e){return!bn(e)&&!Mn(e)}"undefined"!=typeof window&&h([()=>Ye.value,Re],([e,t])=>{var n;if(null==(n=Ge.value)||n.destroy(),Ge.value=null,!t||Je.value)return void(Je.value=!0);if(!e)return void(Je.value=!1);const l=Ke(e,{rootMargin:null==De?void 0:De.value.heavyBlockMargin,allowIdle:!1});Ge.value=l,Je.value=l.isVisible.value,l.whenVisible.then(()=>{Je.value=!0})},{immediate:!0}),g(()=>{var e;_e=!0,Ne+=1,ln.value+=1,null==(e=Ge.value)||e.destroy(),Ge.value=null,it(),Ut()});const Cn=v(()=>!1!==i.showTooltips);function Bn(e){return!e||e.disabled}function En(e,t,n="top"){if(!Cn.value)return;if(Bn(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;Y(e.currentTarget,t,n,!1,o,i.isDark)}function On(){Cn.value&&X()}function Pn(e){if(!Cn.value)return;if(Bn(e.currentTarget))return;const t=We.value?He("common.copied")||"Copied":He("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;Y(e.currentTarget,t,"top",!1,l,i.isDark)}function Sn(e,t){const n={theme:"dark"===t?"dark":"default"};"strict"===Fe.value&&(n.htmlLabels=!1,n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function Rn(){return wn&&!Mt.value&&!en.value&&!an.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"===Z(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 jn(e,t,n,l){return s(this,null,function*(){try{return yield kn(()=>e.render(t,n),{timeoutMs:l})}catch(o){if(!Tn(o))throw o;const a=G(n);if(a===n)throw o;try{return yield kn(()=>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:dn.value.worker,null==n?void 0:n.signal)}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o;const l=(null==o?void 0:o.code)||(null==o?void 0:o.name);if("WORKER_BUSY"!==l&&"WORKER_TIMEOUT"!==l&&"WORKER_INIT_ERROR"!==l&&"MERMAID_DISABLED"!==l&&"WORKER_REPLACED"!==l||(null==o?void 0:o.fallbackToRenderer)||"WORKER_TIMEOUT"===l)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=Sn(e,t);if("function"==typeof s.parse){try{yield kn(()=>s.parse(c),{timeoutMs:null!=(l=null==n?void 0:n.timeoutMs)?l:dn.value.parse,signal:null==n?void 0:n.signal})}catch(o){if(!Tn(o))throw o;const t=G(c);if(t===c)throw o;try{yield kn(()=>s.parse(t),{timeoutMs:null!=(r=null==n?void 0:n.timeoutMs)?r:dn.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 kn(()=>u.render(d,c),{timeoutMs:null!=(a=null==n?void 0:n.timeoutMs)?a:dn.value.render,signal:null==n?void 0:n.signal})}catch(o){if(!Tn(o))throw o;const t=G(c);if(t===c)throw o;try{yield kn(()=>u.render(`${d}-retry`,t),{timeoutMs:null!=(i=null==n?void 0:n.timeoutMs)?i:dn.value.render,signal:null==n?void 0:n.signal})}catch(v){throw o}}return!0})}(e,t,n);throw o}})}function zn(e,t,n){return s(this,null,function*(){var l;if("gantt"===Z(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:dn.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 An=v(()=>Mt.value||Ct.value||Xe.value);function Ln(){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=qe.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(!qe.value||!Ue.value)return;const n=!(null==t?void 0:t.force)&&!1!==i.loading&&gt(),l=Ue.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:qe.value.clientWidth,u=l.getBoundingClientRect().width,s=u>0?u/Math.max(.01,wt.value):a,c=Ln(),d=s*t,v=null==c?d:Math.min(d,c),m=Math.max(v,vt());n||null!=U(i.estimatedPreviewHeightPx)||(Gt.value=`${m}px`),Jt.value=Gt.value}}const _n=d(!1),Nn=v(()=>({transform:`translate(${yt.value}px, ${kt.value}px) scale(${wt.value})`}));function In(e){"Escape"===e.key&&_n.value&&Xn()}function Wn(){var e;if(!qe.value||!Ve.value)return!1;if("1"===(null==(e=Ve.value.firstElementChild)?void 0:e.getAttribute("data-mermaid-modal-clone")))return!0;const t=qe.value.cloneNode(!0);t.dataset.mermaidModalClone="1",t.classList.add("fullscreen"),t.style.height="100%",t.style.maxHeight="100%";const n=t.querySelector("._mermaid");n&&(n.style.contain="none",n.style.contentVisibility="visible");const l=t.querySelector("[data-mermaid-wrapper]");return l&&(Ze.value=l,l.style.transform=Nn.value.transform),$e(Ve.value),Ve.value.appendChild(t),Le(t),!0}function Xn(){if(_n.value=!1,Ve.value&&$e(Ve.value),Ze.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",In)}catch(e){}}function Yn(){wt.value<3&&(wt.value+=.1)}function qn(){wt.value>.5&&(wt.value-=.1)}function Un(){wt.value=1,yt.value=0,kt.value=0}function Vn(e){xt.value=!0,e instanceof MouseEvent?bt.value={x:e.clientX-yt.value,y:e.clientY-kt.value}:bt.value={x:e.touches[0].clientX-yt.value,y:e.touches[0].clientY-kt.value}}function Zn(e){if(!xt.value)return;let t,n;e instanceof MouseEvent?(t=e.clientX,n=e.clientY):(t=e.touches[0].clientX,n=e.touches[0].clientY),yt.value=t-bt.value.x,kt.value=n-bt.value.y}function Kn(){xt.value=!1}function Gn(e){if(i.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!qe.value)return;const t=qe.value.getBoundingClientRect(),n=e.clientX-t.left,l=e.clientY-t.top,o=n-t.width/2,r=l-t.height/2,a=(o-yt.value)/wt.value,i=(r-kt.value)/wt.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(wt.value+s,.5),3);c!==wt.value&&(yt.value=o-a*c,kt.value=r-i*c,wt.value=c)}}function Jn(){return s(this,null,function*(){try{const e=st.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)),We.value=!0,setTimeout(()=>{We.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function Qn(){var e;const t=null==(e=Ue.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 el(){var e,t;const n=null!=(t=null==(e=Ue.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(_n.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",In)}catch(e){}p(()=>{Wn()||p(Wn)})}()}function tl(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};c("toggleMode",e,t),t.defaultPrevented||nl(e)}function nl(e){return s(this,null,function*(){const t=ut.value;if(!t)return Tt.value=!0,void(Mt.value="source"===e);const n=t.getBoundingClientRect().height;t.style.height=`${n}px`,t.style.overflow="hidden",Tt.value=!0,Mt.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 ll(e=st.value,t=(i.isDark?"dark":"light"),n=!1===i.loading){return{code:e,codeWithTheme:ct(t,e),final:n,signature:`${t}\0${e}`,theme:t}}function ol(e){return e.signature===ll().signature}function rl(){return s(this,arguments,function*(e=ll()){const l=Ne;if(!Yt(l)||!ol(e))return!1;if(Ct.value){const t=Bt.value,n=Ot,o=Et;if(!t)return!1;const r=yield t;return!(!Yt(l)||!ol(e))&&(o===e.signature?!(!r||Pt!==e.signature)||!(!e.final||!1!==i.loading||n)&&rl(e):rl(e))}if(!Ue.value){if(yield p(),!Yt(l))return!1;if(!Ue.value)return console.warn("Mermaid container not ready"),!1}return!(!Yt(l)||!ol(e))&&(Ct.value=!0,Ot=e.final,Et=e.signature,rt(),Bt.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)}`;en.value||tn.value||null==(o=c.initialize)||o.call(c,(a=u({},je.value),s={dompurifyConfig:u({},q)},t(a,n(s))));const v=yield jn(c,d,e.codeWithTheme,dn.value.fullRender);if(!Yt(l)||!function(e){return ol(e)||!e.final&&!1!==i.loading&&st.value.startsWith(e.code)}(e))return tn.value&&(tn.value=!1),!1;if(!Ue.value)return!1;const m=ze(Ue.value,null==v?void 0:v.svg,{keepPreviousOnFailure:!e.final||!1!==i.loading});if(!m)return tn.value&&(tn.value=!1),!1;const f=null!=(r=null==v?void 0:v.bindFunctions)?r:null;return Ae=f,Le(m.bindTarget),Q(()=>Hn()),en.value||tn.value||(en.value=!0,sn.value={zoom:wt.value,translateX:yt.value,translateY:kt.value,containerHeight:Gt.value}),nn.value[e.theme]={svg:m.svg,bindFunctions:f},tn.value&&(tn.value=!1),Pt=e.signature,ht.value=Ue.value.innerHTML,an.value=!1,It=0,Zt(),!0}catch(c){if(!Yt(l)||!ol(e))return tn.value&&(tn.value=!1),!1;const t=bn(c),n=It+1;return t&&n<=3?(It=n,Kt(Math.min(1200,600*n))):(It=0,Zt(),e.final&&!1===i.loading&&console.error("Failed to render mermaid diagram:",c),e.final&&!1===i.loading&&xn(c)),!1}finally{Ot=!1,Et="",Ct.value=!1,Bt.value=null,Yt(l)&&at()}}),Bt.value)})}function al(){return s(this,null,function*(){var e;const t=st.value;if(!t.trim()){if(pt())return;return Ue.value&&$e(Ue.value),ht.value=null,Pt="",void(an.value=!1)}if(!Pe.value||!qt())return;const n=ll(t);en.value&&n.signature===Pt&&(null==(e=Ue.value)?void 0:e.querySelector("svg"))||(yield rl(n))&&(an.value=!1)})}function il(e,t,n,l){return s(this,null,function*(){const o=Ne;if(!Yt(o)||!Rn())return;if(!Ue.value&&(yield p(),!Yt(o)||!Ue.value))return;if(Ct.value)return;Ct.value=!0,rt();const r=ll(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 jn(a,u,Sn(c,n),dn.value.render);if(!Yt(o)||ln.value!==l||!1===i.loading||!Rn()||!ol(r))return!1;const v=null==d?void 0:d.svg;if(!Ue.value||!v)return!1;const m=ze(Ue.value,v,{keepPreviousOnFailure:!0});return!!m&&(Ae=null!=(t=null==d?void 0:d.bindFunctions)?t:null,Le(m.bindTarget),Q(()=>Hn()),!1)}catch(u){return!1}finally{Bt.value===a&&(Ct.value=!1,Bt.value=null),Yt(o)&&at()}});return Bt.value=a,a})}function ul(){return s(this,null,function*(){var e;if(!qt())return;const t=Ne,n=Date.now(),l=++ln.value;rt();try{on&&on.abort(),on=new AbortController;const r=on.signal,a=i.isDark?"dark":"light",u=st.value;if(!u.trim()){if(pt())return;return Ue.value&&$e(Ue.value),ht.value=null,Pt="",void(an.value=!1)}if(ll(u,a).signature===Pt)return;try{const e=yield zn(u,a,{signal:r,timeoutMs:dn.value.worker});if(!Yt(t))return;if(e.fullOk){if(r.aborted||ln.value!==l)return;if(!(yield rl(ll(u,a))))return;return void(Yt(t)&&ln.value===l&&(an.value=!1))}const o=pn&&n<=pn;if(e.prefixOk&&e.prefix&&!r.aborted&&ln.value===l&&Rn()&&!o)return void(yield il(e.prefix,u,a,l))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}if(!Yt(t)||ln.value!==l)return;if(an.value)return;const s=nn.value[a];if(s&&Ue.value){const t=ze(Ue.value,s.svg);t&&(Ae=null!=(e=s.bindFunctions)?e:null,Le(t.bindTarget))}}finally{Yt(t)&&at()}})}function sl(){fn&&(fn=!1,hn=jt.value,wn=!1,gn&&(gn.abort(),gn=null),vn&&(globalThis.clearTimeout(vn),vn=null),mn&&(Xt(mn),mn=null),pn=Date.now())}function cl(){if(sl(),Ut(),on){try{on.abort()}catch(e){}on=null}if(gn){try{gn.abort()}catch(e){}gn=null}Zt(),It=0}function dl(){null==rn||rn.abort(),rn=null}function vl(e=jt.value){fn&&(yn>=zt.value?sl():(vn&&globalThis.clearTimeout(vn),vn=globalThis.setTimeout(()=>{mn=Wt(()=>s(null,null,function*(){if(!fn)return;if(!qt())return void sl();if(Mt.value||en.value)return void sl();const e=i.isDark?"dark":"light",t=st.value;if(!t.trim())return!1===i.loading?void sl():void vl(hn);if(yn++,yn>zt.value)sl();else{gn&&gn.abort(),gn=new AbortController;try{const n=yield zn(t,e,{signal:gn.signal,timeoutMs:dn.value.worker});if(n.fullOk){if((yield rl(ll(t,e)))&&en.value)return void sl()}else n.prefixOk&&n.prefix&&Rn()&&(yield il(n.prefix,t,e,ln.value))}catch(n){}hn=Math.min(Math.floor(1.5*hn),$t.value),vl(hn)}}),{timeout:500})},e)))}function ml(){fn||At.value&&Pe.value&&qt()&&(Mt.value||en.value||(fn=!0,pn=0,wn=!0,yn=0,hn=jt.value,vl(hn)))}function fl(){return s(this,null,function*(){const e=Ne;Yt(e)&&(yield Ie().catch(t=>{Yt(e)&&(Pe.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t))}),Yt(e)&&(yield p(),Yt(e)&&(Tt.value||(Mt.value=!Pe.value),qt()&&(At.value?(Vt(),St.value=st.value.length):Mt.value||al()))))})}return h(Ve,e=>{_n.value&&e&&Wn()}),h(Nn,e=>{_n.value&&Ze.value&&(Ze.value.style.transform=e.transform)},{immediate:!0}),h(Cn,e=>{e||X()}),h(()=>st.value,e=>{if((e.trim()||!1===i.loading)&&(en.value=!1,nn.value={}),!At.value)return sl(),void(qt()&&!Mt.value&&al());qt()&&Vt(),!Mt.value&&Pe.value&&qt()?ml():sl(),function(){if(!At.value)return;if(!Mt.value)return;if(!Pe.value)return;const e=st.value.length;e!==St.value&&(Rt.value=!0,St.value=e,Lt&&clearTimeout(Lt),Lt=setTimeout(()=>{Rt.value&&Mt.value&&st.value.trim()&&(Rt.value=!1,nl("preview"))},Ft.value))}()}),h(()=>i.isDark,()=>s(null,null,function*(){var e;if(an.value)return;const t=i.isDark?"dark":"light",n=nn.value[t];if(n){if(Ue.value){const t=ze(Ue.value,n.svg);t&&(Ae=null!=(e=n.bindFunctions)?e:null,Le(t.bindTarget))}return}const l={zoom:wt.value,translateX:yt.value,translateY:kt.value,containerHeight:Gt.value},o=1!==wt.value||0!==yt.value||0!==kt.value;tn.value=!0,o&&(wt.value=1,yt.value=0,kt.value=0,yield p()),yield rl(),o&&(yield p(),wt.value=l.zoom,yt.value=l.translateX,kt.value=l.translateY,Gt.value=l.containerHeight,sn.value=l)})),h(()=>Mt.value,e=>s(null,null,function*(){var t;if(e)sl(),en.value&&(sn.value={zoom:wt.value,translateX:yt.value,translateY:kt.value,containerHeight:Gt.value});else{if(an.value)return;const e=i.isDark?"dark":"light";if(en.value&&nn.value[e]){if(yield p(),Ue.value){const n=nn.value[e],l=ze(Ue.value,n.svg);l&&(Ae=null!=(t=n.bindFunctions)?t:null,Le(l.bindTarget))}return wt.value=sn.value.zoom,yt.value=sn.value.translateX,kt.value=sn.value.translateY,void(Gt.value=sn.value.containerHeight)}if(yield p(),!Pe.value||!qt())return;if(!At.value)return sl(),void(yield al());ml(),yield ul()}})),h(()=>i.loading,(e,t)=>s(null,null,function*(){var n;if(e)dl();else if(!0===t){dl();const e=st.value,t=e.trim();if(!t)return Ue.value&&$e(Ue.value),ht.value=null,Pt="",an.value=!1,cl();if(!qt())return void cl();const r=i.isDark?"dark":"light",u=ll(e,r);if(en.value&&u.signature===Pt){if(yield p(),Ue.value&&!Ue.value.querySelector("svg")&&nn.value[r]){const e=nn.value[r],t=ze(Ue.value,e.svg);t&&(Ae=null!=(n=e.bindFunctions)?n:null,Le(t.bindTarget))}return Hn(void 0,{force:!0}),void cl()}const s=new AbortController;rn=s;try{let e=0;for(;;)try{yield $n(t,r,{signal:s.signal,timeoutMs:dn.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 kn(()=>new Promise(e=>setTimeout(e,o)),{signal:s.signal})}if(!(yield rl(u)))return;an.value=!1,cl()}catch(o){if(Mn(o))return;cl(),xn(o)}finally{rn===s&&(rn=null)}}})),h(qe,e=>{Qt&&Qt.disconnect(),e&&(Qt=new ResizeObserver(e=>{e&&e.length>0&&!Mt.value&&!Xe.value&&Q(()=>{Hn(e[0].contentRect.width)})}),Qt.observe(e))},{immediate:!0}),w(()=>{Re.value&&!qt()||fl()}),h(()=>Pe.value,e=>{Tt.value||(Mt.value=!e)}),h(()=>i.maxHeight,()=>{p(()=>{Hn()})}),h([()=>i.estimatedPreviewHeightPx,()=>st.value],()=>{en.value||gt()||Mt.value||(Gt.value=mt(),Jt.value=Gt.value)}),h(()=>Je.value,e=>s(null,null,function*(){e&&(Se.value?(en.value||(At.value?(Vt(),St.value=st.value.length):al()),i.loading||en.value||al(),!Mt.value&&Pe.value&&At.value&&ml()):yield fl())}),{immediate:!1}),y(()=>{Lt&&clearTimeout(Lt),Ut(),Qt&&Qt.disconnect(),on&&(on.abort(),on=null),dl(),sl(),Zt(),it()}),h(()=>Xe.value,e=>s(null,null,function*(){e?(sl(),on&&on.abort()):qt()&&!en.value&&(yield p(),At.value?(Vt(),ml()):Mt.value||al())}),{immediate:!1}),(e,t)=>(k(),x("div",{ref_key:"blockContainer",ref:Ye,class:b(["mermaid-block-container rounded-lg border overflow-hidden",[{"is-rendering":i.loading,dark:i.isDark}]]),"data-markstream-mermaid":"1","data-markstream-mode":Mt.value?"fallback":en.value?"preview":"pending","data-markstream-pending":un.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&&Pe.value?(k(),x("div",ce,[T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[Mt.value?"":"is-active"]]),onClick:t[0]||(t[0]=()=>tl("preview")),onMouseenter:t[1]||(t[1]=e=>En(e,C(He)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>En(e,C(He)("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(He)("common.preview")||"Preview"),1)])],34),T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[Mt.value?"is-active":""]]),onClick:t[3]||(t[3]=()=>tl("source")),onMouseenter:t[4]||(t[4]=e=>En(e,C(He)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>En(e,C(He)("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(He)("common.source")||"Source"),1)])],34)])):E("",!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(Oe),"aria-pressed":Xe.value,onClick:t[6]||(t[6]=e=>Xe.value=!Xe.value),onMouseenter:t[7]||(t[7]=e=>En(e,Xe.value?C(He)("common.expand")||"Expand":C(He)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>En(e,Xe.value?C(He)("common.expand")||"Expand":C(He)("common.collapse")||"Collapse")),onMouseleave:On,onBlur:On},[(k(),x("svg",{style:O({rotate:Xe.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)):E("",!0),i.showCopyButton?(k(),x("button",{key:1,class:b(Oe),onClick:Jn,onMouseenter:t[9]||(t[9]=e=>Pn(e)),onFocus:t[10]||(t[10]=e=>Pn(e)),onMouseleave:On,onBlur:On},[We.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)):E("",!0),i.showExportButton&&Pe.value?(k(),x("button",{key:2,class:b(`${Oe} ${An.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":C(He)("common.export")||"Export",disabled:An.value,onClick:Qn,onMouseenter:t[11]||(t[11]=e=>En(e,C(He)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>En(e,C(He)("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)):E("",!0),i.showFullscreenButton&&Pe.value?(k(),x("button",{key:3,class:b(`${Oe} ${An.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":_n.value?C(He)("common.minimize")||"Minimize":C(He)("common.open")||"Open",disabled:An.value,onClick:el,onMouseenter:t[13]||(t[13]=e=>En(e,_n.value?C(He)("common.minimize")||"Minimize":C(He)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>En(e,_n.value?C(He)("common.minimize")||"Minimize":C(He)("common.open")||"Open")),onMouseleave:On,onBlur:On},[_n.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)):E("",!0)]))])):E("",!0),P(T("div",{ref_key:"modeContainerRef",ref:ut},[Mt.value?(k(),x("div",{key:0,class:"mermaid-source-panel",style:O({minHeight:ft.value})},[T("pre",be,B(st.value),1)],4)):(k(),x("div",Me,[i.showZoomControls?(k(),x("div",Te,[T("div",Ce,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Yn,onMouseenter:t[15]||(t[15]=e=>En(e,C(He)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>En(e,C(He)("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:qn,onMouseenter:t[17]||(t[17]=e=>En(e,C(He)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>En(e,C(He)("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:Un,onMouseenter:t[19]||(t[19]=e=>En(e,C(He)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>En(e,C(He)("common.resetZoom")||"Reset zoom")),onMouseleave:On,onBlur:On},B(Math.round(100*wt.value))+"% ",33)])])):E("",!0),T("div",S({ref_key:"mermaidContainer",ref:qe,class:"mermaid-preview-area relative overflow-hidden block transition-[height] ease-out",style:{height:Gt.value}},R(cn.value,!0),{onMousedown:Vn,onMousemove:Zn,onMouseup:Kn,onMouseleave:Kn,onTouchstartPassive:Vn,onTouchmovePassive:Zn,onTouchendPassive:Kn}),[T("div",{"data-mermaid-wrapper":"",class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":xt.value}]),style:O(Nn.value)},[T("div",{ref_key:"mermaidContent",ref:Ue,class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:O({height:Jt.value})},null,4)],6)],16),(k(),D(F,{to:"body"},[T("div",{class:b(["markstream-vue",{dark:i.isDark}])},[j($,{name:"mermaid-dialog",appear:""},{default:z(()=>[_n.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",Be,[T("div",Ee,[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:qn},[...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:Un},B(Math.round(100*wt.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:Ve,class:"w-full h-full flex items-center justify-center p-4 overflow-hidden"},R(cn.value,!0),{onMousedown:Vn,onMousemove:Zn,onMouseup:Kn,onMouseleave:Kn,onTouchstartPassive:Vn,onTouchmovePassive:Zn,onTouchendPassive:Kn}),null,16)])])):E("",!0)]),_:1})],2)]))]))],512),[[L,!Xe.value]])],10,oe))}}),[["__scopeId","data-v-acf10812"]]);Pe.install=e=>{e.component(Pe.__name,Pe)};export{Pe as default};
1
+ var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,o=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={}))r.call(t,n)&&i(e,n,t[n]);if(l)for(var n of l(t))o.call(t,n)&&i(e,n,t[n]);return e},s=(e,t,n)=>new Promise((l,r)=>{var o=e=>{try{i(n.next(e))}catch(t){r(t)}},a=e=>{try{i(n.throw(e))}catch(t){r(t)}},i=e=>e.done?l(e.value):Promise.resolve(e.value).then(o,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 E,withDirectives as P,mergeProps as S,toHandlers as R,createBlock as D,Teleport as F,createVNode as $,Transition as j,withCtx as H,withModifiers as z,vShow as A}from"vue";import{createPanGesture as L}from"markstream-core";import{ay as _,aC as N,az as I,aB as W,ak as q,a9 as X,at as Y,G as U}from"./exports.js";import{p as V,g as Z,M as K,a as G,h as J,d as Q}from"./diagramHeight.js";import{e as ee}from"./mermaidSequenceSemicolons.js";import{M as te}from"./index2.js";import{safeRaf as ne}from"./utils/safeRaf.js";import{c as le,g as re,f as oe}from"./workers-mermaidWorkerClient.js";import{toSafeSvgElement as ae}from"stream-markdown-parser";const ie=["data-markstream-mode","data-markstream-pending"],ue={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)]"},se={key:0},ce={key:1,class:"flex items-center gap-x-2 overflow-hidden"},de=["innerHTML"],ve={key:2},me={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},fe={class:"flex items-center gap-x-1"},he={class:"flex items-center gap-x-1"},ge={key:4},pe={key:5,class:"mermaid-header-actions flex items-center"},we=["aria-pressed"],ye={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"},ke={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"},xe=["aria-label","disabled"],be=["aria-label","disabled"],Me={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"},Te={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"},Ce={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Be={key:1,class:"relative"},Oe={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Ee={class:"flex items-center gap-2 backdrop-blur rounded-lg"},Pe={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Se={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Re="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",De=/* @__PURE__ */U(/* @__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},fitPreviewHeight:{type:Boolean,default:!1},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(e,{emit:l}){var r,o;const i=e,c=l,U={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style","br"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},De=d(!1),Fe=d("undefined"==typeof window),$e=_(),je=N(),He=v(()=>i.isStrict?"strict":"loose"),ze=v(()=>({startOnLoad:!1,securityLevel:He.value,dompurifyConfig:"strict"===He.value?U:void 0,htmlLabels:"strict"!==He.value&&void 0,flowchart:"strict"===He.value?{htmlLabels:!1}:void 0}));function Ae(e){if(e)try{e.replaceChildren()}catch(t){e.innerHTML=""}}function Le(e,t,n={}){if(!e)return null;const l=function(e,t){if(!e)return null;const n=ae(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||Ae(e),l}let _e=null;function Ne(e){if(i.enableMermaidInteractions&&(null==e?void 0:e.querySelector("svg")))try{null==_e||_e(e)}catch(t){}}const{t:Ie}=I();let We=!1,qe=0;function Xe(){return s(this,null,function*(){try{const e=yield re();return We?null:(De.value=!!e,e)}catch(e){throw We||(De.value=!1),e}finally{We||(Fe.value=!0)}})}const Ye=d(!1),Ue=d(!1),Ve=d(),Ze=d(),Ke=d(),Ge=d(),Je=d(null),Qe=W(),et=d(null),tt=d("undefined"==typeof window||!$e.value),nt=m(),lt=f(te,null);let rt="",ot=0,at=0;const it=v(()=>q(i,nt));function ut(){const e=it.value;e&&(rt&&rt!==e&&(null==lt||lt.markSettled(rt),ot=0),rt=e,ot+=1,at+=1,1===ot&&(null==lt||lt.markPending(e)))}function st(){return s(this,null,function*(){const e=rt;if(!e)return;if(ot=Math.max(0,ot-1),ot>0)return;rt="";const t=++at;yield p(),t===at&&(function(e=it.value){e&&Ve.value&&(null==lt||lt.reportHeight(e,Ve.value.offsetHeight))}(e),null==lt||lt.markSettled(e))})}function ct(){const e=rt;e&&(rt="",ot=0,at+=1,null==lt||lt.markSettled(e))}const dt=d(),vt=v(()=>i.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function mt(e,t=vt.value){const n=t,l={theme:"dark"===e?"dark":"default"};"strict"===He.value&&(l.htmlLabels=!1,l.flowchart={htmlLabels:!1});const r=`%%{init: ${JSON.stringify(l)}}%%\n`;return n.trim().startsWith("%%{")?n:r+n}const ft=v(()=>{var e;return null!=(e=V(i.estimatedPreviewHeightPx))?e:Z(vt.value)});function ht(){return function(e){const t=function(){var e;const t=Ze.value?getComputedStyle(Ze.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=V(t))?e:360}(),n=qn();return Q(e,t,n)}(ft.value)}function gt(){return`${ht()}px`}const pt=d(null);function wt(){var e;return!!(null==(e=Ke.value)?void 0:e.querySelector("svg"))}function yt(){return!1!==i.loading&&(wt()||!!pt.value)}const kt=d(1),xt=d(0),bt=d(0),Mt=d(!1),Tt=d(!0),Ct=d(!1),Bt=d(!1),Ot=d(null),Et=d(!1);let Pt=null;function St(){null!=Pt&&(clearTimeout(Pt),Pt=null)}h([tt,Fe],([e,t])=>{St(),Et.value=!1,e&&!t&&(Pt=setTimeout(()=>{Pt=null,Et.value=!0},15e3))},{immediate:!0});const Rt=v(()=>{if((!Fe.value||De.value)&&Tt.value&&!Ct.value&&!Et.value)return gt()});let Dt="",Ft=!1,$t="";const jt=d(0),Ht=d(!1),zt=v(()=>{var e;return Math.max(0,null!=(e=i.renderDebounceMs)?e:300)}),At=v(()=>{var e;return Math.max(0,null!=(e=i.contentStableDelayMs)?e:500)}),Lt=v(()=>{var e;return Math.max(120,null!=(e=i.previewPollDelayMs)?e:800)}),_t=v(()=>{var e;return Math.max(Lt.value,null!=(e=i.previewPollMaxDelayMs)?e:4e3)}),Nt=v(()=>{var e;return Math.max(1,Math.trunc(null!=(e=i.previewPollMaxAttempts)?e:12))}),It=v(()=>!1!==i.loading);let Wt=null,qt=null,Xt=null,Yt=null,Ut=0;const Vt=null!=(r=globalThis.requestIdleCallback)?r:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Zt=null!=(o=globalThis.cancelIdleCallback)?o:e=>clearTimeout(e);function Kt(e=qe){return!We&&e===qe}function Gt(){return Kt()&&tt.value&&!Ue.value}function Jt(){null!=Xt&&(globalThis.clearTimeout(Xt),Xt=null),null!=Yt&&(Zt(Yt),Yt=null)}function Qt(){We||null==Xt&&null==Yt&&(Xt=globalThis.setTimeout(()=>{Xt=null,Gt()&&(Yt=Vt(()=>{Yt=null,Gt()&&hl()},{timeout:500}))},zt.value))}function en(){null!=qt&&(globalThis.clearTimeout(qt),qt=null)}function tn(e=600){if("undefined"==typeof globalThis||We)return;const t=Math.max(0,e);en(),qt=globalThis.setTimeout(()=>{if(qt=null,!We){if(i.loading||Bt.value||!Gt())return void tn(Math.min(1200,Math.max(300,1.2*t)));Qt()}},t)}const nn=d(gt()),ln=d(nn.value),rn=v(()=>i.fitPreviewHeight?`${K}px`:void 0);let on=null;const an=d(!1),un=d(!1),sn=d({}),cn=d(0);let dn=null,vn=null;const mn=d(!1),fn=v(()=>{var e,t;return!(Ue.value||Tt.value||Fe.value&&!Bt.value&&!Ot.value&&(an.value||mn.value&&Boolean(null==(t=null==(e=Ke.value)?void 0:e.textContent)?void 0:t.trim())))}),hn=d({zoom:1,translateX:0,translateY:0,containerHeight:nn.value}),gn=v(()=>i.enableWheelZoom?{wheel:rl}:{}),pn=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 wn=null,yn=null,kn=!1,xn=Lt.value,bn=null,Mn=0,Tn=!0,Cn=0;function Bn(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 r=null,o=!1,a=null;return new Promise((t,i)=>{const u=()=>{null!=r&&clearTimeout(r),a&&l&&l.removeEventListener("abort",a)};n&&n>0&&(r=globalThis.setTimeout(()=>{o||(o=!0,u(),i(new Error("Operation timed out")))},n)),l&&(a=()=>{o||(o=!0,u(),i(new DOMException("Aborted","AbortError")))},l.addEventListener("abort",a)),e().then(e=>{o||(o=!0,u(),t(e))}).catch(e=>{o||(o=!0,u(),i(e))})})}function On(e){if("undefined"==typeof document)return;if(!Ke.value)return;if("function"==typeof i.onRenderError&&!0===i.onRenderError(e,vt.value,Ke.value))return mn.value=!0,void gl();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),Ae(Ke.value),Ke.value.appendChild(t);const l=Ke.value?getComputedStyle(Ke.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";nn.value=l||"360px",ln.value=nn.value,mn.value=!0,gl()}function En(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 Pn(e){return"AbortError"===(null==e?void 0:e.name)}function Sn(e){return!En(e)&&!Pn(e)}"undefined"!=typeof window&&h([()=>Ve.value,$e],([e,t])=>{var n;if(null==(n=et.value)||n.destroy(),et.value=null,!t||tt.value)return void(tt.value=!0);if(!e)return void(tt.value=!1);const l=Qe(e,{rootMargin:null==je?void 0:je.value.heavyBlockMargin,allowIdle:!1});et.value=l,tt.value=l.isVisible.value,l.whenVisible.then(()=>{tt.value=!0})},{immediate:!0}),g(()=>{var e;We=!0,qe+=1,cn.value+=1,null==(e=et.value)||e.destroy(),et.value=null,ct(),Jt()});const Rn=v(()=>!1!==i.showTooltips);function Dn(e){return!e||e.disabled}function Fn(e,t,n="top"){if(!Rn.value)return;if(Dn(e.currentTarget))return;const l=e,r=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;Y(e.currentTarget,t,n,!1,r,i.isDark)}function $n(){Rn.value&&X()}function jn(e){if(!Rn.value)return;if(Dn(e.currentTarget))return;const t=Ye.value?Ie("common.copied")||"Copied":Ie("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;Y(e.currentTarget,t,"top",!1,l,i.isDark)}function Hn(e,t){const n={theme:"dark"===t?"dark":"default"};"strict"===He.value&&(n.htmlLabels=!1,n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%%\n`;return e.trimStart().startsWith("%%{")?e:l+e}function zn(){return Tn&&!Tt.value&&!an.value&&!mn.value}function An(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 Ln(e){if("gantt"===J(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(An(e))break;n.pop()}else n.pop()}return n.some(An)?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 _n(e,t,n,l){return s(this,null,function*(){try{return yield Bn(()=>e.render(t,n),{timeoutMs:l})}catch(r){if(!Sn(r))throw r;const a=ee(n);if(a===n)throw r;try{return yield Bn(()=>e.render(`${t}-retry`,a),{timeoutMs:l})}catch(o){throw r}}})}function Nn(e,t,n){return s(this,null,function*(){var l;try{return yield le(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:pn.value.worker,null==n?void 0:n.signal)}catch(r){if("AbortError"===(null==r?void 0:r.name))throw r;const l=(null==r?void 0:r.code)||(null==r?void 0:r.name);if("WORKER_BUSY"!==l&&"WORKER_TIMEOUT"!==l&&"WORKER_INIT_ERROR"!==l&&"MERMAID_DISABLED"!==l&&"WORKER_REPLACED"!==l||(null==r?void 0:r.fallbackToRenderer)||"WORKER_TIMEOUT"===l)return yield function(e,t,n){return s(this,null,function*(){var l,o,a,i;const u=yield Xe();if(!u)return;const s=u,c=Hn(e,t);if("function"==typeof s.parse){try{yield Bn(()=>s.parse(c),{timeoutMs:null!=(l=null==n?void 0:n.timeoutMs)?l:pn.value.parse,signal:null==n?void 0:n.signal})}catch(r){if(!Sn(r))throw r;const t=ee(c);if(t===c)throw r;try{yield Bn(()=>s.parse(t),{timeoutMs:null!=(o=null==n?void 0:n.timeoutMs)?o:pn.value.parse,signal:null==n?void 0:n.signal})}catch(v){throw r}}return!0}const d=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;try{yield Bn(()=>u.render(d,c),{timeoutMs:null!=(a=null==n?void 0:n.timeoutMs)?a:pn.value.render,signal:null==n?void 0:n.signal})}catch(r){if(!Sn(r))throw r;const t=ee(c);if(t===c)throw r;try{yield Bn(()=>u.render(`${d}-retry`,t),{timeoutMs:null!=(i=null==n?void 0:n.timeoutMs)?i:pn.value.render,signal:null==n?void 0:n.signal})}catch(v){throw r}}return!0})}(e,t,n);throw r}})}function In(e,t,n){return s(this,null,function*(){var l;if("gantt"===J(e)){const l=Ln(e);if(!l.trim())return{fullOk:!1,prefixOk:!1};try{if(yield Nn(l,t,n))return l===e?{fullOk:!0,prefixOk:!1}:{fullOk:!1,prefixOk:!0,prefix:l}}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return{fullOk:!1,prefixOk:!1}}try{if(yield Nn(e,t,n))return{fullOk:!0,prefixOk:!1}}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}let r=Ln(e);if(r&&r.trim()&&r!==e)try{try{const o=yield oe(e,t,null!=(l=null==n?void 0:n.timeoutMs)?l:pn.value.worker,null==n?void 0:n.signal);o&&o.trim()&&(r=o)}catch(o){}if(yield Nn(r,t,n))return{fullOk:!1,prefixOk:!0,prefix:r}}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return{fullOk:!1,prefixOk:!1}})}const Wn=v(()=>Tt.value||Bt.value||Ue.value);function qn(){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=Ze.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 Xn(e,t){if(!Ze.value||!Ke.value)return;const n=!(null==t?void 0:t.force)&&!1!==i.loading&&wt(),l=Ke.value.querySelector("svg");if(!l)return;let r=0,o=0;const a=l.getAttribute("viewBox"),u=l.getAttribute("width"),s=l.getAttribute("height");if(a){const e=a.split(" ");4===e.length&&(r=Number.parseFloat(e[2]),o=Number.parseFloat(e[3]))}if(r&&o||u&&s&&(r=Number.parseFloat(u),o=Number.parseFloat(s)),Number.isNaN(r)||Number.isNaN(o)||r<=0||o<=0)try{const e=l.getBBox();e&&e.width>0&&e.height>0&&(r=e.width,o=e.height)}catch(c){return void console.error("Failed to get SVG BBox:",c)}if(r>0&&o>0){const t=o/r,a=null!=e?e:Ze.value.clientWidth,u=l.getBoundingClientRect().width,s=u>0?u/Math.max(.01,kt.value):a,c=qn(),d=s*t,v=null==c?d:Math.min(d,c),m=i.fitPreviewHeight?G(v,K,c):Math.max(v,ht());n||!i.fitPreviewHeight&&null!=V(i.estimatedPreviewHeightPx)||(nn.value=`${m}px`),ln.value=nn.value}}const Yn=d(!1),Un=v(()=>({transform:`translate(${xt.value}px, ${bt.value}px) scale(${kt.value})`}));function Vn(e){"Escape"===e.key&&Yn.value&&Kn()}function Zn(){var e;if(!Ze.value||!Ge.value)return!1;if("1"===(null==(e=Ge.value.firstElementChild)?void 0:e.getAttribute("data-mermaid-modal-clone")))return!0;const t=Ze.value.cloneNode(!0);t.dataset.mermaidModalClone="1",t.classList.add("fullscreen"),t.style.height="100%",t.style.maxHeight="100%";const n=t.querySelector("._mermaid");n&&(n.style.contain="none",n.style.contentVisibility="visible");const l=t.querySelector("[data-mermaid-wrapper]");return l&&(Je.value=l,l.style.transform=Un.value.transform),Ae(Ge.value),Ge.value.appendChild(t),Ne(t),!0}function Kn(){if(Yn.value=!1,Ge.value&&Ae(Ge.value),Je.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",Vn)}catch(e){}}function Gn(){kt.value<3&&(kt.value+=.1)}function Jn(){kt.value>.5&&(kt.value-=.1)}function Qn(){kt.value=1,xt.value=0,bt.value=0}h(Ge,e=>{Yn.value&&e&&Zn()}),h(Un,e=>{Yn.value&&Je.value&&(Je.value.style.transform=e.transform)},{immediate:!0});const el=v(()=>Yn.value||kt.value>1),tl=L({getTranslate:()=>({x:xt.value,y:bt.value}),setTranslate:e=>{xt.value=e.x,bt.value=e.y},canStart:e=>!!wt()&&("touch"!==e.pointerType||el.value),onActiveChange:e=>Mt.value=e}),nl=tl.start,ll=tl.stop;function rl(e){if(i.enableWheelZoom&&(e.ctrlKey||e.metaKey)){if(e.preventDefault(),!Ze.value)return;const t=Ze.value.getBoundingClientRect(),n=e.clientX-t.left,l=e.clientY-t.top,r=n-t.width/2,o=l-t.height/2,a=(r-xt.value)/kt.value,i=(o-bt.value)/kt.value,u=.01,s=-e.deltaY*u,c=Math.min(Math.max(kt.value+s,.5),3);c!==kt.value&&(xt.value=r-a*c,bt.value=o-i*c,kt.value=c)}}function ol(){return s(this,null,function*(){try{const e=vt.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 al(){var e;const t=null==(e=Ke.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),r=new Blob([l],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r);if("undefined"!=typeof document){const e=document.createElement("a");e.href=o,e.download=`mermaid-diagram-${Date.now()}.svg`;try{document.body.appendChild(e),e.click(),document.body.removeChild(e)}catch(n){}URL.revokeObjectURL(o)}}catch(l){console.error("Failed to export SVG:",l)}})}(t,n)}function il(){var e,t;const n=null!=(t=null==(e=Ke.value)?void 0:e.querySelector("svg"))?t:null,l=n?(new XMLSerializer).serializeToString(n):null,r={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:n,svgString:l};c("openModal",r),r.defaultPrevented||function(){if(Yn.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",Vn)}catch(e){}p(()=>{Zn()||p(Zn)})}()}function ul(e){const t={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};c("toggleMode",e,t),t.defaultPrevented||sl(e)}function sl(e){return s(this,null,function*(){const t=dt.value;if(!t)return Ct.value=!0,void(Tt.value="source"===e);const n=t.getBoundingClientRect().height;t.style.height=`${n}px`,t.style.overflow="hidden",Ct.value=!0,Tt.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 r=()=>{t.style.transition="",t.style.height="",t.style.overflow="",t.removeEventListener("transitionend",o)};function o(){r()}t.addEventListener("transitionend",o),setTimeout(()=>r(),220)})}function cl(e=vt.value,t=(i.isDark?"dark":"light"),n=!1===i.loading){return{code:e,codeWithTheme:mt(t,e),final:n,signature:`${t}\0${e}`,theme:t}}function dl(e){return e.signature===cl().signature}function vl(){return s(this,arguments,function*(e=cl()){const l=qe;if(!Kt(l)||!dl(e))return!1;if(Bt.value){const t=Ot.value,n=Ft,r=Dt;if(!t)return!1;const o=yield t;return!(!Kt(l)||!dl(e))&&(r===e.signature?!(!o||$t!==e.signature)||!(!e.final||!1!==i.loading||n)&&vl(e):vl(e))}if(!Ke.value){if(yield p(),!Kt(l))return!1;if(!Ke.value)return console.warn("Mermaid container not ready"),!1}return!(!Kt(l)||!dl(e))&&(Bt.value=!0,Ft=e.final,Dt=e.signature,ut(),Ot.value=s(null,null,function*(){var r,o,a,s;try{const c=yield Xe();if(!Kt(l)||!c)return!1;const d=`mermaid-${Date.now()}-${Math.random().toString(36).substring(2,11)}`;an.value||un.value||null==(r=c.initialize)||r.call(c,(a=u({},ze.value),s={dompurifyConfig:u({},U)},t(a,n(s))));const v=yield _n(c,d,e.codeWithTheme,pn.value.fullRender);if(!Kt(l)||!function(e){return dl(e)||!e.final&&!1!==i.loading&&vt.value.startsWith(e.code)}(e))return un.value&&(un.value=!1),!1;if(!Ke.value)return!1;const m=Le(Ke.value,null==v?void 0:v.svg,{keepPreviousOnFailure:!e.final||!1!==i.loading});if(!m)return un.value&&(un.value=!1),!1;const f=null!=(o=null==v?void 0:v.bindFunctions)?o:null;return _e=f,Ne(m.bindTarget),ne(()=>Xn()),an.value||un.value||(an.value=!0,hn.value={zoom:kt.value,translateX:xt.value,translateY:bt.value,containerHeight:nn.value}),sn.value[e.theme]={svg:m.svg,bindFunctions:f},un.value&&(un.value=!1),$t=e.signature,pt.value=Ke.value.innerHTML,mn.value=!1,Ut=0,en(),!0}catch(c){if(!Kt(l)||!dl(e))return un.value&&(un.value=!1),!1;const t=En(c),n=Ut+1;return t&&n<=3?(Ut=n,tn(Math.min(1200,600*n))):(Ut=0,en(),e.final&&!1===i.loading&&console.error("Failed to render mermaid diagram:",c),e.final&&!1===i.loading&&On(c)),!1}finally{Ft=!1,Dt="",Bt.value=!1,Ot.value=null,Kt(l)&&st()}}),Ot.value)})}function ml(){return s(this,null,function*(){var e;const t=vt.value;if(!t.trim()){if(yt())return;return Ke.value&&Ae(Ke.value),pt.value=null,$t="",void(mn.value=!1)}if(!De.value||!Gt())return;const n=cl(t);an.value&&n.signature===$t&&(null==(e=Ke.value)?void 0:e.querySelector("svg"))||(yield vl(n))&&(mn.value=!1)})}function fl(e,t,n,l){return s(this,null,function*(){const r=qe;if(!Kt(r)||!zn())return;if(!Ke.value&&(yield p(),!Kt(r)||!Ke.value))return;if(Bt.value)return;Bt.value=!0,ut();const o=cl(t,n),a=s(null,null,function*(){var t;try{const a=yield Xe();if(!Kt(r)||!a)return!1;const u=`mermaid-partial-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,s=Ln(e),c=s&&s.trim()?s:e,d=yield _n(a,u,Hn(c,n),pn.value.render);if(!Kt(r)||cn.value!==l||!1===i.loading||!zn()||!dl(o))return!1;const v=null==d?void 0:d.svg;if(!Ke.value||!v)return!1;const m=Le(Ke.value,v,{keepPreviousOnFailure:!0});return!!m&&(_e=null!=(t=null==d?void 0:d.bindFunctions)?t:null,Ne(m.bindTarget),ne(()=>Xn()),!1)}catch(u){return!1}finally{Ot.value===a&&(Bt.value=!1,Ot.value=null),Kt(r)&&st()}});return Ot.value=a,a})}function hl(){return s(this,null,function*(){var e;if(!Gt())return;const t=qe,n=Date.now(),l=++cn.value;ut();try{dn&&dn.abort(),dn=new AbortController;const o=dn.signal,a=i.isDark?"dark":"light",u=vt.value;if(!u.trim()){if(yt())return;return Ke.value&&Ae(Ke.value),pt.value=null,$t="",void(mn.value=!1)}if(cl(u,a).signature===$t)return;try{const e=yield In(u,a,{signal:o,timeoutMs:pn.value.worker});if(!Kt(t))return;if(e.fullOk){if(o.aborted||cn.value!==l)return;if(!(yield vl(cl(u,a))))return;return void(Kt(t)&&cn.value===l&&(mn.value=!1))}const r=Mn&&n<=Mn;if(e.prefixOk&&e.prefix&&!o.aborted&&cn.value===l&&zn()&&!r)return void(yield fl(e.prefix,u,a,l))}catch(r){if("AbortError"===(null==r?void 0:r.name))return}if(!Kt(t)||cn.value!==l)return;if(mn.value)return;const s=sn.value[a];if(s&&Ke.value){const t=Le(Ke.value,s.svg);t&&(_e=null!=(e=s.bindFunctions)?e:null,Ne(t.bindTarget))}}finally{Kt(t)&&st()}})}function gl(){kn&&(kn=!1,xn=Lt.value,Tn=!1,bn&&(bn.abort(),bn=null),wn&&(globalThis.clearTimeout(wn),wn=null),yn&&(Zt(yn),yn=null),Mn=Date.now())}function pl(){if(gl(),Jt(),dn){try{dn.abort()}catch(e){}dn=null}if(bn){try{bn.abort()}catch(e){}bn=null}en(),Ut=0}function wl(){null==vn||vn.abort(),vn=null}function yl(e=Lt.value){kn&&(Cn>=Nt.value?gl():(wn&&globalThis.clearTimeout(wn),wn=globalThis.setTimeout(()=>{yn=Vt(()=>s(null,null,function*(){if(!kn)return;if(!Gt())return void gl();if(Tt.value||an.value)return void gl();const e=i.isDark?"dark":"light",t=vt.value;if(!t.trim())return!1===i.loading?void gl():void yl(xn);if(Cn++,Cn>Nt.value)gl();else{bn&&bn.abort(),bn=new AbortController;try{const n=yield In(t,e,{signal:bn.signal,timeoutMs:pn.value.worker});if(n.fullOk){if((yield vl(cl(t,e)))&&an.value)return void gl()}else n.prefixOk&&n.prefix&&zn()&&(yield fl(n.prefix,t,e,cn.value))}catch(n){}xn=Math.min(Math.floor(1.5*xn),_t.value),yl(xn)}}),{timeout:500})},e)))}function kl(){kn||It.value&&De.value&&Gt()&&(Tt.value||an.value||(kn=!0,Mn=0,Tn=!0,Cn=0,xn=Lt.value,yl(xn)))}function xl(){return s(this,null,function*(){const e=qe;Kt(e)&&(yield Xe().catch(t=>{Kt(e)&&(De.value=!1,console.warn("[markstream-vue] Failed to initialize mermaid renderer. Call enableMermaid() to configure a loader.",t))}),Kt(e)&&(yield p(),Kt(e)&&(Ct.value||(Tt.value=!De.value),Gt()&&(It.value?(Qt(),jt.value=vt.value.length):Tt.value||ml()))))})}return g(ll),h(Rn,e=>{e||X()}),h(()=>vt.value,e=>{if((e.trim()||!1===i.loading)&&(an.value=!1,sn.value={}),!It.value)return gl(),void(Gt()&&!Tt.value&&ml());Gt()&&Qt(),!Tt.value&&De.value&&Gt()?kl():gl(),function(){if(!It.value)return;if(!Tt.value)return;if(!De.value)return;const e=vt.value.length;e!==jt.value&&(Ht.value=!0,jt.value=e,Wt&&clearTimeout(Wt),Wt=setTimeout(()=>{Ht.value&&Tt.value&&vt.value.trim()&&(Ht.value=!1,sl("preview"))},At.value))}()}),h(()=>i.isDark,()=>s(null,null,function*(){var e;if(mn.value)return;const t=i.isDark?"dark":"light",n=sn.value[t];if(n){if(Ke.value){const t=Le(Ke.value,n.svg);t&&(_e=null!=(e=n.bindFunctions)?e:null,Ne(t.bindTarget))}return}const l={zoom:kt.value,translateX:xt.value,translateY:bt.value,containerHeight:nn.value},r=1!==kt.value||0!==xt.value||0!==bt.value;un.value=!0,r&&(kt.value=1,xt.value=0,bt.value=0,yield p()),yield vl(),r&&(yield p(),kt.value=l.zoom,xt.value=l.translateX,bt.value=l.translateY,nn.value=l.containerHeight,hn.value=l)})),h(()=>Tt.value,e=>s(null,null,function*(){var t;if(e)gl(),an.value&&(hn.value={zoom:kt.value,translateX:xt.value,translateY:bt.value,containerHeight:nn.value});else{if(mn.value)return;const e=i.isDark?"dark":"light";if(an.value&&sn.value[e]){if(yield p(),Ke.value){const n=sn.value[e],l=Le(Ke.value,n.svg);l&&(_e=null!=(t=n.bindFunctions)?t:null,Ne(l.bindTarget))}return kt.value=hn.value.zoom,xt.value=hn.value.translateX,bt.value=hn.value.translateY,void(nn.value=hn.value.containerHeight)}if(yield p(),!De.value||!Gt())return;if(!It.value)return gl(),void(yield ml());kl(),yield hl()}})),h(()=>i.loading,(e,t)=>s(null,null,function*(){var n;if(e)wl();else if(!0===t){wl();const e=vt.value,t=e.trim();if(!t)return Ke.value&&Ae(Ke.value),pt.value=null,$t="",mn.value=!1,pl();if(!Gt())return void pl();const o=i.isDark?"dark":"light",u=cl(e,o);if(an.value&&u.signature===$t){if(yield p(),Ke.value&&!Ke.value.querySelector("svg")&&sn.value[o]){const e=sn.value[o],t=Le(Ke.value,e.svg);t&&(_e=null!=(n=e.bindFunctions)?n:null,Ne(t.bindTarget))}return Xn(void 0,{force:!0}),void pl()}const s=new AbortController;vn=s;try{let e=0;for(;;)try{yield Nn(t,o,{signal:s.signal,timeoutMs:pn.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 r=Math.min(50*a(2,e),400);e++,yield Bn(()=>new Promise(e=>setTimeout(e,r)),{signal:s.signal})}if(!(yield vl(u)))return;mn.value=!1,pl()}catch(r){if(Pn(r))return;pl(),On(r)}finally{vn===s&&(vn=null)}}})),h(Ze,e=>{on&&on.disconnect(),e&&(on=new ResizeObserver(e=>{e&&e.length>0&&!Tt.value&&!Ue.value&&ne(()=>{Xn(e[0].contentRect.width)})}),on.observe(e))},{immediate:!0}),w(()=>{$e.value&&!Gt()||xl()}),h(()=>De.value,e=>{Ct.value||(Tt.value=!e)}),h(()=>i.maxHeight,()=>{p(()=>{Xn()})}),h([()=>i.estimatedPreviewHeightPx,()=>vt.value],()=>{an.value||wt()||Tt.value||(nn.value=gt(),ln.value=nn.value)}),h(()=>tt.value,e=>s(null,null,function*(){e&&(Fe.value?(an.value||(It.value?(Qt(),jt.value=vt.value.length):ml()),i.loading||an.value||ml(),!Tt.value&&De.value&&It.value&&kl()):yield xl())}),{immediate:!1}),y(()=>{Wt&&clearTimeout(Wt),St(),Jt(),on&&on.disconnect(),dn&&(dn.abort(),dn=null),wl(),gl(),en(),ct()}),h(()=>Ue.value,e=>s(null,null,function*(){e?(gl(),dn&&dn.abort()):Gt()&&!an.value&&(yield p(),It.value?(Qt(),kl()):Tt.value||ml())}),{immediate:!1}),(e,t)=>(k(),x("div",{ref_key:"blockContainer",ref:Ve,class:b(["mermaid-block-container rounded-lg border overflow-hidden",[{"is-rendering":i.loading,dark:i.isDark}]]),"data-markstream-mermaid":"1","data-markstream-mode":Tt.value?"fallback":an.value?"preview":"pending","data-markstream-pending":fn.value?"true":void 0},[i.showHeader?(k(),x("div",ue,[e.$slots["header-left"]?(k(),x("div",se,[M(e.$slots,"header-left",{},void 0,!0)])):(k(),x("div",ce,[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,de),t[23]||(t[23]=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",ve,[M(e.$slots,"header-center",{},void 0,!0)])):i.showModeToggle&&De.value?(k(),x("div",me,[T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[Tt.value?"":"is-active"]]),onClick:t[0]||(t[0]=()=>ul("preview")),onMouseenter:t[1]||(t[1]=e=>Fn(e,C(Ie)("common.preview")||"Preview")),onFocus:t[2]||(t[2]=e=>Fn(e,C(Ie)("common.preview")||"Preview")),onMouseleave:$n,onBlur:$n},[T("div",fe,[t[24]||(t[24]=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(Ie)("common.preview")||"Preview"),1)])],34),T("button",{class:b(["mermaid-mode-btn px-2 py-0.5 rounded transition-colors",[Tt.value?"is-active":""]]),onClick:t[3]||(t[3]=()=>ul("source")),onMouseenter:t[4]||(t[4]=e=>Fn(e,C(Ie)("common.source")||"Source")),onFocus:t[5]||(t[5]=e=>Fn(e,C(Ie)("common.source")||"Source")),onMouseleave:$n,onBlur:$n},[T("div",he,[t[25]||(t[25]=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(Ie)("common.source")||"Source"),1)])],34)])):O("",!0),e.$slots["header-right"]?(k(),x("div",ge,[M(e.$slots,"header-right",{},void 0,!0)])):(k(),x("div",pe,[i.showCollapseButton?(k(),x("button",{key:0,class:b(Re),"aria-pressed":Ue.value,onClick:t[6]||(t[6]=e=>Ue.value=!Ue.value),onMouseenter:t[7]||(t[7]=e=>Fn(e,Ue.value?C(Ie)("common.expand")||"Expand":C(Ie)("common.collapse")||"Collapse")),onFocus:t[8]||(t[8]=e=>Fn(e,Ue.value?C(Ie)("common.expand")||"Expand":C(Ie)("common.collapse")||"Collapse")),onMouseleave:$n,onBlur:$n},[(k(),x("svg",{style:E({rotate:Ue.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[26]||(t[26]=[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,we)):O("",!0),i.showCopyButton?(k(),x("button",{key:1,class:b(Re),onClick:ol,onMouseenter:t[9]||(t[9]=e=>jn(e)),onFocus:t[10]||(t[10]=e=>jn(e)),onMouseleave:$n,onBlur:$n},[Ye.value?(k(),x("svg",ke,[...t[28]||(t[28]=[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",ye,[...t[27]||(t[27]=[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&&De.value?(k(),x("button",{key:2,class:b(`${Re} ${Wn.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":C(Ie)("common.export")||"Export",disabled:Wn.value,onClick:al,onMouseenter:t[11]||(t[11]=e=>Fn(e,C(Ie)("common.export")||"Export")),onFocus:t[12]||(t[12]=e=>Fn(e,C(Ie)("common.export")||"Export")),onMouseleave:$n,onBlur:$n},[...t[29]||(t[29]=[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,xe)):O("",!0),i.showFullscreenButton&&De.value?(k(),x("button",{key:3,class:b(`${Re} ${Wn.value?"opacity-50 cursor-not-allowed":""}`),"aria-label":Yn.value?C(Ie)("common.minimize")||"Minimize":C(Ie)("common.open")||"Open",disabled:Wn.value,onClick:il,onMouseenter:t[13]||(t[13]=e=>Fn(e,Yn.value?C(Ie)("common.minimize")||"Minimize":C(Ie)("common.open")||"Open")),onFocus:t[14]||(t[14]=e=>Fn(e,Yn.value?C(Ie)("common.minimize")||"Minimize":C(Ie)("common.open")||"Open")),onMouseleave:$n,onBlur:$n},[Yn.value?(k(),x("svg",Te,[...t[31]||(t[31]=[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",Me,[...t[30]||(t[30]=[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,be)):O("",!0)]))])):O("",!0),P(T("div",{ref_key:"modeContainerRef",ref:dt},[Tt.value?(k(),x("div",{key:0,class:"mermaid-source-panel",style:E({minHeight:Rt.value})},[T("pre",Ce,B(vt.value),1)],4)):(k(),x("div",Be,[i.showZoomControls?(k(),x("div",Oe,[T("div",Ee,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Gn,onMouseenter:t[15]||(t[15]=e=>Fn(e,C(Ie)("common.zoomIn")||"Zoom in")),onFocus:t[16]||(t[16]=e=>Fn(e,C(Ie)("common.zoomIn")||"Zoom in")),onMouseleave:$n,onBlur:$n},[...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)])],32),T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Jn,onMouseenter:t[17]||(t[17]=e=>Fn(e,C(Ie)("common.zoomOut")||"Zoom out")),onFocus:t[18]||(t[18]=e=>Fn(e,C(Ie)("common.zoomOut")||"Zoom out")),onMouseleave:$n,onBlur:$n},[...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)])],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=>Fn(e,C(Ie)("common.resetZoom")||"Reset zoom")),onFocus:t[20]||(t[20]=e=>Fn(e,C(Ie)("common.resetZoom")||"Reset zoom")),onMouseleave:$n,onBlur:$n},B(Math.round(100*kt.value))+"% ",33)])])):O("",!0),T("div",S({ref_key:"mermaidContainer",ref:Ze,class:["mermaid-preview-area relative overflow-hidden block transition-[height] ease-out",{"mermaid-pan-touch":el.value}],style:{height:nn.value,minHeight:rn.value}},R(gn.value,!0),{onPointerdown:t[21]||(t[21]=(...e)=>C(nl)&&C(nl)(...e))}),[T("div",{"data-mermaid-wrapper":"",class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":Mt.value}]),style:E(Un.value)},[T("div",{ref_key:"mermaidContent",ref:Ke,class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:E({height:ln.value})},null,4)],6)],16),(k(),D(F,{to:"body"},[T("div",{class:b(["markstream-vue",{dark:i.isDark}])},[$(j,{name:"mermaid-dialog",appear:""},{default:H(()=>[Yn.value?(k(),x("div",{key:0,class:"mermaid-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:z(Kn,["self"])},[T("div",Pe,[T("div",Se,[T("button",{class:"mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Gn},[...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("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:Jn},[...t[35]||(t[35]=[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*kt.value))+"% ",1),T("button",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded transition-colors",onClick:Kn},[...t[36]||(t[36]=[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:Ge,class:["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"mermaid-pan-touch":el.value}]},R(gn.value,!0),{onPointerdown:t[22]||(t[22]=(...e)=>C(nl)&&C(nl)(...e))}),null,16)])])):O("",!0)]),_:1})],2)]))]))],512),[[A,!Ue.value]])],10,ie))}}),[["__scopeId","data-v-a0530481"]]);De.install=e=>{e.component(De.__name,De)};export{De as default};
package/dist/index7.js CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,r=(e,r)=>{for(var a in r||(r={}))n.call(r,a)&&l(e,a,r[a]);if(t)for(var a of t(r))o.call(r,a)&&l(e,a,r[a]);return e},a=(e,t,n)=>new Promise((o,l)=>{var r=e=>{try{i(n.next(e))}catch(t){l(t)}},a=e=>{try{i(n.throw(e))}catch(t){l(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,a);i((n=n.apply(e,t)).next())});import{defineComponent as i,useAttrs as u,inject as s,ref as d,computed as c,watch as v,nextTick as m,onMounted as p,onBeforeUnmount as f,openBlock as g,createElementBlock as h,normalizeClass as y,createElementVNode as w,unref as k,toDisplayString as b,createCommentVNode as x,normalizeStyle as B,withDirectives as D,vShow as M}from"vue";import{az as C,aB as E,aC as T,ay as A,ak as j,at as O,a9 as I,a0 as H,G as F}from"./exports.js";import{M as S}from"./index2.js";const L=["data-markstream-mode","data-markstream-pending"],N={key:0,class:"d2-block-header flex justify-between items-center border-b"},P={class:"d2-header-actions flex items-center"},R={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},_=["aria-label"],U={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},V={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},X=["aria-label"],Y=["aria-pressed"],q={key:0,class:"d2-source"},z={class:"d2-code"},$={key:0,class:"d2-error mt-2 text-xs"},G={key:1},J={key:0,class:"d2-source"},K={class:"d2-code"},Q={key:0,class:"d2-error mt-2 text-xs"},W=["innerHTML"],Z={key:0,class:"d2-error px-4 pb-3 text-xs"},ee=/* @__PURE__ */F(/* @__PURE__ */i({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const t=e,n=u(),o=s(S,null),{t:l}=C(),i=d(!1),F=d(!1),ee=d(!1),te=d(!1),ne=d(null),oe=d(!1),le=d(""),re=d(""),ae=d(0),ie=d(""),ue=d(""),se=d(null),de=d(null),ce=d(null),ve=E(),me=T(),pe=A(),fe=d(null),ge="undefined"!=typeof window,he=d(!1),ye=d("undefined"==typeof window||!pe.value),we=c(()=>{var e;return null!=(e=t.node.code)?e:""}),ke=c(()=>j(t,n)),be=c(()=>{var e,n;return[t.isDark?"dark":"light",null!=(e=t.themeId)?e:"auto",null!=(n=t.darkThemeId)?n:"auto",we.value].join(":")}),xe=c(()=>!!le.value&&re.value===be.value),Be=c(()=>{if(!he.value||!we.value||ee.value)return!1;const e=be.value;return!!oe.value||ie.value!==e&&(!ne.value||ue.value!==e)}),De=c(()=>xe.value||!!le.value&&Be.value),Me=c(()=>ee.value||!te.value||!De.value),Ce=c(()=>{if(Me.value&&de.value)return{minHeight:`${de.value}px`}}),Ee=c(()=>{if("none"===t.maxHeight)return{maxHeight:"none","--ms-d2-render-max-height":"none"};if(null!=t.maxHeight){const e="number"==typeof t.maxHeight?`${t.maxHeight}px`:String(t.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}}});let Te=null,Ae=!1,je=!1,Oe=0,Ie=null,He=!1,Fe=null,Se="";"undefined"!=typeof window&&v([()=>ce.value,pe],([e,t])=>{var n,o,l;if(null==(n=fe.value)||n.destroy(),fe.value=null,!t||ye.value)return void(ye.value=!0);if(!e)return void(ye.value=!1);const r=null!=(l=null!=(o=null==me?void 0:me.value.heavyBlockMargin)?o:null==me?void 0:me.value.rootMargin)?l:"160px",a=ve(e,{rootMargin:r,allowIdle:!1});fe.value=a,ye.value=a.isVisible.value,a.whenVisible.then(()=>{ye.value=!0})},{immediate:!0});const Le={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Ne(e){return!e||e.disabled}function Pe(e,n,o="top"){if(Ne(e.currentTarget))return;const l=e,r=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;O(e.currentTarget,n,o,!1,r,t.isDark)}function Re(){I()}function _e(e){if(Ne(e.currentTarget))return;const n=i.value?l("common.copied")||"Copied":l("common.copy")||"Copy",o=e,r=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;O(e.currentTarget,n,"top",!1,r,t.isDark)}function Ue(){return a(this,null,function*(){try{const e=we.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function Ve(){F.value=!F.value}function Xe(e){ee.value="source"===e}const Ye=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function ze(e){if(!e)return"";const t=e.trim();return qe.test(t)?t:""}function $e(){le.value="",re.value=""}function Ge(e){return je||e!==ae.value}function Je(){return a(this,null,function*(){var e,n,l,i,u;if(!ge||je)return;if(!ye.value)return;if(t.loading&&!t.progressiveRender)return;const s=be.value;if(s===ie.value&&!ne.value&&xe.value)return te.value=!0,void(t.loading&&(ee.value=!1));const d=we.value;if(!d)return $e(),ne.value=null,ie.value="",void(ue.value="");const c=++ae.value;oe.value=!0,ne.value=null,ue.value="",function(){const e=ke.value;o&&e&&Se!==e&&(Se&&o.markSettled(Se),Se=e,o.markPending(e))}();try{const o=yield function(){return a(this,null,function*(){if(Te)return Te;const e=yield H();if(je||!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?Te=t:"function"==typeof e.compile&&(Te=e),Te}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(Te=new e.D2,Te):("function"==typeof e.compile&&(Te=e),Te)})}();if(Ge(c))return;if(!o)return te.value=!1,ee.value=!0,$e(),ne.value="D2 is not available.",void(ue.value=s);if("function"!=typeof o.compile||"function"!=typeof o.render)throw new TypeError("D2 instance is missing compile/render methods.");te.value=!0;const v=yield o.compile(d);if(Ge(c))return;const m=null!=(e=null==v?void 0:v.diagram)?e:v,p=null!=(l=null!=(n=null==v?void 0:v.renderOptions)?n:null==v?void 0:v.options)?l:{},f=null!=(i=t.themeId)?i:p.themeID,g=null!=(u=t.darkThemeId)?u:p.darkThemeID,h=r({},p);if(h.themeID=t.isDark&&null!=g?g:f,h.darkThemeID=null,h.darkThemeOverrides=null,t.isDark){const e=p.themeOverrides&&"object"==typeof p.themeOverrides?p.themeOverrides:null;h.themeOverrides=r(r({},Le),e||{})}const y=yield o.render(m,h);if(Ge(c))return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(y);if(!w)throw new Error("D2 render returned empty output.");!function(e,t){const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ye.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=ze(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(e);le.value=n||"",re.value=n?t:""}(w,s),ie.value=s,ue.value="",t.loading&&(ee.value=!1),ne.value=null}catch(v){if(Ge(c))return;const e=(null==v?void 0:v.message)?String(v.message):"D2 render failed.";t.loading||(ne.value=e,ue.value=s),ie.value="",e.includes("@terrastruct/d2")&&(te.value=!1,ee.value=!0)}finally{Ge(c)||(oe.value=!1,He?(He=!1,Ke()):function(){const e=Se;o&&e&&(Se="",m(()=>{var t,n;if(!je){const l=null!=(n=null==(t=ce.value)?void 0:t.offsetHeight)?n:0;l>0&&o.reportHeight(e,l)}o.markSettled(e)}))}())}})}function Ke(e=!1){if(Ae)return;if(!ge)return;if(je)return;if(oe.value)return void(He=!0);const n=Math.max(120,Number(t.progressiveIntervalMs)||0),o=Date.now()-Oe;if(!e&&o<n)return He=!0,void(null==Ie&&(Ie=window.setTimeout(()=>{Ie=null,He&&(He=!1,Ke(!0))},Math.max(0,n-o))));Ae=!0;const l=()=>{Ae=!1,Oe=Date.now(),Je()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(l):setTimeout(l,0)}function Qe(){if(xe.value)try{const e=new Blob([le.value],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}}function We(){const e=se.value;if(!e)return;const t=e.getBoundingClientRect().height;t>0&&(de.value=t)}return v(()=>[t.node.code,t.loading,t.isDark,t.themeId,t.darkThemeId],()=>{Ke()},{immediate:!0}),v(()=>t.loading,(e,t)=>{t&&!e&&Ke(!0)}),v(()=>ye.value,e=>{e&&Ke(!0)}),v(()=>[Me.value,le.value,we.value],()=>{m(()=>{We()})}),p(()=>{he.value=!0,m(()=>{We()}),"undefined"!=typeof ResizeObserver&&(Fe=new ResizeObserver(()=>{We()}),se.value&&Fe.observe(se.value))}),f(()=>{var e;je=!0,ae.value+=1,He=!1,function(){const e=Se;o&&e&&(Se="",o.markSettled(e))}(),ie.value="",null==(e=fe.value)||e.destroy(),fe.value=null,null!=Ie&&(clearTimeout(Ie),Ie=null),null==Fe||Fe.disconnect(),Fe=null}),(e,n)=>(g(),h("div",{ref_key:"viewportTarget",ref:ce,class:y(["d2-block-container rounded-lg border overflow-hidden",{dark:t.isDark}]),"data-markstream-d2":"1","data-markstream-mode":Me.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[t.showHeader?(g(),h("div",N,[n[16]||(n[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),w("div",P,[t.showModeToggle?(g(),h("div",R,[w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"":"is-active"]),onClick:n[0]||(n[0]=e=>Xe("preview")),onMouseenter:n[1]||(n[1]=e=>Pe(e,k(l)("common.preview")||"Preview")),onFocus:n[2]||(n[2]=e=>Pe(e,k(l)("common.preview")||"Preview")),onMouseleave:Re,onBlur:Re},b(k(l)("common.preview")||"Preview"),35),w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",ee.value?"is-active":""]),onClick:n[3]||(n[3]=e=>Xe("source")),onMouseenter:n[4]||(n[4]=e=>Pe(e,k(l)("common.source")||"Source")),onFocus:n[5]||(n[5]=e=>Pe(e,k(l)("common.source")||"Source")),onMouseleave:Re,onBlur:Re},b(k(l)("common.source")||"Source"),35)])):x("",!0),t.showCopyButton?(g(),h("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":i.value?k(l)("common.copied")||"Copied":k(l)("common.copy")||"Copy",onClick:Ue,onMouseenter:n[6]||(n[6]=e=>_e(e)),onFocus:n[7]||(n[7]=e=>_e(e)),onMouseleave:Re,onBlur:Re},[i.value?(g(),h("svg",V,[...n[13]||(n[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(g(),h("svg",U,[...n[12]||(n[12]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,_)):x("",!0),t.showExportButton&&xe.value?(g(),h("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":k(l)("common.export")||"Export",onClick:Qe,onMouseenter:n[8]||(n[8]=e=>Pe(e,k(l)("common.export")||"Export")),onFocus:n[9]||(n[9]=e=>Pe(e,k(l)("common.export")||"Export")),onMouseleave:Re,onBlur:Re},[...n[14]||(n[14]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,X)):x("",!0),t.showCollapseButton?(g(),h("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":F.value,onClick:Ve,onMouseenter:n[10]||(n[10]=e=>Pe(e,F.value?k(l)("common.expand")||"Expand":k(l)("common.collapse")||"Collapse")),onFocus:n[11]||(n[11]=e=>Pe(e,F.value?k(l)("common.expand")||"Expand":k(l)("common.collapse")||"Collapse")),onMouseleave:Re,onBlur:Re},[(g(),h("svg",{style:B({rotate:F.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...n[15]||(n[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,Y)):x("",!0)])])):x("",!0),D(w("div",{ref_key:"bodyRef",ref:se,class:"d2-block-body",style:B(Ce.value)},[t.loading&&!De.value?(g(),h("div",q,[w("pre",z,[w("code",null,b(we.value),1)]),ne.value?(g(),h("p",$,b(ne.value),1)):x("",!0)])):(g(),h("div",G,[Me.value?(g(),h("div",J,[w("pre",K,[w("code",null,b(we.value),1)]),ne.value?(g(),h("p",Q,b(ne.value),1)):x("",!0)])):(g(),h("div",{key:1,class:"d2-render",style:B(Ee.value)},[w("div",{class:"d2-svg",innerHTML:le.value},null,8,W),ne.value?(g(),h("p",Z,b(ne.value),1)):x("",!0)],4))]))],4),[[M,!F.value]])],10,L))}}),[["__scopeId","data-v-76133c5b"]]);ee.install=e=>{e.component(ee.__name,ee)};export{ee as default};
1
+ var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,l=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,r=(e,r)=>{for(var a in r||(r={}))n.call(r,a)&&l(e,a,r[a]);if(t)for(var a of t(r))o.call(r,a)&&l(e,a,r[a]);return e},a=(e,t,n)=>new Promise((o,l)=>{var r=e=>{try{i(n.next(e))}catch(t){l(t)}},a=e=>{try{i(n.throw(e))}catch(t){l(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,a);i((n=n.apply(e,t)).next())});import{defineComponent as i,useAttrs as u,inject as s,ref as d,computed as c,watch as v,nextTick as m,onMounted as p,onBeforeUnmount as f,openBlock as g,createElementBlock as h,normalizeClass as y,createElementVNode as w,unref as k,toDisplayString as b,createCommentVNode as x,normalizeStyle as B,withDirectives as D,vShow as M}from"vue";import{az as C,aB as E,aC as T,ay as A,ak as j,at as H,a9 as O,a0 as I,G as F}from"./exports.js";import{p as P}from"./diagramHeight.js";import{M as S}from"./index2.js";const L=["data-markstream-mode","data-markstream-pending"],N={key:0,class:"d2-block-header flex justify-between items-center border-b"},R={class:"d2-header-actions flex items-center"},_={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},U=["aria-label"],V={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},X={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Y=["aria-label"],q=["aria-pressed"],z={key:0,class:"d2-source"},$={class:"d2-code"},G={key:0,class:"d2-error mt-2 text-xs"},J={key:1},K={key:0,class:"d2-source"},Q={class:"d2-code"},W={key:0,class:"d2-error mt-2 text-xs"},Z=["innerHTML"],ee={key:0,class:"d2-error px-4 pb-3 text-xs"},te=/* @__PURE__ */F(/* @__PURE__ */i({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const t=e,n=u(),o=s(S,null),{t:l}=C(),i=d(!1),F=d(!1),te=d(!1),ne=d(!1),oe=d(null),le=d(!1),re=d(""),ae=d(""),ie=d(0),ue=d(""),se=d(""),de=d(null),ce=d(null),ve=d(null),me=E(),pe=T(),fe=A(),ge=d(null),he="undefined"!=typeof window,ye=d(!1),we=d("undefined"==typeof window||!fe.value),ke=c(()=>{var e;return null!=(e=t.node.code)?e:""}),be=c(()=>j(t,n)),xe=c(()=>{var e,n;return[t.isDark?"dark":"light",null!=(e=t.themeId)?e:"auto",null!=(n=t.darkThemeId)?n:"auto",ke.value].join(":")}),Be=c(()=>!!re.value&&ae.value===xe.value),De=c(()=>{if(!ye.value||!ke.value||te.value)return!1;const e=xe.value;return!!le.value||ue.value!==e&&(!oe.value||se.value!==e)}),Me=c(()=>Be.value||!!re.value&&De.value),Ce=c(()=>te.value||!ne.value||!Me.value),Ee=c(()=>{var e;return te.value||Me.value?0:ke.value?oe.value&&se.value===xe.value?0:null!=(e=P(t.estimatedPreviewHeightPx))?e:0:0}),Te=c(()=>{var e;if(!Ce.value)return;const t=Math.max(null!=(e=ce.value)?e:0,Ee.value);return t>0?{minHeight:`${t}px`}:void 0}),Ae=c(()=>{if("none"===t.maxHeight)return{maxHeight:"none","--ms-d2-render-max-height":"none"};if(null!=t.maxHeight){const e="number"==typeof t.maxHeight?`${t.maxHeight}px`:String(t.maxHeight);return{maxHeight:e,"--ms-d2-render-max-height":e}}});let je=null,He=!1,Oe=!1,Ie=0,Fe=null,Pe=!1,Se=null,Le="";"undefined"!=typeof window&&v([()=>ve.value,fe],([e,t])=>{var n,o,l;if(null==(n=ge.value)||n.destroy(),ge.value=null,!t||we.value)return void(we.value=!0);if(!e)return void(we.value=!1);const r=null!=(l=null!=(o=null==pe?void 0:pe.value.heavyBlockMargin)?o:null==pe?void 0:pe.value.rootMargin)?l:"160px",a=me(e,{rootMargin:r,allowIdle:!1});ge.value=a,we.value=a.isVisible.value,a.whenVisible.then(()=>{we.value=!0})},{immediate:!0});const Ne={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Re(e){return!e||e.disabled}function _e(e,n,o="top"){if(Re(e.currentTarget))return;const l=e,r=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;H(e.currentTarget,n,o,!1,r,t.isDark)}function Ue(){O()}function Ve(e){if(Re(e.currentTarget))return;const n=i.value?l("common.copied")||"Copied":l("common.copy")||"Copy",o=e,r=null!=(null==o?void 0:o.clientX)&&null!=(null==o?void 0:o.clientY)?{x:o.clientX,y:o.clientY}:void 0;H(e.currentTarget,n,"top",!1,r,t.isDark)}function Xe(){return a(this,null,function*(){try{const e=ke.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function Ye(){F.value=!F.value}function qe(e){te.value="source"===e}const ze=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],$e=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Ge(e){if(!e)return"";const t=e.trim();return $e.test(t)?t:""}function Je(){re.value="",ae.value=""}function Ke(e){return Oe||e!==ie.value}function Qe(){return a(this,null,function*(){var e,n,l,i,u;if(!he||Oe)return;if(!we.value)return;if(t.loading&&!t.progressiveRender)return;const s=xe.value;if(s===ue.value&&!oe.value&&Be.value)return ne.value=!0,void(t.loading&&(te.value=!1));const d=ke.value;if(!d)return Je(),oe.value=null,ue.value="",void(se.value="");const c=++ie.value;le.value=!0,oe.value=null,se.value="",function(){const e=be.value;o&&e&&Le!==e&&(Le&&o.markSettled(Le),Le=e,o.markPending(e))}();try{const o=yield function(){return a(this,null,function*(){if(je)return je;const e=yield I();if(Oe||!e)return null;if("function"==typeof e){const t=new e;return t&&"function"==typeof t.compile?je=t:"function"==typeof e.compile&&(je=e),je}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(je=new e.D2,je):("function"==typeof e.compile&&(je=e),je)})}();if(Ke(c))return;if(!o)return ne.value=!1,te.value=!0,Je(),oe.value="D2 is not available.",void(se.value=s);if("function"!=typeof o.compile||"function"!=typeof o.render)throw new TypeError("D2 instance is missing compile/render methods.");ne.value=!0;const v=yield o.compile(d);if(Ke(c))return;const m=null!=(e=null==v?void 0:v.diagram)?e:v,p=null!=(l=null!=(n=null==v?void 0:v.renderOptions)?n:null==v?void 0:v.options)?l:{},f=null!=(i=t.themeId)?i:p.themeID,g=null!=(u=t.darkThemeId)?u:p.darkThemeID,h=r({},p);if(h.themeID=t.isDark&&null!=g?g:f,h.darkThemeID=null,h.darkThemeOverrides=null,t.isDark){const e=p.themeOverrides&&"object"==typeof p.themeOverrides?p.themeOverrides:null;h.themeOverrides=r(r({},Ne),e||{})}const y=yield o.render(m,h);if(Ke(c))return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(y);if(!w)throw new Error("D2 render returned empty output.");!function(e,t){const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return"";const o=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const o of n){if(t.has(o.tagName.toLowerCase())){o.remove();continue}const e=Array.from(o.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))o.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(ze.some(e=>e.test(n))){o.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=Ge(t.value);if(!n){o.removeAttribute(e);continue}n!==t.value&&o.setAttribute(e,n)}}}}}(o),o.classList.add("markstream-d2-root-svg"),o.outerHTML}(e);re.value=n||"",ae.value=n?t:""}(w,s),ue.value=s,se.value="",t.loading&&(te.value=!1),oe.value=null}catch(v){if(Ke(c))return;const e=(null==v?void 0:v.message)?String(v.message):"D2 render failed.";t.loading||(oe.value=e,se.value=s),ue.value="",e.includes("@terrastruct/d2")&&(ne.value=!1,te.value=!0)}finally{Ke(c)||(le.value=!1,Pe?(Pe=!1,We()):function(){const e=Le;o&&e&&(Le="",m(()=>{var t,n;if(!Oe){const l=null!=(n=null==(t=ve.value)?void 0:t.offsetHeight)?n:0;l>0&&o.reportHeight(e,l)}o.markSettled(e)}))}())}})}function We(e=!1){if(He)return;if(!he)return;if(Oe)return;if(le.value)return void(Pe=!0);const n=Math.max(120,Number(t.progressiveIntervalMs)||0),o=Date.now()-Ie;if(!e&&o<n)return Pe=!0,void(null==Fe&&(Fe=window.setTimeout(()=>{Fe=null,Pe&&(Pe=!1,We(!0))},Math.max(0,n-o))));He=!0;const l=()=>{He=!1,Ie=Date.now(),Qe()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(l):setTimeout(l,0)}function Ze(){if(Be.value)try{const e=new Blob([re.value],{type:"image/svg+xml;charset=utf-8"}),t=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(t)}catch(e){console.error("Failed to export SVG:",e)}}function et(){var e;const t=de.value;if(!t)return;const n=(null!=(e=t.firstElementChild)?e:t).getBoundingClientRect().height;n>0&&(ce.value=n)}return v(()=>[t.node.code,t.loading,t.isDark,t.themeId,t.darkThemeId],()=>{We()},{immediate:!0}),v(()=>t.loading,(e,t)=>{t&&!e&&We(!0)}),v(()=>we.value,e=>{e&&We(!0)}),v(()=>[Ce.value,re.value,ke.value],()=>{m(()=>{et()})}),p(()=>{ye.value=!0,m(()=>{et()}),"undefined"!=typeof ResizeObserver&&(Se=new ResizeObserver(()=>{et()}),de.value&&Se.observe(de.value))}),f(()=>{var e;Oe=!0,ie.value+=1,Pe=!1,function(){const e=Le;o&&e&&(Le="",o.markSettled(e))}(),ue.value="",null==(e=ge.value)||e.destroy(),ge.value=null,null!=Fe&&(clearTimeout(Fe),Fe=null),null==Se||Se.disconnect(),Se=null}),(e,n)=>(g(),h("div",{ref_key:"viewportTarget",ref:ve,class:y(["d2-block-container rounded-lg border overflow-hidden",{dark:t.isDark}]),"data-markstream-d2":"1","data-markstream-mode":Ce.value?"fallback":"preview","data-markstream-pending":De.value?"true":void 0},[t.showHeader?(g(),h("div",N,[n[16]||(n[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),w("div",R,[t.showModeToggle?(g(),h("div",_,[w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",te.value?"":"is-active"]),onClick:n[0]||(n[0]=e=>qe("preview")),onMouseenter:n[1]||(n[1]=e=>_e(e,k(l)("common.preview")||"Preview")),onFocus:n[2]||(n[2]=e=>_e(e,k(l)("common.preview")||"Preview")),onMouseleave:Ue,onBlur:Ue},b(k(l)("common.preview")||"Preview"),35),w("button",{type:"button",class:y(["mode-btn px-2 py-0.5 rounded",te.value?"is-active":""]),onClick:n[3]||(n[3]=e=>qe("source")),onMouseenter:n[4]||(n[4]=e=>_e(e,k(l)("common.source")||"Source")),onFocus:n[5]||(n[5]=e=>_e(e,k(l)("common.source")||"Source")),onMouseleave:Ue,onBlur:Ue},b(k(l)("common.source")||"Source"),35)])):x("",!0),t.showCopyButton?(g(),h("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":i.value?k(l)("common.copied")||"Copied":k(l)("common.copy")||"Copy",onClick:Xe,onMouseenter:n[6]||(n[6]=e=>Ve(e)),onFocus:n[7]||(n[7]=e=>Ve(e)),onMouseleave:Ue,onBlur:Ue},[i.value?(g(),h("svg",X,[...n[13]||(n[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(g(),h("svg",V,[...n[12]||(n[12]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,U)):x("",!0),t.showExportButton&&Be.value?(g(),h("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":k(l)("common.export")||"Export",onClick:Ze,onMouseenter:n[8]||(n[8]=e=>_e(e,k(l)("common.export")||"Export")),onFocus:n[9]||(n[9]=e=>_e(e,k(l)("common.export")||"Export")),onMouseleave:Ue,onBlur:Ue},[...n[14]||(n[14]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,Y)):x("",!0),t.showCollapseButton?(g(),h("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":F.value,onClick:Ye,onMouseenter:n[10]||(n[10]=e=>_e(e,F.value?k(l)("common.expand")||"Expand":k(l)("common.collapse")||"Collapse")),onFocus:n[11]||(n[11]=e=>_e(e,F.value?k(l)("common.expand")||"Expand":k(l)("common.collapse")||"Collapse")),onMouseleave:Ue,onBlur:Ue},[(g(),h("svg",{style:B({rotate:F.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...n[15]||(n[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,q)):x("",!0)])])):x("",!0),D(w("div",{ref_key:"bodyRef",ref:de,class:"d2-block-body",style:B(Te.value)},[t.loading&&!Me.value?(g(),h("div",z,[w("pre",$,[w("code",null,b(ke.value),1)]),oe.value?(g(),h("p",G,b(oe.value),1)):x("",!0)])):(g(),h("div",J,[Ce.value?(g(),h("div",K,[w("pre",Q,[w("code",null,b(ke.value),1)]),oe.value?(g(),h("p",W,b(oe.value),1)):x("",!0)])):(g(),h("div",{key:1,class:"d2-render",style:B(Ae.value)},[w("div",{class:"d2-svg",innerHTML:re.value},null,8,Z),oe.value?(g(),h("p",ee,b(oe.value),1)):x("",!0)],4))]))],4),[[M,!F.value]])],10,L))}}),[["__scopeId","data-v-513c591d"]]);te.install=e=>{e.component(te.__name,te)};export{te as default};
package/dist/index9.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{az as j,aB as H,aC as $,ay as P,ak as T,ac as E,at as z,a9 as L,a1 as S,G as Z}from"./exports.js";import{p as V,e as I,c as _,I as X}from"./diagramHeight.js";import{M as N}from"./index2.js";const Y=["data-markstream-mode"],O={key:0,class:"infographic-block-header flex justify-between items-center border-b"},D={key:0},R={key:1,class:"flex items-center gap-x-2 overflow-hidden"},A=["innerHTML"],U={key:2},G={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},q=["disabled"],W={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"},ee=["aria-pressed"],oe={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"},ne={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"},te=["disabled"],le=["disabled"],ie={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"},re={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"},ae={key:0,class:"infographic-source"},se={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},ue={key:1,class:"relative"},ce={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},de={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ve={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},me={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},he={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pe="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",we=/* @__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 we=o,{t:ge}=j(),fe=H(),Ce=$(),xe=P(),ke=n(!1),ye=n(!1),be=n(),Me=n(),Be=n(!0),Fe=n(!1),je=n(!1),He=n(),$e=n(null),Pe=n(!1),Te=n(!1),Ee=n(null),ze=n("undefined"==typeof window||!xe.value),Le=t(),Se=l(N,null);let Ze="";const Ve=i(()=>T(we,Le));"undefined"!=typeof window&&r([()=>be.value,xe],([e,o])=>{var n,t,l;if(null==(n=Ee.value)||n.destroy(),Ee.value=null,!o||ze.value)return void(ze.value=!0);if(!e)return void(ze.value=!1);const i=null!=(l=null!=(t=null==Ce?void 0:Ce.value.heavyBlockMargin)?t:null==Ce?void 0:Ce.value.rootMargin)?l:"160px",r=fe(e,{rootMargin:i,allowIdle:!1});Ee.value=r,ze.value=r.isVisible.value,r.whenVisible.then(()=>{ze.value=!0})},{immediate:!0});const Ie=i(()=>we.node.code),_e=i(()=>{var e;return function(e){const o=function(){var e;const o=Me.value?getComputedStyle(Me.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=V(o))?e:X}();if("none"===we.maxHeight)return _(e,o,null);const n=V(we.maxHeight);return _(e,o,n)}(null!=(e=V(we.estimatedPreviewHeightPx))?e:I(Ie.value))}),Xe=n(`${_e.value}px`),Ne=i(()=>null!=V(we.estimatedPreviewHeightPx));function Ye(){var e;if(!Me.value)return;if(Ne.value)return;const o=Me.value.scrollHeight;if(o>0){const n=null!=(e=V(function(e){if("none"===we.maxHeight)return`${e}px`;if(null!=we.maxHeight){const o=Number.parseFloat(String(we.maxHeight));if(Number.isFinite(o))return`${Math.min(e,o)}px`}const o=Me.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;Xe.value=`${Math.max(n,_e.value)}px`}}const Oe=n(1),De=n(0),Re=n(0),Ae=n(!1),Ue=n({x:0,y:0}),Ge=i(()=>Ie.value);function qe(e){return!e||e.disabled}function We(e,o,n="top"){if(qe(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;z(e.currentTarget,o,n,!1,l,we.isDark)}function Je(){L()}function Ke(e){if(qe(e.currentTarget))return;const o=ke.value?ge("common.copied")||"Copied":ge("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;z(e.currentTarget,o,"top",!1,t,we.isDark)}function Qe(){return e(this,null,function*(){try{const e=Ie.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),ke.value=!0,setTimeout(()=>{ke.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function eo(e){("preview"!==e||E())&&(Fe.value=!0,Be.value="source"===e)}function oo(){var o;const n=null==(o=Me.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 no(e){"Escape"===e.key&&je.value&&to()}function to(){if(je.value=!1,He.value&&(He.value.innerHTML=""),$e.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(e){}}function lo(){!function(){if(je.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",no)}catch(e){}a(()=>{if(Me.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=Me.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),He.value.appendChild(e),$e.value=e,e.style.transform=`translate(${De.value}px, ${Re.value}px) scale(${Oe.value})`}})}()}function io(){Oe.value<3&&(Oe.value+=.1)}function ro(){Oe.value>.5&&(Oe.value-=.1)}function ao(){Oe.value=1,De.value=0,Re.value=0}function so(e){Ae.value=!0,e instanceof MouseEvent?Ue.value={x:e.clientX-De.value,y:e.clientY-Re.value}:Ue.value={x:e.touches[0].clientX-De.value,y:e.touches[0].clientY-Re.value}}function uo(e){if(!Ae.value)return;let o,n;e instanceof MouseEvent?(o=e.clientX,n=e.clientY):(o=e.touches[0].clientX,n=e.touches[0].clientY),De.value=o-Ue.value.x,Re.value=n-Ue.value.y}function co(){Ae.value=!1}let vo=null,mo=!1,ho=!1,po=!1,wo=!1,go=!1,fo="",Co=!1,xo=0;function ko(e){return!Co&&e===xo}function yo(o=!1){return e(this,null,function*(){var n,t,l,i,r,s;if(Co||!ze.value)return;if(!Me.value)return;if(mo)return ho=!0,void(po=po||o);const u=Ge.value;if(!o&&u===fo&&Pe.value)return;const c=Ie.value,d=!1===we.loading,v=++xo;mo=!0,function(){const e=Ve.value;e&&Ze!==e&&(Ze&&(null==Se||Se.markSettled(Ze)),Ze=e,null==Se||Se.markPending(e))}();let m=null,h=null;try{const e=yield S();if(!ko(v))return;if(!e)throw new Error("Infographic library failed to load.");const o=Me.value;if(!o)return;const i=!0===we.loading;if(!(u===Ge.value||!d&&i&&Ie.value.startsWith(c)))return;h=Array.from(o.childNodes),m=new e({container:o,width:"100%",height:"100%"});let r="",s=!1;if(null==(n=m.on)||n.call(m,"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("; ")}),null==(t=m.on)||t.call(m,"rendered",()=>{s=!0}),m.render(c),r)throw new Error(r);const p=Array.from(o.childNodes),w=p.length>0&&(p.length!==h.length||p.some((e,o)=>e!==(null==h?void 0:h[o])));if(!s&&!w)throw new Error("Infographic render returned empty output.");null==(l=null==vo?void 0:vo.destroy)||l.call(vo),vo=m,m=null,Pe.value=!0,Te.value=!1,fo=u,a(()=>{ko(v)&&Ye()})}catch(p){if(!ko(v))return;null==(i=null==m?void 0:m.destroy)||i.call(m),m=null,d&&!1===we.loading&&u===Ge.value?(console.error("Failed to render infographic:",p),null==(r=null==vo?void 0:vo.destroy)||r.call(vo),vo=null,Pe.value=!1,Te.value=!0,fo="",Me.value&&(Me.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`)):h&&Me.value&&Me.value.replaceChildren(...h)}finally{if(null==(s=null==m?void 0:m.destroy)||s.call(m),mo=!1,ko(v))if(ho){const e=po;ho=!1,po=!1,a(()=>{yo(e)})}else!function(){e(this,null,function*(){const e=Ze;e&&(Ze="",yield a(),function(e=Ve.value){e&&be.value&&(null==Se||Se.reportHeight(e,be.value.offsetHeight))}(e),null==Se||Se.markSettled(e))})}()}})}function bo(e=!1){Co||!ze.value||Be.value||ye.value||(go=go||e,wo||(wo=!0,a(()=>{wo=!1;const e=go;go=!1,Co||yo(e)})))}r(()=>Ie.value,()=>{bo(!0)}),r(()=>we.loading,(e,o)=>{o&&!e&&bo(!0)}),r(()=>Be.value,e=>{e||bo(!0)}),r(()=>ye.value,e=>{e||bo()}),r(()=>we.maxHeight,()=>{a(()=>{Ye()})}),r([()=>we.estimatedPreviewHeightPx,()=>Ie.value],()=>{Pe.value||Be.value||(Xe.value=`${_e.value}px`)}),r(()=>ze.value,e=>{!e||Be.value||ye.value||bo()}),s(()=>{!Fe.value&&E()&&(Be.value=!1),bo()}),u(()=>{var e,o;if(Co=!0,xo+=1,ho=!1,po=!1,wo=!1,go=!1,null==(e=Ee.value)||e.destroy(),Ee.value=null,function(){const e=Ze;e&&(Ze="",null==Se||Se.markSettled(e))}(),vo&&(null==(o=vo.destroy)||o.call(vo),vo=null),fo="","undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(n){}});const Mo=i(()=>!E()),Bo=i(()=>Be.value||ye.value),Fo=i(()=>Be.value?"fallback":Te.value?"error":Pe.value?"preview":"pending"),jo=i(()=>({transform:`translate(${De.value}px, ${Re.value}px) scale(${Oe.value})`}));return r(jo,e=>{je.value&&$e.value&&($e.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:be,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":we.loading,dark:we.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Fo.value},[we.showHeader?(c(),d("div",O,[e.$slots["header-left"]?(c(),d("div",D,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",R,[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,A),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)])):we.showModeToggle?(c(),d("div",G,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Be.value?"":"is-active",Mo.value?"opacity-50 cursor-not-allowed":""]]),disabled:Mo.value,onClick:o[0]||(o[0]=()=>eo("preview")),onMouseenter:o[1]||(o[1]=e=>We(e,p(ge)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>We(e,p(ge)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[h("div",W,[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(ge)("common.preview")||"Preview"),1)])],42,q),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Be.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>eo("source")),onMouseenter:o[4]||(o[4]=e=>We(e,p(ge)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>We(e,p(ge)("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(ge)("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,[we.showCollapseButton?(c(),d("button",{key:0,class:v(pe),"aria-pressed":ye.value,onClick:o[6]||(o[6]=e=>ye.value=!ye.value),onMouseenter:o[7]||(o[7]=e=>We(e,ye.value?p(ge)("common.expand")||"Expand":p(ge)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>We(e,ye.value?p(ge)("common.expand")||"Expand":p(ge)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(c(),d("svg",{style:f({rotate:ye.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,ee)):g("",!0),we.showCopyButton?(c(),d("button",{key:1,class:v(pe),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[ke.value?(c(),d("svg",ne,[...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",oe,[...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),we.showExportButton?(c(),d("button",{key:2,class:v(`${pe} ${Bo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Bo.value,onClick:oo,onMouseenter:o[11]||(o[11]=e=>We(e,p(ge)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>We(e,p(ge)("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,te)):g("",!0),we.showFullscreenButton?(c(),d("button",{key:3,class:v(`${pe} ${Bo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Bo.value,onClick:lo,onMouseenter:o[13]||(o[13]=e=>We(e,je.value?p(ge)("common.minimize")||"Minimize":p(ge)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>We(e,je.value?p(ge)("common.minimize")||"Minimize":p(ge)("common.open")||"Open")),onMouseleave:Je,onBlur:Je},[je.value?(c(),d("svg",re,[...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",ie,[...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,le)):g("",!0)]))])):g("",!0),C(h("div",null,[Be.value?(c(),d("div",ae,[h("pre",se,w(Ie.value),1)])):(c(),d("div",ue,[we.showZoomControls?(c(),d("div",ce,[h("div",de,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[15]||(o[15]=e=>We(e,p(ge)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>We(e,p(ge)("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:ro,onMouseenter:o[17]||(o[17]=e=>We(e,p(ge)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>We(e,p(ge)("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:ao,onMouseenter:o[19]||(o[19]=e=>We(e,p(ge)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>We(e,p(ge)("common.resetZoom")||"Reset zoom")),onMouseleave:Je,onBlur:Je},w(Math.round(100*Oe.value))+"% ",33)])])):g("",!0),h("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:f({height:Xe.value}),onMousedown:so,onMousemove:uo,onMouseup:co,onMouseleave:co,onTouchstartPassive:so,onTouchmovePassive:uo,onTouchendPassive:co},[Pe.value||Te.value?g("",!0):(c(),d("pre",ve,w(Ie.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Ae.value}]),style:f(jo.value)},[h("div",{ref_key:"infographicContainer",ref:Me,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[x,!ye.value]]),(c(),k(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:we.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[je.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(to,["self"])},[h("div",me,[h("div",he,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...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:ro},[...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:ao},w(Math.round(100*Oe.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:to},[...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":!Ae.value,"cursor-grabbing":Ae.value}]),onMousedown:so,onMousemove:uo,onMouseup:co,onMouseleave:co,onTouchstartPassive:so,onTouchmovePassive:uo,onTouchendPassive:co},null,34)])])):g("",!0)]),_:1})],2)]))],10,Y))}}),[["__scopeId","data-v-7fa98755"]]);we.install=e=>{e.component(we.__name,we)};export{we 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 k,createBlock as x,Teleport as y,createVNode as b,Transition as M,withCtx as B,withModifiers as F}from"vue";import{createPanGesture as j}from"markstream-core";import{az as H,aB as $,aC as T,ay as z,ak as P,ac as E,at as L,a9 as S,a1 as Z,G as V}from"./exports.js";import{p as I,f as _,b as N,I as O}from"./diagramHeight.js";import{M as A}from"./index2.js";const D=["data-markstream-mode"],R={key:0,class:"infographic-block-header flex justify-between items-center border-b"},U={key:0},X={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Y=["innerHTML"],G={key:2},q={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},W=["disabled"],J={class:"flex items-center gap-x-1"},K={class:"flex items-center gap-x-1"},Q={key:4},ee={key:5,class:"infographic-header-actions flex items-center"},oe=["aria-pressed"],ne={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"},te={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"},le=["disabled"],ie=["disabled"],re={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"},ae={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"},se={key:0,class:"infographic-source"},ue={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},ce={key:1,class:"relative"},de={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},ve={class:"flex items-center gap-2 backdrop-blur rounded-lg"},me={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},he={class:"dialog-panel infographic-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"},we="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",ge=/* @__PURE__ */V(/* @__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:V}){const ge=o,{t:fe}=H(),Ce=$(),ke=T(),xe=z(),ye=n(!1),be=n(!1),Me=n(),Be=n(),Fe=n(!0),je=n(!1),He=n(!1),$e=n(),Te=n(null),ze=n(!1),Pe=n(!1),Ee=n(null),Le=n("undefined"==typeof window||!xe.value),Se=t(),Ze=l(A,null);let Ve="";const Ie=i(()=>P(ge,Se));"undefined"!=typeof window&&r([()=>Me.value,xe],([e,o])=>{var n,t,l;if(null==(n=Ee.value)||n.destroy(),Ee.value=null,!o||Le.value)return void(Le.value=!0);if(!e)return void(Le.value=!1);const i=null!=(l=null!=(t=null==ke?void 0:ke.value.heavyBlockMargin)?t:null==ke?void 0:ke.value.rootMargin)?l:"160px",r=Ce(e,{rootMargin:i,allowIdle:!1});Ee.value=r,Le.value=r.isVisible.value,r.whenVisible.then(()=>{Le.value=!0})},{immediate:!0});const _e=i(()=>ge.node.code),Ne=i(()=>{var e;return function(e){const o=function(){var e;const o=Be.value?getComputedStyle(Be.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return null!=(e=I(o))?e:O}();if("none"===ge.maxHeight)return N(e,o,null);const n=I(ge.maxHeight);return N(e,o,n)}(null!=(e=I(ge.estimatedPreviewHeightPx))?e:_(_e.value))}),Oe=n(`${Ne.value}px`),Ae=i(()=>null!=I(ge.estimatedPreviewHeightPx));function De(){var e;if(!Be.value)return;if(Ae.value)return;const o=Be.value.scrollHeight;if(o>0){const n=null!=(e=I(function(e){if("none"===ge.maxHeight)return`${e}px`;if(null!=ge.maxHeight){const o=Number.parseFloat(String(ge.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;Oe.value=`${Math.max(n,Ne.value)}px`}}const Re=n(1),Ue=n(0),Xe=n(0),Ye=n(!1),Ge=i(()=>_e.value);function qe(e){return!e||e.disabled}function We(e,o,n="top"){if(qe(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;L(e.currentTarget,o,n,!1,l,ge.isDark)}function Je(){S()}function Ke(e){if(qe(e.currentTarget))return;const o=ye.value?fe("common.copied")||"Copied":fe("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;L(e.currentTarget,o,"top",!1,t,ge.isDark)}function Qe(){return e(this,null,function*(){try{const e=_e.value;"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 eo(e){("preview"!==e||E())&&(je.value=!0,Fe.value="source"===e)}function oo(){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 no(e){"Escape"===e.key&&He.value&&to()}function to(){if(He.value=!1,$e.value&&($e.value.innerHTML=""),Te.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(e){}}function lo(){!function(){if(He.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",no)}catch(e){}a(()=>{if(Be.value&&$e.value){$e.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),$e.value.appendChild(e),Te.value=e,e.style.transform=`translate(${Ue.value}px, ${Xe.value}px) scale(${Re.value})`}})}()}function io(){Re.value<3&&(Re.value+=.1)}function ro(){Re.value>.5&&(Re.value-=.1)}function ao(){Re.value=1,Ue.value=0,Xe.value=0}const so=i(()=>He.value||Re.value>1),uo=j({getTranslate:()=>({x:Ue.value,y:Xe.value}),setTranslate:e=>{Ue.value=e.x,Xe.value=e.y},canStart:e=>!!ze.value&&("touch"!==e.pointerType||so.value),onActiveChange:e=>Ye.value=e}),co=uo.start,vo=uo.stop;let mo=null,ho=!1,po=!1,wo=!1,go=!1,fo=!1,Co="",ko=!1,xo=0;function yo(e){return!ko&&e===xo}function bo(o=!1){return e(this,null,function*(){var n,t,l,i,r,s;if(ko||!Le.value)return;if(!Be.value)return;if(ho)return po=!0,void(wo=wo||o);const u=Ge.value;if(!o&&u===Co&&ze.value)return;const c=_e.value,d=!1===ge.loading,v=++xo;ho=!0,function(){const e=Ie.value;e&&Ve!==e&&(Ve&&(null==Ze||Ze.markSettled(Ve)),Ve=e,null==Ze||Ze.markPending(e))}();let m=null,h=null;try{const e=yield Z();if(!yo(v))return;if(!e)throw new Error("Infographic library failed to load.");const o=Be.value;if(!o)return;const i=!0===ge.loading;if(!(u===Ge.value||!d&&i&&_e.value.startsWith(c)))return;h=Array.from(o.childNodes),m=new e({container:o,width:"100%",height:"100%"});let r="",s=!1;if(null==(n=m.on)||n.call(m,"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("; ")}),null==(t=m.on)||t.call(m,"rendered",()=>{s=!0}),m.render(c),r)throw new Error(r);const p=Array.from(o.childNodes),w=p.length>0&&(p.length!==h.length||p.some((e,o)=>e!==(null==h?void 0:h[o])));if(!s&&!w)throw new Error("Infographic render returned empty output.");null==(l=null==mo?void 0:mo.destroy)||l.call(mo),mo=m,m=null,ze.value=!0,Pe.value=!1,Co=u,a(()=>{yo(v)&&De()})}catch(p){if(!yo(v))return;null==(i=null==m?void 0:m.destroy)||i.call(m),m=null,d&&!1===ge.loading&&u===Ge.value?(console.error("Failed to render infographic:",p),null==(r=null==mo?void 0:mo.destroy)||r.call(mo),mo=null,ze.value=!1,Pe.value=!0,Co="",Be.value&&(Be.value.innerHTML=`<div style="padding: var(--ms-inset-panel-body); color: hsl(var(--ms-destructive))">Failed to render infographic: ${p instanceof Error?p.message:"Unknown error"}</div>`)):h&&Be.value&&Be.value.replaceChildren(...h)}finally{if(null==(s=null==m?void 0:m.destroy)||s.call(m),ho=!1,yo(v))if(po){const e=wo;po=!1,wo=!1,a(()=>{bo(e)})}else!function(){e(this,null,function*(){const e=Ve;e&&(Ve="",yield a(),function(e=Ie.value){e&&Me.value&&(null==Ze||Ze.reportHeight(e,Me.value.offsetHeight))}(e),null==Ze||Ze.markSettled(e))})}()}})}function Mo(e=!1){ko||!Le.value||Fe.value||be.value||(fo=fo||e,go||(go=!0,a(()=>{go=!1;const e=fo;fo=!1,ko||bo(e)})))}r(()=>_e.value,()=>{Mo(!0)}),r(()=>ge.loading,(e,o)=>{o&&!e&&Mo(!0)}),r(()=>Fe.value,e=>{e||Mo(!0)}),r(()=>be.value,e=>{e||Mo()}),r(()=>ge.maxHeight,()=>{a(()=>{De()})}),r([()=>ge.estimatedPreviewHeightPx,()=>_e.value],()=>{ze.value||Fe.value||(Oe.value=`${Ne.value}px`)}),r(()=>Le.value,e=>{!e||Fe.value||be.value||Mo()}),s(()=>{!je.value&&E()&&(Fe.value=!1),Mo()}),u(()=>{var e,o;if(ko=!0,vo(),xo+=1,po=!1,wo=!1,go=!1,fo=!1,null==(e=Ee.value)||e.destroy(),Ee.value=null,function(){const e=Ve;e&&(Ve="",null==Ze||Ze.markSettled(e))}(),mo&&(null==(o=mo.destroy)||o.call(mo),mo=null),Co="","undefined"!=typeof window)try{window.removeEventListener("keydown",no)}catch(n){}});const Bo=i(()=>!E()),Fo=i(()=>Fe.value||be.value),jo=i(()=>Fe.value?"fallback":Pe.value?"error":ze.value?"preview":"pending"),Ho=i(()=>({transform:`translate(${Ue.value}px, ${Xe.value}px) scale(${Re.value})`}));return r(Ho,e=>{He.value&&Te.value&&(Te.value.style.transform=e.transform)}),(e,o)=>(c(),d("div",{ref_key:"viewportTarget",ref:Me,class:v(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":ge.loading,dark:ge.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":jo.value},[ge.showHeader?(c(),d("div",R,[e.$slots["header-left"]?(c(),d("div",U,[m(e.$slots,"header-left",{},void 0,!0)])):(c(),d("div",X,[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,Y),o[23]||(o[23]=h("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),e.$slots["header-center"]?(c(),d("div",G,[m(e.$slots,"header-center",{},void 0,!0)])):ge.showModeToggle?(c(),d("div",q,[h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Fe.value?"":"is-active",Bo.value?"opacity-50 cursor-not-allowed":""]]),disabled:Bo.value,onClick:o[0]||(o[0]=()=>eo("preview")),onMouseenter:o[1]||(o[1]=e=>We(e,p(fe)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>We(e,p(fe)("common.preview")||"Preview")),onMouseleave:Je,onBlur:Je},[h("div",J,[o[24]||(o[24]=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(fe)("common.preview")||"Preview"),1)])],42,W),h("button",{class:v(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[Fe.value?"is-active":""]]),onClick:o[3]||(o[3]=()=>eo("source")),onMouseenter:o[4]||(o[4]=e=>We(e,p(fe)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>We(e,p(fe)("common.source")||"Source")),onMouseleave:Je,onBlur:Je},[h("div",K,[o[25]||(o[25]=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(fe)("common.source")||"Source"),1)])],34)])):g("",!0),e.$slots["header-right"]?(c(),d("div",Q,[m(e.$slots,"header-right",{},void 0,!0)])):(c(),d("div",ee,[ge.showCollapseButton?(c(),d("button",{key:0,class:v(we),"aria-pressed":be.value,onClick:o[6]||(o[6]=e=>be.value=!be.value),onMouseenter:o[7]||(o[7]=e=>We(e,be.value?p(fe)("common.expand")||"Expand":p(fe)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>We(e,be.value?p(fe)("common.expand")||"Expand":p(fe)("common.collapse")||"Collapse")),onMouseleave:Je,onBlur:Je},[(c(),d("svg",{style:f({rotate:be.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[26]||(o[26]=[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,oe)):g("",!0),ge.showCopyButton?(c(),d("button",{key:1,class:v(we),onClick:Qe,onMouseenter:o[9]||(o[9]=e=>Ke(e)),onFocus:o[10]||(o[10]=e=>Ke(e)),onMouseleave:Je,onBlur:Je},[ye.value?(c(),d("svg",te,[...o[28]||(o[28]=[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",ne,[...o[27]||(o[27]=[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),ge.showExportButton?(c(),d("button",{key:2,class:v(`${we} ${Fo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Fo.value,onClick:oo,onMouseenter:o[11]||(o[11]=e=>We(e,p(fe)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>We(e,p(fe)("common.export")||"Export")),onMouseleave:Je,onBlur:Je},[...o[29]||(o[29]=[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,le)):g("",!0),ge.showFullscreenButton?(c(),d("button",{key:3,class:v(`${we} ${Fo.value?"opacity-50 cursor-not-allowed":""}`),disabled:Fo.value,onClick:lo,onMouseenter:o[13]||(o[13]=e=>We(e,He.value?p(fe)("common.minimize")||"Minimize":p(fe)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>We(e,He.value?p(fe)("common.minimize")||"Minimize":p(fe)("common.open")||"Open")),onMouseleave:Je,onBlur:Je},[He.value?(c(),d("svg",ae,[...o[31]||(o[31]=[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",re,[...o[30]||(o[30]=[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,ie)):g("",!0)]))])):g("",!0),C(h("div",null,[Fe.value?(c(),d("div",se,[h("pre",ue,w(_e.value),1)])):(c(),d("div",ce,[ge.showZoomControls?(c(),d("div",de,[h("div",ve,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io,onMouseenter:o[15]||(o[15]=e=>We(e,p(fe)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>We(e,p(fe)("common.zoomIn")||"Zoom in")),onMouseleave:Je,onBlur:Je},[...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)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ro,onMouseenter:o[17]||(o[17]=e=>We(e,p(fe)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>We(e,p(fe)("common.zoomOut")||"Zoom out")),onMouseleave:Je,onBlur:Je},[...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)])],32),h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:ao,onMouseenter:o[19]||(o[19]=e=>We(e,p(fe)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>We(e,p(fe)("common.resetZoom")||"Reset zoom")),onMouseleave:Je,onBlur:Je},w(Math.round(100*Re.value))+"% ",33)])])):g("",!0),h("div",{class:v(["infographic-preview relative transition-all overflow-hidden block",{"infographic-pan-touch":so.value}]),style:f({height:Oe.value}),onPointerdown:o[21]||(o[21]=(...e)=>p(co)&&p(co)(...e))},[ze.value||Pe.value?g("",!0):(c(),d("pre",me,w(_e.value),1)),h("div",{class:v(["absolute inset-0 cursor-grab",{"cursor-grabbing":Ye.value}]),style:f(Ho.value)},[h("div",{ref_key:"infographicContainer",ref:Be,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],38)]))],512),[[k,!be.value]]),(c(),x(y,{to:"body"},[h("div",{class:v(["markstream-vue",{dark:ge.isDark}])},[b(M,{name:"infographic-dialog",appear:""},{default:B(()=>[He.value?(c(),d("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:F(to,["self"])},[h("div",he,[h("div",pe,[h("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:io},[...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("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:ro},[...o[35]||(o[35]=[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:ao},w(Math.round(100*Re.value))+"% ",1),h("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:to},[...o[36]||(o[36]=[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:$e,class:v(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!Ye.value,"cursor-grabbing":Ye.value,"infographic-pan-touch":so.value}]),onPointerdown:o[22]||(o[22]=(...e)=>p(co)&&p(co)(...e))},null,34)])])):g("",!0)]),_:1})],2)]))],10,D))}}),[["__scopeId","data-v-3bff4a01"]]);ge.install=e=>{e.component(ge.__name,ge)};export{ge as default};