markstream-vue 0.0.10-beta.5 → 0.0.10

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.
@@ -1 +1 @@
1
- var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,r=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&a(e,t,n[t]);if(o)for(var t of o(n))i.call(n,t)&&a(e,t,n[t]);return e},u=(e,o)=>n(e,t(o)),d=(e,n,t)=>new Promise((o,l)=>{var i=e=>{try{r(t.next(e))}catch(n){l(n)}},a=e=>{try{r(t.throw(e))}catch(n){l(n)}},r=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,a);r((t=t.apply(e,n)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as g,normalizeClass as y,withModifiers as w,toDisplayString as b,unref as k,getCurrentInstance as x,ref as C,watch as S,onBeforeUnmount as M,nextTick as B,createElementBlock as O,normalizeStyle as E,renderSlot as L,createCommentVNode as P,Fragment as H,withDirectives as D,vShow as N}from"vue";import{b as F,_,n as z,k as T,u as R,l as j,c as $,m as A,o as U,p as W,h as q,q as V,e as I,v as X}from"./exports.js";const Y={class:"markstream-vue"},G={class:"html-preview-frame__header"},J={class:"html-preview-frame__title"},K={class:"html-preview-frame__label"},Q=["srcdoc"],Z=/* @__PURE__ */_(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const n=e,{t}=F(),o=c(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`});function l(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(m(),p(h,{to:"body"},[g("div",Y,[g("div",{class:y(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":n.isDark}]),onClick:l[2]||(l[2]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})},[g("div",{class:y(["html-preview-frame",{"html-preview-frame--dark":n.isDark}]),onClick:l[1]||(l[1]=w(()=>{},["stop"]))},[g("div",G,[g("div",J,[l[3]||(l[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",K,b(n.title||k(t)("common.preview")||"Preview"),1)]),g("button",{type:"button",class:y(["html-preview-frame__close",{"html-preview-frame__close--dark":n.isDark}]),onClick:l[0]||(l[0]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})}," × ",2)]),g("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:o.value},null,8,Q)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let ee=null,ne=null,te=null,oe=null,le=null,ie=null;const ae=/* @__PURE__ */new WeakMap;let re=0;const ue=["data-markstream-enhanced"],de={class:"code-header-main"},se=["innerHTML"],ce={class:"code-header-copy"},ve={class:"code-header-title"},fe={key:0,class:"code-header-caption"},me={class:"code-header-actions"},pe=["aria-label"],he={class:"code-diff-stat removed"},ge={class:"code-diff-stat added"},ye=["aria-pressed"],we=["disabled"],be=["disabled"],ke=["disabled"],xe=["aria-label"],Ce={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"},Se={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"},Me=["aria-pressed"],Be={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"},Oe={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ee=["aria-label"],Le={class:"code-editor-layer"},Pe={class:"sr-only","aria-live":"polite",role:"status"},He="__markstreamMonacoPassiveTouch__",De=/* @__PURE__ */_(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},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},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},customId:{},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){var t;const o=e,l=n;"undefined"!=typeof window&&function(){var e;try{const n=window;if(n[He])return;const t=null==(e=window.Element)?void 0:e.prototype,o=null==t?void 0:t.addEventListener;if(!t||!o)return;t.addEventListener=function(e,n,t){return"touchstart"===e&&function(e,n){if(!e)return!1;const t=e;return!("function"!=typeof t.closest||!t.closest(".monaco-editor, .monaco-diff-editor")||n&&"object"==typeof n&&"passive"in n)}(this,t)?o.call(this,e,n,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(r({},e),{passive:!0}):{passive:!0}}(t)):o.call(this,e,n,t)},n[He]=!0}catch(n){}}();const i=x(),a=c(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:s}=F(),v=C(null),h=C(null),w=C(!1),_=C(z(o.node.language)),Y=c(()=>T(_.value)),G=c(()=>"plaintext"===Y.value),J=C(!1),K=C(!1),Q=C(!1),De=C(!1),Ne=C(!1);let Fe=null;const _e=C(null);let ze=0;const Te=R(),Re=C(null),je=C("undefined"==typeof window);"undefined"!=typeof window&&S(()=>h.value,e=>{var n;if(null==(n=Re.value)||n.destroy(),Re.value=null,!e)return void(je.value=!1);const t=Te(e,{rootMargin:"400px"});Re.value=t,je.value=t.isVisible.value,t.whenVisible.then(()=>{je.value=!0})},{immediate:!0}),M(()=>{var e;null==(e=Re.value)||e.destroy(),Re.value=null});let $e=null,Ae=null,Ue=()=>{},We=()=>{},qe=()=>null,Ve=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ie=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Xe=()=>{},Ye=()=>{},Ge=()=>{},Je=null,Ke=()=>{var e;return String(null!=(e=o.node.language)?e:"plaintext")},Qe=()=>d(null,null,function*(){});const Ze=[],en=[];let nn=null;const tn=c(()=>o.node.diff),on=C({removed:0,added:0}),ln=c(()=>`-${on.value.removed} +${on.value.added}`),an=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function rn(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return u(r(r({},an),t),{enabled:null==(n=t.enabled)||n})}return r({},an)}const un=c(()=>{var e;const n=o.monacoOptions?r({},o.monacoOptions):{};if(!tn.value)return n;const t=void 0===n.diffHideUnchangedRegions?r({},an):rn(n.diffHideUnchangedRegions),l=void 0===n.hideUnchangedRegions?void 0:rn(n.hideUnchangedRegions),i=null!=(e=n.diffUnchangedRegionStyle)?e:"line-info";return u(r(r(r({},{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:12,lineNumbersMinChars:2,glyphMargin:!1,fontSize:13,lineHeight:30,renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,padding:{top:10,bottom:"line-info"===i||"line-info-basic"===i||"metadata"===i?22:14},diffHideUnchangedRegions:t,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:i,diffHunkActionsOnHover:!0,diffHunkHoverHideDelayMs:160}),n),void 0===l?{}:{hideUnchangedRegions:l}),{diffHideUnchangedRegions:t})}),dn=c(()=>tn.value?"diff":"single"),sn=C(dn.value),cn=C(!1),vn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.wordWrap;return null==n||"off"!==String(n)}),fn=c(()=>!cn.value&&!De.value),mn=C(!1);"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield j();if(!e)return void(cn.value=!0);const n=e.useMonaco,t=e.detectLanguage;if("function"==typeof t&&(Ke=t),"function"==typeof n){const e=ct();if(e&&o.themes&&Array.isArray(o.themes)&&!o.themes.includes(e))throw new Error("Preferred theme not in provided themes array");nn=pt();const t=n(nn);$e=t.createEditor||$e,Ae=t.createDiffEditor||Ae,Ue=t.updateCode||Ue,We=t.updateDiff||We,qe=t.getEditor||qe,Ve=t.getEditorView||Ve,Ie=t.getDiffEditorView||Ie,Xe=t.cleanupEditor||Xe,Ye=t.safeClean||t.cleanupEditor||Ye,Ge=t.refreshDiffPresentation||Ge,Qe=t.setTheme||Qe,Ne.value=!0,v.value&&(yield ut(v.value))}}catch(e){cn.value=!0}});const pn=C("number"==typeof(null==(t=o.monacoOptions)?void 0:t.fontSize)?o.monacoOptions.fontSize:Number.NaN),hn=C(pn.value),gn=c(()=>{const e=pn.value,n=hn.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),yn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=hn.value;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12}),wn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.lineHeight;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:Math.round(1.5*yn.value)}),bn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.tabSize;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:4}),kn=c(()=>{const e=o.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),xn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.fontFamily;return r(r({fontSize:`${yn.value}px`,lineHeight:`${wn.value}px`,tabSize:bn.value},null!=kn.value?{minHeight:`${kn.value}px`}:{}),"string"==typeof n&&n.trim()?{"--markstream-code-font-family":n.trim()}:{})}),Cn=c(()=>null!=kn.value&&!De.value),Sn=c(()=>{if(Cn.value)return{minHeight:`${kn.value}px`}}),Mn=c(()=>{if(null!=kn.value)return{minHeight:`${kn.value}px`}});function Bn(){var e,n,t,o,l;try{const i=tn.value?null!=(t=null==(n=null==(e=Ie())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Ie():Ve(),a=qe(),r=null==(o=null==a?void 0:a.EditorOption)?void 0:o.fontInfo;if(i&&null!=r){const e=null==(l=i.getOption)?void 0:l.call(i,r),n=null==e?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n}}catch(i){}try{const e=v.value;if(e){const n=e.querySelector(".view-lines .view-line");if(n)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(n).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(i){}}}catch(i){}return null}function On(e){var n,t;try{const o=qe(),l=null==(n=null==o?void 0:o.EditorOption)?void 0:n.lineHeight;if(null!=l){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,l);if("number"==typeof n&&n>0)return n}}catch(i){}const o=function(){try{const e=v.value;if(!e)return null;const n=e.querySelector(".view-lines .view-line");if(n){const e=Math.ceil(n.getBoundingClientRect().height);if(e>0)return e}}catch(i){}return null}();if(o&&o>0)return o;const l=Number.isFinite(hn.value)&&hn.value>0?hn.value:12;return Math.max(12,Math.round(1.35*l))}function En(e,n){return"number"!=typeof e||"number"!=typeof n||e<1||n<e?0:n-e+1}function Ln(e){if(!e)return[];const n=e.split(/\r?\n/);return 1===n.length&&""===n[0]?[]:n}function Pn(){var e,n;tn.value?on.value=function(e,n){const t=Ln(e),o=Ln(n);let l=0,i=t.length-1,a=o.length-1;for(;l<=i&&l<=a&&t[l]===o[l];)l++;for(;i>=l&&a>=l&&t[i]===o[a];)i--,a--;return{removed:Math.max(0,i-l+1),added:Math.max(0,a-l+1)}}(String(null!=(e=o.node.originalCode)?e:""),String(null!=(n=o.node.updatedCode)?n:"")):on.value={removed:0,added:0}}function Hn(){var e;if(tn.value)try{const n=Ie(),t=null==(e=null==n?void 0:n.getLineChanges)?void 0:e.call(n);if(!Array.isArray(t))return void Pn();let o=0,l=0;for(const e of t)o+=En(e.originalStartLineNumber,e.originalEndLineNumber),l+=En(e.modifiedStartLineNumber,e.modifiedEndLineNumber);on.value={removed:o,added:l}}catch(n){Pn()}else on.value={removed:0,added:0}}function Dn(){var e;if(Number.isFinite(hn.value)&&hn.value>0&&Number.isFinite(pn.value))return hn.value;const n=Bn();return"number"==typeof(null==(e=o.monacoOptions)?void 0:e.fontSize)?(pn.value=o.monacoOptions.fontSize,hn.value=o.monacoOptions.fontSize,hn.value):n&&n>0?(pn.value=n,hn.value=n,n):(pn.value=12,hn.value=12,12)}function Nn(){var e,n,t,o,l,i,a,r,u,d,s,c,v,f;try{const m=tn.value?Ie():Ve();if(!m)return null;if(tn.value&&(null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(n=m.getModifiedEditor)?void 0:n.call(m);null==(t=null==v?void 0:v.layout)||t.call(v),null==(o=null==f?void 0:f.layout)||o.call(f);const p=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,h=(null==(i=null==f?void 0:f.getContentHeight)?void 0:i.call(f))||0,g=Math.max(p,h);if(g>0)return Math.ceil(g+1);const y=(null==(u=null==(r=null==(a=null==v?void 0:v.getModel)?void 0:a.call(v))?void 0:r.getLineCount)?void 0:u.call(r))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(y,w),k=Math.max(On(v),On(f));return Math.ceil(b*(k+1.5)+0+1)}if(null==m?void 0:m.getContentHeight){null==(v=null==m?void 0:m.layout)||v.call(m);const e=m.getContentHeight();if(e>0)return Math.ceil(e+1)}const p=null==(f=null==m?void 0:m.getModel)?void 0:f.call(m);let h=1;p&&"function"==typeof p.getLineCount&&(h=p.getLineCount());const g=On(m);return Math.ceil(h*(g+1.5)+0+1)}catch(m){return null}}function Fn(e){const n=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!n||n.length<3)return null;const[t,o,l]=n.slice(0,3).map(Number);return.2126*t+.7152*o+.0722*l}function _n(){var e,n,t,o,l,i,a,r;const u=v.value,d=h.value;if(!u||!d)return;if(tn.value)return d.style.removeProperty("--vscode-editor-foreground"),d.style.removeProperty("--vscode-editor-background"),void d.style.removeProperty("--vscode-editor-selectionBackground");const s=u.querySelector(".monaco-editor")||u,c=s.querySelector(".monaco-editor-background")||s,f=s.querySelector(".view-lines")||s;let m=null,p=null,g=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(s),p=c===s?m:window.getComputedStyle(c),g=f===s?m:window.getComputedStyle(f))}catch(C){m=null,p=null,g=null}const y=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),w=String(null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?n:"").trim(),b=String(null!=(o=null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?t:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?o:"").trim(),k=y||String(null!=(i=null!=(l=null==g?void 0:g.color)?l:null==m?void 0:m.color)?i:"").trim(),x=w||String(null!=(r=null!=(a=null==p?void 0:p.backgroundColor)?a:null==m?void 0:m.backgroundColor)?r:"").trim();if(function(e,n,t){if(!G.value)return!1;const o=Fn(e),l=Fn(n);return t?null!=o&&o>170||null!=l&&l<110:null!=o&&o<85||null!=l&&l>190}(x,k,d.classList.contains("is-dark")))return d.style.removeProperty("--vscode-editor-foreground"),d.style.removeProperty("--vscode-editor-background"),void d.style.removeProperty("--vscode-editor-selectionBackground");k&&d.style.setProperty("--vscode-editor-foreground",k),x&&d.style.setProperty("--vscode-editor-background",x),b&&d.style.setProperty("--vscode-editor-selectionBackground",b)}const zn=/auto|scroll|overlay/i;function Tn(e,n,t){var o;if("undefined"==typeof window)return;const l=Math.ceil(n),i=Math.ceil(t)-l;if(!i)return;const a=function(e){var n,t;if("undefined"==typeof window)return null;const o=null!=(n=null==e?void 0:e.ownerDocument)?n:document,l=o.scrollingElement||o.documentElement||o.body;let i=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;i&&i!==o.body&&i!==l;){const e=window.getComputedStyle(i),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(zn.test(n)||zn.test(t))return i;i=i.parentElement}return l}(e);if(!a)return;const r=null!=(o=e.ownerDocument)?o:document,u=a===r.body||a===r.documentElement||a===r.scrollingElement,d=u?0:a.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):a.scrollTop+=i)}function Rn(){try{const e=v.value;if(!e)return;const n=e.getBoundingClientRect().height,t=Nn();if(null!=t&&t>0){const o=Math.ceil(t);e.style.minHeight="0px",e.style.height=`${o}px`,e.style.maxHeight="none",e.style.overflow="visible",Tn(e,n,o)}}catch(e){}}function jn(){for(var e,n;Ze.length>0;)try{null==(n=null==(e=Ze.pop())?void 0:e.dispose)||n.call(e)}catch(t){}null!=Fe&&(X(Fe),Fe=null)}function $n(){for(var e;en.length>0;)try{null==(e=en.pop())||e()}catch(n){}}function An(){if($n(),!tn.value)return;const e=v.value;if(!e)return;const n=e.querySelector(".monaco-diff-editor");if(!n||n.classList.contains("side-by-side"))return;const t=Array.from(n.querySelectorAll(".editor.original .diff-hidden-lines")),o=Array.from(n.querySelectorAll(".editor.modified .diff-hidden-lines")),l=Math.min(t.length,o.length);for(let i=0;i<l;i++){const e=t[i],n=o[i].querySelector("a"),l=e.querySelector(".center > div:first-child");if(!n||!l)continue;const a=document.createElement("button");a.type="button",a.className="markstream-inline-fold-proxy";const r=n.getAttribute("title")||"Show Unchanged Region";a.title=r,a.setAttribute("aria-label",r);const u=n.querySelector(".codicon"),d=document.createElement("span");d.className=(null==u?void 0:u.className)||"codicon codicon-unfold",a.append(d);const s=e=>{e.preventDefault(),e.stopPropagation()},c=e=>{e.preventDefault(),e.stopPropagation(),n.click()},v=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n.click())};a.addEventListener("mousedown",s),a.addEventListener("click",c),a.addEventListener("keydown",v),l.replaceChildren(a),en.push(()=>{a.removeEventListener("mousedown",s),a.removeEventListener("click",c),a.removeEventListener("keydown",v),l.contains(a)&&l.replaceChildren()})}}function Un(){null==Fe&&(Fe=$(()=>{Fe=null,$(()=>{An(),K.value||(J.value?Rn():qn())})}))}function Wn(e,n,t){const o=Math.min(n,t),l=n>t+1;return e.style.minHeight="0px",e.style.height=`${Math.ceil(o)}px`,e.style.maxHeight=`${Math.ceil(t)}px`,e.style.overflow=l?"auto":"hidden",Math.ceil(o)}function qn(){var e;try{const n=v.value;if(!n)return;const t=n.getBoundingClientRect().height,l=function(){var e,n;const t=null!=(n=null==(e=o.monacoOptions)?void 0:e.MAX_HEIGHT)?n:500;if("number"==typeof t)return t;const l=String(t).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(ze>0&&(ze--,null!=_e.value))return void Tn(n,t,Wn(n,_e.value,l));const i=Nn();if(null!=i&&i>0)return void Tn(n,t,Wn(n,i,l));if(null!=_e.value)return void Tn(n,t,Wn(n,_e.value,l));const a=Math.ceil((null==(e=n.getBoundingClientRect)?void 0:e.call(n).height)||0);if(a>0)return void Tn(n,t,Wn(n,a,l));const r=Number.parseFloat(n.style.height);!Number.isNaN(r)&&r>0?Tn(n,t,Wn(n,r,l)):Tn(n,t,Wn(n,l,l))}catch(n){}}const Vn=c(()=>o.isShowPreview&&("html"===_.value||"svg"===_.value));S(()=>o.node.language,e=>{_.value=z(e)}),S(()=>[o.node.originalCode,o.node.updatedCode,tn.value],()=>{Pn(),$(()=>Hn())},{immediate:!0}),S(()=>[o.node.originalCode,o.node.updatedCode,Y.value,tn.value],e=>d(null,[e],function*([e,n,t,l]){if(!1!==o.stream&&l){if($e&&!Q.value&&v.value)try{yield ut(v.value)}catch(i){}We(String(null!=e?e:""),String(null!=n?n:""),Y.value),J.value&&$(()=>Rn())}})),S(()=>o.node.code,e=>d(null,null,function*(){if(!1!==o.stream&&(_.value||(_.value=z(Ke(e))),!tn.value)){if($e&&!Q.value&&v.value)try{yield ut(v.value)}catch(n){}Ue(e,Y.value),J.value&&$(()=>Rn())}}));const In=c(()=>{const e=_.value;return e?A[e]||e.charAt(0).toUpperCase()+e.slice(1):A[""]||"Plain Text"});const Xn=c(()=>{var e;return function(e){const n=function(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let i=3;for(;o[i]===l;)i+=1;return o.slice(i).trim()}(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=o.node.raw)?e:""))}),Yn=c(()=>Xn.value||In.value),Gn=c(()=>Xn.value?tn.value?`Diff / ${In.value}`:In.value:""),Jn=c(()=>(U.value,W(_.value||""))),Kn=c(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(o.minWidth),l=n(o.maxWidth);return t&&(e.minWidth=t),l&&(e.maxWidth=l),tn.value?(e.color="var(--markstream-diff-shell-fg)",e.borderColor="var(--markstream-diff-shell-border)"):(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),Qn=c(()=>{if(!tn.value)return{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg))"}}),Zn=c(()=>!1!==o.showTooltips);function et(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(o.node.code)),w.value=!0,l("copy",o.node.code),setTimeout(()=>{w.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function nt(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function tt(e,n,t="top"){if(!Zn.value)return;const l=nt(e);if(!l)return;const i=e,a=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0;I(l,n,t,!1,a,o.isDark)}function ot(){Zn.value&&q()}function lt(e){if(!Zn.value)return;const n=nt(e);if(!n)return;const t=w.value?s("common.copied")||"Copied":s("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;I(n,t,"top",!1,i,o.isDark)}function it(){var e,n,t;if(K.value=!K.value,K.value){if(v.value){const t=Math.ceil((null==(n=(e=v.value).getBoundingClientRect)?void 0:n.call(e).height)||0);t>0&&(_e.value=t)}rt(!1)}else{J.value&&rt(!0),v.value&&null!=_e.value&&(v.value.style.height=`${_e.value}px`);const e=tn.value?Ie():Ve();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(o){}ze=2,$(()=>{J.value?Rn():qn()})}}function at(){if(!Vn.value)return;const e=_.value;if(a.value){const n="html"===e?"text/html":"image/svg+xml",t="html"===e?s("artifacts.htmlPreviewTitle")||"HTML Preview":s("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:o.node,artifactType:n,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&(mn.value=!mn.value)}function rt(e){var n,t;try{if(tn.value){const t=Ie();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}else{const n=Ve();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}}catch(o){}}function ut(e){if(!$e)return null;if(Je)return Je;if(Q.value&&De.value)return Promise.resolve();Q.value=!0;const n=d(null,null,function*(){yield function(e){return d(this,null,function*(){var n,t,l;if(!$e)return;jn(),$n(),function(e){e.replaceChildren()}(e),tn.value?(Ye(),Ae?yield Ae(e,String(null!=(n=o.node.originalCode)?n:""),String(null!=(t=o.node.updatedCode)?t:""),Y.value):yield $e(e,o.node.code,Y.value)):yield $e(e,o.node.code,Y.value);const i=tn.value?Ie():Ve();if("number"==typeof(null==(l=o.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:o.monacoOptions.fontSize,automaticLayout:!1}),pn.value=o.monacoOptions.fontSize,hn.value=o.monacoOptions.fontSize;else{const e=Bn();e&&e>0?(pn.value=e,hn.value=e):(pn.value=12,hn.value=12)}J.value||K.value||qn(),!1===o.loading&&(yield B(),$(()=>{J.value&&!K.value?Rn():K.value||qn()})),yield B(),De.value=!0,function(){var e,n,t,o,l;if(jn(),tn.value){const o=Ie(),l=null==(e=null==o?void 0:o.getOriginalEditor)?void 0:e.call(o),a=null==(n=null==o?void 0:o.getModifiedEditor)?void 0:n.call(o),r=(e,n)=>{try{const t=null==e?void 0:e[n];if("function"!=typeof t)return;const o=t.call(e,()=>Un());o&&Ze.push(o)}catch(t){}};try{const e=null==(t=null==o?void 0:o.onDidUpdateDiff)?void 0:t.call(o,()=>{Un(),$(()=>Hn())});e&&Ze.push(e)}catch(i){}r(l,"onDidContentSizeChange"),r(a,"onDidContentSizeChange"),r(l,"onDidLayoutChange"),r(a,"onDidLayoutChange")}else{const e=Ve();try{const n=null==(o=null==e?void 0:e.onDidContentSizeChange)?void 0:o.call(e,()=>Un());n&&Ze.push(n)}catch(i){}try{const n=null==(l=null==e?void 0:e.onDidLayoutChange)?void 0:l.call(e,()=>Un());n&&Ze.push(n)}catch(i){}}}(),_n(),An(),Hn(),Un()})}(e)});return Je=n.finally(()=>{Je=null}),Je}S(Zn,e=>{e||q()}),S(()=>hn.value,(e,n)=>{const t=tn.value?Ie():Ve();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),J.value&&!K.value&&Rn())},{flush:"post",immediate:!1});const dt=S(()=>[v.value,tn.value,o.stream,o.loading,Ne.value,je.value],e=>d(null,[e],function*([e,n,t,o,l,i]){if(!e||!$e)return;if(!i)return;if(!1===t&&!1!==o)return;const a=ut(e);if(a){try{yield a}catch(r){De.value=!1}dt()}}));function st(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function ct(){var e;const n=o.isDark?o.darkTheme:o.lightTheme,t=null==(e=un.value)?void 0:e.theme,l=null!=n?n:t,i=Array.isArray(o.themes)?o.themes:[];if(!i.length||null==l)return l;const a=st(l),r=i.map(e=>st(e)).filter(e=>!!e);if(!a||r.includes(a))return l;const u=st(t);return null!=t&&u&&r.includes(u)?t:i[0]}S(dn,(e,n)=>d(null,null,function*(){if(e!==n&&(sn.value=e,$e&&v.value&&Q.value&&(!1!==o.stream||!1===o.loading)&&je.value))try{De.value=!1,Q.value=!1,Je=null,jn(),$n(),Ye(),yield B(),yield ut(v.value)}catch(t){De.value=!1}}));const vt=c(()=>function(e){var n;const t=(null!=(n=st(e))?n:"").toLowerCase();return t?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>t.includes(e))&&!["light","latte","dawn","lotus"].some(e=>t.includes(e)):!!o.isDark}(ct())),ft=c(()=>{var e;if(!tn.value)return vt.value?"dark":"light";const n=null==(e=un.value)?void 0:e.diffAppearance;return"light"===n||"dark"===n?n:o.isDark?"dark":"light"}),mt=c(()=>tn.value?"dark"===ft.value:vt.value);function pt(){return u(r(u(r({wordWrap:"on",wrappingIndent:"same",themes:o.themes},un.value||{}),{theme:ct()}),tn.value?{diffAppearance:ft.value}:{}),{onThemeChange(){_n()}})}function ht(){const e=pt();if(!nn)return nn=e,nn;for(const n of Object.keys(nn))n in e||delete nn[n];return Object.assign(nn,e),nn}const gt=c(()=>{var e,n,t,o,l,i,a,r,u,d,s,c,v,f;return JSON.stringify({diffLineStyle:null!=(n=null==(e=un.value)?void 0:e.diffLineStyle)?n:"background",diffUnchangedRegionStyle:null!=(o=null==(t=un.value)?void 0:t.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:null==(i=null==(l=un.value)?void 0:l.diffHideUnchangedRegions)||i,renderSideBySide:null==(r=null==(a=un.value)?void 0:a.renderSideBySide)||r,enableSplitViewResizing:null==(d=null==(u=un.value)?void 0:u.enableSplitViewResizing)||d,ignoreTrimWhitespace:null==(c=null==(s=un.value)?void 0:s.ignoreTrimWhitespace)||c,originalEditable:null!=(f=null==(v=un.value)?void 0:v.originalEditable)&&f})});S(()=>[o.monacoOptions,je.value],()=>{var e,n;if(ht(),!$e||!je.value)return;const t=tn.value?Ie():Ve(),l="number"==typeof(null==(e=o.monacoOptions)?void 0:e.fontSize)?o.monacoOptions.fontSize:Number.isFinite(hn.value)?hn.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(n=null==t?void 0:t.updateOptions)||n.call(t,{fontSize:l})),J.value&&!K.value?Rn():K.value||qn()},{deep:!0}),S(()=>[ct(),ft.value,Ne.value,Q.value,je.value],()=>{Ne.value&&Q.value&&je.value&&function(){ht();const e=ct(),n=()=>{tn.value&&Ge(),$(()=>{_n(),Un()})};e?function(e,n){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=ae.get(e);if(t)return t;try{const n=JSON.stringify(e);if(n)return ae.set(e,n),n}catch(n){}const o="__theme_"+ ++re;return ae.set(e,o),o}return String(e)}(n);return t?(ie=e,ee||le!==t?ee?(oe===t||ne===t||(te=n,oe=t),ee):(te=n,oe=t,ee=d(null,null,function*(){for(;oe&&null!=te;){const t=te,o=oe;if(te=null,oe=null,le!==o)try{ne=o,yield(null!=ie?ie:e)(t),le=o}catch(n){}}}).finally(()=>{ee=null,ne=null}),ee):Promise.resolve()):Promise.resolve()}(Qe,e).then(n).catch(()=>{}):n()}()},{flush:"post"}),S(()=>[gt.value,Ne.value,je.value],(e,n)=>d(null,[e,n],function*([e,n,t],[l]){if(ht(),n&&t&&$e&&v.value&&Q.value&&e!==l&&(!1!==o.stream||!1===o.loading))try{De.value=!1,Q.value=!1,Je=null,jn(),$n(),Ye(),yield B(),yield ut(v.value)}catch(i){De.value=!1}}),{flush:"post"});const yt=S(()=>[o.loading,je.value],(e,n)=>d(null,[e,n],function*([e,n],t){if(!n)return;if(e)return;const l=null==t?void 0:t[0],i=void 0!==l&&!1!==l;yield B(),$(()=>{d(null,null,function*(){var e;if(i&&Q.value)if(tn.value&&v.value){const e=Je;if(e)try{yield e}catch(n){}De.value=!1,Q.value=!1,Je=null,jn(),$n(),Ye(),v.value.replaceChildren(),yield B(),yield ut(v.value)}else Ue(String(null!=(e=o.node.code)?e:""),Y.value);K.value||(J.value?Rn():qn()),yt()})})}),{immediate:!0,flush:"post"});return f(()=>{jn(),$n(),Xe()}),(n,t)=>cn.value?(m(),p(k(V),{key:0,node:e.node,loading:o.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:h,style:E(Kn.value),class:y(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[{"is-rendering":o.loading,"is-dark":mt.value,"is-diff":tn.value,"is-plain-text":G.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":De.value&&!cn.value?"true":"false"},[o.showHeader?(m(),O("div",{key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:E(Qn.value)},[L(n.$slots,"header-left",{},()=>[g("div",de,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:Jn.value},null,8,se),g("div",ce,[g("div",ve,b(Yn.value),1),Gn.value?(m(),O("div",fe,b(Gn.value),1)):P("",!0)])])],!0),L(n.$slots,"header-right",{},()=>[g("div",me,[tn.value?(m(),O("div",{key:0,class:"code-diff-stats","aria-label":ln.value},[g("span",he,"-"+b(on.value.removed),1),g("span",ge,"+"+b(on.value.added),1)],8,pe)):P("",!0),o.showCollapseButton?(m(),O("button",{key:1,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":K.value,onClick:it,onMouseenter:t[0]||(t[0]=e=>tt(e,K.value?k(s)("common.expand")||"Expand":k(s)("common.collapse")||"Collapse")),onFocus:t[1]||(t[1]=e=>tt(e,K.value?k(s)("common.expand")||"Expand":k(s)("common.collapse")||"Collapse")),onMouseleave:ot,onBlur:ot},[(m(),O("svg",{style:E({rotate:K.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"},[...t[18]||(t[18]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ye)):P("",!0),o.showFontSizeButtons&&o.enableFontSizeControl?(m(),O(H,{key:2},[g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(hn.value)&&hn.value<=10,onClick:t[2]||(t[2]=e=>function(){const e=Dn(),n=Math.max(10,e-1);hn.value=n}()),onMouseenter:t[3]||(t[3]=e=>tt(e,k(s)("common.decrease")||"Decrease")),onFocus:t[4]||(t[4]=e=>tt(e,k(s)("common.decrease")||"Decrease")),onMouseleave:ot,onBlur:ot},[...t[19]||(t[19]=[g("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"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,we),g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!gn.value||hn.value===pn.value,onClick:t[5]||(t[5]=e=>(Dn(),void(Number.isFinite(pn.value)&&(hn.value=pn.value)))),onMouseenter:t[6]||(t[6]=e=>tt(e,k(s)("common.reset")||"Reset")),onFocus:t[7]||(t[7]=e=>tt(e,k(s)("common.reset")||"Reset")),onMouseleave:ot,onBlur:ot},[...t[20]||(t[20]=[g("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"},[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),g("path",{d:"M3 3v5h5"})])],-1)])],40,be),g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(hn.value)&&hn.value>=36,onClick:t[8]||(t[8]=e=>function(){const e=Dn(),n=Math.min(36,e+1);hn.value=n}()),onMouseenter:t[9]||(t[9]=e=>tt(e,k(s)("common.increase")||"Increase")),onFocus:t[10]||(t[10]=e=>tt(e,k(s)("common.increase")||"Increase")),onMouseleave:ot,onBlur:ot},[...t[21]||(t[21]=[g("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"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,ke)],64)):P("",!0),o.showCopyButton?(m(),O("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":w.value?k(s)("common.copied")||"Copied":k(s)("common.copy")||"Copy",onClick:et,onMouseenter:t[11]||(t[11]=e=>lt(e)),onFocus:t[12]||(t[12]=e=>lt(e)),onMouseleave:ot,onBlur:ot},[w.value?(m(),O("svg",Se,[...t[23]||(t[23]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(m(),O("svg",Ce,[...t[22]||(t[22]=[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),g("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,xe)):P("",!0),o.showExpandButton?(m(),O("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":J.value,onClick:t[13]||(t[13]=e=>function(e){if(J.value=!J.value,e&&Zn.value){const n=nt(e);if(n){const e=J.value?s("common.collapse")||"Collapse":s("common.expand")||"Expand";I(n,e,"top",!1,void 0,o.isDark)}}const n=tn.value?Ie():Ve(),t=v.value;n&&t&&(J.value?(rt(!0),t.style.maxHeight="none",t.style.overflow="visible",Rn()):(rt(!1),t.style.overflow="auto",qn()))}(e)),onMouseenter:t[14]||(t[14]=e=>tt(e,J.value?k(s)("common.collapse")||"Collapse":k(s)("common.expand")||"Expand")),onFocus:t[15]||(t[15]=e=>tt(e,J.value?k(s)("common.collapse")||"Collapse":k(s)("common.expand")||"Expand")),onMouseleave:ot,onBlur:ot},[J.value?(m(),O("svg",Be,[...t[24]||(t[24]=[g("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)])])):(m(),O("svg",Oe,[...t[25]||(t[25]=[g("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)])]))],40,Me)):P("",!0),Vn.value&&o.showPreviewButton?(m(),O("button",{key:5,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":k(s)("common.preview")||"Preview",onClick:at,onMouseenter:t[16]||(t[16]=e=>tt(e,k(s)("common.preview")||"Preview")),onFocus:t[17]||(t[17]=e=>tt(e,k(s)("common.preview")||"Preview")),onMouseleave:ot,onBlur:ot},[...t[26]||(t[26]=[g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[g("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[g("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"}),g("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,Ee)):P("",!0)])],!0)],4)):P("",!0),D(g("div",Le,[g("div",{ref_key:"codeEditor",ref:v,class:y(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":fn.value}]]),style:E(Sn.value)},null,6),fn.value?(m(),p(k(V),{key:0,class:y(["code-pre-fallback",{"is-wrap":vn.value}]),style:E(xn.value),node:e.node},null,8,["class","style","node"])):P("",!0)],512),[[N,!(K.value||!e.stream&&e.loading)]]),mn.value&&!a.value&&Vn.value&&"html"===_.value?(m(),p(Z,{key:1,code:e.node.code,"is-dark":o.isDark,"on-close":()=>mn.value=!1},null,8,["code","is-dark","on-close"])):P("",!0),D(g("div",{class:"code-loading-placeholder",style:E(Mn.value)},[L(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[27]||(t[27]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))],!0)],4),[[N,!e.stream&&e.loading]]),g("span",Pe,b(w.value?k(s)("common.copied")||"Copied":""),1)],14,ue))}}),[["__scopeId","data-v-d5928ec7"]]);export{De as default};
1
+ var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(n,t,o)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,a=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&r(e,t,n[t]);if(o)for(var t of o(n))i.call(n,t)&&r(e,t,n[t]);return e},u=(e,o)=>n(e,t(o)),d=(e,n,t)=>new Promise((o,l)=>{var i=e=>{try{a(t.next(e))}catch(n){l(n)}},r=e=>{try{a(t.throw(e))}catch(n){l(n)}},a=e=>e.done?o(e.value):Promise.resolve(e.value).then(i,r);a((t=t.apply(e,n)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as g,normalizeClass as y,withModifiers as w,toDisplayString as b,unref as k,getCurrentInstance as x,ref as C,watch as S,onBeforeUnmount as M,nextTick as B,createElementBlock as O,normalizeStyle as E,renderSlot as L,createCommentVNode as P,Fragment as H,withDirectives as D,vShow as N}from"vue";import{b as F,_,n as z,k as T,u as R,l as j,c as $,m as A,o as U,p as W,h as q,q as V,e as I,v as X}from"./exports.js";const Y={class:"markstream-vue"},G={class:"html-preview-frame__header"},J={class:"html-preview-frame__title"},K={class:"html-preview-frame__label"},Q=["srcdoc"],Z=/* @__PURE__ */_(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},onClose:{type:Function},title:{}},setup(e){const n=e,{t}=F(),o=c(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`});function l(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",l)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",l)}),(e,l)=>(m(),p(h,{to:"body"},[g("div",Y,[g("div",{class:y(["html-preview-frame__backdrop",{"html-preview-frame__backdrop--dark":n.isDark}]),onClick:l[2]||(l[2]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})},[g("div",{class:y(["html-preview-frame",{"html-preview-frame--dark":n.isDark}]),onClick:l[1]||(l[1]=w(()=>{},["stop"]))},[g("div",G,[g("div",J,[l[3]||(l[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",K,b(n.title||k(t)("common.preview")||"Preview"),1)]),g("button",{type:"button",class:y(["html-preview-frame__close",{"html-preview-frame__close--dark":n.isDark}]),onClick:l[0]||(l[0]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})}," × ",2)]),g("iframe",{class:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcdoc:o.value},null,8,Q)],2)],2)])]))}}),[["__scopeId","data-v-296dd89d"]]);let ee=null,ne=null,te=null,oe=null,le=null,ie=null;const re=/* @__PURE__ */new WeakMap;let ae=0;const ue=["data-markstream-enhanced"],de={class:"code-header-main"},se=["innerHTML"],ce={class:"code-header-copy"},ve={class:"code-header-title"},fe={key:0,class:"code-header-caption"},me={class:"code-header-actions"},pe=["aria-label"],he={class:"code-diff-stat removed"},ge={class:"code-diff-stat added"},ye=["aria-pressed"],we=["disabled"],be=["disabled"],ke=["disabled"],xe=["aria-label"],Ce={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"},Se={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"},Me=["aria-pressed"],Be={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"},Oe={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Ee=["aria-label"],Le={class:"code-editor-layer"},Pe={class:"sr-only","aria-live":"polite",role:"status"},He="__markstreamMonacoPassiveTouch__",De=/* @__PURE__ */_(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},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},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},customId:{},estimatedHeightPx:{},estimatedContentHeightPx:{}},emits:["previewCode","copy"],setup(e,{emit:n}){var t;const o=e,l=n;const i=x(),r=c(()=>{const e=null==i?void 0:i.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:s}=F(),v=C(null),h=C(null),w=C(!1),_=C(z(o.node.language)),Y=c(()=>T(_.value)),G=c(()=>"plaintext"===Y.value),J=C(!1),K=C(!1),Q=C(!1),De=C(!1),Ne=C(!1);let Fe=!1,_e=null;const ze=C(null);let Te=0;const Re=R(),je=C(null),$e=C("undefined"==typeof window);"undefined"!=typeof window&&S(()=>h.value,e=>{var n;if(null==(n=je.value)||n.destroy(),je.value=null,!e)return void($e.value=!1);const t=Re(e,{rootMargin:"400px"});je.value=t,$e.value=t.isVisible.value,t.whenVisible.then(()=>{$e.value=!0})},{immediate:!0}),M(()=>{var e;Fe=!0,null==(e=je.value)||e.destroy(),je.value=null});let Ae=null,Ue=null,We=()=>{},qe=()=>{},Ve=()=>null,Ie=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Xe=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ye=()=>{},Ge=()=>{},Je=()=>{},Ke=null,Qe=()=>{var e;return String(null!=(e=o.node.language)?e:"plaintext")},Ze=()=>d(null,null,function*(){});const en=[],nn=[];let tn=null;const on=c(()=>o.node.diff),ln=C({removed:0,added:0}),rn=c(()=>`-${ln.value.removed} +${ln.value.added}`),an=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function un(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return u(a(a({},an),t),{enabled:null==(n=t.enabled)||n})}return a({},an)}const dn=c(()=>{var e;const n=o.monacoOptions?a({},o.monacoOptions):{};if(!on.value)return n;const t=void 0===n.diffHideUnchangedRegions?a({},an):un(n.diffHideUnchangedRegions),l=void 0===n.hideUnchangedRegions?void 0:un(n.hideUnchangedRegions),i=null!=(e=n.diffUnchangedRegionStyle)?e:"line-info";return u(a(a(a({},{maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:12,lineNumbersMinChars:2,glyphMargin:!1,fontSize:13,lineHeight:30,renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,padding:{top:10,bottom:"line-info"===i||"line-info-basic"===i||"metadata"===i?22:14},diffHideUnchangedRegions:t,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:i,diffHunkActionsOnHover:!0,diffHunkHoverHideDelayMs:160}),n),void 0===l?{}:{hideUnchangedRegions:l}),{diffHideUnchangedRegions:t})}),sn=c(()=>on.value?"diff":"single"),cn=C(sn.value),vn=C(!1),fn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.wordWrap;return null==n||"off"!==String(n)}),mn=c(()=>!vn.value&&!De.value),pn=C(!1);"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield j();if(Fe)return;if(!e)return void(vn.value=!0);const n=e.useMonaco,t=e.detectLanguage;if("function"==typeof t&&(Qe=t),"function"==typeof n){const e=vt();if(e&&o.themes&&Array.isArray(o.themes)&&!o.themes.includes(e))throw new Error("Preferred theme not in provided themes array");tn=ht();const t=n(tn);Ae=t.createEditor||Ae,Ue=t.createDiffEditor||Ue,We=t.updateCode||We,qe=t.updateDiff||qe,Ve=t.getEditor||Ve,Ie=t.getEditorView||Ie,Xe=t.getDiffEditorView||Xe,Ye=t.cleanupEditor||Ye,Ge=t.safeClean||t.cleanupEditor||Ge,Je=t.refreshDiffPresentation||Je,Ze=t.setTheme||Ze,Ne.value=!0,!Fe&&v.value&&(yield dt(v.value))}}catch(e){if(Fe)return;vn.value=!0}});const hn=C("number"==typeof(null==(t=o.monacoOptions)?void 0:t.fontSize)?o.monacoOptions.fontSize:Number.NaN),gn=C(hn.value),yn=c(()=>{const e=hn.value,n=gn.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),wn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=gn.value;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12}),bn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.lineHeight;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:Math.round(1.5*wn.value)}),kn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.tabSize;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:4}),xn=c(()=>{const e=o.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}),Cn=c(()=>{var e;const n=null==(e=o.monacoOptions)?void 0:e.fontFamily;return a(a({fontSize:`${wn.value}px`,lineHeight:`${bn.value}px`,tabSize:kn.value},null!=xn.value?{minHeight:`${xn.value}px`}:{}),"string"==typeof n&&n.trim()?{"--markstream-code-font-family":n.trim()}:{})}),Sn=c(()=>null!=xn.value&&!De.value),Mn=c(()=>{if(Sn.value)return{minHeight:`${xn.value}px`}}),Bn=c(()=>{if(null!=xn.value)return{minHeight:`${xn.value}px`}});function On(){var e,n,t,o,l;try{const i=on.value?null!=(t=null==(n=null==(e=Xe())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Xe():Ie(),r=Ve(),a=null==(o=null==r?void 0:r.EditorOption)?void 0:o.fontInfo;if(i&&null!=a){const e=null==(l=i.getOption)?void 0:l.call(i,a),n=null==e?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n}}catch(i){}try{const e=v.value;if(e){const n=e.querySelector(".view-lines .view-line");if(n)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(n).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(i){}}}catch(i){}return null}function En(e){var n,t;try{const o=Ve(),l=null==(n=null==o?void 0:o.EditorOption)?void 0:n.lineHeight;if(null!=l){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,l);if("number"==typeof n&&n>0)return n}}catch(i){}const o=function(){try{const e=v.value;if(!e)return null;const n=e.querySelector(".view-lines .view-line");if(n){const e=Math.ceil(n.getBoundingClientRect().height);if(e>0)return e}}catch(i){}return null}();if(o&&o>0)return o;const l=Number.isFinite(gn.value)&&gn.value>0?gn.value:12;return Math.max(12,Math.round(1.35*l))}function Ln(e,n){return"number"!=typeof e||"number"!=typeof n||e<1||n<e?0:n-e+1}function Pn(e){if(!e)return[];const n=e.split(/\r?\n/);return 1===n.length&&""===n[0]?[]:n}function Hn(){var e,n;on.value?ln.value=function(e,n){const t=Pn(e),o=Pn(n);let l=0,i=t.length-1,r=o.length-1;for(;l<=i&&l<=r&&t[l]===o[l];)l++;for(;i>=l&&r>=l&&t[i]===o[r];)i--,r--;return{removed:Math.max(0,i-l+1),added:Math.max(0,r-l+1)}}(String(null!=(e=o.node.originalCode)?e:""),String(null!=(n=o.node.updatedCode)?n:"")):ln.value={removed:0,added:0}}function Dn(){var e;if(on.value)try{const n=Xe(),t=null==(e=null==n?void 0:n.getLineChanges)?void 0:e.call(n);if(!Array.isArray(t))return void Hn();let o=0,l=0;for(const e of t)o+=Ln(e.originalStartLineNumber,e.originalEndLineNumber),l+=Ln(e.modifiedStartLineNumber,e.modifiedEndLineNumber);ln.value={removed:o,added:l}}catch(n){Hn()}else ln.value={removed:0,added:0}}function Nn(){var e;if(Number.isFinite(gn.value)&&gn.value>0&&Number.isFinite(hn.value))return gn.value;const n=On();return"number"==typeof(null==(e=o.monacoOptions)?void 0:e.fontSize)?(hn.value=o.monacoOptions.fontSize,gn.value=o.monacoOptions.fontSize,gn.value):n&&n>0?(hn.value=n,gn.value=n,n):(hn.value=12,gn.value=12,12)}function Fn(){var e,n,t,o,l,i,r,a,u,d,s,c,v,f;try{const m=on.value?Xe():null,p=on.value?m:Ie();if(!p)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(n=m.getModifiedEditor)?void 0:n.call(m);null==(t=null==v?void 0:v.layout)||t.call(v),null==(o=null==f?void 0:f.layout)||o.call(f);const p=(null==(l=null==v?void 0:v.getContentHeight)?void 0:l.call(v))||0,h=(null==(i=null==f?void 0:f.getContentHeight)?void 0:i.call(f))||0,g=Math.max(p,h);if(g>0)return Math.ceil(g+1);const y=(null==(u=null==(a=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:a.getLineCount)?void 0:u.call(a))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(y,w),k=Math.max(En(v),En(f));return Math.ceil(b*(k+1.5)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(f=null==p?void 0:p.getModel)?void 0:f.call(p);let g=1;h&&"function"==typeof h.getLineCount&&(g=h.getLineCount());const y=En(p);return Math.ceil(g*(y+1.5)+0+1)}catch(m){return null}}function _n(e){const n=String(null!=e?e:"").match(/\d+(?:\.\d+)?/g);if(!n||n.length<3)return null;const[t,o,l]=n.slice(0,3).map(Number);return.2126*t+.7152*o+.0722*l}function zn(){var e,n,t,o,l,i,r,a;const u=v.value,d=h.value;if(!u||!d)return;if(on.value)return d.style.removeProperty("--vscode-editor-foreground"),d.style.removeProperty("--vscode-editor-background"),void d.style.removeProperty("--vscode-editor-selectionBackground");const s=u.querySelector(".monaco-editor")||u,c=s.querySelector(".monaco-editor-background")||s,f=s.querySelector(".view-lines")||s;let m=null,p=null,g=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(s),p=c===s?m:window.getComputedStyle(c),g=f===s?m:window.getComputedStyle(f))}catch(C){m=null,p=null,g=null}const y=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),w=String(null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?n:"").trim(),b=String(null!=(o=null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?t:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?o:"").trim(),k=y||String(null!=(i=null!=(l=null==g?void 0:g.color)?l:null==m?void 0:m.color)?i:"").trim(),x=w||String(null!=(a=null!=(r=null==p?void 0:p.backgroundColor)?r:null==m?void 0:m.backgroundColor)?a:"").trim();if(function(e,n,t){if(!G.value)return!1;const o=_n(e),l=_n(n);return t?null!=o&&o>170||null!=l&&l<110:null!=o&&o<85||null!=l&&l>190}(x,k,d.classList.contains("is-dark")))return d.style.removeProperty("--vscode-editor-foreground"),d.style.removeProperty("--vscode-editor-background"),void d.style.removeProperty("--vscode-editor-selectionBackground");k&&d.style.setProperty("--vscode-editor-foreground",k),x&&d.style.setProperty("--vscode-editor-background",x),b&&d.style.setProperty("--vscode-editor-selectionBackground",b)}const Tn=/auto|scroll|overlay/i;function Rn(e,n,t){var o;if("undefined"==typeof window)return;const l=Math.ceil(n),i=Math.ceil(t)-l;if(!i)return;const r=function(e){var n,t;if("undefined"==typeof window)return null;const o=null!=(n=null==e?void 0:e.ownerDocument)?n:document,l=o.scrollingElement||o.documentElement||o.body;let i=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;i&&i!==o.body&&i!==l;){const e=window.getComputedStyle(i),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(Tn.test(n)||Tn.test(t))return i;i=i.parentElement}return l}(e);if(!r)return;const a=null!=(o=e.ownerDocument)?o:document,u=r===a.body||r===a.documentElement||r===a.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):r.scrollTop+=i)}function jn(){try{const e=v.value;if(!e)return;const n=e.getBoundingClientRect().height,t=Fn();if(null!=t&&t>0){const o=Math.ceil(t);e.style.minHeight="0px",e.style.height=`${o}px`,e.style.maxHeight="none",e.style.overflow="visible",Rn(e,n,o)}}catch(e){}}function $n(){for(var e,n;en.length>0;)try{null==(n=null==(e=en.pop())?void 0:e.dispose)||n.call(e)}catch(t){}null!=_e&&(X(_e),_e=null)}function An(){for(var e;nn.length>0;)try{null==(e=nn.pop())||e()}catch(n){}}function Un(){if(An(),!on.value)return;const e=v.value;if(!e)return;const n=e.querySelector(".monaco-diff-editor");if(!n||n.classList.contains("side-by-side"))return;const t=Array.from(n.querySelectorAll(".editor.original .diff-hidden-lines")),o=Array.from(n.querySelectorAll(".editor.modified .diff-hidden-lines")),l=Math.min(t.length,o.length);for(let i=0;i<l;i++){const e=t[i],n=o[i].querySelector("a"),l=e.querySelector(".center > div:first-child");if(!n||!l)continue;const r=document.createElement("button");r.type="button",r.className="markstream-inline-fold-proxy";const a=n.getAttribute("title")||"Show Unchanged Region";r.title=a,r.setAttribute("aria-label",a);const u=n.querySelector(".codicon"),d=document.createElement("span");d.className=(null==u?void 0:u.className)||"codicon codicon-unfold",r.append(d);const s=e=>{e.preventDefault(),e.stopPropagation()},c=e=>{e.preventDefault(),e.stopPropagation(),n.click()},v=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n.click())};r.addEventListener("mousedown",s),r.addEventListener("click",c),r.addEventListener("keydown",v),l.replaceChildren(r),nn.push(()=>{r.removeEventListener("mousedown",s),r.removeEventListener("click",c),r.removeEventListener("keydown",v),l.contains(r)&&l.replaceChildren()})}}function Wn(){null==_e&&(_e=$(()=>{_e=null,$(()=>{Un(),K.value||(J.value?jn():Vn())})}))}function qn(e,n,t){const o=Math.min(n,t),l=n>t+1;return e.style.minHeight="0px",e.style.height=`${Math.ceil(o)}px`,e.style.maxHeight=`${Math.ceil(t)}px`,e.style.overflow=l?"auto":"hidden",Math.ceil(o)}function Vn(){var e;try{const n=v.value;if(!n)return;const t=n.getBoundingClientRect().height,l=function(){var e,n;const t=null!=(n=null==(e=o.monacoOptions)?void 0:e.MAX_HEIGHT)?n:500;if("number"==typeof t)return t;const l=String(t).match(/^(\d+(?:\.\d+)?)/);return l?Number.parseFloat(l[1]):500}();if(Te>0&&(Te--,null!=ze.value))return void Rn(n,t,qn(n,ze.value,l));const i=Fn();if(null!=i&&i>0)return void Rn(n,t,qn(n,i,l));if(null!=ze.value)return void Rn(n,t,qn(n,ze.value,l));const r=Math.ceil((null==(e=n.getBoundingClientRect)?void 0:e.call(n).height)||0);if(r>0)return void Rn(n,t,qn(n,r,l));const a=Number.parseFloat(n.style.height);!Number.isNaN(a)&&a>0?Rn(n,t,qn(n,a,l)):Rn(n,t,qn(n,l,l))}catch(n){}}const In=c(()=>o.isShowPreview&&("html"===_.value||"svg"===_.value));S(()=>o.node.language,e=>{_.value=z(e)}),S(()=>[o.node.originalCode,o.node.updatedCode,on.value],()=>{Hn(),$(()=>Dn())},{immediate:!0}),S(()=>[o.node.originalCode,o.node.updatedCode,Y.value,on.value],e=>d(null,[e],function*([e,n,t,l]){if(!1!==o.stream&&l){if(Ae&&!Q.value&&v.value)try{yield dt(v.value)}catch(i){}qe(String(null!=e?e:""),String(null!=n?n:""),Y.value),J.value&&$(()=>jn())}})),S(()=>o.node.code,e=>d(null,null,function*(){if(!1!==o.stream&&(_.value||(_.value=z(Qe(e))),!on.value)){if(Ae&&!Q.value&&v.value)try{yield dt(v.value)}catch(n){}We(e,Y.value),J.value&&$(()=>jn())}}));const Xn=c(()=>{const e=_.value;return e?A[e]||e.charAt(0).toUpperCase()+e.slice(1):A[""]||"Plain Text"});const Yn=c(()=>{var e;return function(e){const n=function(e){var n,t;const o=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(o.length<3)return"";const l=o[0];if("`"!==l&&"~"!==l||o[1]!==l||o[2]!==l)return"";let i=3;for(;o[i]===l;)i+=1;return o.slice(i).trim()}(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const o="diff"===t[0]?t.slice(1):t;for(const l of o){const e=l.includes(":")?l.slice(l.indexOf(":")+1):l;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=o.node.raw)?e:""))}),Gn=c(()=>Yn.value||Xn.value),Jn=c(()=>Yn.value?on.value?`Diff / ${Xn.value}`:Xn.value:""),Kn=c(()=>(U.value,W(_.value||""))),Qn=c(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(o.minWidth),l=n(o.maxWidth);return t&&(e.minWidth=t),l&&(e.maxWidth=l),on.value?(e.color="var(--markstream-diff-shell-fg)",e.borderColor="var(--markstream-diff-shell-border)"):(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),Zn=c(()=>{if(!on.value)return{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg))"}}),et=c(()=>!1!==o.showTooltips);function nt(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(o.node.code)),w.value=!0,l("copy",o.node.code),setTimeout(()=>{w.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function tt(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}function ot(e,n,t="top"){if(!et.value)return;const l=tt(e);if(!l)return;const i=e,r=null!=(null==i?void 0:i.clientX)&&null!=(null==i?void 0:i.clientY)?{x:i.clientX,y:i.clientY}:void 0;I(l,n,t,!1,r,o.isDark)}function lt(){et.value&&q()}function it(e){if(!et.value)return;const n=tt(e);if(!n)return;const t=w.value?s("common.copied")||"Copied":s("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;I(n,t,"top",!1,i,o.isDark)}function rt(){var e,n,t;if(K.value=!K.value,K.value){if(v.value){const t=Math.ceil((null==(n=(e=v.value).getBoundingClientRect)?void 0:n.call(e).height)||0);t>0&&(ze.value=t)}ut(!1)}else{J.value&&ut(!0),v.value&&null!=ze.value&&(v.value.style.height=`${ze.value}px`);const e=on.value?Xe():Ie();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(o){}Te=2,$(()=>{J.value?jn():Vn()})}}function at(){if(!In.value)return;const e=_.value;if(r.value){const n="html"===e?"text/html":"image/svg+xml",t="html"===e?s("artifacts.htmlPreviewTitle")||"HTML Preview":s("artifacts.svgPreviewTitle")||"SVG Preview";return void l("previewCode",{node:o.node,artifactType:n,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&(pn.value=!pn.value)}function ut(e){var n,t;try{if(on.value){const t=Xe();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}else{const n=Ie();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}}catch(o){}}function dt(e){if(!Ae||Fe)return null;if(function(){var e;try{const n=window;if(n[He])return;const t=null==(e=window.Element)?void 0:e.prototype,o=null==t?void 0:t.addEventListener;if(!t||!o)return;t.addEventListener=function(e,n,t){return"touchstart"===e&&function(e,n){if(!e)return!1;const t=e;return!("function"!=typeof t.closest||!t.closest(".monaco-editor, .monaco-diff-editor")||n&&"object"==typeof n&&"passive"in n)}(this,t)?o.call(this,e,n,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(a({},e),{passive:!0}):{passive:!0}}(t)):o.call(this,e,n,t)},n[He]=!0}catch(n){}}(),Ke)return Ke;if(Q.value&&De.value)return Promise.resolve();Q.value=!0;const n=d(null,null,function*(){yield function(e){return d(this,null,function*(){var n,t,l;if(!Ae||Fe)return;if($n(),An(),function(e){e.replaceChildren()}(e),Fe)return;if(on.value?(Ge(),Ue?yield Ue(e,String(null!=(n=o.node.originalCode)?n:""),String(null!=(t=o.node.updatedCode)?t:""),Y.value):yield Ae(e,o.node.code,Y.value)):yield Ae(e,o.node.code,Y.value),Fe)return;const i=on.value?Xe():Ie();if("number"==typeof(null==(l=o.monacoOptions)?void 0:l.fontSize))null==i||i.updateOptions({fontSize:o.monacoOptions.fontSize,automaticLayout:!1}),hn.value=o.monacoOptions.fontSize,gn.value=o.monacoOptions.fontSize;else{const e=On();e&&e>0?(hn.value=e,gn.value=e):(hn.value=12,gn.value=12)}if(J.value||K.value||Vn(),!1===o.loading){if(yield B(),Fe)return;$(()=>{Fe||(J.value&&!K.value?jn():K.value||Vn())})}yield B(),Fe||(De.value=!0,function(){var e,n,t,o,l;if($n(),on.value){const o=Xe(),l=null==(e=null==o?void 0:o.getOriginalEditor)?void 0:e.call(o),r=null==(n=null==o?void 0:o.getModifiedEditor)?void 0:n.call(o),a=(e,n)=>{try{const t=null==e?void 0:e[n];if("function"!=typeof t)return;const o=t.call(e,()=>Wn());o&&en.push(o)}catch(t){}};try{const e=null==(t=null==o?void 0:o.onDidUpdateDiff)?void 0:t.call(o,()=>{Wn(),$(()=>Dn())});e&&en.push(e)}catch(i){}a(l,"onDidContentSizeChange"),a(r,"onDidContentSizeChange"),a(l,"onDidLayoutChange"),a(r,"onDidLayoutChange")}else{const e=Ie();try{const n=null==(o=null==e?void 0:e.onDidContentSizeChange)?void 0:o.call(e,()=>Wn());n&&en.push(n)}catch(i){}try{const n=null==(l=null==e?void 0:e.onDidLayoutChange)?void 0:l.call(e,()=>Wn());n&&en.push(n)}catch(i){}}}(),zn(),Un(),Dn(),Wn())})}(e)}).finally(()=>{Ke===n&&(Ke=null)});return Ke=n,n}S(et,e=>{e||q()}),S(()=>gn.value,(e,n)=>{const t=on.value?Xe():Ie();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),J.value&&!K.value&&jn())},{flush:"post",immediate:!1});const st=S(()=>[v.value,on.value,o.stream,o.loading,Ne.value,$e.value],e=>d(null,[e],function*([e,n,t,o,l,i]){if(!e||!Ae)return;if(!i)return;if(!1===t&&!1!==o)return;const r=dt(e);if(r){try{yield r}catch(a){De.value=!1}st()}}));function ct(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function vt(){var e;const n=o.isDark?o.darkTheme:o.lightTheme,t=null==(e=dn.value)?void 0:e.theme,l=null!=n?n:t,i=Array.isArray(o.themes)?o.themes:[];if(!i.length||null==l)return l;const r=ct(l),a=i.map(e=>ct(e)).filter(e=>!!e);if(!r||a.includes(r))return l;const u=ct(t);return null!=t&&u&&a.includes(u)?t:i[0]}S(sn,(e,n)=>d(null,null,function*(){if(e===n)return;if(cn.value=e,!Ae||!v.value)return;if(!Q.value)return;if(!1===o.stream&&!1!==o.loading)return;if(!$e.value)return;const t=Ke;if(t){try{yield t}catch(l){}if(Fe||!v.value)return}try{De.value=!1,Q.value=!1,$n(),An(),Ge(),yield B(),yield dt(v.value)}catch(i){De.value=!1}}));const ft=c(()=>function(e){var n;const t=(null!=(n=ct(e))?n:"").toLowerCase();return t?["dark","night","moon","black","dracula","mocha","frappe","macchiato","palenight","ocean","poimandres","monokai","laserwave","tokyo","slack-dark","rose-pine","github-dark","material-theme","one-dark","catppuccin-mocha","catppuccin-frappe","catppuccin-macchiato"].some(e=>t.includes(e))&&!["light","latte","dawn","lotus"].some(e=>t.includes(e)):!!o.isDark}(vt())),mt=c(()=>{var e;if(!on.value)return ft.value?"dark":"light";const n=null==(e=dn.value)?void 0:e.diffAppearance;return"light"===n||"dark"===n?n:o.isDark?"dark":"light"}),pt=c(()=>on.value?"dark"===mt.value:ft.value);function ht(){return u(a(u(a({wordWrap:"on",wrappingIndent:"same",themes:o.themes},dn.value||{}),{theme:vt()}),on.value?{diffAppearance:mt.value}:{}),{onThemeChange(){zn()}})}function gt(){const e=ht();if(!tn)return tn=e,tn;for(const n of Object.keys(tn))n in e||delete tn[n];return Object.assign(tn,e),tn}const yt=c(()=>{var e,n,t,o,l,i,r,a,u,d,s,c,v,f;return JSON.stringify({diffLineStyle:null!=(n=null==(e=dn.value)?void 0:e.diffLineStyle)?n:"background",diffUnchangedRegionStyle:null!=(o=null==(t=dn.value)?void 0:t.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:null==(i=null==(l=dn.value)?void 0:l.diffHideUnchangedRegions)||i,renderSideBySide:null==(a=null==(r=dn.value)?void 0:r.renderSideBySide)||a,enableSplitViewResizing:null==(d=null==(u=dn.value)?void 0:u.enableSplitViewResizing)||d,ignoreTrimWhitespace:null==(c=null==(s=dn.value)?void 0:s.ignoreTrimWhitespace)||c,originalEditable:null!=(f=null==(v=dn.value)?void 0:v.originalEditable)&&f})});S(()=>[o.monacoOptions,$e.value],()=>{var e,n;if(gt(),!Ae||!$e.value)return;const t=on.value?Xe():Ie(),l="number"==typeof(null==(e=o.monacoOptions)?void 0:e.fontSize)?o.monacoOptions.fontSize:Number.isFinite(gn.value)?gn.value:void 0;"number"==typeof l&&Number.isFinite(l)&&l>0&&(null==(n=null==t?void 0:t.updateOptions)||n.call(t,{fontSize:l})),J.value&&!K.value?jn():K.value||Vn()},{deep:!0}),S(()=>[vt(),mt.value,Ne.value,Q.value,$e.value],()=>{Ne.value&&Q.value&&$e.value&&function(){gt();const e=vt(),n=()=>{on.value&&Je(),$(()=>{zn(),Wn()})};e?function(e,n){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);if("object"==typeof e){const t=re.get(e);if(t)return t;try{const n=JSON.stringify(e);if(n)return re.set(e,n),n}catch(n){}const o="__theme_"+ ++ae;return re.set(e,o),o}return String(e)}(n);return t?(ie=e,ee||le!==t?ee?(oe===t||ne===t||(te=n,oe=t),ee):(te=n,oe=t,ee=d(null,null,function*(){for(;oe&&null!=te;){const t=te,o=oe;if(te=null,oe=null,le!==o)try{ne=o,yield(null!=ie?ie:e)(t),le=o}catch(n){}}}).finally(()=>{ee=null,ne=null}),ee):Promise.resolve()):Promise.resolve()}(Ze,e).then(n).catch(e=>{}):n()}()},{flush:"post"}),S(()=>[yt.value,Ne.value,$e.value],(e,n)=>d(null,[e,n],function*([e,n,t],[l]){if(gt(),!n||!t)return;if(!Ae||!v.value)return;if(!Q.value)return;if(e===l)return;if(!1===o.stream&&!1!==o.loading)return;const i=Ke;if(i){try{yield i}catch(r){}if(Fe||!v.value)return}try{De.value=!1,Q.value=!1,$n(),An(),Ge(),yield B(),yield dt(v.value)}catch(a){De.value=!1}}),{flush:"post"});const wt=S(()=>[o.loading,$e.value],(e,n)=>d(null,[e,n],function*([e,n],t){if(!n)return;if(e)return;const l=null==t?void 0:t[0],i=void 0!==l&&!1!==l;yield B(),$(()=>{d(null,null,function*(){var e;try{if(i&&Q.value)if(on.value&&v.value){const e=Ke;if(e)try{yield e}catch(n){}De.value=!1,Q.value=!1,$n(),An(),Ge(),v.value.replaceChildren(),yield B(),yield dt(v.value)}else We(String(null!=(e=o.node.code)?e:""),Y.value);K.value||(J.value?jn():Vn()),wt()}catch(t){}})})}),{immediate:!0,flush:"post"});return f(()=>{$n(),An(),Ye()}),(n,t)=>vn.value?(m(),p(k(V),{key:0,node:o.node,loading:o.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:h,style:E(Qn.value),class:y(["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",[{"is-rendering":o.loading,"is-dark":pt.value,"is-diff":on.value,"is-plain-text":G.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":De.value&&!vn.value?"true":"false"},[o.showHeader?(m(),O("div",{key:0,class:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:E(Zn.value)},[L(n.$slots,"header-left",{},()=>[g("div",de,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:Kn.value},null,8,se),g("div",ce,[g("div",ve,b(Gn.value),1),Jn.value?(m(),O("div",fe,b(Jn.value),1)):P("",!0)])])],!0),L(n.$slots,"header-right",{},()=>[g("div",me,[on.value?(m(),O("div",{key:0,class:"code-diff-stats","aria-label":rn.value},[g("span",he,"-"+b(ln.value.removed),1),g("span",ge,"+"+b(ln.value.added),1)],8,pe)):P("",!0),o.showCollapseButton?(m(),O("button",{key:1,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":K.value,onClick:rt,onMouseenter:t[0]||(t[0]=e=>ot(e,K.value?k(s)("common.expand")||"Expand":k(s)("common.collapse")||"Collapse")),onFocus:t[1]||(t[1]=e=>ot(e,K.value?k(s)("common.expand")||"Expand":k(s)("common.collapse")||"Collapse")),onMouseleave:lt,onBlur:lt},[(m(),O("svg",{style:E({rotate:K.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"},[...t[18]||(t[18]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ye)):P("",!0),o.showFontSizeButtons&&o.enableFontSizeControl?(m(),O(H,{key:2},[g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(gn.value)&&gn.value<=10,onClick:t[2]||(t[2]=e=>function(){const e=Nn(),n=Math.max(10,e-1);gn.value=n}()),onMouseenter:t[3]||(t[3]=e=>ot(e,k(s)("common.decrease")||"Decrease")),onFocus:t[4]||(t[4]=e=>ot(e,k(s)("common.decrease")||"Decrease")),onMouseleave:lt,onBlur:lt},[...t[19]||(t[19]=[g("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"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)])],40,we),g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!yn.value||gn.value===hn.value,onClick:t[5]||(t[5]=e=>(Nn(),void(Number.isFinite(hn.value)&&(gn.value=hn.value)))),onMouseenter:t[6]||(t[6]=e=>ot(e,k(s)("common.reset")||"Reset")),onFocus:t[7]||(t[7]=e=>ot(e,k(s)("common.reset")||"Reset")),onMouseleave:lt,onBlur:lt},[...t[20]||(t[20]=[g("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"},[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),g("path",{d:"M3 3v5h5"})])],-1)])],40,be),g("button",{type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]",disabled:!!Number.isFinite(gn.value)&&gn.value>=36,onClick:t[8]||(t[8]=e=>function(){const e=Nn(),n=Math.min(36,e+1);gn.value=n}()),onMouseenter:t[9]||(t[9]=e=>ot(e,k(s)("common.increase")||"Increase")),onFocus:t[10]||(t[10]=e=>ot(e,k(s)("common.increase")||"Increase")),onMouseleave:lt,onBlur:lt},[...t[21]||(t[21]=[g("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"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)])],40,ke)],64)):P("",!0),o.showCopyButton?(m(),O("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":w.value?k(s)("common.copied")||"Copied":k(s)("common.copy")||"Copy",onClick:nt,onMouseenter:t[11]||(t[11]=e=>it(e)),onFocus:t[12]||(t[12]=e=>it(e)),onMouseleave:lt,onBlur:lt},[w.value?(m(),O("svg",Se,[...t[23]||(t[23]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(m(),O("svg",Ce,[...t[22]||(t[22]=[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),g("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,xe)):P("",!0),o.showExpandButton?(m(),O("button",{key:4,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":J.value,onClick:t[13]||(t[13]=e=>function(e){if(J.value=!J.value,e&&et.value){const n=tt(e);if(n){const e=J.value?s("common.collapse")||"Collapse":s("common.expand")||"Expand";I(n,e,"top",!1,void 0,o.isDark)}}const n=on.value?Xe():Ie(),t=v.value;n&&t&&(J.value?(ut(!0),t.style.maxHeight="none",t.style.overflow="visible",jn()):(ut(!1),t.style.overflow="auto",Vn()))}(e)),onMouseenter:t[14]||(t[14]=e=>ot(e,J.value?k(s)("common.collapse")||"Collapse":k(s)("common.expand")||"Expand")),onFocus:t[15]||(t[15]=e=>ot(e,J.value?k(s)("common.collapse")||"Collapse":k(s)("common.expand")||"Expand")),onMouseleave:lt,onBlur:lt},[J.value?(m(),O("svg",Be,[...t[24]||(t[24]=[g("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)])])):(m(),O("svg",Oe,[...t[25]||(t[25]=[g("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)])]))],40,Me)):P("",!0),In.value&&o.showPreviewButton?(m(),O("button",{key:5,type:"button",class:"code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":k(s)("common.preview")||"Preview",onClick:at,onMouseenter:t[16]||(t[16]=e=>ot(e,k(s)("common.preview")||"Preview")),onFocus:t[17]||(t[17]=e=>ot(e,k(s)("common.preview")||"Preview")),onMouseleave:lt,onBlur:lt},[...t[26]||(t[26]=[g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},[g("g",{fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"},[g("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"}),g("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,Ee)):P("",!0)])],!0)],4)):P("",!0),D(g("div",Le,[g("div",{ref_key:"codeEditor",ref:v,class:y(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":mn.value}]]),style:E(Mn.value)},null,6),mn.value?(m(),p(k(V),{key:0,class:y(["code-pre-fallback",{"is-wrap":fn.value}]),style:E(Cn.value),node:o.node},null,8,["class","style","node"])):P("",!0)],512),[[N,!(K.value||!e.stream&&e.loading)]]),pn.value&&!r.value&&In.value&&"html"===_.value?(m(),p(Z,{key:1,code:o.node.code,"is-dark":o.isDark,"on-close":()=>pn.value=!1},null,8,["code","is-dark","on-close"])):P("",!0),D(g("div",{class:"code-loading-placeholder",style:E(Bn.value)},[L(n.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[27]||(t[27]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))],!0)],4),[[N,!e.stream&&e.loading]]),g("span",Pe,b(w.value?k(s)("common.copied")||"Copied":""),1)],14,ue))}}),[["__scopeId","data-v-1a55f98f"]]);export{De as default};