markstream-vue
Version:
Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.
2 lines (1 loc) • 25.6 kB
JavaScript
;var tt=Object.defineProperty,ot=Object.defineProperties;var nt=Object.getOwnPropertyDescriptors;var ke=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var xe=(m,k,l)=>k in m?tt(m,k,{enumerable:!0,configurable:!0,writable:!0,value:l}):m[k]=l,be=(m,k)=>{for(var l in k||(k={}))it.call(k,l)&&xe(m,l,k[l]);if(ke)for(var l of ke(k))lt.call(k,l)&&xe(m,l,k[l]);return m},Ce=(m,k)=>ot(m,nt(k));var L=(m,k,l)=>new Promise((A,u)=>{var y=f=>{try{F(l.next(f))}catch(p){u(p)}},$=f=>{try{F(l.throw(f))}catch(p){u(p)}},F=f=>f.done?A(f.value):Promise.resolve(f.value).then(y,$);F((l=l.apply(m,k)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),E=require("./exports-BD7Y_TjZ.cjs"),rt={key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},at={class:"flex items-center space-x-2 flex-1 overflow-hidden"},st=["innerHTML"],ut={class:"text-sm font-medium font-mono truncate"},ct={class:"flex items-center space-x-2"},dt=["aria-pressed"],mt=["disabled"],ft=["disabled"],vt=["disabled"],ht=["aria-label"],gt={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},pt={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},wt=["aria-pressed"],yt={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},kt={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},xt=["aria-label"],bt={class:"code-loading-placeholder"},Ct={class:"sr-only","aria-live":"polite",role:"status"},Ee=10,Be=36,Me=1,Ne=0,Se=1.5,J=1,Et=o.defineComponent({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},customId:{}},emits:["previewCode","copy"],setup(m,{emit:k}){var ge,pe;const l=m,A=k,{t:u}=E.useSafeI18n(),y=o.ref(null),$=o.ref(null),F=o.ref(!1),f=o.ref(String((ge=l.node.language)!=null?ge:"")),p=o.ref(!1),x=o.ref(!1),j=o.ref(!1),ae=o.ref(!1),D=o.ref(null);let Q=0;const Ve=E.useViewportPriority(),R=o.ref(null),H=o.ref(typeof window=="undefined");typeof window!="undefined"&&o.watch(()=>$.value,t=>{var n;if((n=R.value)==null||n.destroy(),R.value=null,!t){H.value=!1;return}const e=Ve(t,{rootMargin:"400px"});R.value=e,H.value=e.isVisible.value,e.whenVisible.then(()=>{H.value=!0})},{immediate:!0}),o.onBeforeUnmount(()=>{var t;(t=R.value)==null||t.destroy(),R.value=null});let O=null,q=null,Z=()=>{},_=()=>{},W=()=>null,T=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),S=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),X=()=>{},ee=()=>{},I=null,se=()=>{var t;return String((t=l.node.language)!=null?t:"plaintext")},te=()=>L(null,null,function*(){});const B=o.computed(()=>l.node.diff),oe=o.ref(!1);typeof window!="undefined"&&L(null,null,function*(){try{const t=yield E.getUseMonaco();if(!t){oe.value=!0;return}const e=t.useMonaco,n=t.detectLanguage;if(typeof n=="function"&&(se=n),typeof e=="function"){const i=he();if(i&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(i))throw new Error("Preferred theme not in provided themes array");const r=e(Ce(be({wordWrap:"on",wrappingIndent:"same",themes:l.themes,theme:i},l.monacoOptions||{}),{onThemeChange(){De()}}));O=r.createEditor||O,q=r.createDiffEditor||q,Z=r.updateCode||Z,_=r.updateDiff||_,W=r.getEditor||W,T=r.getEditorView||T,S=r.getDiffEditorView||S,X=r.cleanupEditor||X,ee=r.safeClean||r.cleanupEditor||ee,te=r.setTheme||te,ae.value=!0,y.value&&(yield le(y.value))}}catch(t){oe.value=!0}});const M=o.ref(typeof((pe=l.monacoOptions)==null?void 0:pe.fontSize)=="number"?l.monacoOptions.fontSize:Number.NaN),c=o.ref(M.value),Fe=o.computed(()=>{const t=M.value,e=c.value;return typeof t=="number"&&Number.isFinite(t)&&t>0&&typeof e=="number"&&Number.isFinite(e)&&e>0});function Te(){try{const t=y.value;if(!t)return null;const e=t.querySelector(".view-lines .view-line");if(e){const n=Math.ceil(e.getBoundingClientRect().height);if(n>0)return n}}catch(t){}return null}function ue(){var t,e,n,i,r;try{const a=B.value?(n=(e=(t=S())==null?void 0:t.getModifiedEditor)==null?void 0:e.call(t))!=null?n:S():T(),g=W(),w=(i=g==null?void 0:g.EditorOption)==null?void 0:i.fontInfo;if(a&&w!=null){const v=(r=a.getOption)==null?void 0:r.call(a,w),s=v==null?void 0:v.fontSize;if(typeof s=="number"&&Number.isFinite(s)&&s>0)return s}}catch(a){}try{const a=y.value;if(a){const g=a.querySelector(".view-lines .view-line");if(g)try{if(typeof window!="undefined"&&typeof window.getComputedStyle=="function"){const w=window.getComputedStyle(g).fontSize,v=w&&w.match(/^(\d+(?:\.\d+)?)/);if(v)return Number.parseFloat(v[1])}}catch(w){}}}catch(a){}return null}function ne(t){var i,r;try{const a=W(),g=(i=a==null?void 0:a.EditorOption)==null?void 0:i.lineHeight;if(g!=null){const w=(r=t==null?void 0:t.getOption)==null?void 0:r.call(t,g);if(typeof w=="number"&&w>0)return w}}catch(a){}const e=Te();if(e&&e>0)return e;const n=Number.isFinite(c.value)&&c.value>0?c.value:12;return Math.max(12,Math.round(n*1.35))}function ie(){var e;if(Number.isFinite(c.value)&&c.value>0&&Number.isFinite(M.value))return c.value;const t=ue();return typeof((e=l.monacoOptions)==null?void 0:e.fontSize)=="number"?(M.value=l.monacoOptions.fontSize,c.value=l.monacoOptions.fontSize,c.value):t&&t>0?(M.value=t,c.value=t,t):(M.value=12,c.value=12,12)}function He(){const t=ie(),e=Math.min(Be,t+Me);c.value=e}function Oe(){const t=ie(),e=Math.max(Ee,t-Me);c.value=e}function Le(){ie(),Number.isFinite(M.value)&&(c.value=M.value)}function ce(){var t,e,n,i,r,a,g,w,v,s,h;try{const d=B.value?S():T();if(!d)return null;if(B.value&&(d!=null&&d.getOriginalEditor)&&(d!=null&&d.getModifiedEditor)){const C=(t=d.getOriginalEditor)==null?void 0:t.call(d),V=(e=d.getModifiedEditor)==null?void 0:e.call(d),Je=((n=C==null?void 0:C.getContentHeight)==null?void 0:n.call(C))||0,Ke=((i=V==null?void 0:V.getContentHeight)==null?void 0:i.call(V))||0,ye=Math.max(Je,Ke);if(ye>0)return Math.ceil(ye+J);const Qe=((g=(a=(r=C==null?void 0:C.getModel)==null?void 0:r.call(C))==null?void 0:a.getLineCount)==null?void 0:g.call(a))||1,Ze=((s=(v=(w=V==null?void 0:V.getModel)==null?void 0:w.call(V))==null?void 0:v.getLineCount)==null?void 0:s.call(v))||1,_e=Math.max(Qe,Ze),et=Math.max(ne(C),ne(V));return Math.ceil(_e*(et+Se)+Ne+J)}else if(d!=null&&d.getContentHeight){const C=d.getContentHeight();if(C>0)return Math.ceil(C+J)}const re=(h=d==null?void 0:d.getModel)==null?void 0:h.call(d);let we=1;re&&typeof re.getLineCount=="function"&&(we=re.getLineCount());const Ge=ne(d);return Math.ceil(we*(Ge+Se)+Ne+J)}catch(d){return null}}function De(){var w,v,s;const t=y.value,e=$.value;if(!t||!e)return;const n=t.querySelector(".monaco-editor")||t;let i=null;try{typeof window!="undefined"&&typeof window.getComputedStyle=="function"&&(i=window.getComputedStyle(n))}catch(h){i=null}const r=String((w=i==null?void 0:i.getPropertyValue("--vscode-editor-foreground"))!=null?w:""),a=String((v=i==null?void 0:i.getPropertyValue("--vscode-editor-background"))!=null?v:""),g=String((s=i==null?void 0:i.getPropertyValue("--vscode-editor-hoverHighlightBackground"))!=null?s:"");if(r&&a)return e.style.setProperty("--vscode-editor-foreground",r.trim()),e.style.setProperty("--vscode-editor-background",a.trim()),e.style.setProperty("--vscode-editor-selectionBackground",g.trim()),!0}function P(){try{const t=y.value;if(!t)return;const e=t.getBoundingClientRect(),n=window.scrollY+e.top,i=ce();if(i!=null&&i>0){const r=e.height;t.style.height=`${Math.ceil(i)}px`,t.style.maxHeight="none";const a=Math.ceil(i)-r;a!==0&&n<window.scrollY&&window.scrollBy(0,a)}}catch(t){}}function z(){var t;try{const e=y.value;if(!e)return;const n=e.getBoundingClientRect(),i=window.scrollY+n.top,r=n.height,a=Pe();if(Q>0&&(Q--,D.value!=null)){const s=Math.min(D.value,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const h=Math.ceil(s)-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h);return}const g=ce();if(g!=null&&g>0){const s=Math.min(g,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const h=Math.ceil(s)-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h);return}if(D.value!=null){const s=Math.min(D.value,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const h=Math.ceil(s)-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h);return}const w=Math.ceil(((t=e.getBoundingClientRect)==null?void 0:t.call(e).height)||0);if(w>0){const s=Math.min(w,a);e.style.height=`${Math.ceil(s)}px`,e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto";const h=Math.ceil(s)-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h);return}const v=Number.parseFloat(e.style.height);if(!Number.isNaN(v)&&v>0){const s=Math.ceil(Math.min(v,a));e.style.height=`${s}px`;const h=s-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h)}else{const s=Math.ceil(a);e.style.height=`${s}px`;const h=s-r;h!==0&&i<window.scrollY&&window.scrollBy(0,h)}e.style.maxHeight=`${Math.ceil(a)}px`,e.style.overflow="auto"}catch(e){}}function Pe(){var n,i;const t=(i=(n=l.monacoOptions)==null?void 0:n.MAX_HEIGHT)!=null?i:500;if(typeof t=="number")return t;const e=String(t).match(/^(\d+(?:\.\d+)?)/);return e?Number.parseFloat(e[1]):500}const de=o.computed(()=>{const t=f.value.trim().toLowerCase();return l.isShowPreview&&(t==="html"||t==="svg")}),Y=o.computed(()=>f.value.trim().toLowerCase()==="mermaid");o.watch(()=>l.node.language,t=>{f.value=t}),o.watch(()=>l.node.code,t=>L(null,null,function*(){var e,n;if(l.stream!==!1){if(f.value||(f.value=se(t)),O&&!j.value&&y.value)try{yield le(y.value)}catch(i){}B.value?_(String((e=l.node.originalCode)!=null?e:""),String((n=l.node.updatedCode)!=null?n:""),f.value):Z(t,f.value),p.value&&E.safeRaf(()=>P())}}));const ze=o.computed(()=>{const t=f.value.trim().toLowerCase();return E.languageMap[t]||t.charAt(0).toUpperCase()+t.slice(1)}),$e=o.computed(()=>{const t=f.value.trim().toLowerCase();return E.getLanguageIcon(t.split(":")[0])}),Re=o.computed(()=>{const t={},e=r=>{if(r!=null)return typeof r=="number"?`${r}px`:String(r)},n=e(l.minWidth),i=e(l.maxWidth);return n&&(t.minWidth=n),i&&(t.maxWidth=i),t});function Ie(){return L(this,null,function*(){try{typeof navigator!="undefined"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(l.node.code)),F.value=!0,A("copy",l.node.code),setTimeout(()=>{F.value=!1},1e3)}catch(t){console.error("复制失败:",t)}})}function me(t){const e=t;return!e||e.disabled}function N(t,e,n="top"){if(me(t.currentTarget))return;const i=t,r=(i==null?void 0:i.clientX)!=null&&(i==null?void 0:i.clientY)!=null?{x:i.clientX,y:i.clientY}:void 0;E.showTooltipForAnchor(t.currentTarget,e,n,!1,r,l.isDark)}function b(){E.hideTooltip()}function fe(t){if(me(t.currentTarget))return;const e=F.value?u("common.copied")||"Copied":u("common.copy")||"Copy",n=t,i=(n==null?void 0:n.clientX)!=null&&(n==null?void 0:n.clientY)!=null?{x:n.clientX,y:n.clientY}:void 0;E.showTooltipForAnchor(t.currentTarget,e,"top",!1,i,l.isDark)}function Ye(){p.value=!p.value;const t=B.value?S():T(),e=y.value;!t||!e||(p.value?(U(!0),e.style.maxHeight="none",e.style.overflow="visible",P()):(U(!1),e.style.overflow="auto",z()))}function Ae(){var t,e,n;if(x.value=!x.value,x.value){if(y.value){const i=Math.ceil(((e=(t=y.value).getBoundingClientRect)==null?void 0:e.call(t).height)||0);i>0&&(D.value=i)}U(!1)}else{p.value&&U(!0),y.value&&D.value!=null&&(y.value.style.height=`${D.value}px`);const i=B.value?S():T();try{(n=i==null?void 0:i.layout)==null||n.call(i)}catch(r){}Q=2,E.safeRaf(()=>{p.value?P():z()})}}o.watch(()=>c.value,(t,e)=>{const n=B.value?S():T();n&&typeof t=="number"&&Number.isFinite(t)&&t>0&&(n.updateOptions({fontSize:t}),p.value&&!x.value&&P())},{flush:"post",immediate:!1});function je(){if(!de.value)return;const t=(f.value||l.node.language).toLowerCase(),e=t==="html"?"text/html":"image/svg+xml",n=t==="html"?u("artifacts.htmlPreviewTitle")||"HTML Preview":u("artifacts.svgPreviewTitle")||"SVG Preview";A("previewCode",{node:l.node,artifactType:e,artifactTitle:n,id:`temp-${t}-${Date.now()}`})}function U(t){var e,n;try{if(B.value){const i=S();(e=i==null?void 0:i.updateOptions)==null||e.call(i,{automaticLayout:t})}else{const i=T();(n=i==null?void 0:i.updateOptions)==null||n.call(i,{automaticLayout:t})}}catch(i){}}function qe(t){return L(this,null,function*(){var n,i,r;if(!O)return;B.value?(ee(),q?yield q(t,String((n=l.node.originalCode)!=null?n:""),String((i=l.node.updatedCode)!=null?i:""),f.value):yield O(t,l.node.code,f.value)):yield O(t,l.node.code,f.value);const e=B.value?S():T();if(typeof((r=l.monacoOptions)==null?void 0:r.fontSize)=="number")e==null||e.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),M.value=l.monacoOptions.fontSize,c.value=l.monacoOptions.fontSize;else{const a=ue();a&&a>0?(M.value=a,c.value=a):(M.value=12,c.value=12)}!p.value&&!x.value&&z(),l.loading===!1&&(yield o.nextTick(),E.safeRaf(()=>{p.value&&!x.value?P():x.value||z()}))})}function le(t){return O?I||(j.value=!0,I=L(null,null,function*(){yield qe(t)}).finally(()=>{I=null}),I):null}const ve=o.watch(()=>[y.value,Y.value,B.value,l.stream,l.loading,ae.value,H.value],w=>L(null,[w],function*([t,e,n,i,r,a,g]){if(!t||!O||!g||i===!1&&r!==!1)return;if(Y.value){X(),ve();return}const v=le(t);v&&(yield v,ve())})),We=o.watch(()=>[l.darkTheme,l.lightTheme,j.value,H.value],()=>{if(!(!j.value||!H.value)){if(Y.value)return We();Xe()}});function he(){return l.isDark?l.darkTheme:l.lightTheme}function Xe(){const t=he();t&&te(t)}const Ue=o.watch(()=>[l.monacoOptions,H.value],()=>{var n,i;if(!O||!H.value)return;if(Y.value)return Ue();const t=B.value?S():T(),e=typeof((n=l.monacoOptions)==null?void 0:n.fontSize)=="number"?l.monacoOptions.fontSize:Number.isFinite(c.value)?c.value:void 0;typeof e=="number"&&Number.isFinite(e)&&e>0&&((i=t==null?void 0:t.updateOptions)==null||i.call(t,{fontSize:e})),p.value&&!x.value?P():x.value||z()},{deep:!0}),G=o.watch(()=>[l.loading,H.value],n=>L(null,[n],function*([t,e]){if(e){if(Y.value){o.nextTick(()=>{G==null||G()});return}t||(yield o.nextTick(),E.safeRaf(()=>{x.value||(p.value?P():z()),G()}))}}),{immediate:!0,flush:"post"});return o.onUnmounted(()=>{X()}),(t,e)=>oe.value?(o.openBlock(),o.createBlock(o.unref(E._sfc_main),{key:0,node:m.node,loading:l.loading},null,8,["node","loading"])):(o.openBlock(),o.createElementBlock("div",{key:1,ref_key:"container",ref:$,style:o.normalizeStyle(Re.value),class:o.normalizeClass(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[l.isDark?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",{"is-rendering":l.loading,"is-dark":l.isDark}]])},[l.showHeader?(o.openBlock(),o.createElementBlock("div",rt,[o.renderSlot(t.$slots,"header-left",{},()=>[o.createElementVNode("div",at,[o.createElementVNode("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:$e.value},null,8,st),o.createElementVNode("span",ut,o.toDisplayString(ze.value),1)])],!0),o.renderSlot(t.$slots,"header-right",{},()=>[o.createElementVNode("div",ct,[o.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":x.value,onClick:Ae,onMouseenter:e[0]||(e[0]=n=>N(n,x.value?o.unref(u)("common.expand")||"Expand":o.unref(u)("common.collapse")||"Collapse")),onFocus:e[1]||(e[1]=n=>N(n,x.value?o.unref(u)("common.expand")||"Expand":o.unref(u)("common.collapse")||"Collapse")),onMouseleave:b,onBlur:b},[(o.openBlock(),o.createElementBlock("svg",{style:o.normalizeStyle({rotate:x.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:"w-3 h-3"},[...e[17]||(e[17]=[o.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,dt),l.showFontSizeButtons&&l.enableFontSizeControl?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Number.isFinite(c.value)?c.value<=Ee:!1,onClick:e[2]||(e[2]=n=>Oe()),onMouseenter:e[3]||(e[3]=n=>N(n,o.unref(u)("common.decrease")||"Decrease")),onFocus:e[4]||(e[4]=n=>N(n,o.unref(u)("common.decrease")||"Decrease")),onMouseleave:b,onBlur:b},[...e[18]||(e[18]=[o.createElementVNode("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:"w-3 h-3"},[o.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,mt),o.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!Fe.value||c.value===M.value,onClick:e[5]||(e[5]=n=>Le()),onMouseenter:e[6]||(e[6]=n=>N(n,o.unref(u)("common.reset")||"Reset")),onFocus:e[7]||(e[7]=n=>N(n,o.unref(u)("common.reset")||"Reset")),onMouseleave:b,onBlur:b},[...e[19]||(e[19]=[o.createElementVNode("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:"w-3 h-3"},[o.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o.createElementVNode("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),o.createElementVNode("path",{d:"M3 3v5h5"})])],-1)])],40,ft),o.createElementVNode("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:Number.isFinite(c.value)?c.value>=Be:!1,onClick:e[8]||(e[8]=n=>He()),onMouseenter:e[9]||(e[9]=n=>N(n,o.unref(u)("common.increase")||"Increase")),onFocus:e[10]||(e[10]=n=>N(n,o.unref(u)("common.increase")||"Increase")),onMouseleave:b,onBlur:b},[...e[20]||(e[20]=[o.createElementVNode("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:"w-3 h-3"},[o.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,vt)],64)):o.createCommentVNode("",!0),l.showCopyButton?(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":F.value?o.unref(u)("common.copied")||"Copied":o.unref(u)("common.copy")||"Copy",onClick:Ie,onMouseenter:e[11]||(e[11]=n=>fe(n)),onFocus:e[12]||(e[12]=n=>fe(n)),onMouseleave:b,onBlur:b},[F.value?(o.openBlock(),o.createElementBlock("svg",pt,[...e[22]||(e[22]=[o.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(o.openBlock(),o.createElementBlock("svg",gt,[...e[21]||(e[21]=[o.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[o.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),o.createElementVNode("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,ht)):o.createCommentVNode("",!0),l.showExpandButton?(o.openBlock(),o.createElementBlock("button",{key:2,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":p.value,onClick:Ye,onMouseenter:e[13]||(e[13]=n=>N(n,p.value?o.unref(u)("common.collapse")||"Collapse":o.unref(u)("common.expand")||"Expand")),onFocus:e[14]||(e[14]=n=>N(n,p.value?o.unref(u)("common.collapse")||"Collapse":o.unref(u)("common.expand")||"Expand")),onMouseleave:b,onBlur:b},[p.value?(o.openBlock(),o.createElementBlock("svg",yt,[...e[23]||(e[23]=[o.createElementVNode("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)])])):(o.openBlock(),o.createElementBlock("svg",kt,[...e[24]||(e[24]=[o.createElementVNode("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)])]))],40,wt)):o.createCommentVNode("",!0),de.value&&l.showPreviewButton?(o.openBlock(),o.createElementBlock("button",{key:3,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":o.unref(u)("common.preview")||"Preview",onClick:je,onMouseenter:e[15]||(e[15]=n=>N(n,o.unref(u)("common.preview")||"Preview")),onFocus:e[16]||(e[16]=n=>N(n,o.unref(u)("common.preview")||"Preview")),onMouseleave:b,onBlur:b},[...e[25]||(e[25]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[o.createElementVNode("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[o.createElementVNode("path",{d:"M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496"}),o.createElementVNode("path",{d:"M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23"})])],-1)])],40,xt)):o.createCommentVNode("",!0)])],!0)])):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{ref_key:"codeEditor",ref:y,class:o.normalizeClass(["code-editor-container",[m.stream?"":"code-height-placeholder"]])},null,2),[[o.vShow,!x.value&&(m.stream?!0:!m.loading)]]),o.withDirectives(o.createElementVNode("div",bt,[o.renderSlot(t.$slots,"loading",{loading:m.loading,stream:m.stream},()=>[e[26]||(e[26]=o.createElementVNode("div",{class:"loading-skeleton"},[o.createElementVNode("div",{class:"skeleton-line"}),o.createElementVNode("div",{class:"skeleton-line"}),o.createElementVNode("div",{class:"skeleton-line short"})],-1))],!0)],512),[[o.vShow,!m.stream&&m.loading]]),o.createElementVNode("span",Ct,o.toDisplayString(F.value?o.unref(u)("common.copied")||"Copied":""),1)],6))}}),K=E._export_sfc(Et,[["__scopeId","data-v-c3ca09d1"]]);K.install=m=>{m.component(K.__name,K)};exports.default=K;