markstream-vue 1.0.3-beta.0 → 1.0.3-beta.1
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/README.md +9 -9
- package/README.zh-CN.md +10 -10
- package/dist/CodeBlockNode.js +1 -1
- package/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.js +0 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -31,14 +31,14 @@ Other packages:
|
|
|
31
31
|
|
|
32
32
|
## Packages
|
|
33
33
|
|
|
34
|
-
Start with the [framework overview](https://markstream.simonhe.me/frameworks
|
|
34
|
+
Start with the [framework overview](https://markstream.simonhe.me/frameworks) if you are choosing between packages.
|
|
35
35
|
|
|
36
36
|
| Package | Framework | Install | Docs |
|
|
37
37
|
| --- | --- | --- | --- |
|
|
38
|
-
| `markstream-vue` | Vue 3 / Nuxt / VitePress | `pnpm add markstream-vue` | [Framework overview](https://markstream.simonhe.me/frameworks
|
|
39
|
-
| `markstream-react` | React / Next.js / Remix | `pnpm add markstream-react` | [React landing](https://markstream.simonhe.me/frameworks/react
|
|
40
|
-
| `markstream-svelte` | Svelte 5 | `pnpm add markstream-svelte svelte@^5` | [Svelte landing](https://markstream.simonhe.me/frameworks/svelte
|
|
41
|
-
| `markstream-angular` | Angular standalone | `pnpm add markstream-angular` | [Angular landing](https://markstream.simonhe.me/frameworks/angular
|
|
38
|
+
| `markstream-vue` | Vue 3 / Nuxt / VitePress | `pnpm add markstream-vue` | [Framework overview](https://markstream.simonhe.me/frameworks) · [Vue landing](https://markstream.simonhe.me/frameworks/vue) · [Nuxt landing](https://markstream.simonhe.me/frameworks/nuxt) |
|
|
39
|
+
| `markstream-react` | React / Next.js / Remix | `pnpm add markstream-react` | [React landing](https://markstream.simonhe.me/frameworks/react) · [Next.js landing](https://markstream.simonhe.me/frameworks/next) |
|
|
40
|
+
| `markstream-svelte` | Svelte 5 | `pnpm add markstream-svelte svelte@^5` | [Svelte landing](https://markstream.simonhe.me/frameworks/svelte) · [Quick start](https://markstream.simonhe.me/guide/svelte) |
|
|
41
|
+
| `markstream-angular` | Angular standalone | `pnpm add markstream-angular` | [Angular landing](https://markstream.simonhe.me/frameworks/angular) · [Quick start](https://markstream.simonhe.me/guide/angular-quick-start) |
|
|
42
42
|
| `markstream-vue2` | Vue 2.6 / 2.7 | `pnpm add markstream-vue2` | [Vue 2 guide](https://markstream.simonhe.me/guide/vue2-quick-start) |
|
|
43
43
|
| `stream-markdown-parser` | Any JS/TS app | `pnpm add stream-markdown-parser` | [Parser guide](https://markstream.simonhe.me/guide/parser-api) |
|
|
44
44
|
| `markstream-core` | Framework-agnostic | `pnpm add markstream-core` | [Core package](./packages/markstream-core/README.md) |
|
|
@@ -86,7 +86,7 @@ For the full release contract and Go / No-Go checklist, see [1.0 Release Readine
|
|
|
86
86
|
- [Star History](#star-history)
|
|
87
87
|
- [License](#license)
|
|
88
88
|
|
|
89
|
-
> 📖 Framework overview, docs, API, and advanced usage: https://markstream.simonhe.me/frameworks
|
|
89
|
+
> 📖 Framework overview, docs, API, and advanced usage: https://markstream.simonhe.me/frameworks
|
|
90
90
|
|
|
91
91
|
## TL;DR Highlights
|
|
92
92
|
|
|
@@ -100,7 +100,7 @@ For the full release contract and Go / No-Go checklist, see [1.0 Release Readine
|
|
|
100
100
|
|
|
101
101
|
| If you want to... | Start here | Then go to |
|
|
102
102
|
| --- | --- | --- |
|
|
103
|
-
| get the first render on screen | [Framework overview](https://markstream.simonhe.me/frameworks
|
|
103
|
+
| get the first render on screen | [Framework overview](https://markstream.simonhe.me/frameworks) | [Quick Starts](#-quick-starts) |
|
|
104
104
|
| integrate it into a docs site or VitePress theme | [Docs Site & VitePress](https://markstream.simonhe.me/guide/vitepress-docs-integration) | [Custom Tags & Advanced Components](https://markstream.simonhe.me/guide/custom-components) |
|
|
105
105
|
| build an AI chat UI or SSE stream | [AI Chat & Streaming](https://markstream.simonhe.me/guide/ai-chat-streaming) | [Performance](https://markstream.simonhe.me/guide/performance) |
|
|
106
106
|
| replace one built-in renderer | [Override Built-in Components](https://markstream.simonhe.me/guide/component-overrides) | [Renderer & Node Components](https://markstream.simonhe.me/guide/components) |
|
|
@@ -119,7 +119,7 @@ For the full release contract and Go / No-Go checklist, see [1.0 Release Readine
|
|
|
119
119
|
| Vue 2 | https://markstream-vue2.pages.dev/ |
|
|
120
120
|
|
|
121
121
|
- Shareable Vue 3 test page: https://markstream-vue.simonhe.me/test
|
|
122
|
-
- Framework docs: https://markstream.simonhe.me/frameworks
|
|
122
|
+
- Framework docs: https://markstream.simonhe.me/frameworks
|
|
123
123
|
- Showcase: https://markstream.simonhe.me/guide/showcase
|
|
124
124
|
- 1.0 benchmark report: run `pnpm benchmark:1.0`
|
|
125
125
|
- LLM recommendation context: https://markstream.simonhe.me/llms.txt
|
|
@@ -209,7 +209,7 @@ export function Message({ content, isDone }: { content: string, isDone: boolean
|
|
|
209
209
|
}
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
For live SSE/WebSocket surfaces in Next.js, use root `markstream-react` inside a `'use client'` component. For SSR-first or server-only Markdown, start from the [Next.js guide](https://markstream.simonhe.me/frameworks/next
|
|
212
|
+
For live SSE/WebSocket surfaces in Next.js, use root `markstream-react` inside a `'use client'` component. For SSR-first or server-only Markdown, start from the [Next.js guide](https://markstream.simonhe.me/frameworks/next).
|
|
213
213
|
|
|
214
214
|
### Svelte 5
|
|
215
215
|
|
package/README.zh-CN.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Markstream 专为在用户眼前持续变化的 Markdown 场景而构建:LLM token 流、SSE/WebSocket 输出、AI 聊天消息、长文档、渐进式 Mermaid 图表、KaTeX 数学公式、流式代码块以及安全的组件化渲染。
|
|
6
6
|
|
|
7
7
|
[](README.md)
|
|
8
|
-
[](https://markstream.simonhe.me/zh/guide
|
|
8
|
+
[](https://markstream.simonhe.me/zh/guide)
|
|
9
9
|
[](https://markstream-vue.simonhe.me/)
|
|
10
10
|
[](https://markstream-vue.simonhe.me/test)
|
|
11
11
|
|
|
@@ -31,14 +31,14 @@ Vue 包:
|
|
|
31
31
|
|
|
32
32
|
## 包矩阵
|
|
33
33
|
|
|
34
|
-
如果你还在选择框架包,先看 [框架总览](https://markstream.simonhe.me/zh/frameworks
|
|
34
|
+
如果你还在选择框架包,先看 [框架总览](https://markstream.simonhe.me/zh/frameworks)。
|
|
35
35
|
|
|
36
36
|
| 包 | 框架 | 安装 | 文档 |
|
|
37
37
|
| --- | --- | --- | --- |
|
|
38
|
-
| `markstream-vue` | Vue 3 / Nuxt / VitePress | `pnpm add markstream-vue` | [框架总览](https://markstream.simonhe.me/zh/frameworks
|
|
39
|
-
| `markstream-react` | React / Next.js / Remix | `pnpm add markstream-react` | [React 指南](https://markstream.simonhe.me/zh/frameworks/react
|
|
40
|
-
| `markstream-svelte` | Svelte 5 | `pnpm add markstream-svelte svelte@^5` | [Svelte 指南](https://markstream.simonhe.me/zh/frameworks/svelte
|
|
41
|
-
| `markstream-angular` | Angular standalone | `pnpm add markstream-angular` | [Angular 指南](https://markstream.simonhe.me/zh/frameworks/angular
|
|
38
|
+
| `markstream-vue` | Vue 3 / Nuxt / VitePress | `pnpm add markstream-vue` | [框架总览](https://markstream.simonhe.me/zh/frameworks) · [Vue 指南](https://markstream.simonhe.me/zh/frameworks/vue) · [Nuxt 指南](https://markstream.simonhe.me/zh/frameworks/nuxt) |
|
|
39
|
+
| `markstream-react` | React / Next.js / Remix | `pnpm add markstream-react` | [React 指南](https://markstream.simonhe.me/zh/frameworks/react) · [Next.js 指南](https://markstream.simonhe.me/zh/frameworks/next) |
|
|
40
|
+
| `markstream-svelte` | Svelte 5 | `pnpm add markstream-svelte svelte@^5` | [Svelte 指南](https://markstream.simonhe.me/zh/frameworks/svelte) |
|
|
41
|
+
| `markstream-angular` | Angular standalone | `pnpm add markstream-angular` | [Angular 指南](https://markstream.simonhe.me/zh/frameworks/angular) |
|
|
42
42
|
| `markstream-vue2` | Vue 2.6 / 2.7 | `pnpm add markstream-vue2` | [Vue 2 指南](https://markstream.simonhe.me/zh/guide/vue2-quick-start) |
|
|
43
43
|
| `stream-markdown-parser` | 任意 JS/TS 应用 | `pnpm add stream-markdown-parser` | [解析器指南](https://markstream.simonhe.me/zh/guide/parser-api) |
|
|
44
44
|
| `markstream-core` | 框架无关 | `pnpm add markstream-core` | [Core 包](./packages/markstream-core/README.md) |
|
|
@@ -83,7 +83,7 @@ Vue 包:
|
|
|
83
83
|
- [许可](#许可)
|
|
84
84
|
|
|
85
85
|
> 📖 框架总览、详细文档、API、示例和高级用法:
|
|
86
|
-
> https://markstream.simonhe.me/frameworks
|
|
86
|
+
> https://markstream.simonhe.me/frameworks
|
|
87
87
|
|
|
88
88
|
## 速览
|
|
89
89
|
|
|
@@ -97,7 +97,7 @@ Vue 包:
|
|
|
97
97
|
|
|
98
98
|
| 如果你现在想做的是... | 先看这里 | 然后看 |
|
|
99
99
|
| --- | --- | --- |
|
|
100
|
-
| 先把第一段渲染跑起来 | [框架总览](https://markstream.simonhe.me/zh/frameworks
|
|
100
|
+
| 先把第一段渲染跑起来 | [框架总览](https://markstream.simonhe.me/zh/frameworks) | [快速上手](#-快速上手) |
|
|
101
101
|
| 接到文档站或 VitePress 主题里 | [文档站与 VitePress 集成](https://markstream.simonhe.me/zh/guide/vitepress-docs-integration) | [自定义标签与高级组件](https://markstream.simonhe.me/zh/guide/custom-components) |
|
|
102
102
|
| 做 AI 聊天界面或 SSE 流式输出 | [AI 聊天与流式输出](https://markstream.simonhe.me/zh/guide/ai-chat-streaming) | [性能](https://markstream.simonhe.me/zh/guide/performance) |
|
|
103
103
|
| 替换一个内置节点渲染器 | [覆盖内置组件](https://markstream.simonhe.me/zh/guide/component-overrides) | [渲染器与节点组件](https://markstream.simonhe.me/zh/guide/components) |
|
|
@@ -116,7 +116,7 @@ Vue 包:
|
|
|
116
116
|
| Vue 2 | https://markstream-vue2.pages.dev/ |
|
|
117
117
|
|
|
118
118
|
- Vue 3 交互测试页(可分享链接,便于复现): https://markstream-vue.simonhe.me/test
|
|
119
|
-
- 中文框架文档: https://markstream.simonhe.me/zh/frameworks
|
|
119
|
+
- 中文框架文档: https://markstream.simonhe.me/zh/frameworks
|
|
120
120
|
- Showcase: https://markstream.simonhe.me/zh/guide/showcase
|
|
121
121
|
- 1.0 benchmark 报告:`pnpm benchmark:1.0`
|
|
122
122
|
- LLM 推荐上下文(中文): https://markstream.simonhe.me/llms.zh-CN.txt
|
|
@@ -206,7 +206,7 @@ export function Message({ content, isDone }: { content: string, isDone: boolean
|
|
|
206
206
|
}
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Next.js 的实时 SSE/WebSocket 区域用 root `markstream-react` 放在 `'use client'` 组件里;SSR-first 或 server-only Markdown 看 [Next.js 指南](https://markstream.simonhe.me/zh/frameworks/next
|
|
209
|
+
Next.js 的实时 SSE/WebSocket 区域用 root `markstream-react` 放在 `'use client'` 组件里;SSR-first 或 server-only Markdown 看 [Next.js 指南](https://markstream.simonhe.me/zh/frameworks/next)。
|
|
210
210
|
|
|
211
211
|
### Svelte 5
|
|
212
212
|
|
package/dist/CodeBlockNode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(n,t,l)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[t]=l,a=(e,n)=>{for(var t in n||(n={}))o.call(n,t)&&r(e,t,n[t]);if(l)for(var t of l(n))i.call(n,t)&&r(e,t,n[t]);return e},u=(e,l)=>n(e,t(l)),d=(e,n,t)=>new Promise((l,o)=>{var i=e=>{try{a(t.next(e))}catch(n){o(n)}},r=e=>{try{a(t.throw(e))}catch(n){o(n)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);a((t=t.apply(e,n)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as g,normalizeClass as y,withModifiers as w,toDisplayString as b,unref as S,useAttrs as k,inject as x,getCurrentInstance as C,ref as M,watch as P,onBeforeUnmount as B,nextTick as E,createElementBlock as O,normalizeStyle as L,createVNode as F,createSlots as H,withCtx as N,withDirectives as z,createCommentVNode as $,vShow as R,renderSlot as D}from"vue";import{ap as T,y as W,ah as _,ar as A,a9 as j,z as I,am as q}from"./exports.js";import{M as U,e as V,n as G,c as J,l as X,g as Y,i as K}from"./index2.js";import{safeRaf as Q,safeCancelRaf as Z}from"./utils/safeRaf.js";import{_ as ee}from"./CodeBlockShell.vue_vue_type_style_index_0_lang.js";import{getUseMonaco as ne}from"./monaco.js";const te={class:"html-preview-frame__header"},le={class:"html-preview-frame__title"},oe={class:"html-preview-frame__label"},ie=["sandbox","srcdoc"],re=/* @__PURE__ */W(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const n=e,t=void 0!==import.meta&&Boolean(!1);let l=null;const{t:o}=T(),i=c(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),r=c(()=>{return e=n.htmlPreviewSandbox,o=n.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!t||"undefined"==typeof console||l===e)return;const n=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);n.has("allow-scripts")&&n.has("allow-same-origin")&&(l=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 a(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",a)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",a)}),(e,t)=>(m(),p(h,{to:"body"},[g("div",{class:y(["markstream-vue",{dark:n.isDark}])},[g("div",{class:"html-preview-frame__backdrop",onClick:t[2]||(t[2]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})},[g("div",{class:"html-preview-frame",onClick:t[1]||(t[1]=w(()=>{},["stop"]))},[g("div",te,[g("div",le,[t[3]||(t[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",oe,b(n.title||S(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=n.onClose)?void 0:t.call(n)})}," × ")]),g("iframe",{class:"html-preview-frame__iframe",sandbox:r.value,referrerpolicy:"no-referrer",srcdoc:i.value},null,8,ie)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]);let ae=null,ue=null,de=null,se=null,ce=null,ve=null;const fe=/* @__PURE__ */new WeakMap;let me=0;const pe=["data-markstream-enhanced","data-markstream-pending"],he={class:"code-header-main"},ge=["innerHTML"],ye={class:"code-header-copy"},we={class:"code-header-title"},be={key:0,class:"code-header-caption"},Se={class:"code-editor-layer"},ke="__markstreamMonacoPassiveTouchState__",xe=1.5,Ce=/* @__PURE__ */W(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},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:{}},emits:["previewCode","copy"],setup(e,{emit:n}){var t;const l=e,o=n,i=k(),r=x(U,null),s=x("markstreamHostScrollManaged",null),v=c(()=>_(l,i));const h=C(),w=c(()=>{const e=null==h?void 0:h.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:W}=T(),te=M(null),le=M(null),oe=M(!1),ie=M(nl(l.node.language,l.node.code,el())),Ce=c(()=>V(ie.value)),Me=c(()=>"plaintext"===Ce.value),Pe=M(!1),Be=M(!1),Ee=M(!1),Oe=M(!1),Le=M(!1),Fe=M(!1);let He=!1,Ne=null,ze="";const $e=M(null),Re=M(null);let De=0,Te=0;const We=A(),_e=M(null),Ae=M("undefined"==typeof window);"undefined"!=typeof window&&P(()=>le.value,e=>{var n;if(null==(n=_e.value)||n.destroy(),_e.value=null,!e)return void(Ae.value=!1);const t=We(e,{rootMargin:"400px"});_e.value=t,Ae.value=t.isVisible.value,t.whenVisible.then(()=>{Ae.value=!0})},{immediate:!0}),B(()=>{var e;He=!0,function(){const e=ze;r&&e&&(ze="",r.markSettled(e))}(),null==(e=_e.value)||e.destroy(),_e.value=null});let je=null,Ie=null,qe=()=>{},Ue=()=>{},Ve=()=>null,Ge=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Je=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Xe=()=>{},Ye=()=>{},Ke=()=>{},Qe=null,Ze=null,en=()=>{var e;return String(null!=(e=l.node.language)?e:"plaintext")},nn=()=>d(null,null,function*(){}),tn=!1;const ln=[],on=[];let rn=null;function an(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}const un=c(()=>{var e;return!0===l.node.diff||an(l.node.language)||an(ol(String(null!=(e=l.node.raw)?e:"")))}),dn=M({removed:0,added:0}),sn=c(()=>`-${dn.value.removed} +${dn.value.added}`),cn=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5}),vn=Object.freeze(u(a({},cn),{enabled:!1,revealLineCount:0}));function fn(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return u(a(a({},cn),t),{enabled:null==(n=t.enabled)||n})}return a({},cn)}function mn(e,n){return{original:pn(e,!1),updated:pn(n,!1)}}function pn(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function hn(e){var n;return String(null!=(n=null==e?void 0:e.message)?n:e).includes("no diff result available")}function gn(){try{const e=Ke();e&&"function"==typeof e.catch&&e.catch(e=>{hn(e)})}catch(e){hn(e)}}const yn=c(()=>{var e,n,t,o;const i=l.monacoOptions?a({},l.monacoOptions):{};if(!un.value)return i;const r=void 0===i.diffHideUnchangedRegions?a({},cn):fn(i.diffHideUnchangedRegions),d=void 0===i.hideUnchangedRegions?void 0:fn(i.hideUnchangedRegions),s=!1!==l.stream&&!1!==l.loading,c=s?a({},vn):r,v=s?a({},vn):d,f=function(e){return void 0!==e.diffWordWrap?e.diffWordWrap:"off"}(i),m=a({},null!=(e=i.experimental)?e:{}),p=null!=(n=i.diffUnchangedRegionStyle)?n:"line-info",h={maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffWordWrap:f,renderSideBySide:null==(t=i.renderSideBySide)||t,diffHideUnchangedRegions:c,useInlineViewWhenSpaceIsLimited:null!=(o=i.useInlineViewWhenSpaceIsLimited)&&o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:p,diffHunkActionsOnHover:!1,experimental:m};return u(a(u(a(a({},h),i),{experimental:m}),void 0===v?{}:{hideUnchangedRegions:v}),{diffHideUnchangedRegions:c,diffWordWrap:f})}),wn=c(()=>un.value?"diff":"single"),bn=M(wn.value),Sn=M(!1),kn=M(!1),xn=M(!1),Cn=M(!1),Mn=M(!1);let Pn=null;const Bn=c(()=>{var e,n,t;if(un.value){const t=null==(e=yn.value)?void 0:e.diffWordWrap;if("inherit"===t){const e=null==(n=l.monacoOptions)?void 0:n.wordWrap;return null==e||"off"!==String(e)}return"on"===t}const o=null==(t=l.monacoOptions)?void 0:t.wordWrap;return null==o||"off"!==String(o)}),En=c(()=>{var e,n,t,l,o,i;if(!un.value)return!1;if(!1===(null==(e=yn.value)?void 0:e.renderSideBySide))return!0;if(!0!==(null==(n=yn.value)?void 0:n.useInlineViewWhenSpaceIsLimited))return!1;const r=null==(t=yn.value)?void 0:t.renderSideBySideInlineBreakpoint,a="number"==typeof r&&Number.isFinite(r)?r:900,u=(null==(o=null==(l=le.value)?void 0:l.getBoundingClientRect)?void 0:o.call(l).width)||(null==(i=le.value)?void 0:i.clientWidth)||("undefined"==typeof window?0:window.innerWidth);return u>0&&u<=a});function On(e){return!0===(null==s?void 0:s.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 Ln=c(()=>On(le.value)),Fn=c(()=>!Sn.value&&(!!xn.value||(un.value||Ln.value||!K())&&!kn.value)),Hn=c(()=>Fn.value||Cn.value),Nn=c(()=>Fn.value&&!Cn.value),zn=c(()=>!Sn.value&&!xn.value&&(Fn.value||Cn.value||Mn.value)),$n=M(!1),Rn=c(()=>pn(l.node.code,!0===l.node.loading)),Dn=c(()=>un.value?!0===l.node.diff?l.node:u(a({},l.node),{diff:!0}):Rn.value===l.node.code?l.node:u(a({},l.node),{code:Rn.value}));"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield ne();if(He)return;if(!e)return void(Sn.value=!0);const n=e.useMonaco,t=e.detectLanguage;if("function"==typeof t&&(en=t),"function"==typeof n){const e=Sl();if(e&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(e))throw new Error("Preferred theme not in provided themes array");rn=Ml();const t=n(rn);je=t.createEditor||je,Ie=t.createDiffEditor||Ie,qe=t.updateCode||qe,Ue=t.updateDiff||Ue,Ve=t.getEditor||Ve,Ge=t.getEditorView||Ge,Je=t.getDiffEditorView||Je,Xe=t.cleanupEditor||Xe,Ye=t.safeClean||t.cleanupEditor||Ye,Ke=t.refreshDiffPresentation||Ke,nn=t.setTheme||nn,Fe.value=!0,!He&&te.value&&(yield hl(te.value))}}catch(e){if(He)return;Sn.value=!0}});const Tn=M("number"==typeof(null==(t=l.monacoOptions)?void 0:t.fontSize)?l.monacoOptions.fontSize:Number.NaN),Wn=M(Tn.value),_n=M(null),An=M(null),jn=c(()=>{const e=Tn.value,n=Wn.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),In=c(()=>{var e;const n=_n.value;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=null==(e=l.monacoOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const o=Wn.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),qn=c(()=>{var e;const n=An.value;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=null==(e=l.monacoOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12===In.value?18:Math.max(12,Math.round(1.5*In.value))}),Un=c(()=>qn.value);function Vn(e){const n=String(null!=e?e:"");return n?Math.max(1,n.split(/\r\n|\n|\r/).length):1}function Gn(e){return e.startsWith("-")&&!e.startsWith("---")}function Jn(e){return e.startsWith("+")&&!e.startsWith("+++")}const Xn=c(()=>En.value?function(){var e,n,t;const o=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(o.some(e=>Gn(e)||Jn(e)))return Math.max(1,o.length);const i=String(null!=(n=l.node.originalCode)?n:"").split(/\r\n|\n|\r/),r=String(null!=(t=l.node.updatedCode)?t:"").split(/\r\n|\n|\r/);let a=0,u=i.length-1,d=r.length-1;for(;a<=u&&a<=d&&i[a]===r[a];)a++;let s=0;for(;u>=a&&d>=a&&i[u]===r[d];)s++,u--,d--;const c=Math.max(0,u-a+1),v=Math.max(0,d-a+1);return Math.max(1,a+c+v+s)}():function(){var e;const n=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(!n.some(e=>Gn(e)||Jn(e))&&(null!=l.node.originalCode||null!=l.node.updatedCode))return Math.max(Vn(l.node.originalCode),Vn(l.node.updatedCode));let t=0,o=0;for(const l of n)Gn(l)?t++:(Jn(l)||t++,o++);return Math.max(1,t,o)}()),Yn=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.tabSize;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:4}),Kn=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.padding;return{top:"number"==typeof(null==n?void 0:n.top)&&Number.isFinite(n.top)&&n.top>0?n.top:0,bottom:"number"==typeof(null==n?void 0:n.bottom)&&Number.isFinite(n.bottom)&&n.bottom>0?n.bottom:0}}),Qn=c(()=>{const e=l.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function Zn(e){if(null==e)return null;const n=Math.ceil(e);return!Number.isFinite(n)||n<=0?null:Math.min(n,Math.ceil(Qt()))}const et=c(()=>un.value?Math.ceil(Xn.value*Un.value):null!=Qn.value?null:Math.ceil((e=>{const n=String(null!=e?e:"");return n?Math.max(1,n.split(/\r\n|\n|\r/).length):1})(Rn.value)*(qn.value+xe)+1)),nt=c(()=>{if(un.value){const e=et.value,n=at();return Zn(null!=n&&null!=e?Math.max(e,n):null!=n?n:e)}const e=Qn.value;return Zn(null!=e?e:et.value)}),tt=c(()=>{const e=l.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),lt=M(null),ot=M(null);function it(){const e=lt.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function rt(){return un.value&&!1!==l.stream&&(!1!==l.loading||Fn.value||Cn.value||Mn.value)}function at(){if(!rt())return null;const e=ot.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function ut(e){if(!rt()||null==e)return;const n=Math.min(Math.ceil(e),Math.ceil(Qt()));if(!Number.isFinite(n)||n<=0)return;const t=at();ot.value=null==t?n:Math.max(t,n)}const dt=c(()=>{const e=it();return null!=e?e:Fn.value||!kn.value?nt.value:null}),st=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.fontFamily,t=Zn(Qn.value),o=Zn(et.value),i=a(a({fontSize:`${In.value}px`,lineHeight:`${Un.value}px`,tabSize:Yn.value,boxSizing:"border-box",maxHeight:`${Qt()}px`,overflow:"auto",paddingTop:`${Kn.value.top}px`,paddingBottom:`${Kn.value.bottom}px`},un.value?function(e){if(null==e)return{};const n=Math.ceil(e),t=Math.ceil(Qt()),l=Math.min(n,t);return n>=t?{height:`${l}px`,minHeight:`${l}px`}:{minHeight:`${n}px`}}(nt.value):null!=t?{height:`${t}px`,minHeight:`${t}px`}:null!=o?{minHeight:`${o}px`}:{}),"string"==typeof n&&n.trim()?{"--markstream-code-font-family":n.trim()}:{});return i["--markstream-pre-line-number-top"]=`${Kn.value.top}px`,i["--markstream-code-padding-left"]="62px",i["--markstream-pre-line-number-width"]="36px",i["--markstream-pre-line-number-gap"]="0px",un.value&&(i["--markstream-pre-diff-line-height"]=`${Un.value}px`),i}),ct=c(()=>null!=dt.value&&(!kn.value||null!=it())),vt=c(()=>{const e=dt.value;if(null==e)return null;if(un.value)return Math.ceil(e);const n=tt.value,t=Qn.value;if(null==n||null==t)return Math.ceil(e);const l=Math.max(0,Math.ceil(n)-Math.ceil(t));return Math.ceil(e+l)}),ft=c(()=>{if(un.value&&Fn.value)return;const e=dt.value;return ct.value&&null!=e?{minHeight:`${e}px`}:void 0});function mt(){null!=Pn&&"undefined"!=typeof window&&window.clearTimeout(Pn),Pn=null}function pt(){if(!un.value)return!1;if(!Le.value||!kn.value)return!1;if(Cn.value||Mn.value)return!1;const e=te.value;return!!e&&Ft(e)}function ht(e,n=!1,t={}){const l=Math.ceil(e),o=it();if(null==o)return l;const i=!0===t.allowBelowEstimatedFloor||pt();return l>=o||i?((n||i)&&Le.value&&(lt.value=null),l):o}function gt(){return new Promise(e=>{Q(()=>e())})}function yt(){try{const e=te.value;if(!e)return null;const n=e.querySelector(".view-lines .view-line");if(n){const e=Math.ceil(n.getBoundingClientRect().height);if(e>0)return e}}catch(e){}return null}function wt(){var e,n,t,l,o;try{const i=un.value?null!=(t=null==(n=null==(e=Je())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Je():Ge(),r=Ve(),a=null==(l=null==r?void 0:r.EditorOption)?void 0:l.fontInfo;if(i&&null!=a){const e=null==(o=i.getOption)?void 0:o.call(i,a),n=null==e?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n}}catch(i){}try{const e=te.value;if(e){const n=e.querySelector(".view-lines .view-line");if(n)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(n).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(i){}}}catch(i){}return null}function bt(e){var n,t;try{const l=Ve(),o=null==(n=null==l?void 0:l.EditorOption)?void 0:n.lineHeight;if(null!=o){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o);if("number"==typeof n&&n>0)return n}}catch(i){}const l=yt();if(l&&l>0)return l;const o=Number.isFinite(Wn.value)&&Wn.value>0?Wn.value:14;return Math.max(12,Math.round(1.35*o))}function St(e){var n,t,l;try{const l=Ve(),o=null==(n=null==l?void 0:l.EditorOption)?void 0:n.padding;if(null!=o){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o),l="number"==typeof(null==n?void 0:n.top)?n.top:0,i="number"==typeof(null==n?void 0:n.bottom)?n.bottom:0;if(l>0||i>0)return l+i}}catch(a){}const o=null==(l=yn.value)?void 0:l.padding,i="number"==typeof(null==o?void 0:o.top)?o.top:0,r="number"==typeof(null==o?void 0:o.bottom)?o.bottom:0;return i>0||r>0?i+r:un.value?24:0}function kt(e,n){return"number"!=typeof e||"number"!=typeof n||e<1||n<e?0:n-e+1}function xt(e){if(!e)return[];const n=e.split(/\r?\n/);return 1===n.length&&""===n[0]?[]:n}function Ct(){var e,n;un.value?dn.value=function(e,n){const t=xt(e),l=xt(n);let o=0,i=t.length-1,r=l.length-1;for(;o<=i&&o<=r&&t[o]===l[o];)o++;for(;i>=o&&r>=o&&t[i]===l[r];)i--,r--;return{removed:Math.max(0,i-o+1),added:Math.max(0,r-o+1)}}(String(null!=(e=l.node.originalCode)?e:""),String(null!=(n=l.node.updatedCode)?n:"")):dn.value={removed:0,added:0}}function Mt(){var e;if(un.value)try{const n=Je(),t=null==(e=null==n?void 0:n.getLineChanges)?void 0:e.call(n);if(!Array.isArray(t))return void Ct();let l=0,o=0;for(const e of t)l+=kt(e.originalStartLineNumber,e.originalEndLineNumber),o+=kt(e.modifiedStartLineNumber,e.modifiedEndLineNumber);dn.value={removed:l,added:o}}catch(n){Ct()}else dn.value={removed:0,added:0}}function Pt(){var e;if(Number.isFinite(Wn.value)&&Wn.value>0&&Number.isFinite(Tn.value))return Wn.value;const n=wt();return"number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?(Tn.value=l.monacoOptions.fontSize,Wn.value=l.monacoOptions.fontSize,Wn.value):n&&n>0?(Tn.value=n,Wn.value=n,n):(Tn.value=12,Wn.value=12,12)}function Bt(){const e=Pt(),n=Math.min(36,e+1);Wn.value=n}function Et(){const e=Pt(),n=Math.max(10,e-1);Wn.value=n}function Ot(){Pt(),Number.isFinite(Tn.value)&&(Wn.value=Tn.value)}function Lt(){var e,n,t,l,o,i,r,a,u,d,s,c,v,f;try{const m=un.value?Je():null,p=un.value?m:Ge();if(!p)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(n=m.getModifiedEditor)?void 0:n.call(m);null==(t=null==v?void 0:v.layout)||t.call(v),null==(l=null==f?void 0:f.layout)||l.call(f);const p=(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(p,h);if(g>0)return Math.ceil(g+1);const y=(null==(u=null==(a=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:a.getLineCount)?void 0:u.call(a))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(y,w),S=Math.max(bt(v),bt(f));return Math.ceil(b*(S+xe)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(f=null==p?void 0:p.getModel)?void 0:f.call(p);let g=1;h&&"function"==typeof h.getLineCount&&(g=h.getLineCount());const y=bt(p);return Math.ceil(g*(y+xe)+0+1)}catch(m){return null}}function Ft(e){if("undefined"==typeof window)return!1;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return!1;const t=e.querySelectorAll(".editor.modified .diff-hidden-lines .center, .stream-monaco-diff-unchanged-bridge");for(const l of Array.from(t)){if(!(l instanceof HTMLElement))continue;const e=window.getComputedStyle(l);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const t=l.getBoundingClientRect();if(!(t.width<=0||t.height<=0||t.bottom<=n.top||t.top>=n.bottom))return!0}return!1}function Ht(e){var n;const t=String(null!=e?e:"").trim(),l=null==(n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:n[1];if(l){const e=3===l.length?l.split("").map(e=>`${e}${e}`).join(""):l;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,r,a]=o.slice(0,3).map(Number);return.2126*i+.7152*r+.0722*a}function Nt(){var e;const n=null==(e=te.value)?void 0:e.parentElement;return n instanceof HTMLElement?n:null}function zt(e,n){var t;null==n||!Number.isFinite(n)||n<=0||null==(t=Nt())||t.style.setProperty(e,`${n}px`)}function $t(){var e,n,t;if(Rt())return;const l=wt();l&&l>0&&(_n.value=l,Wn.value=l,Tn.value=l);try{const l=bt(un.value?null!=(t=null==(n=null==(e=Je())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Je():Ge());l&&l>0&&(An.value=l)}catch(o){}try{const e=yt();e&&e>0&&(An.value=e)}catch(o){}}function Rt(){return un.value&&Hn.value}function Dt(){var e,n,t,l,o,i,r,a;const u=te.value,d=le.value;if(!u||!d)return;const s=u,c=u.querySelector(".monaco-editor")||u,v=c.querySelector(".monaco-editor-background")||c,f=c.querySelector(".view-lines")||c;let m=null,p=null,h=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(c),p=v===c?m:window.getComputedStyle(v),h=f===c?m:window.getComputedStyle(f))}catch(k){m=null,p=null,h=null}const g=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),y=String(null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?n:"").trim(),w=String(null!=(l=null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?t:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?l:"").trim(),b=g||String(null!=(i=null!=(o=null==h?void 0:h.color)?o:null==m?void 0:m.color)?i:"").trim(),S=y||String(null!=(a=null!=(r=null==p?void 0:p.backgroundColor)?r:null==m?void 0:m.backgroundColor)?a:"").trim();return un.value?(b?(d.style.setProperty("--markstream-diff-editor-fg",b),s.style.setProperty("--vscode-editor-foreground",b),s.style.setProperty("--stream-monaco-editor-fg",b)):(d.style.removeProperty("--markstream-diff-editor-fg"),s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--stream-monaco-editor-fg")),S?(d.style.setProperty("--markstream-diff-editor-bg",S),d.style.setProperty("--markstream-diff-panel-bg",S),d.style.setProperty("--markstream-diff-panel-bg-soft",S),d.style.setProperty("--markstream-diff-panel-bg-strong",S),s.style.setProperty("--vscode-editor-background",S),s.style.setProperty("--stream-monaco-editor-bg",S),s.style.setProperty("--stream-monaco-fixed-editor-bg",S),s.style.setProperty("--stream-monaco-panel-bg",S),s.style.setProperty("--stream-monaco-panel-bg-soft",S),s.style.setProperty("--stream-monaco-panel-bg-strong",S),s.style.backgroundColor=S):(d.style.removeProperty("--markstream-diff-editor-bg"),d.style.removeProperty("--markstream-diff-panel-bg"),d.style.removeProperty("--markstream-diff-panel-bg-soft"),d.style.removeProperty("--markstream-diff-panel-bg-strong"),s.style.removeProperty("--vscode-editor-background"),s.style.removeProperty("--stream-monaco-editor-bg"),s.style.removeProperty("--stream-monaco-fixed-editor-bg"),s.style.removeProperty("--stream-monaco-panel-bg"),s.style.removeProperty("--stream-monaco-panel-bg-soft"),s.style.removeProperty("--stream-monaco-panel-bg-strong"),s.style.backgroundColor=""),void(w?s.style.setProperty("--vscode-editor-selectionBackground",w):s.style.removeProperty("--vscode-editor-selectionBackground"))):function(e,n,t){if(!Me.value)return!1;const l=Ht(e),o=Ht(n);return t?null!=l&&l>170||null!=o&&o<110:null!=l&&l<85||null!=o&&o>190}(S,b,d.classList.contains("is-dark"))?(s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--vscode-editor-background"),void s.style.removeProperty("--vscode-editor-selectionBackground")):(b&&s.style.setProperty("--vscode-editor-foreground",b),S&&s.style.setProperty("--vscode-editor-background",S),void(w&&s.style.setProperty("--vscode-editor-selectionBackground",w)))}let Tt=0,Wt=0;const _t=/auto|scroll|overlay/i;function At(e,n,t){var l;if("undefined"==typeof window)return;if(un.value)return;if(function(e){return Ln.value||On(e)}(e))return;const o=Math.ceil(n),i=Math.ceil(t)-o;if(Math.abs(i)<=1)return;const r=function(e){var n,t;if("undefined"==typeof window)return null;const l=null!=(n=null==e?void 0:e.ownerDocument)?n:document,o=l.scrollingElement||l.documentElement||l.body;let i=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;i&&i!==l.body&&i!==o;){const e=window.getComputedStyle(i),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(_t.test(n)||_t.test(t))return i;i=i.parentElement}return o}(e);if(!r)return;const a=null!=(l=e.ownerDocument)?l:document,u=r===a.body||r===a.documentElement||r===a.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):r.scrollTop+=i)}function jt(){try{const e=te.value;if(!e)return;const n=e.getBoundingClientRect().height,t=Lt();if(null!=t&&t>0){const l=ht(t,!0),o=it();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",void At(e,n,l)}const l=it();null!=l&&(e.style.minHeight=`${l}px`,e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",At(e,n,l))}catch(e){}}function It(){for(var e,n;ln.length>0;)try{null==(n=null==(e=ln.pop())?void 0:e.dispose)||n.call(e)}catch(t){}null!=Ne&&(Z(Ne),Ne=null)}function qt(){for(var e;on.length>0;)try{null==(e=on.pop())||e()}catch(n){}}function Ut(e=!1){Be.value||(Pe.value?jt():function(){var e;try{const n=te.value;if(!n)return;const t=n.getBoundingClientRect().height,l=Qt(),o=Math.ceil((null==(e=n.getBoundingClientRect)?void 0:e.call(n).height)||0),i=un.value?function(){var e,n,t,l,o,i,r,a;try{const u=Je(),d=null==(e=null==u?void 0:u.getOriginalEditor)?void 0:e.call(u),s=null==(n=null==u?void 0:u.getModifiedEditor)?void 0:n.call(u);if(!d||!s)return null;const c=(null==(o=null==(l=null==(t=d.getModel)?void 0:t.call(d))?void 0:l.getLineCount)?void 0:o.call(l))||1,v=(null==(a=null==(r=null==(i=s.getModel)?void 0:i.call(s))?void 0:r.getLineCount)?void 0:a.call(r))||1,f=Math.max(c,v),m=Math.max(bt(d),bt(s)),p=Math.max(St(d),St(s));return Math.ceil(f*(m+xe)+p+0+1)}catch(u){return null}}():null,r=un.value&&Ft(n),a=r&&Le.value&&kn.value&&!Cn.value&&!Mn.value;if(r||(Re.value=null),Te>0&&(Te--,null!=$e.value))return void At(n,t,Yt(n,$e.value,l,{allowBelowEstimatedFloor:a}));const u=un.value?function(e){var n,t;if("undefined"==typeof window)return null;try{const l=e.getBoundingClientRect(),o=window.getComputedStyle(e);if("none"===o.display||"hidden"===o.visibility)return null;const i=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];let r=0;for(const n of Array.from(e.querySelectorAll(i.join(",")))){if(!(n instanceof HTMLElement))continue;const e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const t=n.getBoundingClientRect();t.height<=0||t.bottom<=l.top||(r=Math.max(r,t.bottom-l.top))}if(r>0)return Math.ceil(r);const a=e.querySelector(".monaco-diff-editor"),u=null!=(t=null==(n=null==a?void 0:a.getBoundingClientRect)?void 0:n.call(a).height)?t:0;return u>0?Math.ceil(u+1):null}catch(l){return null}}(n):null,d=un.value?r?u:null!=i?Math.max(null!=u?u:0,i):u:Lt();if(null!=d&&d>0){const e=null!=Re.value&&Date.now()<De&&d>=l-1,i=r&&o>0&&o<l-1&&d>=l-1,u=Yt(n,e?Re.value:i?o:d,l,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:a});return r&&u<l-1&&(Re.value=u,De=Date.now()+160),void At(n,t,u)}if(null!=$e.value)return void At(n,t,Yt(n,$e.value,l,{allowBelowEstimatedFloor:a}));const s=r?o:Math.max(o,null!=i&&i>0?i:0);if(s>0){const e=null!=Re.value&&Date.now()<De&&s>=l-1,i=r&&o>0&&o<l-1&&s>=l-1,u=Yt(n,e?Re.value:i?o:s,l,{allowBelowEstimatedFloor:a});return r&&u<l-1&&(Re.value=u,De=Date.now()+160),void At(n,t,u)}const c=it();if(null!=c)return void At(n,t,Yt(n,c,l,{allowBelowEstimatedFloor:a}));const v=Number.parseFloat(n.style.height);!Number.isNaN(v)&&v>0?At(n,t,Yt(n,v,l,{allowBelowEstimatedFloor:a})):un.value||At(n,t,Yt(n,l,l))}catch(n){}}())}function Vt(){Tt=0,Wt=0}function Gt(e=!1){var n,t,l;const o=te.value;if(!o)return;const i=un.value?Je():Ge();if(i&&"function"==typeof i.layout)try{const r=null==(n=o.getBoundingClientRect)?void 0:n.call(o),a=Math.ceil((null!=(t=null==r?void 0:r.width)?t:0)||o.clientWidth||0),u=Math.ceil((null!=(l=null==r?void 0:r.height)?l:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(a>0&&u>0){if(!e&&a===Tt&&u===Wt)return;Tt=a,Wt=u,i.layout({width:a,height:u})}else Vt(),i.layout()}catch(r){}}function Jt(){if(!un.value)return void qt();const e=te.value;if(!e)return void qt();const n=e.querySelector(".monaco-diff-editor");if(!n||n.classList.contains("side-by-side"))return void qt();const t=Array.from(n.querySelectorAll(".editor.original .diff-hidden-lines")),l=Array.from(n.querySelectorAll(".editor.modified .diff-hidden-lines")),o=Math.min(t.length,l.length);for(let i=0;i<o;i++){const e=l[i],n=e.querySelector("a"),t=e.querySelector(".center > div:first-child"),o=e.querySelector(".center");if(!n||!t||!o)continue;if(o.querySelector(".markstream-inline-fold-proxy"))continue;const r=document.createElement("button");r.type="button",r.className="markstream-inline-fold-proxy",r.dataset.markstreamInlineFoldProxy="true";const a=n.getAttribute("title")||"Show Unchanged Region";r.title=a,r.setAttribute("aria-label",a);const u=e=>{e.preventDefault(),e.stopPropagation()},d=e=>{e.preventDefault(),e.stopPropagation(),n.click(),Q(()=>Xt())},s=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n.click(),Q(()=>Xt()))};r.addEventListener("mousedown",u),r.addEventListener("click",d),r.addEventListener("keydown",s),o.appendChild(r),on.push(()=>{r.removeEventListener("mousedown",u),r.removeEventListener("click",d),r.removeEventListener("keydown",s),r.parentElement===o&&o.removeChild(r)})}}function Xt(e=!1){null==Ne&&(Ne=Q(()=>{Ne=null,Q(()=>{Jt(),Ut(e),Gt()})}))}function Yt(e,n,t,l={}){ut(n);const o=at(),i=null!=o?Math.max(n,o):n,r=Math.min(i,t),a=!0===l.allowBelowEstimatedFloor||pt(),u=ht(r,!0===l.clearEstimatedFloor,{allowBelowEstimatedFloor:a}),d=it();if(e.style.minHeight=null==d||a?"0px":`${Math.min(d,Math.ceil(t))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(t)}px`,un.value)e.style.overflow="hidden";else{const n=i>t+1;e.style.overflow=n?"auto":"hidden"}return u}function Kt(e,n,t){return d(this,null,function*(){try{return void(yield Ue(e,n,t))}catch(l){if(!hn(l))throw l}if(yield E(),yield gt(),!He&&un.value)try{yield Ue(e,n,t)}catch(l){if(!hn(l))throw l}})}function Qt(){var e,n;const t=null!=(n=null==(e=l.monacoOptions)?void 0:e.MAX_HEIGHT)?n:500;if("number"==typeof t)return t;const o=String(t).match(/^(\d+(?:\.\d+)?)/);return o?Number.parseFloat(o[1]):500}const Zt=c(()=>l.isShowPreview&&("html"===ie.value||"svg"===ie.value));function el(){return"boolean"==typeof l.node.loading?l.node.loading:!0===l.loading}function nl(e,n,t){return t&&!String(null!=n?n:"")?"plain":G(String(null!=e?e:""))}function tl(){var e,n,t,o;return!(!el()||(un.value?String(null!=(e=l.node.originalCode)?e:"")||String(null!=(n=l.node.updatedCode)?n:"")||String(null!=(t=l.node.code)?t:""):String(null!=(o=l.node.code)?o:"")))}P(()=>[l.node.language,l.node.code,l.node.loading,l.loading],([e,n,t,l])=>{ie.value=nl(e,n,"boolean"==typeof t?t:!0===l)}),P(()=>[l.node.originalCode,l.node.updatedCode,un.value],()=>{Ct(),Q(()=>Mt())},{immediate:!0}),P(()=>[un.value,l.stream,l.loading,Fn.value,Cn.value,Mn.value,et.value],()=>{rt()?ut(et.value):ot.value=null},{immediate:!0}),P(()=>[l.node.originalCode,l.node.updatedCode,Ce.value,un.value],e=>d(null,[e],function*([,,,e]){var n,t;if(!1===l.stream||!e)return;if(je&&!Ee.value&&te.value)try{yield hl(te.value)}catch(a){}const o=Ze;if(o&&!Oe.value){try{yield o}catch(a){}if(He||!un.value)return}const i=mn(String(null!=(n=l.node.originalCode)?n:""),String(null!=(t=l.node.updatedCode)?t:"")),r=!1===l.loading;r&&Pl();try{yield Kt(i.original,i.updated,Ce.value),Gt(!0)}catch(u){return}if(r){if(He||!un.value)return;gn(),Jt(),Mt(),Xt()}Pe.value&&Q(()=>jt())})),P(()=>l.node.code,e=>d(null,null,function*(){if(!1===l.stream)return;if(ie.value||(ie.value=G(en(e))),un.value)return;const n=Ze;if(n&&!Oe.value){try{yield n}catch(t){}if(He||un.value)return}if(je&&!Ee.value&&te.value)try{yield hl(te.value)}catch(t){}qe(pn(l.node.code,!0===l.node.loading),Ce.value),Pe.value&&Q(()=>jt())}));const ll=c(()=>{const e=ie.value;return e?J[e]||e.charAt(0).toUpperCase()+e.slice(1):J[""]||"Plain Text"});function ol(e){var n,t;const l=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(l.length<3)return"";const o=l[0];if("`"!==o&&"~"!==o||l[1]!==o||l[2]!==o)return"";let i=3;for(;l[i]===o;)i+=1;return l.slice(i).trim()}const il=c(()=>{var e;return function(e){const n=ol(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const l="diff"===t[0]?t.slice(1):t;for(const o of l){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=l.node.raw)?e:""))}),rl=c(()=>il.value||ll.value),al=c(()=>il.value?un.value?`Diff / ${ll.value}`:ll.value:""),ul=c(()=>(X.value,Y(ie.value||""))),dl=c(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(l.minWidth),o=n(l.maxWidth);if(t&&(e.minWidth=t),o&&(e.maxWidth=o),ct.value&&!un.value){const n=vt.value;null!=n&&(e.minHeight=`${n}px`)}return un.value||(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),sl=c(()=>!1!==l.showTooltips);function cl(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(l.node.code)),oe.value=!0,o("copy",l.node.code),setTimeout(()=>{oe.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function vl(e){if(Pe.value=!Pe.value,e&&sl.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);if(n){const e=Pe.value?W("common.collapse")||"Collapse":W("common.expand")||"Expand";q(n,e,"top",!1,void 0,l.isDark)}}const n=un.value?Je():Ge(),t=te.value;n&&t&&(Pe.value?(pl(!0),t.style.maxHeight="none",t.style.overflow="visible",Ut(!0)):(pl(!1),t.style.overflow=un.value?"hidden":"auto",Ut(!0)))}function fl(){var e,n,t;if(Be.value=!Be.value,Be.value){if(te.value){const t=Math.ceil((null==(n=(e=te.value).getBoundingClientRect)?void 0:n.call(e).height)||0);t>0&&($e.value=t)}pl(!1)}else{Pe.value&&pl(!0),te.value&&null!=$e.value&&(te.value.style.height=`${$e.value}px`);const e=un.value?Je():Ge();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(l){}Te=2,Q(()=>{Ut(!0)})}}function ml(){if(!Zt.value)return;const e=ie.value;if(w.value){const n="html"===e?"text/html":"image/svg+xml",t="html"===e?W("artifacts.htmlPreviewTitle")||"HTML Preview":W("artifacts.svgPreviewTitle")||"SVG Preview";return void o("previewCode",{node:l.node,artifactType:n,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&($n.value=!$n.value)}function pl(e){var n,t;try{if(un.value){const t=Je();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}else{const n=Ge();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}}catch(l){}}function hl(e){if(!je||He)return null;if(tl())return null;if(Qe)return Qe;if(Ee.value&&Le.value)return Promise.resolve();Ee.value=!0,function(){const e=v.value;r&&e&&ze!==e&&(ze&&r.markSettled(ze),ze=e,r.markPending(e))}();const n=d(null,null,function*(){yield function(e){return d(this,null,function*(){var n;if("undefined"==typeof window)return yield e();try{const t=null==(n=window.Element)?void 0:n.prototype,l=null==t?void 0:t.addEventListener;if(!t||!l)return yield e();const o=function(){const e=window,n=e[ke];if(n)return n;const t={depth:0,original:null};return e[ke]=t,t}();0===o.depth&&(o.original=l,t.addEventListener=function(e,n,t){var i;const r=null!=(i=o.original)?i:l;return"touchstart"===e&&function(e,n){if(!e)return!1;const t=e;return!("function"!=typeof t.closest||!t.closest(".monaco-editor, .monaco-diff-editor")||n&&"object"==typeof n&&"passive"in n)}(this,t)?r.call(this,e,n,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(a({},e),{passive:!0}):{passive:!0}}(t)):r.call(this,e,n,t)}),o.depth++;try{return yield e()}finally{o.depth=Math.max(0,o.depth-1),0===o.depth&&o.original&&t.addEventListener!==o.original&&(t.addEventListener=o.original,o.original=null)}}catch(t){return yield e()}})}(()=>function(e){return d(this,null,function*(){var n;if(!je||He)return;if(xn.value=!1,Oe.value=!1,kn.value=!1,Cn.value=!1,Mn.value=!1,mt(),_n.value=null,An.value=null,function(){const e=Nt();e&&(e.style.removeProperty("--stream-monaco-line-number-left"),e.style.removeProperty("--stream-monaco-line-number-width"),e.style.removeProperty("--stream-monaco-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-modified-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-scrollable-left"),e.style.removeProperty("--stream-monaco-modified-scrollable-left"))}(),Vt(),function(){const e=nt.value;lt.value=Le.value||null==e?null:e}(),It(),qt(),function(e){e.replaceChildren()}(e),He)return;const t=d(null,null,function*(){var n,t;if(un.value){!function(){if(tn||"undefined"==typeof window)return;tn=!0;const e=e=>{var n;hn("reason"in e?e.reason:null!=(n=e.error)?n:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0)}(),Ye();const o=mn(String(null!=(n=l.node.originalCode)?n:""),String(null!=(t=l.node.updatedCode)?t:""));Ie?yield Ie(e,o.original,o.updated,Ce.value):yield je(e,l.node.code,Ce.value)}else yield je(e,Rn.value,Ce.value);Oe.value=!0}),o=t.finally(()=>{Ze===o&&(Ze=null)});if(Ze=o,yield o,He)return;const i=un.value?Je():Ge();if("number"==typeof(null==(n=l.monacoOptions)?void 0:n.fontSize))null==i||i.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),Tn.value=l.monacoOptions.fontSize,Wn.value=l.monacoOptions.fontSize;else if(!Rt()){const e=wt();e&&e>0?(Tn.value=e,Wn.value=e):(Tn.value=12,Wn.value=12)}$t(),Pe.value||Be.value||Ut(!1),yield function(){return d(this,null,function*(){null!=it()&&(Jt(),Ut(!1),yield E(),yield gt(),Jt(),Ut(!1),yield gt(),Jt(),Ut(!1))})}(),He||(Le.value=!0,function(){var e,n,t,l,o;if(It(),un.value){const l=Je(),o=null==(e=null==l?void 0:l.getOriginalEditor)?void 0:e.call(l),i=null==(n=null==l?void 0:l.getModifiedEditor)?void 0:n.call(l),a=(e,n)=>{try{const t=null==e?void 0:e[n];if("function"!=typeof t)return;const l=t.call(e,()=>Xt());l&&ln.push(l)}catch(t){}};try{const e=null==(t=null==l?void 0:l.onDidUpdateDiff)?void 0:t.call(l,()=>{Xt(),Q(()=>Mt())});e&&ln.push(e)}catch(r){}return a(o,"onDidContentSizeChange"),a(i,"onDidContentSizeChange"),a(o,"onDidLayoutChange"),void a(i,"onDidLayoutChange")}const i=Ge();try{const e=null==(l=null==i?void 0:i.onDidContentSizeChange)?void 0:l.call(i,()=>Xt());e&&ln.push(e)}catch(r){}try{const e=null==(o=null==i?void 0:i.onDidLayoutChange)?void 0:o.call(i,()=>Xt());e&&ln.push(e)}catch(r){}}(),Dt(),$t(),Jt(),Mt(),Xt(),yield function(){return d(this,null,function*(){Jt(),Ut(!1),yield E(),yield gt(),Jt(),Ut(!1),yield gt(),Jt(),Ut(!1)})}(),yield function(){return d(this,null,function*(){var e;if(un.value){for(let t=0;t<8;t++){if(He)return;const l=te.value,o=Je();let i=!1;try{const n=null==(e=null==o?void 0:o.getLineChanges)?void 0:e.call(o);i=Array.isArray(n)}catch(n){i=!1}const r=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor")),a=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor .view-lines .view-line"));if(r&&a&&i){if(yield E(),yield gt(),He)return;try{gn(),Jt(),Mt(),Xt()}catch(n){}return}if(t>=1&&!r)return;yield E(),yield gt()}if(!He)try{gn(),Jt(),Mt(),Xt()}catch(n){}}})}(),He||($t(),function(){if(!un.value)return;const e=te.value;if(!e)return;const n=e.querySelector(".monaco-diff-editor");function t(e,n,t,l){const o=e.querySelector(n);if(!o)return;const i=o.getBoundingClientRect();if(i.width<=0)return;const r=o.querySelector(".line-numbers"),a=o.querySelector(".view-lines .view-line"),u=o.querySelector(".margin");let d=null;if(a?(d=a.getBoundingClientRect().left-i.left,zt(t,d)):u&&(d=u.getBoundingClientRect().width,zt(t,d)),r){const e=r.getBoundingClientRect();if(e.width>=20&&e.width<=64&&zt("--stream-monaco-line-number-width",e.width),null!=d){const n=d-(e.right-i.left);Number.isFinite(n)&&n>=0&&n<=32&&(zt(l,n),zt("--stream-monaco-line-number-gap-to-code",n))}}}n&&(t(n,".editor.original","--stream-monaco-original-scrollable-left","--stream-monaco-original-line-number-gap-to-code"),t(n,".editor.modified","--stream-monaco-modified-scrollable-left","--stream-monaco-modified-line-number-gap-to-code"))}(),yield E(),function(){var e;if(!un.value||!Fn.value)return;const n=te.value,t=null==(e=le.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!n||!t)return;const l=Math.ceil(t.getBoundingClientRect().height);!Number.isFinite(l)||l<=0||(n.style.height=`${l}px`,n.style.minHeight=`${l}px`)}(),yield gt(),yield function(){return d(this,null,function*(){if(un.value){if(Cn.value=!0,Mn.value=!1,kn.value=!0,yield E(),yield gt(),!He){if(Gt(!0),Mn.value=!0,mt(),"undefined"==typeof window)return Cn.value=!1,void(Mn.value=!1);Pn=window.setTimeout(()=>{Pn=null,Cn.value=!1,Mn.value=!1,Q(()=>{$t(),Jt(),Xt()})},120)}}else kn.value=!0})}()))})}(e))}).finally(()=>{Qe===n&&(Qe=null),function(){const e=ze;r&&e&&(ze="",E(()=>{var n,t;if(!He){const l=null!=(t=null==(n=le.value)?void 0:n.offsetHeight)?t:0;l>0&&r.reportHeight(e,l)}r.markSettled(e)}))}()});return Qe=n,n}P(sl,e=>{e||j()}),P(()=>Wn.value,(e,n)=>{const t=un.value?Je():Ge();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),Be.value||Ut(!0))},{flush:"post",immediate:!1});const gl=P(()=>[te.value,un.value,l.stream,l.loading,Fe.value,Ae.value,l.node.code,l.node.loading],e=>d(null,[e],function*([e,n,t,l,o,i]){if(!e||!je)return;if(!i)return;if(!1===t&&!1!==l)return;if(tl())return;const r=hl(e);if(r){try{yield r}catch(a){Le.value=!1,kn.value=!1,xn.value=!0}gl()}}));function yl(e){return!!e&&"object"==typeof e&&"light"in e&&"dark"in e}function wl(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function bl(e,n){if(e===n)return!0;const t=wl(e),l=wl(n);return!!t&&t===l}function Sl(){var e;const n=function(){if(void 0!==l.theme){const e=l.theme;return yl(e)?l.isDark?e.dark:e.light:e}return l.isDark?l.darkTheme:l.lightTheme}(),t=null==(e=yn.value)?void 0:e.theme,o=null!=n?n:t;if(null!=o&&"object"==typeof o)return o;const i=Array.isArray(l.themes)?l.themes:[];if(!i.length||null==o)return o;const r=wl(o),a=i.map(e=>wl(e)).filter(e=>!!e);if(!r||a.includes(r))return o;const u=wl(t);return null!=t&&u&&a.includes(u)?t:i[0]}P(wn,(e,n)=>d(null,null,function*(){if(e===n)return;if(bn.value=e,!je||!te.value)return;if(!Ee.value)return;if(!1===l.stream&&!1!==l.loading)return;if(!Ae.value)return;const t=Qe;if(t){try{yield t}catch(o){}if(He||!te.value)return}try{Le.value=!1,kn.value=!1,Ee.value=!1,Oe.value=!1,It(),qt(),Ye(),yield E(),yield hl(te.value)}catch(i){Le.value=!1,kn.value=!1,xn.value=!0}}));const kl=c(()=>(void 0!==l.theme?!yl(l.theme):bl(l.darkTheme,l.lightTheme))?function(e){var n,t;if(e&&"object"==typeof e&&(null==(n=e.colors)?void 0:n["editor.background"])){const n=Ht(e.colors["editor.background"]);if(null!=n)return n<128}const o=(null!=(t=wl(e))?t:"").toLowerCase();return o?["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=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):!!l.isDark}(Sl()):!!l.isDark),xl=c(()=>{var e;if(!un.value)return kl.value?"dark":"light";const n=null==(e=yn.value)?void 0:e.diffAppearance;return"light"===n||"dark"===n?n:kl.value?"dark":"light"}),Cl=c(()=>un.value?"dark"===xl.value:kl.value);function Ml(){return u(a(u(a({wordWrap:"on",wrappingIndent:"same",themes:l.themes},yn.value||{}),{theme:Sl()}),un.value?{diffAppearance:xl.value}:{}),{onThemeChange(){Dt()}})}function Pl(){const e=Ml();if(!rn)return rn=e,rn;for(const n of Object.keys(rn))n in e||delete rn[n];return Object.assign(rn,e),rn}const Bl=c(()=>{var e,n,t,o,i,r,u,d,s,c,v,f,m,p,h;return JSON.stringify({diffLineStyle:null!=(n=null==(e=yn.value)?void 0:e.diffLineStyle)?n:"background",diffUnchangedRegionStyle:null!=(o=null==(t=yn.value)?void 0:t.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:void 0===(null==(i=l.monacoOptions)?void 0:i.diffHideUnchangedRegions)?a({},cn):fn(l.monacoOptions.diffHideUnchangedRegions),renderSideBySide:null==(u=null==(r=yn.value)?void 0:r.renderSideBySide)||u,useInlineViewWhenSpaceIsLimited:null!=(s=null==(d=yn.value)?void 0:d.useInlineViewWhenSpaceIsLimited)&&s,enableSplitViewResizing:null==(v=null==(c=yn.value)?void 0:c.enableSplitViewResizing)||v,ignoreTrimWhitespace:null==(m=null==(f=yn.value)?void 0:f.ignoreTrimWhitespace)||m,originalEditable:null!=(h=null==(p=yn.value)?void 0:p.originalEditable)&&h})});return P(()=>[l.monacoOptions,Ae.value],()=>{var e,n;if(Pl(),!je||!Ae.value)return;const t=un.value?Je():Ge(),o="number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?l.monacoOptions.fontSize:Number.isFinite(Wn.value)?Wn.value:void 0;"number"==typeof o&&Number.isFinite(o)&&o>0&&(null==(n=null==t?void 0:t.updateOptions)||n.call(t,{fontSize:o})),Ut(!1)},{deep:!0}),P(()=>[Sl(),xl.value,Fe.value,Ee.value,Ae.value],([e],n)=>{Fe.value&&Ee.value&&Ae.value&&function(e={}){if(e.appearanceOnly)return;Pl();const n=Sl(),t=()=>{un.value&&gn(),Q(()=>{Dt(),Xt()})};n?function(e,n){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);if("object"==typeof e){const t=fe.get(e);if(t)return t;try{const n=JSON.stringify(e);if(n)return fe.set(e,n),n}catch(n){}const l="__theme_"+ ++me;return fe.set(e,l),l}return String(e)}(n);return t?(ve=e,ae||ce!==t?ae?(se===t||ue===t||(de=n,se=t),ae):(de=n,se=t,ae=d(null,null,function*(){for(;se&&null!=de;){const t=de,l=se;if(de=null,se=null,ce!==l)try{ue=l,yield(null!=ve?ve:e)(t),ce=l}catch(n){}}}).finally(()=>{ae=null,ue=null}),ae):Promise.resolve()):Promise.resolve()}(nn,n).then(t).catch(e=>{}):t()}({appearanceOnly:null!=n&&bl(e,n[0])})},{flush:"post"}),P(()=>[Bl.value,Fe.value,Ae.value],(e,n)=>d(null,[e,n],function*([e,n,t],[o]){if(Pl(),!n||!t)return;if(!je||!te.value)return;if(!Ee.value)return;if(e===o)return;if(!1===l.stream&&!1!==l.loading)return;const i=Qe;if(i){try{yield i}catch(r){}if(He||!te.value)return}try{Le.value=!1,kn.value=!1,Ee.value=!1,Oe.value=!1,It(),qt(),Ye(),yield E(),yield hl(te.value)}catch(a){Le.value=!1,kn.value=!1,xn.value=!0}}),{flush:"post"}),P(()=>[l.loading,Ae.value],(e,n)=>d(null,[e,n],function*([e,n],t){if(!n)return;const o=null==t?void 0:t[0];if(!1===o&&!1!==e&&un.value&&Ee.value&&(yield E(),Q(()=>{d(null,null,function*(){const e=Qe;if(e)try{yield e}catch(n){}!He&&un.value&&!1!==l.loading&&(Pl(),gn(),Xt())})})),e)return;const i=void 0!==o&&!1!==o;yield E(),Q(()=>{d(null,null,function*(){var e,n;try{if(i&&Ee.value)if(un.value&&te.value){const o=Qe;if(o)try{yield o}catch(t){}Pl();const i=mn(String(null!=(e=l.node.originalCode)?e:""),String(null!=(n=l.node.updatedCode)?n:""));if(yield Kt(i.original,i.updated,Ce.value),He||!un.value)return;gn(),Gt(!0),Jt(),Mt(),Xt()}else qe(Rn.value,Ce.value);Ut(!1)}catch(o){}})})}),{immediate:!0,flush:"post"}),f(()=>{mt(),It(),qt(),Xe()}),(n,t)=>Sn.value?(m(),p(S(I),{key:0,node:Dn.value,loading:l.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:le,style:L(dl.value),class:y(["code-block-container rounded-lg border",[{dark:l.isDark,"is-rendering":l.loading,"is-dark":Cl.value,"is-diff":un.value,"is-plain-text":Me.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":kn.value&&!Sn.value?"true":"false","data-markstream-pending":zn.value?"true":void 0},[F(ee,{"show-header":l.showHeader,"show-collapse-button":l.showCollapseButton,"show-font-size-buttons":l.showFontSizeButtons,"enable-font-size-control":l.enableFontSizeControl,"show-copy-button":l.showCopyButton,"show-expand-button":l.showExpandButton,"show-preview-button":l.showPreviewButton,"show-tooltips":l.showTooltips,"is-dark":l.isDark,loading:l.loading,stream:e.stream,"is-collapsed":Be.value,"is-expanded":Pe.value,"copy-text":oe.value,"is-previewable":Zt.value,"code-font-size":Wn.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":Tn.value,"font-baseline-ready":jn.value,"diff-stats":un.value?dn.value:null,"diff-stats-aria-label":sn.value,onToggleCollapse:fl,onDecreaseFont:Et,onResetFont:Ot,onIncreaseFont:Bt,onCopy:cl,onToggleExpand:vl,onPreview:ml},H({"header-left":N(()=>[D(n.$slots,"header-left",{},()=>[g("div",he,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:ul.value},null,8,ge),g("div",ye,[g("div",we,b(rl.value),1),al.value?(m(),O("div",be,b(al.value),1)):$("",!0)])])],!0)]),loading:N(()=>[D(n.$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:N(()=>[z(g("div",Se,[g("div",{ref_key:"codeEditor",ref:te,class:y(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Nn.value}]]),style:L(ft.value)},null,6),Hn.value?(m(),p(S(I),{key:0,class:y(["code-pre-fallback",{"is-wrap":Bn.value,"is-fading-out":Mn.value}]),style:L(st.value),node:Dn.value,"show-line-numbers":!0,"diff-inline":En.value},null,8,["class","style","node","diff-inline"])):$("",!0)],512),[[R,!(Be.value||!e.stream&&e.loading)]]),$n.value&&!w.value&&Zt.value&&"html"===ie.value?(m(),p(re,{key:0,code:l.node.code,"html-preview-allow-scripts":l.htmlPreviewAllowScripts,"html-preview-sandbox":l.htmlPreviewSandbox,"is-dark":l.isDark,"on-close":()=>$n.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):$("",!0)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:N(()=>[D(n.$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,pe))}}),[["__scopeId","data-v-454daf15"]]);export{Ce as default};
|
|
1
|
+
var e=Object.defineProperty,n=Object.defineProperties,t=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,r=(n,t,l)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):n[t]=l,a=(e,n)=>{for(var t in n||(n={}))o.call(n,t)&&r(e,t,n[t]);if(l)for(var t of l(n))i.call(n,t)&&r(e,t,n[t]);return e},u=(e,l)=>n(e,t(l)),d=(e,n,t)=>new Promise((l,o)=>{var i=e=>{try{a(t.next(e))}catch(n){o(n)}},r=e=>{try{a(t.throw(e))}catch(n){o(n)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(i,r);a((t=t.apply(e,n)).next())});import{defineComponent as s,computed as c,onMounted as v,onUnmounted as f,openBlock as m,createBlock as p,Teleport as h,createElementVNode as g,normalizeClass as y,withModifiers as w,toDisplayString as b,unref as S,useAttrs as k,inject as x,getCurrentInstance as C,ref as M,watch as P,onBeforeUnmount as B,nextTick as E,createElementBlock as O,normalizeStyle as L,createVNode as F,createSlots as H,withCtx as N,withDirectives as z,createCommentVNode as $,vShow as R,renderSlot as D}from"vue";import{ap as T,y as W,ah as _,ar as A,a9 as j,z as I,am as q}from"./exports.js";import{M as U,e as V,n as G,c as J,l as X,g as Y,i as K}from"./index2.js";import{safeRaf as Q,safeCancelRaf as Z}from"./utils/safeRaf.js";import{_ as ee}from"./CodeBlockShell.vue_vue_type_style_index_0_lang.js";import{getUseMonaco as ne}from"./monaco.js";const te={class:"html-preview-frame__header"},le={class:"html-preview-frame__title"},oe={class:"html-preview-frame__label"},ie=["sandbox","srcdoc"],re=/* @__PURE__ */W(/* @__PURE__ */s({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){const n=e,t=void 0!==import.meta&&Boolean(!1);let l=null;const{t:o}=T(),i=c(()=>{const e=n.code||"",t=e.trim().toLowerCase();return t.startsWith("<!doctype")||t.startsWith("<html")||t.startsWith("<body")?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${n.isDark?"#020617":"#ffffff"};\n color: ${n.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),r=c(()=>{return e=n.htmlPreviewSandbox,o=n.htmlPreviewAllowScripts,"string"==typeof e?(function(e){if(!t||"undefined"==typeof console||l===e)return;const n=function(e){return new Set(e.trim().toLowerCase().split(/\s+/).filter(Boolean))}(e);n.has("allow-scripts")&&n.has("allow-same-origin")&&(l=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 a(e){var t;"Escape"!==e.key&&"Esc"!==e.key||null==(t=n.onClose)||t.call(n)}return v(()=>{"undefined"!=typeof window&&window.addEventListener("keydown",a)}),f(()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",a)}),(e,t)=>(m(),p(h,{to:"body"},[g("div",{class:y(["markstream-vue",{dark:n.isDark}])},[g("div",{class:"html-preview-frame__backdrop",onClick:t[2]||(t[2]=e=>{var t;return null==(t=n.onClose)?void 0:t.call(n)})},[g("div",{class:"html-preview-frame",onClick:t[1]||(t[1]=w(()=>{},["stop"]))},[g("div",te,[g("div",le,[t[3]||(t[3]=g("span",{class:"html-preview-frame__dot"},null,-1)),g("span",oe,b(n.title||S(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=n.onClose)?void 0:t.call(n)})}," × ")]),g("iframe",{class:"html-preview-frame__iframe",sandbox:r.value,referrerpolicy:"no-referrer",srcdoc:i.value},null,8,ie)])])],2)]))}}),[["__scopeId","data-v-24e66176"]]);let ae=null,ue=null,de=null,se=null,ce=null,ve=null;const fe=/* @__PURE__ */new WeakMap;let me=0;const pe=["data-markstream-enhanced","data-markstream-pending"],he={class:"code-header-main"},ge=["innerHTML"],ye={class:"code-header-copy"},we={class:"code-header-title"},be={key:0,class:"code-header-caption"},Se={class:"code-editor-layer"},ke="__markstreamMonacoPassiveTouchState__",xe=1.5,Ce=/* @__PURE__ */W(/* @__PURE__ */s({__name:"CodeBlockNode",props:{node:{},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isShowPreview:{type:Boolean,default:!0},monacoOptions:{},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},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:{}},emits:["previewCode","copy"],setup(e,{emit:n}){var t;const l=e,o=n,i=k(),r=x(U,null),s=x("markstreamHostScrollManaged",null),v=c(()=>_(l,i));const h=C(),w=c(()=>{const e=null==h?void 0:h.vnode.props;return!(!e||!e.onPreviewCode&&!e.onPreviewCode)}),{t:W}=T(),te=M(null),le=M(null),oe=M(!1),ie=M(tl(l.node.language,l.node.code,nl())),Ce=c(()=>V(ie.value)),Me=c(()=>"plaintext"===Ce.value),Pe=M(!1),Be=M(!1),Ee=M(!1),Oe=M(!1),Le=M(!1),Fe=M(!1);let He=!1,Ne=null,ze="";const $e=M(null),Re=M(null);let De=0,Te=0;const We=A(),_e=M(null),Ae=M("undefined"==typeof window);"undefined"!=typeof window&&P(()=>le.value,e=>{var n;if(null==(n=_e.value)||n.destroy(),_e.value=null,!e)return void(Ae.value=!1);const t=We(e,{rootMargin:"400px"});_e.value=t,Ae.value=t.isVisible.value,t.whenVisible.then(()=>{Ae.value=!0})},{immediate:!0}),B(()=>{var e;He=!0,function(){const e=ze;r&&e&&(ze="",r.markSettled(e))}(),null==(e=_e.value)||e.destroy(),_e.value=null});let je=null,Ie=null,qe=()=>{},Ue=()=>{},Ve=()=>null,Ge=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Je=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Xe=()=>{},Ye=()=>{},Ke=()=>{},Qe=null,Ze=null,en=()=>{var e;return String(null!=(e=l.node.language)?e:"plaintext")},nn=()=>d(null,null,function*(){}),tn=!1;const ln=[],on=[];let rn=null;function an(e){var n;return"diff"===(null!=(n=String(null!=e?e:"").trim().split(/\s+/,1)[0])?n:"")}const un=c(()=>{var e;return!0===l.node.diff||an(l.node.language)||an(il(String(null!=(e=l.node.raw)?e:"")))}),dn=M({removed:0,added:0}),sn=c(()=>`-${dn.value.removed} +${dn.value.added}`),cn=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5}),vn=Object.freeze(u(a({},cn),{enabled:!1,revealLineCount:0}));function fn(e){var n;if("boolean"==typeof e)return e;if(e&&"object"==typeof e){const t=e;return u(a(a({},cn),t),{enabled:null==(n=t.enabled)||n})}return a({},cn)}function mn(e,n){return{original:pn(e,!1),updated:pn(n,!1)}}function pn(e,n){const t=String(null!=e?e:"");return n?t:t.replace(/\r\n$|\n$|\r$/,"")}function hn(e){var n;return String(null!=(n=null==e?void 0:e.message)?n:e).includes("no diff result available")}function gn(){try{const e=Ke();e&&"function"==typeof e.catch&&e.catch(e=>{hn(e)})}catch(e){hn(e)}}const yn=c(()=>{var e,n,t,o;const i=l.monacoOptions?a({},l.monacoOptions):{};if(!un.value)return i;const r=void 0===i.diffHideUnchangedRegions?a({},cn):fn(i.diffHideUnchangedRegions),d=void 0===i.hideUnchangedRegions?void 0:fn(i.hideUnchangedRegions),s=!1!==l.stream&&!1!==l.loading,c=s?a({},vn):r,v=s?a({},vn):d,f=function(e){return void 0!==e.diffWordWrap?e.diffWordWrap:"off"}(i),m=a({},null!=(e=i.experimental)?e:{}),p=null!=(n=i.diffUnchangedRegionStyle)?n:"line-info",h={maxComputationTime:0,diffAlgorithm:"legacy",ignoreTrimWhitespace:!1,renderIndicators:!0,diffUpdateThrottleMs:120,renderLineHighlight:"none",renderLineHighlightOnlyWhenFocus:!0,selectionHighlight:!1,occurrencesHighlight:"off",matchBrackets:"never",lineDecorationsWidth:4,lineNumbersMinChars:2,glyphMargin:!1,minimap:{enabled:!1},renderOverviewRuler:!1,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,scrollBeyondLastLine:!1,diffWordWrap:f,renderSideBySide:null==(t=i.renderSideBySide)||t,diffHideUnchangedRegions:c,useInlineViewWhenSpaceIsLimited:null!=(o=i.useInlineViewWhenSpaceIsLimited)&&o,diffLineStyle:"background",diffAppearance:"auto",diffUnchangedRegionStyle:p,diffHunkActionsOnHover:!1,experimental:m};return u(a(u(a(a({},h),i),{experimental:m}),void 0===v?{}:{hideUnchangedRegions:v}),{diffHideUnchangedRegions:c,diffWordWrap:f})}),wn=c(()=>un.value?"diff":"single"),bn=M(wn.value),Sn=M(!1),kn=M(!1),xn=M(!1),Cn=M(!1),Mn=M(!1);let Pn=null;const Bn=c(()=>{var e,n,t;if(un.value){const t=null==(e=yn.value)?void 0:e.diffWordWrap;if("inherit"===t){const e=null==(n=l.monacoOptions)?void 0:n.wordWrap;return null==e||"off"!==String(e)}return"on"===t}const o=null==(t=l.monacoOptions)?void 0:t.wordWrap;return null==o||"off"!==String(o)}),En=c(()=>{var e,n,t,l,o,i;if(!un.value)return!1;if(!1===(null==(e=yn.value)?void 0:e.renderSideBySide))return!0;if(!0!==(null==(n=yn.value)?void 0:n.useInlineViewWhenSpaceIsLimited))return!1;const r=null==(t=yn.value)?void 0:t.renderSideBySideInlineBreakpoint,a="number"==typeof r&&Number.isFinite(r)?r:900,u=(null==(o=null==(l=le.value)?void 0:l.getBoundingClientRect)?void 0:o.call(l).width)||(null==(i=le.value)?void 0:i.clientWidth)||("undefined"==typeof window?0:window.innerWidth);return u>0&&u<=a});function On(e){return!0===(null==s?void 0:s.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 Ln=c(()=>On(le.value)),Fn=c(()=>!Sn.value&&(!!xn.value||(un.value||Ln.value||!K())&&!kn.value)),Hn=c(()=>Fn.value||Cn.value),Nn=c(()=>Fn.value&&!Cn.value),zn=c(()=>!Sn.value&&!xn.value&&(Fn.value||Cn.value||Mn.value)),$n=M(!1),Rn=c(()=>pn(l.node.code,!0===l.node.loading)),Dn=c(()=>un.value?!0===l.node.diff?l.node:u(a({},l.node),{diff:!0}):Rn.value===l.node.code?l.node:u(a({},l.node),{code:Rn.value}));"undefined"!=typeof window&&d(null,null,function*(){try{const e=yield ne();if(He)return;if(!e)return void(Sn.value=!0);const n=e.useMonaco,t=e.detectLanguage;if("function"==typeof t&&(en=t),"function"==typeof n){const e=kl();if(e&&l.themes&&Array.isArray(l.themes)&&!l.themes.includes(e))throw new Error("Preferred theme not in provided themes array");rn=Pl();const t=n(rn);je=t.createEditor||je,Ie=t.createDiffEditor||Ie,qe=t.updateCode||qe,Ue=t.updateDiff||Ue,Ve=t.getEditor||Ve,Ge=t.getEditorView||Ge,Je=t.getDiffEditorView||Je,Xe=t.cleanupEditor||Xe,Ye=t.safeClean||t.cleanupEditor||Ye,Ke=t.refreshDiffPresentation||Ke,nn=t.setTheme||nn,Fe.value=!0,!He&&te.value&&(yield gl(te.value))}}catch(e){if(He)return;Sn.value=!0}});const Tn=M("number"==typeof(null==(t=l.monacoOptions)?void 0:t.fontSize)?l.monacoOptions.fontSize:Number.NaN),Wn=M(Tn.value),_n=M(null),An=M(null),jn=c(()=>{const e=Tn.value,n=Wn.value;return"number"==typeof e&&Number.isFinite(e)&&e>0&&"number"==typeof n&&Number.isFinite(n)&&n>0}),In=c(()=>{var e;const n=_n.value;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=null==(e=l.monacoOptions)?void 0:e.fontSize;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;const o=Wn.value;return"number"==typeof o&&Number.isFinite(o)&&o>0?o:12}),qn=c(()=>{var e;const n=An.value;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n;const t=null==(e=l.monacoOptions)?void 0:e.lineHeight;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:12===In.value?18:Math.max(12,Math.round(1.5*In.value))}),Un=c(()=>qn.value);function Vn(e){const n=String(null!=e?e:"");return n?Math.max(1,n.split(/\r\n|\n|\r/).length):1}function Gn(e){return e.startsWith("-")&&!e.startsWith("---")}function Jn(e){return e.startsWith("+")&&!e.startsWith("+++")}function Xn(e){var n;const t=e.some(e=>Gn(e)),o=e.some(e=>Jn(e));return t&&o||an(l.node.language)&&(t||o)||an(il(String(null!=(n=l.node.raw)?n:"")))&&(t||o)}const Yn=c(()=>En.value?function(){var e,n,t;const o=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(Xn(o))return Math.max(1,o.length);const i=String(null!=(n=l.node.originalCode)?n:"").split(/\r\n|\n|\r/),r=String(null!=(t=l.node.updatedCode)?t:"").split(/\r\n|\n|\r/);let a=0,u=i.length-1,d=r.length-1;for(;a<=u&&a<=d&&i[a]===r[a];)a++;let s=0;for(;u>=a&&d>=a&&i[u]===r[d];)s++,u--,d--;const c=Math.max(0,u-a+1),v=Math.max(0,d-a+1);return Math.max(1,a+c+v+s)}():function(){var e;const n=String(null!=(e=l.node.code)?e:"").split(/\r\n|\n|\r/);if(!Xn(n)&&(null!=l.node.originalCode||null!=l.node.updatedCode))return Math.max(Vn(l.node.originalCode),Vn(l.node.updatedCode));let t=0,o=0;for(const l of n)Gn(l)?t++:(Jn(l)||t++,o++);return Math.max(1,t,o)}()),Kn=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.tabSize;return"number"==typeof n&&Number.isFinite(n)&&n>0?n:4}),Qn=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.padding;return{top:"number"==typeof(null==n?void 0:n.top)&&Number.isFinite(n.top)&&n.top>0?n.top:0,bottom:"number"==typeof(null==n?void 0:n.bottom)&&Number.isFinite(n.bottom)&&n.bottom>0?n.bottom:0}}),Zn=c(()=>{const e=l.estimatedContentHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null});function et(e){if(null==e)return null;const n=Math.ceil(e);return!Number.isFinite(n)||n<=0?null:Math.min(n,Math.ceil(Zt()))}const nt=c(()=>un.value?Math.ceil(Yn.value*Un.value):null!=Zn.value?null:Math.ceil((e=>{const n=String(null!=e?e:"");return n?Math.max(1,n.split(/\r\n|\n|\r/).length):1})(Rn.value)*(qn.value+xe)+1)),tt=c(()=>{if(un.value){const e=nt.value,n=ut();return et(null!=n&&null!=e?Math.max(e,n):null!=n?n:e)}const e=Zn.value;return et(null!=e?e:nt.value)}),lt=c(()=>{const e=l.estimatedHeightPx;return"number"==typeof e&&Number.isFinite(e)&&e>0?e:null}),ot=M(null),it=M(null);function rt(){const e=ot.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function at(){return un.value&&!1!==l.stream&&(!1!==l.loading||Fn.value||Cn.value||Mn.value)}function ut(){if(!at())return null;const e=it.value;return"number"==typeof e&&Number.isFinite(e)&&e>0?Math.round(e):null}function dt(e){if(!at()||null==e)return;const n=Math.min(Math.ceil(e),Math.ceil(Zt()));if(!Number.isFinite(n)||n<=0)return;const t=ut();it.value=null==t?n:Math.max(t,n)}const st=c(()=>{const e=rt();return null!=e?e:Fn.value||!kn.value?tt.value:null}),ct=c(()=>{var e;const n=null==(e=l.monacoOptions)?void 0:e.fontFamily,t=et(Zn.value),o=et(nt.value),i=a(a({fontSize:`${In.value}px`,lineHeight:`${Un.value}px`,tabSize:Kn.value,boxSizing:"border-box",maxHeight:`${Zt()}px`,overflow:"auto",paddingTop:`${Qn.value.top}px`,paddingBottom:`${Qn.value.bottom}px`},un.value?function(e){if(null==e)return{};const n=Math.ceil(e),t=Math.ceil(Zt()),l=Math.min(n,t);return n>=t?{height:`${l}px`,minHeight:`${l}px`}:{minHeight:`${n}px`}}(tt.value):null!=t?{height:`${t}px`,minHeight:`${t}px`}:null!=o?{minHeight:`${o}px`}:{}),"string"==typeof n&&n.trim()?{"--markstream-code-font-family":n.trim()}:{});return i["--markstream-pre-line-number-top"]=`${Qn.value.top}px`,i["--markstream-code-padding-left"]="62px",i["--markstream-pre-line-number-width"]="36px",i["--markstream-pre-line-number-gap"]="0px",un.value&&(i["--markstream-pre-diff-line-height"]=`${Un.value}px`),i}),vt=c(()=>null!=st.value&&(!kn.value||null!=rt())),ft=c(()=>{const e=st.value;if(null==e)return null;if(un.value)return Math.ceil(e);const n=lt.value,t=Zn.value;if(null==n||null==t)return Math.ceil(e);const l=Math.max(0,Math.ceil(n)-Math.ceil(t));return Math.ceil(e+l)}),mt=c(()=>{if(un.value&&Fn.value)return;const e=st.value;return vt.value&&null!=e?{minHeight:`${e}px`}:void 0});function pt(){null!=Pn&&"undefined"!=typeof window&&window.clearTimeout(Pn),Pn=null}function ht(){if(!un.value)return!1;if(!Le.value||!kn.value)return!1;if(Cn.value||Mn.value)return!1;const e=te.value;return!!e&&Ht(e)}function gt(e,n=!1,t={}){const l=Math.ceil(e),o=rt();if(null==o)return l;const i=!0===t.allowBelowEstimatedFloor||ht();return l>=o||i?((n||i)&&Le.value&&(ot.value=null),l):o}function yt(){return new Promise(e=>{Q(()=>e())})}function wt(){try{const e=te.value;if(!e)return null;const n=e.querySelector(".view-lines .view-line");if(n){const e=Math.ceil(n.getBoundingClientRect().height);if(e>0)return e}}catch(e){}return null}function bt(){var e,n,t,l,o;try{const i=un.value?null!=(t=null==(n=null==(e=Je())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Je():Ge(),r=Ve(),a=null==(l=null==r?void 0:r.EditorOption)?void 0:l.fontInfo;if(i&&null!=a){const e=null==(o=i.getOption)?void 0:o.call(i,a),n=null==e?void 0:e.fontSize;if("number"==typeof n&&Number.isFinite(n)&&n>0)return n}}catch(i){}try{const e=te.value;if(e){const n=e.querySelector(".view-lines .view-line");if(n)try{if("undefined"!=typeof window&&"function"==typeof window.getComputedStyle){const e=window.getComputedStyle(n).fontSize,t=e&&e.match(/^(\d+(?:\.\d+)?)/);if(t)return Number.parseFloat(t[1])}}catch(i){}}}catch(i){}return null}function St(e){var n,t;try{const l=Ve(),o=null==(n=null==l?void 0:l.EditorOption)?void 0:n.lineHeight;if(null!=o){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o);if("number"==typeof n&&n>0)return n}}catch(i){}const l=wt();if(l&&l>0)return l;const o=Number.isFinite(Wn.value)&&Wn.value>0?Wn.value:14;return Math.max(12,Math.round(1.35*o))}function kt(e){var n,t,l;try{const l=Ve(),o=null==(n=null==l?void 0:l.EditorOption)?void 0:n.padding;if(null!=o){const n=null==(t=null==e?void 0:e.getOption)?void 0:t.call(e,o),l="number"==typeof(null==n?void 0:n.top)?n.top:0,i="number"==typeof(null==n?void 0:n.bottom)?n.bottom:0;if(l>0||i>0)return l+i}}catch(a){}const o=null==(l=yn.value)?void 0:l.padding,i="number"==typeof(null==o?void 0:o.top)?o.top:0,r="number"==typeof(null==o?void 0:o.bottom)?o.bottom:0;return i>0||r>0?i+r:un.value?24:0}function xt(e,n){return"number"!=typeof e||"number"!=typeof n||e<1||n<e?0:n-e+1}function Ct(e){if(!e)return[];const n=e.split(/\r?\n/);return 1===n.length&&""===n[0]?[]:n}function Mt(){var e,n;un.value?dn.value=function(e,n){const t=Ct(e),l=Ct(n);let o=0,i=t.length-1,r=l.length-1;for(;o<=i&&o<=r&&t[o]===l[o];)o++;for(;i>=o&&r>=o&&t[i]===l[r];)i--,r--;return{removed:Math.max(0,i-o+1),added:Math.max(0,r-o+1)}}(String(null!=(e=l.node.originalCode)?e:""),String(null!=(n=l.node.updatedCode)?n:"")):dn.value={removed:0,added:0}}function Pt(){var e;if(un.value)try{const n=Je(),t=null==(e=null==n?void 0:n.getLineChanges)?void 0:e.call(n);if(!Array.isArray(t))return void Mt();let l=0,o=0;for(const e of t)l+=xt(e.originalStartLineNumber,e.originalEndLineNumber),o+=xt(e.modifiedStartLineNumber,e.modifiedEndLineNumber);dn.value={removed:l,added:o}}catch(n){Mt()}else dn.value={removed:0,added:0}}function Bt(){var e;if(Number.isFinite(Wn.value)&&Wn.value>0&&Number.isFinite(Tn.value))return Wn.value;const n=bt();return"number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?(Tn.value=l.monacoOptions.fontSize,Wn.value=l.monacoOptions.fontSize,Wn.value):n&&n>0?(Tn.value=n,Wn.value=n,n):(Tn.value=12,Wn.value=12,12)}function Et(){const e=Bt(),n=Math.min(36,e+1);Wn.value=n}function Ot(){const e=Bt(),n=Math.max(10,e-1);Wn.value=n}function Lt(){Bt(),Number.isFinite(Tn.value)&&(Wn.value=Tn.value)}function Ft(){var e,n,t,l,o,i,r,a,u,d,s,c,v,f;try{const m=un.value?Je():null,p=un.value?m:Ge();if(!p)return null;if((null==m?void 0:m.getOriginalEditor)&&(null==m?void 0:m.getModifiedEditor)){const v=null==(e=m.getOriginalEditor)?void 0:e.call(m),f=null==(n=m.getModifiedEditor)?void 0:n.call(m);null==(t=null==v?void 0:v.layout)||t.call(v),null==(l=null==f?void 0:f.layout)||l.call(f);const p=(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(p,h);if(g>0)return Math.ceil(g+1);const y=(null==(u=null==(a=null==(r=null==v?void 0:v.getModel)?void 0:r.call(v))?void 0:a.getLineCount)?void 0:u.call(a))||1,w=(null==(c=null==(s=null==(d=null==f?void 0:f.getModel)?void 0:d.call(f))?void 0:s.getLineCount)?void 0:c.call(s))||1,b=Math.max(y,w),S=Math.max(St(v),St(f));return Math.ceil(b*(S+xe)+0+1)}if(null==p?void 0:p.getContentHeight){null==(v=null==p?void 0:p.layout)||v.call(p);const e=p.getContentHeight();if(e>0)return Math.ceil(e+1)}const h=null==(f=null==p?void 0:p.getModel)?void 0:f.call(p);let g=1;h&&"function"==typeof h.getLineCount&&(g=h.getLineCount());const y=St(p);return Math.ceil(g*(y+xe)+0+1)}catch(m){return null}}function Ht(e){if("undefined"==typeof window)return!1;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return!1;const t=e.querySelectorAll(".editor.modified .diff-hidden-lines .center, .stream-monaco-diff-unchanged-bridge");for(const l of Array.from(t)){if(!(l instanceof HTMLElement))continue;const e=window.getComputedStyle(l);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const t=l.getBoundingClientRect();if(!(t.width<=0||t.height<=0||t.bottom<=n.top||t.top>=n.bottom))return!0}return!1}function Nt(e){var n;const t=String(null!=e?e:"").trim(),l=null==(n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i))?void 0:n[1];if(l){const e=3===l.length?l.split("").map(e=>`${e}${e}`).join(""):l;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,r,a]=o.slice(0,3).map(Number);return.2126*i+.7152*r+.0722*a}function zt(){var e;const n=null==(e=te.value)?void 0:e.parentElement;return n instanceof HTMLElement?n:null}function $t(e,n){var t;null==n||!Number.isFinite(n)||n<=0||null==(t=zt())||t.style.setProperty(e,`${n}px`)}function Rt(){var e,n,t;if(Dt())return;const l=bt();l&&l>0&&(_n.value=l,Wn.value=l,Tn.value=l);try{const l=St(un.value?null!=(t=null==(n=null==(e=Je())?void 0:e.getModifiedEditor)?void 0:n.call(e))?t:Je():Ge());l&&l>0&&(An.value=l)}catch(o){}try{const e=wt();e&&e>0&&(An.value=e)}catch(o){}}function Dt(){return un.value&&Hn.value}function Tt(){var e,n,t,l,o,i,r,a;const u=te.value,d=le.value;if(!u||!d)return;const s=u,c=u.querySelector(".monaco-editor")||u,v=c.querySelector(".monaco-editor-background")||c,f=c.querySelector(".view-lines")||c;let m=null,p=null,h=null;try{"undefined"!=typeof window&&"function"==typeof window.getComputedStyle&&(m=window.getComputedStyle(c),p=v===c?m:window.getComputedStyle(v),h=f===c?m:window.getComputedStyle(f))}catch(k){m=null,p=null,h=null}const g=String(null!=(e=null==m?void 0:m.getPropertyValue("--vscode-editor-foreground"))?e:"").trim(),y=String(null!=(n=null==m?void 0:m.getPropertyValue("--vscode-editor-background"))?n:"").trim(),w=String(null!=(l=null!=(t=null==m?void 0:m.getPropertyValue("--vscode-editor-selectionBackground"))?t:null==m?void 0:m.getPropertyValue("--vscode-editor-hoverHighlightBackground"))?l:"").trim(),b=g||String(null!=(i=null!=(o=null==h?void 0:h.color)?o:null==m?void 0:m.color)?i:"").trim(),S=y||String(null!=(a=null!=(r=null==p?void 0:p.backgroundColor)?r:null==m?void 0:m.backgroundColor)?a:"").trim();return un.value?(b?(d.style.setProperty("--markstream-diff-editor-fg",b),s.style.setProperty("--vscode-editor-foreground",b),s.style.setProperty("--stream-monaco-editor-fg",b)):(d.style.removeProperty("--markstream-diff-editor-fg"),s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--stream-monaco-editor-fg")),S?(d.style.setProperty("--markstream-diff-editor-bg",S),d.style.setProperty("--markstream-diff-panel-bg",S),d.style.setProperty("--markstream-diff-panel-bg-soft",S),d.style.setProperty("--markstream-diff-panel-bg-strong",S),s.style.setProperty("--vscode-editor-background",S),s.style.setProperty("--stream-monaco-editor-bg",S),s.style.setProperty("--stream-monaco-fixed-editor-bg",S),s.style.setProperty("--stream-monaco-panel-bg",S),s.style.setProperty("--stream-monaco-panel-bg-soft",S),s.style.setProperty("--stream-monaco-panel-bg-strong",S),s.style.backgroundColor=S):(d.style.removeProperty("--markstream-diff-editor-bg"),d.style.removeProperty("--markstream-diff-panel-bg"),d.style.removeProperty("--markstream-diff-panel-bg-soft"),d.style.removeProperty("--markstream-diff-panel-bg-strong"),s.style.removeProperty("--vscode-editor-background"),s.style.removeProperty("--stream-monaco-editor-bg"),s.style.removeProperty("--stream-monaco-fixed-editor-bg"),s.style.removeProperty("--stream-monaco-panel-bg"),s.style.removeProperty("--stream-monaco-panel-bg-soft"),s.style.removeProperty("--stream-monaco-panel-bg-strong"),s.style.backgroundColor=""),void(w?s.style.setProperty("--vscode-editor-selectionBackground",w):s.style.removeProperty("--vscode-editor-selectionBackground"))):function(e,n,t){if(!Me.value)return!1;const l=Nt(e),o=Nt(n);return t?null!=l&&l>170||null!=o&&o<110:null!=l&&l<85||null!=o&&o>190}(S,b,d.classList.contains("is-dark"))?(s.style.removeProperty("--vscode-editor-foreground"),s.style.removeProperty("--vscode-editor-background"),void s.style.removeProperty("--vscode-editor-selectionBackground")):(b&&s.style.setProperty("--vscode-editor-foreground",b),S&&s.style.setProperty("--vscode-editor-background",S),void(w&&s.style.setProperty("--vscode-editor-selectionBackground",w)))}let Wt=0,_t=0;const At=/auto|scroll|overlay/i;function jt(e,n,t){var l;if("undefined"==typeof window)return;if(un.value)return;if(function(e){return Ln.value||On(e)}(e))return;const o=Math.ceil(n),i=Math.ceil(t)-o;if(Math.abs(i)<=1)return;const r=function(e){var n,t;if("undefined"==typeof window)return null;const l=null!=(n=null==e?void 0:e.ownerDocument)?n:document,o=l.scrollingElement||l.documentElement||l.body;let i=null!=(t=null==e?void 0:e.parentElement)?t:null;for(;i&&i!==l.body&&i!==o;){const e=window.getComputedStyle(i),n=(e.overflowY||"").toLowerCase(),t=(e.overflow||"").toLowerCase();if(At.test(n)||At.test(t))return i;i=i.parentElement}return o}(e);if(!r)return;const a=null!=(l=e.ownerDocument)?l:document,u=r===a.body||r===a.documentElement||r===a.scrollingElement,d=u?0:r.getBoundingClientRect().top;e.getBoundingClientRect().top-d>=0||(u&&"function"==typeof window.scrollBy?window.scrollBy(0,i):r.scrollTop+=i)}function It(){try{const e=te.value;if(!e)return;const n=e.getBoundingClientRect().height,t=Ft();if(null!=t&&t>0){const l=gt(t,!0),o=rt();return e.style.minHeight=null!=o?`${o}px`:"0px",e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",void jt(e,n,l)}const l=rt();null!=l&&(e.style.minHeight=`${l}px`,e.style.height=`${l}px`,e.style.maxHeight="none",e.style.overflow="visible",jt(e,n,l))}catch(e){}}function qt(){for(var e,n;ln.length>0;)try{null==(n=null==(e=ln.pop())?void 0:e.dispose)||n.call(e)}catch(t){}null!=Ne&&(Z(Ne),Ne=null)}function Ut(){for(var e;on.length>0;)try{null==(e=on.pop())||e()}catch(n){}}function Vt(e=!1){Be.value||(Pe.value?It():function(){var e;try{const n=te.value;if(!n)return;const t=n.getBoundingClientRect().height,l=Zt(),o=Math.ceil((null==(e=n.getBoundingClientRect)?void 0:e.call(n).height)||0),i=un.value?function(){var e,n,t,l,o,i,r,a;try{const u=Je(),d=null==(e=null==u?void 0:u.getOriginalEditor)?void 0:e.call(u),s=null==(n=null==u?void 0:u.getModifiedEditor)?void 0:n.call(u);if(!d||!s)return null;const c=(null==(o=null==(l=null==(t=d.getModel)?void 0:t.call(d))?void 0:l.getLineCount)?void 0:o.call(l))||1,v=(null==(a=null==(r=null==(i=s.getModel)?void 0:i.call(s))?void 0:r.getLineCount)?void 0:a.call(r))||1,f=Math.max(c,v),m=Math.max(St(d),St(s)),p=Math.max(kt(d),kt(s));return Math.ceil(f*(m+xe)+p+0+1)}catch(u){return null}}():null,r=un.value&&Ht(n),a=r&&Le.value&&kn.value&&!Cn.value&&!Mn.value;if(r||(Re.value=null),Te>0&&(Te--,null!=$e.value))return void jt(n,t,Kt(n,$e.value,l,{allowBelowEstimatedFloor:a}));const u=un.value?function(e){var n,t;if("undefined"==typeof window)return null;try{const l=e.getBoundingClientRect(),o=window.getComputedStyle(e);if("none"===o.display||"hidden"===o.visibility)return null;const i=[".editor.original .view-lines .view-line",".editor.modified .view-lines .view-line",".editor.original .view-zones > div",".editor.modified .view-zones > div",".editor.original .margin-view-zones > div",".editor.modified .margin-view-zones > div",".editor.original .diff-hidden-lines",".editor.modified .diff-hidden-lines",".stream-monaco-diff-unchanged-bridge"];let r=0;for(const n of Array.from(e.querySelectorAll(i.join(",")))){if(!(n instanceof HTMLElement))continue;const e=window.getComputedStyle(n);if("none"===e.display||"hidden"===e.visibility)continue;if(Number.parseFloat(e.opacity||"1")<=.01)continue;const t=n.getBoundingClientRect();t.height<=0||t.bottom<=l.top||(r=Math.max(r,t.bottom-l.top))}if(r>0)return Math.ceil(r);const a=e.querySelector(".monaco-diff-editor"),u=null!=(t=null==(n=null==a?void 0:a.getBoundingClientRect)?void 0:n.call(a).height)?t:0;return u>0?Math.ceil(u+1):null}catch(l){return null}}(n):null,d=un.value?r?u:null!=i?Math.max(null!=u?u:0,i):u:Ft();if(null!=d&&d>0){const e=null!=Re.value&&Date.now()<De&&d>=l-1,i=r&&o>0&&o<l-1&&d>=l-1,u=Kt(n,e?Re.value:i?o:d,l,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:a});return r&&u<l-1&&(Re.value=u,De=Date.now()+160),void jt(n,t,u)}if(null!=$e.value)return void jt(n,t,Kt(n,$e.value,l,{allowBelowEstimatedFloor:a}));const s=r?o:Math.max(o,null!=i&&i>0?i:0);if(s>0){const e=null!=Re.value&&Date.now()<De&&s>=l-1,i=r&&o>0&&o<l-1&&s>=l-1,u=Kt(n,e?Re.value:i?o:s,l,{allowBelowEstimatedFloor:a});return r&&u<l-1&&(Re.value=u,De=Date.now()+160),void jt(n,t,u)}const c=rt();if(null!=c)return void jt(n,t,Kt(n,c,l,{allowBelowEstimatedFloor:a}));const v=Number.parseFloat(n.style.height);!Number.isNaN(v)&&v>0?jt(n,t,Kt(n,v,l,{allowBelowEstimatedFloor:a})):un.value||jt(n,t,Kt(n,l,l))}catch(n){}}())}function Gt(){Wt=0,_t=0}function Jt(e=!1){var n,t,l;const o=te.value;if(!o)return;const i=un.value?Je():Ge();if(i&&"function"==typeof i.layout)try{const r=null==(n=o.getBoundingClientRect)?void 0:n.call(o),a=Math.ceil((null!=(t=null==r?void 0:r.width)?t:0)||o.clientWidth||0),u=Math.ceil((null!=(l=null==r?void 0:r.height)?l:0)||o.clientHeight||Number.parseFloat(o.style.height||"")||0);if(a>0&&u>0){if(!e&&a===Wt&&u===_t)return;Wt=a,_t=u,i.layout({width:a,height:u})}else Gt(),i.layout()}catch(r){}}function Xt(){if(!un.value)return void Ut();const e=te.value;if(!e)return void Ut();const n=e.querySelector(".monaco-diff-editor");if(!n||n.classList.contains("side-by-side"))return void Ut();const t=Array.from(n.querySelectorAll(".editor.original .diff-hidden-lines")),l=Array.from(n.querySelectorAll(".editor.modified .diff-hidden-lines")),o=Math.min(t.length,l.length);for(let i=0;i<o;i++){const e=l[i],n=e.querySelector("a"),t=e.querySelector(".center > div:first-child"),o=e.querySelector(".center");if(!n||!t||!o)continue;if(o.querySelector(".markstream-inline-fold-proxy"))continue;const r=document.createElement("button");r.type="button",r.className="markstream-inline-fold-proxy",r.dataset.markstreamInlineFoldProxy="true";const a=n.getAttribute("title")||"Show Unchanged Region";r.title=a,r.setAttribute("aria-label",a);const u=e=>{e.preventDefault(),e.stopPropagation()},d=e=>{e.preventDefault(),e.stopPropagation(),n.click(),Q(()=>Yt())},s=e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),n.click(),Q(()=>Yt()))};r.addEventListener("mousedown",u),r.addEventListener("click",d),r.addEventListener("keydown",s),o.appendChild(r),on.push(()=>{r.removeEventListener("mousedown",u),r.removeEventListener("click",d),r.removeEventListener("keydown",s),r.parentElement===o&&o.removeChild(r)})}}function Yt(e=!1){null==Ne&&(Ne=Q(()=>{Ne=null,Q(()=>{Xt(),Vt(e),Jt()})}))}function Kt(e,n,t,l={}){dt(n);const o=ut(),i=null!=o?Math.max(n,o):n,r=Math.min(i,t),a=!0===l.allowBelowEstimatedFloor||ht(),u=gt(r,!0===l.clearEstimatedFloor,{allowBelowEstimatedFloor:a}),d=rt();if(e.style.minHeight=null==d||a?"0px":`${Math.min(d,Math.ceil(t))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(t)}px`,un.value)e.style.overflow="hidden";else{const n=i>t+1;e.style.overflow=n?"auto":"hidden"}return u}function Qt(e,n,t){return d(this,null,function*(){try{return void(yield Ue(e,n,t))}catch(l){if(!hn(l))throw l}if(yield E(),yield yt(),!He&&un.value)try{yield Ue(e,n,t)}catch(l){if(!hn(l))throw l}})}function Zt(){var e,n;const t=null!=(n=null==(e=l.monacoOptions)?void 0:e.MAX_HEIGHT)?n:500;if("number"==typeof t)return t;const o=String(t).match(/^(\d+(?:\.\d+)?)/);return o?Number.parseFloat(o[1]):500}const el=c(()=>l.isShowPreview&&("html"===ie.value||"svg"===ie.value));function nl(){return"boolean"==typeof l.node.loading?l.node.loading:!0===l.loading}function tl(e,n,t){return t&&!String(null!=n?n:"")?"plain":G(String(null!=e?e:""))}function ll(){var e,n,t,o;return!(!nl()||(un.value?String(null!=(e=l.node.originalCode)?e:"")||String(null!=(n=l.node.updatedCode)?n:"")||String(null!=(t=l.node.code)?t:""):String(null!=(o=l.node.code)?o:"")))}P(()=>[l.node.language,l.node.code,l.node.loading,l.loading],([e,n,t,l])=>{ie.value=tl(e,n,"boolean"==typeof t?t:!0===l)}),P(()=>[l.node.originalCode,l.node.updatedCode,un.value],()=>{Mt(),Q(()=>Pt())},{immediate:!0}),P(()=>[un.value,l.stream,l.loading,Fn.value,Cn.value,Mn.value,nt.value],()=>{at()?dt(nt.value):it.value=null},{immediate:!0}),P(()=>[l.node.originalCode,l.node.updatedCode,Ce.value,un.value],e=>d(null,[e],function*([,,,e]){var n,t;if(!1===l.stream||!e)return;if(je&&!Ee.value&&te.value)try{yield gl(te.value)}catch(a){}const o=Ze;if(o&&!Oe.value){try{yield o}catch(a){}if(He||!un.value)return}const i=mn(String(null!=(n=l.node.originalCode)?n:""),String(null!=(t=l.node.updatedCode)?t:"")),r=!1===l.loading;r&&Bl();try{yield Qt(i.original,i.updated,Ce.value),Jt(!0)}catch(u){return}if(r){if(He||!un.value)return;gn(),Xt(),Pt(),Yt()}Pe.value&&Q(()=>It())})),P(()=>l.node.code,e=>d(null,null,function*(){if(!1===l.stream)return;if(ie.value||(ie.value=G(en(e))),un.value)return;const n=Ze;if(n&&!Oe.value){try{yield n}catch(t){}if(He||un.value)return}if(je&&!Ee.value&&te.value)try{yield gl(te.value)}catch(t){}qe(pn(l.node.code,!0===l.node.loading),Ce.value),Pe.value&&Q(()=>It())}));const ol=c(()=>{const e=ie.value;return e?J[e]||e.charAt(0).toUpperCase()+e.slice(1):J[""]||"Plain Text"});function il(e){var n,t;const l=null!=(t=null==(n=String(null!=e?e:"").split(/\r?\n/,1)[0])?void 0:n.trim())?t:"";if(l.length<3)return"";const o=l[0];if("`"!==o&&"~"!==o||l[1]!==o||l[2]!==o)return"";let i=3;for(;l[i]===o;)i+=1;return l.slice(i).trim()}const rl=c(()=>{var e;return function(e){const n=il(e);if(!n)return"";const t=n.split(/\s+/).filter(Boolean);if(!t.length)return"";const l="diff"===t[0]?t.slice(1):t;for(const o of l){const e=o.includes(":")?o.slice(o.indexOf(":")+1):o;if(e&&/[./\\-]/.test(e))return e}return""}(String(null!=(e=l.node.raw)?e:""))}),al=c(()=>rl.value||ol.value),ul=c(()=>rl.value?un.value?`Diff / ${ol.value}`:ol.value:""),dl=c(()=>(X.value,Y(ie.value||""))),sl=c(()=>{const e={},n=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t=n(l.minWidth),o=n(l.maxWidth);if(t&&(e.minWidth=t),o&&(e.maxWidth=o),vt.value&&!un.value){const n=ft.value;null!=n&&(e.minHeight=`${n}px`)}return un.value||(e.color="var(--vscode-editor-foreground, var(--markstream-code-fallback-fg))",e.backgroundColor="var(--vscode-editor-background, var(--markstream-code-fallback-bg))",e.borderColor="var(--markstream-code-border-color)"),e}),cl=c(()=>!1!==l.showTooltips);function vl(){return d(this,null,function*(){try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(l.node.code)),oe.value=!0,o("copy",l.node.code),setTimeout(()=>{oe.value=!1},1e3)}catch(e){console.error("复制失败:",e)}})}function fl(e){if(Pe.value=!Pe.value,e&&cl.value){const n=function(e){const n=e.currentTarget||e.target;return!n||n.disabled?null:n}(e);if(n){const e=Pe.value?W("common.collapse")||"Collapse":W("common.expand")||"Expand";q(n,e,"top",!1,void 0,l.isDark)}}const n=un.value?Je():Ge(),t=te.value;n&&t&&(Pe.value?(hl(!0),t.style.maxHeight="none",t.style.overflow="visible",Vt(!0)):(hl(!1),t.style.overflow=un.value?"hidden":"auto",Vt(!0)))}function ml(){var e,n,t;if(Be.value=!Be.value,Be.value){if(te.value){const t=Math.ceil((null==(n=(e=te.value).getBoundingClientRect)?void 0:n.call(e).height)||0);t>0&&($e.value=t)}hl(!1)}else{Pe.value&&hl(!0),te.value&&null!=$e.value&&(te.value.style.height=`${$e.value}px`);const e=un.value?Je():Ge();try{null==(t=null==e?void 0:e.layout)||t.call(e)}catch(l){}Te=2,Q(()=>{Vt(!0)})}}function pl(){if(!el.value)return;const e=ie.value;if(w.value){const n="html"===e?"text/html":"image/svg+xml",t="html"===e?W("artifacts.htmlPreviewTitle")||"HTML Preview":W("artifacts.svgPreviewTitle")||"SVG Preview";return void o("previewCode",{node:l.node,artifactType:n,artifactTitle:t,id:`temp-${e}-${Date.now()}`})}"html"===e&&($n.value=!$n.value)}function hl(e){var n,t;try{if(un.value){const t=Je();null==(n=null==t?void 0:t.updateOptions)||n.call(t,{automaticLayout:e})}else{const n=Ge();null==(t=null==n?void 0:n.updateOptions)||t.call(n,{automaticLayout:e})}}catch(l){}}function gl(e){if(!je||He)return null;if(ll())return null;if(Qe)return Qe;if(Ee.value&&Le.value)return Promise.resolve();Ee.value=!0,function(){const e=v.value;r&&e&&ze!==e&&(ze&&r.markSettled(ze),ze=e,r.markPending(e))}();const n=d(null,null,function*(){yield function(e){return d(this,null,function*(){var n;if("undefined"==typeof window)return yield e();try{const t=null==(n=window.Element)?void 0:n.prototype,l=null==t?void 0:t.addEventListener;if(!t||!l)return yield e();const o=function(){const e=window,n=e[ke];if(n)return n;const t={depth:0,original:null};return e[ke]=t,t}();0===o.depth&&(o.original=l,t.addEventListener=function(e,n,t){var i;const r=null!=(i=o.original)?i:l;return"touchstart"===e&&function(e,n){if(!e)return!1;const t=e;return!("function"!=typeof t.closest||!t.closest(".monaco-editor, .monaco-diff-editor")||n&&"object"==typeof n&&"passive"in n)}(this,t)?r.call(this,e,n,function(e){return null==e?{passive:!0}:"boolean"==typeof e?{capture:e,passive:!0}:"object"==typeof e?"passive"in e?e:u(a({},e),{passive:!0}):{passive:!0}}(t)):r.call(this,e,n,t)}),o.depth++;try{return yield e()}finally{o.depth=Math.max(0,o.depth-1),0===o.depth&&o.original&&t.addEventListener!==o.original&&(t.addEventListener=o.original,o.original=null)}}catch(t){return yield e()}})}(()=>function(e){return d(this,null,function*(){var n;if(!je||He)return;if(xn.value=!1,Oe.value=!1,kn.value=!1,Cn.value=!1,Mn.value=!1,pt(),_n.value=null,An.value=null,function(){const e=zt();e&&(e.style.removeProperty("--stream-monaco-line-number-left"),e.style.removeProperty("--stream-monaco-line-number-width"),e.style.removeProperty("--stream-monaco-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-modified-line-number-gap-to-code"),e.style.removeProperty("--stream-monaco-original-scrollable-left"),e.style.removeProperty("--stream-monaco-modified-scrollable-left"))}(),Gt(),function(){const e=tt.value;ot.value=Le.value||null==e?null:e}(),qt(),Ut(),function(e){e.replaceChildren()}(e),He)return;const t=d(null,null,function*(){var n,t;if(un.value){!function(){if(tn||"undefined"==typeof window)return;tn=!0;const e=e=>{var n;hn("reason"in e?e.reason:null!=(n=e.error)?n:e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",e,!0)}(),Ye();const o=mn(String(null!=(n=l.node.originalCode)?n:""),String(null!=(t=l.node.updatedCode)?t:""));Ie?yield Ie(e,o.original,o.updated,Ce.value):yield je(e,l.node.code,Ce.value)}else yield je(e,Rn.value,Ce.value);Oe.value=!0}),o=t.finally(()=>{Ze===o&&(Ze=null)});if(Ze=o,yield o,He)return;const i=un.value?Je():Ge();if("number"==typeof(null==(n=l.monacoOptions)?void 0:n.fontSize))null==i||i.updateOptions({fontSize:l.monacoOptions.fontSize,automaticLayout:!1}),Tn.value=l.monacoOptions.fontSize,Wn.value=l.monacoOptions.fontSize;else if(!Dt()){const e=bt();e&&e>0?(Tn.value=e,Wn.value=e):(Tn.value=12,Wn.value=12)}Rt(),Pe.value||Be.value||Vt(!1),yield function(){return d(this,null,function*(){null!=rt()&&(Xt(),Vt(!1),yield E(),yield yt(),Xt(),Vt(!1),yield yt(),Xt(),Vt(!1))})}(),He||(Le.value=!0,function(){var e,n,t,l,o;if(qt(),un.value){const l=Je(),o=null==(e=null==l?void 0:l.getOriginalEditor)?void 0:e.call(l),i=null==(n=null==l?void 0:l.getModifiedEditor)?void 0:n.call(l),a=(e,n)=>{try{const t=null==e?void 0:e[n];if("function"!=typeof t)return;const l=t.call(e,()=>Yt());l&&ln.push(l)}catch(t){}};try{const e=null==(t=null==l?void 0:l.onDidUpdateDiff)?void 0:t.call(l,()=>{Yt(),Q(()=>Pt())});e&&ln.push(e)}catch(r){}return a(o,"onDidContentSizeChange"),a(i,"onDidContentSizeChange"),a(o,"onDidLayoutChange"),void a(i,"onDidLayoutChange")}const i=Ge();try{const e=null==(l=null==i?void 0:i.onDidContentSizeChange)?void 0:l.call(i,()=>Yt());e&&ln.push(e)}catch(r){}try{const e=null==(o=null==i?void 0:i.onDidLayoutChange)?void 0:o.call(i,()=>Yt());e&&ln.push(e)}catch(r){}}(),Tt(),Rt(),Xt(),Pt(),Yt(),yield function(){return d(this,null,function*(){Xt(),Vt(!1),yield E(),yield yt(),Xt(),Vt(!1),yield yt(),Xt(),Vt(!1)})}(),yield function(){return d(this,null,function*(){var e;if(un.value){for(let t=0;t<8;t++){if(He)return;const l=te.value,o=Je();let i=!1;try{const n=null==(e=null==o?void 0:o.getLineChanges)?void 0:e.call(o);i=Array.isArray(n)}catch(n){i=!1}const r=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor")),a=Boolean(null==l?void 0:l.querySelector(".monaco-diff-editor .view-lines .view-line"));if(r&&a&&i){if(yield E(),yield yt(),He)return;try{gn(),Xt(),Pt(),Yt()}catch(n){}return}if(t>=1&&!r)return;yield E(),yield yt()}if(!He)try{gn(),Xt(),Pt(),Yt()}catch(n){}}})}(),He||(Rt(),function(){if(!un.value)return;const e=te.value;if(!e)return;const n=e.querySelector(".monaco-diff-editor");function t(e,n,t,l){const o=e.querySelector(n);if(!o)return;const i=o.getBoundingClientRect();if(i.width<=0)return;const r=o.querySelector(".line-numbers"),a=o.querySelector(".view-lines .view-line"),u=o.querySelector(".margin");let d=null;if(a?(d=a.getBoundingClientRect().left-i.left,$t(t,d)):u&&(d=u.getBoundingClientRect().width,$t(t,d)),r){const e=r.getBoundingClientRect();if(e.width>=20&&e.width<=64&&$t("--stream-monaco-line-number-width",e.width),null!=d){const n=d-(e.right-i.left);Number.isFinite(n)&&n>=0&&n<=32&&($t(l,n),$t("--stream-monaco-line-number-gap-to-code",n))}}}n&&(t(n,".editor.original","--stream-monaco-original-scrollable-left","--stream-monaco-original-line-number-gap-to-code"),t(n,".editor.modified","--stream-monaco-modified-scrollable-left","--stream-monaco-modified-line-number-gap-to-code"))}(),yield E(),function(){var e;if(!un.value||!Fn.value)return;const n=te.value,t=null==(e=le.value)?void 0:e.querySelector("pre.code-pre-fallback");if(!n||!t)return;const l=Math.ceil(t.getBoundingClientRect().height);!Number.isFinite(l)||l<=0||(n.style.height=`${l}px`,n.style.minHeight=`${l}px`)}(),yield yt(),yield function(){return d(this,null,function*(){if(un.value){if(Cn.value=!0,Mn.value=!1,kn.value=!0,yield E(),yield yt(),!He){if(Jt(!0),Mn.value=!0,pt(),"undefined"==typeof window)return Cn.value=!1,void(Mn.value=!1);Pn=window.setTimeout(()=>{Pn=null,Cn.value=!1,Mn.value=!1,Q(()=>{Rt(),Xt(),Yt()})},120)}}else kn.value=!0})}()))})}(e))}).finally(()=>{Qe===n&&(Qe=null),function(){const e=ze;r&&e&&(ze="",E(()=>{var n,t;if(!He){const l=null!=(t=null==(n=le.value)?void 0:n.offsetHeight)?t:0;l>0&&r.reportHeight(e,l)}r.markSettled(e)}))}()});return Qe=n,n}P(cl,e=>{e||j()}),P(()=>Wn.value,(e,n)=>{const t=un.value?Je():Ge();t&&"number"==typeof e&&Number.isFinite(e)&&e>0&&(t.updateOptions({fontSize:e}),Be.value||Vt(!0))},{flush:"post",immediate:!1});const yl=P(()=>[te.value,un.value,l.stream,l.loading,Fe.value,Ae.value,l.node.code,l.node.loading],e=>d(null,[e],function*([e,n,t,l,o,i]){if(!e||!je)return;if(!i)return;if(!1===t&&!1!==l)return;if(ll())return;const r=gl(e);if(r){try{yield r}catch(a){Le.value=!1,kn.value=!1,xn.value=!0}yl()}}));function wl(e){return!!e&&"object"==typeof e&&"light"in e&&"dark"in e}function bl(e){return"string"==typeof e?e:e&&"object"==typeof e&&"name"in e?String(e.name):null}function Sl(e,n){if(e===n)return!0;const t=bl(e),l=bl(n);return!!t&&t===l}function kl(){var e;const n=function(){if(void 0!==l.theme){const e=l.theme;return wl(e)?l.isDark?e.dark:e.light:e}return l.isDark?l.darkTheme:l.lightTheme}(),t=null==(e=yn.value)?void 0:e.theme,o=null!=n?n:t;if(null!=o&&"object"==typeof o)return o;const i=Array.isArray(l.themes)?l.themes:[];if(!i.length||null==o)return o;const r=bl(o),a=i.map(e=>bl(e)).filter(e=>!!e);if(!r||a.includes(r))return o;const u=bl(t);return null!=t&&u&&a.includes(u)?t:i[0]}P(wn,(e,n)=>d(null,null,function*(){if(e===n)return;if(bn.value=e,!je||!te.value)return;if(!Ee.value)return;if(!1===l.stream&&!1!==l.loading)return;if(!Ae.value)return;const t=Qe;if(t){try{yield t}catch(o){}if(He||!te.value)return}try{Le.value=!1,kn.value=!1,Ee.value=!1,Oe.value=!1,qt(),Ut(),Ye(),yield E(),yield gl(te.value)}catch(i){Le.value=!1,kn.value=!1,xn.value=!0}}));const xl=c(()=>(void 0!==l.theme?!wl(l.theme):Sl(l.darkTheme,l.lightTheme))?function(e){var n,t;if(e&&"object"==typeof e&&(null==(n=e.colors)?void 0:n["editor.background"])){const n=Nt(e.colors["editor.background"]);if(null!=n)return n<128}const o=(null!=(t=bl(e))?t:"").toLowerCase();return o?["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=>o.includes(e))&&!["light","latte","dawn","lotus"].some(e=>o.includes(e)):!!l.isDark}(kl()):!!l.isDark),Cl=c(()=>{var e;if(!un.value)return xl.value?"dark":"light";const n=null==(e=yn.value)?void 0:e.diffAppearance;return"light"===n||"dark"===n?n:xl.value?"dark":"light"}),Ml=c(()=>un.value?"dark"===Cl.value:xl.value);function Pl(){return u(a(u(a({wordWrap:"on",wrappingIndent:"same",themes:l.themes},yn.value||{}),{theme:kl()}),un.value?{diffAppearance:Cl.value}:{}),{onThemeChange(){Tt()}})}function Bl(){const e=Pl();if(!rn)return rn=e,rn;for(const n of Object.keys(rn))n in e||delete rn[n];return Object.assign(rn,e),rn}const El=c(()=>{var e,n,t,o,i,r,u,d,s,c,v,f,m,p,h;return JSON.stringify({diffLineStyle:null!=(n=null==(e=yn.value)?void 0:e.diffLineStyle)?n:"background",diffUnchangedRegionStyle:null!=(o=null==(t=yn.value)?void 0:t.diffUnchangedRegionStyle)?o:"line-info",diffHideUnchangedRegions:void 0===(null==(i=l.monacoOptions)?void 0:i.diffHideUnchangedRegions)?a({},cn):fn(l.monacoOptions.diffHideUnchangedRegions),renderSideBySide:null==(u=null==(r=yn.value)?void 0:r.renderSideBySide)||u,useInlineViewWhenSpaceIsLimited:null!=(s=null==(d=yn.value)?void 0:d.useInlineViewWhenSpaceIsLimited)&&s,enableSplitViewResizing:null==(v=null==(c=yn.value)?void 0:c.enableSplitViewResizing)||v,ignoreTrimWhitespace:null==(m=null==(f=yn.value)?void 0:f.ignoreTrimWhitespace)||m,originalEditable:null!=(h=null==(p=yn.value)?void 0:p.originalEditable)&&h})});return P(()=>[l.monacoOptions,Ae.value],()=>{var e,n;if(Bl(),!je||!Ae.value)return;const t=un.value?Je():Ge(),o="number"==typeof(null==(e=l.monacoOptions)?void 0:e.fontSize)?l.monacoOptions.fontSize:Number.isFinite(Wn.value)?Wn.value:void 0;"number"==typeof o&&Number.isFinite(o)&&o>0&&(null==(n=null==t?void 0:t.updateOptions)||n.call(t,{fontSize:o})),Vt(!1)},{deep:!0}),P(()=>[kl(),Cl.value,Fe.value,Ee.value,Ae.value],([e],n)=>{Fe.value&&Ee.value&&Ae.value&&function(e={}){if(e.appearanceOnly)return;Bl();const n=kl(),t=()=>{un.value&&gn(),Q(()=>{Tt(),Yt()})};n?function(e,n){const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&"name"in e)return String(e.name);if("object"==typeof e){const t=fe.get(e);if(t)return t;try{const n=JSON.stringify(e);if(n)return fe.set(e,n),n}catch(n){}const l="__theme_"+ ++me;return fe.set(e,l),l}return String(e)}(n);return t?(ve=e,ae||ce!==t?ae?(se===t||ue===t||(de=n,se=t),ae):(de=n,se=t,ae=d(null,null,function*(){for(;se&&null!=de;){const t=de,l=se;if(de=null,se=null,ce!==l)try{ue=l,yield(null!=ve?ve:e)(t),ce=l}catch(n){}}}).finally(()=>{ae=null,ue=null}),ae):Promise.resolve()):Promise.resolve()}(nn,n).then(t).catch(e=>{}):t()}({appearanceOnly:null!=n&&Sl(e,n[0])})},{flush:"post"}),P(()=>[El.value,Fe.value,Ae.value],(e,n)=>d(null,[e,n],function*([e,n,t],[o]){if(Bl(),!n||!t)return;if(!je||!te.value)return;if(!Ee.value)return;if(e===o)return;if(!1===l.stream&&!1!==l.loading)return;const i=Qe;if(i){try{yield i}catch(r){}if(He||!te.value)return}try{Le.value=!1,kn.value=!1,Ee.value=!1,Oe.value=!1,qt(),Ut(),Ye(),yield E(),yield gl(te.value)}catch(a){Le.value=!1,kn.value=!1,xn.value=!0}}),{flush:"post"}),P(()=>[l.loading,Ae.value],(e,n)=>d(null,[e,n],function*([e,n],t){if(!n)return;const o=null==t?void 0:t[0];if(!1===o&&!1!==e&&un.value&&Ee.value&&(yield E(),Q(()=>{d(null,null,function*(){const e=Qe;if(e)try{yield e}catch(n){}!He&&un.value&&!1!==l.loading&&(Bl(),gn(),Yt())})})),e)return;const i=void 0!==o&&!1!==o;yield E(),Q(()=>{d(null,null,function*(){var e,n;try{if(i&&Ee.value)if(un.value&&te.value){const o=Qe;if(o)try{yield o}catch(t){}Bl();const i=mn(String(null!=(e=l.node.originalCode)?e:""),String(null!=(n=l.node.updatedCode)?n:""));if(yield Qt(i.original,i.updated,Ce.value),He||!un.value)return;gn(),Jt(!0),Xt(),Pt(),Yt()}else qe(Rn.value,Ce.value);Vt(!1)}catch(o){}})})}),{immediate:!0,flush:"post"}),f(()=>{pt(),qt(),Ut(),Xe()}),(n,t)=>Sn.value?(m(),p(S(I),{key:0,node:Dn.value,loading:l.loading},null,8,["node","loading"])):(m(),O("div",{key:1,ref_key:"container",ref:le,style:L(sl.value),class:y(["code-block-container rounded-lg border",[{dark:l.isDark,"is-rendering":l.loading,"is-dark":Ml.value,"is-diff":un.value,"is-plain-text":Me.value}]]),"data-markstream-code-block":"1","data-markstream-enhanced":kn.value&&!Sn.value?"true":"false","data-markstream-pending":zn.value?"true":void 0},[F(ee,{"show-header":l.showHeader,"show-collapse-button":l.showCollapseButton,"show-font-size-buttons":l.showFontSizeButtons,"enable-font-size-control":l.enableFontSizeControl,"show-copy-button":l.showCopyButton,"show-expand-button":l.showExpandButton,"show-preview-button":l.showPreviewButton,"show-tooltips":l.showTooltips,"is-dark":l.isDark,loading:l.loading,stream:e.stream,"is-collapsed":Be.value,"is-expanded":Pe.value,"copy-text":oe.value,"is-previewable":el.value,"code-font-size":Wn.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":Tn.value,"font-baseline-ready":jn.value,"diff-stats":un.value?dn.value:null,"diff-stats-aria-label":sn.value,onToggleCollapse:ml,onDecreaseFont:Ot,onResetFont:Lt,onIncreaseFont:Et,onCopy:vl,onToggleExpand:fl,onPreview:pl},H({"header-left":N(()=>[D(n.$slots,"header-left",{},()=>[g("div",he,[g("span",{class:"icon-slot h-4 w-4 flex-shrink-0",innerHTML:dl.value},null,8,ge),g("div",ye,[g("div",we,b(al.value),1),ul.value?(m(),O("div",be,b(ul.value),1)):$("",!0)])])],!0)]),loading:N(()=>[D(n.$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:N(()=>[z(g("div",Se,[g("div",{ref_key:"codeEditor",ref:te,class:y(["code-editor-container",[e.stream?"":"code-height-placeholder",{"is-hidden":Nn.value}]]),style:L(mt.value)},null,6),Hn.value?(m(),p(S(I),{key:0,class:y(["code-pre-fallback",{"is-wrap":Bn.value,"is-fading-out":Mn.value}]),style:L(ct.value),node:Dn.value,"show-line-numbers":!0,"diff-inline":En.value},null,8,["class","style","node","diff-inline"])):$("",!0)],512),[[R,!(Be.value||!e.stream&&e.loading)]]),$n.value&&!w.value&&el.value&&"html"===ie.value?(m(),p(re,{key:0,code:l.node.code,"html-preview-allow-scripts":l.htmlPreviewAllowScripts,"html-preview-sandbox":l.htmlPreviewSandbox,"is-dark":l.isDark,"on-close":()=>$n.value=!1},null,8,["code","html-preview-allow-scripts","html-preview-sandbox","is-dark","on-close"])):$("",!0)]),_:2},[n.$slots["header-right"]?{name:"header-right",fn:N(()=>[D(n.$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,pe))}}),[["__scopeId","data-v-3623d4ba"]]);export{Ce as default};
|