wi-chat 0.3.0 → 0.5.0

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.
Files changed (75) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.js +129 -123
  3. package/dist/core/useChat.d.ts +11 -3
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.d.ts +5 -3
  6. package/dist/index.js +101 -68
  7. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -3
  8. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  9. package/dist/mobile-ui/index.cjs +1 -1
  10. package/dist/mobile-ui/index.d.ts +2 -2
  11. package/dist/mobile-ui/index.js +79 -71
  12. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  13. package/dist/mobile-ui/style.css +1 -1
  14. package/dist/page-context/extArgs.d.ts +46 -0
  15. package/dist/page-context/index.cjs +2 -0
  16. package/dist/page-context/index.d.ts +18 -0
  17. package/dist/page-context/index.js +48 -0
  18. package/dist/page-context/state.d.ts +10 -0
  19. package/dist/page-context/types.d.ts +218 -0
  20. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +38 -0
  21. package/dist/parser/answerCom/actionExecute/clarification.d.ts +67 -0
  22. package/dist/parser/answerCom/actionExecute/parseActionExecute.d.ts +28 -0
  23. package/dist/parser/answerCom/actionExecute/types.d.ts +153 -0
  24. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +43 -0
  25. package/dist/parser/answerCom/outputFile/types.d.ts +17 -0
  26. package/dist/parser/index.cjs +2 -2
  27. package/dist/parser/index.d.ts +12 -0
  28. package/dist/parser/index.js +537 -211
  29. package/dist/parser/registry.d.ts +8 -1
  30. package/dist/parser/title.d.ts +27 -0
  31. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +19 -0
  32. package/dist/renderers/index.cjs +1 -1
  33. package/dist/renderers/index.d.ts +4 -0
  34. package/dist/renderers/index.js +796 -143
  35. package/dist/renderers/outputFile/OutputFile.vue.d.ts +19 -0
  36. package/dist/renderers/outputFile/useOutputFile.d.ts +85 -0
  37. package/dist/renderers/style.css +1 -1
  38. package/dist/right-panel/RightPanel.vue.d.ts +43 -0
  39. package/dist/right-panel/RightPanelIcon.vue.d.ts +38 -0
  40. package/dist/right-panel/RightPanelTabs.vue.d.ts +39 -0
  41. package/dist/right-panel/icons.d.ts +48 -0
  42. package/dist/right-panel/index.cjs +2 -0
  43. package/dist/right-panel/index.d.ts +43 -0
  44. package/dist/right-panel/index.js +1004 -0
  45. package/dist/right-panel/panels/index.d.ts +7 -0
  46. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +27 -0
  47. package/dist/right-panel/panels/newtab/defaults.d.ts +6 -0
  48. package/dist/right-panel/panels/newtab/index.d.ts +4 -0
  49. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +28 -0
  50. package/dist/right-panel/panels/web/index.d.ts +4 -0
  51. package/dist/right-panel/panels/web/useWebview.d.ts +59 -0
  52. package/dist/right-panel/registry.d.ts +24 -0
  53. package/dist/right-panel/runtime.d.ts +45 -0
  54. package/dist/right-panel/scope.d.ts +34 -0
  55. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +23 -0
  56. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +48 -0
  57. package/dist/right-panel/style.css +1 -0
  58. package/dist/right-panel/types.d.ts +363 -0
  59. package/dist/right-panel/useRightPanel.d.ts +39 -0
  60. package/dist/right-panel/useRightPanelTabs.d.ts +14 -0
  61. package/dist/tools/index.cjs +4 -4
  62. package/dist/tools/index.d.ts +1 -1
  63. package/dist/tools/index.js +182 -162
  64. package/dist/tools/markdown/index.d.ts +1 -1
  65. package/dist/tools/markdown/renderMarkdown.d.ts +25 -0
  66. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  67. package/dist/web-ui/chat/ChatContainer.vue.d.ts +8 -3
  68. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +5 -0
  69. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +2 -2
  70. package/dist/web-ui/index.cjs +1 -1
  71. package/dist/web-ui/index.d.ts +2 -2
  72. package/dist/web-ui/index.js +428 -408
  73. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +4 -7
  74. package/dist/web-ui/style.css +1 -1
  75. package/package.json +13 -6
