@vite-plugin-opencode-assistant/components 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3325 +0,0 @@
1
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createStaticVNode, createTextVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, toDisplayString, toRef, useCssVars, useSlots, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
2
- import { WIDGET_MSG, createLogger, truncate } from "@vite-plugin-opencode-assistant/shared";
3
- import getCssSelector from "css-selector-generator";
4
- //#region es/open-code-widget/src/context.mjs
5
- var CONTEXT_KEY = /* @__PURE__ */ Symbol("OpenCodeWidgetContext");
6
- function provideOpenCodeWidgetContext(context) {
7
- provide(CONTEXT_KEY, context);
8
- }
9
- function useOpenCodeWidgetContext() {
10
- const context = inject(CONTEXT_KEY);
11
- if (!context) throw new Error("useOpenCodeWidgetContext must be used within OpenCodeWidget");
12
- return context;
13
- }
14
- //#endregion
15
- //#region es/open-code-widget/src/components/Frame.vue.mjs
16
- var __defProp$4 = Object.defineProperty;
17
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
18
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
19
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
20
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value
25
- }) : obj[key] = value;
26
- var __spreadValues$4 = (a, b) => {
27
- for (var prop in b || (b = {})) if (__hasOwnProp$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]);
28
- if (__getOwnPropSymbols$4) {
29
- for (var prop of __getOwnPropSymbols$4(b)) if (__propIsEnum$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]);
30
- }
31
- return a;
32
- };
33
- var __vue_sfc__$9 = /* @__PURE__ */ defineComponent({
34
- __name: "Frame",
35
- setup(__props, { expose: __expose }) {
36
- const iframeRef = ref(null);
37
- const { frameLoading, showEmptyState, showError, iframeSource: iframeSrc, emptyStateText, emptyStateActionText, handleEmptyAction, handleFrameLoaded } = useOpenCodeWidgetContext();
38
- function sendMessageToIframe(type, data) {
39
- var _a;
40
- if (!((_a = iframeRef.value) == null ? void 0 : _a.contentWindow)) return;
41
- iframeRef.value.contentWindow.postMessage(__spreadValues$4({ type }, data), "*");
42
- }
43
- __expose({ sendMessageToIframe });
44
- const __returned__ = {
45
- iframeRef,
46
- frameLoading,
47
- showEmptyState,
48
- showError,
49
- iframeSrc,
50
- emptyStateText,
51
- emptyStateActionText,
52
- handleEmptyAction,
53
- handleFrameLoaded,
54
- sendMessageToIframe
55
- };
56
- Object.defineProperty(__returned__, "__isScriptSetup", {
57
- enumerable: false,
58
- value: true
59
- });
60
- return __returned__;
61
- }
62
- });
63
- var _hoisted_1$7 = { class: "opencode-iframe-container" };
64
- var _hoisted_2$5 = { class: "opencode-empty-state-text" };
65
- var _hoisted_3$5 = ["src"];
66
- function __vue_render__$9(_ctx, _cache, $props, $setup, $data, $options) {
67
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
68
- createElementVNode("div", { class: normalizeClass(["opencode-empty-state-overlay", { visible: $setup.showEmptyState }]) }, [renderSlot(_ctx.$slots, "empty-state", {}, () => [
69
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "opencode-empty-state-icon" }, [createElementVNode("svg", {
70
- viewBox: "0 0 24 24",
71
- width: "48",
72
- height: "48",
73
- fill: "none",
74
- stroke: "currentColor",
75
- "stroke-width": "1.5",
76
- "aria-hidden": "true"
77
- }, [createElementVNode("path", {
78
- "stroke-linecap": "round",
79
- "stroke-linejoin": "round",
80
- d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 0 1-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
81
- })])], -1)),
82
- createElementVNode("div", _hoisted_2$5, toDisplayString($setup.emptyStateText), 1),
83
- createElementVNode("button", {
84
- class: "opencode-empty-state-btn",
85
- type: "button",
86
- onClick: _cache[0] || (_cache[0] = (...args) => $setup.handleEmptyAction && $setup.handleEmptyAction(...args))
87
- }, toDisplayString($setup.emptyStateActionText), 1)
88
- ])], 2),
89
- createElementVNode("div", { class: normalizeClass(["opencode-loading-overlay", { visible: $setup.frameLoading }]) }, [renderSlot(_ctx.$slots, "loading", {}, () => [_cache[3] || (_cache[3] = createElementVNode("div", { class: "opencode-loading-spinner" }, null, -1)), _cache[4] || (_cache[4] = createElementVNode("div", { class: "opencode-loading-text" }, "加载中...", -1))])], 2),
90
- createElementVNode("div", { class: normalizeClass(["opencode-error-overlay", { visible: $setup.showError }]) }, [renderSlot(_ctx.$slots, "error")], 2),
91
- renderSlot(_ctx.$slots, "content", {}, () => [createElementVNode("iframe", {
92
- ref: "iframeRef",
93
- class: "opencode-iframe",
94
- src: $setup.iframeSrc,
95
- allow: "clipboard-write; clipboard-read",
96
- referrerpolicy: "origin",
97
- onLoad: _cache[1] || (_cache[1] = (...args) => $setup.handleFrameLoaded && $setup.handleFrameLoaded(...args))
98
- }, null, 40, _hoisted_3$5)])
99
- ]);
100
- }
101
- __vue_sfc__$9.render = __vue_render__$9;
102
- var Frame_vue_default = __vue_sfc__$9;
103
- //#endregion
104
- //#region es/open-code-widget/src/components/Header.vue.mjs
105
- var __vue_sfc__$8 = /* @__PURE__ */ defineComponent({
106
- __name: "Header",
107
- setup(__props, { expose: __expose }) {
108
- __expose();
109
- const { title, sessionListTitle, sessionListCollapsed, selectMode, selectEnabled, theme, resolvedTheme, minimized, promptDockVisible, reviewPanelVisible, mode, displayMode, splitPosition, handleToggleSessionList, handleToggleSelectMode, handleToggleTheme, handleToggleDisplayMode, handleToggleSplitPosition, handleClose, handleToggleMinimize, handleTogglePromptDock, handleToggleReviewPanel, handleRefresh } = useOpenCodeWidgetContext();
110
- const __returned__ = {
111
- title,
112
- sessionListTitle,
113
- sessionListCollapsed,
114
- selectMode,
115
- selectEnabled,
116
- theme,
117
- resolvedTheme,
118
- minimized,
119
- promptDockVisible,
120
- reviewPanelVisible,
121
- mode,
122
- displayMode,
123
- splitPosition,
124
- handleToggleSessionList,
125
- handleToggleSelectMode,
126
- handleToggleTheme,
127
- handleToggleDisplayMode,
128
- handleToggleSplitPosition,
129
- handleClose,
130
- handleToggleMinimize,
131
- handleTogglePromptDock,
132
- handleToggleReviewPanel,
133
- handleRefresh,
134
- isSplitMode: computed(() => mode.value === "split"),
135
- themeIconTitle: computed(() => {
136
- return `\u4E3B\u9898: ${{
137
- auto: "自动",
138
- light: "亮色",
139
- dark: "暗色"
140
- }[theme.value]} (${resolvedTheme.value})`;
141
- }),
142
- themeIconLabel: computed(() => {
143
- return `\u5207\u6362\u4E3B\u9898 - \u5F53\u524D: ${{
144
- auto: "自动跟随系统",
145
- light: "亮色主题",
146
- dark: "暗色主题"
147
- }[theme.value]}`;
148
- }),
149
- displayModeIconTitle: computed(() => {
150
- return `\u5C55\u793A\u6A21\u5F0F: ${{
151
- bubble: "气泡模式",
152
- split: "分屏模式",
153
- auto: "自动模式",
154
- extension: "扩展模式",
155
- "extension-selector": "扩展选择器模式"
156
- }[displayMode.value]}`;
157
- }),
158
- displayModeIconLabel: computed(() => {
159
- const displayModeLabels = {
160
- bubble: "气泡模式",
161
- split: "分屏模式",
162
- auto: "自动模式",
163
- extension: "扩展模式",
164
- "extension-selector": "扩展选择器模式"
165
- };
166
- const modes = [
167
- "bubble",
168
- "split",
169
- "auto"
170
- ];
171
- return `\u5207\u6362\u5C55\u793A\u6A21\u5F0F - \u4E0B\u4E00\u4E2A: ${displayModeLabels[modes[(modes.indexOf(displayMode.value) + 1) % modes.length]]}`;
172
- }),
173
- splitPositionIconTitle: computed(() => {
174
- return `\u5206\u680F\u4F4D\u7F6E: ${{
175
- left: "左侧",
176
- right: "右侧"
177
- }[splitPosition.value]}`;
178
- }),
179
- splitPositionIconLabel: computed(() => {
180
- return `\u5207\u6362\u5206\u680F\u4F4D\u7F6E - \u4E0B\u4E00\u4E2A: ${splitPosition.value === "right" ? "左侧" : "右侧"}`;
181
- })
182
- };
183
- Object.defineProperty(__returned__, "__isScriptSetup", {
184
- enumerable: false,
185
- value: true
186
- });
187
- return __returned__;
188
- }
189
- });
190
- var _hoisted_1$6 = { class: "opencode-chat-header" };
191
- var _hoisted_2$4 = { class: "opencode-chat-header-left" };
192
- var _hoisted_3$4 = [
193
- "title",
194
- "aria-label",
195
- "aria-expanded"
196
- ];
197
- var _hoisted_4$4 = ["aria-pressed", "disabled"];
198
- var _hoisted_5$4 = ["title", "aria-label"];
199
- var _hoisted_6$4 = {
200
- key: 0,
201
- viewBox: "0 0 24 24",
202
- width: "16",
203
- height: "16",
204
- fill: "none",
205
- stroke: "currentColor",
206
- "stroke-width": "2",
207
- "aria-hidden": "true"
208
- };
209
- var _hoisted_7$2 = {
210
- key: 1,
211
- viewBox: "0 0 24 24",
212
- width: "16",
213
- height: "16",
214
- fill: "none",
215
- stroke: "currentColor",
216
- "stroke-width": "2",
217
- "aria-hidden": "true"
218
- };
219
- var _hoisted_8$1 = {
220
- key: 2,
221
- viewBox: "0 0 24 24",
222
- width: "16",
223
- height: "16",
224
- fill: "none",
225
- stroke: "currentColor",
226
- "stroke-width": "2",
227
- "aria-hidden": "true"
228
- };
229
- var _hoisted_9$1 = ["title", "aria-label"];
230
- var _hoisted_10$1 = {
231
- key: 0,
232
- viewBox: "0 0 24 24",
233
- width: "16",
234
- height: "16",
235
- fill: "none",
236
- stroke: "currentColor",
237
- "stroke-width": "2",
238
- "aria-hidden": "true"
239
- };
240
- var _hoisted_11 = {
241
- key: 1,
242
- viewBox: "0 0 24 24",
243
- width: "16",
244
- height: "16",
245
- fill: "none",
246
- stroke: "currentColor",
247
- "stroke-width": "2",
248
- "aria-hidden": "true"
249
- };
250
- var _hoisted_12 = {
251
- key: 2,
252
- viewBox: "0 0 24 24",
253
- width: "16",
254
- height: "16",
255
- fill: "none",
256
- stroke: "currentColor",
257
- "stroke-width": "2",
258
- "aria-hidden": "true"
259
- };
260
- var _hoisted_13 = { class: "opencode-chat-header-title" };
261
- var _hoisted_14 = { class: "opencode-chat-header-actions" };
262
- var _hoisted_15 = ["title", "aria-label"];
263
- var _hoisted_16 = {
264
- key: 0,
265
- viewBox: "0 0 24 24",
266
- width: "16",
267
- height: "16",
268
- fill: "none",
269
- stroke: "currentColor",
270
- "stroke-width": "2",
271
- "aria-hidden": "true"
272
- };
273
- var _hoisted_17 = {
274
- key: 1,
275
- viewBox: "0 0 24 24",
276
- width: "16",
277
- height: "16",
278
- fill: "none",
279
- stroke: "currentColor",
280
- "stroke-width": "2",
281
- "aria-hidden": "true"
282
- };
283
- var _hoisted_18 = [
284
- "title",
285
- "aria-label",
286
- "aria-pressed"
287
- ];
288
- var _hoisted_19 = [
289
- "title",
290
- "aria-label",
291
- "aria-pressed"
292
- ];
293
- var _hoisted_20 = [
294
- "title",
295
- "aria-label",
296
- "aria-pressed"
297
- ];
298
- var _hoisted_21 = {
299
- key: 0,
300
- viewBox: "0 0 24 24",
301
- width: "14",
302
- height: "14",
303
- fill: "none",
304
- stroke: "currentColor",
305
- "stroke-width": "2",
306
- "aria-hidden": "true"
307
- };
308
- var _hoisted_22 = {
309
- key: 1,
310
- viewBox: "0 0 24 24",
311
- width: "14",
312
- height: "14",
313
- fill: "none",
314
- stroke: "currentColor",
315
- "stroke-width": "2",
316
- "aria-hidden": "true"
317
- };
318
- function __vue_render__$8(_ctx, _cache, $props, $setup, $data, $options) {
319
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
320
- createElementVNode("div", _hoisted_2$4, [
321
- createElementVNode("button", {
322
- class: normalizeClass(["opencode-header-btn session-toggle", { active: !$setup.sessionListCollapsed }]),
323
- type: "button",
324
- title: $setup.sessionListTitle,
325
- "aria-label": $setup.sessionListTitle,
326
- "aria-expanded": !$setup.sessionListCollapsed,
327
- onClick: _cache[0] || (_cache[0] = (...args) => $setup.handleToggleSessionList && $setup.handleToggleSessionList(...args))
328
- }, [renderSlot(_ctx.$slots, "session-toggle-icon", {}, () => [_cache[10] || (_cache[10] = createElementVNode("svg", {
329
- viewBox: "0 0 24 24",
330
- width: "16",
331
- height: "16",
332
- fill: "none",
333
- stroke: "currentColor",
334
- "stroke-width": "2",
335
- "aria-hidden": "true"
336
- }, [createElementVNode("path", {
337
- d: "M4 6h16M4 12h16M4 18h16",
338
- "stroke-linecap": "round"
339
- })], -1))])], 10, _hoisted_3$4),
340
- createElementVNode("button", {
341
- class: normalizeClass(["opencode-header-btn select-btn", { active: $setup.selectMode }]),
342
- type: "button",
343
- title: "选择页面元素 (Ctrl+P)",
344
- "aria-label": "选择页面元素",
345
- "aria-pressed": $setup.selectMode,
346
- disabled: !$setup.selectEnabled,
347
- onClick: _cache[1] || (_cache[1] = (...args) => $setup.handleToggleSelectMode && $setup.handleToggleSelectMode(...args))
348
- }, [renderSlot(_ctx.$slots, "select-icon", {}, () => [_cache[11] || (_cache[11] = createElementVNode("svg", {
349
- viewBox: "0 0 1024 1024",
350
- width: "16",
351
- height: "16",
352
- "aria-hidden": "true"
353
- }, [createElementVNode("path", {
354
- fill: "currentColor",
355
- d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
356
- }), createElementVNode("path", {
357
- fill: "currentColor",
358
- d: "M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32m0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32M96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32m576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32"
359
- })], -1))])], 10, _hoisted_4$4),
360
- createElementVNode("button", {
361
- class: "opencode-header-btn theme-btn",
362
- type: "button",
363
- title: $setup.themeIconTitle,
364
- "aria-label": $setup.themeIconLabel,
365
- onClick: _cache[2] || (_cache[2] = (...args) => $setup.handleToggleTheme && $setup.handleToggleTheme(...args))
366
- }, [renderSlot(_ctx.$slots, "theme-icon", {}, () => [$setup.theme === "light" ? (openBlock(), createElementBlock("svg", _hoisted_6$4, [..._cache[12] || (_cache[12] = [createStaticVNode("<circle cx=\"12\" cy=\"12\" r=\"5\"></circle><line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"3\"></line><line x1=\"12\" y1=\"21\" x2=\"12\" y2=\"23\"></line><line x1=\"4.22\" y1=\"4.22\" x2=\"5.64\" y2=\"5.64\"></line><line x1=\"18.36\" y1=\"18.36\" x2=\"19.78\" y2=\"19.78\"></line><line x1=\"1\" y1=\"12\" x2=\"3\" y2=\"12\"></line><line x1=\"21\" y1=\"12\" x2=\"23\" y2=\"12\"></line><line x1=\"4.22\" y1=\"19.78\" x2=\"5.64\" y2=\"18.36\"></line><line x1=\"18.36\" y1=\"5.64\" x2=\"19.78\" y2=\"4.22\"></line>", 9)])])) : $setup.theme === "dark" ? (openBlock(), createElementBlock("svg", _hoisted_7$2, [..._cache[13] || (_cache[13] = [createElementVNode("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_8$1, [..._cache[14] || (_cache[14] = [createStaticVNode("<rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" ry=\"2\"></rect><line x1=\"8\" y1=\"21\" x2=\"16\" y2=\"21\"></line><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"21\"></line><circle cx=\"12\" cy=\"10\" r=\"3\"></circle><path d=\"M7 7l2 2M17 7l-2 2M7 13l2-2M17 13l-2-2\"></path>", 5)])]))])], 8, _hoisted_5$4),
367
- $setup.displayMode !== "extension" ? (openBlock(), createElementBlock("button", {
368
- key: 0,
369
- class: "opencode-header-btn display-mode-btn",
370
- type: "button",
371
- title: $setup.displayModeIconTitle,
372
- "aria-label": $setup.displayModeIconLabel,
373
- onClick: _cache[3] || (_cache[3] = (...args) => $setup.handleToggleDisplayMode && $setup.handleToggleDisplayMode(...args))
374
- }, [renderSlot(_ctx.$slots, "display-mode-icon", {}, () => [$setup.displayMode === "bubble" ? (openBlock(), createElementBlock("svg", _hoisted_10$1, [..._cache[15] || (_cache[15] = [
375
- createElementVNode("circle", {
376
- cx: "12",
377
- cy: "12",
378
- r: "10"
379
- }, null, -1),
380
- createElementVNode("path", {
381
- d: "M8 14s1.5 2 4 2 4-2 4-2",
382
- "stroke-linecap": "round"
383
- }, null, -1),
384
- createElementVNode("line", {
385
- x1: "9",
386
- y1: "9",
387
- x2: "9.01",
388
- y2: "9",
389
- "stroke-linecap": "round"
390
- }, null, -1),
391
- createElementVNode("line", {
392
- x1: "15",
393
- y1: "9",
394
- x2: "15.01",
395
- y2: "9",
396
- "stroke-linecap": "round"
397
- }, null, -1)
398
- ])])) : $setup.displayMode === "split" ? (openBlock(), createElementBlock("svg", _hoisted_11, [..._cache[16] || (_cache[16] = [createElementVNode("rect", {
399
- x: "3",
400
- y: "3",
401
- width: "18",
402
- height: "18",
403
- rx: "2"
404
- }, null, -1), createElementVNode("line", {
405
- x1: "12",
406
- y1: "3",
407
- x2: "12",
408
- y2: "21"
409
- }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_12, [..._cache[17] || (_cache[17] = [
410
- createElementVNode("rect", {
411
- x: "3",
412
- y: "3",
413
- width: "8",
414
- height: "8",
415
- rx: "1"
416
- }, null, -1),
417
- createElementVNode("rect", {
418
- x: "15",
419
- y: "3",
420
- width: "6",
421
- height: "8",
422
- rx: "1"
423
- }, null, -1),
424
- createElementVNode("rect", {
425
- x: "3",
426
- y: "15",
427
- width: "8",
428
- height: "6",
429
- rx: "1"
430
- }, null, -1),
431
- createElementVNode("circle", {
432
- cx: "18",
433
- cy: "18",
434
- r: "3"
435
- }, null, -1)
436
- ])]))])], 8, _hoisted_9$1)) : createCommentVNode("v-if", true)
437
- ]),
438
- createElementVNode("span", _hoisted_13, toDisplayString($setup.title), 1),
439
- createElementVNode("div", _hoisted_14, [
440
- $setup.displayMode === "extension" ? (openBlock(), createElementBlock("button", {
441
- key: 0,
442
- class: "opencode-header-btn refresh-btn",
443
- type: "button",
444
- title: "刷新面板",
445
- "aria-label": "刷新面板",
446
- onClick: _cache[4] || (_cache[4] = (...args) => $setup.handleRefresh && $setup.handleRefresh(...args))
447
- }, [..._cache[18] || (_cache[18] = [createElementVNode("svg", {
448
- viewBox: "0 0 24 24",
449
- width: "16",
450
- height: "16",
451
- fill: "none",
452
- stroke: "currentColor",
453
- "stroke-width": "2",
454
- "aria-hidden": "true"
455
- }, [createElementVNode("polyline", { points: "23,4 23,10 17,10" }), createElementVNode("path", { d: "M20.49 15a9 9 0 1 1-2.12-9.36L23 10" })], -1)])])) : createCommentVNode("v-if", true),
456
- $setup.isSplitMode && $setup.displayMode !== "extension" ? (openBlock(), createElementBlock("button", {
457
- key: 1,
458
- class: "opencode-header-btn split-position-btn",
459
- type: "button",
460
- title: $setup.splitPositionIconTitle,
461
- "aria-label": $setup.splitPositionIconLabel,
462
- onClick: _cache[5] || (_cache[5] = (...args) => $setup.handleToggleSplitPosition && $setup.handleToggleSplitPosition(...args))
463
- }, [renderSlot(_ctx.$slots, "split-position-icon", {}, () => [$setup.splitPosition === "right" ? (openBlock(), createElementBlock("svg", _hoisted_16, [..._cache[19] || (_cache[19] = [createElementVNode("rect", {
464
- x: "3",
465
- y: "3",
466
- width: "18",
467
- height: "18",
468
- rx: "2"
469
- }, null, -1), createElementVNode("line", {
470
- x1: "15",
471
- y1: "3",
472
- x2: "15",
473
- y2: "21"
474
- }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_17, [..._cache[20] || (_cache[20] = [createElementVNode("rect", {
475
- x: "3",
476
- y: "3",
477
- width: "18",
478
- height: "18",
479
- rx: "2"
480
- }, null, -1), createElementVNode("line", {
481
- x1: "9",
482
- y1: "3",
483
- x2: "9",
484
- y2: "21"
485
- }, null, -1)])]))])], 8, _hoisted_15)) : createCommentVNode("v-if", true),
486
- createElementVNode("button", {
487
- class: normalizeClass(["opencode-header-btn review-panel", { active: $setup.reviewPanelVisible }]),
488
- type: "button",
489
- title: $setup.reviewPanelVisible ? "收起审查面板" : "展开审查面板",
490
- "aria-label": $setup.reviewPanelVisible ? "收起审查面板" : "展开审查面板",
491
- "aria-pressed": $setup.reviewPanelVisible,
492
- onClick: _cache[6] || (_cache[6] = (...args) => $setup.handleToggleReviewPanel && $setup.handleToggleReviewPanel(...args))
493
- }, [..._cache[21] || (_cache[21] = [createElementVNode("svg", {
494
- viewBox: "0 0 24 24",
495
- width: "15",
496
- height: "15",
497
- fill: "none",
498
- stroke: "currentColor",
499
- "stroke-width": "2",
500
- "stroke-linecap": "round",
501
- "stroke-linejoin": "round",
502
- "aria-hidden": "true"
503
- }, [createElementVNode("polyline", { points: "16 18 22 12 16 6" }), createElementVNode("polyline", { points: "8 6 2 12 8 18" })], -1)])], 10, _hoisted_18),
504
- !$setup.isSplitMode ? (openBlock(), createElementBlock("button", {
505
- key: 2,
506
- class: "opencode-header-btn prompt-dock",
507
- type: "button",
508
- title: $setup.promptDockVisible ? "隐藏对话框" : "显示对话框",
509
- "aria-label": $setup.promptDockVisible ? "隐藏对话框" : "显示对话框",
510
- "aria-pressed": $setup.promptDockVisible,
511
- onClick: _cache[7] || (_cache[7] = (...args) => $setup.handleTogglePromptDock && $setup.handleTogglePromptDock(...args))
512
- }, [renderSlot(_ctx.$slots, "prompt-dock-icon", {}, () => [_cache[22] || (_cache[22] = createElementVNode("svg", {
513
- viewBox: "0 0 24 24",
514
- width: "14",
515
- height: "14",
516
- fill: "none",
517
- stroke: "currentColor",
518
- "stroke-width": "2",
519
- "aria-hidden": "true"
520
- }, [createElementVNode("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })], -1))])], 8, _hoisted_19)) : createCommentVNode("v-if", true),
521
- !$setup.isSplitMode ? (openBlock(), createElementBlock("button", {
522
- key: 3,
523
- class: "opencode-header-btn minimize",
524
- type: "button",
525
- title: $setup.minimized ? "展开" : "最小化",
526
- "aria-label": $setup.minimized ? "展开面板" : "最小化面板",
527
- "aria-pressed": $setup.minimized,
528
- onClick: _cache[8] || (_cache[8] = (...args) => $setup.handleToggleMinimize && $setup.handleToggleMinimize(...args))
529
- }, [renderSlot(_ctx.$slots, "minimize-icon", {}, () => [$setup.minimized ? (openBlock(), createElementBlock("svg", _hoisted_21, [..._cache[23] || (_cache[23] = [createElementVNode("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }, null, -1)])])) : (openBlock(), createElementBlock("svg", _hoisted_22, [..._cache[24] || (_cache[24] = [createElementVNode("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" }, null, -1)])]))])], 8, _hoisted_20)) : createCommentVNode("v-if", true),
530
- !$setup.isSplitMode ? (openBlock(), createElementBlock("button", {
531
- key: 4,
532
- class: "opencode-header-btn close",
533
- type: "button",
534
- title: "关闭",
535
- "aria-label": "关闭面板",
536
- onClick: _cache[9] || (_cache[9] = (...args) => $setup.handleClose && $setup.handleClose(...args))
537
- }, [renderSlot(_ctx.$slots, "close-icon", {}, () => [_cache[25] || (_cache[25] = createElementVNode("svg", {
538
- viewBox: "0 0 24 24",
539
- width: "14",
540
- height: "14",
541
- fill: "none",
542
- stroke: "currentColor",
543
- "stroke-width": "2",
544
- "aria-hidden": "true"
545
- }, [createElementVNode("path", { d: "M18 6L6 18M6 6l12 12" })], -1))])])) : createCommentVNode("v-if", true)
546
- ])
547
- ]);
548
- }
549
- __vue_sfc__$8.render = __vue_render__$8;
550
- var Header_vue_default = __vue_sfc__$8;
551
- //#endregion
552
- //#region es/open-code-widget/src/components/SessionList.vue.mjs
553
- var __vue_sfc__$7 = /* @__PURE__ */ defineComponent({
554
- __name: "SessionList",
555
- setup(__props, { expose: __expose }) {
556
- __expose();
557
- const { sessionListCollapsed: collapsed, sessionItems: sessions, loadingSessionList, showSessionListSkeleton, handleCreateSession, handleSelectSession, handleDeleteSession, sessionKey, sessionStates } = useOpenCodeWidgetContext();
558
- const isAnimating = ref(false);
559
- let animTimer = null;
560
- watch(collapsed, () => {
561
- isAnimating.value = true;
562
- if (animTimer) clearTimeout(animTimer);
563
- animTimer = setTimeout(() => {
564
- isAnimating.value = false;
565
- }, 200);
566
- });
567
- const showSkeleton = computed(() => {
568
- if (isAnimating.value) return true;
569
- if (showSessionListSkeleton.value) return true;
570
- return false;
571
- });
572
- function isSessionThinking(sessionId) {
573
- var _a, _b;
574
- if (!(sessionStates == null ? void 0 : sessionStates.value) || !sessionId) return false;
575
- return (_b = (_a = sessionStates.value[sessionId]) == null ? void 0 : _a.thinking) != null ? _b : false;
576
- }
577
- const __returned__ = {
578
- collapsed,
579
- sessions,
580
- loadingSessionList,
581
- showSessionListSkeleton,
582
- handleCreateSession,
583
- handleSelectSession,
584
- handleDeleteSession,
585
- sessionKey,
586
- sessionStates,
587
- isAnimating,
588
- get animTimer() {
589
- return animTimer;
590
- },
591
- set animTimer(v) {
592
- animTimer = v;
593
- },
594
- showSkeleton,
595
- isSessionThinking
596
- };
597
- Object.defineProperty(__returned__, "__isScriptSetup", {
598
- enumerable: false,
599
- value: true
600
- });
601
- return __returned__;
602
- }
603
- });
604
- var _hoisted_1$5 = {
605
- key: 0,
606
- class: "opencode-session-list-header"
607
- };
608
- var _hoisted_2$3 = {
609
- key: 2,
610
- class: "opencode-session-skeleton visible"
611
- };
612
- var _hoisted_3$3 = {
613
- class: "opencode-session-list-content",
614
- role: "listbox",
615
- "aria-labelledby": "opencode-session-list-title"
616
- };
617
- var _hoisted_4$3 = {
618
- key: 0,
619
- class: "opencode-session-list-loading-overlay"
620
- };
621
- var _hoisted_5$3 = ["aria-selected", "onClick"];
622
- var _hoisted_6$3 = { class: "opencode-session-header" };
623
- var _hoisted_7$1 = { class: "opencode-session-title" };
624
- var _hoisted_8 = {
625
- key: 0,
626
- class: "opencode-thinking-loading"
627
- };
628
- var _hoisted_9 = ["aria-label", "onClick"];
629
- var _hoisted_10 = { class: "opencode-session-meta" };
630
- function __vue_render__$7(_ctx, _cache, $props, $setup, $data, $options) {
631
- return openBlock(), createElementBlock("div", { class: normalizeClass(["opencode-session-list", { collapsed: $setup.collapsed }]) }, [
632
- createCommentVNode(" Header "),
633
- !$setup.showSkeleton ? (openBlock(), createElementBlock("div", _hoisted_1$5, [_cache[1] || (_cache[1] = createElementVNode("span", { id: "opencode-session-list-title" }, "会话列表", -1)), createElementVNode("button", {
634
- class: "opencode-new-session-btn",
635
- type: "button",
636
- title: "新建会话",
637
- "aria-label": "新建会话",
638
- onClick: _cache[0] || (_cache[0] = (...args) => $setup.handleCreateSession && $setup.handleCreateSession(...args))
639
- }, " + ")])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Header Skeleton "), _cache[2] || (_cache[2] = createElementVNode("div", { class: "opencode-session-header-skeleton visible" }, [createElementVNode("div", { class: "opencode-skeleton-header-title" }), createElementVNode("div", { class: "opencode-skeleton-header-btn" })], -1))], 2112)),
640
- createCommentVNode(" Content Skeleton "),
641
- $setup.showSkeleton ? (openBlock(), createElementBlock("div", _hoisted_2$3, [(openBlock(), createElementBlock(Fragment, null, renderList(5, (i) => {
642
- return createElementVNode("div", {
643
- key: `skeleton-${i}`,
644
- class: "opencode-skeleton-item"
645
- }, [..._cache[3] || (_cache[3] = [createElementVNode("div", { class: "opencode-skeleton-title" }, null, -1), createElementVNode("div", { class: "opencode-skeleton-meta" }, null, -1)])]);
646
- }), 64))])) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createCommentVNode(" Content "), createElementVNode("div", _hoisted_3$3, [$setup.loadingSessionList ? (openBlock(), createElementBlock("div", _hoisted_4$3, [..._cache[4] || (_cache[4] = [createElementVNode("div", { class: "opencode-loading-spinner small" }, null, -1)])])) : createCommentVNode("v-if", true), $setup.sessions.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList($setup.sessions, (item) => {
647
- return openBlock(), createElementBlock("div", {
648
- key: item[$setup.sessionKey],
649
- class: normalizeClass(["opencode-session-item", {
650
- active: item.active,
651
- thinking: $setup.isSessionThinking(item.id)
652
- }]),
653
- role: "option",
654
- "aria-selected": item.active,
655
- onClick: ($event) => $setup.handleSelectSession(item)
656
- }, [createElementVNode("div", _hoisted_6$3, [createElementVNode("div", _hoisted_7$1, [$setup.isSessionThinking(item.id) ? (openBlock(), createElementBlock("span", _hoisted_8)) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(item.title), 1)]), createElementVNode("button", {
657
- class: "opencode-session-delete-btn",
658
- type: "button",
659
- "aria-label": `\u5220\u9664\u4F1A\u8BDD: ${item.title}`,
660
- onClick: withModifiers(($event) => $setup.handleDeleteSession(item), ["stop"])
661
- }, " × ", 8, _hoisted_9)]), createElementVNode("div", _hoisted_10, toDisplayString(item.meta), 1)], 10, _hoisted_5$3);
662
- }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" Empty State "), renderSlot(_ctx.$slots, "empty")], 64))])], 2112))
663
- ], 2);
664
- }
665
- __vue_sfc__$7.render = __vue_render__$7;
666
- var SessionList_vue_default = __vue_sfc__$7;
667
- //#endregion
668
- //#region es/open-code-widget/src/components/SelectedNodes.vue.mjs
669
- var __vue_sfc__$6 = /* @__PURE__ */ defineComponent({
670
- __name: "SelectedNodes",
671
- setup(__props, { expose: __expose }) {
672
- __expose();
673
- const { selectedElementItems: items, showClearAll, handleClickSelectedNode, handleRemoveSelectedNode, handleClearSelectedNodes } = useOpenCodeWidgetContext();
674
- const __returned__ = {
675
- items,
676
- showClearAll,
677
- handleClickSelectedNode,
678
- handleRemoveSelectedNode,
679
- handleClearSelectedNodes
680
- };
681
- Object.defineProperty(__returned__, "__isScriptSetup", {
682
- enumerable: false,
683
- value: true
684
- });
685
- return __returned__;
686
- }
687
- });
688
- var _hoisted_1$4 = {
689
- class: "opencode-selected-nodes",
690
- role: "list",
691
- "aria-label": "已选元素列表"
692
- };
693
- var _hoisted_2$2 = ["onClick"];
694
- var _hoisted_3$2 = { class: "opencode-node-content" };
695
- var _hoisted_4$2 = { class: "opencode-node-text" };
696
- var _hoisted_5$2 = { class: "opencode-node-file" };
697
- var _hoisted_6$2 = ["aria-label", "onClick"];
698
- function __vue_render__$6(_ctx, _cache, $props, $setup, $data, $options) {
699
- return openBlock(), createElementBlock("div", { class: normalizeClass(["opencode-right-toolbar", { collapsed: $setup.items.length === 0 }]) }, [
700
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "opencode-selected-nodes-header" }, [createElementVNode("div", { class: "opencode-selected-nodes-title" }, "已选节点"), createElementVNode("div", { class: "opencode-selected-nodes-desc" }, "选中的节点会在对话时一起发送给助手")], -1)),
701
- createElementVNode("div", _hoisted_1$4, [(openBlock(true), createElementBlock(Fragment, null, renderList($setup.items, (item, index) => {
702
- return openBlock(), createElementBlock("div", {
703
- key: item.key,
704
- class: "opencode-selected-node",
705
- role: "listitem",
706
- onClick: ($event) => $setup.handleClickSelectedNode(item)
707
- }, [createElementVNode("div", _hoisted_3$2, [createElementVNode("span", _hoisted_4$2, toDisplayString(item.description), 1), createElementVNode("span", _hoisted_5$2, toDisplayString(item.panelFileText), 1)]), createElementVNode("button", {
708
- class: "opencode-node-remove",
709
- type: "button",
710
- "aria-label": `\u79FB\u9664\u5143\u7D20: ${item.description}`,
711
- onClick: withModifiers(($event) => $setup.handleRemoveSelectedNode({
712
- item,
713
- index,
714
- source: "panel"
715
- }), ["stop"])
716
- }, " × ", 8, _hoisted_6$2)], 8, _hoisted_2$2);
717
- }), 128))]),
718
- $setup.showClearAll && $setup.items.length > 0 ? (openBlock(), createElementBlock("button", {
719
- key: 0,
720
- class: "opencode-clear-all-btn",
721
- type: "button",
722
- "aria-label": "清空所有已选节点",
723
- onClick: _cache[0] || (_cache[0] = (...args) => $setup.handleClearSelectedNodes && $setup.handleClearSelectedNodes(...args))
724
- }, " 一键清空 ")) : createCommentVNode("v-if", true)
725
- ], 2);
726
- }
727
- __vue_sfc__$6.render = __vue_render__$6;
728
- var SelectedNodes_vue_default = __vue_sfc__$6;
729
- //#endregion
730
- //#region es/open-code-widget/src/components/ResizeHandle.vue.mjs
731
- var __defProp$3 = Object.defineProperty;
732
- var __defProps$3 = Object.defineProperties;
733
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
734
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
735
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
736
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
737
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
738
- enumerable: true,
739
- configurable: true,
740
- writable: true,
741
- value
742
- }) : obj[key] = value;
743
- var __spreadValues$3 = (a, b) => {
744
- for (var prop in b || (b = {})) if (__hasOwnProp$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]);
745
- if (__getOwnPropSymbols$3) {
746
- for (var prop of __getOwnPropSymbols$3(b)) if (__propIsEnum$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]);
747
- }
748
- return a;
749
- };
750
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
751
- var __vue_sfc__$5 = /* @__PURE__ */ defineComponent(__spreadProps$3(__spreadValues$3({}, { name: "ResizeHandle" }), {
752
- __name: "ResizeHandle",
753
- props: {
754
- width: {
755
- type: Number,
756
- required: false,
757
- default: 500
758
- },
759
- minWidth: {
760
- type: Number,
761
- required: false,
762
- default: 400
763
- },
764
- maxWidth: {
765
- type: Number,
766
- required: false,
767
- default: 800
768
- },
769
- position: {
770
- type: String,
771
- required: false,
772
- default: "right"
773
- }
774
- },
775
- emits: [
776
- "resize",
777
- "resize-start",
778
- "resize-end"
779
- ],
780
- setup(__props, { expose: __expose, emit: __emit }) {
781
- __expose();
782
- const props = __props;
783
- const emit = __emit;
784
- const isResizing = ref(false);
785
- const startX = ref(0);
786
- const startWidth = ref(0);
787
- const handleMouseDown = (e) => {
788
- e.preventDefault();
789
- isResizing.value = true;
790
- startX.value = e.clientX;
791
- startWidth.value = props.width;
792
- emit("resize-start");
793
- document.addEventListener("mousemove", handleMouseMove);
794
- document.addEventListener("mouseup", handleMouseUp);
795
- };
796
- const handleMouseMove = (e) => {
797
- if (!isResizing.value) return;
798
- let deltaX;
799
- if (props.position === "right") deltaX = startX.value - e.clientX;
800
- else deltaX = e.clientX - startX.value;
801
- const newWidth = Math.max(props.minWidth, Math.min(props.maxWidth, startWidth.value + deltaX));
802
- emit("resize", newWidth);
803
- };
804
- const handleMouseUp = () => {
805
- isResizing.value = false;
806
- emit("resize-end");
807
- document.removeEventListener("mousemove", handleMouseMove);
808
- document.removeEventListener("mouseup", handleMouseUp);
809
- };
810
- const handleDoubleClick = () => {
811
- emit("resize", 500);
812
- };
813
- onUnmounted(() => {
814
- document.removeEventListener("mousemove", handleMouseMove);
815
- document.removeEventListener("mouseup", handleMouseUp);
816
- });
817
- const __returned__ = {
818
- props,
819
- emit,
820
- isResizing,
821
- startX,
822
- startWidth,
823
- handleMouseDown,
824
- handleMouseMove,
825
- handleMouseUp,
826
- handleDoubleClick
827
- };
828
- Object.defineProperty(__returned__, "__isScriptSetup", {
829
- enumerable: false,
830
- value: true
831
- });
832
- return __returned__;
833
- }
834
- }));
835
- function __vue_render__$5(_ctx, _cache, $props, $setup, $data, $options) {
836
- return openBlock(), createElementBlock("div", {
837
- class: normalizeClass(["opencode-resize-handle", {
838
- resizing: $setup.isResizing,
839
- "handle-left": $props.position === "left"
840
- }]),
841
- onMousedown: $setup.handleMouseDown,
842
- onDblclick: $setup.handleDoubleClick
843
- }, null, 34);
844
- }
845
- __vue_sfc__$5.render = __vue_render__$5;
846
- var ResizeHandle_vue_default = __vue_sfc__$5;
847
- //#endregion
848
- //#region es/open-code-widget/src/components/ChatPanel.vue.mjs
849
- var __defProp$2 = Object.defineProperty;
850
- var __defProps$2 = Object.defineProperties;
851
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
852
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
853
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
854
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
855
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
856
- enumerable: true,
857
- configurable: true,
858
- writable: true,
859
- value
860
- }) : obj[key] = value;
861
- var __spreadValues$2 = (a, b) => {
862
- for (var prop in b || (b = {})) if (__hasOwnProp$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]);
863
- if (__getOwnPropSymbols$2) {
864
- for (var prop of __getOwnPropSymbols$2(b)) if (__propIsEnum$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]);
865
- }
866
- return a;
867
- };
868
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
869
- var __vue_sfc__$4 = /* @__PURE__ */ defineComponent(__spreadProps$2(__spreadValues$2({}, { name: "ChatPanel" }), {
870
- __name: "ChatPanel",
871
- props: {
872
- mode: {
873
- type: String,
874
- required: false,
875
- default: "bubble"
876
- },
877
- open: {
878
- type: Boolean,
879
- required: false,
880
- default: false
881
- },
882
- minimized: {
883
- type: Boolean,
884
- required: false,
885
- default: false
886
- },
887
- positionStyle: {
888
- type: Object,
889
- required: false,
890
- default: () => ({})
891
- },
892
- animationOrigin: {
893
- type: Object,
894
- required: false,
895
- default: () => ({
896
- x: "20px",
897
- y: "20px"
898
- })
899
- },
900
- panelWidth: {
901
- type: Number,
902
- required: false,
903
- default: 500
904
- },
905
- resizable: {
906
- type: Boolean,
907
- required: false,
908
- default: true
909
- },
910
- minWidth: {
911
- type: Number,
912
- required: false,
913
- default: 400
914
- },
915
- maxWidth: {
916
- type: Number,
917
- required: false,
918
- default: 800
919
- },
920
- noTransition: {
921
- type: Boolean,
922
- required: false,
923
- default: false
924
- },
925
- dragging: {
926
- type: Boolean,
927
- required: false,
928
- default: false
929
- },
930
- thinking: {
931
- type: Boolean,
932
- required: false,
933
- default: false
934
- },
935
- resolvedTheme: {
936
- type: String,
937
- required: false,
938
- default: "light"
939
- },
940
- splitPosition: {
941
- type: String,
942
- required: false,
943
- default: "right"
944
- },
945
- extension: {
946
- type: Boolean,
947
- required: false,
948
- default: false
949
- }
950
- },
951
- emits: [
952
- "resize",
953
- "resize-start",
954
- "resize-end",
955
- "toggle"
956
- ],
957
- setup(__props, { expose: __expose, emit: __emit }) {
958
- useCssVars((_ctx) => ({
959
- "-animationOrigin.x": _ctx.animationOrigin.x,
960
- "-animationOrigin.y": _ctx.animationOrigin.y
961
- }));
962
- const props = __props;
963
- const emit = __emit;
964
- const slots = useSlots();
965
- const frameRef = ref(null);
966
- const sendMessageToIframe = (type, data) => {
967
- var _a;
968
- (_a = frameRef.value) == null || _a.sendMessageToIframe(type, data);
969
- };
970
- __expose({
971
- sendMessageToIframe,
972
- frameRef
973
- });
974
- const handleResizeStart = () => {
975
- emit("resize-start");
976
- };
977
- const handleResize = (width) => {
978
- emit("resize", width);
979
- };
980
- const handleResizeEnd = () => {
981
- emit("resize-end");
982
- };
983
- const handleToggle = () => {
984
- emit("toggle");
985
- };
986
- const __returned__ = {
987
- props,
988
- emit,
989
- slots,
990
- frameRef,
991
- sendMessageToIframe,
992
- handleResizeStart,
993
- handleResize,
994
- handleResizeEnd,
995
- handleToggle,
996
- panelStyle: computed(() => {
997
- if (props.extension) return {};
998
- if (props.mode === "split") return { width: `${props.panelWidth}px` };
999
- return props.positionStyle;
1000
- }),
1001
- panelClasses: computed(() => ["opencode-chat", {
1002
- open: props.open,
1003
- minimized: props.minimized,
1004
- dragging: props.dragging,
1005
- "no-transition": props.noTransition,
1006
- "split-mode": props.mode === "split",
1007
- "split-left": props.mode === "split" && props.splitPosition === "left" && !props.extension,
1008
- "split-right": props.mode === "split" && props.splitPosition === "right" && !props.extension,
1009
- "extension-mode": props.extension
1010
- }]),
1011
- Frame: Frame_vue_default,
1012
- Header: Header_vue_default,
1013
- SessionList: SessionList_vue_default,
1014
- SelectedNodes: SelectedNodes_vue_default,
1015
- ResizeHandle: ResizeHandle_vue_default
1016
- };
1017
- Object.defineProperty(__returned__, "__isScriptSetup", {
1018
- enumerable: false,
1019
- value: true
1020
- });
1021
- return __returned__;
1022
- }
1023
- }));
1024
- var _hoisted_1$3 = ["aria-expanded"];
1025
- var _hoisted_2$1 = { class: "opencode-split-toggle-icon" };
1026
- var _hoisted_3$1 = {
1027
- key: 0,
1028
- viewBox: "0 0 24 24",
1029
- width: "16",
1030
- height: "16",
1031
- fill: "none",
1032
- stroke: "currentColor",
1033
- "stroke-width": "2"
1034
- };
1035
- var _hoisted_4$1 = {
1036
- key: 1,
1037
- viewBox: "0 0 24 24",
1038
- width: "16",
1039
- height: "16",
1040
- fill: "none",
1041
- stroke: "currentColor",
1042
- "stroke-width": "2"
1043
- };
1044
- var _hoisted_5$1 = {
1045
- key: 2,
1046
- viewBox: "0 0 24 24",
1047
- width: "16",
1048
- height: "16",
1049
- fill: "none",
1050
- stroke: "currentColor",
1051
- "stroke-width": "2"
1052
- };
1053
- var _hoisted_6$1 = {
1054
- key: 3,
1055
- viewBox: "0 0 24 24",
1056
- width: "16",
1057
- height: "16",
1058
- fill: "none",
1059
- stroke: "currentColor",
1060
- "stroke-width": "2"
1061
- };
1062
- var _hoisted_7 = { class: "opencode-chat-content" };
1063
- function __vue_render__$4(_ctx, _cache, $props, $setup, $data, $options) {
1064
- return openBlock(), createElementBlock("div", {
1065
- class: normalizeClass($setup.panelClasses),
1066
- style: normalizeStyle($setup.panelStyle)
1067
- }, [
1068
- $props.mode === "split" && $props.resizable && $props.open ? (openBlock(), createBlock($setup["ResizeHandle"], {
1069
- key: 0,
1070
- width: $props.panelWidth,
1071
- "min-width": $props.minWidth,
1072
- "max-width": $props.maxWidth,
1073
- position: $props.splitPosition,
1074
- onResize: $setup.handleResize,
1075
- onResizeStart: $setup.handleResizeStart,
1076
- onResizeEnd: $setup.handleResizeEnd
1077
- }, null, 8, [
1078
- "width",
1079
- "min-width",
1080
- "max-width",
1081
- "position"
1082
- ])) : createCommentVNode("v-if", true),
1083
- $props.mode === "split" && $props.resizable ? (openBlock(), createElementBlock("button", {
1084
- key: 1,
1085
- type: "button",
1086
- class: normalizeClass(["opencode-split-toggle-btn", {
1087
- open: $setup.props.open,
1088
- thinking: $setup.props.thinking,
1089
- "opencode-theme-dark": $props.resolvedTheme === "dark",
1090
- "split-left": $props.splitPosition === "left"
1091
- }]),
1092
- "aria-expanded": $props.open,
1093
- "aria-label": "切换面板",
1094
- onClick: $setup.handleToggle
1095
- }, [createElementVNode("span", _hoisted_2$1, [
1096
- $props.open && $props.splitPosition === "right" ? (openBlock(), createElementBlock("svg", _hoisted_3$1, [..._cache[0] || (_cache[0] = [createElementVNode("path", {
1097
- d: "M9 18l6-6-6-6",
1098
- "stroke-linecap": "round",
1099
- "stroke-linejoin": "round"
1100
- }, null, -1)])])) : createCommentVNode("v-if", true),
1101
- !$props.open && $props.splitPosition === "right" ? (openBlock(), createElementBlock("svg", _hoisted_4$1, [..._cache[1] || (_cache[1] = [createElementVNode("path", {
1102
- d: "M15 18l-6-6 6-6",
1103
- "stroke-linecap": "round",
1104
- "stroke-linejoin": "round"
1105
- }, null, -1)])])) : createCommentVNode("v-if", true),
1106
- $props.open && $props.splitPosition === "left" ? (openBlock(), createElementBlock("svg", _hoisted_5$1, [..._cache[2] || (_cache[2] = [createElementVNode("path", {
1107
- d: "M15 18l-6-6 6-6",
1108
- "stroke-linecap": "round",
1109
- "stroke-linejoin": "round"
1110
- }, null, -1)])])) : createCommentVNode("v-if", true),
1111
- !$props.open && $props.splitPosition === "left" ? (openBlock(), createElementBlock("svg", _hoisted_6$1, [..._cache[3] || (_cache[3] = [createElementVNode("path", {
1112
- d: "M9 18l6-6-6-6",
1113
- "stroke-linecap": "round",
1114
- "stroke-linejoin": "round"
1115
- }, null, -1)])])) : createCommentVNode("v-if", true)
1116
- ])], 10, _hoisted_1$3)) : createCommentVNode("v-if", true),
1117
- createVNode($setup["Header"], null, createSlots({ _: 2 }, [
1118
- $setup.slots["session-toggle-icon"] ? {
1119
- name: "session-toggle-icon",
1120
- fn: withCtx(() => [renderSlot(_ctx.$slots, "session-toggle-icon")]),
1121
- key: "0"
1122
- } : void 0,
1123
- $setup.slots["select-icon"] ? {
1124
- name: "select-icon",
1125
- fn: withCtx(() => [renderSlot(_ctx.$slots, "select-icon")]),
1126
- key: "1"
1127
- } : void 0,
1128
- $setup.slots["close-icon"] ? {
1129
- name: "close-icon",
1130
- fn: withCtx(() => [renderSlot(_ctx.$slots, "close-icon")]),
1131
- key: "2"
1132
- } : void 0
1133
- ]), 1024),
1134
- createElementVNode("div", _hoisted_7, [
1135
- createVNode($setup["SessionList"], null, {
1136
- empty: withCtx(() => [renderSlot(_ctx.$slots, "sessions-empty", {}, () => [_cache[4] || (_cache[4] = createElementVNode("div", { class: "opencode-session-empty" }, "暂无会话", -1))])]),
1137
- _: 3
1138
- }),
1139
- createVNode($setup["Frame"], { ref: "frameRef" }, createSlots({ _: 2 }, [
1140
- $setup.slots["empty-state"] ? {
1141
- name: "empty-state",
1142
- fn: withCtx(() => [renderSlot(_ctx.$slots, "empty-state")]),
1143
- key: "0"
1144
- } : void 0,
1145
- $setup.slots.loading ? {
1146
- name: "loading",
1147
- fn: withCtx(() => [renderSlot(_ctx.$slots, "loading")]),
1148
- key: "1"
1149
- } : void 0,
1150
- $setup.slots.error ? {
1151
- name: "error",
1152
- fn: withCtx(() => [renderSlot(_ctx.$slots, "error")]),
1153
- key: "2"
1154
- } : void 0,
1155
- $setup.slots.content ? {
1156
- name: "content",
1157
- fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
1158
- key: "3"
1159
- } : void 0
1160
- ]), 1536),
1161
- createVNode($setup["SelectedNodes"])
1162
- ])
1163
- ], 6);
1164
- }
1165
- __vue_sfc__$4.render = __vue_render__$4;
1166
- var ChatPanel_vue_default = __vue_sfc__$4;
1167
- //#endregion
1168
- //#region es/open-code-widget/src/components/SelectHint.vue.mjs
1169
- var __vue_sfc__$3 = /* @__PURE__ */ defineComponent({
1170
- __name: "SelectHint",
1171
- setup(__props, { expose: __expose }) {
1172
- __expose();
1173
- const { selectMode: visible, selectShortcutLabel: shortcutLabel } = useOpenCodeWidgetContext();
1174
- const __returned__ = {
1175
- visible,
1176
- shortcutLabel
1177
- };
1178
- Object.defineProperty(__returned__, "__isScriptSetup", {
1179
- enumerable: false,
1180
- value: true
1181
- });
1182
- return __returned__;
1183
- }
1184
- });
1185
- var _hoisted_1$2 = { class: "opencode-hint-shortcut" };
1186
- function __vue_render__$3(_ctx, _cache, $props, $setup, $data, $options) {
1187
- return openBlock(), createElementBlock("div", { class: normalizeClass(["opencode-select-mode-hint", { visible: $setup.visible }]) }, [_cache[0] || (_cache[0] = createStaticVNode("<span class=\"opencode-hint-main\"><span class=\"opencode-hint-icon\" aria-hidden=\"true\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"8\"></circle><circle cx=\"12\" cy=\"12\" r=\"2.5\" fill=\"currentColor\"></circle><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"5\"></line><line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"22\"></line><line x1=\"2\" y1=\"12\" x2=\"5\" y2=\"12\"></line><line x1=\"19\" y1=\"12\" x2=\"22\" y2=\"12\"></line></svg></span><span class=\"opencode-hint-text\">选择模式已开启 · 点击元素进行选择</span></span>", 1)), createElementVNode("span", _hoisted_1$2, toDisplayString($setup.shortcutLabel), 1)], 2);
1188
- }
1189
- __vue_sfc__$3.render = __vue_render__$3;
1190
- var SelectHint_vue_default = __vue_sfc__$3;
1191
- //#endregion
1192
- //#region es/open-code-widget/src/components/FloatingBubble/FloatingBubble.vue.mjs
1193
- var __defProp$1 = Object.defineProperty;
1194
- var __defProps$1 = Object.defineProperties;
1195
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
1196
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
1197
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
1198
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
1199
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
1200
- enumerable: true,
1201
- configurable: true,
1202
- writable: true,
1203
- value
1204
- }) : obj[key] = value;
1205
- var __spreadValues$1 = (a, b) => {
1206
- for (var prop in b || (b = {})) if (__hasOwnProp$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
1207
- if (__getOwnPropSymbols$1) {
1208
- for (var prop of __getOwnPropSymbols$1(b)) if (__propIsEnum$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
1209
- }
1210
- return a;
1211
- };
1212
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
1213
- var __vue_sfc__$2 = /* @__PURE__ */ defineComponent(__spreadProps$1(__spreadValues$1({}, { name: "FloatingBubble" }), {
1214
- __name: "FloatingBubble",
1215
- props: {
1216
- offset: {
1217
- type: Object,
1218
- required: false,
1219
- default: void 0
1220
- },
1221
- axis: {
1222
- type: String,
1223
- required: false,
1224
- default: "xy"
1225
- },
1226
- magnetic: {
1227
- type: String,
1228
- required: false,
1229
- default: void 0
1230
- },
1231
- gap: {
1232
- type: [Number, Object],
1233
- required: false,
1234
- default: 24
1235
- },
1236
- teleport: {
1237
- type: null,
1238
- required: false,
1239
- default: "body"
1240
- }
1241
- },
1242
- emits: [
1243
- "update:offset",
1244
- "click",
1245
- "offset-change",
1246
- "drag-start",
1247
- "drag-end"
1248
- ],
1249
- setup(__props, { expose: __expose, emit: __emit }) {
1250
- const props = __props;
1251
- const emit = __emit;
1252
- const rootRef = ref(null);
1253
- const state = ref({
1254
- x: 0,
1255
- y: 0,
1256
- width: 0,
1257
- height: 0
1258
- });
1259
- const isObject = (val) => val !== null && typeof val === "object";
1260
- const gapX = computed(() => isObject(props.gap) ? props.gap.x : props.gap);
1261
- const gapY = computed(() => isObject(props.gap) ? props.gap.y : props.gap);
1262
- const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
1263
- const windowHeight = ref(typeof window !== "undefined" ? window.innerHeight : 0);
1264
- const boundary = computed(() => ({
1265
- top: gapY.value,
1266
- right: windowWidth.value - state.value.width - gapX.value,
1267
- bottom: windowHeight.value - state.value.height - gapY.value,
1268
- left: gapX.value
1269
- }));
1270
- const closest = (arr, target) => {
1271
- return arr.reduce((pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur);
1272
- };
1273
- const applyMagnetic = () => {
1274
- if (props.magnetic === "x") if (magneticSide.value === "left") state.value.x = boundary.value.left;
1275
- else if (magneticSide.value === "right") state.value.x = boundary.value.right;
1276
- else {
1277
- const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
1278
- state.value.x = nextX;
1279
- magneticSide.value = nextX === boundary.value.left ? "left" : "right";
1280
- }
1281
- if (props.magnetic === "y") {
1282
- const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
1283
- state.value.y = nextY;
1284
- }
1285
- };
1286
- const dragging = ref(false);
1287
- const initialized = ref(false);
1288
- const magneticSide = ref(null);
1289
- const rootStyle = computed(() => {
1290
- const style = {};
1291
- style.transform = `translate3d(${`${state.value.x}px`}, ${`${state.value.y}px`}, 0)`;
1292
- if (dragging.value || !initialized.value) style.transition = "none";
1293
- else style.transition = "transform 0.3s ease";
1294
- return style;
1295
- });
1296
- const updateState = () => {
1297
- if (!rootRef.value || typeof window === "undefined") return;
1298
- const rect = rootRef.value.getBoundingClientRect();
1299
- const { offset } = props;
1300
- let x = offset ? offset.x : windowWidth.value - rect.width - gapX.value;
1301
- let y = offset ? offset.y : windowHeight.value - rect.height - gapY.value;
1302
- const maxX = windowWidth.value - rect.width - gapX.value;
1303
- const maxY = windowHeight.value - rect.height - gapY.value;
1304
- if (x < gapX.value) x = gapX.value;
1305
- if (x > maxX) x = maxX;
1306
- if (y < gapY.value) y = gapY.value;
1307
- if (y > maxY) y = maxY;
1308
- const oldX = state.value.x;
1309
- const oldY = state.value.y;
1310
- state.value = {
1311
- x,
1312
- y,
1313
- width: rect.width,
1314
- height: rect.height
1315
- };
1316
- if (!dragging.value) {
1317
- if (props.magnetic === "x" && magneticSide.value) if (magneticSide.value === "left") state.value.x = boundary.value.left;
1318
- else state.value.x = boundary.value.right;
1319
- else applyMagnetic();
1320
- if (state.value.x !== oldX || state.value.y !== oldY) {
1321
- const offset2 = {
1322
- x: state.value.x,
1323
- y: state.value.y
1324
- };
1325
- emit("update:offset", offset2);
1326
- emit("offset-change", offset2);
1327
- }
1328
- }
1329
- };
1330
- const touch = {
1331
- startX: ref(0),
1332
- startY: ref(0),
1333
- deltaX: ref(0),
1334
- deltaY: ref(0),
1335
- offsetX: ref(0),
1336
- offsetY: ref(0),
1337
- isTap: ref(true),
1338
- start(e) {
1339
- this.startX.value = "touches" in e ? e.touches[0].clientX : e.clientX;
1340
- this.startY.value = "touches" in e ? e.touches[0].clientY : e.clientY;
1341
- this.deltaX.value = 0;
1342
- this.deltaY.value = 0;
1343
- this.offsetX.value = 0;
1344
- this.offsetY.value = 0;
1345
- this.isTap.value = true;
1346
- },
1347
- move(e) {
1348
- const clientX = "touches" in e ? e.touches[0].clientX : e.clientX;
1349
- const clientY = "touches" in e ? e.touches[0].clientY : e.clientY;
1350
- this.deltaX.value = clientX - this.startX.value;
1351
- this.deltaY.value = clientY - this.startY.value;
1352
- this.offsetX.value = Math.abs(this.deltaX.value);
1353
- this.offsetY.value = Math.abs(this.deltaY.value);
1354
- const TAP_OFFSET = 5;
1355
- if (this.isTap.value && (this.offsetX.value > TAP_OFFSET || this.offsetY.value > TAP_OFFSET)) this.isTap.value = false;
1356
- }
1357
- };
1358
- let prevX = 0;
1359
- let prevY = 0;
1360
- const onTouchStart = (e) => {
1361
- touch.start(e);
1362
- dragging.value = true;
1363
- prevX = state.value.x;
1364
- prevY = state.value.y;
1365
- document.body.classList.add("floating-bubble-dragging");
1366
- if (!("touches" in e)) {
1367
- window.addEventListener("mousemove", onTouchMove, { passive: false });
1368
- window.addEventListener("mouseup", onTouchEnd);
1369
- }
1370
- };
1371
- const onTouchMove = (e) => {
1372
- if (e.cancelable) e.preventDefault();
1373
- const wasTap = touch.isTap.value;
1374
- touch.move(e);
1375
- if (wasTap && !touch.isTap.value) emit("drag-start");
1376
- if (props.axis === "lock") return;
1377
- if (!touch.isTap.value) {
1378
- if (props.axis === "x" || props.axis === "xy") {
1379
- let nextX = prevX + touch.deltaX.value;
1380
- if (nextX < boundary.value.left) nextX = boundary.value.left;
1381
- if (nextX > boundary.value.right) nextX = boundary.value.right;
1382
- state.value.x = nextX;
1383
- }
1384
- if (props.axis === "y" || props.axis === "xy") {
1385
- let nextY = prevY + touch.deltaY.value;
1386
- if (nextY < boundary.value.top) nextY = boundary.value.top;
1387
- if (nextY > boundary.value.bottom) nextY = boundary.value.bottom;
1388
- state.value.y = nextY;
1389
- }
1390
- const offset = {
1391
- x: state.value.x,
1392
- y: state.value.y
1393
- };
1394
- emit("update:offset", offset);
1395
- }
1396
- };
1397
- const onTouchEnd = (e) => {
1398
- dragging.value = false;
1399
- document.body.classList.remove("floating-bubble-dragging");
1400
- if (e && !("touches" in e) && e.type === "mouseup") {
1401
- window.removeEventListener("mousemove", onTouchMove);
1402
- window.removeEventListener("mouseup", onTouchEnd);
1403
- }
1404
- requestAnimationFrame(() => {
1405
- if (props.magnetic === "x" && !touch.isTap.value) {
1406
- const centerX = state.value.x + state.value.width / 2;
1407
- const windowCenterX = windowWidth.value / 2;
1408
- magneticSide.value = centerX < windowCenterX ? "left" : "right";
1409
- }
1410
- applyMagnetic();
1411
- if (!touch.isTap.value) {
1412
- emit("drag-end");
1413
- const offset = {
1414
- x: state.value.x,
1415
- y: state.value.y
1416
- };
1417
- emit("update:offset", offset);
1418
- if (prevX !== offset.x || prevY !== offset.y) emit("offset-change", offset);
1419
- }
1420
- });
1421
- };
1422
- const onClick = (e) => {
1423
- if (touch.isTap.value) emit("click", e);
1424
- else e.stopPropagation();
1425
- };
1426
- const handleResize = () => {
1427
- if (typeof window !== "undefined") {
1428
- windowWidth.value = window.innerWidth;
1429
- windowHeight.value = window.innerHeight;
1430
- }
1431
- };
1432
- onMounted(() => {
1433
- updateState();
1434
- requestAnimationFrame(() => {
1435
- initialized.value = true;
1436
- });
1437
- if (typeof window !== "undefined") window.addEventListener("resize", handleResize);
1438
- if (rootRef.value) rootRef.value.addEventListener("touchmove", onTouchMove, { passive: false });
1439
- });
1440
- onUnmounted(() => {
1441
- document.body.classList.remove("floating-bubble-dragging");
1442
- if (typeof window !== "undefined") {
1443
- window.removeEventListener("resize", handleResize);
1444
- window.removeEventListener("mousemove", onTouchMove);
1445
- window.removeEventListener("mouseup", onTouchEnd);
1446
- }
1447
- if (rootRef.value) rootRef.value.removeEventListener("touchmove", onTouchMove);
1448
- });
1449
- watch([
1450
- windowWidth,
1451
- windowHeight,
1452
- gapX,
1453
- gapY
1454
- ], updateState);
1455
- watch(() => props.offset, (newOffset) => {
1456
- if (newOffset) magneticSide.value = null;
1457
- updateState();
1458
- }, { deep: true });
1459
- __expose({ offset: computed(() => ({
1460
- x: state.value.x,
1461
- y: state.value.y
1462
- })) });
1463
- const __returned__ = {
1464
- props,
1465
- emit,
1466
- rootRef,
1467
- state,
1468
- isObject,
1469
- gapX,
1470
- gapY,
1471
- windowWidth,
1472
- windowHeight,
1473
- boundary,
1474
- closest,
1475
- applyMagnetic,
1476
- dragging,
1477
- initialized,
1478
- magneticSide,
1479
- rootStyle,
1480
- updateState,
1481
- touch,
1482
- get prevX() {
1483
- return prevX;
1484
- },
1485
- set prevX(v) {
1486
- prevX = v;
1487
- },
1488
- get prevY() {
1489
- return prevY;
1490
- },
1491
- set prevY(v) {
1492
- prevY = v;
1493
- },
1494
- onTouchStart,
1495
- onTouchMove,
1496
- onTouchEnd,
1497
- onClick,
1498
- handleResize
1499
- };
1500
- Object.defineProperty(__returned__, "__isScriptSetup", {
1501
- enumerable: false,
1502
- value: true
1503
- });
1504
- return __returned__;
1505
- }
1506
- }));
1507
- function __vue_render__$2(_ctx, _cache, $props, $setup, $data, $options) {
1508
- return openBlock(), createBlock(Teleport, { to: $props.teleport }, [createElementVNode("div", {
1509
- ref: "rootRef",
1510
- class: "floating-bubble",
1511
- style: normalizeStyle($setup.rootStyle),
1512
- onTouchstartPassive: $setup.onTouchStart,
1513
- onTouchend: $setup.onTouchEnd,
1514
- onTouchcancel: $setup.onTouchEnd,
1515
- onMousedown: $setup.onTouchStart,
1516
- onClickCapture: $setup.onClick
1517
- }, [renderSlot(_ctx.$slots, "default")], 36)], 8, ["to"]);
1518
- }
1519
- __vue_sfc__$2.render = __vue_render__$2;
1520
- var FloatingBubble_vue_default = __vue_sfc__$2;
1521
- //#endregion
1522
- //#region es/open-code-widget/src/components/Trigger.vue.mjs
1523
- var __vue_sfc__$1 = /* @__PURE__ */ defineComponent({
1524
- __name: "Trigger",
1525
- emits: ["drag-start", "drag-end"],
1526
- setup(__props, { expose: __expose, emit: __emit }) {
1527
- const { buttonActive: active, open, hotkeyLabel, thinking, resolvedTheme, handleToggle, bubbleOffset, handleBubbleOffsetChange } = useOpenCodeWidgetContext();
1528
- const offset = ref(bubbleOffset.value);
1529
- const emit = __emit;
1530
- const handleOffsetChange = (value) => {
1531
- offset.value = value;
1532
- handleBubbleOffsetChange(value);
1533
- };
1534
- watch(bubbleOffset, (newOffset) => {
1535
- offset.value = newOffset;
1536
- });
1537
- __expose({ offset });
1538
- const __returned__ = {
1539
- active,
1540
- open,
1541
- hotkeyLabel,
1542
- thinking,
1543
- resolvedTheme,
1544
- handleToggle,
1545
- bubbleOffset,
1546
- handleBubbleOffsetChange,
1547
- offset,
1548
- emit,
1549
- handleOffsetChange,
1550
- FloatingBubble: FloatingBubble_vue_default
1551
- };
1552
- Object.defineProperty(__returned__, "__isScriptSetup", {
1553
- enumerable: false,
1554
- value: true
1555
- });
1556
- return __returned__;
1557
- }
1558
- });
1559
- var _hoisted_1$1 = ["aria-expanded", "title"];
1560
- function __vue_render__$1(_ctx, _cache, $props, $setup, $data, $options) {
1561
- return openBlock(), createBlock($setup["FloatingBubble"], {
1562
- ref: "bubbleRef",
1563
- offset: $setup.offset,
1564
- "onUpdate:offset": _cache[0] || (_cache[0] = ($event) => $setup.offset = $event),
1565
- axis: "xy",
1566
- magnetic: "x",
1567
- gap: 24,
1568
- onClick: $setup.handleToggle,
1569
- onOffsetChange: $setup.handleOffsetChange,
1570
- onDragStart: _cache[1] || (_cache[1] = ($event) => $setup.emit("drag-start")),
1571
- onDragEnd: _cache[2] || (_cache[2] = ($event) => $setup.emit("drag-end"))
1572
- }, {
1573
- default: withCtx(() => [createElementVNode("button", {
1574
- class: normalizeClass(["opencode-button", {
1575
- active: $setup.active,
1576
- thinking: $setup.thinking,
1577
- "opencode-theme-dark": $setup.resolvedTheme === "dark"
1578
- }]),
1579
- type: "button",
1580
- "aria-expanded": $setup.open,
1581
- "aria-label": "打开 AI 助手",
1582
- title: `AI \u52A9\u624B (${$setup.hotkeyLabel})`
1583
- }, [renderSlot(_ctx.$slots, "default", {}, () => [_cache[3] || (_cache[3] = createElementVNode("svg", {
1584
- t: "1775402599580",
1585
- class: "icon",
1586
- viewBox: "0 0 1024 1024",
1587
- version: "1.1",
1588
- xmlns: "http://www.w3.org/2000/svg",
1589
- "p-id": "5390",
1590
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
1591
- width: "100%",
1592
- height: "100%"
1593
- }, [
1594
- createElementVNode("defs", null, [createElementVNode("linearGradient", {
1595
- id: "opencode-logo-gradient",
1596
- x1: "0%",
1597
- y1: "0%",
1598
- x2: "100%",
1599
- y2: "100%"
1600
- }, [createElementVNode("stop", {
1601
- offset: "0%",
1602
- style: { "stop-color": "#667eea" }
1603
- }), createElementVNode("stop", {
1604
- offset: "100%",
1605
- style: { "stop-color": "#764ba2" }
1606
- })])]),
1607
- createElementVNode("path", {
1608
- d: "M512 981.33H85.34c-15.85 0-30.38-8.77-37.77-22.81a42.624 42.624 0 0 1 2.6-44.02L135 791.08C75.25 710.5 42.67 612.6 42.67 512 42.67 253.21 253.21 42.67 512 42.67S981.34 253.21 981.34 512 770.8 981.33 512 981.33zM166.44 896H512c211.73 0 384-172.27 384-384S723.73 128 512 128 128 300.27 128 512c0 91.29 32.83 179.9 92.46 249.46 12.58 14.69 13.73 36 2.77 51.94L166.44 896z",
1609
- fill: "url(#opencode-logo-gradient)",
1610
- "p-id": "5391"
1611
- }),
1612
- createElementVNode("path", {
1613
- d: "M384 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
1614
- fill: "url(#opencode-logo-gradient)",
1615
- "p-id": "5392"
1616
- }),
1617
- createElementVNode("path", {
1618
- d: "M640 448m-64 0a64 64 0 1 0 128 0 64 64 0 1 0 -128 0Z",
1619
- fill: "url(#opencode-logo-gradient)",
1620
- "p-id": "5393"
1621
- })
1622
- ], -1))])], 10, _hoisted_1$1)]),
1623
- _: 3
1624
- }, 8, ["offset", "onClick"]);
1625
- }
1626
- __vue_sfc__$1.render = __vue_render__$1;
1627
- var Trigger_vue_default = __vue_sfc__$1;
1628
- //#endregion
1629
- //#region es/open-code-widget/composables/use-selection.mjs
1630
- var __async$1 = (__this, __arguments, generator) => {
1631
- return new Promise((resolve, reject) => {
1632
- var fulfilled = (value) => {
1633
- try {
1634
- step(generator.next(value));
1635
- } catch (e) {
1636
- reject(e);
1637
- }
1638
- };
1639
- var rejected = (value) => {
1640
- try {
1641
- step(generator.throw(value));
1642
- } catch (e) {
1643
- reject(e);
1644
- }
1645
- };
1646
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1647
- step((generator = generator.apply(__this, __arguments)).next());
1648
- });
1649
- };
1650
- function getElementKey(element, index) {
1651
- var _a;
1652
- if (element.filePath && element.line) return `${element.filePath}:${element.line}:${(_a = element.column) != null ? _a : 0}`;
1653
- return `${element.description}-${index}`;
1654
- }
1655
- function getBubbleFileText(element) {
1656
- var _a;
1657
- return `${((_a = element.filePath) == null ? void 0 : _a.split("/").pop()) || ""}${element.line ? `:${element.line}${element.column ? `:${element.column}` : ""}` : ""}`;
1658
- }
1659
- function getPanelFileText(element) {
1660
- var _a, _b;
1661
- const fileName = ((_a = element.filePath) == null ? void 0 : _a.split("/").pop()) || "未知文件";
1662
- const lineInfo = element.line ? `:${element.line}${element.column ? `:${element.column}` : ""}` : "";
1663
- return `${((_b = element.innerText) == null ? void 0 : _b.trim()) ? `${truncate(element.innerText.trim(), 30)} \xB7 ` : ""}${fileName}${lineInfo}`;
1664
- }
1665
- function useSelection(options) {
1666
- const bubbleVisible = computed(() => options.selectMode.value);
1667
- const selectedElementItems = computed(() => (options.selectedElements.value || []).map((element, index) => ({
1668
- key: getElementKey(element, index),
1669
- description: element.description || "未知元素",
1670
- bubbleFileText: getBubbleFileText(element),
1671
- panelFileText: getPanelFileText(element),
1672
- element
1673
- })));
1674
- const hasSelectedElements = computed(() => selectedElementItems.value.length > 0);
1675
- function handleToggleSelectMode() {
1676
- options.onToggleSelectMode(!options.selectMode.value);
1677
- }
1678
- function handleClickSelectedNode(item) {
1679
- const description = item.element.description;
1680
- if (!description) return;
1681
- let targetElement = null;
1682
- if (description.includes("#")) {
1683
- const idMatch = description.match(/#([^.[\s]+)/);
1684
- if (idMatch) targetElement = document.getElementById(idMatch[1]);
1685
- }
1686
- if (!targetElement && description.includes(".")) {
1687
- const classMatch = description.match(/^([a-z]+)\.([^[\s]+)/i);
1688
- if (classMatch) {
1689
- const selector = `${classMatch[1]}.${classMatch[2].split(".").filter(Boolean).join(".")}`;
1690
- targetElement = document.querySelector(selector);
1691
- }
1692
- }
1693
- if (!targetElement) {
1694
- if (description.match(/^([a-z]+)/i)) {
1695
- const simpleSelector = description.split(/[.[\s]/)[0];
1696
- targetElement = document.querySelector(simpleSelector);
1697
- }
1698
- }
1699
- if (targetElement) {
1700
- targetElement.scrollIntoView({
1701
- behavior: "smooth",
1702
- block: "center"
1703
- });
1704
- const highlightOverlay = document.createElement("div");
1705
- highlightOverlay.className = "opencode-element-highlight-temp";
1706
- const widget = document.querySelector(".opencode-widget");
1707
- let primary = "#3b82f6";
1708
- let primaryBg = "rgba(59, 130, 246, 0.1)";
1709
- if (widget) {
1710
- const style = getComputedStyle(widget);
1711
- primary = style.getPropertyValue("--oc-primary").trim() || primary;
1712
- primaryBg = style.getPropertyValue("--oc-primary-bg").trim() || primaryBg;
1713
- }
1714
- highlightOverlay.style.border = `2px solid ${primary}`;
1715
- highlightOverlay.style.background = primaryBg;
1716
- const rect = targetElement.getBoundingClientRect();
1717
- highlightOverlay.style.top = `${rect.top + window.scrollY}px`;
1718
- highlightOverlay.style.left = `${rect.left + window.scrollX}px`;
1719
- highlightOverlay.style.width = `${rect.width}px`;
1720
- highlightOverlay.style.height = `${rect.height}px`;
1721
- document.body.appendChild(highlightOverlay);
1722
- setTimeout(() => {
1723
- highlightOverlay.remove();
1724
- }, 2e3);
1725
- }
1726
- }
1727
- function handleRemoveSelectedNode(item, index, source) {
1728
- options.onRemoveSelectedNode({
1729
- element: item.element,
1730
- index,
1731
- source
1732
- });
1733
- }
1734
- function handleClearSelectedNodes() {
1735
- return __async$1(this, null, function* () {
1736
- if (!options.selectedElements.value || options.selectedElements.value.length === 0) return;
1737
- if (yield options.showConfirmDialog(`\u786E\u5B9A\u8981\u6E05\u7A7A\u6240\u6709 ${options.selectedElements.value.length} \u4E2A\u5DF2\u9009\u8282\u70B9\u5417\uFF1F`)) options.onClearSelectedNodes();
1738
- });
1739
- }
1740
- return {
1741
- bubbleVisible,
1742
- hasSelectedElements,
1743
- selectedElementItems,
1744
- handleClearSelectedNodes,
1745
- handleClickSelectedNode,
1746
- handleRemoveSelectedNode,
1747
- handleToggleSelectMode
1748
- };
1749
- }
1750
- //#endregion
1751
- //#region es/open-code-widget/composables/use-session.mjs
1752
- var __async = (__this, __arguments, generator) => {
1753
- return new Promise((resolve, reject) => {
1754
- var fulfilled = (value) => {
1755
- try {
1756
- step(generator.next(value));
1757
- } catch (e) {
1758
- reject(e);
1759
- }
1760
- };
1761
- var rejected = (value) => {
1762
- try {
1763
- step(generator.throw(value));
1764
- } catch (e) {
1765
- reject(e);
1766
- }
1767
- };
1768
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
1769
- step((generator = generator.apply(__this, __arguments)).next());
1770
- });
1771
- };
1772
- function formatSessionMeta(session) {
1773
- if (session.meta) return session.meta;
1774
- if (!session.updatedAt) return "";
1775
- const date = new Date(session.updatedAt);
1776
- if (Number.isNaN(date.getTime())) return "";
1777
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
1778
- }
1779
- function useSession(options) {
1780
- const sessionItems = computed(() => (options.sessions.value || []).map((session) => ({
1781
- key: session.id,
1782
- id: session.id,
1783
- title: session.title || "新会话",
1784
- meta: formatSessionMeta(session),
1785
- active: session.id === options.currentSessionId.value,
1786
- session
1787
- })));
1788
- function handleCreateSession() {
1789
- options.onCreateSession();
1790
- }
1791
- function handleSelectSession(item) {
1792
- options.onSelectSession(item.session);
1793
- }
1794
- function handleDeleteSession(item) {
1795
- return __async(this, null, function* () {
1796
- if (yield options.showConfirmDialog(`\u786E\u5B9A\u8981\u5220\u9664\u4F1A\u8BDD "${item.title}" \u5417\uFF1F`)) options.onDeleteSession(item.session);
1797
- });
1798
- }
1799
- return {
1800
- sessionItems,
1801
- handleCreateSession,
1802
- handleDeleteSession,
1803
- handleSelectSession
1804
- };
1805
- }
1806
- //#endregion
1807
- //#region es/open-code-widget/composables/use-widget.mjs
1808
- var THEME_CYCLE = [
1809
- "auto",
1810
- "light",
1811
- "dark"
1812
- ];
1813
- function useWidget(options) {
1814
- const systemTheme = ref("light");
1815
- function getSystemTheme() {
1816
- if (typeof window === "undefined") return "light";
1817
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1818
- }
1819
- let mediaQuery = null;
1820
- let handleChange = null;
1821
- onMounted(() => {
1822
- if (typeof window === "undefined") return;
1823
- systemTheme.value = getSystemTheme();
1824
- mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1825
- handleChange = (e) => {
1826
- systemTheme.value = e.matches ? "dark" : "light";
1827
- };
1828
- mediaQuery.addEventListener("change", handleChange);
1829
- });
1830
- onUnmounted(() => {
1831
- if (mediaQuery && handleChange) mediaQuery.removeEventListener("change", handleChange);
1832
- });
1833
- const resolvedTheme = computed(() => {
1834
- if (options.theme.value === "auto") return systemTheme.value;
1835
- return options.theme.value;
1836
- });
1837
- const containerClasses = computed(() => ["opencode-widget", `opencode-theme-${resolvedTheme.value}`]);
1838
- const buttonActive = computed(() => !!(options.open.value || options.selectMode.value));
1839
- const iframeSource = computed(() => options.iframeSrc.value || "about:blank");
1840
- const sessionListTitle = computed(() => options.sessionListCollapsed.value ? "展开会话列表" : "折叠会话列表");
1841
- function handleToggle() {
1842
- var _a;
1843
- if (options.selectMode.value) {
1844
- (_a = options.onToggleSelectMode) == null || _a.call(options, false);
1845
- return;
1846
- }
1847
- const nextOpen = !options.open.value;
1848
- options.onToggle(nextOpen);
1849
- }
1850
- function handleClose() {
1851
- options.onClose();
1852
- }
1853
- function handleToggleSessionList() {
1854
- options.onToggleSessionList(!options.sessionListCollapsed.value);
1855
- }
1856
- function handleEmptyAction() {
1857
- options.onEmptyAction();
1858
- }
1859
- function handleToggleTheme() {
1860
- var _a;
1861
- const nextTheme = THEME_CYCLE[(THEME_CYCLE.indexOf(options.theme.value) + 1) % THEME_CYCLE.length];
1862
- (_a = options.onToggleTheme) == null || _a.call(options, nextTheme);
1863
- }
1864
- return {
1865
- buttonActive,
1866
- containerClasses,
1867
- iframeSource,
1868
- sessionListTitle,
1869
- resolvedTheme,
1870
- handleClose,
1871
- handleEmptyAction,
1872
- handleToggle,
1873
- handleToggleSessionList,
1874
- handleToggleTheme
1875
- };
1876
- }
1877
- //#endregion
1878
- //#region es/open-code-widget/composables/use-inspector.mjs
1879
- var IGNORE_SELECTORS = [
1880
- "#vue-inspector-container",
1881
- ".opencode-widget",
1882
- ".opencode-element-highlight",
1883
- ".opencode-element-tooltip",
1884
- ".opencode-select-mode-hint",
1885
- ".floating-bubble"
1886
- ];
1887
- var IGNORE_ATTRIBUTE = "data-v-inspector-ignore";
1888
- var KEY_PROPS_DATA = "__v_inspector";
1889
- var KEY_DATA = "data-v-inspector";
1890
- function getDirectText(element) {
1891
- let text = "";
1892
- for (let i = 0; i < element.childNodes.length; i++) {
1893
- const child = element.childNodes[i];
1894
- if (child.nodeType === Node.TEXT_NODE) text += child.textContent || "";
1895
- }
1896
- return text.trim();
1897
- }
1898
- var DYNAMIC_ID_PATTERN = /^(?:el-|:r[0-9]+:|radix-|uid-|ts-|uuid-|id-[a-f0-9]{4,}|.*[0-9]{4,}.*|.*-[a-f0-9]{6,}$)/i;
1899
- var STATE_CLASS_PATTERN = /^(?:hover|active|focus|focus-visible|focus-within|disabled|enabled|checked|selected|open|closed|loading|error|success|warning|hidden|visible|show|hide|current|expanded|collapsed|pressed|dragging|droppable|sortable|placeholder|transition|enter|leave|appear|move)$/i;
1900
- var STATE_CLASS_PREFIX_PATTERN = /^(?:is-|has-|was-|are-|can-|should-|will-|did-|does-|on-|off-|in-|out-|at-|to-|from-)/i;
1901
- function isDynamicId(id) {
1902
- if (!id) return false;
1903
- if (DYNAMIC_ID_PATTERN.test(id)) return true;
1904
- const digitCount = (id.match(/\d/g) || []).length;
1905
- if (digitCount > (id.match(/[a-zA-Z]/g) || []).length && digitCount >= 3) return true;
1906
- const dashParts = id.split("-");
1907
- if (dashParts.length >= 3) {
1908
- const lastPart = dashParts[dashParts.length - 1];
1909
- if (/^\d+$/.test(lastPart) || /^[a-f0-9]{4,}$/i.test(lastPart)) return true;
1910
- }
1911
- return false;
1912
- }
1913
- function isStateClass(className) {
1914
- if (!className) return false;
1915
- if (STATE_CLASS_PATTERN.test(className)) return true;
1916
- if (STATE_CLASS_PREFIX_PATTERN.test(className)) return true;
1917
- if (className.includes("-active") || className.includes("-hover") || className.includes("-focus")) return true;
1918
- if (/^(?:router-link|nuxt-link)/.test(className)) return true;
1919
- return false;
1920
- }
1921
- function getElementDescription(element) {
1922
- return getCssSelector(element, {
1923
- selectors: [
1924
- "id",
1925
- "class",
1926
- "tag",
1927
- "nthchild"
1928
- ],
1929
- combineWithinSelector: true,
1930
- combineBetweenSelectors: true,
1931
- maxCombinations: 100,
1932
- maxCandidates: 100,
1933
- blacklist: [(selectorValue) => {
1934
- const idMatch = selectorValue.match(/^#(.+)$/);
1935
- if (idMatch) return isDynamicId(idMatch[1]);
1936
- const classMatch = selectorValue.match(/^\.([a-zA-Z_-][\w-]*)$/);
1937
- if (classMatch) return isStateClass(classMatch[1]);
1938
- return false;
1939
- }]
1940
- });
1941
- }
1942
- function getFileInfoFromVueInstance(element) {
1943
- var _a, _b, _c, _d;
1944
- const vue3Instance = element.__vueParentComponent;
1945
- if (vue3Instance) {
1946
- let current = vue3Instance;
1947
- while (current) {
1948
- const file = ((_a = current.type) == null ? void 0 : _a.__file) || ((_c = (_b = current.vnode) == null ? void 0 : _b.type) == null ? void 0 : _c.__file);
1949
- if (file) return {
1950
- file,
1951
- line: null,
1952
- column: null
1953
- };
1954
- current = current.parent;
1955
- }
1956
- }
1957
- const vue2Instance = element.__vue__;
1958
- if (vue2Instance) {
1959
- let current = vue2Instance;
1960
- while (current) {
1961
- const file = (_d = current.$options) == null ? void 0 : _d.__file;
1962
- if (file) return {
1963
- file,
1964
- line: null,
1965
- column: null
1966
- };
1967
- current = current.$parent;
1968
- }
1969
- }
1970
- return null;
1971
- }
1972
- function shouldIgnoreElement(el) {
1973
- if (el.hasAttribute(IGNORE_ATTRIBUTE)) return true;
1974
- for (const selector of IGNORE_SELECTORS) if (el.closest(selector)) return true;
1975
- return false;
1976
- }
1977
- function getDataFromElement(el) {
1978
- var _a, _b, _c, _d, _e, _f, _g;
1979
- const vnodeData = (_b = (_a = el.__vnode) == null ? void 0 : _a.props) == null ? void 0 : _b[KEY_PROPS_DATA];
1980
- if (vnodeData) return vnodeData;
1981
- const ctxVNode = (_d = (_c = el.__vnode) == null ? void 0 : _c.ctx) == null ? void 0 : _d.vnode;
1982
- if ((ctxVNode == null ? void 0 : ctxVNode.el) === el) {
1983
- const ctxData = (_e = ctxVNode.props) == null ? void 0 : _e[KEY_PROPS_DATA];
1984
- if (ctxData) return ctxData;
1985
- }
1986
- const vueInstance = el.__vueParentComponent;
1987
- let currentParent = vueInstance == null ? void 0 : vueInstance.parent;
1988
- while (currentParent) {
1989
- if (((_f = currentParent.vnode) == null ? void 0 : _f.el) === el) {
1990
- const parentData = (_g = currentParent.vnode.props) == null ? void 0 : _g[KEY_PROPS_DATA];
1991
- if (parentData) return parentData;
1992
- }
1993
- currentParent = currentParent.parent;
1994
- }
1995
- const attr = el.getAttribute(KEY_DATA);
1996
- return attr != null ? attr : void 0;
1997
- }
1998
- function findInspectorFileInfo(element) {
1999
- let current = element;
2000
- while (current) {
2001
- if (shouldIgnoreElement(current)) {
2002
- current = current.parentElement;
2003
- continue;
2004
- }
2005
- const data = getDataFromElement(current);
2006
- if (data) {
2007
- const match = data.match(/(.+):([\d]+):([\d]+)$/);
2008
- if (match) return {
2009
- file: match[1],
2010
- line: parseInt(match[2], 10),
2011
- column: parseInt(match[3], 10)
2012
- };
2013
- }
2014
- current = current.parentElement;
2015
- }
2016
- return null;
2017
- }
2018
- function mergeFileInfo(inspectorFileInfo, vueFileInfo) {
2019
- if (!(inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && !(vueFileInfo == null ? void 0 : vueFileInfo.file)) return {
2020
- file: null,
2021
- line: null,
2022
- column: null
2023
- };
2024
- const isNodeModules = (path) => path.includes("node_modules");
2025
- if ((inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) && (vueFileInfo == null ? void 0 : vueFileInfo.file)) if (!isNodeModules(inspectorFileInfo.file)) return inspectorFileInfo;
2026
- else if (!isNodeModules(vueFileInfo.file)) return vueFileInfo;
2027
- else return inspectorFileInfo;
2028
- else if (inspectorFileInfo == null ? void 0 : inspectorFileInfo.file) return inspectorFileInfo;
2029
- else return vueFileInfo;
2030
- }
2031
- function getTargetElement(e) {
2032
- if (!e.target || !(e.target instanceof Element)) return null;
2033
- const el = e.target;
2034
- if (shouldIgnoreElement(el)) return null;
2035
- return el;
2036
- }
2037
- function getFileInfo(e, element) {
2038
- let inspectorFileInfo = null;
2039
- if (element) inspectorFileInfo = findInspectorFileInfo(element);
2040
- const vueFileInfo = element ? getFileInfoFromVueInstance(element) : null;
2041
- return mergeFileInfo(inspectorFileInfo, vueFileInfo);
2042
- }
2043
- function useInspector(options) {
2044
- const highlightVisible = ref(false);
2045
- const highlightStyle = ref({
2046
- top: "0px",
2047
- left: "0px",
2048
- width: "0px",
2049
- height: "0px"
2050
- });
2051
- const tooltipVisible = ref(false);
2052
- const tooltipStyle = ref({
2053
- top: "0px",
2054
- left: "0px"
2055
- });
2056
- const tooltipContent = ref({
2057
- description: "",
2058
- fileInfo: ""
2059
- });
2060
- const INSPECTOR_CHECK_INTERVAL = 500;
2061
- let inspectorCheckTimer = null;
2062
- let currentPrimary = "#3b82f6";
2063
- let currentPrimaryBg = "rgba(59, 130, 246, 0.1)";
2064
- function setPointerEventsNone(elements) {
2065
- elements.forEach((el) => {
2066
- if (el) el.style.pointerEvents = "none";
2067
- });
2068
- }
2069
- function setPointerEventsAuto(elements) {
2070
- elements.forEach((el) => {
2071
- if (el) el.style.pointerEvents = "";
2072
- });
2073
- }
2074
- function handleMouseMoveCore(e) {
2075
- if (!options.selectMode.value) return;
2076
- const uiElements = [
2077
- document.querySelector(".opencode-element-highlight"),
2078
- document.querySelector(".opencode-element-tooltip"),
2079
- document.querySelector(".opencode-select-mode-hint"),
2080
- document.querySelector(".floating-bubble")
2081
- ];
2082
- setPointerEventsNone(uiElements);
2083
- const elementToHighlight = getTargetElement(e);
2084
- const fileInfo = getFileInfo(e, elementToHighlight);
2085
- setPointerEventsAuto(uiElements);
2086
- if (elementToHighlight) {
2087
- const widget = document.querySelector(".opencode-widget");
2088
- if (widget) {
2089
- const style = getComputedStyle(widget);
2090
- currentPrimary = style.getPropertyValue("--oc-primary").trim() || currentPrimary;
2091
- currentPrimaryBg = style.getPropertyValue("--oc-primary-bg").trim() || currentPrimaryBg;
2092
- }
2093
- const description = getElementDescription(elementToHighlight);
2094
- const fileName = fileInfo.file ? fileInfo.file.split("/").pop() : "";
2095
- let lineInfo = "";
2096
- if (fileInfo.line) {
2097
- lineInfo = `:${fileInfo.line}`;
2098
- if (fileInfo.column) lineInfo += `:${fileInfo.column}`;
2099
- }
2100
- const fileInfoText = fileName ? `${fileName}${lineInfo}` : "";
2101
- tooltipContent.value = {
2102
- description,
2103
- fileInfo: fileInfoText
2104
- };
2105
- const rect = elementToHighlight.getBoundingClientRect();
2106
- const newTop = `${rect.top}px`;
2107
- const newLeft = `${rect.left}px`;
2108
- const newWidth = `${rect.width}px`;
2109
- const newHeight = `${rect.height}px`;
2110
- if (highlightStyle.value.top !== newTop || highlightStyle.value.left !== newLeft || highlightStyle.value.width !== newWidth || highlightStyle.value.height !== newHeight) highlightStyle.value = {
2111
- top: newTop,
2112
- left: newLeft,
2113
- width: newWidth,
2114
- height: newHeight,
2115
- border: `2px solid ${currentPrimary}`,
2116
- background: currentPrimaryBg
2117
- };
2118
- highlightVisible.value = true;
2119
- tooltipVisible.value = true;
2120
- nextTick(() => {
2121
- const tooltipEl = document.querySelector(".opencode-element-tooltip");
2122
- if (!tooltipEl) return;
2123
- const tooltipWidth = tooltipEl.offsetWidth;
2124
- const tooltipHeight = tooltipEl.offsetHeight;
2125
- if (tooltipWidth === 0 || tooltipHeight === 0) return;
2126
- const margin = 10;
2127
- const gap = 4;
2128
- const viewportWidth = window.innerWidth;
2129
- const viewportHeight = window.innerHeight;
2130
- const clampLeft = (left) => Math.max(margin, Math.min(left, viewportWidth - tooltipWidth - margin));
2131
- const clampTop = (top) => Math.max(margin, Math.min(top, viewportHeight - tooltipHeight - margin));
2132
- const candidateTop = rect.top - tooltipHeight - gap;
2133
- const candidateBottom = rect.bottom + gap;
2134
- const candidateRight = rect.right + gap;
2135
- const candidateLeft = rect.left - tooltipWidth - gap;
2136
- const verticalCenter = rect.top + (rect.height - tooltipHeight) / 2;
2137
- let tooltipTop = 0;
2138
- let tooltipLeft = 0;
2139
- let placed = false;
2140
- if (candidateTop >= margin) {
2141
- tooltipTop = candidateTop;
2142
- tooltipLeft = clampLeft(rect.left);
2143
- placed = true;
2144
- }
2145
- if (!placed && candidateBottom + tooltipHeight <= viewportHeight - margin) {
2146
- tooltipTop = candidateBottom;
2147
- tooltipLeft = clampLeft(rect.left);
2148
- placed = true;
2149
- }
2150
- if (!placed && candidateRight + tooltipWidth <= viewportWidth - margin) {
2151
- tooltipLeft = candidateRight;
2152
- tooltipTop = clampTop(verticalCenter);
2153
- placed = true;
2154
- }
2155
- if (!placed && candidateLeft >= margin) {
2156
- tooltipLeft = candidateLeft;
2157
- tooltipTop = clampTop(verticalCenter);
2158
- placed = true;
2159
- }
2160
- if (!placed) {
2161
- const corners = [
2162
- {
2163
- top: margin,
2164
- left: margin
2165
- },
2166
- {
2167
- top: margin,
2168
- left: viewportWidth - tooltipWidth - margin
2169
- },
2170
- {
2171
- top: viewportHeight - tooltipHeight - margin,
2172
- left: margin
2173
- },
2174
- {
2175
- top: viewportHeight - tooltipHeight - margin,
2176
- left: viewportWidth - tooltipWidth - margin
2177
- }
2178
- ];
2179
- for (const corner of corners) {
2180
- const tooltipRight = corner.left + tooltipWidth;
2181
- const tooltipBottom = corner.top + tooltipHeight;
2182
- if (tooltipRight <= rect.left || rect.right <= corner.left || tooltipBottom <= rect.top || rect.bottom <= corner.top) {
2183
- tooltipTop = corner.top;
2184
- tooltipLeft = corner.left;
2185
- placed = true;
2186
- break;
2187
- }
2188
- }
2189
- if (!placed) {
2190
- tooltipTop = margin;
2191
- tooltipLeft = margin;
2192
- }
2193
- }
2194
- const newTooltipTop = `${tooltipTop}px`;
2195
- const newTooltipLeft = `${tooltipLeft}px`;
2196
- if (tooltipStyle.value.top !== newTooltipTop || tooltipStyle.value.left !== newTooltipLeft) tooltipStyle.value = {
2197
- top: newTooltipTop,
2198
- left: newTooltipLeft
2199
- };
2200
- });
2201
- } else {
2202
- highlightVisible.value = false;
2203
- tooltipVisible.value = false;
2204
- }
2205
- }
2206
- const handleMouseMove = handleMouseMoveCore;
2207
- function setupInspectorHook() {
2208
- const inspector = window.__VUE_INSPECTOR__;
2209
- if (!inspector || inspector.__opencode_hooked) return;
2210
- const originalHandleClick = inspector.handleClick.bind(inspector);
2211
- inspector.handleClick = function(e) {
2212
- if (options.selectMode.value) {
2213
- const targetEl = e.target instanceof Element ? e.target : null;
2214
- if (targetEl && targetEl.closest(".opencode-widget")) return originalHandleClick.call(inspector, e);
2215
- e.preventDefault();
2216
- e.stopPropagation();
2217
- const elementToSelect = getTargetElement(e);
2218
- const fileInfo = getFileInfo(e, elementToSelect);
2219
- if (elementToSelect) {
2220
- const innerText = getDirectText(elementToSelect);
2221
- const description = getElementDescription(elementToSelect);
2222
- const elementInfo = {
2223
- filePath: fileInfo.file,
2224
- line: fileInfo.line,
2225
- column: fileInfo.column,
2226
- innerText: truncate(innerText, 200),
2227
- description
2228
- };
2229
- options.onAddSelectedNode(elementInfo);
2230
- }
2231
- return;
2232
- }
2233
- return originalHandleClick.call(inspector, e);
2234
- };
2235
- inspector.__opencode_hooked = true;
2236
- }
2237
- function handleKeydown(e) {
2238
- if (e.key === "Escape" && options.selectMode.value) {
2239
- e.preventDefault();
2240
- e.stopPropagation();
2241
- options.onExitSelectMode();
2242
- }
2243
- }
2244
- watch(options.selectMode, (newVal) => {
2245
- const inspector = window.__VUE_INSPECTOR__;
2246
- if (newVal) {
2247
- if (inspector) inspector.enable();
2248
- document.addEventListener("mousemove", handleMouseMove);
2249
- document.addEventListener("keydown", handleKeydown, true);
2250
- } else {
2251
- if (inspector) inspector.disable();
2252
- document.removeEventListener("mousemove", handleMouseMove);
2253
- document.removeEventListener("keydown", handleKeydown, true);
2254
- highlightVisible.value = false;
2255
- tooltipVisible.value = false;
2256
- }
2257
- });
2258
- onMounted(() => {
2259
- if (window.__VUE_INSPECTOR__) setupInspectorHook();
2260
- else inspectorCheckTimer = window.setInterval(() => {
2261
- if (window.__VUE_INSPECTOR__) {
2262
- setupInspectorHook();
2263
- if (inspectorCheckTimer) {
2264
- window.clearInterval(inspectorCheckTimer);
2265
- inspectorCheckTimer = null;
2266
- }
2267
- }
2268
- }, INSPECTOR_CHECK_INTERVAL);
2269
- });
2270
- onUnmounted(() => {
2271
- if (inspectorCheckTimer) window.clearInterval(inspectorCheckTimer);
2272
- document.removeEventListener("mousemove", handleMouseMove);
2273
- document.removeEventListener("keydown", handleKeydown, true);
2274
- });
2275
- return {
2276
- highlightVisible,
2277
- highlightStyle,
2278
- tooltipVisible,
2279
- tooltipStyle,
2280
- tooltipContent
2281
- };
2282
- }
2283
- //#endregion
2284
- //#region es/open-code-widget/composables/use-persist-state.mjs
2285
- var log = createLogger("OpenCodeWidget");
2286
- var STORAGE_KEY = "opencode-widget-state";
2287
- function loadState() {
2288
- if (typeof window === "undefined") return null;
2289
- try {
2290
- const stored = localStorage.getItem(STORAGE_KEY);
2291
- if (stored) return JSON.parse(stored);
2292
- } catch (e) {
2293
- log.error("Failed to load persisted state:", { error: e });
2294
- }
2295
- return null;
2296
- }
2297
- function saveState(state) {
2298
- if (typeof window === "undefined") return;
2299
- try {
2300
- localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
2301
- } catch (e) {
2302
- log.error("Failed to save state:", { error: e });
2303
- }
2304
- }
2305
- function usePersistState(options) {
2306
- const restoreState = () => {
2307
- const saved = loadState();
2308
- if (options.onRestore) options.onRestore(saved || {});
2309
- return saved;
2310
- };
2311
- const getCurrentState = () => {
2312
- var _a, _b, _c;
2313
- return {
2314
- open: options.open.value,
2315
- minimized: options.minimized.value,
2316
- promptDockVisible: options.promptDockVisible.value,
2317
- reviewPanelVisible: options.reviewPanelVisible.value,
2318
- bubbleOffset: options.bubbleOffset.value,
2319
- theme: options.theme.value,
2320
- sessionListCollapsed: options.sessionListCollapsed.value,
2321
- splitPanelWidth: (_a = options.splitPanelWidth) == null ? void 0 : _a.value,
2322
- displayMode: (_b = options.displayMode) == null ? void 0 : _b.value,
2323
- splitPosition: (_c = options.splitPosition) == null ? void 0 : _c.value
2324
- };
2325
- };
2326
- const persistState = () => {
2327
- saveState(getCurrentState());
2328
- };
2329
- const watchers = [
2330
- options.open,
2331
- options.minimized,
2332
- options.promptDockVisible,
2333
- options.reviewPanelVisible,
2334
- options.bubbleOffset,
2335
- options.theme,
2336
- options.sessionListCollapsed
2337
- ];
2338
- if (options.splitPanelWidth) watchers.push(options.splitPanelWidth);
2339
- if (options.displayMode) watchers.push(options.displayMode);
2340
- if (options.splitPosition) watchers.push(options.splitPosition);
2341
- onMounted(() => {
2342
- restoreState();
2343
- watch(watchers, () => {
2344
- persistState();
2345
- }, { deep: true });
2346
- });
2347
- return {
2348
- restoreState,
2349
- persistState
2350
- };
2351
- }
2352
- //#endregion
2353
- //#region es/open-code-widget/composables/use-split.mjs
2354
- var AUTO_MODE_THRESHOLD = 1440;
2355
- function useSplitMode(options) {
2356
- var _a, _b;
2357
- const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
2358
- const localSplitPosition = ref((_b = (_a = options.splitPosition) == null ? void 0 : _a.value) != null ? _b : "right");
2359
- const isExtensionMode = computed(() => options.displayMode.value === "extension");
2360
- const splitConfig = computed(() => {
2361
- var _a2, _b2, _c, _d, _e, _f, _g;
2362
- const config = options.splitMode.value || {};
2363
- const isExt = isExtensionMode.value;
2364
- return {
2365
- width: (_a2 = config.width) != null ? _a2 : 500,
2366
- minWidth: (_b2 = config.minWidth) != null ? _b2 : 400,
2367
- maxWidth: (_c = config.maxWidth) != null ? _c : 800,
2368
- resizable: isExt ? false : (_d = config.resizable) != null ? _d : true,
2369
- shrinkPage: isExt ? false : (_e = config.shrinkPage) != null ? _e : true,
2370
- defaultOpen: isExt ? true : (_f = config.defaultOpen) != null ? _f : true,
2371
- position: (_g = config.position) != null ? _g : localSplitPosition.value
2372
- };
2373
- });
2374
- const panelWidth = ref(splitConfig.value.width);
2375
- const effectiveMode = computed(() => {
2376
- if (isExtensionMode.value) return "split";
2377
- if (options.displayMode.value === "bubble") return "bubble";
2378
- if (options.displayMode.value === "split") return "split";
2379
- return windowWidth.value >= AUTO_MODE_THRESHOLD ? "split" : "bubble";
2380
- });
2381
- const isSplitMode = computed(() => effectiveMode.value === "split");
2382
- const splitPosition = computed(() => splitConfig.value.position);
2383
- const handleResize = (width) => {
2384
- var _a2;
2385
- panelWidth.value = width;
2386
- (_a2 = options.onWidthChange) == null || _a2.call(options, width);
2387
- };
2388
- const handleToggle = () => {
2389
- var _a2;
2390
- const nextOpen = !options.open.value;
2391
- (_a2 = options.onOpenChange) == null || _a2.call(options, nextOpen);
2392
- };
2393
- const handleTogglePosition = () => {
2394
- var _a2;
2395
- const nextPosition = localSplitPosition.value === "right" ? "left" : "right";
2396
- localSplitPosition.value = nextPosition;
2397
- (_a2 = options.onPositionChange) == null || _a2.call(options, nextPosition);
2398
- };
2399
- const handleWindowResize = () => {
2400
- if (typeof window !== "undefined") windowWidth.value = window.innerWidth;
2401
- };
2402
- const updateBodyClass = () => {
2403
- if (typeof document === "undefined") return;
2404
- if (isExtensionMode.value) return;
2405
- if (isSplitMode.value && options.open.value && splitConfig.value.shrinkPage) {
2406
- document.body.classList.add("has-opencode-split");
2407
- document.body.style.setProperty("--opencode-split-width", `${panelWidth.value}px`);
2408
- if (splitPosition.value === "left") {
2409
- document.body.classList.add("has-opencode-split-left");
2410
- document.body.classList.remove("has-opencode-split-right");
2411
- } else {
2412
- document.body.classList.add("has-opencode-split-right");
2413
- document.body.classList.remove("has-opencode-split-left");
2414
- }
2415
- } else {
2416
- document.body.classList.remove("has-opencode-split");
2417
- document.body.classList.remove("has-opencode-split-left");
2418
- document.body.classList.remove("has-opencode-split-right");
2419
- document.body.style.removeProperty("--opencode-split-width");
2420
- }
2421
- };
2422
- watch([
2423
- isSplitMode,
2424
- options.open,
2425
- panelWidth,
2426
- splitPosition
2427
- ], updateBodyClass, { immediate: true });
2428
- watch(splitConfig, (config) => {
2429
- if (panelWidth.value < config.minWidth) panelWidth.value = config.minWidth;
2430
- if (panelWidth.value > config.maxWidth) panelWidth.value = config.maxWidth;
2431
- });
2432
- watch(() => {
2433
- var _a2;
2434
- return (_a2 = options.splitPosition) == null ? void 0 : _a2.value;
2435
- }, (val) => {
2436
- if (val && val !== localSplitPosition.value) localSplitPosition.value = val;
2437
- });
2438
- onMounted(() => {
2439
- var _a2;
2440
- if (typeof window !== "undefined") {
2441
- window.addEventListener("resize", handleWindowResize);
2442
- if (!isExtensionMode.value && isSplitMode.value && splitConfig.value.defaultOpen && !options.open.value) (_a2 = options.onOpenChange) == null || _a2.call(options, true);
2443
- }
2444
- });
2445
- onUnmounted(() => {
2446
- if (typeof window !== "undefined") {
2447
- window.removeEventListener("resize", handleWindowResize);
2448
- if (!isExtensionMode.value) {
2449
- document.body.classList.remove("has-opencode-split");
2450
- document.body.classList.remove("has-opencode-split-left");
2451
- document.body.classList.remove("has-opencode-split-right");
2452
- document.body.style.removeProperty("--opencode-split-width");
2453
- }
2454
- }
2455
- });
2456
- return {
2457
- effectiveMode,
2458
- isSplitMode,
2459
- isExtensionMode,
2460
- panelWidth,
2461
- splitConfig,
2462
- splitPosition,
2463
- handleResize,
2464
- handleToggle,
2465
- handleTogglePosition
2466
- };
2467
- }
2468
- //#endregion
2469
- //#region es/open-code-widget/src/index.vue.mjs
2470
- var __defProp = Object.defineProperty;
2471
- var __defProps = Object.defineProperties;
2472
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2473
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2474
- var __hasOwnProp = Object.prototype.hasOwnProperty;
2475
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
2476
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
2477
- enumerable: true,
2478
- configurable: true,
2479
- writable: true,
2480
- value
2481
- }) : obj[key] = value;
2482
- var __spreadValues = (a, b) => {
2483
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
2484
- if (__getOwnPropSymbols) {
2485
- for (var prop of __getOwnPropSymbols(b)) if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
2486
- }
2487
- return a;
2488
- };
2489
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2490
- var __vue_sfc__ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, { name: "OpencodeWidget" }), {
2491
- __name: "index",
2492
- props: {
2493
- open: {
2494
- type: Boolean,
2495
- required: false,
2496
- default: false
2497
- },
2498
- theme: {
2499
- type: String,
2500
- required: false,
2501
- default: "auto"
2502
- },
2503
- title: {
2504
- type: String,
2505
- required: false,
2506
- default: "AI 助手"
2507
- },
2508
- hotkeyLabel: {
2509
- type: String,
2510
- required: false,
2511
- default: "Ctrl+K"
2512
- },
2513
- selectShortcutLabel: {
2514
- type: String,
2515
- required: false,
2516
- default: "按 ESC 或 Ctrl+P 退出"
2517
- },
2518
- selectMode: {
2519
- type: Boolean,
2520
- required: false,
2521
- default: false
2522
- },
2523
- sessionListCollapsed: {
2524
- type: Boolean,
2525
- required: false,
2526
- default: true
2527
- },
2528
- sessionKey: {
2529
- type: String,
2530
- required: false,
2531
- default: "id"
2532
- },
2533
- frameLoading: {
2534
- type: Boolean,
2535
- required: false,
2536
- default: false
2537
- },
2538
- loadingSessionList: {
2539
- type: Boolean,
2540
- required: false
2541
- },
2542
- showSessionListSkeleton: {
2543
- type: Boolean,
2544
- required: false,
2545
- default: false
2546
- },
2547
- showEmptyState: {
2548
- type: Boolean,
2549
- required: false,
2550
- default: false
2551
- },
2552
- showError: {
2553
- type: Boolean,
2554
- required: false,
2555
- default: false
2556
- },
2557
- emptyStateText: {
2558
- type: String,
2559
- required: false,
2560
- default: "当前项目暂无会话"
2561
- },
2562
- emptyStateActionText: {
2563
- type: String,
2564
- required: false,
2565
- default: "立即创建"
2566
- },
2567
- iframeSrc: {
2568
- type: String,
2569
- required: false,
2570
- default: ""
2571
- },
2572
- sessions: {
2573
- type: Array,
2574
- required: false,
2575
- default: () => []
2576
- },
2577
- currentSessionId: {
2578
- type: [String, null],
2579
- required: false,
2580
- default: null
2581
- },
2582
- selectedElements: {
2583
- type: Array,
2584
- required: false,
2585
- default: () => []
2586
- },
2587
- showClearAll: {
2588
- type: Boolean,
2589
- required: false,
2590
- default: true
2591
- },
2592
- selectEnabled: {
2593
- type: Boolean,
2594
- required: false,
2595
- default: true
2596
- },
2597
- thinking: {
2598
- type: Boolean,
2599
- required: false,
2600
- default: false
2601
- },
2602
- sessionStates: {
2603
- type: Object,
2604
- required: false
2605
- },
2606
- displayMode: {
2607
- type: String,
2608
- required: false,
2609
- default: "bubble"
2610
- },
2611
- splitMode: {
2612
- type: Object,
2613
- required: false,
2614
- default: void 0
2615
- },
2616
- splitPanelWidth: {
2617
- type: Number,
2618
- required: false,
2619
- default: 500
2620
- },
2621
- hideBubble: {
2622
- type: Boolean,
2623
- required: false,
2624
- default: false
2625
- }
2626
- },
2627
- emits: [
2628
- "update:open",
2629
- "update:selectMode",
2630
- "update:sessionListCollapsed",
2631
- "update:currentSessionId",
2632
- "update:selectedElements",
2633
- "update:theme",
2634
- "update:thinking",
2635
- "update:splitPanelWidth",
2636
- "toggle",
2637
- "close",
2638
- "toggle-session-list",
2639
- "toggle-select-mode",
2640
- "toggle-theme",
2641
- "create-session",
2642
- "select-session",
2643
- "delete-session",
2644
- "click-selected-node",
2645
- "remove-selected-node",
2646
- "clear-selected-nodes",
2647
- "empty-action",
2648
- "frame-loaded",
2649
- "thinking-change",
2650
- "split-panel-width-change"
2651
- ],
2652
- setup(__props, { expose: __expose, emit: __emit }) {
2653
- var _a, _b;
2654
- useCssVars((_ctx) => ({
2655
- "-chatAnimationOrigin.x": chatAnimationOrigin.value.x,
2656
- "-chatAnimationOrigin.y": chatAnimationOrigin.value.y
2657
- }));
2658
- const props = __props;
2659
- const emit = __emit;
2660
- const slots = useSlots();
2661
- const notificationMessage = ref("");
2662
- const notificationVisible = ref(false);
2663
- const notificationMode = ref("widget");
2664
- let notificationTimer = null;
2665
- const showNotification = (message, options) => {
2666
- const { duration = 3e3, mode = "widget" } = options || {};
2667
- notificationMessage.value = message;
2668
- notificationVisible.value = true;
2669
- notificationMode.value = mode;
2670
- if (notificationTimer) clearTimeout(notificationTimer);
2671
- notificationTimer = setTimeout(() => {
2672
- notificationVisible.value = false;
2673
- }, duration);
2674
- };
2675
- const dialogVisible = ref(false);
2676
- const dialogMessage = ref("");
2677
- let dialogResolve = null;
2678
- const showConfirmDialog = (message) => {
2679
- dialogMessage.value = message;
2680
- dialogVisible.value = true;
2681
- return new Promise((resolve) => {
2682
- dialogResolve = resolve;
2683
- });
2684
- };
2685
- const handleDialogConfirm = () => {
2686
- dialogVisible.value = false;
2687
- if (dialogResolve) dialogResolve(true);
2688
- };
2689
- const handleDialogCancel = () => {
2690
- dialogVisible.value = false;
2691
- if (dialogResolve) dialogResolve(false);
2692
- };
2693
- const frameRef = ref(null);
2694
- const triggerRef = ref(null);
2695
- const sendMessageToIframe = (type, data) => {
2696
- var _a2;
2697
- (_a2 = frameRef.value) == null || _a2.sendMessageToIframe(type, data);
2698
- };
2699
- const localSessionListCollapsed = ref(props.sessionListCollapsed);
2700
- const localDisplayMode = ref(props.displayMode);
2701
- const localSplitPosition = ref((_b = (_a = props.splitMode) == null ? void 0 : _a.position) != null ? _b : "right");
2702
- const minimized = ref(false);
2703
- const promptDockVisible = ref(true);
2704
- const reviewPanelVisible = ref(false);
2705
- const isRestoring = ref(true);
2706
- const iframeLoaded = ref(false);
2707
- const splitPanelWidth = ref(props.splitPanelWidth);
2708
- const syncStateToIframe = () => {
2709
- if (!iframeLoaded.value) return;
2710
- sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
2711
- sendMessageToIframe(WIDGET_MSG.MINIMIZE_STATE, { minimized: minimized.value });
2712
- sendMessageToIframe(WIDGET_MSG.REVIEW_PANEL_TOGGLE, { visible: reviewPanelVisible.value });
2713
- };
2714
- const handleFrameLoaded = () => {
2715
- emit("frame-loaded");
2716
- iframeLoaded.value = true;
2717
- syncStateToIframe();
2718
- };
2719
- watch(() => props.sessionListCollapsed, (val) => {
2720
- localSessionListCollapsed.value = val;
2721
- });
2722
- watch(() => props.splitPanelWidth, (val) => {
2723
- splitPanelWidth.value = val;
2724
- });
2725
- watch(() => props.displayMode, (val) => {
2726
- localDisplayMode.value = val;
2727
- });
2728
- const handleToggleDisplayMode = () => {
2729
- if (localDisplayMode.value === "extension" || localDisplayMode.value === "extension-selector") return;
2730
- const modes = [
2731
- "bubble",
2732
- "split",
2733
- "auto"
2734
- ];
2735
- const nextIndex = (modes.indexOf(localDisplayMode.value) + 1) % modes.length;
2736
- localDisplayMode.value = modes[nextIndex];
2737
- };
2738
- const { buttonActive, containerClasses, iframeSource, sessionListTitle, resolvedTheme, handleClose, handleEmptyAction, handleToggle, handleToggleSessionList, handleToggleTheme } = useWidget({
2739
- theme: toRef(props, "theme"),
2740
- open: toRef(props, "open"),
2741
- selectMode: toRef(props, "selectMode"),
2742
- iframeSrc: toRef(props, "iframeSrc"),
2743
- sessionListCollapsed: localSessionListCollapsed,
2744
- onToggle: (nextOpen) => {
2745
- emit("update:open", nextOpen);
2746
- emit("toggle", nextOpen);
2747
- },
2748
- onToggleSelectMode: (mode) => {
2749
- emit("update:selectMode", mode);
2750
- emit("toggle-select-mode", mode);
2751
- },
2752
- onClose: () => {
2753
- emit("update:open", false);
2754
- emit("close");
2755
- },
2756
- onToggleSessionList: (collapsed) => {
2757
- localSessionListCollapsed.value = collapsed;
2758
- emit("update:sessionListCollapsed", collapsed);
2759
- emit("toggle-session-list", collapsed);
2760
- },
2761
- onEmptyAction: () => {
2762
- emit("empty-action");
2763
- },
2764
- onToggleTheme: (newTheme) => {
2765
- emit("update:theme", newTheme);
2766
- emit("toggle-theme", newTheme);
2767
- }
2768
- });
2769
- const { sessionItems, handleCreateSession, handleDeleteSession, handleSelectSession } = useSession({
2770
- sessions: toRef(props, "sessions"),
2771
- currentSessionId: toRef(props, "currentSessionId"),
2772
- onCreateSession: () => emit("create-session"),
2773
- onSelectSession: (session) => {
2774
- emit("update:currentSessionId", session.id);
2775
- emit("select-session", session);
2776
- },
2777
- onDeleteSession: (session) => emit("delete-session", session),
2778
- showConfirmDialog
2779
- });
2780
- const { bubbleVisible, hasSelectedElements, selectedElementItems, handleClearSelectedNodes, handleClickSelectedNode, handleRemoveSelectedNode, handleToggleSelectMode } = useSelection({
2781
- selectMode: toRef(props, "selectMode"),
2782
- selectedElements: toRef(props, "selectedElements"),
2783
- onToggleSelectMode: (mode) => {
2784
- emit("update:selectMode", mode);
2785
- emit("toggle-select-mode", mode);
2786
- },
2787
- onRemoveSelectedNode: (payload) => {
2788
- emit("remove-selected-node", payload);
2789
- const newElements = [...props.selectedElements];
2790
- newElements.splice(payload.index, 1);
2791
- emit("update:selectedElements", newElements);
2792
- },
2793
- onClearSelectedNodes: () => {
2794
- emit("clear-selected-nodes");
2795
- emit("update:selectedElements", []);
2796
- },
2797
- showConfirmDialog
2798
- });
2799
- const { highlightVisible, highlightStyle, tooltipVisible, tooltipStyle, tooltipContent } = useInspector({
2800
- selectMode: toRef(props, "selectMode"),
2801
- onAddSelectedNode: (element) => {
2802
- emit("click-selected-node", element);
2803
- },
2804
- onExitSelectMode: () => {
2805
- emit("update:selectMode", false);
2806
- emit("toggle-select-mode", false);
2807
- }
2808
- });
2809
- const bubbleOffset = ref(void 0);
2810
- const { effectiveMode, isSplitMode, isExtensionMode, panelWidth, splitConfig, splitPosition, handleResize, handleToggle: handleSplitToggle, handleTogglePosition } = useSplitMode({
2811
- displayMode: localDisplayMode,
2812
- splitMode: toRef(props, "splitMode"),
2813
- open: toRef(props, "open"),
2814
- splitPosition: localSplitPosition,
2815
- onOpenChange: (nextOpen) => {
2816
- emit("update:open", nextOpen);
2817
- emit("toggle", nextOpen);
2818
- },
2819
- onWidthChange: (width) => {
2820
- splitPanelWidth.value = width;
2821
- emit("update:splitPanelWidth", width);
2822
- emit("split-panel-width-change", width);
2823
- },
2824
- onPositionChange: (position) => {
2825
- localSplitPosition.value = position;
2826
- }
2827
- });
2828
- usePersistState({
2829
- open: toRef(props, "open"),
2830
- minimized,
2831
- promptDockVisible,
2832
- reviewPanelVisible,
2833
- bubbleOffset,
2834
- theme: toRef(props, "theme"),
2835
- sessionListCollapsed: localSessionListCollapsed,
2836
- splitPanelWidth,
2837
- displayMode: localDisplayMode,
2838
- splitPosition: localSplitPosition,
2839
- onRestore: (state) => {
2840
- if (state.open !== void 0 && state.open !== props.open) {
2841
- emit("update:open", state.open);
2842
- emit("toggle", state.open);
2843
- }
2844
- if (state.minimized !== void 0) minimized.value = state.minimized;
2845
- if (state.bubbleOffset !== void 0) {
2846
- const bubbleSize = 44;
2847
- const margin = 10;
2848
- const maxX = window.innerWidth - bubbleSize - margin;
2849
- const maxY = window.innerHeight - bubbleSize - margin;
2850
- bubbleOffset.value = {
2851
- x: Math.max(margin, Math.min(state.bubbleOffset.x, maxX)),
2852
- y: Math.max(margin, Math.min(state.bubbleOffset.y, maxY))
2853
- };
2854
- }
2855
- if (state.theme !== void 0 && state.theme !== props.theme) {
2856
- emit("update:theme", state.theme);
2857
- emit("toggle-theme", state.theme);
2858
- }
2859
- if (state.sessionListCollapsed !== void 0 && state.sessionListCollapsed !== props.sessionListCollapsed) {
2860
- localSessionListCollapsed.value = state.sessionListCollapsed;
2861
- emit("update:sessionListCollapsed", state.sessionListCollapsed);
2862
- }
2863
- if (state.promptDockVisible !== void 0) promptDockVisible.value = state.promptDockVisible;
2864
- else if (minimized.value) promptDockVisible.value = false;
2865
- if (state.reviewPanelVisible !== void 0) reviewPanelVisible.value = state.reviewPanelVisible;
2866
- if (state.splitPanelWidth !== void 0 && state.splitPanelWidth !== props.splitPanelWidth) handleResize(state.splitPanelWidth);
2867
- if (state.displayMode !== void 0 && state.displayMode !== props.displayMode) localDisplayMode.value = state.displayMode;
2868
- if (state.splitPosition !== void 0) localSplitPosition.value = state.splitPosition;
2869
- nextTick(() => {
2870
- syncStateToIframe();
2871
- setTimeout(() => {
2872
- isRestoring.value = false;
2873
- }, 50);
2874
- });
2875
- }
2876
- });
2877
- const handleToggleMinimize = () => {
2878
- minimized.value = !minimized.value;
2879
- promptDockVisible.value = !minimized.value;
2880
- sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
2881
- sendMessageToIframe(WIDGET_MSG.MINIMIZE_STATE, { minimized: minimized.value });
2882
- };
2883
- const handleTogglePromptDock = () => {
2884
- promptDockVisible.value = !promptDockVisible.value;
2885
- sendMessageToIframe(WIDGET_MSG.PROMPT_DOCK_VISIBILITY, { visible: promptDockVisible.value });
2886
- };
2887
- const handleToggleReviewPanel = () => {
2888
- reviewPanelVisible.value = !reviewPanelVisible.value;
2889
- sendMessageToIframe(WIDGET_MSG.REVIEW_PANEL_TOGGLE, { visible: reviewPanelVisible.value });
2890
- };
2891
- const handleRefresh = () => {
2892
- window.location.reload();
2893
- };
2894
- const windowWidth = ref(typeof window !== "undefined" ? window.innerWidth : 0);
2895
- const windowHeight = ref(typeof window !== "undefined" ? window.innerHeight : 0);
2896
- const handleWindowResize = () => {
2897
- if (typeof window !== "undefined") {
2898
- windowWidth.value = window.innerWidth;
2899
- windowHeight.value = window.innerHeight;
2900
- }
2901
- };
2902
- onMounted(() => {
2903
- if (typeof window !== "undefined") window.addEventListener("resize", handleWindowResize);
2904
- });
2905
- onUnmounted(() => {
2906
- if (typeof window !== "undefined") window.removeEventListener("resize", handleWindowResize);
2907
- });
2908
- const bubbleQuadrant = computed(() => {
2909
- var _a2, _b2, _c, _d;
2910
- if (typeof window === "undefined") return "bottom-right";
2911
- const centerX = windowWidth.value / 2;
2912
- const centerY = windowHeight.value / 2;
2913
- const bubbleSize = 44;
2914
- const currentOffset = (_b2 = (_a2 = triggerRef.value) == null ? void 0 : _a2.offset) != null ? _b2 : bubbleOffset.value;
2915
- const effectiveX = ((_c = currentOffset == null ? void 0 : currentOffset.x) != null ? _c : windowWidth.value - bubbleSize - 24) + bubbleSize / 2;
2916
- const effectiveY = ((_d = currentOffset == null ? void 0 : currentOffset.y) != null ? _d : windowHeight.value - bubbleSize - 24) + bubbleSize / 2;
2917
- if (effectiveX >= centerX && effectiveY >= centerY) return "bottom-right";
2918
- else if (effectiveX < centerX && effectiveY >= centerY) return "bottom-left";
2919
- else if (effectiveX >= centerX && effectiveY < centerY) return "top-right";
2920
- else return "top-left";
2921
- });
2922
- const isBubbleOnRightSide = computed(() => {
2923
- const quadrant = bubbleQuadrant.value;
2924
- return quadrant === "top-right" || quadrant === "bottom-right";
2925
- });
2926
- const chatPositionStyle = computed(() => {
2927
- var _a2, _b2, _c;
2928
- if (typeof window === "undefined") return {};
2929
- const chatWidth = minimized.value ? 300 : 700;
2930
- const chatHeight = minimized.value ? 300 : Math.min(windowHeight.value * .86, windowHeight.value - 40);
2931
- const gap = 24;
2932
- const bubbleSize = 44;
2933
- const screenMargin = 20;
2934
- const effectiveOffset = (_c = (_b2 = (_a2 = triggerRef.value) == null ? void 0 : _a2.offset) != null ? _b2 : bubbleOffset.value) != null ? _c : {
2935
- x: windowWidth.value - bubbleSize - gap,
2936
- y: windowHeight.value - bubbleSize - gap
2937
- };
2938
- const style = {};
2939
- if (isBubbleOnRightSide.value) {
2940
- let rightPos = windowWidth.value - effectiveOffset.x + gap;
2941
- const minRight = screenMargin;
2942
- const maxRight = windowWidth.value - chatWidth - screenMargin;
2943
- if (rightPos > maxRight) rightPos = maxRight;
2944
- if (rightPos < minRight) rightPos = minRight;
2945
- style.right = `${rightPos}px`;
2946
- style.left = "auto";
2947
- } else {
2948
- let leftPos = effectiveOffset.x + bubbleSize + gap;
2949
- const minLeft = screenMargin;
2950
- const maxLeft = windowWidth.value - chatWidth - screenMargin;
2951
- if (leftPos > maxLeft) leftPos = maxLeft;
2952
- if (leftPos < minLeft) leftPos = minLeft;
2953
- style.left = `${leftPos}px`;
2954
- style.right = "auto";
2955
- }
2956
- let bottomPos = windowHeight.value - effectiveOffset.y - bubbleSize;
2957
- const maxBottom = windowHeight.value - chatHeight - screenMargin;
2958
- if (bottomPos > maxBottom) bottomPos = maxBottom;
2959
- if (bottomPos < screenMargin) bottomPos = screenMargin;
2960
- style.bottom = `${bottomPos}px`;
2961
- return style;
2962
- });
2963
- const handleBubbleOffsetChange = (offset) => {
2964
- bubbleOffset.value = offset;
2965
- };
2966
- const handleResizeStart = () => {
2967
- isDragging.value = true;
2968
- };
2969
- const handleResizeEnd = () => {
2970
- isDragging.value = false;
2971
- };
2972
- const chatAnimationOrigin = computed(() => {
2973
- switch (bubbleQuadrant.value) {
2974
- case "top-left": return {
2975
- x: "-20px",
2976
- y: "-20px"
2977
- };
2978
- case "top-right": return {
2979
- x: "20px",
2980
- y: "-20px"
2981
- };
2982
- case "bottom-left": return {
2983
- x: "-20px",
2984
- y: "20px"
2985
- };
2986
- default: return {
2987
- x: "20px",
2988
- y: "20px"
2989
- };
2990
- }
2991
- });
2992
- const isDragging = ref(false);
2993
- let wasOpenBeforeDrag = false;
2994
- const handleDragStart = () => {
2995
- isDragging.value = true;
2996
- wasOpenBeforeDrag = props.open;
2997
- if (props.open) emit("update:open", false);
2998
- };
2999
- const handleDragEnd = () => {
3000
- isDragging.value = false;
3001
- if (wasOpenBeforeDrag) emit("update:open", true);
3002
- };
3003
- provideOpenCodeWidgetContext({
3004
- theme: toRef(props, "theme"),
3005
- resolvedTheme,
3006
- title: toRef(props, "title"),
3007
- hotkeyLabel: toRef(props, "hotkeyLabel"),
3008
- selectShortcutLabel: toRef(props, "selectShortcutLabel"),
3009
- selectMode: toRef(props, "selectMode"),
3010
- selectEnabled: toRef(props, "selectEnabled"),
3011
- sessionListCollapsed: localSessionListCollapsed,
3012
- sessionKey: toRef(props, "sessionKey"),
3013
- frameLoading: toRef(props, "frameLoading"),
3014
- loadingSessionList: toRef(props, "loadingSessionList"),
3015
- showSessionListSkeleton: toRef(props, "showSessionListSkeleton"),
3016
- showEmptyState: toRef(props, "showEmptyState"),
3017
- showError: toRef(props, "showError"),
3018
- emptyStateText: toRef(props, "emptyStateText"),
3019
- emptyStateActionText: toRef(props, "emptyStateActionText"),
3020
- showClearAll: toRef(props, "showClearAll"),
3021
- open: toRef(props, "open"),
3022
- thinking: toRef(props, "thinking"),
3023
- minimized,
3024
- promptDockVisible,
3025
- reviewPanelVisible,
3026
- bubbleOffset,
3027
- mode: effectiveMode,
3028
- displayMode: localDisplayMode,
3029
- splitPosition,
3030
- sessionStates: computed(() => {
3031
- var _a2;
3032
- return (_a2 = props.sessionStates) != null ? _a2 : {};
3033
- }),
3034
- iframeSource,
3035
- buttonActive,
3036
- sessionListTitle,
3037
- bubbleVisible,
3038
- hasSelectedElements,
3039
- sessionItems,
3040
- selectedElementItems,
3041
- handleToggle,
3042
- handleClose,
3043
- handleToggleMinimize,
3044
- handleTogglePromptDock,
3045
- handleToggleReviewPanel,
3046
- handleToggleSessionList,
3047
- handleToggleTheme,
3048
- handleToggleDisplayMode,
3049
- handleToggleSplitPosition: handleTogglePosition,
3050
- handleEmptyAction,
3051
- handleCreateSession,
3052
- handleSelectSession,
3053
- handleDeleteSession,
3054
- handleToggleSelectMode,
3055
- handleClickSelectedNode,
3056
- handleRemoveSelectedNode: (payload) => handleRemoveSelectedNode(payload.item, payload.index, payload.source),
3057
- handleClearSelectedNodes,
3058
- handleFrameLoaded,
3059
- handleBubbleOffsetChange,
3060
- handleRefresh
3061
- });
3062
- __expose({
3063
- showNotification,
3064
- showConfirmDialog,
3065
- sendMessageToIframe,
3066
- isSplitMode
3067
- });
3068
- const __returned__ = {
3069
- props,
3070
- emit,
3071
- slots,
3072
- notificationMessage,
3073
- notificationVisible,
3074
- notificationMode,
3075
- get notificationTimer() {
3076
- return notificationTimer;
3077
- },
3078
- set notificationTimer(v) {
3079
- notificationTimer = v;
3080
- },
3081
- showNotification,
3082
- dialogVisible,
3083
- dialogMessage,
3084
- get dialogResolve() {
3085
- return dialogResolve;
3086
- },
3087
- set dialogResolve(v) {
3088
- dialogResolve = v;
3089
- },
3090
- showConfirmDialog,
3091
- handleDialogConfirm,
3092
- handleDialogCancel,
3093
- frameRef,
3094
- triggerRef,
3095
- sendMessageToIframe,
3096
- localSessionListCollapsed,
3097
- localDisplayMode,
3098
- localSplitPosition,
3099
- minimized,
3100
- promptDockVisible,
3101
- reviewPanelVisible,
3102
- isRestoring,
3103
- iframeLoaded,
3104
- splitPanelWidth,
3105
- syncStateToIframe,
3106
- handleFrameLoaded,
3107
- handleToggleDisplayMode,
3108
- buttonActive,
3109
- containerClasses,
3110
- iframeSource,
3111
- sessionListTitle,
3112
- resolvedTheme,
3113
- handleClose,
3114
- handleEmptyAction,
3115
- handleToggle,
3116
- handleToggleSessionList,
3117
- handleToggleTheme,
3118
- sessionItems,
3119
- handleCreateSession,
3120
- handleDeleteSession,
3121
- handleSelectSession,
3122
- bubbleVisible,
3123
- hasSelectedElements,
3124
- selectedElementItems,
3125
- handleClearSelectedNodes,
3126
- handleClickSelectedNode,
3127
- handleRemoveSelectedNode,
3128
- handleToggleSelectMode,
3129
- highlightVisible,
3130
- highlightStyle,
3131
- tooltipVisible,
3132
- tooltipStyle,
3133
- tooltipContent,
3134
- bubbleOffset,
3135
- effectiveMode,
3136
- isSplitMode,
3137
- isExtensionMode,
3138
- panelWidth,
3139
- splitConfig,
3140
- splitPosition,
3141
- handleResize,
3142
- handleSplitToggle,
3143
- handleTogglePosition,
3144
- handleToggleMinimize,
3145
- handleTogglePromptDock,
3146
- handleToggleReviewPanel,
3147
- handleRefresh,
3148
- windowWidth,
3149
- windowHeight,
3150
- handleWindowResize,
3151
- bubbleQuadrant,
3152
- isBubbleOnRightSide,
3153
- chatPositionStyle,
3154
- handleBubbleOffsetChange,
3155
- handleResizeStart,
3156
- handleResizeEnd,
3157
- chatAnimationOrigin,
3158
- isDragging,
3159
- get wasOpenBeforeDrag() {
3160
- return wasOpenBeforeDrag;
3161
- },
3162
- set wasOpenBeforeDrag(v) {
3163
- wasOpenBeforeDrag = v;
3164
- },
3165
- handleDragStart,
3166
- handleDragEnd,
3167
- ChatPanel: ChatPanel_vue_default,
3168
- SelectHint: SelectHint_vue_default,
3169
- Trigger: Trigger_vue_default
3170
- };
3171
- Object.defineProperty(__returned__, "__isScriptSetup", {
3172
- enumerable: false,
3173
- value: true
3174
- });
3175
- return __returned__;
3176
- }
3177
- }));
3178
- var _hoisted_1 = { class: "opencode-tooltip-tag" };
3179
- var _hoisted_2 = { class: "opencode-tooltip-file" };
3180
- var _hoisted_3 = {
3181
- key: 1,
3182
- class: "opencode-dialog-overlay"
3183
- };
3184
- var _hoisted_4 = {
3185
- class: "opencode-dialog",
3186
- role: "alertdialog",
3187
- "aria-modal": "true"
3188
- };
3189
- var _hoisted_5 = { class: "opencode-dialog-content" };
3190
- var _hoisted_6 = { class: "opencode-dialog-message" };
3191
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
3192
- return openBlock(), createElementBlock("div", { class: normalizeClass([...$setup.containerClasses, { "extension-mode": $setup.isExtensionMode }]) }, [
3193
- $props.displayMode !== "extension-selector" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3194
- !$setup.isSplitMode && !$setup.props.hideBubble ? (openBlock(), createBlock($setup["Trigger"], {
3195
- key: 0,
3196
- ref: "triggerRef",
3197
- onDragStart: $setup.handleDragStart,
3198
- onDragEnd: $setup.handleDragEnd
3199
- }, createSlots({ _: 2 }, [$setup.slots["button-icon"] ? {
3200
- name: "default",
3201
- fn: withCtx(() => [renderSlot(_ctx.$slots, "button-icon")]),
3202
- key: "0"
3203
- } : void 0]), 1536)) : createCommentVNode("v-if", true),
3204
- createVNode($setup["ChatPanel"], {
3205
- ref: "frameRef",
3206
- mode: $setup.effectiveMode,
3207
- open: $props.open,
3208
- minimized: $setup.minimized,
3209
- "position-style": $setup.chatPositionStyle,
3210
- "animation-origin": $setup.chatAnimationOrigin,
3211
- "panel-width": $setup.panelWidth,
3212
- resizable: $setup.splitConfig.resizable,
3213
- "min-width": $setup.splitConfig.minWidth,
3214
- "max-width": $setup.splitConfig.maxWidth,
3215
- "no-transition": $setup.isRestoring,
3216
- dragging: $setup.isDragging,
3217
- thinking: $props.thinking,
3218
- "resolved-theme": $setup.resolvedTheme,
3219
- "split-position": $setup.splitPosition,
3220
- extension: $setup.isExtensionMode,
3221
- onResize: $setup.handleResize,
3222
- onResizeStart: $setup.handleResizeStart,
3223
- onResizeEnd: $setup.handleResizeEnd,
3224
- onToggle: $setup.handleSplitToggle
3225
- }, createSlots({
3226
- "sessions-empty": withCtx(() => [renderSlot(_ctx.$slots, "sessions-empty", {}, () => [_cache[0] || (_cache[0] = createElementVNode("div", { class: "opencode-session-empty" }, "暂无会话", -1))])]),
3227
- _: 2
3228
- }, [
3229
- $setup.slots["session-toggle-icon"] ? {
3230
- name: "session-toggle-icon",
3231
- fn: withCtx(() => [renderSlot(_ctx.$slots, "session-toggle-icon")]),
3232
- key: "0"
3233
- } : void 0,
3234
- $setup.slots["select-icon"] ? {
3235
- name: "select-icon",
3236
- fn: withCtx(() => [renderSlot(_ctx.$slots, "select-icon")]),
3237
- key: "1"
3238
- } : void 0,
3239
- $setup.slots["close-icon"] ? {
3240
- name: "close-icon",
3241
- fn: withCtx(() => [renderSlot(_ctx.$slots, "close-icon")]),
3242
- key: "2"
3243
- } : void 0,
3244
- $setup.slots["empty-state"] ? {
3245
- name: "empty-state",
3246
- fn: withCtx(() => [renderSlot(_ctx.$slots, "empty-state")]),
3247
- key: "3"
3248
- } : void 0,
3249
- $setup.slots.loading ? {
3250
- name: "loading",
3251
- fn: withCtx(() => [renderSlot(_ctx.$slots, "loading")]),
3252
- key: "4"
3253
- } : void 0,
3254
- $setup.slots.error ? {
3255
- name: "error",
3256
- fn: withCtx(() => [renderSlot(_ctx.$slots, "error")]),
3257
- key: "5"
3258
- } : void 0,
3259
- $setup.slots.content ? {
3260
- name: "content",
3261
- fn: withCtx(() => [renderSlot(_ctx.$slots, "content")]),
3262
- key: "6"
3263
- } : void 0
3264
- ]), 1032, [
3265
- "mode",
3266
- "open",
3267
- "minimized",
3268
- "position-style",
3269
- "animation-origin",
3270
- "panel-width",
3271
- "resizable",
3272
- "min-width",
3273
- "max-width",
3274
- "no-transition",
3275
- "dragging",
3276
- "thinking",
3277
- "resolved-theme",
3278
- "split-position",
3279
- "extension",
3280
- "onResize",
3281
- "onToggle"
3282
- ]),
3283
- createVNode($setup["SelectHint"])
3284
- ], 64)) : createCommentVNode("v-if", true),
3285
- withDirectives(createElementVNode("div", {
3286
- class: "opencode-element-highlight",
3287
- style: normalizeStyle($setup.highlightStyle)
3288
- }, null, 4), [[vShow, $setup.highlightVisible]]),
3289
- withDirectives(createElementVNode("div", {
3290
- class: "opencode-element-tooltip",
3291
- style: normalizeStyle($setup.tooltipStyle)
3292
- }, [createElementVNode("div", _hoisted_1, toDisplayString($setup.tooltipContent.description), 1), createElementVNode("div", _hoisted_2, toDisplayString($setup.tooltipContent.fileInfo), 1)], 4), [[vShow, $setup.tooltipVisible]]),
3293
- $setup.dialogVisible ? (openBlock(), createElementBlock("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createElementVNode("div", _hoisted_6, toDisplayString($setup.dialogMessage), 1)]), createElementVNode("div", { class: "opencode-dialog-actions" }, [createElementVNode("button", {
3294
- class: "opencode-dialog-btn cancel",
3295
- onClick: $setup.handleDialogCancel
3296
- }, "取消"), createElementVNode("button", {
3297
- class: "opencode-dialog-btn confirm",
3298
- onClick: $setup.handleDialogConfirm
3299
- }, "确认")])])])) : createCommentVNode("v-if", true),
3300
- (openBlock(), createBlock(Teleport, {
3301
- to: "body",
3302
- disabled: $setup.notificationMode === "widget"
3303
- }, [$setup.notificationVisible ? (openBlock(), createElementBlock("div", {
3304
- key: 0,
3305
- class: normalizeClass($setup.notificationMode === "page" ? "opencode-page-notification" : "opencode-notification"),
3306
- role: "alert"
3307
- }, toDisplayString($setup.notificationMessage), 3)) : createCommentVNode("v-if", true)], 8, ["disabled"]))
3308
- ], 2);
3309
- }
3310
- __vue_sfc__.render = __vue_render__;
3311
- //#endregion
3312
- //#region es/open-code-widget/index.mjs
3313
- var open_code_widget_default = __vue_sfc__;
3314
- //#endregion
3315
- //#region es/index.mjs
3316
- var version = "1.1.3";
3317
- function install(app, options) {
3318
- [open_code_widget_default].forEach((item) => {
3319
- if (item.install) app.use(item, options);
3320
- else if (item.name) app.component(item.name, item);
3321
- });
3322
- }
3323
- var es_default = install;
3324
- //#endregion
3325
- export { open_code_widget_default as OpenCodeWidget, es_default as default, install, version };