markstream-vue 2.0.0-beta.1 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CodeBlockNode.js +1 -1
- package/dist/CodeBlockNodeLoading.js +1 -0
- package/dist/PreCodeBlock.js +1 -0
- package/dist/PreCodeBlock.vue_vue_type_style_index_0_lang.js +1 -0
- package/dist/Tooltip.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index10.js +1 -1
- package/dist/index2.js +1 -1
- package/dist/index5.js +1 -1
- package/dist/index6.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.js +1 -1
- package/dist/index9.js +1 -1
- package/dist/preCodeDiffMetrics.js +1 -0
- package/dist/preCodeTheme.js +1 -0
- package/dist/tailwind.js +0 -0
- package/package.json +6 -3
package/dist/CodeBlockNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,l=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(l,t,n)=>t in l?e(l,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[t]=n,r=(e,l)=>{for(var t in l||(l={}))o.call(l,t)&&a(e,t,l[t]);if(n)for(var t of n(l))i.call(l,t)&&a(e,t,l[t]);return e},u=(e,n)=>l(e,t(n)),d=(e,l,t)=>new Promise((n,o)=>{var i=e=>{try{r(t.next(e))}catch(l){o(l)}},a=e=>{try{r(t.throw(e))}catch(l){o(l)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);r((t=t.apply(e,l)).next())});import{defineComponent as s,ref as c,computed as v,openBlock as f,createElementBlock as p,Fragment as m,renderSlot as h,createElementVNode as g,toDisplayString as y,createCommentVNode as w,unref as b,normalizeStyle as k,withModifiers as x,createStaticVNode as C,createVNode as S,Transition as B,withCtx as M,withDirectives as F,normalizeClass as P,vShow as O,onMounted as E,onUnmounted as H,createBlock as N,Teleport as z,useAttrs as D,inject as T,getCurrentInstance as L,shallowRef as $,watch as j,onBeforeUnmount as _,nextTick as R,createSlots as A}from"vue";import{al as I,a4 as V,ah as q,y as W,M as U,ac as G,an as Y,ao as J,ak as X,a6 as K,ab as Q,z as Z}from"./exports.js";import{g as ee,n as le,e as te,b as ne,M as oe,f as ie,c as ae,l as re}from"./index2.js";import{safeRaf as ue,safeCancelRaf as de}from"./utils/safeRaf.js";import{getStreamDiffsRuntime as se}from"./streamDiffs.js";const ce={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},ve={class:"flex items-center gap-0.5"},fe=["aria-label"],pe={class:"code-diff-stat removed"},me={class:"code-diff-stat added"},he=["aria-label"],ge={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ye={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},we=["aria-pressed"],be={key:3,class:"relative"},ke=["aria-expanded"],xe=["disabled"],Ce=["disabled"],Se=["disabled"],Be={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Me={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Fe={class:"code-loading-placeholder"},Pe={class:"sr-only","aria-live":"polite",role:"status"},Oe=/* @__PURE__ */s({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:l}){const t=e,n=l,o=c(!1),i=c(null),a=c(null);function r(){V(!0),o.value=!o.value,o.value&&document.addEventListener("click",d,{once:!0,capture:!0})}function u(){V(!0),o.value=!1}function d(e){var l,t;const n=e.target;(null==(l=i.value)?void 0:l.contains(n))||(null==(t=a.value)?void 0:t.contains(n))?document.addEventListener("click",d,{once:!0,capture:!0}):u()}const s=v(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:E}=I(),H=v(()=>!1!==t.showTooltips);function N(e,l){H.value&&q(e.currentTarget,l,"top",!1,void 0,t.isDark)}function z(){H.value&&V()}function D(e){N(e,t.copyText?E("common.copied")||"Copied":E("common.copy")||"Copy")}const T=v(()=>{var e,l;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(l=t.codeFontMin)?l:0)}),L=v(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),$=v(()=>{var e,l;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(l=t.codeFontMax)?l:100)});return(l,d)=>(f(),p(m,null,[t.showHeader?(f(),p("div",ce,[h(l.$slots,"header-left"),h(l.$slots,"header-right",{},()=>[g("div",ve,[e.diffStats?(f(),p("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[g("span",pe,"-"+y(e.diffStats.removed),1),g("span",me,"+"+y(e.diffStats.added),1)],8,fe)):w("",!0),t.showCopyButton?(f(),p("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?b(E)("common.copied")||"Copied":b(E)("common.copy")||"Copy",onClick:d[0]||(d[0]=e=>n("copy")),onMouseenter:d[1]||(d[1]=e=>D(e)),onFocus:d[2]||(d[2]=e=>D(e)),onMouseleave:z,onBlur:z},[e.copyText?(f(),p("svg",ye,[...d[14]||(d[14]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(f(),p("svg",ge,[...d[13]||(d[13]=[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,he)):w("",!0),t.showCollapseButton?(f(),p("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:d[3]||(d[3]=e=>n("toggleCollapse")),onMouseenter:d[4]||(d[4]=l=>N(l,e.isCollapsed?b(E)("common.expand")||"Expand":b(E)("common.collapse")||"Collapse")),onFocus:d[5]||(d[5]=l=>N(l,e.isCollapsed?b(E)("common.expand")||"Expand":b(E)("common.collapse")||"Collapse")),onMouseleave:z,onBlur:z},[(f(),p("svg",{style:k({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...d[15]||(d[15]=[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,we)):w("",!0),s.value?(f(),p("div",be,[g("button",{ref_key:"moreBtnRef",ref:a,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":o.value,"aria-haspopup":"true",onClick:x(r,["stop"]),onMouseenter:d[6]||(d[6]=e=>N(e,b(E)("common.more")||"More")),onFocus:d[7]||(d[7]=e=>N(e,b(E)("common.more")||"More")),onMouseleave:z,onBlur:z},[...d[16]||(d[16]=[C('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,ke),S(B,{name:"code-menu"},{default:M(()=>[o.value?(f(),p("div",{key:0,ref_key:"moreMenuRef",ref:i,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[t.showFontSizeButtons&&t.enableFontSizeControl?(f(),p(m,{key:0},[g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:T.value,onClick:d[8]||(d[8]=e=>{b(V)(!0),n("decreaseFont")})},[d[17]||(d[17]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),g("span",null,y(b(E)("common.fontSmaller")||"Font size −"),1)],8,xe),g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:L.value,onClick:d[9]||(d[9]=e=>{b(V)(!0),n("resetFont")})},[d[18]||(d[18]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[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)),g("span",null,y(b(E)("common.fontReset")||"Font size reset"),1)],8,Ce),g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:$.value,onClick:d[10]||(d[10]=e=>{b(V)(!0),n("increaseFont")})},[d[19]||(d[19]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),g("span",null,y(b(E)("common.fontLarger")||"Font size +"),1)],8,Se)],64)):w("",!0),t.showExpandButton?(f(),p("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:d[11]||(d[11]=e=>{u(),n("toggleExpand")})},[e.isExpanded?(f(),p("svg",Be,[...d[20]||(d[20]=[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)])])):(f(),p("svg",Me,[...d[21]||(d[21]=[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)])])),g("span",null,y(e.isExpanded?b(E)("common.collapse")||"Collapse":b(E)("common.expand")||"Expand"),1)])):w("",!0),e.isPreviewable&&t.showPreviewButton?(f(),p("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:d[12]||(d[12]=e=>{u(),n("preview")})},[d[22]||(d[22]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),g("circle",{cx:"12",cy:"12",r:"3"})])],-1)),g("span",null,y(b(E)("common.preview")||"Preview"),1)])):w("",!0)],512)):w("",!0)]),_:1})])):w("",!0)])])])):w("",!0),F(g("div",{class:P(["code-block-shell-content",{"code-block-shell-content--collapsed":e.isCollapsed}])},[h(l.$slots,"default")],2),[[O,!!e.stream||!e.loading]]),F(g("div",Fe,[h(l.$slots,"loading",{},()=>[d[23]||(d[23]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))])],512),[[O,!e.stream&&e.loading]]),g("span",Pe,y(e.copyText?b(E)("common.copied")||"Copied":""),1)],64))}}),Ee={class:"html-preview-frame__header"},He={class:"html-preview-frame__title"},Ne={class:"html-preview-frame__label"},ze=["sandbox","srcdoc"],De=/* @__PURE__ */W(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const l=e,t=void 0!==import.meta&&Boolean(!1);let n=null;const{t:o}=I(),i=v(()=>{const e=l.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: ${l.isDark?"#020617":"#ffffff"};\n color: ${l.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>`}),a=v(()=>{return e=l.htmlPreviewSandbox,o=l.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!t||"undefined"==typeof console||n===e)return;const l=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);l.has("allow-scripts")&&l.has("allow-same-origin")&&(n=e,console.warn("[markstream-vue] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===o?"allow-scripts":"";var e,o});function r(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=l.onClose)||t.call(l)}return E(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",r)}),H(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",r)}),(e,t)=>(f(),N(z,{to:"body"},[g("div",{class:P(["markstream-vue",{dark:l.isDark}])},[g("div",{class:"html-preview-frame__backdrop",onClick:t[2]||(t[2]=e=>{var t;return null==(t=l.onClose)?void 0:t.call(l)})},[g("div",{class:"html-preview-frame",onClick:t[1]||(t[1]=x(()=>{},["stop"]))},[g("div",Ee,[g("div",He,[t[3]||(t[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",Ne,y(l.title||b(o)("common.preview")||"Preview"),1)]),g("button",{type:"button",class:"html-preview-frame__close",onClick:t[0]||(t[0]=e=>{var t;return null==(t=l.onClose)?void 0:t.call(l)})}," × ")]),g("iframe",{class:"html-preview-frame__iframe",sandbox:a.value,referrerpolicy:"no-referrer",srcdoc:i.value},null,8,ze)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]),Te=["data-markstream-enhanced","data-markstream-enhancement-state","data-markstream-code-block-state","data-markstream-pending","data-markstream-viewport-pending"],Le={class:"code-header-main"},$e=["innerHTML"],je={class:"code-header-copy"},_e={class:"code-header-title"},Re={key:0,class:"code-header-caption"},Ae=["data-markstream-host-hidden"],Ie=/* @__PURE__ */W(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},codeBlockOptions:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:["previewCode","copy"],setup(e,{emit:l}){var t,n,o,i,a;const s=e,m=l,x=v(()=>{var e,l;return null!=(l=s.showLineNumbers)?l:!0!==(null==(e=s.codeBlockOptions)?void 0:e.disableLineNumbers)}),C=D(),B=T(oe,null),z=T("markstreamHostScrollManaged",null),q=T(U,void 0),W=v(()=>G(s,C));function ce(e,l){}const ve=L(),fe=v(()=>{const e=null==ve?void 0:ve.vnode.props;return!(!e||!e.onPreviewCode&&!e["onPreview-code"])}),{t:pe}=I(),me=c(null),he=c(null),ge=c(!1),ye=c(Tn(s.node.language,s.node.code,Dn())),we=v(()=>ie(ye.value)),be=v(()=>"plaintext"===we.value?"text":we.value),ke=v(()=>"plaintext"===we.value),xe=c(!1),Ce=c(!1),Se=c(!1),Be=c(!1),Me=c(!1),Fe=c(!1);let Pe=!1,Ee=null,He=null,Ne=null,ze=0,Ie=!1,Ve="";const qe=c(null);let We=0,Ue=!1;const Ge=Y(),Ye=J(),Je=X(),Xe=$(null),Ke=c("undefined"==typeof window||!Je.value),Qe=null!=(o=null==(n=null==(t=L())?void 0:t.vnode.el)?void 0:n.textContent)?o:"",Ze="undefined"!=typeof window&&String(null!=(i=s.node.code)?i:"").length>0&&Qe.includes(String(s.node.code)),el=c(!Ze);E(()=>{el.value=!0}),"undefined"!=typeof window&&j([()=>he.value,Je],([e,l],t,n)=>{var o,i,a;if(null==(o=Xe.value)||o.destroy(),Xe.value=null,!l||Ke.value)return void(Ke.value=!0);if(!e)return void(Ke.value=!1);let r=!0;const u=null!=(a=null!=(i=null==Ye?void 0:Ye.value.heavyBlockMargin)?i:null==Ye?void 0:Ye.value.rootMargin)?a:"0px",d=Ge(e,{rootMargin:u,allowIdle:!1});Xe.value=d,Ke.value=Ke.value||d.isVisible.value,d.whenVisible.then(()=>{r&&Xe.value===d&&(Ke.value=!0)}).catch(()=>{}),n(()=>{r=!1,d.destroy(),Xe.value===d&&(Xe.value=null)})},{immediate:!0}),_(()=>{var e;Pe=!0,function(){const e=Ve;B&&e&&(Ve="",B.markSettled(e))}(),null==(e=Xe.value)||e.destroy(),Xe.value=null});let ll=null,tl=null,nl=()=>{},ol=()=>{},il=()=>{},al=()=>{},rl=()=>null,ul=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),dl=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),sl=()=>{},cl=()=>{},vl=()=>{},fl=null,pl=null,ml=null,hl=null,gl=()=>{var e;return String(null!=(e=s.node.language)?e:"plaintext")},yl=()=>d(null,null,function*(){}),wl=!1,bl=null;const kl=[],xl=[];let Cl=null,Sl=null;const Bl=v(()=>K(s.node)),Ml=c({removed:0,added:0}),Fl=v(()=>`-${Ml.value.removed} +${Ml.value.added}`);function Pl(e,l){return{original:Ol(e),updated:Ol(l)}}function Ol(e){return String(null!=e?e:"").replace(/\r\n$|\n$|\r$/,"")}function El(e){var l;return String(null!=(l=null==e?void 0:e.message)?l:e).includes("no diff result available")}function Hl(){if(!Fn())try{const e=vl();e&&"function"==typeof e.catch&&e.catch(e=>{El(e)})}catch(e){El(e)}}const Nl=v(()=>{const e=r({},s.codeBlockOptions||{});for(const n of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix","maxHeight","padding","tabSize"])delete e[n];if(!Bl.value)return e;const l=e.parseDiffOptions&&"object"==typeof e.parseDiffOptions?e.parseDiffOptions:{},t={diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return u(r(r({},t),e),{parseDiffOptions:r(r({},t.parseDiffOptions),l)})}),zl=v(()=>(void 0!==s.theme?!oo(s.theme):ao(s.darkTheme,s.lightTheme))?function(e){var l;const t=(null!=(l=io(e))?l:"").toLowerCase();if(!t)return!!s.isDark;return["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))}(ro()):!!s.isDark),Dl=v(()=>(Bl.value,zl.value?"dark":"light")),Tl=v(()=>Bl.value?"dark"===Dl.value:zl.value),Ll=v(()=>Bl.value?"diff":"single"),$l=c(Ll.value),jl=c(!1),_l=c(!1),Rl=c(!1),Al=c(!1),Il=c(null),Vl=c(0),ql=c(0),Wl=c(!1);let Ul=null,Gl=!1,Yl=null,Jl=!1;const Xl=v(()=>{var e;return"scroll"!==(null==(e=s.codeBlockOptions)?void 0:e.overflow)}),Kl=v(()=>{var e;return!!Bl.value&&"unified"===(null==(e=Nl.value)?void 0:e.diffStyle)}),Ql=v(()=>{var e,l,t,n;if(!0===(null==(e=Nl.value)?void 0:e.expandUnchanged))return!1;const o=Number(null==(t=null==(l=Nl.value)?void 0:l.parseDiffOptions)?void 0:t.context),i=Number(null==(n=Nl.value)?void 0:n.collapsedContextThreshold),a=Number.isFinite(o)&&o>=0?Math.floor(o):2,r=Number.isFinite(i)&&i>=0?Math.floor(i):5;return{enabled:!0,contextLineCount:a,minimumLineCount:Math.max(1,r-a+1),revealLineCount:5}});function Zl(e){return!0===(null==z?void 0:z.value)||!!e&&(!!e.closest('[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline')||Boolean(e.closest(".vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]")))}const et=v(()=>Zl(he.value)),lt=v(()=>!(jl.value||!Al.value&&_l.value)),tt=v(()=>lt.value),nt=v(()=>lt.value&&!Rl.value),ot=v(()=>!jl.value&&!Al.value&<.value),it=v(()=>_l.value&&!jl.value?"ready":Al.value?"fallback":"pending"),at=c(!1),rt=v(()=>Ol(s.node.code)),ut=v(()=>Bl.value?!0===s.node.diff?s.node:u(r({},s.node),{diff:!0}):rt.value===s.node.code?s.node:u(r({},s.node),{code:rt.value}));function dt(e){const l=e.detectLanguage;"function"==typeof l&&(gl=l),Sl=e,Cl=so();const t=e.createCodeBlockRuntime(Cl);return!!t&&(ll=t.createEditor||ll,tl=t.createDiffEditor||tl,nl=t.updateCode||nl,ol=t.updateDiff||ol,il=t.finalizeCode||il,al=t.finalizeDiff||al,rl=t.getEditor||rl,ul=t.getEditorView||ul,dl=t.getDiffEditorView||dl,sl=t.cleanupEditor||sl,cl=t.safeClean||t.cleanupEditor||cl,vl=t.refreshDiffPresentation||vl,yl=t.setTheme||yl,fl=t.whenVisualReady||null,Fe.value=!0,!0)}const st=c("number"==typeof(null==(a=s.codeBlockOptions)?void 0:a.fontSize)?s.codeBlockOptions.fontSize:Number.NaN),ct=c(st.value),vt=c(null),ft=c(null),pt=c(null),mt=v(()=>{const e=st.value,l=ct.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof l&&Number.isFinite(l)&&l>0}),ht=v(()=>{var e;const l=vt.value;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l;const t=null==(e=s.codeBlockOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const n=ct.value;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:12}),gt=v(()=>{var e;const l=ft.value;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l;const t=null==(e=s.codeBlockOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12===ht.value?18:Math.max(12,Math.round(1.5*ht.value))}),yt=v(()=>gt.value),wt=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.tabSize;return"number"==typeof l&&Number.isFinite(l)&&l>0?l:4}),bt=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.padding,t=Bl.value?0:8,n="number"==typeof l&&Number.isFinite(l)&&l>=0?l:t;return{top:n,bottom:n}}),kt=v(()=>{const e=s.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function xt(e){if(null==e)return null;const l=Math.ceil(e);return!Number.isFinite(l)||l<=0?null:Math.min(l,Math.ceil(Nn()))}function Ct(){return!Bl.value&&!1!==s.stream&&!1!==s.loading}const St=v(()=>Bl.value?null:null==kt.value||Ct()?Math.ceil((e=>{const l=String(null!=e?e:"");return l?Math.max(1,l.split(/\r\n|\n|\r/).length):1})(rt.value)*yt.value+1):null),Bt=v(()=>{if(Bl.value)return null;const e=kt.value;return null==e||Ct()?xt(St.value):xt(e)}),Mt=v(()=>{const e=s.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),Ft=c(null);function Pt(){const e=Ft.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}const Ot=v(()=>{const e=Pt();return null!=e?e:!Bl.value&&Wl.value?null:lt.value||!_l.value?Bt.value:null});function Et(e){const l=e?"hsl(152 42% 60%)":"var(--diff-added-fg)",t=e?"hsl(0 58% 58%)":"var(--diff-removed-fg)",n=e?"hsl(152 42% 60% / 0.18)":"var(--diff-added-bg)",o=e?"hsl(0 58% 58% / 0.18)":"var(--diff-removed-bg)";return{"--markstream-diff-line-number-bg":e?"hsl(0 0% 7% / 0.98)":"hsl(var(--ms-muted) / 0.45)","--markstream-diff-added-fg":l,"--markstream-diff-removed-fg":t,"--markstream-diff-added-line":n,"--markstream-diff-removed-line":o,"--markstream-diff-added-line-fill":n,"--markstream-diff-removed-line-fill":o,"--markstream-diff-added-gutter":`linear-gradient(90deg, ${l} 0 4px, transparent 4px 100%)`,"--markstream-diff-removed-gutter":`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,"--markstream-diff-added-inline":e?"hsl(152 42% 60% / 0.28)":"var(--diff-added-inline-bg)","--markstream-diff-removed-inline":e?"hsl(0 58% 58% / 0.28)":"var(--diff-removed-inline-bg)"}}const Ht=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.fontFamily,t=xt(kt.value),n=xt(St.value),o=Ct(),i=r(r({fontSize:`${ht.value}px`,lineHeight:`${yt.value}px`,tabSize:wt.value,boxSizing:"border-box",maxHeight:`${Nn()}px`,overflow:"auto",paddingTop:`${bt.value.top}px`,paddingBottom:`${bt.value.bottom}px`},Bl.value||null==t||o?Bl.value||null==n?{}:{minHeight:`${n}px`}:{height:`${t}px`,minHeight:`${t}px`}),"string"==typeof l&&l.trim()?{fontFamily:l.trim()}:{});return i["--markstream-pre-line-number-top"]=`${bt.value.top}px`,i["--markstream-pre-line-number-left"]="0px",i["--markstream-pre-line-number-padding-left"]="2ch",i["--markstream-pre-line-number-padding-right"]="1ch",i["--markstream-pre-line-number-separator-width"]="2px",Bl.value&&(i["--markstream-pre-diff-line-height"]=`${yt.value}px`,i["--markstream-pre-diff-pane-bottom-padding"]=(Kl.value,"0px"),Object.assign(i,Et(Tl.value))),i}),Nt=v(()=>null!=Ot.value&&(!_l.value||null!=Pt())),zt=v(()=>{const e=Ot.value;if(null==e)return null;if(Bl.value)return Math.ceil(e);const l=Mt.value,t=kt.value;if(null==l||null==t)return Math.ceil(e);const n=Math.max(0,Math.ceil(l)-Math.ceil(t));return Math.ceil(e+n)}),Dt=v(()=>{if(Bl.value&<.value)return{};const e=Ot.value;return Nt.value&&null!=e?{minHeight:`${e}px`}:{}});function Tt(){var e,l,t,n,o,i,a,r;const u=null==(e=he.value)?void 0:e.querySelector("pre.code-pre-fallback"),d=dl(),s=null!=(l=null==u?void 0:u.scrollTop)?l:0;null==(o=null==(n=null==(t=null==d?void 0:d.getOriginalEditor)?void 0:t.call(d))?void 0:n.setScrollTop)||o.call(n,s),null==(r=null==(a=null==(i=null==d?void 0:d.getModifiedEditor)?void 0:i.call(d))?void 0:a.setScrollTop)||r.call(a,s)}function Lt(){return d(this,null,function*(){return Bl.value?(null!=an()||$t(),gn(!0),Tt(),yn(),Rl.value=!0,yield R(),gn(!0),yield _t(),gn(!0),!(fl&&!(yield fl())||(nn(),$t(),gn(!0),_l.value=!0,yield R(),$t(),gn(!0),nn(),yn(),wn(),0))):!(fl&&!(yield fl())||(an(),gn(!0),Rl.value=!0,yield R(),an(),gn(!0),yield _t(),an(),gn(!0),_l.value=!0,yield R(),wn(),0))})}function $t(){const e=me.value;return e&&Sn(e)?(yn(),mn({preferModelDiffHeight:!0}),bn(),Number.parseFloat(e.style.height||"")||null):an()}function jt(e,l=!1,t={}){const n=Math.ceil(e),o=Pt();if(null==o)return n;const i=!0===t.allowBelowEstimatedFloor;return n>=o||i?((l||i)&&Me.value&&(Ft.value=null),n):o}function _t(){return new Promise(e=>{let l=!1,t=null,n=null;const o=()=>{l||(l=!0,null!=n&&globalThis.clearTimeout(n),null!=t&&de(t),e())};n=globalThis.setTimeout(o,50),t=ue(o)})}function Rt(){var e;try{const l=me.value;if(!l)return null;const t=null!=(e=l.querySelector(".stream-diffs-shell .stream-diffs-surface"))?e:l.querySelector(".stream-diffs-shell");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(l){}return null}function At(){var e,l,t,n,o,i;try{const i=Bl.value?null!=(t=null==(l=null==(e=dl())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:dl():ul(),a=rl(),r=null==(n=null==a?void 0:a.EditorOption)?void 0:n.fontInfo;if(i&&null!=r){const e=null==(o=i.getOption)?void 0:o.call(i,r),l=null==e?void 0:e.fontSize;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l}}catch(a){}try{const e=me.value;if(e){const l=null!=(i=e.querySelector(".stream-diffs-shell .stream-diffs-surface"))?i:e.querySelector(".stream-diffs-shell");if(l)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(l).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(a){}}}catch(a){}return null}function It(e){var l,t;try{const n=rl(),o=null==(l=null==n?void 0:n.EditorOption)?void 0:l.lineHeight;if(null!=o){const l=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o);if("number"==typeof l&&l>0)return l}}catch(i){}const n=Rt();if(n&&n>0)return n;const o=Number.isFinite(ct.value)&&ct.value>0?ct.value:14;return Math.max(12,Math.round(1.35*o))}function Vt(){var e;const l=null==(e=s.codeBlockOptions)?void 0:e.padding;return"number"==typeof l&&Number.isFinite(l)?2*Math.max(0,l):Bl.value?24:0}function qt(e,l){return"number"!=typeof e||"number"!=typeof l||e<1||l<e?0:l-e+1}function Wt(e){if(!e)return[];const l=e.split(/\r?\n/);return 1===l.length&&""===l[0]?[]:l}function Ut(e){return!!ke.value||!!e&&(Fn(e)||null!=fl)}function Gt(){var e,l;Bl.value?Ml.value=function(e,l){const t=Wt(e),n=Wt(l);let o=0,i=t.length-1,a=n.length-1;for(;o<=i&&o<=a&&t[o]===n[o];)o++;for(;i>=o&&a>=o&&t[i]===n[a];)i--,a--;const r=Math.max(0,i-o+1),u=Math.max(0,a-o+1);if(0===r||0===u)return{removed:r,added:u};if((r+1)*(u+1)<=15e5){const e=u+1;let l=new Uint32Array(e),i=new Uint32Array(e);for(let d=r-1;d>=0;d--){i[u]=0;for(let a=u-1;a>=0;a--)i[a]=t[o+d]===n[o+a]?l[a+1]+1:Math.max(l[a],i[a+1]);const e=l;l=i,i=e}const a=l[0];return{removed:r-a,added:u-a}}return{removed:r,added:u}}(String(null!=(e=s.node.originalCode)?e:""),String(null!=(l=s.node.updatedCode)?l:"")):Ml.value={removed:0,added:0}}function Yt(){var e;if(Bl.value)try{const l=dl(),t=null==(e=null==l?void 0:l.getLineChanges)?void 0:e.call(l);if(!Array.isArray(t))return void Gt();let n=0,o=0;for(const e of t)n+=qt(e.originalStartLineNumber,e.originalEndLineNumber),o+=qt(e.modifiedStartLineNumber,e.modifiedEndLineNumber);Ml.value={removed:n,added:o}}catch(l){Gt()}else Ml.value={removed:0,added:0}}function Jt(){var e;if(Number.isFinite(ct.value)&&ct.value>0&&Number.isFinite(st.value))return ct.value;if("number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.fontSize))return st.value=s.codeBlockOptions.fontSize,ct.value=s.codeBlockOptions.fontSize,s.codeBlockOptions.fontSize;const l=At();return l&&l>0?(st.value=l,ct.value=l,l):(st.value=12,ct.value=12,12)}function Xt(){const e=Jt(),l=Math.min(36,e+1);ct.value=l}function Kt(){const e=Jt(),l=Math.max(10,e-1);ct.value=l}function Qt(){Jt(),Number.isFinite(st.value)&&(ct.value=st.value)}function Zt(){var e,l,t,n,o,i,a,r,u,d,s,c,v,f;try{const p=Bl.value?dl():null,m=Bl.value?p:ul();if(!m)return null;if((null==p?void 0:p.getOriginalEditor)&&(null==p?void 0:p.getModifiedEditor)){const v=null==(e=p.getOriginalEditor)?void 0:e.call(p),f=null==(l=p.getModifiedEditor)?void 0:l.call(p);null==(t=null==v?void 0:v.layout)||t.call(v),null==(n=null==f?void 0:f.layout)||n.call(f);const m=(null==(o=null==v?void 0:v.getContentHeight)?void 0:o.call(v))||0,h=(null==(i=null==f?void 0:f.getContentHeight)?void 0:i.call(f))||0,g=Math.max(m,h);if(g>0)return Math.ceil(g);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(It(v),It(f)),x=Vt();return Math.ceil(b*k+x+0)}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 Bl.value||(Wl.value=!0),Math.ceil(e)}const h=null==(f=null==m?void 0:m.getModel)?void 0:f.call(m);let g=1;h&&"function"==typeof h.getLineCount&&(g=h.getLineCount());const y=It(m);return Math.ceil(g*(y+1.5)+0)}catch(p){return null}}function en(){var e,l;if(Bl.value)return!1;try{const t=null==(l=null==(e=ul())?void 0:e.getContentHeight)?void 0:l.call(e),n="number"==typeof t&&Number.isFinite(t)&&t>0;return n&&(Wl.value=!0),n}catch(t){return!1}}function ln(e){if("undefined"==typeof window)return null;try{const l=e.getBoundingClientRect(),t=window.getComputedStyle(e);if("none"===t.display||"hidden"===t.visibility)return null;const n=e.querySelector("diffs-container");if(n instanceof HTMLElement){const e=n.getBoundingClientRect();if(e.height>0&&e.bottom>l.top)return Math.ceil(e.bottom-l.top)}const o=e.querySelector(".stream-diffs-shell");if(o){const e=o.getBoundingClientRect();if(e.height>0&&e.bottom>l.top)return Math.ceil(e.bottom-l.top)}return null}catch(l){return null}}function tn(e){var l;const t=String(null!=e?e:"").trim(),n=null==(l=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:l[1];if(n){const e=3===n.length?n.split("").map(e=>`${e}${e}`).join(""):n;return.2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}const o=t.match(/\d+(?:\.\d+)?/g);if(!o||o.length<3)return null;const[i,a,r]=o.slice(0,3).map(Number);return.2126*i+.7152*a+.0722*r}function nn(){var e,l,t;if(on())return;const n=At();n&&n>0&&(vt.value=n,ct.value=n,st.value=n);try{const n=It(Bl.value?null!=(t=null==(l=null==(e=dl())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:dl():ul());n&&n>0&&(ft.value=n)}catch(o){}try{const e=Rt();e&&e>0&&(ft.value=e)}catch(o){}}function on(){return Bl.value&&tt.value}function an(){var e;if(!lt.value)return null;const l=me.value,t=null==(e=he.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!l||!t)return null;const n=Math.ceil(t.getBoundingClientRect().height);return!Number.isFinite(n)||n<=0?null:(l.style.height=`${n}px`,l.style.minHeight=`${n}px`,l.style.maxHeight=`${Math.ceil(Nn())}px`,l.style.overflow="hidden",n)}function rn(){var e,l,t,n,o,i,a,r,u;const d=me.value,c=he.value;if(!d||!c)return;const v=d;v.style.setProperty("--diffs-tab-size",String(wt.value)),"number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.padding)?v.style.setProperty("--diffs-gap-block",`${bt.value.top}px`):v.style.removeProperty("--diffs-gap-block");const f=d.querySelector(".stream-diffs-shell")||d,p=f,m=f;let h=null,g=null,y=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(h=window.getComputedStyle(f),g=p===f?h:window.getComputedStyle(p),y=m===f?h:window.getComputedStyle(m))}catch(B){h=null,g=null,y=null}const w=String(null!=(l=null==h?void 0:h.getPropertyValue("--vscode-editor-foreground"))?l:"").trim(),b=String(null!=(t=null==h?void 0:h.getPropertyValue("--vscode-editor-background"))?t:"").trim(),k=String(null!=(o=null!=(n=null==h?void 0:h.getPropertyValue("--vscode-editor-selectionBackground"))?n:null==h?void 0:h.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?o:"").trim(),x=w||String(null!=(a=null!=(i=null==y?void 0:y.color)?i:null==h?void 0:h.color)?a:"").trim(),C=b||String(null!=(u=null!=(r=null==g?void 0:g.backgroundColor)?r:null==h?void 0:h.backgroundColor)?u:"").trim(),S=function(){var e,l,t,n,o;try{const i=Bl.value?null!=(t=null==(l=null==(e=dl())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:dl():ul(),a=rl(),r=null==(n=null==a?void 0:a.EditorOption)?void 0:n.fontInfo;if(i&&null!=r){const e=null==(o=i.getOption)?void 0:o.call(i,r),l=null==e?void 0:e.typicalHalfwidthCharacterWidth;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l}}catch(B){}return null}();if(null!=S&&(pt.value=S),Bl.value){const e=(e,l)=>{l?(c.style.setProperty(e,l),v.style.setProperty(e,l)):(c.style.removeProperty(e),v.style.removeProperty(e))};for(const[l,t]of Object.entries(Et(c.classList.contains("is-dark"))))e(l,t);return x?(c.style.setProperty("--markstream-diff-editor-fg",x),v.style.setProperty("--vscode-editor-foreground",x)):(c.style.removeProperty("--markstream-diff-editor-fg"),v.style.removeProperty("--vscode-editor-foreground")),C?(c.style.setProperty("--markstream-diff-editor-bg",C),c.style.setProperty("--markstream-diff-panel-bg",C),c.style.setProperty("--markstream-diff-panel-bg-soft",C),c.style.setProperty("--markstream-diff-panel-bg-strong",C),v.style.setProperty("--vscode-editor-background",C),v.style.backgroundColor=C):(c.style.removeProperty("--markstream-diff-editor-bg"),c.style.removeProperty("--markstream-diff-panel-bg"),c.style.removeProperty("--markstream-diff-panel-bg-soft"),c.style.removeProperty("--markstream-diff-panel-bg-strong"),v.style.removeProperty("--vscode-editor-background"),v.style.backgroundColor=""),void(k?v.style.setProperty("--vscode-editor-selectionBackground",k):v.style.removeProperty("--vscode-editor-selectionBackground"))}if(function(e,l,t){if(!ke.value)return!1;const n=tn(e),o=tn(l);return t?null!=n&&n>170||null!=o&&o<110:null!=n&&n<85||null!=o&&o>190}(C,x,c.classList.contains("is-dark")))return v.style.removeProperty("--vscode-editor-foreground"),v.style.removeProperty("--vscode-editor-background"),void v.style.removeProperty("--vscode-editor-selectionBackground");x&&v.style.setProperty("--vscode-editor-foreground",x),C&&v.style.setProperty("--vscode-editor-background",C),k&&v.style.setProperty("--vscode-editor-selectionBackground",k)}let un=0,dn=0;const sn=/auto|scroll|overlay/i;function cn(e,l,t){var n;if("undefined"==typeof window)return;if(Bl.value)return;if(function(e){return et.value||Zl(e)}(e))return;const o=Math.ceil(l),i=Math.ceil(t)-o;if(Math.abs(i)<=1)return;const a=function(e){var l,t;if("undefined"==typeof window)return null;const n=null!=(l=null==e?void 0:e.ownerDocument)?l:document,o=n.scrollingElement||n.documentElement||n.body;let i=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;i&&i!==n.body&&i!==o;){const e=window.getComputedStyle(i),l=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(sn.test(l)||sn.test(t))return i;i=i.parentElement}return o}(e);if(!a)return;const r=null!=(n=e.ownerDocument)?n: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 vn(){try{const e=me.value;if(!e)return;const l=e.getBoundingClientRect().height,t=Zt();if(null!=t&&t>0){const n=jt(t,!0,{allowBelowEstimatedFloor:!Bl.value&&Me.value&&en()}),o=Pt();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${n}px`,e.style.maxHeight="none",e.style.overflow="visible",void cn(e,l,n)}const n=Pt();null!=n&&(e.style.minHeight=`${n}px`,e.style.height=`${n}px`,e.style.maxHeight="none",e.style.overflow="visible",cn(e,l,n))}catch(e){}}function fn(){for(var e,l;kl.length>0;)try{null==(l=null==(e=kl.pop())?void 0:e.dispose)||l.call(e)}catch(t){}null!=Ee&&(de(Ee),Ee=null),null!=He&&(de(He),He=null),null!=Ne&&(de(Ne),Ne=null),ze=0,Ie=!1}function pn(){for(var e;xl.length>0;)try{null==(e=xl.pop())||e()}catch(l){}}function mn(e=!1){Ce.value||(xe.value?vn():function(e={}){var l;try{const t=me.value;if(!t)return;const n=t.getBoundingClientRect().height,o=Nn(),i=Math.ceil((null==(l=t.getBoundingClientRect)?void 0:l.call(t).height)||0),a=Number.parseFloat(t.style.height||""),r=i>0?i:Number.isFinite(a)&&a>0?Math.ceil(a):0,u=Bl.value?function(){var e,l,t,n,o,i,a,r,u,d,s,c;if(Fn())return null;try{const v=dl(),f=null==(e=null==v?void 0:v.getOriginalEditor)?void 0:e.call(v),p=null==(l=null==v?void 0:v.getModifiedEditor)?void 0:l.call(v);if(!f||!p)return null;const m=(null==(o=null==(n=null==(t=f.getModel)?void 0:t.call(f))?void 0:n.getLineCount)?void 0:o.call(n))||1,h=(null==(r=null==(a=null==(i=p.getModel)?void 0:i.call(p))?void 0:a.getLineCount)?void 0:r.call(a))||1,g=Math.max(m,h),y=Math.max(It(f),It(p)),w=Vt(),b=Math.max(null!=(d=null==(u=f.getContentHeight)?void 0:u.call(f))?d:0,null!=(c=null==(s=p.getContentHeight)?void 0:s.call(p))?c:0);return Math.ceil(Math.max(b,g*y+w+0))}catch(v){return null}}():null,d=Bl.value&&Sn(t);if(We>0&&(We--,null!=qe.value))return void cn(t,n,kn(t,qe.value,o,{preserveScrollableOverflow:Cn(t)}));if(Bl.value&&!d&<.value){const e=an();if(null!=e){const l=kn(t,e,o,{allowBelowEstimatedFloor:!0});return gn(!0),void cn(t,n,l)}}const c=Bl.value&&!0===e.preferModelDiffHeight,v=Bl.value?ln(t):null,f=!Bl.value&&Me.value&&en(),p=Bl.value&&!1!==s.loading&&(null!=v||null!=u&&i>0&&u<i-1),m=null!=u;let h;if(Bl.value)if(c){const e=null!=u&&!1===s.loading&&r>0&&u<r-1;h=!1===s.loading&&null!=v?null==u?v:Math.max(v,u):e?u:null!=v&&null!=u?Math.max(v,u,!1!==s.loading?r:0):Math.max(null!=v?v:0,null!=u?u:0,!1!==s.loading?r:0)||null}else h=Kl.value&&null!=v||null!=v?m?Math.max(v,u):v:Bl.value&&!1!==s.loading?null!=u&&r>0&&u<r-1?u:r>0?r:null:u;else h=Zt();if(Bl.value&&null!=h&&r>0&&(!1!==s.loading||!0===e.holdCurrentDiffHeight)&&(h=Math.max(h,r)),null!=h&&h>0)return void cn(t,n,kn(t,h,o,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:f||p,preserveScrollableOverflow:Cn(t)}));if(null!=qe.value)return void cn(t,n,kn(t,qe.value,o,{preserveScrollableOverflow:Cn(t)}));const g=Bl.value&&!1!==s.loading?i:Math.max(i,null!=u&&u>0?u:0);if(g>0)return void cn(t,n,kn(t,g,o));const y=Pt();if(!(null==y||Bl.value&&!1!==s.loading&&d))return void cn(t,n,kn(t,y,o));const w=Number.parseFloat(t.style.height);!Number.isNaN(w)&&w>0?cn(t,n,kn(t,w,o)):Bl.value||cn(t,n,kn(t,o,o))}catch(t){}}("object"==typeof e?e:{}))}function hn(){un=0,dn=0}function gn(e=!1){var l,t,n;if(Ce.value)return;const o=me.value;if(!o)return;const i=Bl.value?dl():ul();if(i&&"function"==typeof i.layout)try{const a=null==(l=o.getBoundingClientRect)?void 0:l.call(o),r=Math.ceil((null!=(t=null==a?void 0:a.width)?t:0)||o.clientWidth||0),u=Math.ceil((null!=(n=null==a?void 0:a.height)?n:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(r>0&&u>0){if(!e&&r===un&&u===dn)return;un=r,dn=u,i.layout({width:r,height:u})}else hn(),i.layout()}catch(a){}}function yn(){pn()}function wn(e=!1){if(Pe||null!=Ee)return;const l=()=>{Pe||(yn(),mn(e),gn())};Ee=ue(()=>{Ee=null,l(),He=ue(()=>{He=null,l()})}),bn()}function bn(e=!1){if(!Bl.value||Pe||!e&&!1===s.loading)return;if(Ie=Ie||e,ze=Math.max(ze,e?18:6),null!=Ne)return;const l=()=>{if(Ne=null,!Bl.value||Pe||ze<=0||!Ie&&!1===s.loading)return ze=0,void(Ie=!1);ze--,yn(),mn({preferModelDiffHeight:!0,holdCurrentDiffHeight:Ie}),gn(),ze>0?Ne=ue(l):Ie=!1};Ne=ue(l)}function kn(e,l,t,n={}){const o=Bl.value&&!1!==s.loading?ln(e):null,i=null!=o&&o>l+1?o:l,a=Math.min(i,t),r=!0===n.allowBelowEstimatedFloor,u=jt(a,!0===n.clearEstimatedFloor,{allowBelowEstimatedFloor:r}),d=Pt();if(e.style.minHeight=null==d||r?"0px":`${Math.min(d,Math.ceil(t))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(t)}px`,Bl.value)e.style.overflow="hidden";else{const o=!0===n.preserveScrollableOverflow||l>t+1;e.style.overflow=o?"auto":"hidden"}return u}function xn(e,l=0){var t;const n=Math.ceil((null==(t=e.getBoundingClientRect)?void 0:t.call(e).height)||0),o=Math.max(l,e.clientHeight||0,n);return o>0&&e.scrollHeight>o+1}function Cn(e){var l;return!Bl.value&&(Ue||xn(e,null!=(l=qe.value)?l:0))}function Sn(e=me.value){return Fn(e)}function Bn(e=me.value){return Fn(e)}function Mn(){var e,l;if(Fn())return!0;const t=null==(l=null==(e=ul())?void 0:e.getModel)?void 0:l.call(e);return"function"==typeof(null==t?void 0:t.getValue)&&t.getValue()===rt.value}function Fn(e=me.value){return Boolean(null==e?void 0:e.querySelector("diffs-container"))}function Pn(){return!1!==s.loading||_l.value}function On(){const e=dl();return Boolean("function"==typeof(null==e?void 0:e.getOriginalEditor)||"function"==typeof(null==e?void 0:e.getModifiedEditor)||"function"==typeof(null==e?void 0:e.getLineChanges))}function En(){return d(this,null,function*(){if(!Bl.value)return!0;for(let e=0;e<30;e++){if(Pe)return!1;if(Fn())return yield R(),yield _t(),!Pe&&Fn();yield R(),yield _t()}return!1})}function Hn(e,l,t){return d(this,null,function*(){try{return void(yield ol(e,l,t))}catch(n){if(!El(n))throw n}if(yield R(),yield _t(),!Pe&&Bl.value)try{yield ol(e,l,t)}catch(n){if(!El(n))throw n}})}function Nn(){var e,l;return null!=(l=null==(e=s.codeBlockOptions)?void 0:e.maxHeight)?l:500}const zn=v(()=>s.isShowPreview&&("html"===ye.value||"svg"===ye.value));function Dn(){return"boolean"==typeof s.node.loading?s.node.loading:!0===s.loading}function Tn(e,l,t){return!t||function(){var e,l,t;if(!Dn())return!0;const n=String(null!=(e=s.node.raw)?e:""),o=null!=(t=null==(l=n.split(/\r\n|\n|\r/,1)[0])?void 0:l.trimStart())?t:"";return!/^(?:`{3,}|~{3,})/.test(o)||/\r\n|\n|\r/.test(n)}()&&String(null!=l?l:"")?le(String(null!=e?e:"")):"plain"}function Ln(){return Dn()}let $n=null,jn=!1,_n=0;function Rn(){$n=null,_n++}function An(){return d(this,arguments,function*(e=_n){if(!jn){jn=!0;try{for(;$n&&!Pe&&!Bl.value&&e===_n;){const e=$n;$n=null;try{yield Promise.resolve(nl(e.code,e.language)),yield R(),Pe||Bl.value||(mn(!1),gn())}catch(l){ce()}}}finally{jn=!1,!$n||Pe||Bl.value||An()}}})}function In(e,l){$n={code:e,language:l},An(_n)}j(()=>[s.node.language,s.node.code,s.node.raw,s.node.loading,s.loading],([e,l,t,n,o])=>{ye.value=Tn(e,l,"boolean"==typeof n?n:!0===o)}),j(()=>[s.node.originalCode,s.node.updatedCode,Bl.value],()=>{Gt(),ue(()=>Yt())},{immediate:!0});let Vn=0;j(()=>[s.node.originalCode,s.node.updatedCode,be.value,Bl.value,s.stream],e=>d(null,[e],function*([,,,e,l]){var t,n;const o=++Vn;if(!e)return;if(Dn())return;if(!1===l&&!Se.value)return;if(!1!==l&&ll&&!Se.value&&me.value)try{yield lo(me.value)}catch(u){}const i=ml;if(i&&!Be.value){try{yield i}catch(u){}if(Pe||!Bl.value||o!==Vn)return}if(o!==Vn)return;const a=Pl(String(null!=(t=s.node.originalCode)?t:""),String(null!=(n=s.node.updatedCode)?n:"")),r=!1===s.loading;r&&co();try{if(yield Hn(a.original,a.updated,be.value),Pe||!Bl.value||o!==Vn)return;yield R(),gn(!0),yn(),mn(!1===s.loading||{preferModelDiffHeight:!0}),gn(!0),wn(!0)}catch(d){return}if(r){if(Pe||!Bl.value)return;Hl(),yn(),Yt(),wn(),bn(!0)}xe.value&&ue(()=>vn())})),j(()=>s.node.code,e=>d(null,null,function*(){if(Dn())return;if(!1===s.stream)return;if(ye.value||(ye.value=le(gl(e))),Bl.value)return;const l=ml;if(l&&!Be.value){try{yield l}catch(t){}if(Pe||Bl.value)return}if(ll&&!Se.value&&me.value)try{yield lo(me.value)}catch(t){}In(Ol(s.node.code),be.value),xe.value&&ue(()=>vn())}));const qn=v(()=>{const e=ye.value;return e?ae[e]||e.charAt(0).toUpperCase()+e.slice(1):ae[""]||"Plain Text"}),Wn=v(()=>{var e;return Q(String(null!=(e=s.node.raw)?e:""),qn.value,Bl.value)}),Un=v(()=>Wn.value.title),Gn=v(()=>Wn.value.caption),Yn=v(()=>(re.value,function(e,l){if(void 0===l)return ee(e);if(l){const t=l(e);if(null!=t&&""!==t)return t}const t=le(e);return te(t)||ne()}(ye.value||"",q))),Jn=v(()=>{const e={};e["--markstream-code-layout-character-width"]=null==pt.value?"1ch":`${pt.value}px`;const l=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=l(s.minWidth),n=l(s.maxWidth);if(t&&(e.minWidth=t),n&&(e.maxWidth=n),Nt.value&&!Bl.value&&!Ce.value){const l=zt.value;null!=l&&(e.minHeight=`${l}px`)}return Bl.value||(e.color="var(--markstream-code-fallback-fg, var(--code-fg))",e.backgroundColor="var(--markstream-code-fallback-bg, var(--code-bg))",e.borderColor="var(--markstream-code-border-color, var(--code-border))"),e}),Xn=v(()=>!1!==s.showTooltips);function Kn(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(s.node.code)),ge.value=!0,m("copy",s.node.code),setTimeout(()=>{ge.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function Qn(){xe.value=!xe.value;const e=Bl.value?dl():ul(),l=me.value;e&&l&&(xe.value?(l.style.maxHeight="none",l.style.overflow="visible",mn(!0)):(l.style.overflow=Bl.value?"hidden":"auto",mn(!0)))}function Zn(){var e,l;if(Ce.value=!Ce.value,Ce.value){if(Ue=!1,me.value){const t=Math.ceil((null==(l=(e=me.value).getBoundingClientRect)?void 0:l.call(e).height)||0);Ue=!Bl.value&&(xn(me.value,t)||"auto"===me.value.style.overflow||"auto"===me.value.style.overflowY),t>0&&(qe.value=t)}}else me.value&&null!=qe.value&&(me.value.style.height=`${qe.value}px`),We=2,R(()=>{Ce.value||Pe||(mn(!0),gn(!0))})}function eo(){if(!zn.value)return;const e=ye.value;if(fe.value){const l="html"===e?"text/html":"image/svg+xml",t="html"===e?pe("artifacts.htmlPreviewTitle")||"HTML Preview":pe("artifacts.svgPreviewTitle")||"SVG Preview";return void m("previewCode",{node:s.node,artifactType:l,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&(at.value=!at.value)}function lo(e,l={}){if(!ll||Pe)return null;if(!1===s.stream&&!1!==s.loading)return null;if(go(),yo())return null;if(jl.value||me.value!==e)return null;if(Ln())return null;if(pl)return pl;if(Se.value&&Me.value)return Promise.resolve();const t=mo(),n=Vl.value;let o=!1;Se.value=!0,function(){const e=W.value;B&&e&&Ve!==e&&(Ve&&B.markSettled(Ve),Ve=e,B.markPending(e))}();const i=d(null,null,function*(){try{yield function(e){return d(this,null,function*(){var l,t;if(!ll||Pe)return;const n=Ll.value;if(Jl=!1,Al.value=!1,Il.value=null,Be.value=!1,_l.value=!1,Rl.value=!1,vt.value=null,ft.value=null,pt.value=null,hn(),function(){Wl.value=!1;const e=Bt.value;Ft.value=Me.value||null==e?null:e}(),fn(),pn(),function(e){e.replaceChildren()}(e),co(),Pe)return;const o=d(null,null,function*(){var l,t;if("diff"===n){!function(){if(wl||"undefined"==typeof window)return;wl=!0;const e=e=>{var l;El("reason"in e?e.reason:null!=(l=e.error)?l:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0),bl=()=>{window.removeEventListener("error",e,!0),window.removeEventListener("unhandledrejection",e,!0),wl=!1,bl=null}}(),cl();const n=Pl(String(null!=(l=s.node.originalCode)?l:""),String(null!=(t=s.node.updatedCode)?t:""));tl?yield tl(e,n.original,n.updated,be.value):yield ll(e,s.node.code,be.value)}else yield ll(e,rt.value,be.value);Be.value=!0}),i=o.finally(()=>{ml===i&&(ml=null)});if(ml=i,yield function(e){return d(this,null,function*(){if(!Bl.value)return void(yield e);let l,t=!1;for(e.then(()=>{t=!0},e=>{t=!0,l=e});;){if(Pe)return;if(t){if(l)throw l;return}if(Sn()&&On())return;yield R(),yield _t()}})}(i),Pe)return;if(Ll.value!==n)return;Be.value=!0;const a=null==(l=s.codeBlockOptions)?void 0:l.fontSize;if("number"==typeof a&&Number.isFinite(a)&&a>0){const e="diff"===n?dl():ul();null==(t=null==e?void 0:e.updateOptions)||t.call(e,{fontSize:a}),st.value=a,ct.value=a}else if(!on()){const e=At();e&&e>0?(st.value=e,ct.value=e):(st.value=12,ct.value=12)}nn(),yield uo(),xe.value||Ce.value||mn(!1),Me.value=!0,$l.value=n,function(){var e,l,t,n,o;if(fn(),Bl.value){const n=dl(),o=null==(e=null==n?void 0:n.getOriginalEditor)?void 0:e.call(n),i=null==(l=null==n?void 0:n.getModifiedEditor)?void 0:l.call(n),r=(e,l)=>{try{const t=null==e?void 0:e[l];if("function"!=typeof t)return;const n=t.call(e,()=>wn());n&&kl.push(n)}catch(t){}};try{const e=null==(t=null==n?void 0:n.onDidUpdateDiff)?void 0:t.call(n,()=>{wn(),ue(()=>Yt())});e&&kl.push(e)}catch(a){}r(o,"onDidContentSizeChange"),r(i,"onDidContentSizeChange");const u=me.value;if(u&&"undefined"!=typeof MutationObserver){const e=["diffs-container",".stream-diffs-shell",".stream-diffs-surface"].join(","),l=l=>{var t;const n=l instanceof HTMLElement?l:l.parentElement;return Boolean(null==(t=null==n?void 0:n.closest)?void 0:t.call(n,e))},t=l=>{var t,n;const o=l instanceof HTMLElement?l:l.parentElement;return Boolean((null==(t=null==o?void 0:o.closest)?void 0:t.call(o,e))||(null==(n=null==o?void 0:o.querySelector)?void 0:n.call(o,e)))},n=new MutationObserver(e=>{Bl.value&&Pn()&&e.some(e=>l(e.target)||Array.from(e.addedNodes).some(t)||Array.from(e.removedNodes).some(l))&&(yn(),mn({preferModelDiffHeight:!0}),gn(),bn())});n.observe(u,{attributeFilter:["class"],attributes:!0,childList:!0,characterData:!0,subtree:!0}),kl.push({dispose:()=>n.disconnect()})}if(u&&"undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{if(!Bl.value)return;if(gn(),!Pn())return;const e=ln(u);null!=e&&(Math.ceil(u.getBoundingClientRect().height||0)<=e+1||(yn(),mn({preferModelDiffHeight:!0}),gn()))});e.observe(u),kl.push({dispose:()=>e.disconnect()})}return}const i=ul();try{const e=null==(n=null==i?void 0:i.onDidContentSizeChange)?void 0:n.call(i,()=>wn());e&&kl.push(e)}catch(a){}try{const e=null==(o=null==i?void 0:i.onDidLayoutChange)?void 0:o.call(i,()=>wn());e&&kl.push(e)}catch(a){}}(),rn(),nn(),yn(),Yt(),wn(),yield R();let r=null;fl&&(r=yield fl(),r&&(yield R(),yield _t()));const u=null==r?"diff"===n?yield En():yield function(){return d(this,null,function*(){if(Fn())return yield R(),yield _t(),Fn();for(let e=0;e<30;e++){if(Pe||Bl.value)return!1;const e=me.value,l=Mn(),t=Bn(e),n=!rt.value.trim()||Ut(e);if(l&&t&&n&&(yield R(),yield _t(),!Pe&&!Bl.value&&Mn()&&Bn(me.value)&&(!rt.value.trim()||Ut(me.value))))return!0;yield R(),yield _t()}return!1})}():r;Pe||(u?(nn(),$t(),(yield Lt())||wo()):wo())})}(e),Ul=null}catch(i){const e=mo(),a=n!==Vl.value,r=!1!==l.allowStaleContentRetry&&a&&Ul!==e;if(t!==e||r)return r&&(Ul=e),o=!0,Se.value=!1,Me.value=!1,Be.value=!1,void(_l.value=!1);throw wo(t),i}}).finally(()=>{pl===i&&(pl=null),function(){const e=Ve;B&&e&&(Ve="",R(()=>{var l,t;if(!Pe){const n=null!=(t=null==(l=he.value)?void 0:l.offsetHeight)?t:0;n>0&&B.reportHeight(e,n)}B.markSettled(e)}))}(),o&&!Pe&&queueMicrotask(()=>{var e;const l=me.value;l&&!Pe&&(null==(e=lo(l))||e.catch(e=>{Me.value=!1,_l.value=!1,wo()}))})});return pl=i,i}j(Xn,e=>{e||V()}),j(()=>ct.value,(e,l)=>{var t;const n=Bl.value?dl():ul();n&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(null==(t=n.updateOptions)||t.call(n,{fontSize:e}),Ce.value||mn(!0))},{flush:"post",immediate:!1});let to=0;const no=j(()=>[me.value,Bl.value,s.stream,s.loading,Fe.value,Ke.value,s.node.language,s.node.raw,s.node.code,s.node.loading],e=>d(null,[e],function*([e,l,t,n,o,i]){const a=++to;if(!e)return;if(!i)return;if(Dn())return;if(Gl)return;if(!1===t&&!1!==n)return;if(!ll){if(yield function(){return d(this,null,function*(){if("undefined"==typeof window||Pe)return;if(Fe.value||jl.value)return;if(hl)return hl;const e=d(null,null,function*(){try{const e=yield se();if(Pe)return;if(!e)return void(jl.value=!0);dt(e)}catch(e){if(Pe)return;jl.value=!0}}).finally(()=>{hl===e&&(hl=null)});return hl=e,e})}(),a!==to)return;if(!1===s.stream&&!1!==s.loading)return;if(Ln())return;if(!Ke.value)return;if(!ll||jl.value||Se.value||yo()||Pe||me.value!==e)return}if(Ln())return;const r=lo(e);if(r){try{yield r}catch(u){Me.value=!1,_l.value=!1,wo()}Me.value&&_l.value&&no()}}));function oo(e){return!!e&&"object"==typeof e&&"light"in e&&"dark"in e}function io(e){return"string"==typeof e?e:null}function ao(e,l){if(e===l)return!0;const t=io(e),n=io(l);return!!t&&t===n}function ro(){return function(){if(void 0!==s.theme){const e=s.theme;return oo(e)?s.isDark?e.dark:e.light:e}const e=s.isDark?s.darkTheme:s.lightTheme;if(e)return e;const l=s.themes;return l?s.isDark?l[0]:l[1]:s.isDark?"vitesse-dark":"vitesse-light"}()}function uo(){return d(this,arguments,function*(e={}){co();const l=()=>{Bl.value&&Hl(),ue(()=>{rn(),wn()})};if(e.appearanceOnly)return void l();const t=ro();if(t)try{yield yl(t),l()}catch(n){}else l()})}function so(){var e,l;const t=u(r({overflow:"wrap"},Nl.value||{}),{themes:s.themes,stream:!1,MAX_HEIGHT:null!=(l=null==(e=s.codeBlockOptions)?void 0:e.maxHeight)?l:500,fontSize:ht.value,lineHeight:yt.value,theme:ro(),themeType:s.isDark?"dark":"light",disableLineNumbers:!x.value,disableFileHeader:!0,onThemeChange(){rn()}}),n=function(){var e;const l=null==(e=Nl.value)?void 0:e.fontFamily;return"string"==typeof l&&l.trim()?l.trim():Bl.value?function(){var e;if("undefined"==typeof window)return;const l=null==(e=he.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!l)return;return window.getComputedStyle(l).fontFamily.trim()||void 0}():void 0}();n&&(null!=t.fontFamily||(t.fontFamily=n));const o="string"==typeof t.unsafeCSS?t.unsafeCSS:"";return t.unsafeCSS=`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }\n${o}`.trim(),t}function co(){const e=so();if(!Cl)return Cl=e,Cl;for(const l of Object.keys(Cl))l in e||delete Cl[l];return Object.assign(Cl,e),Cl}j(Ll,(e,l)=>d(null,null,function*(){if(e===l)return;if(Al.value||Gl)return;if(Rn(),!ll||!me.value)return;if(!Se.value)return;if(!1===s.stream&&!1!==s.loading)return;if(!Ke.value)return;const t=pl;if(t){try{yield t}catch(n){}if(Pe||!me.value)return}if($l.value!==e||!Se.value||!Me.value)try{Me.value=!1,_l.value=!1,Se.value=!1,Be.value=!1,fn(),pn(),cl(),yield R(),yield lo(me.value)}catch(o){Me.value=!1,_l.value=!1,wo()}}));const vo=c(0),fo=v(()=>String(vo.value));let po=!1;function mo(){var e;const l=ro();return JSON.stringify({kind:Ll.value,language:be.value,structural:fo.value,optionsRevision:vo.value,settledContentGeneration:ql.value,theme:null!=(e=io(l))?e:null==l?null:"custom",isDark:s.isDark})}j(()=>{var e;return null==(e=s.codeBlockOptions)?void 0:e.fontSize},e=>{const l="number"==typeof e&&Number.isFinite(e)&&e>0?e:12;st.value=l,ct.value=l,vt.value=null,ft.value=null,pt.value=null}),j(()=>[s.codeBlockOptions,s.showLineNumbers],()=>{vo.value+=1,!1===s.stream&&!1!==s.loading&&(po=!0)},{deep:!0}),j(()=>[rt.value,s.node.originalCode,s.node.updatedCode],()=>{Vl.value+=1,Dn()||(ql.value+=1)});const ho=v(()=>mo());function go(){Al.value&&Il.value!==ho.value&&(Al.value=!1,Il.value=null,Ul=null,Yl=null,Se.value=!1,Me.value=!1,Be.value=!1,_l.value=!1,Rl.value=!1)}function yo(){return go(),Al.value&&Il.value===ho.value}function wo(e=ho.value){Il.value=e,Al.value=!0,Rl.value=!1}return j(ho,()=>d(null,null,function*(){if(Gl)return;if(!Al.value)return;if(Il.value===ho.value)return;if(!ll||!me.value||jl.value||Pe||!Ke.value)return;if(!1===s.stream&&!1!==s.loading)return;if(Ln())return;const e=ho.value;Gl=!0;try{if(go(),Al.value)return;yield lo(me.value)}catch(l){Me.value=!1,_l.value=!1,wo()}finally{Yl=e,yield R(),Gl=!1}})),j(()=>[s.codeBlockOptions,Ke.value],()=>{var e,l;if(co(),!ll||!Ke.value)return;const t=Bl.value?dl():ul(),n="number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.fontSize)?s.codeBlockOptions.fontSize:Number.isFinite(ct.value)?ct.value:void 0;"number"==typeof n&&Number.isFinite(n)&&n>0&&(null==(l=null==t?void 0:t.updateOptions)||l.call(t,{fontSize:n})),mn(!1)},{deep:!0}),j(()=>[ro(),Dl.value,Fe.value,Se.value,Ke.value],([e],l)=>{Fe.value&&Me.value&&Ke.value&&uo({appearanceOnly:null!=l&&ao(e,l[0])})},{flush:"post"}),j(()=>[fo.value,Fe.value,Ke.value],(e,l)=>d(null,[e,l],function*([e,l,t],[n]){if(co(),!l||!t)return;if(!ll||!me.value)return;if(!Se.value)return;if(e===n)return;if(!1===s.stream&&!1!==s.loading)return void(po=!0);po=!1;const o=pl;if(o){try{yield o}catch(i){}if(Pe||!me.value)return}try{Me.value=!1,_l.value=!1,Se.value=!1,Be.value=!1,fn(),pn(),cl(),Sl&&dt(Sl),yield R(),yield lo(me.value,{allowStaleContentRetry:!1})}catch(a){Me.value=!1,_l.value=!1,wo()}}),{flush:"post"}),j(()=>[s.loading,Ke.value],([e,l])=>{!1===e&&l&&po&&(po=!1,vo.value+=1)},{flush:"post"}),j(()=>[s.loading,Ke.value],(e,l)=>d(null,[e,l],function*([e,l],t){if(!l)return;const n=null==t?void 0:t[0];if(!1===n&&!1!==e&&Bl.value&&Se.value&&(yield R(),ue(()=>{d(null,null,function*(){const e=pl;if(e)try{yield e}catch(l){}!Pe&&Bl.value&&!1!==s.loading&&(co(),Hl(),wn())})})),e)return;const o=void 0!==n&&!1!==n;yield R(),ue(()=>{d(null,null,function*(){var e,l;try{if(o&&(yield function(){return d(this,null,function*(){if(!Al.value)return!1;if(!ll||!me.value||jl.value||Pe||!Ke.value)return!1;if(Yl===ho.value)return!0;Gl=!0;try{Al.value=!1,Il.value=null,Ul=null,Se.value=!1,Me.value=!1,Be.value=!1,_l.value=!1,fn(),pn(),cl(),Sl&&dt(Sl),yield R();try{yield lo(me.value)}catch(e){Me.value=!1,_l.value=!1,wo()}}finally{yield R(),Gl=!1}return!0})}()))return void mn(!1);if(o&&Bl.value&&Se.value&&Jl&&me.value)return Jl=!1,Me.value=!1,_l.value=!1,Se.value=!1,Be.value=!1,fn(),pn(),cl(),yield R(),yield lo(me.value,{allowStaleContentRetry:!1}),void bn(!0);if(o&&Se.value)if(Bl.value&&me.value){const n=pl;if(n)try{yield n}catch(t){}co();const o=Pl(String(null!=(e=s.node.originalCode)?e:""),String(null!=(l=s.node.updatedCode)?l:""));if(yield Hn(o.original,o.updated,be.value),Pe||!Bl.value)return;yield Promise.resolve(al()),Hl(),gn(!0),Tt(),yn(),Yt();const i=yield En();Pe||!i||_l.value||(yield Lt()),wn(),bn(!0)}else Rn(),In(rt.value,be.value),yield new Promise(e=>{const l=()=>{Pe?e():jn||$n?setTimeout(l,16):e()};l()}),Pe||Bl.value||(yield Promise.resolve(il()));o&&Bl.value?(mn({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),bn(!0)):mn(!1)}catch(n){}})})}),{immediate:!0,flush:"post"}),H(()=>{fn(),pn(),sl(),null==bl||bl()}),(l,t)=>jl.value?(f(),N(b(Z),{key:0,class:P(["code-pre-fallback",{"is-wrap":Xl.value}]),style:k(Ht.value),node:ut.value,loading:s.loading,"show-line-numbers":x.value,"diff-inline":Kl.value,"diff-hide-unchanged-regions":Ql.value},null,8,["class","style","node","loading","show-line-numbers","diff-inline","diff-hide-unchanged-regions"])):(f(),p("div",{key:1,ref_key:"container",ref:he,style:k(Jn.value),class:P(["code-block-container rounded-lg border",[{dark:s.isDark,"is-rendering":s.loading,"is-dark":Tl.value,"is-diff":Bl.value,"is-plain-text":ke.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":_l.value&&!jl.value?"true":"false","data-markstream-enhancement-state":it.value,"data-markstream-code-block-state":Dn()?"streaming":"settled","data-markstream-pending":ot.value?"true":void 0,"data-markstream-viewport-pending":el.value&&b(Je)&&!Ke.value?"true":void 0},[S(Oe,{"show-header":s.showHeader,"show-collapse-button":s.showCollapseButton,"show-font-size-buttons":s.showFontSizeButtons,"enable-font-size-control":s.enableFontSizeControl,"show-copy-button":s.showCopyButton,"show-expand-button":s.showExpandButton,"show-preview-button":s.showPreviewButton,"show-tooltips":s.showTooltips,"is-dark":s.isDark,loading:s.loading,stream:e.stream,"is-collapsed":Ce.value,"is-expanded":xe.value,"copy-text":ge.value,"is-previewable":zn.value,"code-font-size":ct.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":st.value,"font-baseline-ready":mt.value,"diff-stats":Bl.value?Ml.value:null,"diff-stats-aria-label":Fl.value,onToggleCollapse:Zn,onDecreaseFont:Kt,onResetFont:Qt,onIncreaseFont:Xt,onCopy:Kn,onToggleExpand:Qn,onPreview:eo},A({"header-left":M(()=>[h(l.$slots,"header-left",{},()=>[g("div",Le,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:Yn.value},null,8,$e),g("div",je,[g("div",_e,y(Un.value),1),Gn.value?(f(),p("div",Re,y(Gn.value),1)):w("",!0)])])],!0)]),loading:M(()=>[h(l.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[0]||(t[0]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))],!0)]),default:M(()=>[F(g("div",{class:P(["code-editor-layer",{"code-editor-layer--collapsed":Ce.value}])},[g("div",{ref_key:"codeEditor",ref:me,class:P(["code-editor-container",e.stream?"":"code-height-placeholder"]),"data-markstream-host-hidden":nt.value?"true":void 0,style:k(Dt.value)},null,14,Ae),tt.value?(f(),N(b(Z),{key:0,class:P(["code-pre-fallback",{"is-wrap":Xl.value}]),style:k(Ht.value),node:ut.value,"show-line-numbers":x.value,"diff-inline":Kl.value,"diff-hide-unchanged-regions":Ql.value},null,8,["class","style","node","show-line-numbers","diff-inline","diff-hide-unchanged-regions"])):w("",!0)],2),[[O,!!e.stream||!e.loading]]),at.value&&!fe.value&&zn.value&&"html"===ye.value?(f(),N(De,{key:0,code:s.node.code,"html-preview-allow-scripts":s.htmlPreviewAllowScripts,"html-preview-sandbox":s.htmlPreviewSandbox,"is-dark":s.isDark,"on-close":()=>at.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):w("",!0)]),_:2},[l.$slots["header-right"]?{name:"header-right",fn:M(()=>[h(l.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready","diff-stats","diff-stats-aria-label"])],14,Te))}}),[["__scopeId","data-v-044e277d"]]);export{Ie as default};
|
|
1
|
+
var e=Object.defineProperty,l=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,r=(l,t,n)=>t in l?e(l,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[t]=n,i=(e,l)=>{for(var t in l||(l={}))o.call(l,t)&&r(e,t,l[t]);if(n)for(var t of n(l))a.call(l,t)&&r(e,t,l[t]);return e},u=(e,n)=>l(e,t(n)),d=(e,l,t)=>new Promise((n,o)=>{var a=e=>{try{i(t.next(e))}catch(l){o(l)}},r=e=>{try{i(t.throw(e))}catch(l){o(l)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(a,r);i((t=t.apply(e,l)).next())});import{defineComponent as s,computed as v,onMounted as c,onUnmounted as f,openBlock as m,createBlock as h,Teleport as p,createElementVNode as g,normalizeClass as y,withModifiers as b,toDisplayString as w,unref as k,useAttrs as x,inject as S,getCurrentInstance as C,ref as M,shallowRef as B,watch as P,onBeforeUnmount as H,nextTick as O,normalizeStyle as F,createSlots as N,withCtx as E,renderSlot as D,createElementBlock as $,createVNode as T,withDirectives as z,createCommentVNode as L,vShow as _}from"vue";import{as as R,G as j,M as q,ah as I,au as A,av as V,ar as W,a8 as U,af as G,b as Y,c as J,aj as X,ae as K,a6 as Q,ab as Z,ai as ee}from"./exports.js";import{M as le,f as te,n as ne,c as oe,l as ae}from"./index2.js";import{r as re,_ as ie,a as ue}from"./PreCodeBlock.vue_vue_type_style_index_0_lang.js";import{safeRaf as de,safeCancelRaf as se}from"./utils/safeRaf.js";import{r as ve}from"./preCodeTheme.js";import{getStreamDiffsRuntime as ce}from"./streamDiffs.js";const fe={class:"html-preview-frame__header"},me={class:"html-preview-frame__title"},he={class:"html-preview-frame__label"},pe=["sandbox","srcdoc"],ge=/* @__PURE__ */j(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const l=e,t=void 0!==import.meta&&Boolean(!1);let n=null;const{t:o}=R(),a=v(()=>{const e=l.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: ${l.isDark?"#020617":"#ffffff"};\n color: ${l.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>`}),r=v(()=>{return e=l.htmlPreviewSandbox,o=l.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!t||"undefined"==typeof console||n===e)return;const l=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);l.has("allow-scripts")&&l.has("allow-same-origin")&&(n=e,console.warn("[markstream-vue] htmlPreviewSandbox contains both allow-scripts and allow-same-origin. Use this only for fully trusted content served from an isolated origin."))}(e),e):void 0!==e?"":!0===o?"allow-scripts":"";var e,o});function i(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=l.onClose)||t.call(l)}return c(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",i)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",i)}),(e,t)=>(m(),h(p,{to:"body"},[g("div",{class:y(["markstream-vue",{dark:l.isDark}])},[g("div",{class:"html-preview-frame__backdrop",onClick:t[2]||(t[2]=e=>{var t;return null==(t=l.onClose)?void 0:t.call(l)})},[g("div",{class:"html-preview-frame",onClick:t[1]||(t[1]=b(()=>{},["stop"]))},[g("div",fe,[g("div",me,[t[3]||(t[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",he,w(l.title||k(o)("common.preview")||"Preview"),1)]),g("button",{type:"button",class:"html-preview-frame__close",onClick:t[0]||(t[0]=e=>{var t;return null==(t=l.onClose)?void 0:t.call(l)})}," × ")]),g("iframe",{class:"html-preview-frame__iframe",sandbox:r.value,referrerpolicy:"no-referrer",srcdoc:a.value},null,8,pe)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]),ye=["data-markstream-enhanced","data-markstream-enhancement-state","data-markstream-code-block-state","data-markstream-pending","data-markstream-viewport-pending"],be={class:"code-header-main"},we=["innerHTML"],ke={class:"code-header-copy"},xe={class:"code-header-title"},Se={key:0,class:"code-header-caption"},Ce=["data-markstream-host-hidden"],Me=/* @__PURE__ */j(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},codeBlockOptions:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:["previewCode","copy"],setup(e,{emit:l}){var t,n,o,a,r;const s=e,p=l,b=v(()=>{var e,l;return null!=(l=s.showLineNumbers)?l:!0!==(null==(e=s.codeBlockOptions)?void 0:e.disableLineNumbers)}),j=x(),fe=S(le,null),me=S("markstreamHostScrollManaged",null),he=S(q,void 0),pe=v(()=>I(s,j));function Me(e,l){}const Be=C(),Pe=v(()=>{const e=null==Be?void 0:Be.vnode.props;return!(!e||!e.onPreviewCode&&!e["onPreview-code"])}),{t:He}=R(),Oe=M(null),Fe=M(null),Ne=M(!1),Ee=M(Yn(s.node.language,s.node.code,Gn())),De=v(()=>te(Ee.value)),$e=v(()=>"plaintext"===De.value?"text":De.value),Te=v(()=>"plaintext"===De.value),ze=M(!1),Le=M(!1),_e=M(!1),Re=M(!1),je=M(!1),qe=M(!1);let Ie=!1,Ae=null,Ve=null,We=null,Ue=0,Ge=!1,Ye="";const Je=M(null);let Xe=0,Ke=!1;const Qe=A(),Ze=V(),el=W(),ll=B(null),tl=M("undefined"==typeof window||!el.value),nl=null!=(o=null==(n=null==(t=C())?void 0:t.vnode.el)?void 0:n.textContent)?o:"",ol="undefined"!=typeof window&&String(null!=(a=s.node.code)?a:"").length>0&&nl.includes(String(s.node.code)),al=M(!ol);c(()=>{al.value=!0}),"undefined"!=typeof window&&P([()=>Fe.value,el],([e,l],t,n)=>{var o,a,r;if(null==(o=ll.value)||o.destroy(),ll.value=null,!l||tl.value)return void(tl.value=!0);if(!e)return void(tl.value=!1);let i=!0;const u=null!=(r=null!=(a=null==Ze?void 0:Ze.value.heavyBlockMargin)?a:null==Ze?void 0:Ze.value.rootMargin)?r:"0px",d=Qe(e,{rootMargin:u,allowIdle:!1});ll.value=d,tl.value=tl.value||d.isVisible.value,d.whenVisible.then(()=>{i&&ll.value===d&&(tl.value=!0)}).catch(()=>{}),n(()=>{i=!1,d.destroy(),ll.value===d&&(ll.value=null)})},{immediate:!0}),H(()=>{var e;Ie=!0,function(){const e=Ye;fe&&e&&(Ye="",fe.markSettled(e))}(),null==(e=ll.value)||e.destroy(),ll.value=null});let rl=null,il=null,ul=()=>{},dl=()=>{},sl=()=>{},vl=()=>{},cl=()=>null,fl=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),ml=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),hl=()=>{},pl=()=>{},gl=()=>{},yl=null,bl=null,wl=null,kl=null,xl=()=>{var e;return String(null!=(e=s.node.language)?e:"plaintext")},Sl=()=>d(null,null,function*(){}),Cl=!1,Ml=null;const Bl=[],Pl=[];let Hl=null,Ol=null;const Fl=v(()=>U(s.node)),Nl=M({removed:0,added:0}),El=v(()=>`-${Nl.value.removed} +${Nl.value.added}`);function Dl(e,l){return{original:e,updated:l}}function $l(e){return String(null!=e?e:"").replace(/\r\n$|\n$|\r$/,"")}function Tl(e){var l;return String(null!=(l=null==e?void 0:e.message)?l:e).includes("no diff result available")}function zl(){if(!jn())try{const e=gl();e&&"function"==typeof e.catch&&e.catch(e=>{Tl(e)})}catch(e){Tl(e)}}const Ll=v(()=>{const e=i({},s.codeBlockOptions||{});for(const n of["theme","themes","themeType","language","languages","stream","disableFileHeader","onThemeChange","renderCustomHeader","renderHeaderMetadata","renderHeaderPrefix","maxHeight","padding","tabSize"])delete e[n];if(!Fl.value)return e;const l=e.parseDiffOptions&&"object"==typeof e.parseDiffOptions?e.parseDiffOptions:{},t={diffStyle:"split",expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:"line-info",parseDiffOptions:{context:2}};return u(i(i({},t),e),{parseDiffOptions:i(i({},t.parseDiffOptions),l)})}),_l=v(()=>{return(void 0!==s.theme?(e=s.theme)&&"object"==typeof e&&"light"in e&&"dark"in e:!bo(s.darkTheme,s.lightTheme))?!!s.isDark:function(e){var l;const t=null!=(l=yo(e))?l:"";return Z(t,!0===s.isDark)}(wo());var e}),Rl=v(()=>(Fl.value,_l.value?"dark":"light")),jl=v(()=>Fl.value?"dark"===Rl.value:_l.value),ql=v(()=>ve({darkTheme:s.darkTheme,isDark:s.isDark,lightTheme:s.lightTheme,theme:s.theme,themes:s.themes})),Il=v(()=>Fl.value?"diff":"single"),Al=M(Il.value),Vl=M(!1),Wl=M(!1),Ul=M(!1),Gl=M(!1),Yl=M(null),Jl=M(0),Xl=M(0),Kl=M(!1);let Ql=null,Zl=!1,et=null,lt=!1;const tt=v(()=>{var e;return!!Fl.value&&"unified"===(null==(e=Ll.value)?void 0:e.diffStyle)}),nt=v(()=>G(Ll.value));function ot(e){return!0===(null==me?void 0:me.value)||!!e&&(!!e.closest('[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline')||Boolean(e.closest(".vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]")))}const at=v(()=>ot(Fe.value)),rt=v(()=>!(Vl.value||!Gl.value&&Wl.value)),it=v(()=>rt.value),ut=v(()=>rt.value&&!Ul.value),dt=v(()=>!Vl.value&&!Gl.value&&rt.value),st=v(()=>Wl.value&&!Vl.value?"ready":Gl.value?"fallback":"pending"),vt=M(!1),ct=v(()=>$l(s.node.code)),ft=v(()=>Fl.value?!0===s.node.diff?s.node:u(i({},s.node),{diff:!0}):ct.value===s.node.code?s.node:u(i({},s.node),{code:ct.value}));function mt(e){const l=e.detectLanguage;"function"==typeof l&&(xl=l),Ol=e,Hl=xo();const t=e.createCodeBlockRuntime(Hl);return!!t&&(rl=t.createEditor||rl,il=t.createDiffEditor||il,ul=t.updateCode||ul,dl=t.updateDiff||dl,sl=t.finalizeCode||sl,vl=t.finalizeDiff||vl,cl=t.getEditor||cl,fl=t.getEditorView||fl,ml=t.getDiffEditorView||ml,hl=t.cleanupEditor||hl,pl=t.safeClean||t.cleanupEditor||pl,gl=t.refreshDiffPresentation||gl,Sl=t.setTheme||Sl,yl=t.whenVisualReady||null,qe.value=!0,!0)}const ht=Y,pt=J,gt=M("number"==typeof(null==(r=s.codeBlockOptions)?void 0:r.fontSize)?s.codeBlockOptions.fontSize:Number.NaN),yt=M(gt.value),bt=M(null),wt=M(null),kt=M(null),xt=M(null),St=v(()=>{const e=gt.value,l=yt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof l&&Number.isFinite(l)&&l>0}),Ct=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.fontSize;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l;const t=yt.value;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:ht}),Mt=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.lineHeight;return"number"==typeof l&&Number.isFinite(l)&&l>0?l:Ct.value===ht?pt:Math.max(12,Math.round(1.5*Ct.value))}),Bt=v(()=>Mt.value),Pt=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.tabSize;return"number"==typeof l&&Number.isFinite(l)&&l>0?l:4}),Ht=v(()=>{var e;const l=null==(e=s.codeBlockOptions)?void 0:e.padding,t="number"==typeof l&&Number.isFinite(l)&&l>=0?l:8;return{top:t,bottom:t}}),Ot=v(()=>{const e=X(s.codeBlockOptions);return u(i({},e),{fontSize:Ct.value,lineHeight:Bt.value,maxHeight:Wn(),padding:Ht.value.top,paddingBottom:Ht.value.bottom,tabSize:Pt.value})}),Ft=v(()=>{const e=s.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function Nt(e){if(null==e)return null;const l=Math.ceil(e);return!Number.isFinite(l)||l<=0?null:Math.min(l,Math.ceil(Wn()))}function Et(){return!Fl.value&&!1!==s.stream&&!1!==s.loading}const Dt=M(Et());function $t(){return Et()||Dt.value}const Tt=v(()=>Fl.value?null:null==Ft.value||$t()?Math.ceil((e=>{const l=String(null!=e?e:"");if(!l)return 1;let t=1;for(let n=0;n<l.length;n++)"\n"===l[n]?t++:"\r"===l[n]&&(t++,"\n"===l[n+1]&&n++);return t})(ct.value)*Bt.value+1):null),zt=v(()=>{if(Fl.value)return null;const e=Ft.value;return null==e||$t()?Nt(Tt.value):Nt(e)}),Lt=v(()=>{const e=s.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),_t=M(null);function Rt(){const e=_t.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}const jt=v(()=>{const e=Rt();return null!=e?e:!Fl.value&&Kl.value?null:rt.value||!Wl.value?zt.value:null});function qt(e){const l=e?"hsl(152 42% 60%)":"var(--diff-added-fg)",t=e?"hsl(0 58% 58%)":"var(--diff-removed-fg)",n=e?"color-mix(in lab, #121212 80%, #4d9375)":"color-mix(in lab, #ffffff 88%, #1e754f)",o=e?"color-mix(in lab, #121212 80%, #cb7676)":"color-mix(in lab, #ffffff 88%, #ab5959)";return{"--markstream-diff-line-number-bg":e?"hsl(0 0% 7% / 0.98)":"hsl(var(--ms-muted) / 0.45)","--markstream-diff-added-fg":l,"--markstream-diff-removed-fg":t,"--markstream-diff-added-line":n,"--markstream-diff-removed-line":o,"--markstream-diff-added-line-fill":n,"--markstream-diff-added-number-fill":e?"color-mix(in lab, #121212 85%, #4d9375)":"color-mix(in lab, #ffffff 91%, #1e754f)","--markstream-diff-removed-line-fill":o,"--markstream-diff-removed-number-fill":e?"color-mix(in lab, #121212 85%, #cb7676)":"color-mix(in lab, #ffffff 91%, #ab5959)","--markstream-diff-added-gutter":`linear-gradient(90deg, ${l} 0 4px, transparent 4px 100%)`,"--markstream-diff-removed-gutter":`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,"--markstream-diff-added-inline":e?"hsl(152 42% 60% / 0.28)":"var(--diff-added-inline-bg)","--markstream-diff-removed-inline":e?"hsl(0 58% 58% / 0.28)":"var(--diff-removed-inline-bg)"}}const It=v(()=>{const e=Nt(Ft.value),l=Nt(Tt.value),t=$t(),n=i({},Fl.value||null==e||t?Fl.value||null==l?{}:{minHeight:`${l}px`}:{height:`${e}px`,minHeight:`${e}px`});if(n["--markstream-code-fallback-bg"]=ql.value.background,n["--markstream-code-fallback-fg"]=ql.value.foreground,ql.value.builtin&&(n["--markstream-code-theme-bg"]=ql.value.background,n["--markstream-code-theme-fg"]=ql.value.foreground,n["--markstream-code-theme-line-number"]=ql.value.lineNumber),n["--markstream-pre-line-number-top"]=`${Ht.value.top}px`,n["--markstream-pre-line-number-left"]="0px",n["--markstream-pre-line-number-padding-left"]="2ch",n["--markstream-pre-line-number-padding-right"]="1ch",n["--markstream-pre-line-number-separator-width"]="2px",Fl.value){n["--markstream-pre-diff-line-height"]=`${Bt.value}px`,n["--markstream-pre-diff-pane-bottom-padding"]=(tt.value,"0px");const e=xt.value;null!=e&&e>0&&(n.height=`${e}px`,n.minHeight=`${e}px`,n.maxHeight=`${e}px`),Object.assign(n,qt(jl.value))}return n}),At=v(()=>null!=jt.value&&(!Wl.value||null!=Rt())),Vt=v(()=>{const e=jt.value;if(null==e)return null;if(Fl.value)return Math.ceil(e);const l=Lt.value,t=Ft.value;if(null==l||null==t)return Math.ceil(e);const n=Math.max(0,Math.ceil(l)-Math.ceil(t));return Math.ceil(e+n)}),Wt=v(()=>{if(Fl.value&&rt.value)return{};const e=jt.value;return At.value&&null!=e?{minHeight:`${e}px`}:{}});function Ut(){_t.value=null}function Gt(){var e,l,t,n,o,a,r,i;const u=null==(e=Fe.value)?void 0:e.querySelector("pre.code-pre-fallback"),d=ml(),s=null!=(l=null==u?void 0:u.scrollTop)?l:0;null==(o=null==(n=null==(t=null==d?void 0:d.getOriginalEditor)?void 0:t.call(d))?void 0:n.setScrollTop)||o.call(n,s),null==(i=null==(r=null==(a=null==d?void 0:d.getModifiedEditor)?void 0:a.call(d))?void 0:r.setScrollTop)||i.call(r,s)}function Yt(){return d(this,null,function*(){return Fl.value?(bn(),Kt(),Fn(!0),Gt(),Nn(),Ul.value=!0,yield O(),Fn(!0),yield Zt(),Fn(!0),gn(),Kt(),!!(yield function(){return d(this,null,function*(){var e;if(!Fl.value)return!0;for(let l=0;l<4;l++){const l=Kt();Fn(!0),Jt(l),Xt(l),yield O(),yield Zt();const t=null==(e=Fe.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!t)return!1;if(null==l)return Ln();const n=t.getBoundingClientRect().height;if(n>0&&Math.abs(n-l)<=2)return!0}return!1})}())&&(Wl.value=!0,yield O(),Kt(),Fn(!0),gn(),Nn(),de(()=>{Ie||de(()=>{Ie||(function(){var e,l;const t=null==(e=Fe.value)?void 0:e.querySelector(".code-block-shell-content"),n=null==(l=Fe.value)?void 0:l.querySelector(".code-editor-layer");t&&n&&(n.style.removeProperty("height"),n.style.removeProperty("min-height"),t.style.removeProperty("height"),t.style.removeProperty("min-height"))}(),En(!0))})}),En(),!0)):!(yl&&!(yield yl())||(bn(),Fn(!0),Ul.value=!0,yield O(),bn(),Fn(!0),yield Zt(),bn(),Fn(!0),Wl.value=!0,yield O(),En(),0))})}function Jt(e){var l;if(!Fl.value)return;const t=Oe.value,n=null==(l=Fe.value)?void 0:l.querySelector("pre.code-pre-fallback");if(!t||!n)return;const o=null!=e?e:Number.parseFloat(t.style.height||"");if(!Number.isFinite(o)||o<=0)return;const a=Math.ceil(o),r=`${a}px`;xt.value=a;const i=Fe.value;i&&(i.dataset.markstreamDiffHandoffHeight=r),n.dataset.markstreamDiffHandoffHeight=r,n.style.setProperty("height",r),n.style.setProperty("min-height",r)}function Xt(e){var l,t,n;if(!Fl.value)return;const o=null==(l=Fe.value)?void 0:l.querySelector(".code-block-shell-content"),a=null==(t=Fe.value)?void 0:t.querySelector(".code-editor-layer");if(!o||!a)return;const r="number"==typeof e&&Number.isFinite(e)&&e>0?Math.ceil(e):Number.parseFloat((null==(n=Oe.value)?void 0:n.style.height)||"");if(!Number.isFinite(r)||r<=0)return;const i=`${r}px`;a.style.height=i,a.style.minHeight=i,o.style.height=i,o.style.minHeight=i}function Kt(){const e=Oe.value;if(e&&Ln(e)){Nn();const l=hn(e);if(null!=l&&l>0){const t=Math.ceil(l),n=Math.ceil(Wn()),o=Math.min(t,n),a=`${o}px`;return e.style.height=a,e.style.minHeight="0px",e.style.maxHeight=`${n}px`,e.style.overflow=t>n+1?"auto":"hidden",rt.value&&(xt.value=o,Jt(o)),Dn(),o}return Hn({preferModelDiffHeight:!0}),Jt(),Dn(),Number.parseFloat(e.style.height||"")||null}return bn()}function Qt(e,l=!1,t={}){const n=Math.ceil(e),o=Rt();if(null==o)return n;const a=!0===t.allowBelowEstimatedFloor;return n>=o||a?((l||a)&&je.value&&Ut(),n):o}function Zt(){return new Promise(e=>{let l=!1,t=null,n=null;const o=()=>{l||(l=!0,null!=n&&globalThis.clearTimeout(n),null!=t&&se(t),e())};n=globalThis.setTimeout(o,50),t=de(o)})}function en(){var e;try{const l=Oe.value;if(!l)return null;const t=null!=(e=l.querySelector(".stream-diffs-shell .stream-diffs-surface"))?e:l.querySelector(".stream-diffs-shell");if(t){const e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch(l){}return null}function ln(){var e,l,t,n,o,a;try{const a=Fl.value?null!=(t=null==(l=null==(e=ml())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:ml():fl(),r=cl(),i=null==(n=null==r?void 0:r.EditorOption)?void 0:n.fontInfo;if(a&&null!=i){const e=null==(o=a.getOption)?void 0:o.call(a,i),l=null==e?void 0:e.fontSize;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l}}catch(r){}try{const e=Oe.value;if(e){const l=null!=(a=e.querySelector(".stream-diffs-shell .stream-diffs-surface"))?a:e.querySelector(".stream-diffs-shell");if(l)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(l).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(r){}}}catch(r){}return null}function tn(e){var l,t;try{const n=cl(),o=null==(l=null==n?void 0:n.EditorOption)?void 0:l.lineHeight;if(null!=o){const l=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o);if("number"==typeof l&&l>0)return l}}catch(a){}const n=en();if(n&&n>0)return n;const o=Number.isFinite(yt.value)&&yt.value>0?yt.value:14;return Math.max(12,Math.round(1.35*o))}function nn(){var e;const l=null==(e=s.codeBlockOptions)?void 0:e.padding;return"number"==typeof l&&Number.isFinite(l)?2*Math.max(0,l):Fl.value?24:0}function on(e){const l=$l(e);return l?l.split(/\r\n|\n|\r/):[]}function an(e){return!!Te.value||!!e&&(jn(e)||null!=yl)}function rn(){var e,l;Fl.value?Nl.value=function(e,l){const t=on(e),n=on(l);let o=0,a=t.length-1,r=n.length-1;for(;o<=a&&o<=r&&t[o]===n[o];)o++;for(;a>=o&&r>=o&&t[a]===n[r];)a--,r--;const i=Math.max(0,a-o+1),u=Math.max(0,r-o+1);if(0===i||0===u)return{removed:i,added:u};if((i+1)*(u+1)<=15e5){const e=u+1;let l=new Uint32Array(e),a=new Uint32Array(e);for(let d=i-1;d>=0;d--){a[u]=0;for(let r=u-1;r>=0;r--)a[r]=t[o+d]===n[o+r]?l[r+1]+1:Math.max(l[r],a[r+1]);const e=l;l=a,a=e}const r=l[0];return{removed:i-r,added:u-r}}return{removed:i,added:u}}(String(null!=(e=s.node.originalCode)?e:""),String(null!=(l=s.node.updatedCode)?l:"")):Nl.value={removed:0,added:0}}function un(){rn()}function dn(){var e;if(Number.isFinite(yt.value)&&yt.value>0&&Number.isFinite(gt.value))return yt.value;if("number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.fontSize))return gt.value=s.codeBlockOptions.fontSize,yt.value=s.codeBlockOptions.fontSize,s.codeBlockOptions.fontSize;const l=ln();return l&&l>0?(gt.value=l,yt.value=l,l):(gt.value=12,yt.value=12,12)}function sn(){const e=dn(),l=Math.min(36,e+1);yt.value=l}function vn(){const e=dn(),l=Math.max(10,e-1);yt.value=l}function cn(){dn(),Number.isFinite(gt.value)&&(yt.value=gt.value)}function fn(){var e,l,t,n,o,a,r,i,u,d,s,v,c,f;try{const m=Fl.value?ml():null,h=Fl.value?m:fl();if(!h)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const c=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(l=m.getModifiedEditor)?void 0:l.call(m);null==(t=null==c?void 0:c.layout)||t.call(c),null==(n=null==f?void 0:f.layout)||n.call(f);const h=(null==(o=null==c?void 0:c.getContentHeight)?void 0:o.call(c))||0,p=(null==(a=null==f?void 0:f.getContentHeight)?void 0:a.call(f))||0,g=Math.max(h,p);if(g>0)return Math.ceil(g);const y=(null==(u=null==(i=null==(r=null==c?void 0:c.getModel)?void 0:r.call(c))?void 0:i.getLineCount)?void 0:u.call(i))||1,b=(null==(v=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:v.call(s))||1,w=Math.max(y,b),k=Math.max(tn(c),tn(f)),x=nn();return Math.ceil(w*k+x+0)}if(null==h?void 0:h.getContentHeight){null==(c=null==h?void 0:h.layout)||c.call(h);const e=h.getContentHeight();if(e>0)return Fl.value||(Kl.value=!0),Math.ceil(e)}const p=null==(f=null==h?void 0:h.getModel)?void 0:f.call(h);let g=1;p&&"function"==typeof p.getLineCount&&(g=p.getLineCount());const y=tn(h);return Math.ceil(g*(y+1.5)+0)}catch(m){return null}}function mn(){var e,l;if(Fl.value)return!1;try{const t=null==(l=null==(e=fl())?void 0:e.getContentHeight)?void 0:l.call(e),n="number"==typeof t&&Number.isFinite(t)&&t>0;return n&&(Kl.value=!0),n}catch(t){return!1}}function hn(e){if("undefined"==typeof window)return null;try{if("none"===window.getComputedStyle(e).display)return null;const l=e.querySelector("diffs-container");if(l instanceof HTMLElement){const e=l.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}const t=e.querySelector(".stream-diffs-shell");if(t){const e=t.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}return null}catch(l){return null}}function pn(e){var l;const t=String(null!=e?e:"").trim(),n=null==(l=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:l[1];if(n){const e=3===n.length?n.split("").map(e=>`${e}${e}`).join(""):n;return.2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}const o=t.match(/\d+(?:\.\d+)?/g);if(!o||o.length<3)return null;const[a,r,i]=o.slice(0,3).map(Number);return.2126*a+.7152*r+.0722*i}function gn(){var e,l,t;if(yn())return;const n=ln();n&&n>0&&(bt.value=n,yt.value=n,gt.value=n);try{const n=tn(Fl.value?null!=(t=null==(l=null==(e=ml())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:ml():fl());n&&n>0&&(wt.value=n)}catch(o){}try{const e=en();e&&e>0&&(wt.value=e)}catch(o){}}function yn(){return Fl.value&&it.value}function bn(){var e;if(!rt.value)return null;const l=Oe.value,t=null==(e=Fe.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!l||!t)return null;const n=Math.ceil(t.getBoundingClientRect().height),o=Fl.value?hn(l):null,a=Math.max(n,null!=o&&o>0?Math.ceil(o):0),r=Math.ceil(Wn()),i=Math.min(a,r);return!Number.isFinite(i)||i<=0?null:(Fl.value&&i>n&&(xt.value=i),l.style.height=`${i}px`,l.style.minHeight=`${i}px`,l.style.maxHeight=`${r}px`,l.style.overflow=a>r+1?"auto":"hidden",i)}function wn(){var e,l,t,n,o,a,r,i,u;const d=Oe.value,v=Fe.value;if(!d||!v)return;const c=d;c.style.setProperty("--markstream-diff-metadata-bg",ql.value.background),c.style.setProperty("--markstream-diff-metadata-fg",ql.value.lineNumber),c.style.setProperty("--diffs-tab-size",String(Pt.value)),c.style.setProperty("--diffs-scrollbar-gutter-override","0px"),"number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.padding)?c.style.setProperty("--diffs-gap-block",`${Ht.value.top}px`):c.style.removeProperty("--diffs-gap-block");const f=d.querySelector(".stream-diffs-shell")||d,m=f,h=f;let p=null,g=null,y=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(p=window.getComputedStyle(f),g=m===f?p:window.getComputedStyle(m),y=h===f?p:window.getComputedStyle(h))}catch(M){p=null,g=null,y=null}const b=String(null!=(l=null==p?void 0:p.getPropertyValue("--vscode-editor-foreground"))?l:"").trim(),w=String(null!=(t=null==p?void 0:p.getPropertyValue("--vscode-editor-background"))?t:"").trim(),k=String(null!=(o=null!=(n=null==p?void 0:p.getPropertyValue("--vscode-editor-selectionBackground"))?n:null==p?void 0:p.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?o:"").trim(),x=b||String(null!=(r=null!=(a=null==y?void 0:y.color)?a:null==p?void 0:p.color)?r:"").trim(),S=w||String(null!=(u=null!=(i=null==g?void 0:g.backgroundColor)?i:null==p?void 0:p.backgroundColor)?u:"").trim(),C=function(){var e,l,t,n,o;try{const a=Fl.value?null!=(t=null==(l=null==(e=ml())?void 0:e.getModifiedEditor)?void 0:l.call(e))?t:ml():fl(),r=cl(),i=null==(n=null==r?void 0:r.EditorOption)?void 0:n.fontInfo;if(a&&null!=i){const e=null==(o=a.getOption)?void 0:o.call(a,i),l=null==e?void 0:e.typicalHalfwidthCharacterWidth;if("number"==typeof l&&Number.isFinite(l)&&l>0)return l}}catch(M){}return null}();if(null!=C&&(kt.value=C),Fl.value){const e=(e,l)=>{l?(v.style.setProperty(e,l),c.style.setProperty(e,l)):(v.style.removeProperty(e),c.style.removeProperty(e))};for(const[l,t]of Object.entries(qt(v.classList.contains("is-dark"))))e(l,t);return x?(v.style.setProperty("--markstream-diff-editor-fg",x),c.style.setProperty("--vscode-editor-foreground",x)):(v.style.removeProperty("--markstream-diff-editor-fg"),c.style.removeProperty("--vscode-editor-foreground")),S?(v.style.setProperty("--markstream-diff-editor-bg",S),v.style.setProperty("--markstream-diff-panel-bg",S),v.style.setProperty("--markstream-diff-panel-bg-soft",S),v.style.setProperty("--markstream-diff-panel-bg-strong",S),c.style.setProperty("--vscode-editor-background",S),c.style.backgroundColor=S):(v.style.removeProperty("--markstream-diff-editor-bg"),v.style.removeProperty("--markstream-diff-panel-bg"),v.style.removeProperty("--markstream-diff-panel-bg-soft"),v.style.removeProperty("--markstream-diff-panel-bg-strong"),c.style.removeProperty("--vscode-editor-background"),c.style.backgroundColor=""),void(k?c.style.setProperty("--vscode-editor-selectionBackground",k):c.style.removeProperty("--vscode-editor-selectionBackground"))}if(function(e,l,t){if(!Te.value)return!1;const n=pn(e),o=pn(l);return t?null!=n&&n>170||null!=o&&o<110:null!=n&&n<85||null!=o&&o>190}(S,x,v.classList.contains("is-dark")))return c.style.removeProperty("--vscode-editor-foreground"),c.style.removeProperty("--vscode-editor-background"),void c.style.removeProperty("--vscode-editor-selectionBackground");x&&c.style.setProperty("--vscode-editor-foreground",x),S&&c.style.setProperty("--vscode-editor-background",S),k&&c.style.setProperty("--vscode-editor-selectionBackground",k)}P(()=>[s.stream,s.loading,s.node.loading,Fl.value],([e,l,t,n])=>{n||!1===e||!1===l||Dt.value?(n||!1===e)&&Dt.value&&(Dt.value=!1):(Dt.value=!0,Ut())},{immediate:!0});let kn=0,xn=0;const Sn=/auto|scroll|overlay/i;function Cn(e,l,t){var n;if("undefined"==typeof window)return;if(Fl.value)return;if(function(e){return at.value||ot(e)}(e))return;const o=Math.ceil(l),a=Math.ceil(t)-o;if(Math.abs(a)<=1)return;const r=function(e){var l,t;if("undefined"==typeof window)return null;const n=null!=(l=null==e?void 0:e.ownerDocument)?l:document,o=n.scrollingElement||n.documentElement||n.body;let a=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;a&&a!==n.body&&a!==o;){const e=window.getComputedStyle(a),l=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(Sn.test(l)||Sn.test(t))return a;a=a.parentElement}return o}(e);if(!r)return;const i=null!=(n=e.ownerDocument)?n:document,u=r===i.body||r===i.documentElement||r===i.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,a):r.scrollTop+=a)}function Mn(){try{const e=Oe.value;if(!e)return;const l=e.getBoundingClientRect().height,t=fn();if(null!=t&&t>0){const n=Qt(t,!0,{allowBelowEstimatedFloor:!Fl.value&&je.value&&mn()}),o=Rt();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${n}px`,e.style.maxHeight="none",e.style.overflow="visible",void Cn(e,l,n)}const n=Rt();null!=n&&(e.style.minHeight=`${n}px`,e.style.height=`${n}px`,e.style.maxHeight="none",e.style.overflow="visible",Cn(e,l,n))}catch(e){}}function Bn(){for(var e,l;Bl.length>0;)try{null==(l=null==(e=Bl.pop())?void 0:e.dispose)||l.call(e)}catch(t){}null!=Ae&&(se(Ae),Ae=null),null!=Ve&&(se(Ve),Ve=null),null!=We&&(se(We),We=null),Ue=0,Ge=!1}function Pn(){for(var e;Pl.length>0;)try{null==(e=Pl.pop())||e()}catch(l){}}function Hn(e=!1){Le.value||(ze.value?Mn():function(e={}){var l;try{const t=Oe.value;if(!t)return;const n=t.getBoundingClientRect().height,o=Wn(),a=Math.ceil((null==(l=t.getBoundingClientRect)?void 0:l.call(t).height)||0),r=Number.parseFloat(t.style.height||""),i=a>0?a:Number.isFinite(r)&&r>0?Math.ceil(r):0,u=Fl.value?function(){var e,l,t,n,o,a,r,i,u,d,s,v;if(jn())return null;try{const c=ml(),f=null==(e=null==c?void 0:c.getOriginalEditor)?void 0:e.call(c),m=null==(l=null==c?void 0:c.getModifiedEditor)?void 0:l.call(c);if(!f||!m)return null;const h=(null==(o=null==(n=null==(t=f.getModel)?void 0:t.call(f))?void 0:n.getLineCount)?void 0:o.call(n))||1,p=(null==(i=null==(r=null==(a=m.getModel)?void 0:a.call(m))?void 0:r.getLineCount)?void 0:i.call(r))||1,g=Math.max(h,p),y=Math.max(tn(f),tn(m)),b=nn(),w=Math.max(null!=(d=null==(u=f.getContentHeight)?void 0:u.call(f))?d:0,null!=(v=null==(s=m.getContentHeight)?void 0:s.call(m))?v:0);return Math.ceil(Math.max(w,g*y+b+0))}catch(c){return null}}():null,d=Fl.value&&Ln(t);if(Xe>0&&(Xe--,null!=Je.value))return void Cn(t,n,$n(t,Je.value,o,{preserveScrollableOverflow:zn(t)}));if(Fl.value&&!d&&rt.value){const e=bn();if(null!=e){const l=$n(t,e,o,{allowBelowEstimatedFloor:!0});return Fn(!0),void Cn(t,n,l)}}const v=Fl.value&&!0===e.preferModelDiffHeight,c=Fl.value?hn(t):null,f=!Fl.value&&je.value&&mn(),m=Fl.value&&!1!==s.loading&&(null!=c||null!=u&&a>0&&u<a-1),h=null!=u;let p;if(Fl.value)if(v){const e=null!=u&&!1===s.loading&&i>0&&u<i-1;p=!1===s.loading&&null!=c?null==u?c:Math.max(c,u):e?u:null!=c&&null!=u?Math.max(c,u,!1!==s.loading?i:0):Math.max(null!=c?c:0,null!=u?u:0,!1!==s.loading?i:0)||null}else p=tt.value&&null!=c||null!=c?h?Math.max(c,u):c:Fl.value&&!1!==s.loading?null!=u&&i>0&&u<i-1?u:i>0?i:null:u;else p=fn();if(Fl.value&&null!=p&&i>0&&(!1!==s.loading||!0===e.holdCurrentDiffHeight)&&(p=Math.max(p,i)),null!=p&&p>0)return void Cn(t,n,$n(t,p,o,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:f||m,preserveScrollableOverflow:zn(t)}));if(null!=Je.value)return void Cn(t,n,$n(t,Je.value,o,{preserveScrollableOverflow:zn(t)}));const g=Fl.value&&!1!==s.loading?a:Math.max(a,null!=u&&u>0?u:0);if(g>0)return void Cn(t,n,$n(t,g,o));const y=Rt();if(!(null==y||Fl.value&&!1!==s.loading&&d))return void Cn(t,n,$n(t,y,o));const b=Number.parseFloat(t.style.height);!Number.isNaN(b)&&b>0?Cn(t,n,$n(t,b,o)):Fl.value||Cn(t,n,$n(t,o,o))}catch(t){}}("object"==typeof e?e:{}))}function On(){kn=0,xn=0}function Fn(e=!1){var l,t,n;if(Le.value)return;const o=Oe.value;if(!o)return;const a=Fl.value?ml():fl();if(a&&"function"==typeof a.layout)try{const r=null==(l=o.getBoundingClientRect)?void 0:l.call(o),i=Math.ceil((null!=(t=null==r?void 0:r.width)?t:0)||o.clientWidth||0),u=Math.ceil((null!=(n=null==r?void 0:r.height)?n:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(i>0&&u>0){if(!e&&i===kn&&u===xn)return;kn=i,xn=u,a.layout({width:i,height:u})}else On(),a.layout()}catch(r){}}function Nn(){Pn()}function En(e=!1){if(Ie||null!=Ae)return;const l=()=>{Ie||(Nn(),Hn(e),Fn())};Ae=de(()=>{Ae=null,l(),Ve=de(()=>{Ve=null,l()})}),Dn()}function Dn(e=!1){if(!Fl.value||Ie||!e&&!1===s.loading)return;if(Ge=Ge||e,Ue=Math.max(Ue,e?18:6),null!=We)return;const l=()=>{if(We=null,!Fl.value||Ie||Ue<=0||!Ge&&!1===s.loading)return Ue=0,void(Ge=!1);Ue--,Nn(),Hn({preferModelDiffHeight:!0,holdCurrentDiffHeight:Ge}),Fn(),Ue>0?We=de(l):Ge=!1};We=de(l)}function $n(e,l,t,n={}){const o=Fl.value&&!1!==s.loading?hn(e):null,a=null!=o&&o>l+1?o:l,r=Math.min(a,t),i=!0===n.allowBelowEstimatedFloor,u=Qt(r,!0===n.clearEstimatedFloor,{allowBelowEstimatedFloor:i}),d=Rt();e.style.minHeight=null==d||i?"0px":`${Math.min(d,Math.ceil(t))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(t)}px`;const v=!0===n.preserveScrollableOverflow||a>t+1||Tn(e,u);return e.style.overflow=v?"auto":"hidden",u}function Tn(e,l=0){var t;const n=Math.ceil((null==(t=e.getBoundingClientRect)?void 0:t.call(e).height)||0),o=Math.max(l,e.clientHeight||0,n);return o>0&&e.scrollHeight>o+1}function zn(e){var l;return Ke||Tn(e,null!=(l=Je.value)?l:0)}function Ln(e=Oe.value){return jn(e)}function _n(e=Oe.value){return jn(e)}function Rn(){var e,l;if(jn())return!0;const t=null==(l=null==(e=fl())?void 0:e.getModel)?void 0:l.call(e);return"function"==typeof(null==t?void 0:t.getValue)&&t.getValue()===ct.value}function jn(e=Oe.value){return Boolean(null==e?void 0:e.querySelector("diffs-container"))}function qn(){return!1!==s.loading||Wl.value}function In(){const e=ml();return Boolean("function"==typeof(null==e?void 0:e.getOriginalEditor)||"function"==typeof(null==e?void 0:e.getModifiedEditor)||"function"==typeof(null==e?void 0:e.getLineChanges))}function An(){return d(this,null,function*(){if(!Fl.value)return!0;for(let e=0;e<30;e++){if(Ie)return!1;if(jn())return yield O(),yield Zt(),!Ie&&jn();yield O(),yield Zt()}return!1})}function Vn(e,l,t){return d(this,null,function*(){try{return void(yield dl(e,l,t))}catch(n){if(!Tl(n))throw n}if(yield O(),yield Zt(),!Ie&&Fl.value)try{yield dl(e,l,t)}catch(n){if(!Tl(n))throw n}})}function Wn(){var e,l;return null!=(l=null==(e=s.codeBlockOptions)?void 0:e.maxHeight)?l:500}const Un=v(()=>s.isShowPreview&&("html"===Ee.value||"svg"===Ee.value));function Gn(){return"boolean"==typeof s.node.loading?s.node.loading:!0===s.loading}function Yn(e,l,t){return!t||function(){var e,l,t;if(!Gn())return!0;const n=String(null!=(e=s.node.raw)?e:""),o=null!=(t=null==(l=n.split(/\r\n|\n|\r/,1)[0])?void 0:l.trimStart())?t:"";return!/^(?:`{3,}|~{3,})/.test(o)||/\r\n|\n|\r/.test(n)}()&&String(null!=l?l:"")?ne(String(null!=e?e:"")):"plain"}function Jn(){return Gn()}let Xn=null,Kn=!1,Qn=0;function Zn(){Xn=null,Qn++}function eo(){return d(this,arguments,function*(e=Qn){if(!Kn){Kn=!0;try{for(;Xn&&!Ie&&!Fl.value&&e===Qn;){const e=Xn;Xn=null;try{yield Promise.resolve(ul(e.code,e.language)),yield O(),Ie||Fl.value||(Hn(!1),Fn())}catch(l){Me()}}}finally{Kn=!1,!Xn||Ie||Fl.value||eo()}}})}function lo(e,l){Xn={code:e,language:l},eo(Qn)}P(()=>[s.node.language,s.node.code,s.node.raw,s.node.loading,s.loading],([e,l,t,n,o])=>{Ee.value=Yn(e,l,"boolean"==typeof n?n:!0===o)}),P(()=>[s.node.originalCode,s.node.updatedCode,Fl.value],()=>{rn(),de(()=>un())},{immediate:!0});let to=0;P(()=>[s.node.originalCode,s.node.updatedCode,$e.value,Fl.value,s.stream],e=>d(null,[e],function*([,,,e,l]){var t,n;const o=++to;if(!e)return;if(Gn())return;if(!1===l&&!_e.value)return;if(!1!==l&&rl&&!_e.value&&Oe.value)try{yield ho(Oe.value)}catch(u){}const a=wl;if(a&&!Re.value){try{yield a}catch(u){}if(Ie||!Fl.value||o!==to)return}if(o!==to)return;const r=Dl(String(null!=(t=s.node.originalCode)?t:""),String(null!=(n=s.node.updatedCode)?n:"")),i=!1===s.loading;i&&So();try{if(yield Vn(r.original,r.updated,$e.value),Ie||!Fl.value||o!==to)return;yield O(),Fn(!0),Nn(),Hn(!1===s.loading||{preferModelDiffHeight:!0}),Fn(!0),En(!0)}catch(d){return}if(i){if(Ie||!Fl.value)return;zl(),Nn(),un(),En(),Dn(!0)}ze.value&&de(()=>Mn())})),P(()=>s.node.code,e=>d(null,null,function*(){if(Gn())return;if(!1===s.stream)return;if(Ee.value||(Ee.value=ne(xl(e))),Fl.value)return;const l=wl;if(l&&!Re.value){try{yield l}catch(t){}if(Ie||Fl.value)return}if(rl&&!_e.value&&Oe.value)try{yield ho(Oe.value)}catch(t){}lo($l(s.node.code),$e.value),ze.value&&de(()=>Mn())}));const no=v(()=>{const e=Ee.value;return e?oe[e]||e.charAt(0).toUpperCase()+e.slice(1):oe[""]||"Plain Text"}),oo=v(()=>{var e;return K(String(null!=(e=s.node.raw)?e:""),no.value,Fl.value)}),ao=v(()=>oo.value.title),ro=v(()=>oo.value.caption),io=v(()=>(ae.value,re(Ee.value||"",he))),uo=v(()=>{const e={};e["--markstream-code-layout-character-width"]=null==kt.value?"1ch":`${kt.value}px`,e["--markstream-code-fallback-bg"]=ql.value.background,e["--markstream-code-fallback-fg"]=ql.value.foreground,ql.value.builtin&&(e["--markstream-code-theme-bg"]=ql.value.background,e["--markstream-code-theme-fg"]=ql.value.foreground,e["--markstream-code-theme-line-number"]=ql.value.lineNumber),e["--markstream-diff-added-line-fill"]=ql.value.diffAddedLine,e["--markstream-diff-added-number-fill"]=ql.value.diffAddedNumber,e["--markstream-diff-editor-bg"]=ql.value.background,e["--markstream-diff-removed-line-fill"]=ql.value.diffRemovedLine,e["--markstream-diff-removed-number-fill"]=ql.value.diffRemovedNumber,e["--markstream-diff-shell-bg"]=ql.value.background,e["--markstream-pre-resolved-theme-bg"]=ql.value.background,e["--markstream-pre-resolved-theme-fg"]=ql.value.foreground,e["--markstream-pre-resolved-theme-line-number"]=ql.value.lineNumber;const l=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=l(s.minWidth),n=l(s.maxWidth);if(t&&(e.minWidth=t),n&&(e.maxWidth=n),At.value&&!Fl.value&&!Le.value){const l=Vt.value;null!=l&&(e.minHeight=`${l}px`)}return e.color="var(--markstream-code-fallback-fg, var(--markstream-code-theme-fg, var(--markstream-pre-resolved-theme-fg)))",e.backgroundColor="var(--markstream-code-fallback-bg, var(--markstream-code-theme-bg, var(--markstream-pre-resolved-theme-bg)))",Fl.value||(e.borderColor="var(--markstream-code-border-color, var(--code-border))"),e}),so=v(()=>!1!==s.showTooltips);function vo(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(s.node.code)),Ne.value=!0,p("copy",s.node.code),setTimeout(()=>{Ne.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function co(){ze.value=!ze.value;const e=Fl.value?ml():fl(),l=Oe.value;e&&l&&(ze.value?(l.style.maxHeight="none",l.style.overflow="visible",Hn(!0)):(l.style.overflow="auto",Hn(!0)))}function fo(){var e,l;if(Le.value=!Le.value,Le.value){if(Ke=!1,Oe.value){const t=Math.ceil((null==(l=(e=Oe.value).getBoundingClientRect)?void 0:l.call(e).height)||0);Ke=Tn(Oe.value,t)||"auto"===Oe.value.style.overflow||"auto"===Oe.value.style.overflowY,t>0&&(Je.value=t)}}else Oe.value&&null!=Je.value&&(Oe.value.style.height=`${Je.value}px`),Xe=2,O(()=>{Le.value||Ie||(Hn(!0),Fn(!0))})}function mo(){if(!Un.value)return;const e=Ee.value;if(Pe.value){const l="html"===e?"text/html":"image/svg+xml",t="html"===e?He("artifacts.htmlPreviewTitle")||"HTML Preview":He("artifacts.svgPreviewTitle")||"SVG Preview";return void p("previewCode",{node:s.node,artifactType:l,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&(vt.value=!vt.value)}function ho(e,l={}){if(!rl||Ie)return null;if(!1===s.stream&&!1!==s.loading)return null;if(Oo(),Fo())return null;if(Vl.value||Oe.value!==e)return null;if(Jn())return null;if(bl)return bl;if(_e.value&&je.value)return Promise.resolve();const t=Po(),n=Jl.value;let o=!1;_e.value=!0,function(){const e=pe.value;fe&&e&&Ye!==e&&(Ye&&fe.markSettled(Ye),Ye=e,fe.markPending(e))}();const a=d(null,null,function*(){try{yield function(e){return d(this,null,function*(){var l,t;if(!rl||Ie)return;const n=Il.value;if(lt=!1,Gl.value=!1,Yl.value=null,Re.value=!1,Wl.value=!1,Ul.value=!1,bt.value=null,wt.value=null,kt.value=null,xt.value=null,On(),function(){if(Kl.value=!1,$t())return void(_t.value=null);const e=zt.value;_t.value=je.value||null==e?null:e}(),Bn(),Pn(),function(e){e.replaceChildren()}(e),So(),Ie)return;const o=d(null,null,function*(){var l,t;if("diff"===n){!function(){if(Cl||"undefined"==typeof window)return;Cl=!0;const e=e=>{var l;Tl("reason"in e?e.reason:null!=(l=e.error)?l:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0),Ml=()=>{window.removeEventListener("error",e,!0),window.removeEventListener("unhandledrejection",e,!0),Cl=!1,Ml=null}}(),pl();const n=Dl(String(null!=(l=s.node.originalCode)?l:""),String(null!=(t=s.node.updatedCode)?t:""));il?yield il(e,n.original,n.updated,$e.value):yield rl(e,s.node.code,$e.value)}else yield rl(e,ct.value,$e.value);Re.value=!0}),a=o.finally(()=>{wl===a&&(wl=null)});if(wl=a,yield function(e){return d(this,null,function*(){if(!Fl.value)return void(yield e);let l,t=!1;for(e.then(()=>{t=!0},e=>{t=!0,l=e});;){if(Ie)return;if(t){if(l)throw l;return}if(Ln()&&In())return;yield O(),yield Zt()}})}(a),Ie)return;if(Il.value!==n)return;Re.value=!0;const r=null==(l=s.codeBlockOptions)?void 0:l.fontSize;if("number"==typeof r&&Number.isFinite(r)&&r>0){const e="diff"===n?ml():fl();null==(t=null==e?void 0:e.updateOptions)||t.call(e,{fontSize:r}),gt.value=r,yt.value=r}else if(!yn()){const e=ln();e&&e>0?(gt.value=e,yt.value=e):(gt.value=12,yt.value=12)}gn(),yield ko(),ze.value||Le.value||Hn(!1),je.value=!0,Al.value=n,function(){var e,l,t,n,o;if(Bn(),Fl.value){const n=ml(),o=null==(e=null==n?void 0:n.getOriginalEditor)?void 0:e.call(n),a=null==(l=null==n?void 0:n.getModifiedEditor)?void 0:l.call(n),i=(e,l)=>{try{const t=null==e?void 0:e[l];if("function"!=typeof t)return;const n=t.call(e,()=>En());n&&Bl.push(n)}catch(t){}};try{const e=null==(t=null==n?void 0:n.onDidUpdateDiff)?void 0:t.call(n,()=>{En(),de(()=>un())});e&&Bl.push(e)}catch(r){}i(o,"onDidContentSizeChange"),i(a,"onDidContentSizeChange");const u=Oe.value;if(u&&"undefined"!=typeof MutationObserver){const e=["diffs-container",".stream-diffs-shell",".stream-diffs-surface"].join(","),l=l=>{var t;const n=l instanceof HTMLElement?l:l.parentElement;return Boolean(null==(t=null==n?void 0:n.closest)?void 0:t.call(n,e))},t=l=>{var t,n;const o=l instanceof HTMLElement?l:l.parentElement;return Boolean((null==(t=null==o?void 0:o.closest)?void 0:t.call(o,e))||(null==(n=null==o?void 0:o.querySelector)?void 0:n.call(o,e)))},n=new MutationObserver(e=>{Fl.value&&qn()&&e.some(e=>l(e.target)||Array.from(e.addedNodes).some(t)||Array.from(e.removedNodes).some(l))&&(Nn(),Hn({preferModelDiffHeight:!0}),Fn(),Dn())});n.observe(u,{attributeFilter:["class"],attributes:!0,childList:!0,characterData:!0,subtree:!0}),Bl.push({dispose:()=>n.disconnect()})}if(u&&"undefined"!=typeof ResizeObserver){const e=new ResizeObserver(()=>{if(!Fl.value)return;if(Fn(),!qn())return;const e=hn(u);null!=e&&(Math.ceil(u.getBoundingClientRect().height||0)<=e+1||(Nn(),Hn({preferModelDiffHeight:!0}),Fn()))});e.observe(u),Bl.push({dispose:()=>e.disconnect()})}return}const a=fl();try{const e=null==(n=null==a?void 0:a.onDidContentSizeChange)?void 0:n.call(a,()=>En());e&&Bl.push(e)}catch(r){}try{const e=null==(o=null==a?void 0:a.onDidLayoutChange)?void 0:o.call(a,()=>En());e&&Bl.push(e)}catch(r){}}(),wn(),gn(),Nn(),un(),En(),yield O();let i=null;yl&&(i=yield yl(),i&&(yield O(),yield Zt()));const u=null==i?"diff"===n?yield An():yield function(){return d(this,null,function*(){if(jn())return yield O(),yield Zt(),jn();for(let e=0;e<30;e++){if(Ie||Fl.value)return!1;const e=Oe.value,l=Rn(),t=_n(e),n=!ct.value.trim()||an(e);if(l&&t&&n&&(yield O(),yield Zt(),!Ie&&!Fl.value&&Rn()&&_n(Oe.value)&&(!ct.value.trim()||an(Oe.value))))return!0;yield O(),yield Zt()}return!1})}():i;Ie||(u?(gn(),Kt(),(yield Yt())||No()):No())})}(e),Ql=null}catch(a){const e=Po(),r=n!==Jl.value,i=!1!==l.allowStaleContentRetry&&r&&Ql!==e;if(t!==e||i)return i&&(Ql=e),o=!0,_e.value=!1,je.value=!1,Re.value=!1,void(Wl.value=!1);throw No(t),a}}).finally(()=>{bl===a&&(bl=null),function(){const e=Ye;fe&&e&&(Ye="",O(()=>{var l,t;if(!Ie){const n=null!=(t=null==(l=Fe.value)?void 0:l.offsetHeight)?t:0;n>0&&fe.reportHeight(e,n)}fe.markSettled(e)}))}(),o&&!Ie&&queueMicrotask(()=>{var e;const l=Oe.value;l&&!Ie&&(null==(e=ho(l))||e.catch(e=>{je.value=!1,Wl.value=!1,No()}))})});return bl=a,a}P(so,e=>{e||Q()}),P(()=>yt.value,(e,l)=>{var t;const n=Fl.value?ml():fl();n&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(null==(t=n.updateOptions)||t.call(n,{fontSize:e}),Le.value||Hn(!0))},{flush:"post",immediate:!1});let po=0;const go=P(()=>[Oe.value,Fl.value,s.stream,s.loading,qe.value,tl.value,s.node.language,s.node.raw,s.node.code,s.node.loading],e=>d(null,[e],function*([e,l,t,n,o,a]){const r=++po;if(!e)return;if(!a)return;if(Gn())return;if(Zl)return;if(!1===t&&!1!==n)return;if(!rl){if(yield function(){return d(this,null,function*(){if("undefined"==typeof window||Ie)return;if(qe.value||Vl.value)return;if(kl)return kl;const e=d(null,null,function*(){try{const e=yield ce();if(Ie)return;if(!e)return void(Vl.value=!0);mt(e)}catch(e){if(Ie)return;Vl.value=!0}}).finally(()=>{kl===e&&(kl=null)});return kl=e,e})}(),r!==po)return;if(!1===s.stream&&!1!==s.loading)return;if(Jn())return;if(!tl.value)return;if(!rl||Vl.value||_e.value||Fo()||Ie||Oe.value!==e)return}if(Jn())return;const i=ho(e);if(i){try{yield i}catch(u){je.value=!1,Wl.value=!1,No()}je.value&&Wl.value&&go()}}));function yo(e){return"string"==typeof e?e:null}function bo(e,l){if(e===l)return!0;const t=yo(e),n=yo(l);return!!t&&t===n}function wo(){return ee({darkTheme:s.darkTheme,isDark:s.isDark,lightTheme:s.lightTheme,theme:s.theme,themes:s.themes})}function ko(){return d(this,arguments,function*(e={}){So();const l=()=>{Fl.value&&zl(),de(()=>{wn(),En()})};if(e.appearanceOnly)return void l();const t=wo();if(t)try{yield Sl(t),l()}catch(n){}else l()})}function xo(){var e,l;const t=Ot.value,n=u(i({},Ll.value||{}),{wordWrap:"wrap"===t.overflow?"on":"off",overflow:t.overflow,themes:s.themes,stream:!1,MAX_HEIGHT:null!=(l=null==(e=s.codeBlockOptions)?void 0:e.maxHeight)?l:500,fontSize:Ct.value,lineHeight:Bt.value,theme:wo(),themeType:s.isDark?"dark":"light",disableLineNumbers:!b.value,disableFileHeader:!0,onThemeChange(){wn()}}),o=function(){var e;const l=null==(e=Ll.value)?void 0:e.fontFamily;return"string"==typeof l&&l.trim()?l.trim():Fl.value?function(){var e;if("undefined"==typeof window)return;const l=null==(e=Fe.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!l)return;return window.getComputedStyle(l).fontFamily.trim()||void 0}():void 0}();o&&(null!=n.fontFamily||(n.fontFamily=o));const a="string"==typeof n.unsafeCSS?n.unsafeCSS:"",r=`\n[data-file] [data-line],\n[data-diff] [data-line] {\n white-space: ${"wrap"===(d=t.overflow)?"pre-wrap":"pre"} !important;\n overflow-wrap: ${"wrap"===d?"anywhere":"normal"} !important;\n word-break: normal !important;\n}`;var d;return n.unsafeCSS=`[data-file], [data-diff] { --diffs-min-number-column-width-default: 2ch !important; }\n${r}\n\n[data-no-newline],\n[data-gutter-buffer="metadata"] {\n --diffs-computed-decoration-bg: var(--markstream-diff-metadata-bg) !important;\n --diffs-computed-diff-line-bg: var(--markstream-diff-metadata-bg) !important;\n --diffs-computed-selected-line-bg: var(--markstream-diff-metadata-bg) !important;\n --diffs-line-bg: var(--markstream-diff-metadata-bg) !important;\n color: var(--markstream-diff-metadata-fg) !important;\n background-color: var(--markstream-diff-metadata-bg) !important;\n}\n${a}`.trim(),n}function So(){const e=xo();if(!Hl)return Hl=e,Hl;for(const l of Object.keys(Hl))l in e||delete Hl[l];return Object.assign(Hl,e),Hl}P(Il,(e,l)=>d(null,null,function*(){if(e===l)return;if(Gl.value||Zl)return;if(Zn(),!rl||!Oe.value)return;if(!_e.value)return;if(!1===s.stream&&!1!==s.loading)return;if(!tl.value)return;const t=bl;if(t){try{yield t}catch(n){}if(Ie||!Oe.value)return}if(Al.value!==e||!_e.value||!je.value)try{je.value=!1,Wl.value=!1,_e.value=!1,Re.value=!1,Bn(),Pn(),pl(),yield O(),yield ho(Oe.value)}catch(o){je.value=!1,Wl.value=!1,No()}}));const Co=M(0),Mo=v(()=>String(Co.value));let Bo=!1;function Po(){var e;const l=wo();return JSON.stringify({kind:Il.value,language:$e.value,structural:Mo.value,optionsRevision:Co.value,settledContentGeneration:Xl.value,theme:null!=(e=yo(l))?e:null==l?null:"custom",isDark:s.isDark})}P(()=>{var e;return null==(e=s.codeBlockOptions)?void 0:e.fontSize},e=>{const l="number"==typeof e&&Number.isFinite(e)&&e>0?e:ht;gt.value=l,yt.value=l,bt.value=null,wt.value=null,kt.value=null}),P(()=>[s.codeBlockOptions,s.showLineNumbers],()=>{Co.value+=1,!1===s.stream&&!1!==s.loading&&(Bo=!0)},{deep:!0}),P(()=>[ct.value,s.node.originalCode,s.node.updatedCode],()=>{Jl.value+=1,Gn()||(Xl.value+=1)});const Ho=v(()=>Po());function Oo(){Gl.value&&Yl.value!==Ho.value&&(Gl.value=!1,Yl.value=null,Ql=null,et=null,_e.value=!1,je.value=!1,Re.value=!1,Wl.value=!1,Ul.value=!1)}function Fo(){return Oo(),Gl.value&&Yl.value===Ho.value}function No(e=Ho.value){Yl.value=e,Gl.value=!0,Ul.value=!1}return P(Ho,()=>d(null,null,function*(){if(Zl)return;if(!Gl.value)return;if(Yl.value===Ho.value)return;if(!rl||!Oe.value||Vl.value||Ie||!tl.value)return;if(!1===s.stream&&!1!==s.loading)return;if(Jn())return;const e=Ho.value;Zl=!0;try{if(Oo(),Gl.value)return;yield ho(Oe.value)}catch(l){je.value=!1,Wl.value=!1,No()}finally{et=e,yield O(),Zl=!1}})),P(()=>[s.codeBlockOptions,tl.value],()=>{var e,l;if(So(),!rl||!tl.value)return;const t=Fl.value?ml():fl(),n="number"==typeof(null==(e=s.codeBlockOptions)?void 0:e.fontSize)?s.codeBlockOptions.fontSize:Number.isFinite(yt.value)?yt.value:void 0;"number"==typeof n&&Number.isFinite(n)&&n>0&&(null==(l=null==t?void 0:t.updateOptions)||l.call(t,{fontSize:n})),Hn(!1)},{deep:!0}),P(()=>[wo(),Rl.value,qe.value,_e.value,tl.value],([e],l)=>{qe.value&&je.value&&tl.value&&ko({appearanceOnly:null!=l&&bo(e,l[0])})},{flush:"post"}),P(()=>[Mo.value,qe.value,tl.value],(e,l)=>d(null,[e,l],function*([e,l,t],[n]){if(So(),!l||!t)return;if(!rl||!Oe.value)return;if(!_e.value)return;if(e===n)return;if(!1===s.stream&&!1!==s.loading)return void(Bo=!0);Bo=!1;const o=bl;if(o){try{yield o}catch(a){}if(Ie||!Oe.value)return}try{je.value=!1,Wl.value=!1,_e.value=!1,Re.value=!1,Bn(),Pn(),pl(),Ol&&mt(Ol),yield O(),yield ho(Oe.value,{allowStaleContentRetry:!1})}catch(r){je.value=!1,Wl.value=!1,No()}}),{flush:"post"}),P(()=>[s.loading,tl.value],([e,l])=>{!1===e&&l&&Bo&&(Bo=!1,Co.value+=1)},{flush:"post"}),P(()=>[s.loading,tl.value],(e,l)=>d(null,[e,l],function*([e,l],t){if(!l)return;const n=null==t?void 0:t[0];if(!1===n&&!1!==e&&Fl.value&&_e.value&&(yield O(),de(()=>{d(null,null,function*(){const e=bl;if(e)try{yield e}catch(l){}!Ie&&Fl.value&&!1!==s.loading&&(So(),zl(),En())})})),e)return;const o=void 0!==n&&!1!==n;yield O(),de(()=>{d(null,null,function*(){var e,l;try{if(o&&(yield function(){return d(this,null,function*(){if(!Gl.value)return!1;if(!rl||!Oe.value||Vl.value||Ie||!tl.value)return!1;if(et===Ho.value)return!0;Zl=!0;try{Gl.value=!1,Yl.value=null,Ql=null,_e.value=!1,je.value=!1,Re.value=!1,Wl.value=!1,Bn(),Pn(),pl(),Ol&&mt(Ol),yield O();try{yield ho(Oe.value)}catch(e){je.value=!1,Wl.value=!1,No()}}finally{yield O(),Zl=!1}return!0})}()))return void Hn(!1);if(o&&Fl.value&&_e.value&<&&Oe.value)return lt=!1,je.value=!1,Wl.value=!1,_e.value=!1,Re.value=!1,Bn(),Pn(),pl(),yield O(),yield ho(Oe.value,{allowStaleContentRetry:!1}),void Dn(!0);if(o&&_e.value)if(Fl.value&&Oe.value){const n=bl;if(n)try{yield n}catch(t){}So();const o=Dl(String(null!=(e=s.node.originalCode)?e:""),String(null!=(l=s.node.updatedCode)?l:""));if(yield Vn(o.original,o.updated,$e.value),Ie||!Fl.value)return;yield Promise.resolve(vl()),zl(),Fn(!0),Gt(),Nn(),un();const a=yield An();Ie||!a||Wl.value||(yield Yt()),En(),Dn(!0)}else Zn(),lo(ct.value,$e.value),yield new Promise(e=>{const l=()=>{Ie?e():Kn||Xn?setTimeout(l,16):e()};l()}),Ie||Fl.value||(yield Promise.resolve(sl()));o&&Fl.value?(Hn({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Dn(!0)):Hn(!1)}catch(n){}})})}),{immediate:!0,flush:"post"}),f(()=>{Bn(),Pn(),hl(),null==Ml||Ml()}),(l,t)=>{var n;return Vl.value?(m(),h(ie,{key:0,style:F(It.value),node:ft.value,loading:s.loading,"show-line-numbers":b.value,"diff-inline":tt.value,"diff-hide-unchanged-regions":nt.value,"code-block-options":s.codeBlockOptions,"resolved-visual-options":Ot.value,"reserved-height-px":Fl.value&&null!=(n=xt.value)?n:void 0,"is-dark":s.isDark,theme:s.theme,"dark-theme":s.darkTheme,"light-theme":s.lightTheme,themes:s.themes,"show-header":s.showHeader,"show-copy-button":s.showCopyButton,"show-tooltips":s.showTooltips},N({_:2},[l.$slots["header-left"]?{name:"header-left",fn:E(()=>[D(l.$slots,"header-left",{},void 0,!0)]),key:"0"}:void 0,l.$slots["header-right"]?{name:"header-right",fn:E(()=>[D(l.$slots,"header-right",{},void 0,!0)]),key:"1"}:void 0]),1032,["style","node","loading","show-line-numbers","diff-inline","diff-hide-unchanged-regions","code-block-options","resolved-visual-options","reserved-height-px","is-dark","theme","dark-theme","light-theme","themes","show-header","show-copy-button","show-tooltips"])):(m(),$("div",{key:1,ref_key:"container",ref:Fe,style:F(uo.value),class:y(["code-block-container rounded-lg border",[{dark:s.isDark,"is-rendering":s.loading,"is-dark":jl.value,"is-diff":Fl.value,"is-plain-text":Te.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":Wl.value&&!Vl.value?"true":"false","data-markstream-enhancement-state":st.value,"data-markstream-code-block-state":Gn()?"streaming":"settled","data-markstream-pending":dt.value?"true":void 0,"data-markstream-viewport-pending":al.value&&k(el)&&!tl.value?"true":void 0},[T(ue,{"show-header":s.showHeader,"show-collapse-button":s.showCollapseButton,"show-font-size-buttons":s.showFontSizeButtons,"enable-font-size-control":s.enableFontSizeControl,"show-copy-button":s.showCopyButton,"show-expand-button":s.showExpandButton,"show-preview-button":s.showPreviewButton,"show-tooltips":s.showTooltips,"is-dark":s.isDark,loading:s.loading,stream:e.stream,"is-collapsed":Le.value,"is-expanded":ze.value,"copy-text":Ne.value,"is-previewable":Un.value,"code-font-size":yt.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":gt.value,"font-baseline-ready":St.value,"diff-stats":Fl.value?Nl.value:null,"diff-stats-aria-label":El.value,onToggleCollapse:fo,onDecreaseFont:vn,onResetFont:cn,onIncreaseFont:sn,onCopy:vo,onToggleExpand:co,onPreview:mo},N({"header-left":E(()=>[D(l.$slots,"header-left",{},()=>[g("div",be,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:io.value},null,8,we),g("div",ke,[g("div",xe,w(ao.value),1),ro.value?(m(),$("div",Se,w(ro.value),1)):L("",!0)])])],!0)]),loading:E(()=>[D(l.$slots,"loading",{loading:e.loading,stream:e.stream},()=>[t[0]||(t[0]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))],!0)]),default:E(()=>{var l;return[z(g("div",{class:y(["code-editor-layer",{"code-editor-layer--collapsed":Le.value}])},[g("div",{ref_key:"codeEditor",ref:Oe,class:y(["code-editor-container",e.stream?"":"code-height-placeholder"]),"data-markstream-host-hidden":ut.value?"true":void 0,style:F(Wt.value)},null,14,Ce),it.value?(m(),h(ie,{key:0,style:F(It.value),node:ft.value,loading:s.loading,"show-line-numbers":b.value,"diff-inline":tt.value,"diff-hide-unchanged-regions":nt.value,"code-block-options":s.codeBlockOptions,"resolved-visual-options":Ot.value,"reserved-height-px":Fl.value&&null!=(l=xt.value)?l:void 0,"is-dark":s.isDark,theme:s.theme,"dark-theme":s.darkTheme,"light-theme":s.lightTheme,themes:s.themes,"show-toolbar":!1},null,8,["style","node","loading","show-line-numbers","diff-inline","diff-hide-unchanged-regions","code-block-options","resolved-visual-options","reserved-height-px","is-dark","theme","dark-theme","light-theme","themes"])):L("",!0)],2),[[_,!!e.stream||!e.loading]]),vt.value&&!Pe.value&&Un.value&&"html"===Ee.value?(m(),h(ge,{key:0,code:s.node.code,"html-preview-allow-scripts":s.htmlPreviewAllowScripts,"html-preview-sandbox":s.htmlPreviewSandbox,"is-dark":s.isDark,"on-close":()=>vt.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):L("",!0)]}),_:2},[l.$slots["header-right"]?{name:"header-right",fn:E(()=>[D(l.$slots,"header-right",{},void 0,!0)]),key:"0"}:void 0]),1032,["show-header","show-collapse-button","show-font-size-buttons","enable-font-size-control","show-copy-button","show-expand-button","show-preview-button","show-tooltips","is-dark","loading","stream","is-collapsed","is-expanded","copy-text","is-previewable","code-font-size","default-code-font-size","font-baseline-ready","diff-stats","diff-stats-aria-label"])],14,ye))}}}),[["__scopeId","data-v-5ea442c1"]]);export{Me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,a=Object.defineProperties,r=Object.getOwnPropertyDescriptors,t=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,d=(a,r,t)=>r in a?e(a,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[r]=t,n=(e,a)=>{for(var r in a||(a={}))o.call(a,r)&&d(e,r,a[r]);if(t)for(var r of t(a))i.call(a,r)&&d(e,r,a[r]);return e},l=(e,t)=>a(e,r(t));import{defineComponent as s,h as m}from"vue";import{a8 as c,ae as f,ag as h,aj as p,J as g,af as u}from"./exports.js";import{r as b}from"./preCodeTheme.js";import{n as k,c as v}from"./index2.js";const w=s({name:"CodeBlockNodeLoadingContent",inheritAttrs:!1,props:["node","isDark","loading","stream","codeBlockOptions","showLineNumbers","theme","darkTheme","lightTheme","isShowPreview","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:a}){const r=e;return()=>{var e,t,o,i,d,s,w;const x=k(String(null!=(t=null==(e=r.node)?void 0:e.language)?t:"")),y=v[x]||(x?x.charAt(0).toUpperCase()+x.slice(1):v[""]),S=c(r.node),C=f(String(null!=(i=null==(o=r.node)?void 0:o.raw)?i:""),y,S),P=null!=(d=r.codeBlockOptions)?d:{},H=S&&(null!=(s=r.estimatedDiffInline)?s:h(P)),B=p(P),N=b({darkTheme:r.darkTheme,isDark:r.isDark,lightTheme:r.lightTheme,theme:r.theme,themes:r.themes}),O=!S&&"number"==typeof r.estimatedContentHeightPx&&Number.isFinite(r.estimatedContentHeightPx)?Math.min(B.maxHeight,Math.ceil(r.estimatedContentHeightPx)):B.maxHeight,j=null!=(w=r.showLineNumbers)?w:!0!==P.disableLineNumbers,W=l(n(l(n({fontSize:`${B.fontSize}px`,lineHeight:`${B.lineHeight}px`,tabSize:B.tabSize,paddingTop:`${B.padding}px`,paddingBottom:`${B.paddingBottom}px`,maxHeight:`${O}px`,overflow:"auto",overflowX:"wrap"===B.overflow?"hidden":"auto",overflowY:"auto",whiteSpace:"scroll"===B.overflow?"pre":"pre-wrap",overflowWrap:"wrap"===B.overflow?"anywhere":"normal",wordBreak:"normal","--markstream-pre-line-number-top":`${B.padding}px`},S?{"--markstream-pre-diff-line-height":`${B.lineHeight}px`}:{}),{"--markstream-code-font-family":B.fontFamily,"--markstream-code-fallback-bg":N.background,"--markstream-code-fallback-fg":N.foreground}),N.builtin?{"--markstream-code-theme-bg":N.background,"--markstream-code-theme-fg":N.foreground,"--markstream-code-theme-line-number":N.lineNumber}:{}),{"--markstream-diff-added-line-fill":N.diffAddedLine,"--markstream-diff-added-number-fill":N.diffAddedNumber,"--markstream-diff-metadata-bg":N.background,"--markstream-diff-metadata-fg":N.lineNumber,"--markstream-diff-removed-line-fill":N.diffRemovedLine,"--markstream-diff-removed-number-fill":N.diffRemovedNumber,"--markstream-pre-resolved-theme-bg":N.background,"--markstream-pre-resolved-theme-fg":N.foreground,"--markstream-pre-resolved-theme-line-number":N.lineNumber,backgroundColor:N.background,color:N.foreground,fontFamily:B.fontFamily}),z=()=>m("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[m("svg",{class:"action-icon",width:"14",height:"14"})]),L=!1!==r.isShowPreview&&("html"===x||"svg"===x),T=!1!==r.showFontSizeButtons&&!1!==r.enableFontSizeControl||!1!==r.showExpandButton||L&&!1!==r.showPreviewButton,F=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},$=n(n(n(l(n({"--markstream-code-layout-character-width":"1ch","--markstream-code-fallback-bg":N.background,"--markstream-code-fallback-fg":N.foreground},N.builtin?{"--markstream-code-theme-bg":N.background,"--markstream-code-theme-fg":N.foreground,"--markstream-code-theme-line-number":N.lineNumber}:{}),{"--markstream-diff-added-line-fill":N.diffAddedLine,"--markstream-diff-added-number-fill":N.diffAddedNumber,"--markstream-diff-editor-bg":N.background,"--markstream-diff-removed-line-fill":N.diffRemovedLine,"--markstream-diff-removed-number-fill":N.diffRemovedNumber,"--markstream-diff-shell-bg":N.background,"--markstream-pre-resolved-theme-bg":N.background,"--markstream-pre-resolved-theme-fg":N.foreground,"--markstream-pre-resolved-theme-line-number":N.lineNumber,color:N.foreground,backgroundColor:N.background}),F(r.minWidth)?{minWidth:F(r.minWidth)}:{}),F(r.maxWidth)?{maxWidth:F(r.maxWidth)}:{}),S?{}:{borderColor:"var(--markstream-code-border-color, var(--code-border))"});return m("div",l(n({},a),{class:["code-block-container","rounded-lg","border",{dark:!0===r.isDark,"is-rendering":!1!==r.loading,"is-dark":N.dark,"is-diff":S,"is-plain-text":""===x||"plaintext"===x||"text"===x},a.class],style:[$,a.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":r.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[!1===r.showHeader?null:m("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[m("div",{class:"code-header-main",style:{minWidth:0,flex:"1 1 auto",display:"flex",alignItems:"center",gap:"var(--ms-gap-header-main, 0.625rem)",overflow:"hidden"}},[m("span",{class:"icon-slot h-4 w-4 flex-shrink-0","aria-hidden":"true",style:{display:"inline-flex",width:"1rem",height:"1rem",flex:"0 0 auto"}}),m("div",{class:"code-header-copy",style:{minWidth:0,display:"grid",gap:"2px"}},[m("div",{class:"code-header-title",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--ms-text-label, 0.75rem)",fontWeight:"500",color:"var(--code-action-fg)"}},C.title),C.caption?m("div",{class:"code-header-caption",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.75rem",color:"var(--code-line-number)"}},C.caption):null])]),m("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[S?m("div",{class:"code-diff-stats","aria-hidden":"true"},[m("span",{class:"code-diff-stat removed"},"-0"),m("span",{class:"code-diff-stat added"},"+0")]):null,!1===r.showCopyButton?null:z(),!1===r.showCollapseButton?null:z(),T?m("div",{class:"relative"},[z()]):null])]),m("div",{class:"code-block-shell-content",style:!1!==r.stream||!1===r.loading?void 0:{display:"none"}},[m(g,{node:r.node,loading:r.loading,showLineNumbers:j,reservedHeightPx:S||null==r.estimatedContentHeightPx?void 0:Math.min(r.estimatedContentHeightPx,B.maxHeight),diffInline:H,diffHideUnchangedRegions:S?u(P):void 0,class:["code-pre-fallback",{"is-wrap":"wrap"===B.overflow}],style:W,"data-markstream-code-theme":N.name,"data-markstream-code-loading":"1"})]),m("div",{class:"code-loading-placeholder",style:!1===r.stream&&!1!==r.loading?void 0:{display:"none"}},[m("div",{class:"loading-skeleton"},[m("div",{class:"skeleton-line"}),m("div",{class:"skeleton-line"}),m("div",{class:"skeleton-line short"})])]),m("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}});export{w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./PreCodeBlock.vue_vue_type_style_index_0_lang.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,o=Object.defineProperties,t=Object.getOwnPropertyDescriptors,a=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,l=(o,t,a)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a,i=(e,o)=>{for(var t in o||(o={}))r.call(o,t)&&l(e,t,o[t]);if(a)for(var t of a(o))n.call(o,t)&&l(e,t,o[t]);return e},d=(e,a)=>o(e,t(a)),s=(e,o,t)=>new Promise((a,r)=>{var n=e=>{try{i(t.next(e))}catch(o){r(o)}},l=e=>{try{i(t.throw(e))}catch(o){r(o)}},i=e=>e.done?a(e.value):Promise.resolve(e.value).then(n,l);i((t=t.apply(e,o)).next())});import{defineComponent as c,ref as u,computed as m,openBlock as p,createElementBlock as v,Fragment as h,renderSlot as f,createElementVNode as g,toDisplayString as b,createCommentVNode as w,unref as k,normalizeStyle as y,withModifiers as x,createStaticVNode as B,createVNode as C,Transition as F,withCtx as S,withDirectives as T,normalizeClass as M,vShow as z,useAttrs as j,inject as H,onBeforeUnmount as P,createSlots as O,mergeProps as $,createBlock as E}from"vue";import{as as L,a6 as N,ao as R,M as _,a8 as A,ag as D,ae as I,aj as U,J as V}from"./exports.js";import{g as G,n as J,e as W,b as X,c as Y,l as q}from"./index2.js";import{r as K}from"./preCodeTheme.js";function Q(e,o){if(void 0===o)return G(e);if(o){const t=o(e);if(null!=t&&""!==t)return t}const t=J(e);return W(t)||X()}const Z={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},ee={class:"flex items-center gap-0.5"},oe=["aria-label"],te={class:"code-diff-stat removed"},ae={class:"code-diff-stat added"},re=["aria-label"],ne={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},le={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ie=["aria-pressed"],de={key:3,class:"relative"},se=["aria-expanded"],ce=["disabled"],ue=["disabled"],me=["disabled"],pe={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ve={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},he={class:"code-loading-placeholder"},fe={class:"sr-only","aria-live":"polite",role:"status"},ge=/* @__PURE__ */c({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(e,{emit:o}){const t=e,a=o,r=u(!1),n=u(null),l=u(null);function i(){N(!0),r.value=!r.value,r.value&&document.addEventListener("click",s,{once:!0,capture:!0})}function d(){N(!0),r.value=!1}function s(e){var o,t;const a=e.target;(null==(o=n.value)?void 0:o.contains(a))||(null==(t=l.value)?void 0:t.contains(a))?document.addEventListener("click",s,{once:!0,capture:!0}):d()}const c=m(()=>t.showFontSizeButtons&&t.enableFontSizeControl||t.showExpandButton||t.isPreviewable&&t.showPreviewButton),{t:j}=L(),H=m(()=>!1!==t.showTooltips);function P(e,o){H.value&&R(e.currentTarget,o,"top",!1,void 0,t.isDark)}function O(){H.value&&N()}function $(e){P(e,t.copyText?j("common.copied")||"Copied":j("common.copy")||"Copy")}const E=m(()=>{var e,o;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)<=(null!=(o=t.codeFontMin)?o:0)}),_=m(()=>!t.fontBaselineReady||t.codeFontSize===t.defaultCodeFontSize),A=m(()=>{var e,o;return!!Number.isFinite(t.codeFontSize)&&(null!=(e=t.codeFontSize)?e:0)>=(null!=(o=t.codeFontMax)?o:100)});return(o,s)=>(p(),v(h,null,[t.showHeader?(p(),v("div",Z,[f(o.$slots,"header-left"),f(o.$slots,"header-right",{},()=>[g("div",ee,[e.diffStats?(p(),v("div",{key:0,class:"code-diff-stats","aria-label":e.diffStatsAriaLabel},[g("span",te,"-"+b(e.diffStats.removed),1),g("span",ae,"+"+b(e.diffStats.added),1)],8,oe)):w("",!0),t.showCopyButton?(p(),v("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":e.copyText?k(j)("common.copied")||"Copied":k(j)("common.copy")||"Copy",onClick:s[0]||(s[0]=e=>a("copy")),onMouseenter:s[1]||(s[1]=e=>$(e)),onFocus:s[2]||(s[2]=e=>$(e)),onMouseleave:O,onBlur:O},[e.copyText?(p(),v("svg",le,[...s[14]||(s[14]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(p(),v("svg",ne,[...s[13]||(s[13]=[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,re)):w("",!0),t.showCollapseButton?(p(),v("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":e.isCollapsed,onClick:s[3]||(s[3]=e=>a("toggleCollapse")),onMouseenter:s[4]||(s[4]=o=>P(o,e.isCollapsed?k(j)("common.expand")||"Expand":k(j)("common.collapse")||"Collapse")),onFocus:s[5]||(s[5]=o=>P(o,e.isCollapsed?k(j)("common.expand")||"Expand":k(j)("common.collapse")||"Collapse")),onMouseleave:O,onBlur:O},[(p(),v("svg",{style:y({rotate:e.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...s[15]||(s[15]=[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,ie)):w("",!0),c.value?(p(),v("div",de,[g("button",{ref_key:"moreBtnRef",ref:l,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":r.value,"aria-haspopup":"true",onClick:x(i,["stop"]),onMouseenter:s[6]||(s[6]=e=>P(e,k(j)("common.more")||"More")),onFocus:s[7]||(s[7]=e=>P(e,k(j)("common.more")||"More")),onMouseleave:O,onBlur:O},[...s[16]||(s[16]=[B('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,se),C(F,{name:"code-menu"},{default:S(()=>[r.value?(p(),v("div",{key:0,ref_key:"moreMenuRef",ref:n,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[t.showFontSizeButtons&&t.enableFontSizeControl?(p(),v(h,{key:0},[g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:E.value,onClick:s[8]||(s[8]=e=>{k(N)(!0),a("decreaseFont")})},[s[17]||(s[17]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),g("span",null,b(k(j)("common.fontSmaller")||"Font size −"),1)],8,ce),g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:_.value,onClick:s[9]||(s[9]=e=>{k(N)(!0),a("resetFont")})},[s[18]||(s[18]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[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)),g("span",null,b(k(j)("common.fontReset")||"Font size reset"),1)],8,ue),g("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:A.value,onClick:s[10]||(s[10]=e=>{k(N)(!0),a("increaseFont")})},[s[19]||(s[19]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),g("span",null,b(k(j)("common.fontLarger")||"Font size +"),1)],8,me)],64)):w("",!0),t.showExpandButton?(p(),v("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[11]||(s[11]=e=>{d(),a("toggleExpand")})},[e.isExpanded?(p(),v("svg",pe,[...s[20]||(s[20]=[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)])])):(p(),v("svg",ve,[...s[21]||(s[21]=[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)])])),g("span",null,b(e.isExpanded?k(j)("common.collapse")||"Collapse":k(j)("common.expand")||"Expand"),1)])):w("",!0),e.isPreviewable&&t.showPreviewButton?(p(),v("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:s[12]||(s[12]=e=>{d(),a("preview")})},[s[22]||(s[22]=g("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),g("circle",{cx:"12",cy:"12",r:"3"})])],-1)),g("span",null,b(k(j)("common.preview")||"Preview"),1)])):w("",!0)],512)):w("",!0)]),_:1})])):w("",!0)])])])):w("",!0),T(g("div",{class:M(["code-block-shell-content",{"code-block-shell-content--collapsed":e.isCollapsed}])},[f(o.$slots,"default")],2),[[z,!!e.stream||!e.loading]]),T(g("div",he,[f(o.$slots,"loading",{},()=>[s[23]||(s[23]=g("div",{class:"loading-skeleton"},[g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line"}),g("div",{class:"skeleton-line short"})],-1))])],512),[[z,!e.stream&&e.loading]]),g("span",fe,b(e.copyText?k(j)("common.copied")||"Copied":""),1)],64))}}),be={class:"code-header-main"},we=["innerHTML"],ke={class:"code-header-copy"},ye={class:"code-header-title"},xe={key:0,class:"code-header-caption"},Be=/* @__PURE__ */c(d(i({},{inheritAttrs:!1}),{__name:"PreCodeBlock",props:{codeBlockOptions:{},darkTheme:{},isDark:{type:Boolean,default:!1},lightTheme:{},resolvedVisualOptions:{},showCopyButton:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},theme:{},themes:{},node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean,default:!0},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},emits:["copy"],setup(e,{emit:o}){const t=e,l=o,c=j(),h=m(()=>{const e=c,{class:o,style:t}=e;return((e,o)=>{var t={};for(var l in e)r.call(e,l)&&o.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&a)for(var l of a(e))o.indexOf(l)<0&&n.call(e,l)&&(t[l]=e[l]);return t})(e,["class","style"])}),x=u(null),B=u(!1);let F;const T=H(_,void 0),M=m(()=>{var e,o;return null!=(o=t.showLineNumbers)?o:!0!==(null==(e=t.codeBlockOptions)?void 0:e.disableLineNumbers)}),z=m(()=>A(t.node)),L=m(()=>{var e;return!0===t.diffInline||z.value&&D(null!=(e=t.codeBlockOptions)?e:{})}),N=m(()=>{var e,o;return J(String(null!=(o=null==(e=t.node)?void 0:e.language)?o:""))}),R=m(()=>{const e=N.value;return e?Y[e]||e.charAt(0).toUpperCase()+e.slice(1):Y[""]||"Plain Text"}),G=m(()=>{var e,o;return I(String(null!=(o=null==(e=t.node)?void 0:e.raw)?o:""),R.value,A(t.node))}),W=m(()=>(q.value,Q(N.value,T))),X=m(()=>{var e;return null!=(e=t.resolvedVisualOptions)?e:U(t.codeBlockOptions)}),Z=m(()=>K({darkTheme:t.darkTheme,isDark:t.isDark,lightTheme:t.lightTheme,theme:t.theme,themes:t.themes})),ee=m(()=>d(i({"--markstream-code-fallback-bg":Z.value.background,"--markstream-code-fallback-fg":Z.value.foreground},Z.value.builtin?{"--markstream-code-theme-bg":Z.value.background,"--markstream-code-theme-fg":Z.value.foreground,"--markstream-code-theme-line-number":Z.value.lineNumber}:{}),{"--markstream-diff-added-line-fill":Z.value.diffAddedLine,"--markstream-diff-added-number-fill":Z.value.diffAddedNumber,"--markstream-diff-editor-bg":Z.value.background,"--markstream-diff-removed-line-fill":Z.value.diffRemovedLine,"--markstream-diff-removed-number-fill":Z.value.diffRemovedNumber,"--markstream-diff-shell-bg":Z.value.background,"--markstream-pre-resolved-theme-bg":Z.value.background,"--markstream-pre-resolved-theme-fg":Z.value.foreground,"--markstream-pre-resolved-theme-line-number":Z.value.lineNumber,backgroundColor:Z.value.background,color:Z.value.foreground})),oe=m(()=>["code-pre-fallback",c.class,{"is-wrap":"wrap"===X.value.overflow}]),te=m(()=>{var e;const o=X.value,a=null==(null==(e=t.codeBlockOptions)?void 0:e.padding)?"1ch":`${o.padding}px`,r=z.value&&"number"==typeof t.reservedHeightPx&&Number.isFinite(t.reservedHeightPx)&&t.reservedHeightPx>0?`${Math.ceil(t.reservedHeightPx)}px`:void 0;return i(d(i(d(i({"--markstream-code-font-family":o.fontFamily,"--markstream-code-padding-x":a,"--markstream-code-padding-y":`${o.padding}px`,"--markstream-code-padding-bottom":`${o.paddingBottom}px`,"--markstream-code-scrollbar-gutter":`${o.scrollbarGutter}px`,"--markstream-code-tab-size":String(o.tabSize)},z.value?{"--markstream-pre-diff-line-height":`${o.lineHeight}px`}:{}),{"--markstream-pre-line-number-top":`${o.padding}px`,"--markstream-pre-line-number-left":"0px","--markstream-pre-line-number-padding-left":"2ch","--markstream-pre-line-number-padding-right":"1ch","--markstream-pre-line-number-separator-width":"2px"}),Z.value.builtin?{"--markstream-code-theme-bg":Z.value.background,"--markstream-code-theme-fg":Z.value.foreground,"--markstream-code-theme-line-number":Z.value.lineNumber}:{}),{"--markstream-diff-added-line-fill":Z.value.diffAddedLine,"--markstream-diff-added-number-fill":Z.value.diffAddedNumber,"--markstream-diff-metadata-bg":Z.value.background,"--markstream-diff-metadata-fg":Z.value.lineNumber,"--markstream-diff-removed-line-fill":Z.value.diffRemovedLine,"--markstream-diff-removed-number-fill":Z.value.diffRemovedNumber,"--markstream-pre-resolved-theme-bg":Z.value.background,"--markstream-pre-resolved-theme-fg":Z.value.foreground,"--markstream-pre-resolved-theme-line-number":Z.value.lineNumber,"--markstream-pre-line-number-gap-to-code":a,"--markstream-diff-fallback-handoff-height":null!=r?r:"auto",backgroundColor:"var(--markstream-code-fallback-bg, var(--markstream-code-theme-bg, var(--markstream-pre-resolved-theme-bg)))",boxSizing:"border-box",color:"var(--markstream-code-fallback-fg, var(--markstream-code-theme-fg, var(--markstream-pre-resolved-theme-fg)))",fontFamily:o.fontFamily,fontSize:`${o.fontSize}px`,lineHeight:`${o.lineHeight}px`,margin:"0",maxHeight:`${o.maxHeight}px`,overflow:"auto",overflowX:"wrap"===o.overflow?"hidden":"auto",overflowY:"auto",paddingBottom:`${o.paddingBottom}px`,paddingLeft:M.value?"var(--markstream-code-padding-left)":a,paddingRight:a,paddingTop:`${o.padding}px`,scrollbarGutter:z.value?"auto":"stable",tabSize:o.tabSize,whiteSpace:"scroll"===o.overflow?"pre":"pre-wrap",overflowWrap:"wrap"===o.overflow?"anywhere":"normal",wordBreak:"normal",width:"100%"}),r?{height:r,minHeight:r,maxHeight:r}:{})});function ae(){return s(this,null,function*(){const e=String(null!=(a=null==(o=t.node)?void 0:o.code)?a:"");var o,a;try{yield function(e){return s(this,null,function*(){if("undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText)return void(yield navigator.clipboard.writeText(e));if("undefined"==typeof document||!document.body)throw new Error("Clipboard API is unavailable");const o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select();try{if(!document.execCommand("copy"))throw new Error("Clipboard copy command failed")}finally{o.remove()}})}(e),B.value=!0,l("copy",e),F&&clearTimeout(F),F=setTimeout(()=>{B.value=!1,F=void 0},1e3)}catch(r){B.value=!1,console.error("[markstream-vue] Failed to copy preformatted code.",r)}})}return P(()=>{F&&clearTimeout(F)}),(e,o)=>t.showToolbar?(p(),v("div",{key:0,style:y(ee.value),class:"code-block-container rounded-lg border"},[C(ge,{"show-header":t.showHeader,"show-copy-button":t.showCopyButton,"show-collapse-button":!1,"show-font-size-buttons":!1,"show-expand-button":!1,"show-preview-button":!1,"show-tooltips":t.showTooltips,"copy-text":B.value,stream:"",onCopy:ae},O({"header-left":S(()=>[f(e.$slots,"header-left",{},()=>[g("div",be,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:W.value},null,8,we),g("div",ke,[g("div",ye,b(G.value.title),1),G.value.caption?(p(),v("div",xe,b(G.value.caption),1)):w("",!0)])])])]),default:S(()=>[C(V,$({ref_key:"preNodeRef",ref:x},h.value,{class:oe.value,style:[k(c).style,te.value],node:t.node,loading:t.loading,"show-line-numbers":M.value,"diff-inline":L.value,"diff-hide-unchanged-regions":t.diffHideUnchangedRegions,"reserved-height-px":t.reservedHeightPx,"data-markstream-code-theme":Z.value.name}),null,16,["class","style","node","loading","show-line-numbers","diff-inline","diff-hide-unchanged-regions","reserved-height-px","data-markstream-code-theme"])]),_:2},[e.$slots["header-right"]?{name:"header-right",fn:S(()=>[f(e.$slots,"header-right")]),key:"0"}:void 0]),1032,["show-header","show-copy-button","show-tooltips","copy-text"])],4)):(p(),E(V,$({key:1,ref_key:"preNodeRef",ref:x},h.value,{class:oe.value,style:[k(c).style,te.value],node:t.node,loading:t.loading,"show-line-numbers":M.value,"diff-inline":L.value,"diff-hide-unchanged-regions":t.diffHideUnchangedRegions,"reserved-height-px":t.reservedHeightPx,"data-markstream-code-theme":Z.value.name}),null,16,["class","style","node","loading","show-line-numbers","diff-inline","diff-hide-unchanged-regions","reserved-height-px","data-markstream-code-theme"]))}}));export{Be as _,ge as a,Q as r};
|
package/dist/Tooltip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=(e,l,t)=>new Promise((n,a)=>{var i=e=>{try{r(t.next(e))}catch(l){a(l)}},o=e=>{try{r(t.throw(e))}catch(l){a(l)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,o);r((t=t.apply(e,l)).next())});import{defineComponent as l,ref as t,watch as n,nextTick as a,onBeforeUnmount as i,openBlock as o,createBlock as r,Teleport as u,createElementVNode as s,normalizeClass as v,createVNode as c,Transition as p,withCtx as f,withDirectives as d,normalizeStyle as h,createTextVNode as m,toDisplayString as y,vShow as x}from"vue";import{
|
|
1
|
+
var e=(e,l,t)=>new Promise((n,a)=>{var i=e=>{try{r(t.next(e))}catch(l){a(l)}},o=e=>{try{r(t.throw(e))}catch(l){a(l)}},r=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,o);r((t=t.apply(e,l)).next())});import{defineComponent as l,ref as t,watch as n,nextTick as a,onBeforeUnmount as i,openBlock as o,createBlock as r,Teleport as u,createElementVNode as s,normalizeClass as v,createVNode as c,Transition as p,withCtx as f,withDirectives as d,normalizeStyle as h,createTextVNode as m,toDisplayString as y,vShow as x}from"vue";import{G as b}from"./exports.js";const g=["id"],E=["data-placement"],w=/* @__PURE__ */b(/* @__PURE__ */l({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(l){var b;const w=l,M=t(null),$=t(null),_=t({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),k=t({}),B=t(null!=(b=w.placement)?b:"top"),P=t(!1);let X=null,Y=null,C=null,D=null,R=null,N=0;function j(){return D?Promise.resolve(D):(R||(R=import("@floating-ui/dom").then(e=>(D=e,e)).catch(e=>{throw R=null,e})),R)}function G(){X&&(X(),X=null),Y=null,C=null}function I(l){return e(this,null,function*(){const e=w.anchorEl,t=M.value;if(!w.visible||!e||!t)return;if(Y===e&&C===t)return;const{autoUpdate:n}=yield j();l()&&w.visible&&w.anchorEl===e&&M.value===t&&(G(),Y=e,C=t,X=n(e,t,()=>{T().catch(()=>{U()})}))})}function T(){return e(this,null,function*(){var e,l;const t=w.anchorEl,n=M.value;if(!w.visible||!t||!n)return!1;const{arrow:a,computePosition:i,flip:o,offset:r,shift:u}=yield j();if(!w.visible||w.anchorEl!==t||M.value!==n)return!1;const s=[r(null!=(e=w.offset)?e:6),o(),u({padding:6}),...$.value?[a({element:$.value,padding:4})]:[]],{x:v,y:c,placement:p,middlewareData:f}=yield i(t,n,{placement:null!=(l=w.placement)?l:"top",middleware:s,strategy:"fixed"});if(!w.visible||w.anchorEl!==t||M.value!==n)return!1;if(_.value.transform=`translate3d(${Math.round(v)}px, ${Math.round(c)}px, 0)`,_.value.left="0px",_.value.top="0px",B.value=p,f.arrow&&$.value){const{x:e,y:l}=f.arrow,t={top:"bottom",bottom:"top",left:"right",right:"left"}[p.split("-")[0]];k.value={left:null!=e?`${e}px`:"",top:null!=l?`${l}px`:"",[t]:"-3px"}}return!0})}function U(){var e,l;const t=w.anchorEl,n=M.value;if(!t||!n)return!1;const a=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=null!=(e=w.offset)?e:6,r=null!=(l=w.placement)?l:"top";let u=a.left,s=a.top;return"bottom"===r?s=a.bottom+o:"left"===r?u=a.left-i.width-o:"right"===r?u=a.right+o:s=a.top-i.height-o,_.value.transform=`translate3d(${Math.round(Math.max(0,u))}px, ${Math.round(Math.max(0,s))}px, 0)`,_.value.left="0px",_.value.top="0px",B.value=r,k.value={},!0}n(()=>w.visible,l=>e(null,null,function*(){const e=++N;if(l){if(P.value=!1,yield a(),e!==N||!w.visible)return;if(w.anchorEl&&M.value)try{const l=w.anchorEl,t=M.value,n=l.getBoundingClientRect();if(!(yield T())||e!==N||!w.visible||w.anchorEl!==l||M.value!==t)return;const i=_.value.transform;if(null!=w.originX&&null!=w.originY){const l=Math.abs(Number(w.originX)-n.left),t=Math.abs(Number(w.originY)-n.top);if(Math.hypot(l,t)>120){if(_.value.transform=`translate3d(${Math.round(w.originX)}px, ${Math.round(w.originY)}px, 0)`,yield a(),e!==N||!w.visible)return;if(P.value=!0,yield a(),e!==N||!w.visible)return;_.value.transform=i}else P.value=!0}else P.value=!0;yield I(()=>e===N)}catch(t){if(e!==N||!w.visible)return;if(P.value=U(),w.anchorEl&&M.value)try{yield I(()=>e===N)}catch(n){}}else P.value=!0}else P.value=!1,G()}));let q=0;return n([()=>w.anchorEl,()=>w.placement,()=>w.content],()=>e(null,null,function*(){const e=++q;if(w.visible&&w.anchorEl&&M.value){if(yield a(),e!==q||!w.visible||!w.anchorEl||!M.value)return;try{const l=yield T();if(e!==q||!w.visible||!w.anchorEl||!M.value)return;l||U()}catch(l){U()}yield I(()=>e===q)}})),i(()=>{N+=1,G()}),(e,t)=>(o(),r(u,{to:"body"},[s("div",{class:v(["markstream-vue",{dark:l.isDark}])},[c(p,{name:"tooltip",appear:""},{default:f(()=>[d(s("div",{id:w.id,ref_key:"tooltip",ref:M,style:h({position:"fixed",left:_.value.left,top:_.value.top,transform:_.value.transform,visibility:P.value?"visible":"hidden",pointerEvents:P.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[m(y(l.content)+" ",1),s("div",{ref_key:"arrowEl",ref:$,class:"tooltip-arrow","data-placement":B.value,style:h(k.value)},null,12,E)],12,g),[[x,l.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{w as default};
|