@onerjs/code-input 0.0.0-stage → 0.1.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 CHANGED
@@ -1,3 +1,291 @@
1
- # Temporary Holding Version
1
+ # 轻量代码输入框 CodeEditor
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 一个基于 Vue 3 + Vite 的轻量代码输入框组件,用于在业务表单中提供 JavaScript / TypeScript 的代码编辑与提示能力。
4
+
5
+ 不使用 CodeMirror / Monaco 等重型编辑器,全部逻辑自研,体积小、可定制。
6
+
7
+ ## 特性
8
+
9
+ - **轻量自研补全**:内置 JS / TS 关键字、全局对象,支持自定义变量 / 方法的成员提示(`obj.`)
10
+ - **类型提示**:`detail`(类型签名)与 `type`(完整类型定义,TS 语法高亮)
11
+ - **悬停定义**:鼠标悬停在变量 / 成员上显示含义与类型定义
12
+ - **模板模式**:仅在 `{{ }}`(可自定义定界符)区间内触发代码补全
13
+ - **语法高亮**:关键字 / 字符串 / 数字 / 注释 / 内置对象着色
14
+ - **暗色主题**:亮色 / 暗色一键切换
15
+ - **折叠展开**:默认单行输入,点击展开为多行编辑器
16
+ - **智能滚动**:光标移动 / 换行自动滚动到可视区,单行模式整行吸附
17
+ - **编辑增强**:括号自动闭合、回车自动缩进
18
+
19
+ ## 安装
20
+
21
+ ```bash
22
+ npm install @onerjs/code-input
23
+ ```
24
+
25
+ 作为插件全局注册(组件名为 `CodeInput`):
26
+
27
+ ```ts
28
+ import { createApp } from 'vue'
29
+ import CodeInput from '@onerjs/code-input'
30
+ import '@onerjs/code-input/style.css'
31
+
32
+ createApp(App).use(CodeInput).mount('#app')
33
+ ```
34
+
35
+ 或按需引入组件:
36
+
37
+ ```vue
38
+ <script setup lang="ts">
39
+ import { CodeEditor } from '@onerjs/code-input'
40
+ import type { CompletionItem } from '@onerjs/code-input'
41
+ import '@onerjs/code-input/style.css'
42
+ </script>
43
+ ```
44
+
45
+ 也可以只使用核心能力(不渲染组件):
46
+
47
+ ```ts
48
+ import { parseTsCompletions, defaultCompletions } from '@onerjs/code-input'
49
+ ```
50
+
51
+ > 需要 Vue 3.5+(作为 `peerDependency`,由宿主项目提供)。
52
+
53
+ ## 本地开发
54
+
55
+ ```bash
56
+ npm install
57
+ npm run dev # 启动演示页
58
+ npm run build # 类型检查 + 构建库产物到 dist/
59
+ npm run preview # 预览构建产物
60
+ ```
61
+
62
+ ## 构建与发布
63
+
64
+ ```bash
65
+ npm run build
66
+ npm publish
67
+ ```
68
+
69
+ 产物说明:
70
+
71
+ - `dist/code-input.es.js` / `dist/code-input.cjs`:ESM / CJS 两种模块格式(`vue` 已 external)
72
+ - `dist/style.css`:样式文件,需使用方手动引入
73
+ - `dist/index.d.ts`:类型声明入口
74
+
75
+ ## 基础用法
76
+
77
+ ```vue
78
+ <script setup lang="ts">
79
+ import { ref } from 'vue'
80
+ import CodeEditor from './components/CodeEditor.vue'
81
+ import type { CompletionItem } from './core/types'
82
+
83
+ const code = ref('const user = $user\n')
84
+
85
+ const completions: CompletionItem[] = [
86
+ {
87
+ label: '$user',
88
+ kind: 'variable',
89
+ detail: 'User',
90
+ type: `interface User {
91
+ id: number
92
+ name: string
93
+ }`,
94
+ documentation: '当前登录用户',
95
+ members: [
96
+ { label: 'id', kind: 'property', detail: 'number' },
97
+ { label: 'name', kind: 'property', detail: 'string' }
98
+ ]
99
+ }
100
+ ]
101
+ </script>
102
+
103
+ <template>
104
+ <CodeEditor v-model="code" language="typescript" :completions="completions" />
105
+ </template>
106
+ ```
107
+
108
+ ## Props
109
+
110
+ | 名称 | 类型 | 默认值 | 说明 |
111
+ | --- | --- | --- | --- |
112
+ | `modelValue` | `string` | — | 输入内容(`v-model`) |
113
+ | `mode` | `'code' \| 'template'` | `'code'` | 补全模式,`template` 仅在定界符区间内触发 |
114
+ | `language` | `'javascript' \| 'typescript'` | `'javascript'` | 语言,影响关键字集合 |
115
+ | `completions` | `CompletionItem[]` | `[]` | 自定义补全项(内置项会自动合并) |
116
+ | `tsTypes` | `string` | `''` | TS 类型声明代码,自动解析为补全项(见下文) |
117
+ | `templateCompletions` | `CompletionItem[]` | `[]` | 模板模式专属补全项,展示优先级最高 |
118
+ | `templateOpen` | `string` | `'{{'` | 模板区间起始定界符 |
119
+ | `templateClose` | `string` | `'}}'` | 模板区间结束定界符 |
120
+ | `placeholder` | `string` | `''` | 占位文本 |
121
+ | `readonly` | `boolean` | `false` | 只读 |
122
+ | `lineNumbers` | `boolean` | `true` | 是否显示行号 |
123
+ | `hover` | `boolean` | `true` | 是否启用悬停显示定义 |
124
+ | `theme` | `'light' \| 'dark'` | `'light'` | 主题 |
125
+ | `collapsible` | `boolean` | `false` | 是否启用折叠 / 展开 |
126
+ | `defaultExpanded` | `boolean` | `false` | 折叠模式下是否默认展开 |
127
+ | `collapsedHeight` | `string` | `'34px'` | 单行模式高度(同时也是行高) |
128
+ | `collapseOnBlur` | `boolean` | `false` | 展开状态下失焦后是否自动收起 |
129
+ | `minHeight` | `string` | `'260px'` | 展开模式高度 |
130
+
131
+ ## Events
132
+
133
+ | 事件 | 参数 | 说明 |
134
+ | --- | --- | --- |
135
+ | `update:modelValue` | `(value: string)` | 内容变化 |
136
+ | `change` | `(value: string)` | 内容变化(同 `update:modelValue`,便于监听) |
137
+ | `expand` | — | 展开为多行编辑器 |
138
+ | `collapse` | — | 收起为单行输入框 |
139
+
140
+ ## 方法
141
+
142
+ 通过 `ref` 调用:
143
+
144
+ ```vue
145
+ <CodeEditor ref="editorRef" v-model="code" />
146
+ ```
147
+
148
+ | 方法 | 说明 |
149
+ | --- | --- |
150
+ | `focus()` | 聚焦输入框 |
151
+
152
+ ## 补全数据格式 CompletionItem
153
+
154
+ ```ts
155
+ interface CompletionItem {
156
+ label: string // 展示名称,同时作为匹配与插入文本
157
+ kind: CompletionKind // 'variable' | 'function' | 'property' | 'class' | 'keyword'
158
+ detail?: string // 类型签名 / 类型名,如 '(url: string) => Promise<any>'
159
+ type?: string // 完整类型定义,支持多行,hover 时以 TS 语法高亮展示
160
+ documentation?: string // 含义说明
161
+ insertText?: string // 插入文本(缺省使用 label)
162
+ members?: CompletionItem[] // 成员列表,用于 `obj.` 提示
163
+ }
164
+ ```
165
+
166
+ 补全弹窗与悬停卡片中的类型徽标:`变量 / 函数 / 属性 / 对象 / 关键字`。
167
+
168
+ ## 从 TS 类型代码生成补全
169
+
170
+ 除了手写 `CompletionItem`,也可以直接传入一段 TS 声明代码,组件会用内置解析器(`src/core/parser.ts`)自动生成变量、函数与成员提示。
171
+
172
+ ```vue
173
+ <script setup lang="ts">
174
+ const tsTypes = `
175
+ interface AppConfig {
176
+ apiBase: string
177
+ timeout: number
178
+ }
179
+
180
+ interface User {
181
+ id: number
182
+ name: string
183
+ roles: string[]
184
+ hasRole(role: string): boolean
185
+ }
186
+
187
+ interface Store {
188
+ count: number
189
+ user: User
190
+ }
191
+
192
+ declare const $config: AppConfig
193
+ declare const $store: Store
194
+ declare function $notify(message: string, type?: 'success' | 'error'): void
195
+ `
196
+ </script>
197
+
198
+ <template>
199
+ <CodeEditor v-model="code" language="typescript" :ts-types="tsTypes" />
200
+ </template>
201
+ ```
202
+
203
+ 支持的声明形式:
204
+
205
+ - `interface X { ... }`、`class X { ... }`、`type X = ...`
206
+ - `declare const / let / var x: Type`(`export` 可选)
207
+ - `declare function f(a: T): R`
208
+
209
+ 解析规则:
210
+
211
+ - 成员区分属性 / 方法,方法生成 `(params) => ret` 签名;可选属性 `?` 会读取类型
212
+ - 变量的类型若指向已定义的 `interface / class / type`,会自动关联其类型定义与成员
213
+ - 成员类型再次指向某个对象类型时会递归展开,因此 `$store.user.` 也能提示 `User` 的成员
214
+ - **注释会解析为 `documentation`**:支持 `/** ... */`(JSDoc)与 `//`,成员与顶层声明均可;变量优先用自身注释,缺省时回退到其类型的注释;类型定义正文会剔除注释
215
+ - 也可单独调用:`import { parseTsCompletions } from './core/parser'`
216
+
217
+ ## 模板模式
218
+
219
+ 模板模式下只有光标位于未闭合的 `{{ ... }}` 内才会触发代码补全,区间外输入不弹窗。
220
+
221
+ ```vue
222
+ <CodeEditor
223
+ v-model="template"
224
+ mode="template"
225
+ :template-completions="templateVars"
226
+ template-open="{{"
227
+ template-close="}}"
228
+ />
229
+ ```
230
+
231
+ 定界符可自定义,例如改为 `${ }`:
232
+
233
+ ```vue
234
+ <CodeEditor mode="template" template-open="${" template-close="}" />
235
+ ```
236
+
237
+ ## 折叠模式
238
+
239
+ ```vue
240
+ <CodeEditor v-model="code" collapsible collapsed-height="40px" min-height="300px" />
241
+ ```
242
+
243
+ - 默认单行显示,行高等于输入框高度,文字垂直居中
244
+ - 点击右侧按钮展开为多行编辑器(含行号)
245
+ - 单行模式下滚轮滚动按整行吸附
246
+ - 设置 `collapse-on-blur` 后:展开时若编辑器没有焦点会自动聚焦,失焦时自动收起(点击展开 / 收起按钮本身不会误触发)
247
+
248
+ ## 主题
249
+
250
+ ```vue
251
+ <CodeEditor v-model="code" theme="dark" />
252
+ ```
253
+
254
+ ## 键盘交互
255
+
256
+ | 按键 | 行为 |
257
+ | --- | --- |
258
+ | `Ctrl / ⌘ + Space` | 手动触发补全 |
259
+ | `↑` / `↓` | 补全列表上下选择 |
260
+ | `Enter` / `Tab` | 确认补全项 |
261
+ | `Esc` | 关闭补全 |
262
+ | `Enter` | 换行并自动缩进(补全未打开时) |
263
+ | `(` `[` `{` `"` `'` | 自动闭合 |
264
+
265
+ 光标移动(点击、方向键、Home / End)到 `obj.` 之后会自动弹出成员提示。
266
+
267
+ ## 目录结构
268
+
269
+ ```
270
+ src/
271
+ ├─ components/
272
+ │ └─ CodeEditor.vue # 组件本体(模板 / 交互 / 样式)
273
+ ├─ core/
274
+ │ ├─ types.ts # 类型定义
275
+ │ ├─ builtins.ts # 内置补全(Math / JSON / console 等)
276
+ │ ├─ keywords.ts # JS / TS 关键字
277
+ │ ├─ completion.ts # 补全上下文解析、成员链、模糊匹配
278
+ │ ├─ hover.ts # 悬停定义解析
279
+ │ ├─ template.ts # 模板区间识别
280
+ │ └─ tokenizer.ts # 词法分析与高亮
281
+ ├─ App.vue # 演示页
282
+ └─ main.ts
283
+ ```
284
+
285
+ ## 实现原理
286
+
287
+ - **渲染**:`textarea`(文字透明)叠加一层高亮 `<pre>`,两者共享字体、行高与尺寸;滚动时用 `transform` 平移高亮层,保证逐像素对齐
288
+ - **高亮层同时作为命中层**:每个 token 的 `<span>` 携带 `data-start` / `data-end`,鼠标坐标换算为内容坐标后比对字符矩形,用于悬停查定义
289
+ - **补全**:解析光标前的标识符链与前缀,从根级集合或对象成员中取出候选,做前缀 / 子序列模糊打分排序
290
+ - **单行模式**:行高等于输入框高度、上下 padding 归零,配合整行吸附实现单行窗口滚动
291
+ - **模板模式**:定位光标所在的 `{{ }}` 区间,仅在该区间内启用代码补全与高亮
@@ -0,0 +1,28 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),He=[{label:"Math",kind:"class",detail:"Math",type:`interface Math {
2
+ readonly PI: number
3
+ readonly E: number
4
+ abs(x: number): number
5
+ round(x: number): number
6
+ max(...values: number[]): number
7
+ random(): number
8
+ }`,documentation:"内置数学对象",members:[{label:"PI",kind:"property",detail:"number"},{label:"E",kind:"property",detail:"number"},{label:"abs",kind:"function",detail:"(x: number) => number"},{label:"ceil",kind:"function",detail:"(x: number) => number"},{label:"floor",kind:"function",detail:"(x: number) => number"},{label:"round",kind:"function",detail:"(x: number) => number"},{label:"max",kind:"function",detail:"(...values: number[]) => number"},{label:"min",kind:"function",detail:"(...values: number[]) => number"},{label:"pow",kind:"function",detail:"(base: number, exp: number) => number"},{label:"random",kind:"function",detail:"() => number"},{label:"sqrt",kind:"function",detail:"(x: number) => number"},{label:"trunc",kind:"function",detail:"(x: number) => number"}]},{label:"JSON",kind:"class",detail:"JSON",members:[{label:"parse",kind:"function",detail:"(text: string) => any"},{label:"stringify",kind:"function",detail:"(value: any, space?: number) => string"}]},{label:"console",kind:"variable",detail:"Console",members:[{label:"log",kind:"function",detail:"(...data: any[]) => void"},{label:"info",kind:"function",detail:"(...data: any[]) => void"},{label:"warn",kind:"function",detail:"(...data: any[]) => void"},{label:"error",kind:"function",detail:"(...data: any[]) => void"},{label:"debug",kind:"function",detail:"(...data: any[]) => void"},{label:"table",kind:"function",detail:"(data: any) => void"},{label:"time",kind:"function",detail:"(label: string) => void"},{label:"timeEnd",kind:"function",detail:"(label: string) => void"}]},{label:"Object",kind:"class",detail:"Object",members:[{label:"keys",kind:"function",detail:"(o: object) => string[]"},{label:"values",kind:"function",detail:"(o: object) => any[]"},{label:"entries",kind:"function",detail:"(o: object) => [string, any][]"},{label:"assign",kind:"function",detail:"(target: object, ...sources: object[]) => object"},{label:"freeze",kind:"function",detail:"(o: object) => object"}]},{label:"Array",kind:"class",detail:"Array",members:[{label:"isArray",kind:"function",detail:"(value: any) => boolean"},{label:"from",kind:"function",detail:"(iterable: any) => any[]"},{label:"of",kind:"function",detail:"(...items: any[]) => any[]"}]},{label:"Promise",kind:"class",detail:"Promise",members:[{label:"resolve",kind:"function",detail:"(value?: any) => Promise<any>"},{label:"reject",kind:"function",detail:"(reason?: any) => Promise<never>"},{label:"all",kind:"function",detail:"(values: any[]) => Promise<any[]>"},{label:"race",kind:"function",detail:"(values: any[]) => Promise<any>"}]},{label:"Date",kind:"class",detail:"Date",members:[{label:"now",kind:"function",detail:"() => number"},{label:"parse",kind:"function",detail:"(dateString: string) => number"}]},{label:"String",kind:"class",detail:"String",members:[{label:"fromCharCode",kind:"function",detail:"(...codes: number[]) => string"},{label:"from",kind:"function",detail:"(value: any) => string"}]},{label:"Number",kind:"class",detail:"Number",members:[{label:"isNaN",kind:"function",detail:"(value: any) => boolean"},{label:"isInteger",kind:"function",detail:"(value: any) => boolean"},{label:"parseFloat",kind:"function",detail:"(value: string) => number"},{label:"parseInt",kind:"function",detail:"(value: string, radix?: number) => number"}]},{label:"setTimeout",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearTimeout",kind:"function",detail:"(id: number) => void"},{label:"setInterval",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearInterval",kind:"function",detail:"(id: number) => void"}],Te=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","from","function","if","import","in","instanceof","let","new","of","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","async","await","true","false","null","undefined","NaN","Infinity"],ut=["abstract","any","as","asserts","bigint","boolean","declare","enum","implements","infer","interface","is","keyof","namespace","never","number","object","override","private","protected","public","readonly","satisfies","static","string","symbol","type","unknown"];function ce(o){return o==="typescript"?[...Te,...ut]:Te}function re(o){return new Set(ce(o))}const dt=/((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/,Se=/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g,ft=/^[A-Za-z_$]/;function pt(o,c){const r=o.slice(0,c),l=dt.exec(r);if(!l)return{prefix:"",chain:[]};const i=l[1]??"",u=l[2]??"",d=i.split(".").filter(Boolean).map(f=>f.replace(/\?$/,""));return{prefix:u,chain:d}}function se(o,c){const r=[],l=new Set;let i;for(Se.lastIndex=0;(i=Se.exec(o))&&!(i.index>=c);){const u=i[1];if(l.has(u))continue;l.add(u);const d=i[0].slice(0,i[0].indexOf(u)).trim();r.push({label:u,kind:d==="function"?"function":d==="class"?"class":"variable",detail:"当前文件"})}return r}function Ae(o,c){let r=c;for(const l of o){if(!r)return null;const i=r.find(u=>u.label===l);if(!i)return null;r=i.members??[]}return r}function mt(o,c){const r=o.toLowerCase(),l=c.toLowerCase(),i=r.indexOf(l);if(i===0)return 1e3-r.length;if(i>0)return 800-i;let u=0,d=0,f=-1;for(let a=0;a<r.length&&u<l.length;a++)r[a]===l[u]&&(f>=0&&(d+=a-f-1),f=a,u++);return u!==l.length?null:400-d-r.length}function ht(o,c){if(!c)return o;const r=[];for(const l of o){const i=mt(l.label,c);i!==null&&r.push({item:l,score:i})}return r.sort((l,i)=>i.score-l.score||l.item.label.localeCompare(i.item.label)),r.map(l=>l.item)}function gt(o){const c=new Set,r=[];for(const l of o)c.has(l.label)||(c.add(l.label),r.push(l));return r}function Le(o,c,r){const{prefix:l,chain:i}=pt(o,c);if(r.auto&&(!l&&i.length===0||l&&!ft.test(l)))return null;const u=r.declared??[],d=[...u,...r.completions];let f;if(i.length>0){const p=Ae(i,d);if(!p||p.length===0)return null;f=p}else f=[...r.completions,...u,...ce(r.language).map(p=>({label:p,kind:"keyword"}))];const a=ht(gt(f),l);return a.length===0?null:{items:a,start:c-l.length,end:c}}const bt=/([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;function Ve(o,c,r,l){const i=o.slice(c,r);if(!i)return null;const u=[...l.declared??[],...l.completions],d=bt.exec(o.slice(0,c));if(d){const f=d[1].split(".").filter(Boolean).map(S=>S.replace(/\?$/,"")),a=Ae(f,u),p=a==null?void 0:a.find(S=>S.label===i);if(p)return p}return u.find(f=>f.label===i)??null}const O="[A-Za-z_$][\\w$]*",$e="(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";function Be(o,c){let r=0,l=!1,i=c;for(let u=c;u<o.length;u++){const d=o[u];for(let f=0;f<d.length;f++){const a=d[f];a==="{"?(r++,l=!0):a==="}"&&r--}if(l&&r<=0){i=u;break}}return{end:i,body:o.slice(c+1,i)}}function _e(o){return o.trim().replace(/[,;]$/,"").trim()}function j(o){return o.length?o.join(`
9
+ `).replace(/^\s*\/\*\*?/,"").replace(/\*\/\s*$/,"").split(`
10
+ `).map(c=>c.replace(/^\s*\*+\s?/,"").replace(/^\s*\/\/\s?/,"")).join(`
11
+ `).replace(/\n{3,}/g,`
12
+
13
+ `).trim():""}function Re(o){return o.split(`
14
+ `).filter(c=>!/^\s*(\/\/|\/\*|\*)/.test(c)).join(`
15
+ `).replace(/\n{2,}/g,`
16
+ `).trim()}function Ie(o){const c=[],r=new Set,l=new RegExp(`^${$e}(${O})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`),i=new RegExp(`^${$e}(${O})(\\?)?\\s*:\\s*(.+?);?$`);let u=[],d=!1;for(const f of o){const a=f.trim();if(d){u.push(a),a.includes("*/")&&(d=!1);continue}if(a.startsWith("/*")){u.push(a),a.includes("*/")||(d=!0);continue}if(a.startsWith("//")){u.push(a);continue}if(!a||a.startsWith("}")||a.startsWith("[")){u=[];continue}const p=l.exec(a);if(p){const L=j(u);u=[];const v=p[1];if(r.has(v))continue;r.add(v),c.push({label:v,kind:"function",detail:`(${p[3].trim()}) => ${_e(p[4])}`,documentation:L||void 0});continue}const S=i.exec(a);if(S){const L=j(u);u=[];const v=S[1];if(r.has(v))continue;r.add(v);const b=_e(S[3]),_=/^\(|=>/.test(b)?"function":"property";c.push({label:v,kind:_,detail:b,documentation:L||void 0})}}return c}function De(o){const c=o.replace(/\[\]/g,"").replace(/<[^>]*>/g,"").replace(/\s*\|\s*null\s*/g,"").trim(),r=new RegExp(`^(${O})$`).exec(c);return r?r[1]:null}function vt(o){const c=o.trim();if(!c||c.endsWith(";"))return!1;const r=(c.match(/[(<[{]/g)??[]).length,l=(c.match(/[)>\]}]/g)??[]).length;return/[|&,(<]\s*$/.test(c)||r>l}function Oe(o,c,r,l=0){return l>6?o:o.map(i=>{if(i.kind!=="property"||!i.detail)return i;const u=De(i.detail),d=u?c.get(u):void 0;if(!d||r.has(d.label))return i;const f=new Set(r);return f.add(d.label),{...i,type:d.type,members:Oe(d.members,c,f,l+1)}})}function ze(o){if(!o||!o.trim())return[];const c=o.split(`
17
+ `),r=new Map,l=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${O})`),i=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${O})`),u=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${O})\\s*=`);let d=[],f=!1;for(let v=0;v<c.length;v++){const b=c[v].trim();if(f){d.push(b),b.includes("*/")&&(f=!1);continue}if(b.startsWith("/*")){d.push(b),b.includes("*/")||(f=!0);continue}if(b.startsWith("//")){d.push(b);continue}if(!b){d=[];continue}const _=l.exec(b);if(_&&b.includes("{")){const w=j(d);d=[];const{end:x,body:T}=Be(c,v),y=_[1];r.set(y,{label:y,type:Re(c.slice(v,x+1).join(`
18
+ `).replace(/^\s*export\s+/,"")),members:Ie(T),kind:"interface",documentation:w||void 0}),v=x;continue}const N=i.exec(b);if(N&&b.includes("{")){const w=j(d);d=[];const{end:x,body:T}=Be(c,v),y=N[1];r.set(y,{label:y,type:Re(c.slice(v,x+1).join(`
19
+ `).replace(/^\s*export\s+/,"")),members:Ie(T),kind:"class",documentation:w||void 0}),v=x;continue}const R=u.exec(b);if(R){const w=j(d);d=[];const x=[c[v]];let T=v;for(;vt(x.join(`
20
+ `))&&T+1<c.length;)T++,x.push(c[T]);const y=x.join(`
21
+ `).replace(/^\s*export\s+/,"").replace(/;\s*$/,"").trim();r.set(R[1],{label:R[1],type:y,members:[],kind:"type",documentation:w||void 0}),v=T;continue}d=[]}const a=[],p=new Set,S=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${O})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`),L=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${O})\\s*:\\s*([^=;]+)`);d=[],f=!1;for(const v of c){const b=v.trim();if(f){d.push(b),b.includes("*/")&&(f=!1);continue}if(b.startsWith("/*")){d.push(b),b.includes("*/")||(f=!0);continue}if(b.startsWith("//")){d.push(b);continue}if(!b){d=[];continue}const _=S.exec(b);if(_){const R=j(d);d=[];const w=_[1];p.has(w)||(p.add(w),a.push({label:w,kind:"function",detail:`(${_[2].trim()}) => ${_[3].trim()}`,documentation:R||void 0}));continue}const N=L.exec(b);if(N){const R=j(d);d=[];const w=N[1];if(p.has(w))continue;p.add(w);const x=N[2].trim(),T=De(x),y=T?r.get(T):void 0,C=(y==null?void 0:y.kind)==="class"?"class":/^\(|=>/.test(x)?"function":"variable";a.push({label:w,kind:C,detail:x,type:y==null?void 0:y.type,documentation:R||(y==null?void 0:y.documentation)||void 0,members:y?Oe(y.members,r,new Set([y.label])):void 0});continue}d=[]}return a}function Q(o,c,r,l){if(!r||!l)return null;const i=Math.max(0,c-1),u=o.lastIndexOf(r,i);if(u===-1||o.lastIndexOf(l,i)>u)return null;const f=o.indexOf(l,u+r.length);return{start:u+r.length,end:f===-1?o.length:f}}function yt(o,c,r,l){return Q(o,c,r,l)!==null}const Me=/[A-Za-z_$]/,kt=/[\w$]/,Ne=/\s/;function Y(o,c){const r=[],l=o.length;let i=0;for(;i<l;){const u=o[i],d=o[i+1];if(Ne.test(u)){i++;continue}if(u==="/"&&d==="/"){let a=o.indexOf(`
22
+ `,i);a===-1&&(a=l),r.push({start:i,end:a,type:"comment"}),i=a;continue}if(u==="/"&&d==="*"){const a=o.indexOf("*/",i+2),p=a===-1?l:a+2;r.push({start:i,end:p,type:"comment"}),i=p;continue}if(u==='"'||u==="'"){let a=i+1;for(;a<l;){if(o[a]==="\\"){a+=2;continue}if(o[a]===`
23
+ `)break;if(o[a]===u){a++;break}a++}r.push({start:i,end:a,type:"string"}),i=a;continue}if(u==="`"){let a=i+1;for(;a<l;){if(o[a]==="\\"){a+=2;continue}if(o[a]==="`"){a++;break}a++}r.push({start:i,end:a,type:"template"}),i=a;continue}if(/[0-9]/.test(u)||u==="."&&/[0-9]/.test(d??"")){let a=i+1;for(;a<l&&/[\w.]/.test(o[a]);)a++;r.push({start:i,end:a,type:"number"}),i=a;continue}if(Me.test(u)){let a=i+1;for(;a<l&&kt.test(o[a]);)a++;const p=o.slice(i,a),S=c.keywords.has(p)?"keyword":c.builtins.has(p)?"builtin":"identifier";r.push({start:i,end:a,type:S}),i=a;continue}let f=i+1;for(;f<l;){const a=o[f];if(Ne.test(a)||Me.test(a)||/[0-9]/.test(a)||a==='"'||a==="'"||a==="`"||a==="/")break;f++}r.push({start:i,end:f,type:"punctuation"}),i=f}return r}const wt={"&":"&amp;","<":"&lt;",">":"&gt;"};function W(o){return o.replace(/[&<>]/g,c=>wt[c]??c)}function J(o,c,r=0){let l="",i=0;for(const u of c){u.start>i&&(l+=W(o.slice(i,u.start)));const d=W(o.slice(u.start,u.end));l+=`<span class="tok-${u.type}" data-start="${u.start+r}" data-end="${u.end+r}">${d}</span>`,i=u.end}return i<o.length&&(l+=W(o.slice(i))),l}function je(o,c,r,l){if(!r||!l)return J(o,Y(o,c));let i="",u=0;for(;u<o.length;){const d=o.indexOf(r,u);if(d===-1){i+=W(o.slice(u));break}i+=W(o.slice(u,d));const f=o.indexOf(l,d+r.length),a=f===-1?o.length:f,p=o.slice(d+r.length,a);i+=`<span class="tok-brace">${W(r)}</span>`,i+=J(p,Y(p,c),d+r.length),f===-1?u=a:(i+=`<span class="tok-brace">${W(l)}</span>`,u=f+l.length)}return i}const xt={key:0,class:"gutter","aria-hidden":"true"},Et=["innerHTML"],Ct=["value","readonly","placeholder"],Tt=["onMouseenter","onClick"],St={class:"popup-label"},$t={key:0,class:"popup-detail"},Bt={class:"hover-head"},_t={class:"hover-name"},Rt={key:0,class:"hover-colon"},It={key:0,class:"hover-type"},Mt={key:0,class:"hover-doc"},Nt={key:1,class:"hover-def"},Ht=["innerHTML"],At=["title","aria-label"],Lt={key:0,viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},Vt={key:1,viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},Dt=t.defineComponent({__name:"CodeEditor",props:{modelValue:{},mode:{default:"code"},language:{default:"javascript"},completions:{default:()=>[]},tsTypes:{default:""},templateCompletions:{default:()=>[]},templateOpen:{default:"{{"},templateClose:{default:"}}"},placeholder:{default:""},readonly:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!0},hover:{type:Boolean,default:!0},theme:{default:"light"},collapsible:{type:Boolean,default:!1},defaultExpanded:{type:Boolean,default:!1},collapsedHeight:{default:"34px"},collapseOnBlur:{type:Boolean,default:!1},minHeight:{default:"260px"}},emits:["update:modelValue","change","expand","collapse"],setup(o,{expose:c,emit:r}){const l=o,i=r,u={variable:"变量",function:"函数",property:"属性",class:"对象",keyword:"关键字"},d={"(":")","[":"]","{":"}",'"':'"',"'":"'"},f=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),a=t.ref(l.modelValue),p=t.ref(),S=t.ref(),L=t.ref(),v=t.ref(),b=t.ref(),_=t.ref(),N=t.ref(),R=t.ref([]),w=t.ref(0),x=t.ref(!1),T=t.ref({start:0,end:0}),y=t.ref({}),C=t.ref(null),ue=t.ref({}),Pe=t.computed(()=>l.tsTypes?ze(l.tsTypes):[]),de=t.computed(()=>[...He,...Pe.value,...l.completions]),ee=t.computed(()=>l.mode==="template"?[...l.templateCompletions,...de.value]:de.value),Fe=t.computed(()=>{const e={keywords:re(l.language),builtins:new Set(ee.value.map(n=>n.label))};return l.mode==="template"?`${je(a.value,e,l.templateOpen,l.templateClose)}
24
+ `:`${J(a.value,Y(a.value,e))}
25
+ `}),Ke=t.computed(()=>a.value.split(`
26
+ `).length),A=t.ref(l.defaultExpanded),P=t.computed(()=>l.collapsible&&!A.value),Ze=t.computed(()=>P.value?{"--ce-collapsed-height":l.collapsedHeight}:{height:l.minHeight}),qe=t.computed(()=>P.value?{height:l.collapsedHeight}:{});let fe=0;function pe(e){if(A.value===e)return;const n=p.value;e&&n&&(fe=n.scrollTop),A.value=e,i(e?"expand":"collapse"),$(),M(),t.nextTick(()=>{if(te(),!A.value&&n){const s=Math.max(0,n.scrollHeight-n.clientHeight);n.scrollTop=Math.max(0,Math.min(fe,s)),H(!0),document.activeElement===n&&K();return}H(!0),e&&l.collapseOnBlur&&n&&document.activeElement!==n&&n.focus()})}function Ue(){pe(!A.value)}t.watch(()=>l.modelValue,e=>{e!==a.value&&(a.value=e,$())}),t.watch(a,()=>{t.nextTick(()=>H(!0))});function me(e){return u[e]}function Ye(e){return e?J(e,Y(e,{keywords:re("typescript"),builtins:new Set})):""}let F={top:14,bottom:14,lineHeight:22};function te(){const e=p.value;if(!e)return;const n=window.getComputedStyle(e);F={top:parseFloat(n.paddingTop)||0,bottom:parseFloat(n.paddingBottom)||0,lineHeight:parseFloat(n.lineHeight)||22}}function H(e=!1){const n=p.value;if(!n)return;const s=v.value;if(s&&(s.style.transform=`translate(${-n.scrollLeft}px, ${-n.scrollTop}px)`),b.value&&(b.value.style.transform=`translateY(${-n.scrollTop}px)`),e){const h=`${a.value}|${l.mode}|${n.clientWidth}|${n.clientHeight}`;h!==ge&&(ge=h,Je())}}function K(){const e=p.value;if(!e||!P.value)return;const n=be();if(!n)return;const s=e.clientHeight-F.top-F.bottom,g=n.top+e.scrollTop-F.top-Math.max(0,(s-n.lineHeight)/2),m=Math.max(0,e.scrollHeight-e.clientHeight),E=Math.max(0,Math.min(g,m));Math.abs(E-e.scrollTop)>.5&&(e.scrollTop=E,H())}let he=[],ge="",G=0,ne=-1,le=-1,oe={x:0,y:0};function Je(){const e=p.value,n=L.value;if(!e||!n)return;const s=e.getBoundingClientRect(),h=[];n.querySelectorAll("[data-start]").forEach(g=>{const m=g.getBoundingClientRect();h.push({start:Number(g.dataset.start),end:Number(g.dataset.end),left:m.left-s.left+e.scrollLeft,right:m.right-s.left+e.scrollLeft,top:m.top-s.top+e.scrollTop,bottom:m.bottom-s.top+e.scrollTop})}),he=h}function Ge(e,n){for(const s of he)if(e>=s.left-1&&e<=s.right+1&&n>=s.top&&n<=s.bottom)return s;return null}function M(){C.value=null,G=0,ne=-1,le=-1}function Xe(e){const n=N.value,s=p.value;if(!n||!s)return;const h=s.getBoundingClientRect(),g=h.left+e.left-s.scrollLeft,m=h.left+e.right-s.scrollLeft,E=h.top+e.top-s.scrollTop,k=h.top+e.bottom-s.scrollTop,B=12,I=8,V=n.offsetWidth,q=n.offsetHeight;let D=g,z=k+I;D+V>window.innerWidth-B&&(D=m-V),z+q>window.innerHeight-B&&(z=E-q-I),D=Math.max(B,Math.min(D,window.innerWidth-B-V)),z=Math.max(B,z),ue.value={left:`${D}px`,top:`${z}px`}}function Qe(e,n){const s=p.value;if(!s||l.readonly||!l.hover||x.value){M();return}if(s.selectionStart!==s.selectionEnd){M();return}const h=N.value;if(C.value&&h){const k=h.getBoundingClientRect();if(e>=k.left&&e<=k.right&&n>=k.top&&n<=k.bottom)return}const g=s.getBoundingClientRect(),m=Ge(e-g.left+s.scrollLeft,n-g.top+s.scrollTop);if(!m){M();return}if(C.value&&ne===m.start&&le===m.end)return;const E=Ve(s.value,m.start,m.end,{completions:ee.value,declared:se(s.value,m.start)});if(!E){M();return}C.value=E,ne=m.start,le=m.end,t.nextTick(()=>Xe(m))}function et(e){oe={x:e.clientX,y:e.clientY},!G&&(G=requestAnimationFrame(()=>{G=0,Qe(oe.x,oe.y)}))}function be(){const e=p.value;if(!e)return null;const n=window.getComputedStyle(e),s=document.createElement("div"),h=parseFloat(n.paddingLeft)||0,g=parseFloat(n.paddingRight)||0,m=e.getBoundingClientRect();Object.assign(s.style,{position:"fixed",left:`${m.left}px`,top:`${m.top}px`,visibility:"hidden",pointerEvents:"none",zIndex:"-1",whiteSpace:"pre-wrap",overflowWrap:"break-word",wordBreak:"normal",boxSizing:"content-box",width:`${e.clientWidth-h-g}px`,paddingTop:n.paddingTop,paddingRight:n.paddingRight,paddingBottom:n.paddingBottom,paddingLeft:n.paddingLeft,border:"0",fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,fontStyle:n.fontStyle,fontVariant:n.fontVariant,letterSpacing:n.letterSpacing,lineHeight:n.lineHeight,textTransform:n.textTransform,tabSize:n.tabSize}),s.textContent=e.value.slice(0,e.selectionStart);const E=document.createElement("span");E.textContent="​",s.appendChild(E),document.body.appendChild(s);const k=E.getBoundingClientRect();document.body.removeChild(s);const B=parseFloat(n.lineHeight)||22,I=k.height,V=I>0&&I<B?(B-I)/2:0;return{left:k.left-m.left-e.scrollLeft,top:k.top-m.top-e.scrollTop-V,lineHeight:B}}async function tt(){await t.nextTick();const e=S.value,n=_.value,s=be();if(!e||!n||!s)return;const h=4,g=8,m=window.innerWidth,E=window.innerHeight,k=e.getBoundingClientRect(),B=n.scrollHeight,I=E-(k.top+s.top+s.lineHeight)-h-g,V=k.top+s.top-h-g,q=I>=Math.min(B,180)||I>=V,D=Math.min(248,Math.max(q?I:V,96)),z=Math.min(B,D),Ce=n.offsetWidth||280;let U=s.left;k.left+U+Ce>m-g&&(U=m-g-Ce-k.left),U=Math.max(U,g-k.left),y.value={left:`${U}px`,top:`${q?s.top+s.lineHeight+h:s.top-h-z}px`,maxHeight:`${D}px`}}function $(){x.value=!1,R.value=[],w.value=0,M()}function Z(e=!1){const n=p.value;if(!n||l.readonly)return;if(n.selectionStart!==n.selectionEnd){$();return}const s=n.selectionStart;let h=!e;if(l.mode==="template"){const m=Q(n.value,s,l.templateOpen,l.templateClose);if(!m){$();return}e&&n.value.slice(m.start,s).trim()===""&&(h=!0)}const g=Le(n.value,s,{language:l.language,completions:ee.value,declared:se(n.value,s),auto:!h});if(!g){$();return}R.value=g.items,T.value={start:g.start,end:g.end},w.value=0,x.value=!0,tt()}function nt(e){a.value=e,i("update:modelValue",e),i("change",e)}function X(e,n,s,h=e+s.length){const g=p.value;if(!g)return;const m=g.value.slice(0,e)+s+g.value.slice(n);nt(m),$(),t.nextTick(()=>{g.value=m,g.setSelectionRange(h,h),g.focus(),H(!0),K()})}function ve(e=R.value[w.value]){if(!e)return;const n=e.insertText??e.label;X(T.value.start,T.value.end,n),$()}function ye(e){const n=R.value.length;n&&(w.value=(w.value+e+n)%n,t.nextTick(()=>{var s,h;(h=(s=_.value)==null?void 0:s.querySelector(".is-active"))==null||h.scrollIntoView({block:"nearest"})}))}function lt(e){const n=e.target;a.value=n.value,i("update:modelValue",n.value),i("change",n.value),M(),H(),t.nextTick(K),Z(!0)}function ot(e){if($(),M(),!l.collapsible||!l.collapseOnBlur||!A.value)return;const n=e.relatedTarget;n&&n.closest(".expand-toggle")||pe(!1)}function it(){ke(),K()}function ke(){const e=p.value;if(!e||l.readonly)return;if(e.selectionStart!==e.selectionEnd){$();return}const n=e.selectionStart;if(n>0&&e.value[n-1]==="."){Z(!0);return}if(l.mode==="template"){const s=Q(e.value,n,l.templateOpen,l.templateClose);if(s&&e.value.slice(s.start,n).trim()===""){Z(!0);return}}$()}let ie=0;function we(){window.clearTimeout(ie),ie=window.setTimeout(()=>{ie=0,ke(),K()},0)}function xe(e){e.target!==p.value&&x.value&&$()}function at(){M(),H(),P.value&&rt()}let ae=0;function rt(){window.clearTimeout(ae),ae=window.setTimeout(()=>{ae=0,st()},120)}function st(){const e=p.value;if(!e)return;const n=F.lineHeight,s=e.scrollTop,h=Math.round(s/n)*n;Math.abs(h-s)<.5||(e.scrollTop=h,H())}function ct(e){var g;const n=p.value;if(!n)return;const s=e.metaKey||e.ctrlKey,h=f.has(e.key);if(e.key===" "&&s){e.preventDefault(),Z(!1);return}if(x.value){if(e.key==="ArrowDown"){e.preventDefault(),ye(1);return}if(e.key==="ArrowUp"){e.preventDefault(),ye(-1);return}if(e.key==="Enter"||e.key==="Tab"){e.preventDefault(),ve();return}if(e.key==="Escape"){e.preventDefault(),$();return}if(h||s){$(),h&&!s&&we();return}}if(h&&!s){we();return}if(e.key==="Enter"&&!s&&!e.shiftKey){const m=n.selectionStart;if(m!==n.selectionEnd)return;const E=n.value.lastIndexOf(`
27
+ `,m-1)+1,k=n.value.slice(E,m),B=((g=k.match(/^[ \t]*/))==null?void 0:g[0])??"",I=/[{[(]$/.test(k.trimEnd())?" ":"";e.preventDefault(),X(m,m,`
28
+ ${B}${I}`);return}if(e.key==="Tab"){e.preventDefault(),X(n.selectionStart,n.selectionEnd," ");return}if(e.key.length===1&&!s&&!e.altKey&&d[e.key]){if(n.selectionStart!==n.selectionEnd)return;const m=n.selectionStart,E=n.value[m-1],k=n.value[m];if((e.key==='"'||e.key==="'")&&E&&/[\w$]/.test(E)||k!==void 0&&!/[\s)\]},;:]/.test(k))return;e.preventDefault(),X(m,m,e.key+d[e.key],m+1),l.mode==="template"&&t.nextTick(()=>Z(!0))}}function Ee(){x.value&&$(),M(),t.nextTick(()=>{te(),H(!0)})}return t.onMounted(()=>{window.addEventListener("resize",Ee),window.addEventListener("scroll",xe,!0),t.nextTick(()=>{te(),H(!0)})}),t.onBeforeUnmount(()=>{window.removeEventListener("resize",Ee),window.removeEventListener("scroll",xe,!0)}),c({focus:()=>{var e;return(e=p.value)==null?void 0:e.focus()}}),(e,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["code-editor",{"is-readonly":o.readonly,"is-dark":o.theme==="dark","is-collapsed":P.value}]),style:t.normalizeStyle(Ze.value)},[o.lineNumbers&&!P.value?(t.openBlock(),t.createElementBlock("div",xt,[t.createElementVNode("div",{ref_key:"gutterInner",ref:b,class:"gutter-inner code-font"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Ke.value,s=>(t.openBlock(),t.createElementBlock("div",{key:s,class:"gutter-line"},t.toDisplayString(s),1))),128))],512)])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"stage",ref:S,class:"stage",style:t.normalizeStyle(qe.value)},[t.createElementVNode("div",{ref_key:"highlightLayer",ref:L,class:"highlight code-font"},[t.createElementVNode("pre",{ref_key:"highlightInner",ref:v,class:"code-font"},[t.createElementVNode("code",{innerHTML:Fe.value},null,8,Et)],512)],512),t.createElementVNode("textarea",{ref_key:"textarea",ref:p,class:"code-font input",value:a.value,readonly:o.readonly,placeholder:o.placeholder,spellcheck:"false",autocomplete:"off",autocapitalize:"off",autocorrect:"off",wrap:"soft",onInput:lt,onKeydown:ct,onScroll:at,onClick:it,onMousemove:et,onMouseleave:M,onBlur:ot},null,40,Ct),x.value?(t.openBlock(),t.createElementBlock("ul",{key:0,ref_key:"popup",ref:_,class:"popup",style:t.normalizeStyle(y.value),onMousedown:n[0]||(n[0]=t.withModifiers(()=>{},["prevent"]))},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(R.value,(s,h)=>(t.openBlock(),t.createElementBlock("li",{key:`${s.label}-${h}`,class:t.normalizeClass(["popup-item",{"is-active":h===w.value}]),onMouseenter:g=>w.value=h,onClick:g=>ve(s)},[t.createElementVNode("span",{class:t.normalizeClass(["badge",`badge-${s.kind}`])},t.toDisplayString(me(s.kind)),3),t.createElementVNode("span",St,t.toDisplayString(s.label),1),s.detail?(t.openBlock(),t.createElementBlock("span",$t,t.toDisplayString(s.detail),1)):t.createCommentVNode("",!0)],42,Tt))),128))],36)):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createElementBlock("div",{key:1,ref_key:"hoverCard",ref:N,class:"hover-card",style:t.normalizeStyle(ue.value)},[t.createElementVNode("div",Bt,[t.createElementVNode("span",{class:t.normalizeClass(["badge",`badge-${C.value.kind}`])},t.toDisplayString(me(C.value.kind)),3),t.createElementVNode("span",_t,[t.createTextVNode(t.toDisplayString(C.value.label),1),C.value.detail?(t.openBlock(),t.createElementBlock("span",Rt,":")):t.createCommentVNode("",!0)]),C.value.detail?(t.openBlock(),t.createElementBlock("span",It,t.toDisplayString(C.value.detail),1)):t.createCommentVNode("",!0)]),C.value.documentation?(t.openBlock(),t.createElementBlock("p",Mt,t.toDisplayString(C.value.documentation),1)):t.createCommentVNode("",!0),C.value.type?(t.openBlock(),t.createElementBlock("pre",Nt,[t.createElementVNode("code",{innerHTML:Ye(C.value.type)},null,8,Ht)])):t.createCommentVNode("",!0)],4)):t.createCommentVNode("",!0)],4),o.collapsible?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"expand-toggle",title:A.value?"收起":"展开","aria-label":A.value?"收起编辑器":"展开编辑器",onClick:Ue},[A.value?(t.openBlock(),t.createElementBlock("svg",Vt,[...n[2]||(n[2]=[t.createElementVNode("path",{d:"M11 2 5 8 11 14",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",Lt,[...n[1]||(n[1]=[t.createElementVNode("path",{d:"M6 2 12 8 6 14",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],8,At)):t.createCommentVNode("",!0)],6))}}),Ot=(o,c)=>{const r=o.__vccOpts||o;for(const[l,i]of c)r[l]=i;return r},We=Ot(Dt,[["__scopeId","data-v-dc3651c9"]]),zt={install(o){o.component("CodeInput",We)}};exports.CodeEditor=We;exports.collectCompletions=Le;exports.default=zt;exports.defaultCompletions=He;exports.findTemplateRange=Q;exports.getKeywordSet=re;exports.getKeywords=ce;exports.highlight=J;exports.highlightTemplate=je;exports.isInsideTemplate=yt;exports.parseTsCompletions=ze;exports.resolveHoverItem=Ve;exports.scanDeclarations=se;exports.tokenize=Y;