@@ -0,0 +1,1004 @@
1
+ import { defineComponent as G, computed as y, openBlock as h, createElementBlock as v, Fragment as B, renderList as Q, createElementVNode as d, normalizeClass as se, createVNode as M, toDisplayString as z, createCommentVNode as P, withModifiers as le, ref as R, watch as V, withDirectives as be, vModelText as Ae, normalizeStyle as fe, unref as me, createBlock as we, createTextVNode as We, pushScopeId as re, popScopeId as ce, onMounted as ye, onUnmounted as Te, shallowReactive as Ne, reactive as ke, nextTick as Oe, resolveDynamicComponent as Ue, vShow as De } from "vue";
2
+ const _e = {
3
+ /** 地球:网页标签页与推荐站点缺省图标 */
4
+ globe: [
5
+ "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18",
6
+ "M3.6 9h16.8",
7
+ "M3.6 15h16.8",
8
+ "M12 3c2.4 2.7 2.4 15.3 0 18",
9
+ "M12 3c-2.4 2.7-2.4 15.3 0 18"
10
+ ],
11
+ /** 叠窗 + 加号:新标签页 */
12
+ newtab: [
13
+ "M3 8.5A2.5 2.5 0 0 1 5.5 6h7A2.5 2.5 0 0 1 15 8.5v9A2.5 2.5 0 0 1 12.5 20h-7A2.5 2.5 0 0 1 3 17.5v-9z",
14
+ "M8 3h9.5A2.5 2.5 0 0 1 20 5.5V15",
15
+ "M17 12v6",
16
+ "M14 15h6"
17
+ ],
18
+ /** 加号 */
19
+ plus: ["M12 5v14", "M5 12h14"],
20
+ /** 关闭(叉) */
21
+ close: ["M6 6l12 12", "M18 6L6 18"],
22
+ /** 后退 */
23
+ "arrow-left": ["M19 12H5", "M11 6l-6 6 6 6"],
24
+ /** 前进 */
25
+ "arrow-right": ["M5 12h14", "M13 6l6 6-6 6"],
26
+ /** 刷新 */
27
+ reload: ["M20.5 12a8.5 8.5 0 1 1-2.6-6.1", "M20 3.5V9h-5.5"],
28
+ /** 外部打开 */
29
+ external: ["M14 4h6v6", "M20 4l-8 8", "M18 14v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h5"],
30
+ /** 收起(指向右侧的箭头) */
31
+ "chevron-right": ["M9 6l6 6-6 6"],
32
+ /** 侧边栏布局:收起右侧面板 */
33
+ sidebar: ["M5 4.5h14a1.5 1.5 0 0 1 1.5 1.5v12a1.5 1.5 0 0 1-1.5 1.5H5a1.5 1.5 0 0 1-1.5-1.5V6A1.5 1.5 0 0 1 5 4.5z", "M9.5 4.5v15"],
34
+ /** 变更 / diff */
35
+ diff: ["M6 4v16", "M18 4v16", "M6 9h12", "M9 16l3-3 3 3"],
36
+ /** 终端 */
37
+ terminal: ["M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z", "M7 9l3 3-3 3", "M13 15h4"],
38
+ /** 文件 / 文件夹 */
39
+ folder: ["M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"],
40
+ /** 侧边聊天 */
41
+ chat: ["M21 11.5a8.4 8.4 0 0 1-9 8.4 9 9 0 0 1-4-1L3 21l1.6-4.4A8.4 8.4 0 1 1 21 11.5z"],
42
+ /** 警示(内嵌被拒) */
43
+ alert: ["M12 3.5 21.5 20h-19L12 3.5z", "M12 10v4", "M12 17h0.01"],
44
+ /** 搜索 */
45
+ search: ["M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14", "M16.5 16.5 21 21"],
46
+ /** 最大化(四角向外) */
47
+ maximize: ["M4 9V4h5", "M20 9V4h-5", "M4 15v5h5", "M20 15v5h-5"],
48
+ /** 还原(四角向内) */
49
+ restore: ["M9 4v5H4", "M15 4v5h5", "M9 20v-5H4", "M15 20v-5h5"]
50
+ }, Be = ["width", "height"], Ge = ["d"], Fe = /* @__PURE__ */ G({
51
+ __name: "RightPanelIcon",
52
+ props: {
53
+ name: { default: "globe" },
54
+ size: { default: 16 }
55
+ },
56
+ setup(t) {
57
+ const e = t, n = y(() => _e[e.name] ?? _e.globe);
58
+ return (l, o) => (h(), v("svg", {
59
+ class: "wi-right-panel__icon",
60
+ width: l.size,
61
+ height: l.size,
62
+ viewBox: "0 0 24 24",
63
+ fill: "none",
64
+ stroke: "currentColor",
65
+ "stroke-width": "1.8",
66
+ "stroke-linecap": "round",
67
+ "stroke-linejoin": "round",
68
+ "aria-hidden": "true"
69
+ }, [
70
+ (h(!0), v(B, null, Q(n.value, (s, _) => (h(), v("path", {
71
+ key: _,
72
+ d: s
73
+ }, null, 8, Ge))), 128))
74
+ ], 8, Be));
75
+ }
76
+ }), F = (t, e) => {
77
+ const n = t.__vccOpts || t;
78
+ for (const [l, o] of e)
79
+ n[l] = o;
80
+ return n;
81
+ }, E = /* @__PURE__ */ F(Fe, [["__scopeId", "data-v-5a35fd97"]]), He = { class: "wi-right-panel__tabs" }, Ke = { class: "wi-right-panel__tabs-list" }, Ve = ["title", "onClick"], je = { class: "wi-right-panel__tab-title" }, Xe = {
82
+ key: 0,
83
+ class: "wi-right-panel__tab-loading"
84
+ }, qe = ["onClick"], Je = ["title"], Qe = /* @__PURE__ */ G({
85
+ __name: "RightPanelTabs",
86
+ props: {
87
+ tabs: {},
88
+ activeId: {},
89
+ maximized: { type: Boolean }
90
+ },
91
+ emits: ["select", "close", "add", "toggle-maximize", "collapse"],
92
+ setup(t, { emit: e }) {
93
+ const n = e;
94
+ return (l, o) => (h(), v("div", He, [
95
+ d("div", Ke, [
96
+ (h(!0), v(B, null, Q(l.tabs, (s) => (h(), v("button", {
97
+ key: s.id,
98
+ type: "button",
99
+ class: se(["wi-right-panel__tab", { "is-active": s.id === l.activeId }]),
100
+ title: s.title,
101
+ onClick: (_) => n("select", s.id)
102
+ }, [
103
+ M(E, {
104
+ name: s.icon || "globe",
105
+ size: 14
106
+ }, null, 8, ["name"]),
107
+ d("span", je, z(s.title), 1),
108
+ s.loading ? (h(), v("span", Xe)) : P("", !0),
109
+ d("span", {
110
+ class: "wi-right-panel__tab-close",
111
+ title: "关闭标签页",
112
+ onClick: le((_) => n("close", s.id), ["stop"])
113
+ }, [
114
+ M(E, {
115
+ name: "close",
116
+ size: 12
117
+ })
118
+ ], 8, qe)
119
+ ], 10, Ve))), 128))
120
+ ]),
121
+ d("button", {
122
+ type: "button",
123
+ class: "wi-right-panel__tab-action",
124
+ title: "新建标签页 Ctrl+Shift+B",
125
+ onClick: o[0] || (o[0] = (s) => n("add"))
126
+ }, [
127
+ M(E, {
128
+ name: "plus",
129
+ size: 15
130
+ })
131
+ ]),
132
+ d("button", {
133
+ type: "button",
134
+ class: "wi-right-panel__tab-action wi-right-panel__tab-action--maximize",
135
+ title: l.maximized ? "还原面板" : "最大化面板",
136
+ onClick: o[1] || (o[1] = (s) => n("toggle-maximize"))
137
+ }, [
138
+ M(E, {
139
+ name: l.maximized ? "restore" : "maximize",
140
+ size: 15
141
+ }, null, 8, ["name"])
142
+ ], 8, Je),
143
+ d("button", {
144
+ type: "button",
145
+ class: "wi-right-panel__tab-action wi-right-panel__tab-action--collapse",
146
+ title: "收起侧边栏",
147
+ onClick: o[2] || (o[2] = (s) => n("collapse"))
148
+ }, [
149
+ M(E, {
150
+ name: "sidebar",
151
+ size: 15
152
+ })
153
+ ])
154
+ ]));
155
+ }
156
+ }), Ye = /* @__PURE__ */ F(Qe, [["__scopeId", "data-v-0f712f34"]]), $e = () => typeof window > "u" ? {} : window, Me = () => {
157
+ var e;
158
+ const t = $e();
159
+ return !!((e = t.electronApp) != null && e.isElectron) || !!t.wiElectron || !!t.wiChatDesktop;
160
+ }, Ze = { class: "wi-right-panel__toolbar" }, et = ["disabled"], tt = ["disabled"], nt = {
161
+ key: 0,
162
+ class: "wi-right-panel__address-loading"
163
+ }, at = ["disabled"], it = /* @__PURE__ */ G({
164
+ __name: "BrowserToolbar",
165
+ props: {
166
+ tab: {},
167
+ panel: {}
168
+ },
169
+ setup(t) {
170
+ const e = t, n = y(() => e.panel.canGoBack.value), l = y(() => e.panel.canGoForward.value), o = R(""), s = R();
171
+ V(
172
+ () => e.tab.url,
173
+ (g) => {
174
+ o.value = g ?? "";
175
+ },
176
+ { immediate: !0 }
177
+ );
178
+ const _ = () => {
179
+ const g = o.value.trim();
180
+ g && e.panel.navigate(g);
181
+ }, T = () => {
182
+ const g = e.tab.url;
183
+ !g || typeof window > "u" || window.open(g, "_blank", "noopener,noreferrer");
184
+ };
185
+ return (g, w) => (h(), v("div", Ze, [
186
+ d("button", {
187
+ type: "button",
188
+ class: "wi-right-panel__tool",
189
+ disabled: !n.value,
190
+ title: "后退",
191
+ onClick: w[0] || (w[0] = (b) => g.panel.goBack())
192
+ }, [
193
+ M(E, {
194
+ name: "arrow-left",
195
+ size: 15
196
+ })
197
+ ], 8, et),
198
+ d("button", {
199
+ type: "button",
200
+ class: "wi-right-panel__tool",
201
+ disabled: !l.value,
202
+ title: "前进",
203
+ onClick: w[1] || (w[1] = (b) => g.panel.goForward())
204
+ }, [
205
+ M(E, {
206
+ name: "arrow-right",
207
+ size: 15
208
+ })
209
+ ], 8, tt),
210
+ d("button", {
211
+ type: "button",
212
+ class: "wi-right-panel__tool",
213
+ title: "刷新",
214
+ onClick: w[2] || (w[2] = (b) => g.panel.reload())
215
+ }, [
216
+ M(E, {
217
+ name: "reload",
218
+ size: 15
219
+ })
220
+ ]),
221
+ d("form", {
222
+ class: "wi-right-panel__address",
223
+ onSubmit: le(_, ["prevent"])
224
+ }, [
225
+ M(E, {
226
+ class: "wi-right-panel__address-icon",
227
+ name: "search",
228
+ size: 13
229
+ }),
230
+ be(d("input", {
231
+ ref_key: "inputRef",
232
+ ref: s,
233
+ "onUpdate:modelValue": w[3] || (w[3] = (b) => o.value = b),
234
+ class: "wi-right-panel__address-input",
235
+ type: "text",
236
+ placeholder: "搜索或输入网址",
237
+ spellcheck: "false",
238
+ autocomplete: "off"
239
+ }, null, 512), [
240
+ [Ae, o.value]
241
+ ]),
242
+ g.tab.loading ? (h(), v("span", nt)) : P("", !0)
243
+ ], 32),
244
+ d("button", {
245
+ type: "button",
246
+ class: "wi-right-panel__tool",
247
+ disabled: !g.tab.url,
248
+ title: "在新窗口打开",
249
+ onClick: T
250
+ }, [
251
+ M(E, {
252
+ name: "external",
253
+ size: 15
254
+ })
255
+ ], 8, at)
256
+ ]));
257
+ }
258
+ }), Ie = /* @__PURE__ */ F(it, [["__scopeId", "data-v-89af1cad"]]), ot = {
259
+ key: 0,
260
+ class: "wi-right-panel__section"
261
+ }, st = {
262
+ key: 0,
263
+ class: "wi-right-panel__section-title"
264
+ }, lt = ["title", "onClick"], rt = { class: "wi-right-panel__tool-card-label" }, ct = {
265
+ key: 0,
266
+ class: "wi-right-panel__tool-card-tag"
267
+ }, dt = {
268
+ key: 1,
269
+ class: "wi-right-panel__tool-card-shortcut"
270
+ }, ut = /* @__PURE__ */ G({
271
+ __name: "RightPanelToolList",
272
+ props: {
273
+ tools: {},
274
+ title: { default: "工具" },
275
+ columns: { default: 2 }
276
+ },
277
+ emits: ["tool-click"],
278
+ setup(t, { emit: e }) {
279
+ const n = e, l = (o) => {
280
+ n("tool-click", o);
281
+ };
282
+ return (o, s) => o.tools.length ? (h(), v("section", ot, [
283
+ o.title ? (h(), v("h4", st, z(o.title), 1)) : P("", !0),
284
+ d("div", {
285
+ class: "wi-right-panel__tools",
286
+ style: fe({ gridTemplateColumns: `repeat(${o.columns}, minmax(0, 1fr))` })
287
+ }, [
288
+ (h(!0), v(B, null, Q(o.tools, (_) => (h(), v("button", {
289
+ key: _.key,
290
+ type: "button",
291
+ class: se(["wi-right-panel__tool-card", { "is-disabled": _.disabled }]),
292
+ title: _.description ?? _.label,
293
+ onClick: (T) => l(_)
294
+ }, [
295
+ M(E, {
296
+ name: _.icon,
297
+ size: 16
298
+ }, null, 8, ["name"]),
299
+ d("span", rt, z(_.label), 1),
300
+ _.disabled ? (h(), v("span", ct, "即将支持")) : _.shortcut ? (h(), v("span", dt, z(_.shortcut), 1)) : P("", !0)
301
+ ], 10, lt))), 128))
302
+ ], 4)
303
+ ])) : P("", !0);
304
+ }
305
+ }), pt = /* @__PURE__ */ F(ut, [["__scopeId", "data-v-edb8e61a"]]), ht = [], vt = [
306
+ {
307
+ title: "地图 Demo · OpenLayers",
308
+ url: "https://openlayers.org/",
309
+ description: "OpenLayers 官方示例站"
310
+ },
311
+ {
312
+ title: "127.0.0.1",
313
+ url: "http://127.0.0.1:8890",
314
+ description: "本机开发服务"
315
+ }
316
+ ], _t = (t) => (re("data-v-1d433f71"), t = t(), ce(), t), gt = { class: "wi-right-panel__newtab" }, bt = { class: "wi-right-panel__newtab-body" }, ft = { class: "wi-right-panel__hero" }, mt = { class: "wi-right-panel__hero-title" }, wt = { class: "wi-right-panel__hero-desc" }, yt = {
317
+ key: 0,
318
+ class: "wi-right-panel__section"
319
+ }, Tt = /* @__PURE__ */ _t(() => /* @__PURE__ */ d("h4", { class: "wi-right-panel__section-title" }, "推荐", -1)), kt = { class: "wi-right-panel__recommendations" }, $t = ["title", "onClick"], Mt = { class: "wi-right-panel__recommendation-icon" }, It = { class: "wi-right-panel__recommendation-title" }, Et = /* @__PURE__ */ G({
320
+ __name: "NewTabPanel",
321
+ props: {
322
+ tab: {},
323
+ panel: {}
324
+ },
325
+ emits: ["tool-click"],
326
+ setup(t, { emit: e }) {
327
+ const n = t, l = e, o = y(() => n.panel.options.tools ?? ht), s = y(() => n.panel.options.recommendations ?? vt), _ = Me() ? "在这里打开网页或终端,与对话并行使用;每个标签页都会各自保留页面状态。" : "在这里打开网页,与对话并行使用;每个标签页都会各自保留页面状态。", T = (b) => {
328
+ l("tool-click", b);
329
+ }, g = (b) => {
330
+ n.panel.navigate(b.url, b.title);
331
+ }, w = (b) => b.trim().charAt(0).toUpperCase() || "·";
332
+ return (b, S) => (h(), v("div", gt, [
333
+ M(Ie, {
334
+ tab: b.tab,
335
+ panel: b.panel
336
+ }, null, 8, ["tab", "panel"]),
337
+ d("div", bt, [
338
+ d("section", ft, [
339
+ d("h3", mt, z(b.panel.options.newTabTitle), 1),
340
+ d("p", wt, z(me(_)), 1)
341
+ ]),
342
+ M(pt, {
343
+ tools: o.value,
344
+ onToolClick: T
345
+ }, null, 8, ["tools"]),
346
+ s.value.length ? (h(), v("section", yt, [
347
+ Tt,
348
+ d("div", kt, [
349
+ (h(!0), v(B, null, Q(s.value, ($) => (h(), v("button", {
350
+ key: $.url,
351
+ type: "button",
352
+ class: "wi-right-panel__recommendation",
353
+ title: $.description ?? $.url,
354
+ onClick: (m) => g($)
355
+ }, [
356
+ d("span", Mt, [
357
+ $.icon ? (h(), we(E, {
358
+ key: 0,
359
+ name: $.icon,
360
+ size: 17
361
+ }, null, 8, ["name"])) : (h(), v(B, { key: 1 }, [
362
+ We(z(w($.title)), 1)
363
+ ], 64))
364
+ ]),
365
+ d("span", It, z($.title), 1)
366
+ ], 8, $t))), 128))
367
+ ])
368
+ ])) : P("", !0)
369
+ ])
370
+ ]));
371
+ }
372
+ }), Rt = /* @__PURE__ */ F(Et, [["__scopeId", "data-v-1d433f71"]]), zt = {
373
+ type: "newtab",
374
+ defaultTitle: "新建标签页",
375
+ icon: "newtab",
376
+ component: Rt
377
+ }, Pt = "persist:wi-right-panel", St = () => {
378
+ var n, l, o;
379
+ if (typeof window > "u" || typeof document > "u")
380
+ return !1;
381
+ const t = $e();
382
+ return !!((n = t.electronApp) != null && n.isElectron) || !!t.wiElectron ? ((l = t.wiElectron) == null ? void 0 : l.rightPanelWebviewEnabled) === !0 || ((o = t.electronApp) == null ? void 0 : o.rightPanelWebviewEnabled) === !0 : !1;
383
+ }, Lt = (t) => t || (St() ? "webview" : "iframe"), Ct = (t, e = Pt) => {
384
+ const n = document.createElement("webview");
385
+ return n.className = "wi-right-panel__webview", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.background = "#fff", n.setAttribute("partition", e), t && n.setAttribute("src", t), n;
386
+ }, xt = (t) => (re("data-v-4ee42504"), t = t(), ce(), t), At = { class: "wi-right-panel__web" }, Wt = {
387
+ key: 0,
388
+ class: "wi-right-panel__frame-hint"
389
+ }, Nt = /* @__PURE__ */ xt(() => /* @__PURE__ */ d("span", null, "部分网站禁止被内嵌;若页面空白或显示禁止图标,请点右上角在新窗口打开。", -1)), Ot = { class: "wi-right-panel__web-body" }, Ut = ["src", "title"], Dt = {
390
+ key: 2,
391
+ class: "wi-right-panel__blocked"
392
+ }, Bt = { class: "wi-right-panel__blocked-title" }, Gt = { class: "wi-right-panel__blocked-desc" }, Ft = /* @__PURE__ */ G({
393
+ __name: "WebPanel",
394
+ props: {
395
+ tab: {},
396
+ panel: {},
397
+ runtime: {}
398
+ },
399
+ setup(t) {
400
+ const e = t, n = Lt(e.runtime) === "webview", l = y(() => `${e.tab.id}-${e.tab.reloadKey ?? 0}`), o = R(!1), s = () => {
401
+ o.value = !1, e.panel.reload(), n || b();
402
+ }, _ = () => {
403
+ const i = e.tab.url;
404
+ !i || typeof window > "u" || window.open(i, "_blank", "noopener,noreferrer");
405
+ }, T = R(!1);
406
+ let g;
407
+ const w = () => {
408
+ g && clearTimeout(g), g = void 0;
409
+ };
410
+ function b() {
411
+ w(), T.value = !1, o.value = !1, g = setTimeout(() => {
412
+ T.value || (o.value = !0);
413
+ }, 8e3);
414
+ }
415
+ const S = (i) => {
416
+ var u, k;
417
+ T.value = !0, o.value = !1, w(), e.panel.updateTab(e.tab.id, { loading: !1 });
418
+ try {
419
+ const D = (k = (u = i.target.contentDocument) == null ? void 0 : u.title) == null ? void 0 : k.trim();
420
+ D && e.panel.updateTab(e.tab.id, { title: D });
421
+ } catch {
422
+ }
423
+ };
424
+ V(
425
+ () => e.tab.url,
426
+ (i) => {
427
+ !i || n || (e.panel.updateTab(e.tab.id, { loading: !0 }), b());
428
+ }
429
+ );
430
+ const $ = R();
431
+ let m = null;
432
+ const C = R(e.tab.url ?? "");
433
+ let x = "";
434
+ const W = (i) => {
435
+ if (i) {
436
+ if (!m) {
437
+ x = i;
438
+ return;
439
+ }
440
+ i !== C.value && (C.value = i, e.panel.updateTab(e.tab.id, { loading: !0 }), m.setAttribute("src", i));
441
+ }
442
+ }, H = () => {
443
+ o.value = !1, e.panel.updateTab(e.tab.id, { loading: !0 });
444
+ }, X = () => {
445
+ e.panel.updateTab(e.tab.id, { loading: !1 });
446
+ }, N = (i) => {
447
+ const u = i;
448
+ u.isMainFrame === !1 || !u.url || u.url === "about:blank" || (C.value = u.url, e.panel.recordNavigation(u.url, void 0, e.tab.id));
449
+ }, O = (i) => {
450
+ const u = i;
451
+ u.title && e.panel.updateTab(e.tab.id, { title: u.title });
452
+ }, q = (i) => {
453
+ const u = i;
454
+ u.isMainFrame === !1 || !u.errorCode || u.errorCode === -3 || (o.value = !0, e.panel.updateTab(e.tab.id, { loading: !1 }));
455
+ }, U = () => {
456
+ if (!m)
457
+ return;
458
+ const i = typeof m.getURL == "function" ? m.getURL() : m.getAttribute("src") || "";
459
+ if (i && (C.value = i), e.panel.updateTab(e.tab.id, { loading: !1 }), x) {
460
+ const u = x;
461
+ x = "", W(u);
462
+ }
463
+ }, K = () => {
464
+ if (!n || !$.value)
465
+ return;
466
+ const i = Ct(e.tab.url ?? "");
467
+ m = i, i.addEventListener("did-start-loading", H), i.addEventListener("did-stop-loading", X), i.addEventListener("did-navigate", N), i.addEventListener("did-navigate-in-page", N), i.addEventListener("page-title-updated", O), i.addEventListener("did-fail-load", q), i.addEventListener("dom-ready", U), $.value.replaceChildren(i);
468
+ };
469
+ return V(
470
+ () => e.tab.url,
471
+ (i) => {
472
+ !i || !n || W(i);
473
+ }
474
+ ), ye(() => {
475
+ n ? K() : b();
476
+ }), Te(() => {
477
+ w(), m && (m.remove(), m = null);
478
+ }), (i, u) => (h(), v("div", At, [
479
+ M(Ie, {
480
+ tab: i.tab,
481
+ panel: i.panel
482
+ }, null, 8, ["tab", "panel"]),
483
+ n ? P("", !0) : (h(), v("div", Wt, [
484
+ M(E, {
485
+ name: "alert",
486
+ size: 12
487
+ }),
488
+ Nt
489
+ ])),
490
+ d("div", Ot, [
491
+ n ? (h(), v("div", {
492
+ key: 0,
493
+ ref_key: "webviewHostRef",
494
+ ref: $,
495
+ class: "wi-right-panel__webview-host"
496
+ }, null, 512)) : i.tab.url ? (h(), v("iframe", {
497
+ key: l.value,
498
+ class: "wi-right-panel__iframe",
499
+ src: i.tab.url,
500
+ title: i.tab.title,
501
+ referrerpolicy: "no-referrer",
502
+ onLoad: S
503
+ }, null, 40, Ut)) : P("", !0),
504
+ o.value ? (h(), v("div", Dt, [
505
+ M(E, {
506
+ name: "alert",
507
+ size: 30
508
+ }),
509
+ d("p", Bt, z(n ? "页面加载失败" : "该页面可能不允许被嵌入"), 1),
510
+ d("p", Gt, z(n ? "请检查网络或地址是否正确,也可以在新窗口打开。" : "部分网站会通过 X-Frame-Options / CSP 禁止在 iframe 中打开,可在新窗口访问。"), 1),
511
+ d("div", { class: "wi-right-panel__blocked-actions" }, [
512
+ d("button", {
513
+ type: "button",
514
+ class: "wi-right-panel__ghost-button",
515
+ onClick: s
516
+ }, "重试"),
517
+ d("button", {
518
+ type: "button",
519
+ class: "wi-right-panel__primary-button",
520
+ onClick: _
521
+ }, "在新窗口打开")
522
+ ])
523
+ ])) : P("", !0)
524
+ ])
525
+ ]));
526
+ }
527
+ }), Ht = /* @__PURE__ */ F(Ft, [["__scopeId", "data-v-4ee42504"]]), Kt = {
528
+ type: "web",
529
+ defaultTitle: "网页",
530
+ icon: "globe",
531
+ component: Ht
532
+ }, Ee = [zt, Kt], Re = (t = []) => {
533
+ const e = Ne(/* @__PURE__ */ new Map());
534
+ return t.forEach((n) => e.set(n.type, n)), {
535
+ register(n) {
536
+ return e.set(n.type, n), () => {
537
+ e.get(n.type) === n && e.delete(n.type);
538
+ };
539
+ },
540
+ get(n) {
541
+ return e.get(n);
542
+ },
543
+ list() {
544
+ return Array.from(e.values());
545
+ }
546
+ };
547
+ }, de = Re(Ee), bn = (t, e = de) => e.register(t), fn = (t, e = de) => e.get(t), ze = "https://www.bing.com/search?q={q}", Vt = Math.random().toString(36).slice(2, 8), jt = {
548
+ initialWidth: 480,
549
+ minWidth: 360,
550
+ maxWidth: 900,
551
+ maxTabs: 10,
552
+ searchUrlTemplate: ze,
553
+ defaultTabType: "newtab",
554
+ newTabTitle: "新建标签页"
555
+ }, Z = (t) => {
556
+ try {
557
+ return new URL(t).host || t;
558
+ } catch {
559
+ return t;
560
+ }
561
+ }, ae = (t, e = ze) => {
562
+ const n = (t ?? "").trim();
563
+ if (!n || /^(javascript|data|vbscript|file|about):/i.test(n))
564
+ return "";
565
+ if (/^https?:\/\//i.test(n))
566
+ return n;
567
+ if (/^([\w-]+\.)*[\w-]+(:\d+)?(\/\S*)?$/i.test(n)) {
568
+ if (/^localhost(:\d+)?(\/.*)?$/i.test(n) || /^(\d{1,3}\.){3}\d{1,3}(:\d+)?(\/.*)?$/i.test(n))
569
+ return `http://${n}`;
570
+ if (/^[\w.-]+:\d+/.test(n))
571
+ return `http://${n}`;
572
+ if (/^([\w-]+\.)+[a-z]{2,}(:\d+)?(\/.*)?$/i.test(n))
573
+ return `https://${n}`;
574
+ }
575
+ return e.replace("{q}", encodeURIComponent(n));
576
+ }, Xt = (t = {}) => {
577
+ const e = ke({
578
+ ...jt,
579
+ ...Object.fromEntries(Object.entries(t).filter(([a, r]) => a !== "registry" && r !== void 0))
580
+ }), n = t.registry ?? Re(Ee), l = R(!1), o = R([]), s = R(""), _ = R(!1), T = R(!1);
581
+ let g = 0;
582
+ const w = () => `right-panel-${++g}-${Vt}`, b = () => typeof window > "u" ? e.maxWidth : Math.min(e.maxWidth, Math.max(e.minWidth, window.innerWidth * 0.7)), S = (a) => {
583
+ const r = b();
584
+ return Math.round(Math.min(Math.max(a, e.minWidth), r));
585
+ }, $ = R(S(t.initialWidth ?? e.initialWidth)), m = y(() => o.value.find((a) => a.id === s.value) ?? null), C = y(() => {
586
+ var a;
587
+ return (((a = m.value) == null ? void 0 : a.historyIndex) ?? -1) > 0;
588
+ }), x = y(() => {
589
+ const a = m.value;
590
+ return !!a && a.historyIndex >= 0 && a.historyIndex < a.history.length - 1;
591
+ }), W = () => {
592
+ l.value = !0;
593
+ }, H = () => {
594
+ l.value = !1, _.value = !1;
595
+ }, X = () => {
596
+ l.value = !l.value, l.value || (_.value = !1);
597
+ }, N = (a) => {
598
+ _.value = a, a && (l.value = !0);
599
+ }, O = () => N(!_.value), q = (a) => {
600
+ $.value = S(a);
601
+ }, U = (a) => {
602
+ var ve;
603
+ const r = typeof a == "string" ? { type: a } : a ?? {}, f = r.type ?? e.defaultTabType, c = n.get(f);
604
+ if (c != null && c.singleton) {
605
+ const ne = o.value.find((xe) => xe.type === f);
606
+ if (ne)
607
+ return s.value = ne.id, l.value = !0, ne;
608
+ }
609
+ if (o.value.length >= e.maxTabs)
610
+ return null;
611
+ const p = ((ve = c == null ? void 0 : c.createTab) == null ? void 0 : ve.call(c, r)) ?? {}, I = r.url ?? p.url ?? "", Y = w(), te = {
612
+ ...p,
613
+ id: Y,
614
+ type: f,
615
+ title: r.title ?? p.title ?? (c == null ? void 0 : c.defaultTitle) ?? f,
616
+ icon: r.icon ?? p.icon ?? (c == null ? void 0 : c.icon) ?? (f === "newtab" ? "newtab" : "globe"),
617
+ url: I || void 0,
618
+ // 调用方传入的 data 优先于面板定义 createTab 的默认 data
619
+ data: r.data ?? p.data,
620
+ history: I ? [I] : [],
621
+ historyIndex: I ? 0 : -1,
622
+ loading: !1,
623
+ reloadKey: 0
624
+ };
625
+ return I && !r.title && !p.title && (te.title = Z(I)), o.value.push(te), r.activate !== !1 && (s.value = Y), l.value = !0, te;
626
+ }, K = (a, r) => {
627
+ const f = ae(a, e.searchUrlTemplate);
628
+ return f ? U({ type: "web", url: f, title: r }) : null;
629
+ }, i = (a) => !!a && (a.type === "web" || a.type === "newtab"), u = (a, r) => {
630
+ const f = ae(a, e.searchUrlTemplate);
631
+ if (!f)
632
+ return;
633
+ const c = m.value;
634
+ if (!i(c)) {
635
+ U({ type: "web", url: f, title: r });
636
+ return;
637
+ }
638
+ if (c.url === f) {
639
+ c.reloadKey = (c.reloadKey ?? 0) + 1, c.loading = !0;
640
+ return;
641
+ }
642
+ const p = c.history.slice(0, c.historyIndex + 1);
643
+ p.push(f), c.type = "web", c.icon = "globe", c.url = f, c.title = r ?? Z(f), c.history = p, c.historyIndex = p.length - 1, c.loading = !0;
644
+ }, k = (a) => {
645
+ u(a);
646
+ }, A = (a) => {
647
+ const r = o.value.findIndex((c) => c.id === a);
648
+ if (r < 0)
649
+ return;
650
+ if (o.value.splice(r, 1), !o.value.length) {
651
+ s.value = "", H();
652
+ return;
653
+ }
654
+ if (s.value !== a)
655
+ return;
656
+ const f = o.value[r] ?? o.value[r - 1] ?? null;
657
+ s.value = (f == null ? void 0 : f.id) ?? "";
658
+ }, D = (a) => {
659
+ o.value.some((r) => r.id === a) && (s.value = a);
660
+ }, ee = (a, r) => {
661
+ const f = o.value.find((c) => c.id === a);
662
+ f && Object.assign(f, r);
663
+ }, Ce = (a, r, f) => {
664
+ const c = ae(a, e.searchUrlTemplate);
665
+ if (!c)
666
+ return;
667
+ const p = f ? o.value.find((Y) => Y.id === f) : m.value;
668
+ if (!p || p.type !== "web" && p.type !== "newtab")
669
+ return;
670
+ if (p.url === c) {
671
+ r && (p.title = r);
672
+ return;
673
+ }
674
+ const I = p.history.slice(0, p.historyIndex + 1);
675
+ I.push(c), p.type === "newtab" && (p.type = "web", p.icon = "globe"), p.url = c, p.title = r ?? Z(c), p.history = I, p.historyIndex = I.length - 1;
676
+ }, he = (a) => {
677
+ const r = m.value;
678
+ !r || a < 0 || a >= r.history.length || (r.historyIndex = a, r.url = r.history[a], r.title = Z(r.url), r.loading = !0);
679
+ };
680
+ return {
681
+ isOpen: l,
682
+ width: $,
683
+ maximized: _,
684
+ tabs: o,
685
+ activeTabId: s,
686
+ activeTab: m,
687
+ canGoBack: C,
688
+ canGoForward: x,
689
+ isRestoring: T,
690
+ options: e,
691
+ registry: n,
692
+ open: W,
693
+ close: H,
694
+ toggle: X,
695
+ setMaximized: N,
696
+ toggleMaximized: O,
697
+ setWidth: q,
698
+ addTab: U,
699
+ openInNewTab: K,
700
+ openInActiveTab: k,
701
+ closeTab: A,
702
+ activateTab: D,
703
+ updateTab: ee,
704
+ navigate: u,
705
+ recordNavigation: Ce,
706
+ goBack: () => {
707
+ const a = m.value;
708
+ a && he(a.historyIndex - 1);
709
+ },
710
+ goForward: () => {
711
+ const a = m.value;
712
+ a && he(a.historyIndex + 1);
713
+ },
714
+ reload: () => {
715
+ const a = m.value;
716
+ a && (a.reloadKey = (a.reloadKey ?? 0) + 1, a.loading = !0);
717
+ },
718
+ reset: () => {
719
+ o.value = [], s.value = "", l.value = !1, _.value = !1, $.value = S(e.initialWidth);
720
+ },
721
+ snapshot: () => o.value.map((a) => ({
722
+ id: a.id,
723
+ type: a.type,
724
+ title: a.title,
725
+ icon: a.icon,
726
+ url: a.url,
727
+ history: [...a.history],
728
+ historyIndex: a.historyIndex,
729
+ data: a.data ? { ...a.data } : void 0
730
+ })),
731
+ restore: (a, r) => {
732
+ var c;
733
+ T.value = !0, o.value = (a ?? []).map((p) => {
734
+ var I;
735
+ return {
736
+ ...p,
737
+ history: [...p.history ?? []],
738
+ historyIndex: Math.min(Math.max(p.historyIndex ?? -1, -1), (((I = p.history) == null ? void 0 : I.length) ?? 0) - 1),
739
+ data: p.data ? { ...p.data } : void 0,
740
+ loading: !1,
741
+ reloadKey: 0
742
+ };
743
+ }), o.value.forEach((p) => {
744
+ const I = /^right-panel-(\d+)(?:-|$)/.exec(p.id);
745
+ I && (g = Math.max(g, Number(I[1])));
746
+ });
747
+ const f = r && o.value.some((p) => p.id === r) ? r : ((c = o.value[0]) == null ? void 0 : c.id) ?? "";
748
+ s.value = f, Oe(() => {
749
+ T.value = !1;
750
+ });
751
+ }
752
+ };
753
+ };
754
+ let ie;
755
+ const j = () => (ie || (ie = Xt({ registry: de })), ie), mn = (t) => {
756
+ const e = j();
757
+ Object.assign(e.options, t), typeof t.initialWidth == "number" && e.setWidth(t.initialWidth);
758
+ }, wn = () => {
759
+ j().reset();
760
+ }, ue = (t) => (re("data-v-752ff3da"), t = t(), ce(), t), qt = { class: "wi-right-panel__body" }, Jt = {
761
+ key: 1,
762
+ class: "wi-right-panel__unknown"
763
+ }, Qt = { class: "wi-right-panel__unknown-title" }, Yt = /* @__PURE__ */ ue(() => /* @__PURE__ */ d("p", { class: "wi-right-panel__unknown-desc" }, "请先通过 registerRightPanel 注册该类型的面板组件。", -1)), Zt = {
764
+ key: 1,
765
+ class: "wi-right-panel__lazy"
766
+ }, en = { class: "wi-right-panel__lazy-title" }, tn = /* @__PURE__ */ ue(() => /* @__PURE__ */ d("p", { class: "wi-right-panel__lazy-desc" }, "点击标签页加载内容", -1)), nn = {
767
+ key: 0,
768
+ class: "wi-right-panel__empty"
769
+ }, an = { class: "wi-right-panel__empty-icon" }, on = /* @__PURE__ */ ue(() => /* @__PURE__ */ d("p", { class: "wi-right-panel__empty-title" }, "还没有打开任何标签页", -1)), sn = { class: "wi-right-panel__empty-desc" }, ln = /* @__PURE__ */ G({
770
+ __name: "RightPanel",
771
+ props: {
772
+ panel: {},
773
+ enableShortcut: { type: Boolean, default: !0 }
774
+ },
775
+ emits: ["tool-click"],
776
+ setup(t, { expose: e, emit: n }) {
777
+ const l = t, o = n, s = y(() => l.panel ?? j()), _ = Me() ? "在这里打开网页或终端,与对话并行使用。" : "在这里打开网页,与对话并行使用。", T = y(() => s.value.isOpen.value), g = y(() => s.value.width.value), w = y(() => s.value.maximized.value), b = y(() => s.value.tabs.value), S = y(() => s.value.activeTabId.value), $ = y(() => b.value.map((i) => ({ tab: i, definition: s.value.registry.get(i.type) }))), m = ke(/* @__PURE__ */ new Set());
778
+ V(
779
+ S,
780
+ (i) => {
781
+ i && m.add(i);
782
+ },
783
+ { immediate: !0 }
784
+ ), V(
785
+ () => b.value.map((i) => i.id).join("|"),
786
+ () => {
787
+ const i = new Set(b.value.map((u) => u.id));
788
+ Array.from(m).forEach((u) => {
789
+ i.has(u) || m.delete(u);
790
+ });
791
+ }
792
+ );
793
+ const C = (i) => s.value.activateTab(i), x = (i) => s.value.closeTab(i), W = () => s.value.addTab(), H = () => s.value.close(), X = () => s.value.toggleMaximized(), N = (i) => o("tool-click", i), O = R(!1), q = (i) => {
794
+ if (typeof window > "u")
795
+ return;
796
+ O.value = !0;
797
+ const u = i.clientX, k = g.value, A = (ee) => {
798
+ s.value.setWidth(k + (u - ee.clientX));
799
+ }, D = () => {
800
+ O.value = !1, window.removeEventListener("pointermove", A), window.removeEventListener("pointerup", D);
801
+ };
802
+ window.addEventListener("pointermove", A), window.addEventListener("pointerup", D);
803
+ }, U = () => s.value.setWidth(s.value.options.initialWidth), K = (i) => {
804
+ if (!l.enableShortcut || !(i.ctrlKey || i.metaKey) || !i.shiftKey || i.key.toLowerCase() !== "b")
805
+ return;
806
+ const u = i.target, k = u == null ? void 0 : u.tagName;
807
+ k === "INPUT" || k === "TEXTAREA" || u != null && u.isContentEditable || (i.preventDefault(), s.value.addTab());
808
+ };
809
+ return ye(() => window.addEventListener("keydown", K)), Te(() => window.removeEventListener("keydown", K)), e({ panel: s }), (i, u) => T.value ? (h(), v("aside", {
810
+ key: 0,
811
+ class: se(["wi-right-panel", { "is-resizing": O.value, "is-maximized": w.value }]),
812
+ style: fe(w.value ? void 0 : { width: `${g.value}px` })
813
+ }, [
814
+ w.value ? P("", !0) : (h(), v("span", {
815
+ key: 0,
816
+ class: "wi-right-panel__resizer",
817
+ title: "拖拽调整宽度,双击恢复默认",
818
+ onPointerdown: le(q, ["stop", "prevent"]),
819
+ onDblclick: U
820
+ }, null, 32)),
821
+ M(Ye, {
822
+ tabs: b.value,
823
+ "active-id": S.value,
824
+ maximized: w.value,
825
+ onSelect: C,
826
+ onClose: x,
827
+ onAdd: W,
828
+ onCollapse: H,
829
+ onToggleMaximize: X
830
+ }, null, 8, ["tabs", "active-id", "maximized"]),
831
+ d("div", qt, [
832
+ (h(!0), v(B, null, Q($.value, (k) => {
833
+ var A;
834
+ return be((h(), v("div", {
835
+ key: k.tab.id,
836
+ class: "wi-right-panel__view"
837
+ }, [
838
+ m.has(k.tab.id) ? (h(), v(B, { key: 0 }, [
839
+ k.definition ? (h(), we(Ue((A = k.definition) == null ? void 0 : A.component), {
840
+ key: `${k.tab.id}-${k.tab.reloadKey ?? 0}`,
841
+ tab: k.tab,
842
+ panel: s.value,
843
+ onToolClick: N
844
+ }, null, 40, ["tab", "panel"])) : (h(), v("div", Jt, [
845
+ d("p", Qt, "未注册的面板类型:" + z(k.tab.type), 1),
846
+ Yt
847
+ ]))
848
+ ], 64)) : (h(), v("div", Zt, [
849
+ d("p", en, z(k.tab.title), 1),
850
+ tn
851
+ ]))
852
+ ])), [
853
+ [De, k.tab.id === S.value]
854
+ ]);
855
+ }), 128)),
856
+ b.value.length ? P("", !0) : (h(), v("div", nn, [
857
+ d("span", an, [
858
+ M(E, {
859
+ name: "newtab",
860
+ size: 30
861
+ })
862
+ ]),
863
+ on,
864
+ d("p", sn, z(me(_)), 1),
865
+ d("button", {
866
+ type: "button",
867
+ class: "wi-right-panel__empty-button",
868
+ onClick: W
869
+ }, "新建标签页")
870
+ ]))
871
+ ])
872
+ ], 6)) : P("", !0);
873
+ }
874
+ }), yn = /* @__PURE__ */ F(ln, [["__scopeId", "data-v-752ff3da"]]), oe = "wi-chat:right-panel-scope:", rn = () => ({
875
+ load(t) {
876
+ if (typeof localStorage > "u")
877
+ return null;
878
+ try {
879
+ const e = localStorage.getItem(oe + t);
880
+ if (!e)
881
+ return null;
882
+ const n = JSON.parse(e);
883
+ return Array.isArray(n == null ? void 0 : n.tabs) ? n : null;
884
+ } catch {
885
+ return null;
886
+ }
887
+ },
888
+ save(t, e) {
889
+ if (!(typeof localStorage > "u"))
890
+ try {
891
+ localStorage.setItem(oe + t, JSON.stringify(e));
892
+ } catch {
893
+ }
894
+ },
895
+ clear(t) {
896
+ if (!(typeof localStorage > "u"))
897
+ try {
898
+ localStorage.removeItem(oe + t);
899
+ } catch {
900
+ }
901
+ }
902
+ }), J = R("");
903
+ let L = rn(), pe = !0, ge = !1;
904
+ const Pe = /* @__PURE__ */ new Set(), Tn = (t = {}) => {
905
+ "storage" in t && (L = t.storage ?? null), typeof t.persist == "boolean" && (pe = t.persist);
906
+ }, kn = () => J.value, Se = (t) => {
907
+ const e = J.value;
908
+ if (!pe || !L || !e)
909
+ return;
910
+ const n = t.snapshot();
911
+ !n.length && !Pe.has(e) || L.save(e, {
912
+ scopeId: e,
913
+ tabs: n,
914
+ activeTabId: t.activeTabId.value,
915
+ savedAt: Date.now()
916
+ });
917
+ }, cn = (t) => {
918
+ ge || (ge = !0, V([t.tabs, t.activeTabId], () => Se(t), { deep: !0, flush: "post" }));
919
+ }, $n = (t, e = j()) => {
920
+ cn(e);
921
+ const n = String(t ?? "").trim();
922
+ if (n === J.value)
923
+ return;
924
+ if (Se(e), J.value = n, !n) {
925
+ e.restore([]);
926
+ return;
927
+ }
928
+ const l = pe && L ? L.load(n) : null;
929
+ Pe.add(n), e.restore((l == null ? void 0 : l.tabs) ?? [], l == null ? void 0 : l.activeTabId);
930
+ }, Mn = (t = J.value) => {
931
+ !t || !(L != null && L.clear) || L.clear(t);
932
+ }, Le = (t, e) => ({
933
+ id: t.id,
934
+ type: t.type,
935
+ title: t.title,
936
+ icon: t.icon,
937
+ url: t.url,
938
+ active: t.id === e
939
+ }), In = (t = {}) => {
940
+ const e = t.panel ?? j(), n = y(() => {
941
+ const T = e.activeTabId.value;
942
+ return e.tabs.value.map((g) => Le(g, T));
943
+ }), l = y(() => n.value.length > 0), o = y(() => n.value.length), s = y(() => e.activeTabId.value), _ = y(() => e.isOpen.value);
944
+ return {
945
+ tabs: n,
946
+ hasTabs: l,
947
+ tabCount: o,
948
+ activeTabId: s,
949
+ isOpen: _,
950
+ activateTab(T) {
951
+ e.activateTab(T), e.open();
952
+ },
953
+ addTab(T) {
954
+ e.addTab(T);
955
+ },
956
+ open() {
957
+ e.open();
958
+ },
959
+ toggle() {
960
+ e.toggle();
961
+ }
962
+ };
963
+ }, En = (t = j()) => {
964
+ const e = t.activeTabId.value;
965
+ return t.tabs.value.map((n) => Le(n, e));
966
+ };
967
+ export {
968
+ Ee as BUILTIN_RIGHT_PANELS,
969
+ Ie as BrowserToolbar,
970
+ vt as DEFAULT_NEW_TAB_RECOMMENDATIONS,
971
+ ht as DEFAULT_NEW_TAB_TOOLS,
972
+ ze as DEFAULT_SEARCH_URL_TEMPLATE,
973
+ _e as RIGHT_PANEL_ICONS,
974
+ oe as RIGHT_PANEL_SCOPE_STORAGE_PREFIX,
975
+ yn as RightPanel,
976
+ E as RightPanelIcon,
977
+ Ye as RightPanelTabs,
978
+ pt as RightPanelToolList,
979
+ Pt as WEBVIEW_PARTITION,
980
+ St as canUseWebview,
981
+ Mn as clearRightPanelScope,
982
+ mn as configureRightPanel,
983
+ Tn as configureRightPanelScope,
984
+ rn as createLocalStorageRightPanelScopeStorage,
985
+ Xt as createRightPanel,
986
+ Re as createRightPanelRegistry,
987
+ de as defaultRightPanelRegistry,
988
+ fn as getRightPanelDefinition,
989
+ kn as getRightPanelScope,
990
+ Me as isDesktopRuntime,
991
+ En as listRightPanelTabs,
992
+ zt as newTabPanelDefinition,
993
+ $e as readElectronBridge,
994
+ bn as registerRightPanel,
995
+ wn as resetRightPanel,
996
+ Z as resolveRightPanelTitle,
997
+ ae as resolveRightPanelUrl,
998
+ Lt as resolveWebRuntime,
999
+ $n as setRightPanelScope,
1000
+ j as useRightPanel,
1001
+ In as useRightPanelTabs,
1002
+ Kt as webPanelDefinition
1003
+ };
1004
+ //# sourceMappingURL=index.js.map