yc-component 0.1.15 → 0.1.17

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,59 +1,59 @@
1
- var Yt = Object.defineProperty;
2
- var jt = (e, n, t) => n in e ? Yt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
- var tt = (e, n, t) => jt(e, typeof n != "symbol" ? n + "" : n, t);
4
- import ut from "axios";
5
- import { reactive as ct, defineComponent as de, computed as P, ref as b, watch as ne, onMounted as Ke, onUnmounted as Ne, resolveComponent as B, resolveDirective as dt, openBlock as u, createBlock as M, withCtx as g, createElementVNode as T, createVNode as m, withKeys as Gt, unref as w, createCommentVNode as $, createTextVNode as G, createElementBlock as E, normalizeClass as fe, toDisplayString as D, Fragment as re, renderList as he, withDirectives as _e, renderSlot as ye, normalizeProps as ft, mergeProps as ze, withModifiers as Wt, nextTick as nt, render as qt, onBeforeUnmount as Ht, Transition as pt, normalizeStyle as ot, vShow as De, inject as Ye, Teleport as Jt, provide as Be, isRef as Xt } from "vue";
6
- import { ElMessage as Q } from "element-plus";
7
- import { Search as Qt, Upload as Zt, Check as mt, ArrowLeft as en, ArrowUpBold as tn, ArrowDownBold as nn, Switch as on, Close as gt, Refresh as lt, ArrowDown as ln, CircleCheck as an, CircleClose as sn, Remove as rn } from "@element-plus/icons-vue";
8
- import { storeToRefs as un, defineStore as cn } from "pinia";
9
- const je = {
1
+ var Wt = Object.defineProperty;
2
+ var qt = (e, n, t) => n in e ? Wt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var ot = (e, n, t) => qt(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import dt from "axios";
5
+ import { reactive as ft, defineComponent as ue, computed as P, ref as k, watch as ne, onMounted as Ke, onUnmounted as Ye, resolveComponent as V, resolveDirective as pt, openBlock as u, createBlock as E, withCtx as g, createElementVNode as T, createElementBlock as A, createVNode as m, withKeys as Ht, unref as w, createCommentVNode as b, createTextVNode as W, normalizeClass as me, toDisplayString as B, Fragment as ce, renderList as ye, withDirectives as we, renderSlot as Te, normalizeProps as mt, mergeProps as ze, withModifiers as Jt, nextTick as lt, render as Xt, onBeforeUnmount as Qt, Transition as gt, normalizeStyle as at, vShow as Be, inject as je, Teleport as Zt, provide as Ve, isRef as en } from "vue";
6
+ import { ElMessage as ee } from "element-plus";
7
+ import { Search as tn, Upload as nn, Check as vt, ArrowLeft as on, ArrowUpBold as ln, ArrowDownBold as an, Switch as sn, Close as _t, Refresh as it, ArrowDown as rn, CircleCheck as un, CircleClose as cn, Remove as dn } from "@element-plus/icons-vue";
8
+ import { storeToRefs as fn, defineStore as pn } from "pinia";
9
+ const Ge = {
10
10
  projectId: "default-project",
11
11
  storageKey: "yc-ai-task-queue-v1"
12
12
  };
13
- let we = { ...je };
14
- function dn(e) {
15
- we = { ...we, ...e };
13
+ let Ie = { ...Ge };
14
+ function mn(e) {
15
+ Ie = { ...Ie, ...e };
16
16
  }
17
- function vt() {
18
- return we;
17
+ function ht() {
18
+ return Ie;
19
19
  }
20
- function fn() {
21
- return we.projectId ?? je.projectId;
20
+ function gn() {
21
+ return Ie.projectId ?? Ge.projectId;
22
22
  }
23
- function ht() {
24
- return we.storageKey ?? je.storageKey;
23
+ function yt() {
24
+ return Ie.storageKey ?? Ge.storageKey;
25
25
  }
26
- let ce = null;
27
- function pn() {
28
- ce = null;
26
+ let de = null;
27
+ function vn() {
28
+ de = null;
29
29
  }
30
- function pe() {
31
- if (ce) return ce;
32
- const { baseURL: e, getToken: n, onUnauthorized: t } = vt();
33
- return ce = ut.create({
30
+ function ge() {
31
+ if (de) return de;
32
+ const { baseURL: e, getToken: n, onUnauthorized: t } = ht();
33
+ return de = dt.create({
34
34
  baseURL: e ?? "",
35
35
  timeout: 6e4,
36
36
  headers: { "Content-Type": "application/json" }
37
- }), ce.interceptors.request.use((o) => {
38
- const s = n == null ? void 0 : n();
39
- return s && (o.headers.Authorization = `Bearer ${s}`), o;
40
- }), ce.interceptors.response.use(
37
+ }), de.interceptors.request.use((o) => {
38
+ const l = n == null ? void 0 : n();
39
+ return l && (o.headers.Authorization = `Bearer ${l}`), o;
40
+ }), de.interceptors.response.use(
41
41
  (o) => {
42
- const s = o.data;
43
- return (s == null ? void 0 : s.code) != null && s.code !== 200 ? Promise.reject(new Error(s.message || "请求失败")) : (o.data = (s == null ? void 0 : s.data) ?? s, o);
42
+ const l = o.data;
43
+ return (l == null ? void 0 : l.code) != null && l.code !== 200 ? Promise.reject(new Error(l.message || "请求失败")) : (o.data = (l == null ? void 0 : l.data) ?? l, o);
44
44
  },
45
45
  (o) => {
46
- var d, v, _;
47
- ((d = o.response) == null ? void 0 : d.status) === 401 && (t == null || t());
48
- const s = (_ = (v = o.response) == null ? void 0 : v.data) == null ? void 0 : _.message;
49
- return Promise.reject(new Error(s || o.message || "请求失败"));
46
+ var y, c, h;
47
+ ((y = o.response) == null ? void 0 : y.status) === 401 && (t == null || t());
48
+ const l = (h = (c = o.response) == null ? void 0 : c.data) == null ? void 0 : h.message;
49
+ return Promise.reject(new Error(l || o.message || "请求失败"));
50
50
  }
51
- ), ce;
51
+ ), de;
52
52
  }
53
- async function mn(e, n) {
54
- const o = (await pe().get(
53
+ async function _n(e, n) {
54
+ const o = (await ge().get(
55
55
  `/yc-ai/workflows/runs/${e}/artifacts/${n}`,
56
- { transformResponse: [(s) => s] }
56
+ { transformResponse: [(l) => l] }
57
57
  )).data;
58
58
  if (typeof o == "string")
59
59
  try {
@@ -63,19 +63,19 @@ async function mn(e, n) {
63
63
  }
64
64
  return o;
65
65
  }
66
- let Ve = {};
67
- function gn(e) {
68
- Ve = { ...Ve, ...e };
66
+ let Oe = {};
67
+ function hn(e) {
68
+ Oe = { ...Oe, ...e };
69
69
  }
70
70
  function Ae() {
71
- return Ve;
71
+ return Oe;
72
72
  }
73
73
  class be extends Error {
74
74
  constructor(n = "Image selector cancelled") {
75
75
  super(n), this.name = "ImageSelectorCancelledError";
76
76
  }
77
77
  }
78
- class at extends Error {
78
+ class st extends Error {
79
79
  constructor(t, o) {
80
80
  super(o || {
81
81
  missing_token: "请先填写并保存云盘 Access Token",
@@ -83,71 +83,74 @@ class at extends Error {
83
83
  valid_site: "请先在云盘配置有效站点",
84
84
  unknown: "云盘鉴权失败"
85
85
  }[t]);
86
- tt(this, "reason");
86
+ ot(this, "reason");
87
87
  this.name = "ImageSelectorAuthError", this.reason = t;
88
88
  }
89
89
  }
90
- let Z = null;
91
- function vn() {
92
- return Z && (Z.reject(new be()), Z = null), new Promise((e, n) => {
93
- Z = { resolve: e, reject: n };
90
+ let te = null;
91
+ function yn() {
92
+ return te && (te.reject(new be()), te = null), new Promise((e, n) => {
93
+ te = { resolve: e, reject: n };
94
94
  });
95
95
  }
96
- function hn(e) {
97
- Z == null || Z.resolve(e), Z = null;
96
+ function wn(e) {
97
+ te == null || te.resolve(e), te = null;
98
98
  }
99
- function it() {
100
- Z == null || Z.reject(new be()), Z = null;
99
+ function rt() {
100
+ te == null || te.reject(new be()), te = null;
101
101
  }
102
- const $e = "__YC_COMPONENT_IMAGE_SELECTOR__", Oe = "yc-component:image-selector-open";
103
- function _n() {
102
+ const Le = "__YC_COMPONENT_IMAGE_SELECTOR__", Fe = "yc-component:image-selector-open";
103
+ function Tn() {
104
104
  const e = globalThis;
105
- return e[$e] || (e[$e] = ct({
105
+ return e[Le] || (e[Le] = ft({
106
106
  visible: !1,
107
107
  options: {}
108
- })), e[$e];
108
+ })), e[Le];
109
109
  }
110
- const q = _n();
111
- function yn(e = {}) {
112
- q.options = { ...e }, q.visible = !0, globalThis.dispatchEvent(
113
- new CustomEvent(Oe, { detail: { ...e } })
110
+ const J = Tn();
111
+ function In(e = {}) {
112
+ J.options = { ...e }, J.visible = !0, globalThis.dispatchEvent(
113
+ new CustomEvent(Fe, { detail: { ...e } })
114
114
  );
115
115
  }
116
- function _t() {
117
- q.visible = !1;
116
+ function wt() {
117
+ J.visible = !1;
118
118
  }
119
- function yt() {
120
- _t();
119
+ function Tt() {
120
+ wt();
121
121
  }
122
- function wt(e = {}) {
123
- const n = vn();
124
- return yn(e), n;
122
+ function It(e = {}) {
123
+ const n = yn();
124
+ return In(e), n;
125
125
  }
126
- const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__toolbar" }, In = { class: "yc-image-selector__body" }, Cn = {
126
+ const Cn = { class: "yc-image-selector" }, Sn = {
127
+ key: 0,
128
+ class: "yc-image-selector__toolbar"
129
+ }, xn = { class: "yc-image-selector__body" }, kn = {
127
130
  key: 0,
128
131
  class: "yc-image-selector__aside"
129
- }, Sn = ["onClick"], kn = {
132
+ }, En = ["onClick"], bn = {
130
133
  key: 0,
131
134
  class: "yc-image-selector__category-count"
132
- }, xn = { class: "yc-image-selector__main" }, bn = {
135
+ }, An = { class: "yc-image-selector__main" }, Mn = {
133
136
  key: 1,
134
137
  class: "yc-image-selector__grid"
135
- }, An = ["onClick"], En = { class: "yc-image-selector__thumb" }, Mn = ["src", "alt", "onLoad"], Pn = {
138
+ }, Pn = ["onClick"], $n = { class: "yc-image-selector__thumb" }, Ln = ["src", "alt", "onLoad"], Dn = {
136
139
  key: 0,
137
140
  class: "yc-image-selector__order"
138
- }, $n = ["title"], Ln = {
139
- key: 0,
140
- class: "yc-image-selector__selected-bar"
141
- }, Dn = { class: "yc-image-selector__selected-bar-label" }, Bn = { class: "yc-image-selector__selected-bar-list" }, Vn = ["onClick"], On = ["src", "alt"], Un = {
141
+ }, Bn = ["title"], Vn = {
142
142
  key: 1,
143
+ class: "yc-image-selector__selected-bar"
144
+ }, On = { class: "yc-image-selector__selected-bar-label" }, Fn = { class: "yc-image-selector__selected-bar-list" }, Un = ["onClick"], Rn = ["src", "alt"], Nn = {
145
+ key: 2,
143
146
  class: "yc-image-selector__pagination"
144
- }, Fn = {
147
+ }, Kn = {
145
148
  key: 0,
146
149
  class: "yc-image-selector__footer"
147
- }, Rn = { class: "yc-image-selector__selected-tip" }, Kn = { class: "yc-image-selector__footer-actions" }, Nn = {
150
+ }, Yn = { class: "yc-image-selector__footer-left" }, zn = { class: "yc-image-selector__selected-tip" }, jn = { class: "yc-image-selector__footer-actions" }, Gn = {
148
151
  key: 1,
149
152
  class: "yc-image-selector__footer yc-image-selector__footer--quick"
150
- }, zn = { class: "yc-image-selector__selected-tip" }, Yn = /* @__PURE__ */ de({
153
+ }, Wn = { class: "yc-image-selector__footer-left" }, qn = { class: "yc-image-selector__selected-tip" }, Hn = /* @__PURE__ */ ue({
151
154
  __name: "YcImageSelectorDialog",
152
155
  props: {
153
156
  modelValue: { type: [Boolean, null], default: null },
@@ -168,13 +171,14 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
168
171
  cancelText: { default: "取消" },
169
172
  emptyText: { default: "暂无图片资源" },
170
173
  renderEmpty: {},
174
+ renderFooterExtra: {},
171
175
  getImages: {},
172
176
  upload: {},
173
177
  urlField: { default: "url" }
174
178
  },
175
179
  emits: ["update:modelValue", "confirm", "cancel"],
176
180
  setup(e, { emit: n }) {
177
- const t = de({
181
+ const t = ue({
178
182
  name: "YcImageSelectorRenderEmpty",
179
183
  props: {
180
184
  render: {
@@ -189,294 +193,333 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
189
193
  setup(a) {
190
194
  return () => a.render(a.ctx);
191
195
  }
192
- }), o = e, s = n, d = P(() => o.modelValue != null), v = b(!1), _ = b(null);
196
+ }), o = ue({
197
+ name: "YcImageSelectorRenderFooterExtra",
198
+ props: {
199
+ render: {
200
+ type: Function,
201
+ required: !0
202
+ },
203
+ ctx: {
204
+ type: Object,
205
+ required: !0
206
+ }
207
+ },
208
+ setup(a) {
209
+ return () => a.render(a.ctx);
210
+ }
211
+ }), l = e, y = n, c = P(() => l.modelValue != null), h = k(!1), p = k(null);
193
212
  ne(
194
- () => o.modelValue,
213
+ () => l.modelValue,
195
214
  (a) => {
196
- d.value && (v.value = !!a);
215
+ c.value && (h.value = !!a);
197
216
  },
198
217
  { immediate: !0 }
199
- ), ne(v, (a) => {
200
- if (d.value) {
201
- s("update:modelValue", a);
218
+ ), ne(h, (a) => {
219
+ if (c.value) {
220
+ y("update:modelValue", a);
202
221
  return;
203
222
  }
204
- q.visible = a, a || _t();
223
+ J.visible = a, a || wt();
205
224
  }), ne(
206
- () => q.visible,
225
+ () => J.visible,
207
226
  (a) => {
208
- d.value || (v.value = a);
227
+ c.value || (h.value = a);
209
228
  },
210
229
  { immediate: !0 }
211
230
  );
212
- const y = P(
213
- () => (d.value ? void 0 : q.options.title) ?? o.title ?? "选择图片"
214
- ), r = P(
215
- () => (d.value ? void 0 : q.options.multiple) ?? o.multiple
216
- ), C = P(
217
- () => (d.value ? void 0 : q.options.maxCount) ?? o.maxCount
218
- ), V = P(
219
- () => (d.value ? void 0 : q.options.showModeSwitch) ?? o.showModeSwitch
220
- ), F = P(
221
- () => (d.value ? void 0 : q.options.showCategories) ?? o.showCategories
222
- ), X = P(() => {
223
- var a, l;
224
- if ((a = o.categories) != null && a.length) return o.categories;
225
- if (!d.value && ((l = q.options.categories) != null && l.length))
226
- return q.options.categories;
227
- }), O = P(() => F.value ? X.value ?? ee.value : []), f = P(
228
- () => (d.value ? void 0 : q.options.confirmOnSelect) ?? o.confirmOnSelect
229
- ), L = b("single"), H = [
231
+ const r = P(
232
+ () => (c.value ? void 0 : J.options.title) ?? l.title ?? "选择图片"
233
+ ), S = P(
234
+ () => (c.value ? void 0 : J.options.multiple) ?? l.multiple
235
+ ), D = P(
236
+ () => (c.value ? void 0 : J.options.maxCount) ?? l.maxCount
237
+ ), N = P(
238
+ () => (c.value ? void 0 : J.options.showModeSwitch) ?? l.showModeSwitch
239
+ ), q = P(
240
+ () => (c.value ? void 0 : J.options.showCategories) ?? l.showCategories
241
+ ), F = P(() => {
242
+ var a, i;
243
+ if ((a = l.categories) != null && a.length) return l.categories;
244
+ if (!c.value && ((i = J.options.categories) != null && i.length))
245
+ return J.options.categories;
246
+ }), v = P(() => q.value ? F.value ?? Q.value : []), L = P(
247
+ () => (c.value ? void 0 : J.options.confirmOnSelect) ?? l.confirmOnSelect
248
+ ), z = k("single"), $ = [
230
249
  { label: "单选", value: "single" },
231
250
  { label: "多选", value: "multiple" }
232
- ], S = P(
233
- () => V.value ? L.value === "multiple" : r.value
234
- ), U = b(""), N = b(""), h = b(1), k = b(0), Y = b(!1), j = b(!1), W = b([]), ee = b([]), A = b(/* @__PURE__ */ new Map()), oe = b(/* @__PURE__ */ new Map()), le = b(), te = b(), R = b(!1), z = P(() => [...A.value.values()]), Te = P(() => !!_.value || W.value.length === 0), Ie = P(() => ({
235
- authState: _.value,
236
- isEmpty: W.value.length === 0,
237
- reload: me
238
- })), Ce = P(() => {
239
- var l, x;
240
- const a = z.value.length;
241
- return f.value ? a ? `已选:${((l = z.value[0]) == null ? void 0 : l.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? S.value ? `已选 ${a} / ${C.value} 张` : `已选:${((x = z.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : S.value ? `多选模式:最多 ${C.value} 张` : "单选模式:请选择一张图片";
251
+ ], M = P(
252
+ () => N.value ? z.value === "multiple" : S.value
253
+ ), Y = k(""), _ = k(""), C = k(1), K = k(0), j = k(!1), X = k(!1), H = k([]), Q = k([]), O = k(/* @__PURE__ */ new Map()), Z = k(/* @__PURE__ */ new Map()), se = k(), U = k(), oe = k(!1), G = P(() => [...O.value.values()]), Ce = P(() => !!p.value || H.value.length === 0), Se = P(() => ({
254
+ authState: p.value,
255
+ isEmpty: H.value.length === 0,
256
+ reload: ve
257
+ }));
258
+ function s(a) {
259
+ p.value = {
260
+ reason: (a == null ? void 0 : a.reason) ?? "missing_token",
261
+ message: a == null ? void 0 : a.message
262
+ }, H.value = [], K.value = 0, Q.value = [], Y.value = "", _.value = "", C.value = 1;
263
+ }
264
+ const f = P(() => ({
265
+ isAuthenticated: !p.value,
266
+ enterAuthSetup: s
267
+ })), d = P(() => {
268
+ var i, x;
269
+ const a = G.value.length;
270
+ return L.value ? a ? `已选:${((i = G.value[0]) == null ? void 0 : i.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? M.value ? `已选 ${a} / ${D.value} 张` : `已选:${((x = G.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : M.value ? `多选模式:最多 ${D.value} 张` : "单选模式:请选择一张图片";
242
271
  });
243
- function i(a) {
244
- const l = z.value.findIndex((x) => J(x) === J(a));
245
- return l >= 0 ? l + 1 : "";
272
+ function R(a) {
273
+ const i = G.value.findIndex((x) => le(x) === le(a));
274
+ return i >= 0 ? i + 1 : "";
246
275
  }
247
- function p(a) {
248
- if (a === "single" && z.value.length > 1) {
249
- const l = z.value[0];
250
- A.value = /* @__PURE__ */ new Map([[J(l), l]]), Q.info("已切换为单选,仅保留第一张");
276
+ function fe(a) {
277
+ if (a === "single" && G.value.length > 1) {
278
+ const i = G.value[0];
279
+ O.value = /* @__PURE__ */ new Map([[le(i), i]]), ee.info("已切换为单选,仅保留第一张");
251
280
  }
252
281
  }
253
- function c() {
254
- L.value = r.value ? "multiple" : "single";
282
+ function pe() {
283
+ z.value = S.value ? "multiple" : "single";
255
284
  }
256
- function K() {
257
- A.value = /* @__PURE__ */ new Map();
285
+ function Dt() {
286
+ O.value = /* @__PURE__ */ new Map();
258
287
  }
259
- function ue(a) {
260
- return a[o.urlField];
288
+ function He(a) {
289
+ return a[l.urlField];
261
290
  }
262
- function J(a) {
291
+ function le(a) {
263
292
  return a.id ?? a.url;
264
293
  }
265
- function Se(a) {
266
- return A.value.has(J(a));
294
+ function xe(a) {
295
+ return O.value.has(le(a));
267
296
  }
268
- function qe(a, l) {
269
- return a < l ? "portrait" : a > l ? "landscape" : "square";
297
+ function Je(a, i) {
298
+ return a < i ? "portrait" : a > i ? "landscape" : "square";
270
299
  }
271
- function He(a, l) {
272
- const x = J(a);
273
- oe.value.get(x) !== l && (oe.value.set(x, l), oe.value = new Map(oe.value));
300
+ function Xe(a, i) {
301
+ const x = le(a);
302
+ Z.value.get(x) !== i && (Z.value.set(x, i), Z.value = new Map(Z.value));
274
303
  }
275
- function $t(a) {
276
- const l = oe.value.get(J(a));
277
- return l ? `yc-image-selector__img--${l}` : "";
304
+ function Bt(a) {
305
+ const i = Z.value.get(le(a));
306
+ return i ? `yc-image-selector__img--${i}` : "";
278
307
  }
279
- function Lt(a, l) {
308
+ function Vt(a, i) {
280
309
  const x = a.target;
281
- !(x != null && x.naturalWidth) || !(x != null && x.naturalHeight) || He(l, qe(x.naturalWidth, x.naturalHeight));
310
+ !(x != null && x.naturalWidth) || !(x != null && x.naturalHeight) || Xe(i, Je(x.naturalWidth, x.naturalHeight));
282
311
  }
283
- function Dt(a) {
284
- a.width && a.height && He(a, qe(a.width, a.height));
312
+ function Ot(a) {
313
+ a.width && a.height && Xe(a, Je(a.width, a.height));
285
314
  }
286
- function Je(a) {
287
- const l = /* @__PURE__ */ new Map();
315
+ function Qe(a) {
316
+ const i = /* @__PURE__ */ new Map();
288
317
  if (!(a != null && a.length)) {
289
- A.value = l;
318
+ O.value = i;
290
319
  return;
291
320
  }
292
321
  if (typeof a[0] == "string")
293
322
  for (const ie of a)
294
- l.set(ie, { id: ie, url: ie, name: ie.split("/").pop() });
323
+ i.set(ie, { id: ie, url: ie, name: ie.split("/").pop() });
295
324
  else
296
325
  for (const ie of a)
297
- l.set(J(ie), ie);
298
- A.value = l;
326
+ i.set(le(ie), ie);
327
+ O.value = i;
299
328
  }
300
- function Me(a) {
301
- le.value = a.onConfirm, te.value = a.onCancel, Je(a.selected ?? o.selected);
329
+ function Pe(a) {
330
+ se.value = a.onConfirm, U.value = a.onCancel, Qe(a.selected ?? l.selected);
302
331
  }
303
- function Xe(a) {
304
- if (d.value) return;
305
- const l = a.detail ?? {};
306
- Me(l), v.value = !0;
332
+ function Ze(a) {
333
+ if (c.value) return;
334
+ const i = a.detail ?? {};
335
+ Pe(i), h.value = !0;
307
336
  }
308
337
  Ke(() => {
309
- globalThis.addEventListener(Oe, Xe), d.value || (v.value = q.visible);
310
- }), Ne(() => {
311
- globalThis.removeEventListener(Oe, Xe);
338
+ globalThis.addEventListener(Fe, Ze), c.value || (h.value = J.visible);
339
+ }), Ye(() => {
340
+ globalThis.removeEventListener(Fe, Ze);
312
341
  });
313
- async function Pe() {
342
+ async function $e() {
314
343
  var a;
315
- if (!o.getImages) {
316
- Q.error("请通过 props.getImages 传入图片列表请求方法");
344
+ if (!l.getImages) {
345
+ ee.error("请通过 props.getImages 传入图片列表请求方法");
317
346
  return;
318
347
  }
319
- Y.value = !0, _.value = null;
348
+ j.value = !0, p.value = null;
320
349
  try {
321
- const l = await o.getImages({
322
- keyword: U.value.trim() || void 0,
323
- category: F.value && N.value || void 0,
324
- page: h.value,
325
- pageSize: o.pageSize
350
+ const i = await l.getImages({
351
+ keyword: Y.value.trim() || void 0,
352
+ category: q.value && _.value || void 0,
353
+ page: C.value,
354
+ pageSize: l.pageSize
326
355
  });
327
- W.value = l.list, k.value = l.total;
328
- for (const x of l.list)
329
- Dt(x);
330
- F.value && !X.value && ((a = l.categories) != null && a.length) && (ee.value = l.categories);
331
- } catch (l) {
332
- if (W.value = [], k.value = 0, l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
333
- const x = l;
334
- _.value = {
356
+ H.value = i.list, K.value = i.total;
357
+ for (const x of i.list)
358
+ Ot(x);
359
+ q.value && !F.value && ((a = i.categories) != null && a.length) && (Q.value = i.categories);
360
+ } catch (i) {
361
+ if (H.value = [], K.value = 0, i instanceof st || (i == null ? void 0 : i.name) === "ImageSelectorAuthError") {
362
+ const x = i;
363
+ p.value = {
335
364
  reason: x.reason || "unknown",
336
365
  message: x.message
337
366
  };
338
367
  return;
339
368
  }
340
- Q.error(l instanceof Error ? l.message : "加载图片失败");
369
+ ee.error(i instanceof Error ? i.message : "加载图片失败");
341
370
  } finally {
342
- Y.value = !1;
371
+ j.value = !1;
343
372
  }
344
373
  }
345
- function me() {
346
- h.value = 1, Pe();
374
+ function ve() {
375
+ C.value = 1, $e();
347
376
  }
348
- function Qe(a) {
349
- N.value !== a && (N.value = a, me());
377
+ function et(a) {
378
+ _.value !== a && (_.value = a, ve());
350
379
  }
351
- function Ze(a) {
352
- const l = J(a);
353
- if (S.value) {
354
- if (A.value.has(l)) {
355
- A.value.delete(l), A.value = new Map(A.value);
380
+ function tt(a) {
381
+ const i = le(a);
382
+ if (M.value) {
383
+ if (O.value.has(i)) {
384
+ O.value.delete(i), O.value = new Map(O.value);
356
385
  return;
357
386
  }
358
- if (z.value.length >= C.value) {
359
- Q.warning(`最多选择 ${C.value} 张图片`);
387
+ if (G.value.length >= D.value) {
388
+ ee.warning(`最多选择 ${D.value} 张图片`);
360
389
  return;
361
390
  }
362
- A.value.set(l, a), A.value = new Map(A.value);
391
+ O.value.set(i, a), O.value = new Map(O.value);
363
392
  return;
364
393
  }
365
- if (A.value.has(l)) {
366
- if (f.value) {
367
- nt(() => ke());
394
+ if (O.value.has(i)) {
395
+ if (L.value) {
396
+ lt(() => ke());
368
397
  return;
369
398
  }
370
- A.value = /* @__PURE__ */ new Map();
399
+ O.value = /* @__PURE__ */ new Map();
371
400
  return;
372
401
  }
373
- A.value = /* @__PURE__ */ new Map([[l, a]]), f.value && nt(() => ke());
402
+ O.value = /* @__PURE__ */ new Map([[i, a]]), L.value && lt(() => ke());
374
403
  }
375
- async function Bt(a) {
376
- if (!o.upload) {
377
- Q.error("请通过 props.upload 传入图片上传方法");
404
+ async function Ft(a) {
405
+ if (!l.upload) {
406
+ ee.error("请通过 props.upload 传入图片上传方法");
378
407
  return;
379
408
  }
380
- j.value = !0;
409
+ X.value = !0;
381
410
  try {
382
- const { resource: l } = await o.upload(a.file);
383
- if (Q.success("上传成功"), _.value = null, S.value)
384
- z.value.length < C.value && (A.value.set(J(l), l), A.value = new Map(A.value));
385
- else if (A.value = /* @__PURE__ */ new Map([[J(l), l]]), f.value) {
411
+ const { resource: i } = await l.upload(a.file);
412
+ if (ee.success("上传成功"), p.value = null, M.value)
413
+ G.value.length < D.value && (O.value.set(le(i), i), O.value = new Map(O.value));
414
+ else if (O.value = /* @__PURE__ */ new Map([[le(i), i]]), L.value) {
386
415
  ke();
387
416
  return;
388
417
  }
389
- me();
390
- } catch (l) {
391
- if (l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
392
- const x = l;
393
- _.value = {
418
+ ve();
419
+ } catch (i) {
420
+ if (i instanceof st || (i == null ? void 0 : i.name) === "ImageSelectorAuthError") {
421
+ const x = i;
422
+ p.value = {
394
423
  reason: x.reason || "unknown",
395
424
  message: x.message
396
- }, W.value = [], k.value = 0;
425
+ }, H.value = [], K.value = 0;
397
426
  return;
398
427
  }
399
- Q.error(l instanceof Error ? l.message : "上传失败");
428
+ ee.error(i instanceof Error ? i.message : "上传失败");
400
429
  } finally {
401
- j.value = !1;
430
+ X.value = !1;
402
431
  }
403
432
  }
404
- function Vt() {
405
- R.value = !1, U.value = "", N.value = "", h.value = 1, ee.value = [], oe.value = /* @__PURE__ */ new Map(), _.value = null, c(), d.value ? Me({}) : Me(q.options), c(), Pe();
433
+ function Ut() {
434
+ oe.value = !1, Y.value = "", _.value = "", C.value = 1, Q.value = [], Z.value = /* @__PURE__ */ new Map(), p.value = null, pe(), c.value ? Pe({}) : Pe(J.options), pe(), $e();
406
435
  }
407
- function Ot() {
408
- j.value = !1;
436
+ function Rt() {
437
+ X.value = !1;
409
438
  }
410
- function et() {
439
+ function nt() {
411
440
  var a;
412
- R.value || (R.value = !0, (a = te.value) == null || a.call(te), d.value || it(), s("cancel"), v.value = !1);
441
+ oe.value || (oe.value = !0, (a = U.value) == null || a.call(U), c.value || rt(), y("cancel"), h.value = !1);
413
442
  }
414
443
  function ke() {
415
- var l;
416
- if (!z.value.length) {
417
- Q.warning("请选择图片");
444
+ var i;
445
+ if (!G.value.length) {
446
+ ee.warning("请选择图片");
418
447
  return;
419
448
  }
420
- if (R.value) return;
421
- R.value = !0;
422
- const a = [...z.value];
423
- if (d.value) {
424
- s("confirm", a), v.value = !1;
449
+ if (oe.value) return;
450
+ oe.value = !0;
451
+ const a = [...G.value];
452
+ if (c.value) {
453
+ y("confirm", a), h.value = !1;
425
454
  return;
426
455
  }
427
- (l = le.value) == null || l.call(le, a), d.value || hn(a), s("confirm", a), v.value = !1;
456
+ (i = se.value) == null || i.call(se, a), c.value || wn(a), y("confirm", a), h.value = !1;
428
457
  }
429
- return ne(v, (a, l) => {
458
+ return ne(h, (a, i) => {
430
459
  var x;
431
- l && !a && !R.value && ((x = te.value) == null || x.call(te), d.value || it(), s("cancel"));
460
+ i && !a && !oe.value && ((x = U.value) == null || x.call(U), c.value || rt(), y("cancel"));
432
461
  }), ne(
433
- () => o.selected,
462
+ () => l.selected,
434
463
  (a) => {
435
- v.value || Je(a);
464
+ h.value || Qe(a);
436
465
  },
437
466
  { deep: !0 }
438
- ), (a, l) => {
439
- const x = B("el-icon"), ie = B("el-input"), Ut = B("el-segmented"), ge = B("el-button"), Ft = B("el-upload"), Rt = B("el-empty"), Kt = B("el-pagination"), Nt = B("el-dialog"), zt = dt("loading");
440
- return u(), M(Nt, {
441
- modelValue: v.value,
442
- "onUpdate:modelValue": l[4] || (l[4] = (I) => v.value = I),
443
- title: y.value,
467
+ ), (a, i) => {
468
+ const x = V("el-icon"), ie = V("el-input"), Nt = V("el-segmented"), _e = V("el-button"), Kt = V("el-upload"), Yt = V("el-empty"), zt = V("el-pagination"), jt = V("el-dialog"), Gt = pt("loading");
469
+ return u(), E(jt, {
470
+ modelValue: h.value,
471
+ "onUpdate:modelValue": i[4] || (i[4] = (I) => h.value = I),
472
+ title: r.value,
444
473
  width: e.width,
445
474
  "append-to-body": "",
446
475
  "destroy-on-close": "",
447
476
  class: "yc-image-selector-dialog",
448
- onClosed: Ot,
449
- onOpen: Vt
477
+ onClosed: Rt,
478
+ onOpen: Ut
450
479
  }, {
451
480
  footer: g(() => [
452
- f.value ? (u(), E("div", Nn, [
453
- T("span", zn, D(Ce.value), 1),
454
- m(ge, {
481
+ L.value ? (u(), A("div", Gn, [
482
+ T("div", Wn, [
483
+ T("span", qn, B(d.value), 1),
484
+ l.renderFooterExtra && !p.value ? (u(), E(w(o), {
485
+ key: 0,
486
+ render: l.renderFooterExtra,
487
+ ctx: f.value
488
+ }, null, 8, ["render", "ctx"])) : b("", !0)
489
+ ]),
490
+ m(_e, {
455
491
  link: "",
456
492
  type: "primary",
457
- onClick: et
493
+ onClick: nt
458
494
  }, {
459
495
  default: g(() => [
460
- G(D(e.cancelText), 1)
496
+ W(B(e.cancelText), 1)
461
497
  ]),
462
498
  _: 1
463
499
  })
464
- ])) : (u(), E("div", Fn, [
465
- T("span", Rn, D(Ce.value), 1),
466
- T("div", Kn, [
467
- m(ge, { onClick: et }, {
500
+ ])) : (u(), A("div", Kn, [
501
+ T("div", Yn, [
502
+ T("span", zn, B(d.value), 1),
503
+ l.renderFooterExtra && !p.value ? (u(), E(w(o), {
504
+ key: 0,
505
+ render: l.renderFooterExtra,
506
+ ctx: f.value
507
+ }, null, 8, ["render", "ctx"])) : b("", !0)
508
+ ]),
509
+ T("div", jn, [
510
+ m(_e, { onClick: nt }, {
468
511
  default: g(() => [
469
- G(D(e.cancelText), 1)
512
+ W(B(e.cancelText), 1)
470
513
  ]),
471
514
  _: 1
472
515
  }),
473
- m(ge, {
516
+ m(_e, {
474
517
  type: "primary",
475
- disabled: !z.value.length,
518
+ disabled: !G.value.length,
476
519
  onClick: ke
477
520
  }, {
478
521
  default: g(() => [
479
- G(D(e.confirmText), 1)
522
+ W(B(e.confirmText), 1)
480
523
  ]),
481
524
  _: 1
482
525
  }, 8, ["disabled"])
@@ -484,191 +527,191 @@ const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__too
484
527
  ]))
485
528
  ]),
486
529
  default: g(() => [
487
- T("div", wn, [
488
- T("div", Tn, [
530
+ T("div", Cn, [
531
+ p.value ? b("", !0) : (u(), A("div", Sn, [
489
532
  m(ie, {
490
- modelValue: U.value,
491
- "onUpdate:modelValue": l[0] || (l[0] = (I) => U.value = I),
533
+ modelValue: Y.value,
534
+ "onUpdate:modelValue": i[0] || (i[0] = (I) => Y.value = I),
492
535
  clearable: "",
493
536
  placeholder: "搜索图片名称",
494
537
  class: "yc-image-selector__search",
495
- onKeyup: Gt(me, ["enter"]),
496
- onClear: me
538
+ onKeyup: Ht(ve, ["enter"]),
539
+ onClear: ve
497
540
  }, {
498
541
  prefix: g(() => [
499
542
  m(x, null, {
500
543
  default: g(() => [
501
- m(w(Qt))
544
+ m(w(tn))
502
545
  ]),
503
546
  _: 1
504
547
  })
505
548
  ]),
506
549
  _: 1
507
550
  }, 8, ["modelValue"]),
508
- V.value ? (u(), M(Ut, {
551
+ N.value ? (u(), E(Nt, {
509
552
  key: 0,
510
- modelValue: L.value,
511
- "onUpdate:modelValue": l[1] || (l[1] = (I) => L.value = I),
512
- options: H,
553
+ modelValue: z.value,
554
+ "onUpdate:modelValue": i[1] || (i[1] = (I) => z.value = I),
555
+ options: $,
513
556
  class: "yc-image-selector__mode",
514
- onChange: p
515
- }, null, 8, ["modelValue"])) : $("", !0),
516
- e.showUpload && e.upload ? (u(), M(Ft, {
557
+ onChange: fe
558
+ }, null, 8, ["modelValue"])) : b("", !0),
559
+ e.showUpload && e.upload ? (u(), E(Kt, {
517
560
  key: 1,
518
561
  "show-file-list": !1,
519
562
  accept: e.accept,
520
- "http-request": Bt,
521
- disabled: j.value
563
+ "http-request": Ft,
564
+ disabled: X.value
522
565
  }, {
523
566
  default: g(() => [
524
- m(ge, {
567
+ m(_e, {
525
568
  type: "primary",
526
569
  plain: "",
527
- loading: j.value
570
+ loading: X.value
528
571
  }, {
529
572
  default: g(() => [
530
573
  m(x, { class: "m-r-4" }, {
531
574
  default: g(() => [
532
- m(w(Zt))
575
+ m(w(nn))
533
576
  ]),
534
577
  _: 1
535
578
  }),
536
- l[5] || (l[5] = G(" 上传图片 ", -1))
579
+ i[5] || (i[5] = W(" 上传图片 ", -1))
537
580
  ]),
538
581
  _: 1
539
582
  }, 8, ["loading"])
540
583
  ]),
541
584
  _: 1
542
- }, 8, ["accept", "disabled"])) : $("", !0)
543
- ]),
544
- T("div", In, [
545
- F.value ? (u(), E("aside", Cn, [
585
+ }, 8, ["accept", "disabled"])) : b("", !0)
586
+ ])),
587
+ T("div", xn, [
588
+ q.value && !p.value ? (u(), A("aside", kn, [
546
589
  T("div", {
547
- class: fe(["yc-image-selector__category", { "is-active": N.value === "" }]),
548
- onClick: l[2] || (l[2] = (I) => Qe(""))
549
- }, D(e.categoryAllLabel), 3),
550
- (u(!0), E(re, null, he(O.value, (I) => (u(), E("div", {
590
+ class: me(["yc-image-selector__category", { "is-active": _.value === "" }]),
591
+ onClick: i[2] || (i[2] = (I) => et(""))
592
+ }, B(e.categoryAllLabel), 3),
593
+ (u(!0), A(ce, null, ye(v.value, (I) => (u(), A("div", {
551
594
  key: I.id,
552
- class: fe(["yc-image-selector__category", { "is-active": N.value === I.id }]),
553
- onClick: (xe) => Qe(I.id)
595
+ class: me(["yc-image-selector__category", { "is-active": _.value === I.id }]),
596
+ onClick: (Ee) => et(I.id)
554
597
  }, [
555
- T("span", null, D(I.name), 1),
556
- I.count != null ? (u(), E("span", kn, D(I.count), 1)) : $("", !0)
557
- ], 10, Sn))), 128))
558
- ])) : $("", !0),
559
- _e((u(), E("div", xn, [
560
- !Y.value && Te.value ? ye(a.$slots, "empty", ft(ze({ key: 0 }, Ie.value)), () => {
598
+ T("span", null, B(I.name), 1),
599
+ I.count != null ? (u(), A("span", bn, B(I.count), 1)) : b("", !0)
600
+ ], 10, En))), 128))
601
+ ])) : b("", !0),
602
+ we((u(), A("div", An, [
603
+ !j.value && Ce.value ? Te(a.$slots, "empty", mt(ze({ key: 0 }, Se.value)), () => {
561
604
  var I;
562
605
  return [
563
- o.renderEmpty ? (u(), M(w(t), {
606
+ l.renderEmpty ? (u(), E(w(t), {
564
607
  key: 0,
565
- render: o.renderEmpty,
566
- ctx: Ie.value
567
- }, null, 8, ["render", "ctx"])) : (u(), M(Rt, {
608
+ render: l.renderEmpty,
609
+ ctx: Se.value
610
+ }, null, 8, ["render", "ctx"])) : (u(), E(Yt, {
568
611
  key: 1,
569
- description: ((I = _.value) == null ? void 0 : I.message) || e.emptyText
612
+ description: ((I = p.value) == null ? void 0 : I.message) || e.emptyText
570
613
  }, null, 8, ["description"]))
571
614
  ];
572
- }, !0) : Te.value ? $("", !0) : (u(), E("div", bn, [
573
- (u(!0), E(re, null, he(W.value, (I) => (u(), E("div", {
615
+ }, !0) : Ce.value ? b("", !0) : (u(), A("div", Mn, [
616
+ (u(!0), A(ce, null, ye(H.value, (I) => (u(), A("div", {
574
617
  key: String(I.id),
575
- class: fe(["yc-image-selector__item", {
576
- "is-selected": Se(I),
577
- "is-single-mode": !S.value,
578
- "is-multi-mode": S.value
618
+ class: me(["yc-image-selector__item", {
619
+ "is-selected": xe(I),
620
+ "is-single-mode": !M.value,
621
+ "is-multi-mode": M.value
579
622
  }]),
580
- onClick: (xe) => Ze(I)
623
+ onClick: (Ee) => tt(I)
581
624
  }, [
582
- T("div", En, [
625
+ T("div", $n, [
583
626
  T("img", {
584
- src: ue(I),
627
+ src: He(I),
585
628
  alt: I.name || "image",
586
629
  loading: "lazy",
587
- class: fe($t(I)),
588
- onLoad: (xe) => Lt(xe, I)
589
- }, null, 42, Mn),
630
+ class: me(Bt(I)),
631
+ onLoad: (Ee) => Vt(Ee, I)
632
+ }, null, 42, Ln),
590
633
  T("div", {
591
- class: fe(["yc-image-selector__indicator", {
592
- "is-checked": Se(I),
593
- "is-radio": !S.value,
594
- "is-checkbox": S.value
634
+ class: me(["yc-image-selector__indicator", {
635
+ "is-checked": xe(I),
636
+ "is-radio": !M.value,
637
+ "is-checkbox": M.value
595
638
  }])
596
639
  }, [
597
- Se(I) && S.value ? (u(), E("span", Pn, D(i(I)), 1)) : Se(I) ? (u(), M(x, { key: 1 }, {
640
+ xe(I) && M.value ? (u(), A("span", Dn, B(R(I)), 1)) : xe(I) ? (u(), E(x, { key: 1 }, {
598
641
  default: g(() => [
599
- m(w(mt))
642
+ m(w(vt))
600
643
  ]),
601
644
  _: 1
602
- })) : $("", !0)
645
+ })) : b("", !0)
603
646
  ], 2)
604
647
  ]),
605
648
  T("div", {
606
649
  class: "yc-image-selector__meta",
607
650
  title: I.name
608
- }, D(I.name || "未命名"), 9, $n)
609
- ], 10, An))), 128))
651
+ }, B(I.name || "未命名"), 9, Bn)
652
+ ], 10, Pn))), 128))
610
653
  ]))
611
654
  ])), [
612
- [zt, Y.value]
655
+ [Gt, j.value]
613
656
  ])
614
657
  ]),
615
- S.value && z.value.length ? (u(), E("div", Ln, [
616
- T("span", Dn, "已选 " + D(z.value.length) + " 张", 1),
617
- T("div", Bn, [
618
- (u(!0), E(re, null, he(z.value, (I) => (u(), E("div", {
658
+ M.value && G.value.length ? (u(), A("div", Vn, [
659
+ T("span", On, "已选 " + B(G.value.length) + " 张", 1),
660
+ T("div", Fn, [
661
+ (u(!0), A(ce, null, ye(G.value, (I) => (u(), A("div", {
619
662
  key: String(I.id),
620
663
  class: "yc-image-selector__selected-chip",
621
- onClick: Wt((xe) => Ze(I), ["stop"])
664
+ onClick: Jt((Ee) => tt(I), ["stop"])
622
665
  }, [
623
666
  T("img", {
624
- src: ue(I),
667
+ src: He(I),
625
668
  alt: I.name
626
- }, null, 8, On),
627
- l[6] || (l[6] = T("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
628
- ], 8, Vn))), 128))
669
+ }, null, 8, Rn),
670
+ i[6] || (i[6] = T("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
671
+ ], 8, Un))), 128))
629
672
  ]),
630
- m(ge, {
673
+ m(_e, {
631
674
  link: "",
632
675
  type: "primary",
633
- onClick: K
676
+ onClick: Dt
634
677
  }, {
635
- default: g(() => [...l[7] || (l[7] = [
636
- G("清空", -1)
678
+ default: g(() => [...i[7] || (i[7] = [
679
+ W("清空", -1)
637
680
  ])]),
638
681
  _: 1
639
682
  })
640
- ])) : $("", !0),
641
- k.value > 0 ? (u(), E("div", Un, [
642
- m(Kt, {
643
- "current-page": h.value,
644
- "onUpdate:currentPage": l[3] || (l[3] = (I) => h.value = I),
683
+ ])) : b("", !0),
684
+ K.value > 0 ? (u(), A("div", Nn, [
685
+ m(zt, {
686
+ "current-page": C.value,
687
+ "onUpdate:currentPage": i[3] || (i[3] = (I) => C.value = I),
645
688
  background: "",
646
689
  layout: "total, prev, pager, next, jumper",
647
690
  "page-size": e.pageSize,
648
- total: k.value,
649
- onCurrentChange: Pe
691
+ total: K.value,
692
+ onCurrentChange: $e
650
693
  }, null, 8, ["current-page", "page-size", "total"])
651
- ])) : $("", !0)
694
+ ])) : b("", !0)
652
695
  ])
653
696
  ]),
654
697
  _: 3
655
698
  }, 8, ["modelValue", "title", "width"]);
656
699
  };
657
700
  }
658
- }), Ee = (e, n) => {
701
+ }), Me = (e, n) => {
659
702
  const t = e.__vccOpts || e;
660
- for (const [o, s] of n)
661
- t[o] = s;
703
+ for (const [o, l] of n)
704
+ t[o] = l;
662
705
  return t;
663
- }, Tt = /* @__PURE__ */ Ee(Yn, [["__scopeId", "data-v-30690802"]]);
664
- function It() {
706
+ }, Ct = /* @__PURE__ */ Me(Hn, [["__scopeId", "data-v-03096613"]]);
707
+ function St() {
665
708
  const { baseURL: e = "" } = Ae();
666
- return ut.create({ baseURL: e, timeout: 3e4 });
709
+ return dt.create({ baseURL: e, timeout: 3e4 });
667
710
  }
668
- async function jn(e) {
711
+ async function Jn(e) {
669
712
  const n = Ae().fetchImages;
670
713
  if (n) return n(e);
671
- const t = It(), { data: o } = await t.get(
714
+ const t = St(), { data: o } = await t.get(
672
715
  "/yc-media/images",
673
716
  { params: e }
674
717
  );
@@ -676,44 +719,44 @@ async function jn(e) {
676
719
  throw new Error("加载图片资源失败");
677
720
  return o.data;
678
721
  }
679
- async function Gn(e) {
722
+ async function Xn(e) {
680
723
  const n = Ae().uploadImage;
681
724
  if (n) return n(e);
682
- const t = It(), o = new FormData();
725
+ const t = St(), o = new FormData();
683
726
  o.append("file", e);
684
- const { data: s } = await t.post(
727
+ const { data: l } = await t.post(
685
728
  "/yc-media/images/upload",
686
729
  o,
687
730
  { headers: { "Content-Type": "multipart/form-data" } }
688
731
  );
689
- if (s.code !== 200)
732
+ if (l.code !== 200)
690
733
  throw new Error("上传图片失败");
691
- return s.data;
734
+ return l.data;
692
735
  }
693
- const st = "__YC_IMAGE_SELECTOR_MOUNT__";
694
- function Wn(e) {
736
+ const ut = "__YC_IMAGE_SELECTOR_MOUNT__";
737
+ function Qn(e) {
695
738
  const n = globalThis;
696
- if (n[st] || typeof document > "u") return;
739
+ if (n[ut] || typeof document > "u") return;
697
740
  const t = document.createElement("div");
698
741
  t.setAttribute("data-yc-image-selector-host", ""), document.body.appendChild(t);
699
- const o = Ae().dialog ?? {}, s = m(Tt, {
700
- getImages: jn,
701
- upload: Gn,
742
+ const o = Ae().dialog ?? {}, l = m(Ct, {
743
+ getImages: Jn,
744
+ upload: Xn,
702
745
  showUpload: o.showUpload ?? !0,
703
746
  ...o
704
747
  });
705
- s.appContext = e._context, qt(s, t), n[st] = !0;
748
+ l.appContext = e._context, Xt(l, t), n[ut] = !0;
706
749
  }
707
- function qn(e) {
708
- e.config.globalProperties.openImageSelector = wt, e.config.globalProperties.closeImageSelector = yt;
750
+ function Zn(e) {
751
+ e.config.globalProperties.openImageSelector = It, e.config.globalProperties.closeImageSelector = Tt;
709
752
  }
710
- function Hn(e) {
711
- Wn(e), qn(e);
753
+ function eo(e) {
754
+ Qn(e), Zn(e);
712
755
  }
713
- const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__title" }, Qn = {
756
+ const to = { class: "yc-page-window__header" }, no = { class: "yc-page-window__title" }, oo = {
714
757
  key: 0,
715
758
  class: "yc-page-window__nav"
716
- }, Zn = { class: "yc-page-window__opera" }, eo = { class: "yc-page-window__content" }, to = /* @__PURE__ */ de({
759
+ }, lo = { class: "yc-page-window__opera" }, ao = { class: "yc-page-window__content" }, io = /* @__PURE__ */ ue({
717
760
  __name: "YcPageWindow",
718
761
  props: {
719
762
  visible: { type: Boolean },
@@ -733,90 +776,90 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
733
776
  },
734
777
  emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
735
778
  setup(e, { expose: n, emit: t }) {
736
- const o = e, s = t, d = b(!1), v = P(() => o.loading || d.value), _ = P(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), y = P(
779
+ const o = e, l = t, y = k(!1), c = P(() => o.loading || y.value), h = P(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), p = P(
737
780
  () => o.list.length > 0 && o.row != null
738
781
  ), r = P(
739
782
  () => ["detail", "edit"].includes(o.type)
740
- ), C = P(() => o.type !== "detail");
741
- function V() {
783
+ ), S = P(() => o.type !== "detail");
784
+ function D() {
742
785
  if (!o.row) return -1;
743
- const S = o.rowKey, U = o.row[S];
744
- return o.list.findIndex((N) => N[S] === U);
786
+ const $ = o.rowKey, M = o.row[$];
787
+ return o.list.findIndex((Y) => Y[$] === M);
745
788
  }
746
- function F(S) {
747
- const U = V();
748
- return U < 0 ? !0 : S === "prev" ? U <= 0 : U >= o.list.length - 1;
789
+ function N($) {
790
+ const M = D();
791
+ return M < 0 ? !0 : $ === "prev" ? M <= 0 : M >= o.list.length - 1;
749
792
  }
750
- function X() {
751
- const S = V();
752
- if (S <= 0) return;
753
- const U = o.list[S - 1];
754
- s("checkRow", U), s("prev", U);
793
+ function q() {
794
+ const $ = D();
795
+ if ($ <= 0) return;
796
+ const M = o.list[$ - 1];
797
+ l("checkRow", M), l("prev", M);
755
798
  }
756
- function O() {
757
- const S = V();
758
- if (S < 0 || S >= o.list.length - 1) return;
759
- const U = o.list[S + 1];
760
- s("checkRow", U), s("next", U);
799
+ function F() {
800
+ const $ = D();
801
+ if ($ < 0 || $ >= o.list.length - 1) return;
802
+ const M = o.list[$ + 1];
803
+ l("checkRow", M), l("next", M);
761
804
  }
762
- function f() {
763
- const S = o.type === "detail" ? "edit" : "detail";
764
- s("update:type", S), s("changeType");
805
+ function v() {
806
+ const $ = o.type === "detail" ? "edit" : "detail";
807
+ l("update:type", $), l("changeType");
765
808
  }
766
809
  function L() {
767
- s("update:visible", !1), s("close");
810
+ l("update:visible", !1), l("close");
768
811
  }
769
- function H() {
770
- d.value = !0, s("confirm", (S) => {
771
- d.value = !1, S && L();
812
+ function z() {
813
+ y.value = !0, l("confirm", ($) => {
814
+ y.value = !1, $ && L();
772
815
  });
773
816
  }
774
817
  return ne(
775
818
  () => o.visible,
776
- (S) => {
777
- S && s("opened");
819
+ ($) => {
820
+ $ && l("opened");
778
821
  }
779
- ), Ht(() => {
822
+ ), Qt(() => {
780
823
  o.visible && L();
781
- }), n({ closeWindow: L }), (S, U) => {
782
- const N = B("el-icon"), h = B("el-button"), k = B("el-tooltip"), Y = B("el-scrollbar"), j = dt("loading");
783
- return u(), M(pt, {
824
+ }), n({ closeWindow: L }), ($, M) => {
825
+ const Y = V("el-icon"), _ = V("el-button"), C = V("el-tooltip"), K = V("el-scrollbar"), j = pt("loading");
826
+ return u(), E(gt, {
784
827
  name: "yc-page-window-fade",
785
828
  mode: "out-in"
786
829
  }, {
787
830
  default: g(() => [
788
- _e(T("div", {
831
+ we(T("div", {
789
832
  class: "yc-page-window",
790
- style: ot({ zIndex: e.zIndex })
833
+ style: at({ zIndex: e.zIndex })
791
834
  }, [
792
- T("div", Jn, [
793
- T("div", Xn, [
794
- m(N, {
835
+ T("div", to, [
836
+ T("div", no, [
837
+ m(Y, {
795
838
  class: "yc-page-window__back",
796
839
  onClick: L
797
840
  }, {
798
841
  default: g(() => [
799
- m(w(en))
842
+ m(w(on))
800
843
  ]),
801
844
  _: 1
802
845
  }),
803
- T("span", null, D(e.title) + D(_.value), 1),
804
- y.value ? (u(), E("div", Qn, [
805
- m(k, {
846
+ T("span", null, B(e.title) + B(h.value), 1),
847
+ p.value ? (u(), A("div", oo, [
848
+ m(C, {
806
849
  content: "上一条",
807
850
  placement: "top"
808
851
  }, {
809
852
  default: g(() => [
810
- m(h, {
853
+ m(_, {
811
854
  round: "",
812
855
  text: "",
813
- disabled: F("prev"),
814
- onClick: X
856
+ disabled: N("prev"),
857
+ onClick: q
815
858
  }, {
816
859
  default: g(() => [
817
- m(N, null, {
860
+ m(Y, null, {
818
861
  default: g(() => [
819
- m(w(tn))
862
+ m(w(ln))
820
863
  ]),
821
864
  _: 1
822
865
  })
@@ -826,21 +869,21 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
826
869
  ]),
827
870
  _: 1
828
871
  }),
829
- m(k, {
872
+ m(C, {
830
873
  content: "下一条",
831
874
  placement: "top"
832
875
  }, {
833
876
  default: g(() => [
834
- m(h, {
877
+ m(_, {
835
878
  round: "",
836
879
  text: "",
837
- disabled: F("next"),
838
- onClick: O
880
+ disabled: N("next"),
881
+ onClick: F
839
882
  }, {
840
883
  default: g(() => [
841
- m(N, null, {
884
+ m(Y, null, {
842
885
  default: g(() => [
843
- m(w(nn))
886
+ m(w(an))
844
887
  ]),
845
888
  _: 1
846
889
  })
@@ -850,146 +893,146 @@ const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__t
850
893
  ]),
851
894
  _: 1
852
895
  })
853
- ])) : $("", !0),
854
- r.value ? (u(), M(h, {
896
+ ])) : b("", !0),
897
+ r.value ? (u(), E(_, {
855
898
  key: 1,
856
899
  text: "",
857
900
  class: "yc-page-window__type-switch",
858
901
  type: e.type === "detail" ? "primary" : "success",
859
- onClick: f
902
+ onClick: v
860
903
  }, {
861
904
  default: g(() => [
862
- m(N, { class: "m-r-4" }, {
905
+ m(Y, { class: "m-r-4" }, {
863
906
  default: g(() => [
864
- m(w(on))
907
+ m(w(sn))
865
908
  ]),
866
909
  _: 1
867
910
  }),
868
- G(" " + D(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
911
+ W(" " + B(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
869
912
  ]),
870
913
  _: 1
871
- }, 8, ["type"])) : $("", !0)
914
+ }, 8, ["type"])) : b("", !0)
872
915
  ]),
873
- T("div", Zn, [
874
- ye(S.$slots, "opera", {}, void 0, !0),
875
- e.showButtons && C.value ? (u(), E(re, { key: 0 }, [
876
- m(h, {
916
+ T("div", lo, [
917
+ Te($.$slots, "opera", {}, void 0, !0),
918
+ e.showButtons && S.value ? (u(), A(ce, { key: 0 }, [
919
+ m(_, {
877
920
  text: "",
878
- disabled: v.value,
921
+ disabled: c.value,
879
922
  onClick: L
880
923
  }, {
881
924
  default: g(() => [
882
- m(N, { class: "m-r-4" }, {
925
+ m(Y, { class: "m-r-4" }, {
883
926
  default: g(() => [
884
- m(w(gt))
927
+ m(w(_t))
885
928
  ]),
886
929
  _: 1
887
930
  }),
888
- G(" " + D(e.cancelText), 1)
931
+ W(" " + B(e.cancelText), 1)
889
932
  ]),
890
933
  _: 1
891
934
  }, 8, ["disabled"]),
892
- e.showConfirm ? (u(), M(h, {
935
+ e.showConfirm ? (u(), E(_, {
893
936
  key: 0,
894
937
  type: "primary",
895
- loading: v.value,
938
+ loading: c.value,
896
939
  disabled: e.disabled,
897
- onClick: H
940
+ onClick: z
898
941
  }, {
899
942
  default: g(() => [
900
- m(N, { class: "m-r-4" }, {
943
+ m(Y, { class: "m-r-4" }, {
901
944
  default: g(() => [
902
- m(w(mt))
945
+ m(w(vt))
903
946
  ]),
904
947
  _: 1
905
948
  }),
906
- G(" " + D(e.confirmText), 1)
949
+ W(" " + B(e.confirmText), 1)
907
950
  ]),
908
951
  _: 1
909
- }, 8, ["loading", "disabled"])) : $("", !0)
910
- ], 64)) : $("", !0)
952
+ }, 8, ["loading", "disabled"])) : b("", !0)
953
+ ], 64)) : b("", !0)
911
954
  ])
912
955
  ]),
913
- _e((u(), E("div", eo, [
914
- m(Y, { class: "yc-page-window__scroll" }, {
956
+ we((u(), A("div", ao, [
957
+ m(K, { class: "yc-page-window__scroll" }, {
915
958
  default: g(() => [
916
- e.visible ? (u(), E("div", {
959
+ e.visible ? (u(), A("div", {
917
960
  key: 0,
918
961
  class: "yc-page-window__body",
919
- style: ot({ minHeight: e.contentMinHeight })
962
+ style: at({ minHeight: e.contentMinHeight })
920
963
  }, [
921
- ye(S.$slots, "default", {}, void 0, !0)
922
- ], 4)) : $("", !0)
964
+ Te($.$slots, "default", {}, void 0, !0)
965
+ ], 4)) : b("", !0)
923
966
  ]),
924
967
  _: 3
925
968
  })
926
969
  ])), [
927
- [j, v.value]
970
+ [j, c.value]
928
971
  ])
929
972
  ], 4), [
930
- [De, e.visible]
973
+ [Be, e.visible]
931
974
  ])
932
975
  ]),
933
976
  _: 3
934
977
  });
935
978
  };
936
979
  }
937
- }), rt = /* @__PURE__ */ Ee(to, [["__scopeId", "data-v-b3e784c3"]]);
938
- function no(e) {
939
- e != null && e.aiTask && (dn(e.aiTask), pn()), e != null && e.imageSelector && gn(e.imageSelector);
980
+ }), ct = /* @__PURE__ */ Me(io, [["__scopeId", "data-v-b3e784c3"]]);
981
+ function so(e) {
982
+ e != null && e.aiTask && (mn(e.aiTask), vn()), e != null && e.imageSelector && hn(e.imageSelector);
940
983
  }
941
- function oo(e, n) {
942
- (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", rt), e.component("SkyPageWindow", rt));
984
+ function ro(e, n) {
985
+ (n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", ct), e.component("SkyPageWindow", ct));
943
986
  }
944
- function lo(e, n) {
945
- (n == null ? void 0 : n.registerImageSelector) !== !1 && Hn(e);
987
+ function uo(e, n) {
988
+ (n == null ? void 0 : n.registerImageSelector) !== !1 && eo(e);
946
989
  }
947
- const ll = {
990
+ const ul = {
948
991
  install(e, n) {
949
- no(n), oo(e, n), lo(e, n);
992
+ so(n), ro(e, n), uo(e, n);
950
993
  }
951
- }, Le = "__YC_COMPONENT_AI_DIALOG__", Ue = "yc-component:ai-dialog-open";
952
- function ao() {
994
+ }, De = "__YC_COMPONENT_AI_DIALOG__", Ue = "yc-component:ai-dialog-open";
995
+ function co() {
953
996
  const e = globalThis;
954
- return e[Le] || (e[Le] = ct({
997
+ return e[De] || (e[De] = ft({
955
998
  visible: !1,
956
999
  options: {}
957
- })), e[Le];
1000
+ })), e[De];
958
1001
  }
959
- const ae = ao();
960
- function Ge(e = {}) {
1002
+ const ae = co();
1003
+ function We(e = {}) {
961
1004
  ae.options = { ...e }, ae.visible = !0, globalThis.dispatchEvent(
962
1005
  new CustomEvent(Ue, { detail: { ...e } })
963
1006
  );
964
1007
  }
965
- function Ct() {
1008
+ function xt() {
966
1009
  ae.visible = !1;
967
1010
  }
968
- function al(e = {}) {
969
- Ge(e);
1011
+ function cl(e = {}) {
1012
+ We(e);
970
1013
  }
971
- function St(e) {
1014
+ function kt(e) {
972
1015
  const {
973
1016
  tasks: n,
974
1017
  panelVisible: t,
975
1018
  panelMinimized: o,
976
- dialogVisible: s,
977
- runningCount: d,
978
- activeCount: v,
979
- panelTitle: _,
980
- panelSubtitle: y
981
- } = un(e);
1019
+ dialogVisible: l,
1020
+ runningCount: y,
1021
+ activeCount: c,
1022
+ panelTitle: h,
1023
+ panelSubtitle: p
1024
+ } = fn(e);
982
1025
  return {
983
1026
  tasks: n,
984
1027
  panelVisible: t,
985
1028
  panelMinimized: o,
986
- dialogVisible: s,
987
- runningCount: d,
988
- activeCount: v,
989
- panelTitle: _,
990
- panelSubtitle: y,
1029
+ dialogVisible: l,
1030
+ runningCount: y,
1031
+ activeCount: c,
1032
+ panelTitle: h,
1033
+ panelSubtitle: p,
991
1034
  openUseDialog: (r) => {
992
- Ge(r ?? {}), e.openDialog(r ?? {});
1035
+ We(r ?? {}), e.openDialog(r ?? {});
993
1036
  },
994
1037
  closeUseDialog: () => e.closeDialog(),
995
1038
  openTaskPanel: () => e.showPanel(),
@@ -1005,19 +1048,19 @@ function St(e) {
1005
1048
  onTaskFinish: (r) => e.onTaskFinish(r)
1006
1049
  };
1007
1050
  }
1008
- const io = "__YC_AI_TASK_CTX_KEY__", so = "__YC_AI_TASK_STORE_KEY__";
1009
- function kt(e) {
1051
+ const fo = "__YC_AI_TASK_CTX_KEY__", po = "__YC_AI_TASK_STORE_KEY__";
1052
+ function Et(e) {
1010
1053
  const n = globalThis;
1011
1054
  return n[e] || (n[e] = Symbol(e)), n[e];
1012
1055
  }
1013
- const xt = kt(io), bt = kt(so), ro = async (e) => (await pe().post(
1056
+ const bt = Et(fo), At = Et(po), mo = async (e) => (await ge().post(
1014
1057
  "/yc-ai/workflows/runs",
1015
1058
  e
1016
- )).data, At = async (e) => (await pe().get(`/yc-ai/workflows/runs/${e}`)).data, uo = (e) => pe().post(`/yc-ai/workflows/runs/${e}/cancel`), co = (e, n) => pe().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
1017
- async function Fe(e, n) {
1018
- return mn(e, n);
1059
+ )).data, Mt = async (e) => (await ge().get(`/yc-ai/workflows/runs/${e}`)).data, go = (e) => ge().post(`/yc-ai/workflows/runs/${e}/cancel`), vo = (e, n) => ge().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
1060
+ async function Re(e, n) {
1061
+ return _n(e, n);
1019
1062
  }
1020
- function fo(e, n) {
1063
+ function _o(e, n) {
1021
1064
  const t = e.trim();
1022
1065
  if (!t)
1023
1066
  return n;
@@ -1031,79 +1074,79 @@ function fo(e, n) {
1031
1074
  throw new Error('请定义 function handler(result) { ... }');
1032
1075
  `
1033
1076
  ) : o = new Function("result", `return (${t})(result);`);
1034
- } catch (s) {
1035
- throw new Error(`自定义脚本语法错误: ${s instanceof Error ? s.message : String(s)}`);
1077
+ } catch (l) {
1078
+ throw new Error(`自定义脚本语法错误: ${l instanceof Error ? l.message : String(l)}`);
1036
1079
  }
1037
1080
  try {
1038
1081
  return o(n);
1039
- } catch (s) {
1040
- throw new Error(`自定义脚本执行失败: ${s instanceof Error ? s.message : String(s)}`);
1082
+ } catch (l) {
1083
+ throw new Error(`自定义脚本执行失败: ${l instanceof Error ? l.message : String(l)}`);
1041
1084
  }
1042
1085
  }
1043
- async function po(e) {
1044
- return (await ro({
1045
- projectId: fn(),
1086
+ async function ho(e) {
1087
+ return (await mo({
1088
+ projectId: gn(),
1046
1089
  freeText: e.freeText,
1047
1090
  promptId: e.promptId,
1048
1091
  autoMatch: e.autoMatch
1049
1092
  })).runId;
1050
1093
  }
1051
- async function mo(e, n) {
1052
- var o, s, d, v;
1053
- const t = await At(e);
1094
+ async function yo(e, n) {
1095
+ var o, l, y, c;
1096
+ const t = await Mt(e);
1054
1097
  if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
1055
1098
  (o = n == null ? void 0 : n.onProgress) == null || o.call(n, 60, `执行脚本:${t.waitingStepKey}`);
1056
- let _ = {};
1057
- t.waitingArtifactId && (_ = await Fe(e, t.waitingArtifactId));
1058
- const y = fo(t.waitingClientScript, _);
1059
- return await co(e, {
1099
+ let h = {};
1100
+ t.waitingArtifactId && (h = await Re(e, t.waitingArtifactId));
1101
+ const p = _o(t.waitingClientScript, h);
1102
+ return await vo(e, {
1060
1103
  stepKey: t.waitingStepKey,
1061
- output: y ?? {}
1104
+ output: p ?? {}
1062
1105
  }), null;
1063
1106
  }
1064
1107
  if (t.status === "SUCCEEDED") {
1065
1108
  if (t.finalArtifactId) {
1066
- (s = n == null ? void 0 : n.onProgress) == null || s.call(n, 95, "加载结果…");
1067
- const _ = await Fe(e, t.finalArtifactId);
1068
- return (d = n == null ? void 0 : n.onProgress) == null || d.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: _ };
1109
+ (l = n == null ? void 0 : n.onProgress) == null || l.call(n, 95, "加载结果…");
1110
+ const h = await Re(e, t.finalArtifactId);
1111
+ return (y = n == null ? void 0 : n.onProgress) == null || y.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: h };
1069
1112
  }
1070
1113
  return { phase: "SUCCEEDED", runId: e, result: {} };
1071
1114
  }
1072
- return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((v = n == null ? void 0 : n.onProgress) == null || v.call(n, ho(t), _o(t)), null);
1115
+ return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((c = n == null ? void 0 : n.onProgress) == null || c.call(n, Io(t), Co(t)), null);
1073
1116
  }
1074
- async function go(e) {
1075
- const n = await At(e);
1076
- return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await Fe(e, n.finalArtifactId);
1117
+ async function wo(e) {
1118
+ const n = await Mt(e);
1119
+ return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await Re(e, n.finalArtifactId);
1077
1120
  }
1078
- async function vo(e) {
1079
- await uo(e);
1121
+ async function To(e) {
1122
+ await go(e);
1080
1123
  }
1081
- function ho(e) {
1124
+ function Io(e) {
1082
1125
  if (e.status === "PENDING") return 8;
1083
1126
  const n = e.steps ?? [];
1084
1127
  if (!n.length) return 35;
1085
1128
  const t = n.filter((o) => o.status === "SUCCEEDED" || o.status === "SKIPPED").length;
1086
1129
  return Math.min(90, Math.round(20 + t / n.length * 70));
1087
1130
  }
1088
- function _o(e) {
1131
+ function Co(e) {
1089
1132
  var t;
1090
1133
  if (e.status === "PENDING") return "排队中…";
1091
1134
  const n = (t = e.steps) == null ? void 0 : t.find((o) => o.status === "RUNNING");
1092
1135
  return n ? `执行中:${n.stepKey}` : "后端处理中…";
1093
1136
  }
1094
- const Et = 80;
1095
- function yo() {
1137
+ const Pt = 80;
1138
+ function So() {
1096
1139
  try {
1097
- const e = localStorage.getItem(ht());
1140
+ const e = localStorage.getItem(yt());
1098
1141
  if (!e) return [];
1099
1142
  const n = JSON.parse(e);
1100
- return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0, Et) : [];
1143
+ return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0, Pt) : [];
1101
1144
  } catch {
1102
1145
  return [];
1103
1146
  }
1104
1147
  }
1105
- function wo(e) {
1106
- const n = e.slice(0, Et).map((t) => ({
1148
+ function xo(e) {
1149
+ const n = e.slice(0, Pt).map((t) => ({
1107
1150
  id: t.id,
1108
1151
  title: t.title,
1109
1152
  freeText: t.freeText,
@@ -1117,250 +1160,250 @@ function wo(e) {
1117
1160
  createdAt: t.createdAt,
1118
1161
  finishedAt: t.finishedAt
1119
1162
  }));
1120
- localStorage.setItem(ht(), JSON.stringify(n));
1163
+ localStorage.setItem(yt(), JSON.stringify(n));
1121
1164
  }
1122
- function To(e) {
1165
+ function ko(e) {
1123
1166
  return {
1124
1167
  ...e,
1125
1168
  logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
1126
1169
  result: void 0
1127
1170
  };
1128
1171
  }
1129
- function se(e) {
1172
+ function re(e) {
1130
1173
  return e === "pending" || e === "running";
1131
1174
  }
1132
- let Re = 0, ve = null;
1133
- const Io = 5e3;
1134
- function Co() {
1135
- return Re += 1, `ai_task_${Date.now()}_${Re}`;
1175
+ let Ne = 0, he = null;
1176
+ const Eo = 5e3;
1177
+ function bo() {
1178
+ return Ne += 1, `ai_task_${Date.now()}_${Ne}`;
1136
1179
  }
1137
- function So(e, n = 28) {
1180
+ function Ao(e, n = 28) {
1138
1181
  const t = e.trim();
1139
1182
  return t.length <= n ? t : `${t.slice(0, n)}…`;
1140
1183
  }
1141
- const Mt = cn("ycAiTask", () => {
1142
- const e = b([]), n = b(!1), t = b(!1), o = b(!1), s = b({}), d = b(!1), v = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set();
1143
- function r(i, p) {
1184
+ const $t = pn("ycAiTask", () => {
1185
+ const e = k([]), n = k(!1), t = k(!1), o = k(!1), l = k({}), y = k(!1), c = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set();
1186
+ function r(s, f) {
1144
1187
  return {
1145
- taskId: i.id,
1146
- runId: i.runId,
1147
- title: i.title,
1148
- freeText: i.freeText,
1149
- promptId: i.promptId,
1150
- result: p,
1151
- finishedAt: i.finishedAt ?? Date.now()
1188
+ taskId: s.id,
1189
+ runId: s.runId,
1190
+ title: s.title,
1191
+ freeText: s.freeText,
1192
+ promptId: s.promptId,
1193
+ result: f,
1194
+ finishedAt: s.finishedAt ?? Date.now()
1152
1195
  };
1153
1196
  }
1154
- function C(i, p) {
1155
- var ue;
1156
- const c = e.value.find((J) => J.id === i);
1157
- if (!(c != null && c.runId)) return;
1158
- const K = r(c, p);
1159
- (ue = _.get(i)) == null || ue(K), _.delete(i), y.forEach((J) => J(K));
1197
+ function S(s, f) {
1198
+ var fe;
1199
+ const d = e.value.find((pe) => pe.id === s);
1200
+ if (!(d != null && d.runId)) return;
1201
+ const R = r(d, f);
1202
+ (fe = h.get(s)) == null || fe(R), h.delete(s), p.forEach((pe) => pe(R));
1160
1203
  }
1161
- function V(i) {
1162
- return y.add(i), () => y.delete(i);
1204
+ function D(s) {
1205
+ return p.add(s), () => p.delete(s);
1163
1206
  }
1164
- const F = P(
1165
- () => e.value.filter((i) => se(i.status)).length
1166
- ), X = P(() => e.value.filter((i) => i.status === "running").length), O = P(() => F.value > 0 ? "AI 处理中" : e.value.some((i) => i.status === "failed") ? "部分任务失败" : "AI 任务"), f = P(() => {
1167
- const i = e.value.length, p = F.value;
1168
- return i === 0 ? "暂无任务" : p > 0 ? `${p}/${i} 项任务进行中` : `${i} 项任务已完成`;
1207
+ const N = P(
1208
+ () => e.value.filter((s) => re(s.status)).length
1209
+ ), q = P(() => e.value.filter((s) => s.status === "running").length), F = P(() => N.value > 0 ? "AI 处理中" : e.value.some((s) => s.status === "failed") ? "部分任务失败" : "AI 任务"), v = P(() => {
1210
+ const s = e.value.length, f = N.value;
1211
+ return s === 0 ? "暂无任务" : f > 0 ? `${f}/${s} 项任务进行中` : `${s} 项任务已完成`;
1169
1212
  });
1170
1213
  function L() {
1171
- wo(e.value);
1214
+ xo(e.value);
1172
1215
  }
1173
- function H(i, p) {
1174
- const c = e.value.findIndex((K) => K.id === i);
1175
- c >= 0 && (e.value[c] = { ...e.value[c], ...p }, L());
1216
+ function z(s, f) {
1217
+ const d = e.value.findIndex((R) => R.id === s);
1218
+ d >= 0 && (e.value[d] = { ...e.value[d], ...f }, L());
1176
1219
  }
1177
- function S(i, p) {
1178
- const c = e.value.find((K) => K.id === i);
1179
- c && (c.logs.unshift(p), c.logs.length > 20 && c.logs.pop());
1220
+ function $(s, f) {
1221
+ const d = e.value.find((R) => R.id === s);
1222
+ d && (d.logs.unshift(f), d.logs.length > 20 && d.logs.pop());
1180
1223
  }
1181
- function U() {
1224
+ function M() {
1182
1225
  n.value = !0, t.value = !1;
1183
1226
  }
1184
- function N() {
1227
+ function Y() {
1185
1228
  n.value = !1;
1186
1229
  }
1187
- function h() {
1230
+ function _() {
1188
1231
  t.value = !t.value;
1189
1232
  }
1190
- function k(i = {}) {
1191
- s.value = { ...i }, o.value = !0, Ge(i);
1233
+ function C(s = {}) {
1234
+ l.value = { ...s }, o.value = !0, We(s);
1192
1235
  }
1193
- function Y() {
1194
- o.value = !1, Ct();
1236
+ function K() {
1237
+ o.value = !1, xt();
1195
1238
  }
1196
1239
  function j() {
1197
- ve || (ve = setInterval(() => {
1198
- ee();
1199
- }, Io));
1240
+ he || (he = setInterval(() => {
1241
+ H();
1242
+ }, Eo));
1200
1243
  }
1201
- function W() {
1202
- F.value > 0 || ve && (clearInterval(ve), ve = null);
1244
+ function X() {
1245
+ N.value > 0 || he && (clearInterval(he), he = null);
1203
1246
  }
1204
- async function ee() {
1205
- const i = e.value.filter((p) => p.runId && se(p.status));
1206
- if (!i.length) {
1207
- W();
1247
+ async function H() {
1248
+ const s = e.value.filter((f) => f.runId && re(f.status));
1249
+ if (!s.length) {
1250
+ X();
1208
1251
  return;
1209
1252
  }
1210
- await Promise.all(i.map((p) => A(p.id)));
1253
+ await Promise.all(s.map((f) => Q(f.id)));
1211
1254
  }
1212
- async function A(i) {
1213
- if (v.has(i)) return;
1214
- const p = e.value.find((c) => c.id === i);
1215
- if (!(!(p != null && p.runId) || !se(p.status))) {
1216
- v.add(i);
1255
+ async function Q(s) {
1256
+ if (c.has(s)) return;
1257
+ const f = e.value.find((d) => d.id === s);
1258
+ if (!(!(f != null && f.runId) || !re(f.status))) {
1259
+ c.add(s);
1217
1260
  try {
1218
- const c = await mo(p.runId, {
1219
- onProgress: (K, ue) => H(i, { progress: K, summary: ue, status: "running" })
1261
+ const d = await yo(f.runId, {
1262
+ onProgress: (R, fe) => z(s, { progress: R, summary: fe, status: "running" })
1220
1263
  });
1221
- if (!c) return;
1222
- if (c.phase === "SUCCEEDED") {
1223
- const K = c.result ?? {};
1224
- H(i, {
1264
+ if (!d) return;
1265
+ if (d.phase === "SUCCEEDED") {
1266
+ const R = d.result ?? {};
1267
+ z(s, {
1225
1268
  status: "succeeded",
1226
1269
  progress: 100,
1227
1270
  summary: "已完成",
1228
- result: K,
1229
- runId: c.runId,
1271
+ result: R,
1272
+ runId: d.runId,
1230
1273
  finishedAt: Date.now()
1231
- }), C(i, K);
1274
+ }), S(s, R);
1232
1275
  } else
1233
- H(i, {
1234
- status: c.errorMessage === "已取消" ? "cancelled" : "failed",
1276
+ z(s, {
1277
+ status: d.errorMessage === "已取消" ? "cancelled" : "failed",
1235
1278
  progress: 100,
1236
- summary: c.errorMessage || "失败",
1237
- errorMessage: c.errorMessage,
1238
- runId: c.runId,
1279
+ summary: d.errorMessage || "失败",
1280
+ errorMessage: d.errorMessage,
1281
+ runId: d.runId,
1239
1282
  finishedAt: Date.now()
1240
1283
  });
1241
- W();
1242
- } catch (c) {
1243
- const K = c instanceof Error ? c.message : "同步失败";
1244
- S(i, `✗ ${K}`);
1284
+ X();
1285
+ } catch (d) {
1286
+ const R = d instanceof Error ? d.message : "同步失败";
1287
+ $(s, `✗ ${R}`);
1245
1288
  } finally {
1246
- v.delete(i);
1289
+ c.delete(s);
1247
1290
  }
1248
1291
  }
1249
1292
  }
1250
- async function oe() {
1251
- if (d.value) return;
1252
- d.value = !0;
1253
- const i = yo();
1254
- i.length && (e.value = i.map(To), Re = i.length);
1255
- const p = e.value.filter((c) => c.runId && se(c.status));
1256
- p.length && (await Promise.all(p.map((c) => A(c.id))), j());
1257
- for (const c of e.value)
1258
- c.status === "pending" && !c.runId && H(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
1293
+ async function O() {
1294
+ if (y.value) return;
1295
+ y.value = !0;
1296
+ const s = So();
1297
+ s.length && (e.value = s.map(ko), Ne = s.length);
1298
+ const f = e.value.filter((d) => d.runId && re(d.status));
1299
+ f.length && (await Promise.all(f.map((d) => Q(d.id))), j());
1300
+ for (const d of e.value)
1301
+ d.status === "pending" && !d.runId && z(d.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
1259
1302
  }
1260
- function le(i) {
1261
- const p = Co(), c = {
1262
- id: p,
1263
- title: i.title ?? So(i.freeText),
1264
- freeText: i.freeText.trim(),
1265
- promptId: i.promptId,
1266
- autoMatch: i.autoMatch,
1303
+ function Z(s) {
1304
+ const f = bo(), d = {
1305
+ id: f,
1306
+ title: s.title ?? Ao(s.freeText),
1307
+ freeText: s.freeText.trim(),
1308
+ promptId: s.promptId,
1309
+ autoMatch: s.autoMatch,
1267
1310
  status: "pending",
1268
1311
  progress: 0,
1269
1312
  summary: "正在提交…",
1270
1313
  createdAt: Date.now(),
1271
1314
  logs: []
1272
1315
  };
1273
- return e.value.unshift(c), L(), i.onFinish && _.set(p, i.onFinish), i.showPanel !== !1 && U(), te(p), p;
1316
+ return e.value.unshift(d), L(), s.onFinish && h.set(f, s.onFinish), s.showPanel !== !1 && M(), se(f), f;
1274
1317
  }
1275
- async function te(i) {
1276
- const p = e.value.find((c) => c.id === i);
1277
- if (p)
1318
+ async function se(s) {
1319
+ const f = e.value.find((d) => d.id === s);
1320
+ if (f)
1278
1321
  try {
1279
- const c = await po({
1280
- freeText: p.freeText,
1281
- promptId: p.promptId,
1282
- autoMatch: p.autoMatch
1322
+ const d = await ho({
1323
+ freeText: f.freeText,
1324
+ promptId: f.promptId,
1325
+ autoMatch: f.autoMatch
1283
1326
  });
1284
- H(i, {
1285
- runId: c,
1327
+ z(s, {
1328
+ runId: d,
1286
1329
  status: "running",
1287
1330
  progress: 10,
1288
1331
  summary: "后端异步处理中…"
1289
- }), S(i, `▶ 已提交 runId=${c}`), j(), A(i);
1290
- } catch (c) {
1291
- const K = c instanceof Error ? c.message : "提交失败";
1292
- H(i, {
1332
+ }), $(s, `▶ 已提交 runId=${d}`), j(), Q(s);
1333
+ } catch (d) {
1334
+ const R = d instanceof Error ? d.message : "提交失败";
1335
+ z(s, {
1293
1336
  status: "failed",
1294
1337
  progress: 100,
1295
- summary: K,
1296
- errorMessage: K,
1338
+ summary: R,
1339
+ errorMessage: R,
1297
1340
  finishedAt: Date.now()
1298
1341
  });
1299
1342
  }
1300
1343
  }
1301
- async function R(i) {
1302
- const p = e.value.find((K) => K.id === i);
1303
- if (!(p != null && p.runId)) return null;
1304
- if (p.result) return p.result;
1305
- const c = await go(p.runId);
1306
- return c && H(i, { result: c }), c;
1344
+ async function U(s) {
1345
+ const f = e.value.find((R) => R.id === s);
1346
+ if (!(f != null && f.runId)) return null;
1347
+ if (f.result) return f.result;
1348
+ const d = await wo(f.runId);
1349
+ return d && z(s, { result: d }), d;
1307
1350
  }
1308
- async function z(i) {
1309
- const p = e.value.find((c) => c.id === i);
1310
- if (p != null && p.runId && se(p.status))
1351
+ async function oe(s) {
1352
+ const f = e.value.find((d) => d.id === s);
1353
+ if (f != null && f.runId && re(f.status))
1311
1354
  try {
1312
- await vo(p.runId);
1355
+ await To(f.runId);
1313
1356
  } catch {
1314
1357
  }
1315
- p && se(p.status) && H(i, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), _.delete(i), W();
1358
+ f && re(f.status) && z(s, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), h.delete(s), X();
1316
1359
  }
1317
- function Te() {
1318
- for (const i of e.value)
1319
- se(i.status) && z(i.id);
1360
+ function G() {
1361
+ for (const s of e.value)
1362
+ re(s.status) && oe(s.id);
1320
1363
  }
1321
- function Ie() {
1322
- e.value = e.value.filter((i) => se(i.status)), L();
1364
+ function Ce() {
1365
+ e.value = e.value.filter((s) => re(s.status)), L();
1323
1366
  }
1324
- function Ce(i) {
1325
- z(i), _.delete(i), e.value = e.value.filter((p) => p.id !== i), L();
1367
+ function Se(s) {
1368
+ oe(s), h.delete(s), e.value = e.value.filter((f) => f.id !== s), L();
1326
1369
  }
1327
1370
  return {
1328
1371
  tasks: e,
1329
1372
  panelVisible: n,
1330
1373
  panelMinimized: t,
1331
1374
  dialogVisible: o,
1332
- dialogOptions: s,
1333
- hydrated: d,
1334
- runningCount: F,
1335
- activeCount: X,
1336
- panelTitle: O,
1337
- panelSubtitle: f,
1338
- hydrate: oe,
1339
- showPanel: U,
1340
- hidePanel: N,
1341
- toggleMinimize: h,
1342
- openDialog: k,
1343
- closeDialog: Y,
1344
- enqueue: le,
1345
- onTaskFinish: V,
1346
- refreshActiveTasks: ee,
1347
- loadTaskResult: R,
1348
- cancelTask: z,
1349
- cancelAll: Te,
1350
- clearFinished: Ie,
1351
- removeTask: Ce
1375
+ dialogOptions: l,
1376
+ hydrated: y,
1377
+ runningCount: N,
1378
+ activeCount: q,
1379
+ panelTitle: F,
1380
+ panelSubtitle: v,
1381
+ hydrate: O,
1382
+ showPanel: M,
1383
+ hidePanel: Y,
1384
+ toggleMinimize: _,
1385
+ openDialog: C,
1386
+ closeDialog: K,
1387
+ enqueue: Z,
1388
+ onTaskFinish: D,
1389
+ refreshActiveTasks: H,
1390
+ loadTaskResult: U,
1391
+ cancelTask: oe,
1392
+ cancelAll: G,
1393
+ clearFinished: Ce,
1394
+ removeTask: Se
1352
1395
  };
1353
1396
  });
1354
- async function ko(e) {
1355
- return (await pe().get("/yc-ai/ai/prompts", {
1397
+ async function Mo(e) {
1398
+ return (await ge().get("/yc-ai/ai/prompts", {
1356
1399
  params: e ? { category: e } : {}
1357
1400
  })).data;
1358
1401
  }
1359
- function We() {
1360
- const e = Ye(bt, null);
1361
- return e || Mt();
1402
+ function qe() {
1403
+ const e = je(At, null);
1404
+ return e || $t();
1362
1405
  }
1363
- const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__footer-actions" }, Ao = /* @__PURE__ */ de({
1406
+ const Po = { class: "ai-use-dialog__footer" }, $o = { class: "ai-use-dialog__footer-actions" }, Lo = /* @__PURE__ */ ue({
1364
1407
  __name: "AiUseDialog",
1365
1408
  props: {
1366
1409
  title: { default: "AI 生成" },
@@ -1383,147 +1426,147 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1383
1426
  },
1384
1427
  emits: ["update:modelValue", "submitted"],
1385
1428
  setup(e, { emit: n }) {
1386
- const t = e, o = n, s = We(), d = P(() => t.modelValue !== void 0), v = b(!1);
1429
+ const t = e, o = n, l = qe(), y = P(() => t.modelValue !== void 0), c = k(!1);
1387
1430
  ne(
1388
1431
  () => t.modelValue,
1389
- (h) => {
1390
- d.value && (v.value = !!h);
1432
+ (_) => {
1433
+ y.value && (c.value = !!_);
1391
1434
  },
1392
1435
  { immediate: !0 }
1393
- ), ne(v, (h) => {
1394
- if (d.value) {
1395
- o("update:modelValue", h);
1436
+ ), ne(c, (_) => {
1437
+ if (y.value) {
1438
+ o("update:modelValue", _);
1396
1439
  return;
1397
1440
  }
1398
- ae.visible = h, h || Ct();
1441
+ ae.visible = _, _ || xt();
1399
1442
  }), ne(
1400
1443
  () => ae.visible,
1401
- (h) => {
1402
- d.value || (v.value = h);
1444
+ (_) => {
1445
+ y.value || (c.value = _);
1403
1446
  },
1404
1447
  { immediate: !0 }
1405
1448
  );
1406
- function _(h) {
1407
- if (d.value) return;
1408
- const k = h.detail ?? {};
1409
- O(k), v.value = !0;
1449
+ function h(_) {
1450
+ if (y.value) return;
1451
+ const C = _.detail ?? {};
1452
+ F(C), c.value = !0;
1410
1453
  }
1411
1454
  Ke(() => {
1412
- globalThis.addEventListener(Ue, _), d.value || (v.value = ae.visible);
1413
- }), Ne(() => {
1414
- globalThis.removeEventListener(Ue, _);
1455
+ globalThis.addEventListener(Ue, h), y.value || (c.value = ae.visible);
1456
+ }), Ye(() => {
1457
+ globalThis.removeEventListener(Ue, h);
1415
1458
  });
1416
- const y = P(
1417
- () => (d.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
1418
- ), r = b({
1459
+ const p = P(
1460
+ () => (y.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
1461
+ ), r = k({
1419
1462
  freeText: t.freeText,
1420
1463
  promptId: t.promptId,
1421
1464
  autoMatch: t.autoMatch
1422
- }), C = b(t.prompts ? [...t.prompts] : []), V = b(!1), F = b(!1), X = b();
1423
- function O(h) {
1424
- var k, Y;
1425
- r.value.freeText = h.freeText ?? t.freeText ?? "", r.value.promptId = h.promptId ?? t.promptId, r.value.autoMatch = h.autoMatch ?? t.autoMatch ?? !1, X.value = h.onFinish, (k = h.prompts) != null && k.length ? C.value = [...h.prompts] : (Y = t.prompts) != null && Y.length && (C.value = [...t.prompts]);
1465
+ }), S = k(t.prompts ? [...t.prompts] : []), D = k(!1), N = k(!1), q = k();
1466
+ function F(_) {
1467
+ var C, K;
1468
+ r.value.freeText = _.freeText ?? t.freeText ?? "", r.value.promptId = _.promptId ?? t.promptId, r.value.autoMatch = _.autoMatch ?? t.autoMatch ?? !1, q.value = _.onFinish, (C = _.prompts) != null && C.length ? S.value = [..._.prompts] : (K = t.prompts) != null && K.length && (S.value = [...t.prompts]);
1426
1469
  }
1427
- async function f() {
1428
- if (!(C.value.length > 0)) {
1429
- V.value = !0;
1470
+ async function v() {
1471
+ if (!(S.value.length > 0)) {
1472
+ D.value = !0;
1430
1473
  try {
1431
- const h = vt().listPrompts;
1432
- C.value = h ? await h() : await ko();
1474
+ const _ = ht().listPrompts;
1475
+ S.value = _ ? await _() : await Mo();
1433
1476
  } catch {
1434
- Q.warning("加载提示词失败");
1477
+ ee.warning("加载提示词失败");
1435
1478
  } finally {
1436
- V.value = !1;
1479
+ D.value = !1;
1437
1480
  }
1438
1481
  }
1439
1482
  }
1440
1483
  function L() {
1441
- d.value ? O({}) : O(ae.options), t.showPromptSelect && f();
1484
+ y.value ? F({}) : F(ae.options), t.showPromptSelect && v();
1442
1485
  }
1443
1486
  ne(
1444
1487
  () => t.prompts,
1445
- (h) => {
1446
- h != null && h.length && (C.value = [...h]);
1488
+ (_) => {
1489
+ _ != null && _.length && (S.value = [..._]);
1447
1490
  },
1448
1491
  { deep: !0 }
1449
1492
  ), ne(
1450
1493
  () => [t.freeText, t.promptId, t.autoMatch],
1451
- ([h, k, Y]) => {
1452
- v.value || (r.value.freeText = h ?? "", r.value.promptId = k, r.value.autoMatch = Y ?? !1);
1494
+ ([_, C, K]) => {
1495
+ c.value || (r.value.freeText = _ ?? "", r.value.promptId = C, r.value.autoMatch = K ?? !1);
1453
1496
  }
1454
1497
  );
1455
- function H() {
1498
+ function z() {
1456
1499
  r.value.autoMatch && (r.value.promptId = void 0);
1457
1500
  }
1458
- function S() {
1459
- F.value = !1;
1501
+ function $() {
1502
+ N.value = !1;
1460
1503
  }
1461
- function U() {
1462
- s.showPanel();
1504
+ function M() {
1505
+ l.showPanel();
1463
1506
  }
1464
- async function N() {
1465
- var W, ee;
1507
+ async function Y() {
1508
+ var X, H;
1466
1509
  if (!r.value.freeText.trim()) {
1467
- Q.warning("请填写需求描述");
1510
+ ee.warning("请填写需求描述");
1468
1511
  return;
1469
1512
  }
1470
- const h = r.value.autoMatch, k = h ? void 0 : r.value.promptId;
1471
- if (!h && k == null) {
1472
- const A = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
1473
- Q.warning(A);
1513
+ const _ = r.value.autoMatch, C = _ ? void 0 : r.value.promptId;
1514
+ if (!_ && C == null) {
1515
+ const Q = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
1516
+ ee.warning(Q);
1474
1517
  return;
1475
1518
  }
1476
- F.value = !0;
1477
- const Y = d.value ? X.value : ae.options.onFinish, j = s.enqueue({
1519
+ N.value = !0;
1520
+ const K = y.value ? q.value : ae.options.onFinish, j = l.enqueue({
1478
1521
  freeText: r.value.freeText.trim(),
1479
- promptId: k,
1480
- autoMatch: h && k == null ? !0 : void 0,
1522
+ promptId: C,
1523
+ autoMatch: _ && C == null ? !0 : void 0,
1481
1524
  showPanel: !0,
1482
- onFinish: Y
1525
+ onFinish: K
1483
1526
  });
1484
- d.value ? o("submitted", j) : (ee = (W = ae.options).onSubmitted) == null || ee.call(W, j), v.value = !1, F.value = !1, Q.success("已加入任务队列,可在任务面板查看进度");
1527
+ y.value ? o("submitted", j) : (H = (X = ae.options).onSubmitted) == null || H.call(X, j), c.value = !1, N.value = !1, ee.success("已加入任务队列,可在任务面板查看进度");
1485
1528
  }
1486
- return (h, k) => {
1487
- const Y = B("el-switch"), j = B("el-form-item"), W = B("el-option"), ee = B("el-select"), A = B("el-input"), oe = B("el-form"), le = B("el-button"), te = B("el-dialog");
1488
- return u(), M(te, {
1489
- modelValue: v.value,
1490
- "onUpdate:modelValue": k[4] || (k[4] = (R) => v.value = R),
1491
- title: y.value,
1529
+ return (_, C) => {
1530
+ const K = V("el-switch"), j = V("el-form-item"), X = V("el-option"), H = V("el-select"), Q = V("el-input"), O = V("el-form"), Z = V("el-button"), se = V("el-dialog");
1531
+ return u(), E(se, {
1532
+ modelValue: c.value,
1533
+ "onUpdate:modelValue": C[4] || (C[4] = (U) => c.value = U),
1534
+ title: p.value,
1492
1535
  width: e.width,
1493
1536
  "append-to-body": "",
1494
1537
  class: "ai-use-dialog",
1495
- onClosed: S,
1538
+ onClosed: $,
1496
1539
  onOpen: L
1497
1540
  }, {
1498
1541
  footer: g(() => [
1499
- T("div", xo, [
1500
- e.showTaskListButton ? (u(), M(le, {
1542
+ T("div", Po, [
1543
+ e.showTaskListButton ? (u(), E(Z, {
1501
1544
  key: 0,
1502
1545
  link: "",
1503
1546
  type: "primary",
1504
- onClick: U
1547
+ onClick: M
1505
1548
  }, {
1506
1549
  default: g(() => [
1507
- G(D(e.taskListButtonText), 1)
1550
+ W(B(e.taskListButtonText), 1)
1508
1551
  ]),
1509
1552
  _: 1
1510
- })) : $("", !0),
1511
- T("div", bo, [
1512
- m(le, {
1513
- onClick: k[3] || (k[3] = (R) => v.value = !1)
1553
+ })) : b("", !0),
1554
+ T("div", $o, [
1555
+ m(Z, {
1556
+ onClick: C[3] || (C[3] = (U) => c.value = !1)
1514
1557
  }, {
1515
- default: g(() => [...k[5] || (k[5] = [
1516
- G("取消", -1)
1558
+ default: g(() => [...C[5] || (C[5] = [
1559
+ W("取消", -1)
1517
1560
  ])]),
1518
1561
  _: 1
1519
1562
  }),
1520
- m(le, {
1563
+ m(Z, {
1521
1564
  type: "primary",
1522
- loading: F.value,
1523
- onClick: N
1565
+ loading: N.value,
1566
+ onClick: Y
1524
1567
  }, {
1525
1568
  default: g(() => [
1526
- G(D(e.submitText), 1)
1569
+ W(B(e.submitText), 1)
1527
1570
  ]),
1528
1571
  _: 1
1529
1572
  }, 8, ["loading"])
@@ -1531,58 +1574,58 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1531
1574
  ])
1532
1575
  ]),
1533
1576
  default: g(() => [
1534
- m(oe, { "label-position": "top" }, {
1577
+ m(O, { "label-position": "top" }, {
1535
1578
  default: g(() => [
1536
- e.showAutoMatch ? (u(), M(j, {
1579
+ e.showAutoMatch ? (u(), E(j, {
1537
1580
  key: 0,
1538
1581
  label: e.autoMatchLabel
1539
1582
  }, {
1540
1583
  default: g(() => [
1541
- m(Y, {
1584
+ m(K, {
1542
1585
  modelValue: r.value.autoMatch,
1543
- "onUpdate:modelValue": k[0] || (k[0] = (R) => r.value.autoMatch = R),
1586
+ "onUpdate:modelValue": C[0] || (C[0] = (U) => r.value.autoMatch = U),
1544
1587
  "active-text": "按需求自动选",
1545
1588
  "inactive-text": "手动指定",
1546
- onChange: H
1589
+ onChange: z
1547
1590
  }, null, 8, ["modelValue"])
1548
1591
  ]),
1549
1592
  _: 1
1550
- }, 8, ["label"])) : $("", !0),
1551
- e.showPromptSelect ? (u(), M(j, {
1593
+ }, 8, ["label"])) : b("", !0),
1594
+ e.showPromptSelect ? (u(), E(j, {
1552
1595
  key: 1,
1553
1596
  label: e.promptLabel,
1554
1597
  required: !r.value.autoMatch
1555
1598
  }, {
1556
1599
  default: g(() => [
1557
- m(ee, {
1600
+ m(H, {
1558
1601
  modelValue: r.value.promptId,
1559
- "onUpdate:modelValue": k[1] || (k[1] = (R) => r.value.promptId = R),
1602
+ "onUpdate:modelValue": C[1] || (C[1] = (U) => r.value.promptId = U),
1560
1603
  filterable: "",
1561
1604
  clearable: "",
1562
1605
  placeholder: r.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
1563
1606
  style: { width: "100%" },
1564
- loading: V.value
1607
+ loading: D.value
1565
1608
  }, {
1566
1609
  default: g(() => [
1567
- (u(!0), E(re, null, he(C.value, (R) => (u(), M(W, {
1568
- key: R.id,
1569
- label: R.name,
1570
- value: R.id
1610
+ (u(!0), A(ce, null, ye(S.value, (U) => (u(), E(X, {
1611
+ key: U.id,
1612
+ label: U.name,
1613
+ value: U.id
1571
1614
  }, null, 8, ["label", "value"]))), 128))
1572
1615
  ]),
1573
1616
  _: 1
1574
1617
  }, 8, ["modelValue", "placeholder", "loading"])
1575
1618
  ]),
1576
1619
  _: 1
1577
- }, 8, ["label", "required"])) : $("", !0),
1620
+ }, 8, ["label", "required"])) : b("", !0),
1578
1621
  m(j, {
1579
1622
  label: e.freeTextLabel,
1580
1623
  required: ""
1581
1624
  }, {
1582
1625
  default: g(() => [
1583
- m(A, {
1626
+ m(Q, {
1584
1627
  modelValue: r.value.freeText,
1585
- "onUpdate:modelValue": k[2] || (k[2] = (R) => r.value.freeText = R),
1628
+ "onUpdate:modelValue": C[2] || (C[2] = (U) => r.value.freeText = U),
1586
1629
  type: "textarea",
1587
1630
  rows: 4,
1588
1631
  placeholder: e.freeTextPlaceholder
@@ -1598,104 +1641,104 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1598
1641
  }, 8, ["modelValue", "title", "width"]);
1599
1642
  };
1600
1643
  }
1601
- }), Eo = /* @__PURE__ */ Ee(Ao, [["__scopeId", "data-v-9aa82e83"]]), Mo = { class: "ai-task-panel" }, Po = { class: "ai-task-panel__header" }, $o = { class: "ai-task-panel__header-left" }, Lo = { class: "ai-task-panel__titles" }, Do = { class: "ai-task-panel__subtitle" }, Bo = { class: "ai-task-panel__title" }, Vo = { class: "ai-task-panel__header-actions" }, Oo = { class: "ai-task-panel__body" }, Uo = {
1644
+ }), Do = /* @__PURE__ */ Me(Lo, [["__scopeId", "data-v-9aa82e83"]]), Bo = { class: "ai-task-panel" }, Vo = { class: "ai-task-panel__header" }, Oo = { class: "ai-task-panel__header-left" }, Fo = { class: "ai-task-panel__titles" }, Uo = { class: "ai-task-panel__subtitle" }, Ro = { class: "ai-task-panel__title" }, No = { class: "ai-task-panel__header-actions" }, Ko = { class: "ai-task-panel__body" }, Yo = {
1602
1645
  key: 1,
1603
1646
  class: "ai-task-list"
1604
- }, Fo = { class: "ai-task-row__icon" }, Ro = { class: "ai-task-row__main" }, Ko = { class: "ai-task-row__title" }, No = { class: "ai-task-row__meta" }, zo = { key: 0 }, Yo = {
1647
+ }, zo = { class: "ai-task-row__icon" }, jo = { class: "ai-task-row__main" }, Go = { class: "ai-task-row__title" }, Wo = { class: "ai-task-row__meta" }, qo = { key: 0 }, Ho = {
1605
1648
  key: 0,
1606
1649
  class: "ai-task-row__summary"
1607
- }, jo = { class: "ai-task-row__ops" }, Go = {
1650
+ }, Jo = { class: "ai-task-row__ops" }, Xo = {
1608
1651
  key: 0,
1609
1652
  class: "ai-task-panel__footer"
1610
- }, Wo = /* @__PURE__ */ de({
1653
+ }, Qo = /* @__PURE__ */ ue({
1611
1654
  __name: "AiTaskPanel",
1612
1655
  emits: ["use"],
1613
1656
  setup(e, { emit: n }) {
1614
- const t = n, o = We(), s = b(null), d = {
1657
+ const t = n, o = qe(), l = k(null), y = {
1615
1658
  pending: "等待中",
1616
1659
  running: "执行中",
1617
1660
  succeeded: "已完成",
1618
1661
  failed: "失败",
1619
1662
  cancelled: "已取消"
1620
1663
  };
1621
- function v(y) {
1622
- return d[y] ?? y;
1664
+ function c(p) {
1665
+ return y[p] ?? p;
1623
1666
  }
1624
- async function _(y) {
1625
- s.value = y.id;
1667
+ async function h(p) {
1668
+ l.value = p.id;
1626
1669
  try {
1627
- const r = y.result ?? await o.loadTaskResult(y.id);
1670
+ const r = p.result ?? await o.loadTaskResult(p.id);
1628
1671
  if (!r) return;
1629
1672
  t("use", {
1630
- taskId: y.id,
1631
- runId: y.runId,
1632
- title: y.title,
1633
- freeText: y.freeText,
1634
- promptId: y.promptId,
1673
+ taskId: p.id,
1674
+ runId: p.runId,
1675
+ title: p.title,
1676
+ freeText: p.freeText,
1677
+ promptId: p.promptId,
1635
1678
  result: r,
1636
- finishedAt: y.finishedAt ?? Date.now()
1679
+ finishedAt: p.finishedAt ?? Date.now()
1637
1680
  });
1638
1681
  } finally {
1639
- s.value = null;
1682
+ l.value = null;
1640
1683
  }
1641
1684
  }
1642
- return (y, r) => {
1643
- const C = B("el-icon"), V = B("el-button"), F = B("el-empty"), X = B("el-progress"), O = B("el-badge");
1644
- return u(), M(Jt, { to: "body" }, [
1645
- m(pt, { name: "ai-panel-slide" }, {
1685
+ return (p, r) => {
1686
+ const S = V("el-icon"), D = V("el-button"), N = V("el-empty"), q = V("el-progress"), F = V("el-badge");
1687
+ return u(), E(Zt, { to: "body" }, [
1688
+ m(gt, { name: "ai-panel-slide" }, {
1646
1689
  default: g(() => [
1647
- _e(T("div", Mo, [
1648
- T("div", Po, [
1649
- T("div", $o, [
1690
+ we(T("div", Bo, [
1691
+ T("div", Vo, [
1692
+ T("div", Oo, [
1650
1693
  T("div", {
1651
- class: fe(["ai-task-panel__icon", { spinning: w(o).activeCount > 0 }])
1694
+ class: me(["ai-task-panel__icon", { spinning: w(o).activeCount > 0 }])
1652
1695
  }, [
1653
- m(C, null, {
1696
+ m(S, null, {
1654
1697
  default: g(() => [
1655
- m(w(lt))
1698
+ m(w(it))
1656
1699
  ]),
1657
1700
  _: 1
1658
1701
  })
1659
1702
  ], 2),
1660
- T("div", Lo, [
1661
- T("div", Do, D(w(o).panelSubtitle), 1),
1662
- T("div", Bo, D(w(o).panelTitle), 1)
1703
+ T("div", Fo, [
1704
+ T("div", Uo, B(w(o).panelSubtitle), 1),
1705
+ T("div", Ro, B(w(o).panelTitle), 1)
1663
1706
  ])
1664
1707
  ]),
1665
- T("div", Vo, [
1666
- w(o).runningCount > 0 ? (u(), M(V, {
1708
+ T("div", No, [
1709
+ w(o).runningCount > 0 ? (u(), E(D, {
1667
1710
  key: 0,
1668
1711
  link: "",
1669
1712
  type: "primary",
1670
- onClick: r[0] || (r[0] = (f) => w(o).cancelAll())
1713
+ onClick: r[0] || (r[0] = (v) => w(o).cancelAll())
1671
1714
  }, {
1672
1715
  default: g(() => [...r[5] || (r[5] = [
1673
- G(" 取消全部 ", -1)
1716
+ W(" 取消全部 ", -1)
1674
1717
  ])]),
1675
1718
  _: 1
1676
- })) : $("", !0),
1677
- m(V, {
1719
+ })) : b("", !0),
1720
+ m(D, {
1678
1721
  link: "",
1679
- onClick: r[1] || (r[1] = (f) => w(o).toggleMinimize())
1722
+ onClick: r[1] || (r[1] = (v) => w(o).toggleMinimize())
1680
1723
  }, {
1681
1724
  default: g(() => [
1682
- m(C, null, {
1725
+ m(S, null, {
1683
1726
  default: g(() => [
1684
- m(w(ln))
1727
+ m(w(rn))
1685
1728
  ]),
1686
1729
  _: 1
1687
1730
  })
1688
1731
  ]),
1689
1732
  _: 1
1690
1733
  }),
1691
- m(V, {
1734
+ m(D, {
1692
1735
  link: "",
1693
- onClick: r[2] || (r[2] = (f) => w(o).hidePanel())
1736
+ onClick: r[2] || (r[2] = (v) => w(o).hidePanel())
1694
1737
  }, {
1695
1738
  default: g(() => [
1696
- m(C, null, {
1739
+ m(S, null, {
1697
1740
  default: g(() => [
1698
- m(w(gt))
1741
+ m(w(_t))
1699
1742
  ]),
1700
1743
  _: 1
1701
1744
  })
@@ -1704,142 +1747,142 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1704
1747
  })
1705
1748
  ])
1706
1749
  ]),
1707
- T("div", Oo, [
1708
- w(o).tasks.length ? (u(), E("div", Uo, [
1709
- (u(!0), E(re, null, he(w(o).tasks, (f) => (u(), E("div", {
1710
- key: f.id,
1750
+ T("div", Ko, [
1751
+ w(o).tasks.length ? (u(), A("div", Yo, [
1752
+ (u(!0), A(ce, null, ye(w(o).tasks, (v) => (u(), A("div", {
1753
+ key: v.id,
1711
1754
  class: "ai-task-row"
1712
1755
  }, [
1713
- T("div", Fo, [
1714
- f.status === "succeeded" ? (u(), M(C, {
1756
+ T("div", zo, [
1757
+ v.status === "succeeded" ? (u(), E(S, {
1715
1758
  key: 0,
1716
1759
  class: "ok"
1717
1760
  }, {
1718
1761
  default: g(() => [
1719
- m(w(an))
1762
+ m(w(un))
1720
1763
  ]),
1721
1764
  _: 1
1722
- })) : f.status === "failed" ? (u(), M(C, {
1765
+ })) : v.status === "failed" ? (u(), E(S, {
1723
1766
  key: 1,
1724
1767
  class: "err"
1725
1768
  }, {
1726
1769
  default: g(() => [
1727
- m(w(sn))
1770
+ m(w(cn))
1728
1771
  ]),
1729
1772
  _: 1
1730
- })) : f.status === "running" || f.status === "pending" ? (u(), M(X, {
1773
+ })) : v.status === "running" || v.status === "pending" ? (u(), E(q, {
1731
1774
  key: 2,
1732
1775
  type: "circle",
1733
- percentage: f.progress,
1776
+ percentage: v.progress,
1734
1777
  width: 36,
1735
1778
  "stroke-width": 3
1736
- }, null, 8, ["percentage"])) : (u(), M(C, {
1779
+ }, null, 8, ["percentage"])) : (u(), E(S, {
1737
1780
  key: 3,
1738
1781
  class: "muted"
1739
1782
  }, {
1740
1783
  default: g(() => [
1741
- m(w(rn))
1784
+ m(w(dn))
1742
1785
  ]),
1743
1786
  _: 1
1744
1787
  }))
1745
1788
  ]),
1746
- T("div", Ro, [
1747
- T("div", Ko, D(f.title), 1),
1748
- T("div", No, [
1749
- T("span", null, D(v(f.status)), 1),
1750
- f.runId ? (u(), E("span", zo, " · #" + D(f.runId), 1)) : $("", !0)
1789
+ T("div", jo, [
1790
+ T("div", Go, B(v.title), 1),
1791
+ T("div", Wo, [
1792
+ T("span", null, B(c(v.status)), 1),
1793
+ v.runId ? (u(), A("span", qo, " · #" + B(v.runId), 1)) : b("", !0)
1751
1794
  ]),
1752
- f.summary ? (u(), E("div", Yo, D(f.summary), 1)) : $("", !0)
1795
+ v.summary ? (u(), A("div", Ho, B(v.summary), 1)) : b("", !0)
1753
1796
  ]),
1754
- T("div", jo, [
1755
- f.status === "running" || f.status === "pending" ? (u(), M(V, {
1797
+ T("div", Jo, [
1798
+ v.status === "running" || v.status === "pending" ? (u(), E(D, {
1756
1799
  key: 0,
1757
1800
  link: "",
1758
1801
  type: "danger",
1759
1802
  size: "small",
1760
- onClick: (L) => w(o).cancelTask(f.id)
1803
+ onClick: (L) => w(o).cancelTask(v.id)
1761
1804
  }, {
1762
1805
  default: g(() => [...r[6] || (r[6] = [
1763
- G(" 取消 ", -1)
1806
+ W(" 取消 ", -1)
1764
1807
  ])]),
1765
1808
  _: 1
1766
- }, 8, ["onClick"])) : $("", !0),
1767
- f.status === "succeeded" && f.runId ? (u(), M(V, {
1809
+ }, 8, ["onClick"])) : b("", !0),
1810
+ v.status === "succeeded" && v.runId ? (u(), E(D, {
1768
1811
  key: 1,
1769
1812
  link: "",
1770
1813
  type: "primary",
1771
1814
  size: "small",
1772
- loading: s.value === f.id,
1773
- onClick: (L) => _(f)
1815
+ loading: l.value === v.id,
1816
+ onClick: (L) => h(v)
1774
1817
  }, {
1775
1818
  default: g(() => [...r[7] || (r[7] = [
1776
- G(" 使用 ", -1)
1819
+ W(" 使用 ", -1)
1777
1820
  ])]),
1778
1821
  _: 1
1779
- }, 8, ["loading", "onClick"])) : $("", !0),
1780
- f.status !== "running" && f.status !== "pending" ? (u(), M(V, {
1822
+ }, 8, ["loading", "onClick"])) : b("", !0),
1823
+ v.status !== "running" && v.status !== "pending" ? (u(), E(D, {
1781
1824
  key: 2,
1782
1825
  link: "",
1783
1826
  size: "small",
1784
- onClick: (L) => w(o).removeTask(f.id)
1827
+ onClick: (L) => w(o).removeTask(v.id)
1785
1828
  }, {
1786
1829
  default: g(() => [...r[8] || (r[8] = [
1787
- G(" 移除 ", -1)
1830
+ W(" 移除 ", -1)
1788
1831
  ])]),
1789
1832
  _: 1
1790
- }, 8, ["onClick"])) : $("", !0)
1833
+ }, 8, ["onClick"])) : b("", !0)
1791
1834
  ])
1792
1835
  ]))), 128))
1793
- ])) : (u(), M(F, {
1836
+ ])) : (u(), E(N, {
1794
1837
  key: 0,
1795
1838
  description: "暂无 AI 任务",
1796
1839
  "image-size": 64
1797
1840
  }))
1798
1841
  ]),
1799
- w(o).tasks.some((f) => f.status !== "running" && f.status !== "pending") ? (u(), E("div", Go, [
1800
- m(V, {
1842
+ w(o).tasks.some((v) => v.status !== "running" && v.status !== "pending") ? (u(), A("div", Xo, [
1843
+ m(D, {
1801
1844
  link: "",
1802
1845
  type: "info",
1803
- onClick: r[3] || (r[3] = (f) => w(o).clearFinished())
1846
+ onClick: r[3] || (r[3] = (v) => w(o).clearFinished())
1804
1847
  }, {
1805
1848
  default: g(() => [...r[9] || (r[9] = [
1806
- G("清除已完成", -1)
1849
+ W("清除已完成", -1)
1807
1850
  ])]),
1808
1851
  _: 1
1809
1852
  })
1810
- ])) : $("", !0)
1853
+ ])) : b("", !0)
1811
1854
  ], 512), [
1812
- [De, w(o).panelVisible && !w(o).panelMinimized]
1855
+ [Be, w(o).panelVisible && !w(o).panelMinimized]
1813
1856
  ])
1814
1857
  ]),
1815
1858
  _: 1
1816
1859
  }),
1817
- _e(T("div", {
1860
+ we(T("div", {
1818
1861
  class: "ai-task-panel-mini",
1819
- onClick: r[4] || (r[4] = (f) => w(o).toggleMinimize())
1862
+ onClick: r[4] || (r[4] = (v) => w(o).toggleMinimize())
1820
1863
  }, [
1821
- w(o).activeCount > 0 ? (u(), M(C, {
1864
+ w(o).activeCount > 0 ? (u(), E(S, {
1822
1865
  key: 0,
1823
1866
  class: "spinning"
1824
1867
  }, {
1825
1868
  default: g(() => [
1826
- m(w(lt))
1869
+ m(w(it))
1827
1870
  ]),
1828
1871
  _: 1
1829
- })) : $("", !0),
1830
- T("span", null, D(w(o).panelSubtitle), 1),
1831
- w(o).runningCount > 0 ? (u(), M(O, {
1872
+ })) : b("", !0),
1873
+ T("span", null, B(w(o).panelSubtitle), 1),
1874
+ w(o).runningCount > 0 ? (u(), E(F, {
1832
1875
  key: 1,
1833
1876
  value: w(o).runningCount,
1834
1877
  class: "m-l-8"
1835
- }, null, 8, ["value"])) : $("", !0)
1878
+ }, null, 8, ["value"])) : b("", !0)
1836
1879
  ], 512), [
1837
- [De, w(o).panelVisible && w(o).panelMinimized]
1880
+ [Be, w(o).panelVisible && w(o).panelMinimized]
1838
1881
  ])
1839
1882
  ]);
1840
1883
  };
1841
1884
  }
1842
- }), qo = /* @__PURE__ */ Ee(Wo, [["__scopeId", "data-v-812b3127"]]), il = /* @__PURE__ */ de({
1885
+ }), Zo = /* @__PURE__ */ Me(Qo, [["__scopeId", "data-v-812b3127"]]), dl = /* @__PURE__ */ ue({
1843
1886
  __name: "AiTaskProvider",
1844
1887
  props: {
1845
1888
  title: {},
@@ -1862,10 +1905,10 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1862
1905
  },
1863
1906
  emits: ["finish", "use"],
1864
1907
  setup(e, { emit: n }) {
1865
- const t = e, o = n, s = Mt();
1866
- Be(bt, s), Be(xt, St(s));
1867
- const d = P(() => {
1868
- const y = {
1908
+ const t = e, o = n, l = $t();
1909
+ Ve(At, l), Ve(bt, kt(l));
1910
+ const y = P(() => {
1911
+ const p = {
1869
1912
  title: t.title,
1870
1913
  freeText: t.freeText,
1871
1914
  promptId: t.promptId,
@@ -1882,61 +1925,61 @@ const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__foo
1882
1925
  taskListButtonText: t.taskListButtonText,
1883
1926
  width: t.width
1884
1927
  };
1885
- return t.modelValue !== void 0 && (y.modelValue = t.modelValue), y;
1928
+ return t.modelValue !== void 0 && (p.modelValue = t.modelValue), p;
1886
1929
  });
1887
- let v;
1888
- function _(y) {
1889
- o("use", y);
1930
+ let c;
1931
+ function h(p) {
1932
+ o("use", p);
1890
1933
  }
1891
1934
  return Ke(() => {
1892
- s.hydrate(), v = s.onTaskFinish((y) => o("finish", y));
1893
- }), Ne(() => {
1894
- v == null || v();
1895
- }), (y, r) => (u(), E(re, null, [
1896
- e.showDialog !== !1 ? (u(), M(Eo, ft(ze({ key: 0 }, d.value)), null, 16)) : $("", !0),
1897
- m(qo, { onUse: _ }),
1898
- ye(y.$slots, "default")
1935
+ l.hydrate(), c = l.onTaskFinish((p) => o("finish", p));
1936
+ }), Ye(() => {
1937
+ c == null || c();
1938
+ }), (p, r) => (u(), A(ce, null, [
1939
+ e.showDialog !== !1 ? (u(), E(Do, mt(ze({ key: 0 }, y.value)), null, 16)) : b("", !0),
1940
+ m(Zo, { onUse: h }),
1941
+ Te(p.$slots, "default")
1899
1942
  ], 64));
1900
1943
  }
1901
1944
  });
1902
- function sl() {
1903
- const e = Ye(xt, null);
1904
- return e || St(We());
1945
+ function fl() {
1946
+ const e = je(bt, null);
1947
+ return e || kt(qe());
1905
1948
  }
1906
- function Ho() {
1907
- const e = b(!1), n = b({});
1949
+ function el() {
1950
+ const e = k(!1), n = k({});
1908
1951
  let t = null;
1909
- function o(_) {
1910
- t == null || t.resolve(_), t = null;
1952
+ function o(h) {
1953
+ t == null || t.resolve(h), t = null;
1911
1954
  }
1912
- function s() {
1955
+ function l() {
1913
1956
  t == null || t.reject(new be()), t = null;
1914
1957
  }
1915
- function d(_ = {}) {
1958
+ function y(h = {}) {
1916
1959
  t && (t.reject(new be()), t = null);
1917
- const y = new Promise((r, C) => {
1918
- t = { resolve: r, reject: C };
1960
+ const p = new Promise((r, S) => {
1961
+ t = { resolve: r, reject: S };
1919
1962
  });
1920
- return n.value = { ..._ }, e.value = !0, y;
1963
+ return n.value = { ...h }, e.value = !0, p;
1921
1964
  }
1922
- function v() {
1965
+ function c() {
1923
1966
  e.value = !1;
1924
1967
  }
1925
1968
  return {
1926
1969
  dialogVisible: e,
1927
1970
  dialogOptions: n,
1928
- openImageSelector: d,
1929
- closeImageSelector: v,
1971
+ openImageSelector: y,
1972
+ closeImageSelector: c,
1930
1973
  settlePendingConfirm: o,
1931
- settlePendingCancel: s
1974
+ settlePendingCancel: l
1932
1975
  };
1933
1976
  }
1934
- const Jo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1935
- function Xo(e) {
1977
+ const tl = "__YC_IMAGE_SELECTOR_CTX_KEY__";
1978
+ function nl(e) {
1936
1979
  const n = globalThis;
1937
1980
  return n[e] || (n[e] = Symbol(e)), n[e];
1938
1981
  }
1939
- const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
1982
+ const Lt = nl(tl), pl = /* @__PURE__ */ ue({
1940
1983
  __name: "YcImageSelectorProvider",
1941
1984
  props: {
1942
1985
  modelValue: { type: [Boolean, null] },
@@ -1957,113 +2000,115 @@ const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
1957
2000
  cancelText: { default: "取消" },
1958
2001
  emptyText: { default: "暂无图片资源" },
1959
2002
  renderEmpty: {},
2003
+ renderFooterExtra: {},
1960
2004
  getImages: {},
1961
2005
  upload: {},
1962
2006
  urlField: { default: "url" },
1963
2007
  showDialog: { type: Boolean, default: !0 }
1964
2008
  },
1965
2009
  setup(e, { expose: n }) {
1966
- const t = e, o = Ho(), {
1967
- dialogVisible: s,
1968
- dialogOptions: d,
1969
- openImageSelector: v,
1970
- closeImageSelector: _,
1971
- settlePendingConfirm: y,
2010
+ const t = e, o = el(), {
2011
+ dialogVisible: l,
2012
+ dialogOptions: y,
2013
+ openImageSelector: c,
2014
+ closeImageSelector: h,
2015
+ settlePendingConfirm: p,
1972
2016
  settlePendingCancel: r
1973
2017
  } = o;
1974
- Be(Pt, o);
1975
- function C(O, f) {
1976
- return O in d.value ? d.value[O] : f;
2018
+ Ve(Lt, o);
2019
+ function S(F, v) {
2020
+ return F in y.value ? y.value[F] : v;
1977
2021
  }
1978
- const V = P(() => ({
1979
- title: C("title", t.title),
1980
- multiple: C("multiple", t.multiple),
1981
- maxCount: C("maxCount", t.maxCount),
1982
- selected: C("selected", t.selected),
2022
+ const D = P(() => ({
2023
+ title: S("title", t.title),
2024
+ multiple: S("multiple", t.multiple),
2025
+ maxCount: S("maxCount", t.maxCount),
2026
+ selected: S("selected", t.selected),
1983
2027
  width: t.width,
1984
2028
  pageSize: t.pageSize,
1985
2029
  showUpload: t.showUpload,
1986
2030
  accept: t.accept,
1987
- showCategories: C("showCategories", t.showCategories),
1988
- categories: C("categories", t.categories),
1989
- categoryAllLabel: C("categoryAllLabel", t.categoryAllLabel),
1990
- showModeSwitch: C("showModeSwitch", t.showModeSwitch),
1991
- confirmOnSelect: C("confirmOnSelect", t.confirmOnSelect),
2031
+ showCategories: S("showCategories", t.showCategories),
2032
+ categories: S("categories", t.categories),
2033
+ categoryAllLabel: S("categoryAllLabel", t.categoryAllLabel),
2034
+ showModeSwitch: S("showModeSwitch", t.showModeSwitch),
2035
+ confirmOnSelect: S("confirmOnSelect", t.confirmOnSelect),
1992
2036
  confirmText: t.confirmText,
1993
2037
  cancelText: t.cancelText,
1994
2038
  emptyText: t.emptyText,
1995
2039
  renderEmpty: t.renderEmpty,
2040
+ renderFooterExtra: t.renderFooterExtra,
1996
2041
  getImages: t.getImages,
1997
2042
  upload: t.upload,
1998
2043
  urlField: t.urlField
1999
2044
  }));
2000
- function F(O) {
2001
- var f, L;
2002
- (L = (f = d.value).onConfirm) == null || L.call(f, O), y(O), _();
2045
+ function N(F) {
2046
+ var v, L;
2047
+ (L = (v = y.value).onConfirm) == null || L.call(v, F), p(F), h();
2003
2048
  }
2004
- function X() {
2005
- var O, f;
2006
- (f = (O = d.value).onCancel) == null || f.call(O), r(), _();
2049
+ function q() {
2050
+ var F, v;
2051
+ (v = (F = y.value).onCancel) == null || v.call(F), r(), h();
2007
2052
  }
2008
- return n({ openImageSelector: v, closeImageSelector: _ }), (O, f) => (u(), E(re, null, [
2009
- e.showDialog !== !1 ? (u(), M(Tt, ze({
2053
+ return n({ openImageSelector: c, closeImageSelector: h }), (F, v) => (u(), A(ce, null, [
2054
+ e.showDialog !== !1 ? (u(), E(Ct, ze({
2010
2055
  key: 0,
2011
- modelValue: w(s),
2012
- "onUpdate:modelValue": f[0] || (f[0] = (L) => Xt(s) ? s.value = L : null)
2013
- }, V.value, {
2014
- onConfirm: F,
2015
- onCancel: X
2016
- }), null, 16, ["modelValue"])) : $("", !0),
2017
- ye(O.$slots, "default")
2056
+ modelValue: w(l),
2057
+ "onUpdate:modelValue": v[0] || (v[0] = (L) => en(l) ? l.value = L : null)
2058
+ }, D.value, {
2059
+ onConfirm: N,
2060
+ onCancel: q
2061
+ }), null, 16, ["modelValue"])) : b("", !0),
2062
+ Te(F.$slots, "default")
2018
2063
  ], 64));
2019
2064
  }
2020
2065
  });
2021
- function ul() {
2022
- const e = Ye(Pt, null);
2066
+ function ml() {
2067
+ const e = je(Lt, null);
2023
2068
  return e ? {
2024
2069
  openImageSelector: (n = {}) => e.openImageSelector(n),
2025
2070
  closeImageSelector: () => e.closeImageSelector()
2026
2071
  } : {
2027
- openImageSelector: wt,
2028
- closeImageSelector: yt
2072
+ openImageSelector: It,
2073
+ closeImageSelector: Tt
2029
2074
  };
2030
2075
  }
2031
2076
  export {
2032
- qo as AiTaskPanel,
2033
- il as AiTaskProvider,
2034
- Eo as AiUseDialog,
2035
- Pt as IMAGE_SELECTOR_INJECT_KEY,
2036
- at as ImageSelectorAuthError,
2077
+ Zo as AiTaskPanel,
2078
+ dl as AiTaskProvider,
2079
+ Do as AiUseDialog,
2080
+ Lt as IMAGE_SELECTOR_INJECT_KEY,
2081
+ st as ImageSelectorAuthError,
2037
2082
  be as ImageSelectorCancelledError,
2038
- Tt as ImageSelectorDialog,
2039
- rl as ImageSelectorProvider,
2040
- rt as SkyPageWindow,
2041
- qo as YcAiTaskPanel,
2042
- il as YcAiTaskProvider,
2043
- Eo as YcAiUseDialog,
2044
- ll as YcComponent,
2045
- Tt as YcImageSelectorDialog,
2046
- rl as YcImageSelectorProvider,
2047
- rt as YcPageWindow,
2048
- yt as closeImageSelector,
2049
- Ho as createImageSelectorApi,
2050
- ll as default,
2051
- jn as fetchImages,
2052
- vt as getAiTaskConfig,
2083
+ Ct as ImageSelectorDialog,
2084
+ pl as ImageSelectorProvider,
2085
+ ct as SkyPageWindow,
2086
+ Zo as YcAiTaskPanel,
2087
+ dl as YcAiTaskProvider,
2088
+ Do as YcAiUseDialog,
2089
+ ul as YcComponent,
2090
+ Ct as YcImageSelectorDialog,
2091
+ pl as YcImageSelectorProvider,
2092
+ ct as YcPageWindow,
2093
+ Tt as closeImageSelector,
2094
+ el as createImageSelectorApi,
2095
+ ul as default,
2096
+ Jn as fetchImages,
2097
+ ht as getAiTaskConfig,
2053
2098
  Ae as getImageSelectorConfig,
2054
- Ct as hideAiDialog,
2055
- _t as hideImageSelectorDialog,
2056
- Hn as installImageSelector,
2057
- no as installYcComponent,
2058
- ko as listPrompts,
2059
- al as openAiUseDialog,
2060
- wt as openImageSelector,
2061
- dn as setAiTaskConfig,
2062
- gn as setImageSelectorConfig,
2063
- Ge as showAiDialog,
2064
- yn as showImageSelectorDialog,
2065
- Gn as uploadImage,
2066
- sl as useAiTask,
2067
- Mt as useAiTaskStore,
2068
- ul as useImageSelector
2099
+ xt as hideAiDialog,
2100
+ wt as hideImageSelectorDialog,
2101
+ eo as installImageSelector,
2102
+ so as installYcComponent,
2103
+ Mo as listPrompts,
2104
+ cl as openAiUseDialog,
2105
+ It as openImageSelector,
2106
+ mn as setAiTaskConfig,
2107
+ hn as setImageSelectorConfig,
2108
+ We as showAiDialog,
2109
+ In as showImageSelectorDialog,
2110
+ Xn as uploadImage,
2111
+ fl as useAiTask,
2112
+ $t as useAiTaskStore,
2113
+ ml as useImageSelector
2069
2114
  };