@skopon-cool/form-sdk 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/catalog/skoponCaseSelect.d.ts.map +1 -1
  2. package/dist/catalog/skoponResumeSelect.d.ts.map +1 -1
  3. package/dist/catalog/useSkoponBoundField.d.ts.map +1 -1
  4. package/dist/components/AskUserFormCard.d.ts.map +1 -1
  5. package/dist/index.js +1624 -1382
  6. package/dist/runtime/buildFormRuntimeSnapshot.d.ts +16 -0
  7. package/dist/runtime/buildFormRuntimeSnapshot.d.ts.map +1 -0
  8. package/dist/runtime/formLiveOptionsContext.d.ts +20 -0
  9. package/dist/runtime/formLiveOptionsContext.d.ts.map +1 -0
  10. package/dist/runtime/formRuntimeConnection.d.ts +35 -0
  11. package/dist/runtime/formRuntimeConnection.d.ts.map +1 -0
  12. package/dist/runtime/formRuntimeContext.d.ts +2 -2
  13. package/dist/runtime/formRuntimeContext.d.ts.map +1 -1
  14. package/dist/runtime/formRuntimeWs.d.ts +8 -13
  15. package/dist/runtime/formRuntimeWs.d.ts.map +1 -1
  16. package/dist/runtime/types.d.ts +11 -0
  17. package/dist/runtime/types.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/src/catalog/skoponCaseSelect.tsx +12 -1
  20. package/src/catalog/skoponResumeSelect.tsx +12 -1
  21. package/src/catalog/useSkoponBoundField.ts +21 -0
  22. package/src/components/AskUserFormCard.tsx +141 -31
  23. package/src/runtime/buildFormRuntimeSnapshot.test.ts +97 -0
  24. package/src/runtime/buildFormRuntimeSnapshot.ts +61 -0
  25. package/src/runtime/formLiveOptionsContext.tsx +118 -0
  26. package/src/runtime/formRuntimeConnection.test.ts +155 -0
  27. package/src/runtime/formRuntimeConnection.ts +251 -0
  28. package/src/runtime/formRuntimeContext.tsx +13 -11
  29. package/src/runtime/formRuntimeWs.ts +24 -129
  30. package/src/runtime/types.ts +12 -0
package/dist/index.js CHANGED
@@ -1,34 +1,34 @@
1
1
  import './form-sdk.css';
2
- var fn = Object.defineProperty;
3
- var hn = (e, t, n) => t in e ? fn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
- var Q = (e, t, n) => hn(e, typeof t != "symbol" ? t + "" : t, n);
5
- import { jsx as c, jsxs as N } from "react/jsx-runtime";
6
- import { createContext as Ie, useContext as Ne, useRef as P, useCallback as L, useMemo as R, useEffect as w, useSyncExternalStore as gn, useState as E, forwardRef as yn, useImperativeHandle as vn } from "react";
7
- import { Spin as tt, Button as Me, Typography as X, Avatar as Sn, Tag as le, Select as Je, Checkbox as bn, Radio as kn, Switch as An, TimePicker as Cn, DatePicker as _n, Upload as qe, Input as Oe, InputNumber as xn, ConfigProvider as Tn, Tooltip as se } from "antd";
8
- import { ReloadOutlined as Mt, FileTextOutlined as Ft, UserOutlined as In, FileImageOutlined as Nn, FileExcelOutlined as Mn, FileOutlined as Ut, PictureOutlined as Fn, SoundOutlined as Un, VideoCameraOutlined as En } from "@ant-design/icons";
9
- import { createBinderlessComponentImplementation as J, basicCatalog as Ae, A2uiSurface as Et } from "@a2ui/react/v0_9";
10
- import { z as f } from "zod";
11
- import { Catalog as Pn, MessageProcessor as Pt } from "@a2ui/web_core/v0_9";
12
- import { injectBasicCatalogStyles as wt } from "@a2ui/web_core/v0_9/basic_catalog";
13
- import { injectStyles as Rt } from "@a2ui/react/styles";
14
- import At from "dayjs";
15
- const Fi = "v0.9", wn = [
2
+ var In = Object.defineProperty;
3
+ var Mn = (e, t, n) => t in e ? In(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var G = (e, t, n) => Mn(e, typeof t != "symbol" ? t + "" : t, n);
5
+ import { jsx as u, jsxs as I } from "react/jsx-runtime";
6
+ import { useRef as T, useState as U, useCallback as $, useMemo as j, createContext as ye, useContext as ve, useEffect as z, useSyncExternalStore as Fn, forwardRef as Nn, useImperativeHandle as En } from "react";
7
+ import { Spin as ct, Button as ze, Typography as te, Avatar as Un, Tag as fe, Select as nt, Checkbox as Rn, Radio as wn, Switch as Pn, TimePicker as zn, DatePicker as On, Upload as Ke, Input as Ge, InputNumber as qn, ConfigProvider as Bn, Tooltip as pe } from "antd";
8
+ import { ReloadOutlined as Dt, FileTextOutlined as Ht, UserOutlined as Ln, FileImageOutlined as Vn, FileExcelOutlined as jn, FileOutlined as Kt, PictureOutlined as $n, SoundOutlined as Dn, VideoCameraOutlined as Hn } from "@ant-design/icons";
9
+ import { createBinderlessComponentImplementation as Q, basicCatalog as Ee, A2uiSurface as Gt } from "@a2ui/react/v0_9";
10
+ import { z as h } from "zod";
11
+ import { Catalog as Kn, MessageProcessor as Jt } from "@a2ui/web_core/v0_9";
12
+ import { injectBasicCatalogStyles as Wt } from "@a2ui/web_core/v0_9/basic_catalog";
13
+ import { injectStyles as Yt } from "@a2ui/react/styles";
14
+ import Ot from "dayjs";
15
+ const Zi = "v0.9", Gn = [
16
16
  "huge",
17
17
  "large",
18
18
  "medium",
19
19
  "small",
20
20
  "icon"
21
21
  ];
22
- function Ce(e) {
22
+ function Ue(e) {
23
23
  return e === "image" || e === "video" || e === "audio";
24
24
  }
25
- function Fe(e) {
25
+ function Oe(e) {
26
26
  return e === "heading" || e === "paragraph";
27
27
  }
28
- function ne(e) {
29
- return !Fe(e) && !Ce(e);
28
+ function ae(e) {
29
+ return !Oe(e) && !Ue(e);
30
30
  }
31
- function Rn() {
31
+ function Jn() {
32
32
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
33
33
  return crypto.randomUUID();
34
34
  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") {
@@ -42,11 +42,11 @@ function Rn() {
42
42
  return (e === "x" ? t : t & 3 | 8).toString(16);
43
43
  });
44
44
  }
45
- function me(e) {
46
- const t = Rn().replace(/-/g, "").slice(0, 8);
45
+ function Se(e) {
46
+ const t = Jn().replace(/-/g, "").slice(0, 8);
47
47
  return `${e}${t}`;
48
48
  }
49
- const zt = [
49
+ const Qt = [
50
50
  { value: "image/*", label: "图片" },
51
51
  { value: "video/*", label: "视频" },
52
52
  { value: "audio/*", label: "音频" },
@@ -57,7 +57,7 @@ const zt = [
57
57
  { value: "text/plain", label: "纯文本" },
58
58
  { value: "application/zip", label: "ZIP 压缩包" },
59
59
  { value: "application/x-rar-compressed", label: "RAR 压缩包" }
60
- ], zn = {
60
+ ], Wn = {
61
61
  "image/*": ["image/*"],
62
62
  "video/*": ["video/*"],
63
63
  "audio/*": ["audio/*"],
@@ -77,7 +77,7 @@ const zt = [
77
77
  "text/plain": ["text/plain"],
78
78
  "application/zip": ["application/zip"],
79
79
  "application/x-rar-compressed": ["application/x-rar-compressed"]
80
- }, Bn = {
80
+ }, Yn = {
81
81
  "image/*": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
82
82
  "video/*": [".mp4", ".mov", ".avi", ".webm"],
83
83
  "audio/*": [".mp3", ".wav", ".ogg", ".m4a"],
@@ -88,14 +88,14 @@ const zt = [
88
88
  "text/plain": [".txt"],
89
89
  "application/zip": [".zip", ".7z"],
90
90
  "application/x-rar-compressed": [".rar"]
91
- }, qn = {
91
+ }, Qn = {
92
92
  "application/msword": "office/word",
93
93
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "office/word",
94
94
  "application/vnd.ms-excel": "office/excel",
95
95
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "office/excel",
96
96
  "application/vnd.ms-powerpoint": "office/ppt",
97
97
  "application/vnd.openxmlformats-officedocument.presentationml.presentation": "office/ppt"
98
- }, nt = [
98
+ }, ut = [
99
99
  { value: ".jpg", label: ".jpg" },
100
100
  { value: ".jpeg", label: ".jpeg" },
101
101
  { value: ".png", label: ".png" },
@@ -121,124 +121,124 @@ const zt = [
121
121
  { value: ".zip", label: ".zip" },
122
122
  { value: ".rar", label: ".rar" },
123
123
  { value: ".7z", label: ".7z" }
124
- ], On = Object.fromEntries(
125
- zt.map((e) => [e.value, e.label])
126
- ), Vn = Object.fromEntries(
127
- nt.map((e) => [e.value, e.label])
128
- ), Ln = new Set(zt.map((e) => e.value)), jn = new Set(
129
- nt.map((e) => e.value)
124
+ ], Xn = Object.fromEntries(
125
+ Qt.map((e) => [e.value, e.label])
126
+ ), Zn = Object.fromEntries(
127
+ ut.map((e) => [e.value, e.label])
128
+ ), er = new Set(Qt.map((e) => e.value)), tr = new Set(
129
+ ut.map((e) => e.value)
130
130
  );
131
- function $n(e) {
131
+ function nr(e) {
132
132
  const t = e.trim();
133
- return t ? Ln.has(t) ? t : qn[t] ?? null : null;
133
+ return t ? er.has(t) ? t : Qn[t] ?? null : null;
134
134
  }
135
- function Dn(e) {
135
+ function rr(e) {
136
136
  return Array.isArray(e) ? e.map((t) => {
137
137
  const n = t.trim().toLowerCase();
138
138
  return n ? n.startsWith(".") ? n : `.${n}` : "";
139
139
  }).filter(Boolean) : [];
140
140
  }
141
- function de(e) {
141
+ function be(e) {
142
142
  if (!Array.isArray(e)) return [];
143
143
  const t = [], n = /* @__PURE__ */ new Set();
144
144
  for (const r of e) {
145
- const o = $n(r);
145
+ const o = nr(r);
146
146
  o && !n.has(o) && (n.add(o), t.push(o));
147
147
  }
148
148
  return t;
149
149
  }
150
- function Hn(e) {
151
- const t = de(e), n = [];
150
+ function or(e) {
151
+ const t = be(e), n = [];
152
152
  for (const r of t)
153
- n.push(...zn[r] ?? [r]);
153
+ n.push(...Wn[r] ?? [r]);
154
154
  return n;
155
155
  }
156
- function Kn(e) {
157
- const t = de(e);
156
+ function ir(e) {
157
+ const t = be(e);
158
158
  if (t.length === 0) return [];
159
159
  const n = /* @__PURE__ */ new Set();
160
160
  for (const r of t)
161
- for (const o of Bn[r] ?? [])
161
+ for (const o of Yn[r] ?? [])
162
162
  n.add(o);
163
- return nt.filter((r) => n.has(r.value));
163
+ return ut.filter((r) => n.has(r.value));
164
164
  }
165
- function rt(e, t) {
166
- const n = Dn(t), r = de(e);
165
+ function mt(e, t) {
166
+ const n = rr(t), r = be(e);
167
167
  if (r.length === 0)
168
- return n.filter((i) => jn.has(i));
168
+ return n.filter((i) => tr.has(i));
169
169
  const o = new Set(
170
- Kn(r).map((i) => i.value)
170
+ ir(r).map((i) => i.value)
171
171
  );
172
172
  return n.filter((i) => o.has(i));
173
173
  }
174
- function Gn(e, t) {
175
- const n = Hn(e), r = rt(e, t), o = [...n, ...r];
174
+ function sr(e, t) {
175
+ const n = or(e), r = mt(e, t), o = [...n, ...r];
176
176
  return o.length > 0 ? o.join(",") : void 0;
177
177
  }
178
- function Jn(e, t) {
179
- const n = de(e), r = rt(
178
+ function ar(e, t) {
179
+ const n = be(e), r = mt(
180
180
  n,
181
181
  t
182
182
  ), o = [
183
- ...n.map((i) => On[i] ?? i),
184
- ...r.map((i) => Vn[i] ?? i)
183
+ ...n.map((i) => Xn[i] ?? i),
184
+ ...r.map((i) => Zn[i] ?? i)
185
185
  ];
186
186
  return o.length === 0 ? null : o.join("、");
187
187
  }
188
- const Wn = [
188
+ const lr = [
189
189
  "video",
190
190
  "audio",
191
191
  "image",
192
192
  "file",
193
193
  "spreadsheet",
194
194
  "document"
195
- ], Yn = new Set(Wn);
196
- function Qn(e) {
197
- return e && Yn.has(e) ? e : "file";
195
+ ], cr = new Set(lr);
196
+ function ur(e) {
197
+ return e && cr.has(e) ? e : "file";
198
198
  }
199
- function pe(e) {
200
- return typeof e == "string" && wn.includes(e) ? e : "medium";
199
+ function ke(e) {
200
+ return typeof e == "string" && Gn.includes(e) ? e : "medium";
201
201
  }
202
- function Xn(e, t) {
202
+ function mr(e, t) {
203
203
  var o;
204
204
  const n = Math.max(1, t);
205
205
  let r = [];
206
206
  return Array.isArray(e.mediaUrls) ? r = e.mediaUrls.map((i) => String(i).trim()) : (o = e.mediaUrl) != null && o.trim() && (r = [e.mediaUrl.trim()]), r.length === 0 ? [""] : r.slice(0, n);
207
207
  }
208
- function Zn(e) {
208
+ function dr(e) {
209
209
  var t;
210
210
  return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((n) => n.trim()).filter(Boolean) : (t = e.mediaUrl) != null && t.trim() ? [e.mediaUrl.trim()] : [];
211
211
  }
212
- function er(e) {
213
- return `form-media-size-${pe(e)}`;
212
+ function pr(e) {
213
+ return `form-media-size-${ke(e)}`;
214
214
  }
215
- function tr(e) {
216
- return `form-media-preview form-media-list ${er(e)}`;
215
+ function fr(e) {
216
+ return `form-media-preview form-media-list ${pr(e)}`;
217
217
  }
218
- const nr = 10;
219
- function ot(e) {
218
+ const hr = 10;
219
+ function dt(e) {
220
220
  return e && typeof e == "object" && !Array.isArray(e) ? e : {};
221
221
  }
222
- function fe(e) {
222
+ function Ce(e) {
223
223
  return e === !0 || e === "true" || e === 1 || e === "1";
224
224
  }
225
- function Ct(e, t = 1) {
225
+ function qt(e, t = 1) {
226
226
  const n = typeof e == "number" ? e : Number(e);
227
227
  return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : t;
228
228
  }
229
- function Se(e, t = 1) {
229
+ function Me(e, t = 1) {
230
230
  const n = typeof e == "number" ? e : Number(e);
231
231
  return Number.isFinite(n) ? Math.max(1, Math.floor(n)) : t;
232
232
  }
233
- function rr(e, t) {
233
+ function gr(e, t) {
234
234
  if (t !== void 0)
235
- return e === "toggle" ? fe(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String) : typeof t == "string" && t ? [t] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t);
235
+ return e === "toggle" ? Ce(t) : e === "multiselect" || e === "checkbox" || e === "resume_multiselect" || e === "case_multiselect" ? Array.isArray(t) ? t.map(String) : typeof t == "string" && t ? [t] : [] : typeof t == "boolean" ? t ? "true" : "false" : Array.isArray(t) ? t.map(String) : String(t);
236
236
  }
237
- function or(e) {
238
- const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20, r = typeof (e == null ? void 0 : e.agentKind) == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, o = typeof (e == null ? void 0 : e.agentUniqueId) == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, i = typeof (e == null ? void 0 : e.flowType) == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, a = typeof (e == null ? void 0 : e.category) == "string" && e.category.trim() ? e.category.trim() : void 0, s = Array.isArray(e == null ? void 0 : e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
239
- return { agentKind: r, agentUniqueId: o, flowType: i, category: a, flowUniqueIds: s, pageSize: n };
237
+ function yr(e) {
238
+ const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20, r = typeof (e == null ? void 0 : e.agentKind) == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, o = typeof (e == null ? void 0 : e.agentUniqueId) == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, i = typeof (e == null ? void 0 : e.flowType) == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, s = typeof (e == null ? void 0 : e.category) == "string" && e.category.trim() ? e.category.trim() : void 0, a = Array.isArray(e == null ? void 0 : e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
239
+ return { agentKind: r, agentUniqueId: o, flowType: i, category: s, flowUniqueIds: a, pageSize: n };
240
240
  }
241
- function ir(e) {
241
+ function vr(e) {
242
242
  const t = typeof (e == null ? void 0 : e.pageSize) == "number" ? e.pageSize : Number(e == null ? void 0 : e.pageSize), n = Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20;
243
243
  return {
244
244
  names: Array.isArray(e == null ? void 0 : e.names) ? e.names.map(String).filter(Boolean) : [],
@@ -247,51 +247,51 @@ function ir(e) {
247
247
  pageSize: n
248
248
  };
249
249
  }
250
- function ar(e) {
250
+ function Sr(e) {
251
251
  if (e.type !== "case_singleselect") return e;
252
252
  const t = typeof e.defaultValue == "string" && e.defaultValue.trim() ? [e.defaultValue.trim()] : Array.isArray(e.defaultValue) ? e.defaultValue.map(String).filter(Boolean) : [];
253
253
  return { ...e, type: "case_multiselect", defaultValue: t };
254
254
  }
255
- function sr(e) {
255
+ function br(e) {
256
256
  var o, i;
257
- const t = ar(e), n = de(t.fileAcceptTypes), r = t.type;
257
+ const t = Sr(e), n = be(t.fileAcceptTypes), r = t.type;
258
258
  return {
259
- id: ((o = t.id) == null ? void 0 : o.trim()) || me("block-"),
259
+ id: ((o = t.id) == null ? void 0 : o.trim()) || Se("block-"),
260
260
  type: r,
261
261
  name: ((i = t.name) == null ? void 0 : i.trim()) || void 0,
262
262
  label: t.label ?? "",
263
263
  placeholder: t.placeholder ?? "",
264
264
  help: t.help ?? "",
265
265
  required: t.required === !0,
266
- mediaUrls: Ce(r) ? Xn(t, nr) : void 0,
267
- mediaSize: Ce(r) ? pe(t.mediaSize) : void 0,
266
+ mediaUrls: Ue(r) ? mr(t, hr) : void 0,
267
+ mediaSize: Ue(r) ? ke(t.mediaSize) : void 0,
268
268
  fileAcceptTypes: n,
269
- fileAcceptExtensions: rt(
269
+ fileAcceptExtensions: mt(
270
270
  n,
271
271
  t.fileAcceptExtensions
272
272
  ),
273
- filePlaceholderIcon: Qn(t.filePlaceholderIcon),
274
- fileMinCount: r === "file" ? Ct(t.fileMinCount, 1) : void 0,
275
- fileMaxCount: r === "file" ? Ct(t.fileMaxCount, 1) : void 0,
276
- defaultValue: rr(r, t.defaultValue),
277
- options: Array.isArray(t.options) ? t.options.map((a, s) => {
278
- var l, u;
273
+ filePlaceholderIcon: ur(t.filePlaceholderIcon),
274
+ fileMinCount: r === "file" ? qt(t.fileMinCount, 1) : void 0,
275
+ fileMaxCount: r === "file" ? qt(t.fileMaxCount, 1) : void 0,
276
+ defaultValue: gr(r, t.defaultValue),
277
+ options: Array.isArray(t.options) ? t.options.map((s, a) => {
278
+ var l, c;
279
279
  return {
280
- value: ((l = a.value) == null ? void 0 : l.trim()) || `option_${s + 1}`,
281
- label: ((u = a.label) == null ? void 0 : u.trim()) || `选项 ${s + 1}`
280
+ value: ((l = s.value) == null ? void 0 : l.trim()) || `option_${a + 1}`,
281
+ label: ((c = s.label) == null ? void 0 : c.trim()) || `选项 ${a + 1}`
282
282
  };
283
283
  }) : void 0,
284
284
  resumeEnableRefresh: r === "resume_multiselect" ? t.resumeEnableRefresh !== !1 : void 0,
285
- resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ? Se(t.resumeMinCount, 1) : void 0,
286
- resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ? Se(t.resumeMaxCount, 1) : void 0,
287
- resumeFilter: r === "resume_multiselect" ? ir(t.resumeFilter) : void 0,
285
+ resumeMinCount: r === "resume_multiselect" && t.resumeMinCount != null ? Me(t.resumeMinCount, 1) : void 0,
286
+ resumeMaxCount: r === "resume_multiselect" && t.resumeMaxCount != null ? Me(t.resumeMaxCount, 1) : void 0,
287
+ resumeFilter: r === "resume_multiselect" ? vr(t.resumeFilter) : void 0,
288
288
  caseEnableRefresh: r === "case_multiselect" ? t.caseEnableRefresh !== !1 : void 0,
289
- caseMinCount: r === "case_multiselect" && t.caseMinCount != null ? Se(t.caseMinCount, 1) : void 0,
290
- caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ? Se(t.caseMaxCount, 1) : void 0,
291
- caseFilter: r === "case_multiselect" ? or(t.caseFilter) : void 0
289
+ caseMinCount: r === "case_multiselect" && t.caseMinCount != null ? Me(t.caseMinCount, 1) : void 0,
290
+ caseMaxCount: r === "case_multiselect" && t.caseMaxCount != null ? Me(t.caseMaxCount, 1) : void 0,
291
+ caseFilter: r === "case_multiselect" ? yr(t.caseFilter) : void 0
292
292
  };
293
293
  }
294
- function _e(e) {
294
+ function Re(e) {
295
295
  return {
296
296
  title: e.title ?? "",
297
297
  description: e.description ?? "",
@@ -299,36 +299,36 @@ function _e(e) {
299
299
  jsonSchema: e.jsonSchema ?? {}
300
300
  };
301
301
  }
302
- function re(e) {
302
+ function me(e) {
303
303
  if (!e || !Array.isArray(e.blocks))
304
- return _e({ title: "", description: "", blocks: [], jsonSchema: {} });
305
- const t = e.blocks.map(sr);
306
- return _e({
304
+ return Re({ title: "", description: "", blocks: [], jsonSchema: {} });
305
+ const t = e.blocks.map(br);
306
+ return Re({
307
307
  title: typeof e.title == "string" ? e.title : "",
308
308
  description: typeof e.description == "string" ? e.description : "",
309
309
  blocks: t,
310
- jsonSchema: ot(e.jsonSchema)
310
+ jsonSchema: dt(e.jsonSchema)
311
311
  });
312
312
  }
313
- function lr(e) {
314
- const t = typeof e.pageSize == "number" ? e.pageSize : Number(e.pageSize), n = typeof e.agentKind == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, r = typeof e.agentUniqueId == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, o = typeof e.flowType == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, i = typeof e.category == "string" && e.category.trim() ? e.category.trim() : void 0, a = Array.isArray(e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
313
+ function kr(e) {
314
+ const t = typeof e.pageSize == "number" ? e.pageSize : Number(e.pageSize), n = typeof e.agentKind == "string" && e.agentKind.trim() ? e.agentKind.trim() : void 0, r = typeof e.agentUniqueId == "string" && e.agentUniqueId.trim() ? e.agentUniqueId.trim() : void 0, o = typeof e.flowType == "string" && e.flowType.trim() ? e.flowType.trim() : void 0, i = typeof e.category == "string" && e.category.trim() ? e.category.trim() : void 0, s = Array.isArray(e.flowUniqueIds) ? e.flowUniqueIds.map(String).filter(Boolean) : [];
315
315
  return {
316
316
  agentKind: n,
317
317
  agentUniqueId: r,
318
318
  flowType: o,
319
319
  category: i,
320
- flowUniqueIds: a,
320
+ flowUniqueIds: s,
321
321
  pageSize: Number.isFinite(t) && t >= 1 && t <= 100 ? Math.floor(t) : 20
322
322
  };
323
323
  }
324
- function _t(e) {
324
+ function Bt(e) {
325
325
  if (e == null) return;
326
326
  const t = typeof e == "number" ? e : Number(e);
327
327
  if (!(!Number.isFinite(t) || t < 1))
328
328
  return Math.floor(t);
329
329
  }
330
- function cr(e, t) {
331
- var a, s, l, u, m, d;
330
+ function Cr(e, t) {
331
+ var s, a, l, c, m, d;
332
332
  const { id: n, label: r, path: o, withData: i } = t;
333
333
  return i({
334
334
  id: n,
@@ -338,10 +338,10 @@ function cr(e, t) {
338
338
  help: e.help ?? "",
339
339
  enableRefresh: e.caseEnableRefresh !== !1,
340
340
  caseFilter: {
341
- agentKind: (a = e.caseFilter) == null ? void 0 : a.agentKind,
342
- agentUniqueId: (s = e.caseFilter) == null ? void 0 : s.agentUniqueId,
341
+ agentKind: (s = e.caseFilter) == null ? void 0 : s.agentKind,
342
+ agentUniqueId: (a = e.caseFilter) == null ? void 0 : a.agentUniqueId,
343
343
  flowType: (l = e.caseFilter) == null ? void 0 : l.flowType,
344
- category: (u = e.caseFilter) == null ? void 0 : u.category,
344
+ category: (c = e.caseFilter) == null ? void 0 : c.category,
345
345
  flowUniqueIds: ((m = e.caseFilter) == null ? void 0 : m.flowUniqueIds) ?? [],
346
346
  pageSize: ((d = e.caseFilter) == null ? void 0 : d.pageSize) ?? 20
347
347
  },
@@ -350,35 +350,91 @@ function cr(e, t) {
350
350
  value: { path: o }
351
351
  });
352
352
  }
353
- function ur(e, t, n) {
353
+ function Ar(e, t, n) {
354
354
  const r = n.nameFromValue(e.value), o = {
355
355
  ...t("case_multiselect"),
356
356
  name: r,
357
357
  caseEnableRefresh: e.enableRefresh !== !1
358
358
  }, i = n.asLiteral(e.placeholder);
359
359
  i && (o.placeholder = i);
360
- const a = n.asLiteral(e.help);
361
- a && (o.help = a), e.caseFilter && typeof e.caseFilter == "object" && (o.caseFilter = lr(e.caseFilter));
362
- const s = _t(e.minCount);
363
- s !== void 0 && (o.caseMinCount = s);
364
- const l = _t(e.maxCount);
360
+ const s = n.asLiteral(e.help);
361
+ s && (o.help = s), e.caseFilter && typeof e.caseFilter == "object" && (o.caseFilter = kr(e.caseFilter));
362
+ const a = Bt(e.minCount);
363
+ a !== void 0 && (o.caseMinCount = a);
364
+ const l = Bt(e.maxCount);
365
365
  return l !== void 0 && (o.caseMaxCount = l), o;
366
366
  }
367
- const Bt = Ie({ interactive: !0 });
368
- function We({
367
+ const Xt = ye(
368
+ null
369
+ );
370
+ function _r(e) {
371
+ try {
372
+ return JSON.stringify(e);
373
+ } catch {
374
+ return String(e.length);
375
+ }
376
+ }
377
+ const Tr = {
378
+ publishLiveOptions: () => {
379
+ },
380
+ liveOptions: /* @__PURE__ */ new Map(),
381
+ pendingChangeFields: [],
382
+ version: 0,
383
+ clearPendingChangeFields: () => {
384
+ }
385
+ };
386
+ function xr({ children: e }) {
387
+ const t = T(/* @__PURE__ */ new Map()), n = T(/* @__PURE__ */ new Map()), r = T([]), [o, i] = U(0), [s, a] = U(() => /* @__PURE__ */ new Map()), [l, c] = U(
388
+ []
389
+ ), m = $(
390
+ (g, b) => {
391
+ const y = g.trim();
392
+ if (!y) return;
393
+ const k = b.map((p) => ({
394
+ value: String(p.value ?? ""),
395
+ label: String(p.label ?? p.value ?? "")
396
+ })), f = _r(k);
397
+ n.current.get(y) !== f && (n.current.set(y, f), t.current.set(y, k), r.current.includes(y) || (r.current = [...r.current, y]), a(new Map(t.current)), c(r.current), i((p) => p + 1));
398
+ },
399
+ []
400
+ ), d = $(() => {
401
+ r.current = [], c([]);
402
+ }, []), S = j(
403
+ () => ({
404
+ publishLiveOptions: m,
405
+ liveOptions: s,
406
+ pendingChangeFields: l,
407
+ version: o,
408
+ clearPendingChangeFields: d
409
+ }),
410
+ [
411
+ m,
412
+ s,
413
+ l,
414
+ o,
415
+ d
416
+ ]
417
+ );
418
+ return /* @__PURE__ */ u(Xt.Provider, { value: S, children: e });
419
+ }
420
+ function pt() {
421
+ return ve(Xt) ?? Tr;
422
+ }
423
+ const Zt = ye({ interactive: !0 });
424
+ function rt({
369
425
  interactive: e,
370
426
  children: t
371
427
  }) {
372
- return /* @__PURE__ */ c(Bt.Provider, { value: { interactive: e }, children: t });
428
+ return /* @__PURE__ */ u(Zt.Provider, { value: { interactive: e }, children: t });
373
429
  }
374
- function ee() {
375
- return Ne(Bt);
430
+ function oe() {
431
+ return ve(Zt);
376
432
  }
377
- const qt = Ie(null);
378
- function mr(e) {
433
+ const en = ye(null);
434
+ function Ir(e) {
379
435
  return e != null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
380
436
  }
381
- const dr = {
437
+ const Mr = {
382
438
  reportEvent: () => {
383
439
  },
384
440
  reportData: () => {
@@ -386,219 +442,234 @@ const dr = {
386
442
  runAutoControl: (e) => e(),
387
443
  isAutoControl: () => !1
388
444
  };
389
- function pr(e) {
445
+ function Fr(e) {
390
446
  const t = {};
391
- for (const [n, r] of Object.entries(e))
447
+ for (const [n, r] of Object.entries(e.form_values ?? {}))
392
448
  r !== void 0 && (t[n] = r);
393
- return t;
449
+ return {
450
+ form_schema: e.form_schema,
451
+ form_values: t,
452
+ form_change: Array.isArray(e.form_change) ? [...e.form_change] : []
453
+ };
394
454
  }
395
- function fr({
455
+ function Nr({
396
456
  client: e,
397
457
  children: t
398
458
  }) {
399
- const n = P(0), r = P(e);
459
+ const n = T(0), r = T(e);
400
460
  r.current = e;
401
- const o = L((u) => {
461
+ const o = $((c) => {
402
462
  const m = r.current;
403
463
  if (!m) return;
404
464
  const d = {
405
- action: u.action,
406
- component: u.component
465
+ action: c.action,
466
+ component: c.component
407
467
  };
408
- u.field !== void 0 && (d.field = u.field), u.value !== void 0 && (d.value = u.value);
409
- const y = n.current > 0 ? "form_auto_control_bac_event" : "form_runtime_event";
410
- m.send(y, d);
411
- }, []), i = L((u) => {
468
+ c.field !== void 0 && (d.field = c.field), c.value !== void 0 && (d.value = c.value);
469
+ const S = n.current > 0 ? "form_auto_control_bac_event" : "form_runtime_event";
470
+ m.send(S, d);
471
+ }, []), i = $((c) => {
412
472
  const m = r.current;
413
- m && m.send("form_runtime_data", pr(u));
414
- }, []), a = L((u) => {
473
+ m && m.send("form_runtime_data", Fr(c));
474
+ }, []), s = $((c) => {
415
475
  n.current += 1;
416
476
  let m;
417
477
  try {
418
- m = u();
478
+ m = c();
419
479
  } catch (d) {
420
480
  throw n.current = Math.max(0, n.current - 1), d;
421
481
  }
422
- return mr(m) ? Promise.resolve(m).finally(() => {
482
+ return Ir(m) ? Promise.resolve(m).finally(() => {
423
483
  n.current = Math.max(0, n.current - 1);
424
484
  }) : (n.current = Math.max(0, n.current - 1), m);
425
- }, []), s = L(
485
+ }, []), a = $(
426
486
  () => n.current > 0,
427
487
  []
428
- ), l = R(
488
+ ), l = j(
429
489
  () => ({
430
490
  reportEvent: o,
431
491
  reportData: i,
432
- runAutoControl: a,
433
- isAutoControl: s
492
+ runAutoControl: s,
493
+ isAutoControl: a
434
494
  }),
435
- [o, i, a, s]
495
+ [o, i, s, a]
436
496
  );
437
- return /* @__PURE__ */ c(qt.Provider, { value: l, children: t });
497
+ return /* @__PURE__ */ u(en.Provider, { value: l, children: t });
438
498
  }
439
- function Ot() {
440
- return Ne(qt) ?? dr;
499
+ function tn() {
500
+ return ve(en) ?? Mr;
441
501
  }
442
- const hr = 300;
443
- function Vt(e) {
502
+ const Er = 300;
503
+ function nn(e) {
444
504
  return e && typeof e == "object" && "path" in e && String(e.path ?? "").trim() || null;
445
505
  }
446
- function gr(e) {
506
+ function Ur(e) {
447
507
  if (!e) return;
448
508
  const t = e.trim();
449
509
  if (t)
450
510
  return t.startsWith("/") ? t.slice(1) : t;
451
511
  }
452
- function xt(e, t = "value") {
512
+ function Lt(e, t = "value") {
453
513
  const r = e.componentModel.properties[t];
454
- if (!(!Vt(r) || r === void 0))
514
+ if (!(!nn(r) || r === void 0))
455
515
  return e.dataContext.resolveDynamicValue(r);
456
516
  }
457
- function te(e, t = "value", n = {}) {
458
- const o = e.componentModel.properties[t], i = Vt(o), a = gr(i), s = Ot(), {
517
+ function ie(e, t = "value", n = {}) {
518
+ const o = e.componentModel.properties[t], i = nn(o), s = Ur(i), a = tn(), {
459
519
  component: l = "Unknown",
460
- changeAction: u = "change",
520
+ changeAction: c = "change",
461
521
  debounceChange: m = !1
462
- } = n, d = P(null), y = P(s);
463
- y.current = s, w(() => () => {
464
- d.current != null && (clearTimeout(d.current), d.current = null);
522
+ } = n, d = T(null), S = T(void 0), g = T(!1), b = T(a);
523
+ b.current = a;
524
+ const y = T(c);
525
+ y.current = c;
526
+ const k = T(l);
527
+ k.current = l;
528
+ const f = T(s);
529
+ f.current = s, z(() => () => {
530
+ d.current != null && (clearTimeout(d.current), d.current = null), g.current && f.current && (g.current = !1, b.current.reportEvent({
531
+ action: y.current,
532
+ component: k.current,
533
+ field: f.current,
534
+ value: S.current
535
+ }));
465
536
  }, []);
466
- const g = L(
467
- (A) => {
537
+ const p = $(
538
+ (O) => {
468
539
  if (!i || o === void 0) return () => {
469
540
  };
470
- const x = e.dataContext.subscribeDynamicValue(o, () => A());
471
- return () => x.unsubscribe();
541
+ const q = e.dataContext.subscribeDynamicValue(o, () => O());
542
+ return () => q.unsubscribe();
472
543
  },
473
544
  [e, o, i]
474
- ), k = L(() => {
545
+ ), v = $(() => {
475
546
  if (!(!i || o === void 0))
476
547
  return e.dataContext.resolveDynamicValue(o);
477
- }, [e, o, i]), v = gn(g, k, k), C = L(
478
- (A) => {
479
- if (!a) return;
480
- const x = () => {
481
- y.current.reportEvent({
482
- action: u,
548
+ }, [e, o, i]), x = Fn(p, v, v), M = $(
549
+ (O) => {
550
+ if (!s) return;
551
+ const q = () => {
552
+ g.current = !1, b.current.reportEvent({
553
+ action: c,
483
554
  component: l,
484
- field: a,
485
- value: A
555
+ field: s,
556
+ value: O
486
557
  });
487
558
  };
488
559
  if (!m) {
489
- x();
560
+ q();
490
561
  return;
491
562
  }
492
- d.current != null && clearTimeout(d.current), d.current = setTimeout(() => {
493
- d.current = null, x();
494
- }, hr);
563
+ S.current = O, g.current = !0, d.current != null && clearTimeout(d.current), d.current = setTimeout(() => {
564
+ d.current = null, q();
565
+ }, Er);
495
566
  },
496
- [a, u, l, m]
497
- ), h = L(
498
- (A) => {
499
- !i || !o || typeof o != "object" || !("path" in o) || e.dataContext.set(String(o.path), A);
567
+ [s, c, l, m]
568
+ ), A = $(
569
+ (O) => {
570
+ !i || !o || typeof o != "object" || !("path" in o) || e.dataContext.set(String(o.path), O);
500
571
  },
501
572
  [e, o, i]
502
- ), p = L(
503
- (A) => {
504
- h(A), C(A);
573
+ ), R = $(
574
+ (O) => {
575
+ A(O), M(O);
505
576
  },
506
- [h, C]
507
- ), S = L(() => {
508
- a && y.current.reportEvent({
577
+ [A, M]
578
+ ), C = $(() => {
579
+ s && b.current.reportEvent({
509
580
  action: "focus",
510
581
  component: l,
511
- field: a
582
+ field: s
512
583
  });
513
- }, [a, l]);
584
+ }, [s, l]);
514
585
  return {
515
- value: v,
516
- setValue: p,
586
+ value: x,
587
+ setValue: R,
517
588
  /** 写入 dataModel 但不上报(用于模式切换规范化等内部同步) */
518
- setValueSilent: h,
589
+ setValueSilent: A,
519
590
  hasBinding: !!i,
520
- fieldName: a,
521
- reportFocus: S
591
+ fieldName: s,
592
+ reportFocus: C
522
593
  };
523
594
  }
524
- function ce(e) {
595
+ function he(e) {
525
596
  if (typeof e == "string") return e || void 0;
526
597
  if (typeof e == "number") return String(e);
527
598
  }
528
- function G(e) {
599
+ function Y(e) {
529
600
  return Array.isArray(e) ? e.map(String) : typeof e == "string" && e ? [e] : [];
530
601
  }
531
- function Lt(e, t) {
532
- return t ? Array.isArray(e) ? null : G(e) : Array.isArray(e) ? e.length > 0 ? String(e[0]) : "" : e == null || typeof e == "string" || typeof e == "number" ? null : "";
602
+ function rn(e, t) {
603
+ return t ? Array.isArray(e) ? null : Y(e) : Array.isArray(e) ? e.length > 0 ? String(e[0]) : "" : e == null || typeof e == "string" || typeof e == "number" ? null : "";
533
604
  }
534
- function xe(e) {
605
+ function we(e) {
535
606
  if (e == null) return;
536
607
  const t = typeof e == "number" ? e : Number(e);
537
608
  if (!(!Number.isFinite(t) || t < 1))
538
609
  return Math.floor(t);
539
610
  }
540
- function jt(e, t, n, r) {
611
+ function on(e, t, n, r) {
541
612
  if (e.includes(t)) {
542
- const i = e.filter((a) => a !== t);
613
+ const i = e.filter((s) => s !== t);
543
614
  return n !== void 0 && i.length < n ? null : i;
544
615
  }
545
616
  return r !== void 0 && e.length >= r ? null : [...e, t];
546
617
  }
547
- function $t(e, t, n, r, o) {
618
+ function sn(e, t, n, r, o) {
548
619
  if (!n) return !0;
549
620
  const i = e.includes(t);
550
621
  return !!(!i && o !== void 0 && e.length >= o || i && r !== void 0 && e.length <= r);
551
622
  }
552
- function Dt(e, t) {
623
+ function an(e, t) {
553
624
  return t === void 0 || e.length <= t ? null : e.slice(0, t);
554
625
  }
555
- const Ht = Ie(null);
556
- function Ye({
626
+ const ln = ye(null);
627
+ function ot({
557
628
  caseSearch: e,
558
629
  children: t
559
630
  }) {
560
- return /* @__PURE__ */ c(Ht.Provider, { value: e ?? null, children: t });
631
+ return /* @__PURE__ */ u(ln.Provider, { value: e ?? null, children: t });
561
632
  }
562
- function yr() {
563
- return Ne(Ht);
633
+ function Rr() {
634
+ return ve(ln);
564
635
  }
565
- function Ve(e) {
636
+ function Je(e) {
566
637
  return typeof e == "string" ? e : "";
567
638
  }
568
- function Le(e) {
639
+ function We(e) {
569
640
  if (!e || typeof e != "object")
570
641
  return { flowUniqueIds: [], pageSize: 20 };
571
- const t = e, n = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), r = Number.isFinite(n) && n >= 1 && n <= 100 ? Math.floor(n) : 20, o = typeof t.agentKind == "string" && t.agentKind.trim() ? t.agentKind.trim() : void 0, i = typeof t.agentUniqueId == "string" && t.agentUniqueId.trim() ? t.agentUniqueId.trim() : void 0, a = typeof t.flowType == "string" && t.flowType.trim() ? t.flowType.trim() : void 0, s = typeof t.category == "string" && t.category.trim() ? t.category.trim() : void 0, l = Array.isArray(t.flowUniqueIds) ? t.flowUniqueIds.map(String).filter(Boolean) : [];
572
- return { agentKind: o, agentUniqueId: i, flowType: a, category: s, flowUniqueIds: l, pageSize: r };
642
+ const t = e, n = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), r = Number.isFinite(n) && n >= 1 && n <= 100 ? Math.floor(n) : 20, o = typeof t.agentKind == "string" && t.agentKind.trim() ? t.agentKind.trim() : void 0, i = typeof t.agentUniqueId == "string" && t.agentUniqueId.trim() ? t.agentUniqueId.trim() : void 0, s = typeof t.flowType == "string" && t.flowType.trim() ? t.flowType.trim() : void 0, a = typeof t.category == "string" && t.category.trim() ? t.category.trim() : void 0, l = Array.isArray(t.flowUniqueIds) ? t.flowUniqueIds.map(String).filter(Boolean) : [];
643
+ return { agentKind: o, agentUniqueId: i, flowType: s, category: a, flowUniqueIds: l, pageSize: r };
573
644
  }
574
- function je(e) {
645
+ function Ye(e) {
575
646
  var r;
576
647
  const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!(e.agentUniqueId && e.flowType && e.category);
577
648
  return t || n;
578
649
  }
579
- function vr(e) {
650
+ function wr(e) {
580
651
  return JSON.stringify(e);
581
652
  }
582
- const Sr = {
653
+ const Pr = {
583
654
  name: "SkoponCaseSelect",
584
- schema: f.object({
585
- label: f.any().optional(),
586
- placeholder: f.any().optional(),
587
- help: f.any().optional(),
588
- enableRefresh: f.any().optional(),
589
- caseFilter: f.any().optional(),
590
- minCount: f.any().optional(),
591
- maxCount: f.any().optional(),
592
- value: f.any().optional()
655
+ schema: h.object({
656
+ label: h.any().optional(),
657
+ placeholder: h.any().optional(),
658
+ help: h.any().optional(),
659
+ enableRefresh: h.any().optional(),
660
+ caseFilter: h.any().optional(),
661
+ minCount: h.any().optional(),
662
+ maxCount: h.any().optional(),
663
+ value: h.any().optional()
593
664
  }).passthrough()
594
665
  };
595
- function br({
666
+ function zr({
596
667
  item: e,
597
668
  selected: t,
598
669
  disabled: n,
599
670
  onToggle: r
600
671
  }) {
601
- return /* @__PURE__ */ N(
672
+ return /* @__PURE__ */ I(
602
673
  "button",
603
674
  {
604
675
  type: "button",
@@ -606,11 +677,11 @@ function br({
606
677
  disabled: n,
607
678
  onClick: r,
608
679
  children: [
609
- /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-avatar", children: /* @__PURE__ */ c(Ft, { style: { fontSize: 24, color: "var(--color-primary, #208368)" } }) }),
610
- /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-body", children: [
611
- /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-name", children: e.name }),
612
- e.description ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-desc", children: e.description }) : null,
613
- /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-meta", children: [
680
+ /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-avatar", children: /* @__PURE__ */ u(Ht, { style: { fontSize: 24, color: "var(--color-primary, #208368)" } }) }),
681
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-body", children: [
682
+ /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-name", children: e.name }),
683
+ e.description ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-desc", children: e.description }) : null,
684
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-meta", children: [
614
685
  e.caseUniqueId,
615
686
  e.platform ? ` · ${e.platform}` : "",
616
687
  e.link ? ` · ${e.link}` : ""
@@ -620,115 +691,121 @@ function br({
620
691
  }
621
692
  );
622
693
  }
623
- function kr({ context: e }) {
624
- const { interactive: t } = ee(), n = yr(), { value: r, setValue: o, setValueSilent: i, fieldName: a } = te(e, "value", {
694
+ function Or({ context: e }) {
695
+ const { interactive: t } = oe(), n = Rr(), { publishLiveOptions: r } = pt(), { value: o, setValue: i, setValueSilent: s, fieldName: a } = ie(e, "value", {
625
696
  component: "SkoponCaseSelect",
626
697
  changeAction: "click"
627
- }), s = e.componentModel.properties, l = Ve(s.label), u = Ve(s.placeholder), m = Ve(s.help), d = s.enableRefresh !== !1, y = xe(s.minCount), g = xe(s.maxCount), k = R(() => Le(s.caseFilter), [s.caseFilter]), v = vr(k), [C, h] = E(1), [p, S] = E(!1), [A, x] = E(""), [_, z] = E([]), [T, D] = E(0), [H, oe] = E(k.pageSize ?? 20), K = P(0), j = G(r);
628
- w(() => {
629
- const b = Dt(j, g);
630
- b !== null && i(b);
631
- }, [g, j, i]);
632
- const I = R(() => n ? je(k) ? A || u || "暂无匹配的案例" : "未配置案例列表筛选条件" : "未配置案例搜索服务", [n, k, A, u]), F = L(
633
- async (b) => {
634
- const B = Le(JSON.parse(v)), $ = ++K.current;
635
- if (!n || !je(B)) {
636
- z([]), D(0), x(""), S(!1);
698
+ }), l = e.componentModel.properties, c = Je(l.label), m = Je(l.placeholder), d = Je(l.help), S = l.enableRefresh !== !1, g = we(l.minCount), b = we(l.maxCount), y = j(() => We(l.caseFilter), [l.caseFilter]), k = wr(y), [f, p] = U(1), [v, x] = U(!1), [M, A] = U(""), [R, C] = U([]), [O, q] = U(0), [le, K] = U(y.pageSize ?? 20), D = T(0), J = Y(o);
699
+ z(() => {
700
+ const _ = an(J, b);
701
+ _ !== null && s(_);
702
+ }, [b, J, s]);
703
+ const Z = j(() => n ? Ye(y) ? M || m || "暂无匹配的案例" : "未配置案例列表筛选条件" : "未配置案例搜索服务", [n, y, M, m]), ee = $(
704
+ async (_) => {
705
+ const V = We(JSON.parse(k)), w = ++D.current;
706
+ if (!n || !Ye(V)) {
707
+ C([]), q(0), A(""), x(!1);
637
708
  return;
638
709
  }
639
- S(!0), x("");
710
+ x(!0), A("");
640
711
  try {
641
- const U = await n({ filter: B, page: b });
642
- if ($ !== K.current) return;
643
- z(U.list), D(U.total), h(U.page), oe(U.pageSize);
644
- } catch (U) {
645
- if ($ !== K.current) return;
646
- z([]), D(0), x(U instanceof Error ? U.message : "加载案例列表失败");
712
+ const F = await n({ filter: V, page: _ });
713
+ if (w !== D.current) return;
714
+ C(F.list), q(F.total), p(F.page), K(F.pageSize), a && r(
715
+ a,
716
+ F.list.map((W) => ({
717
+ value: W.caseUniqueId,
718
+ label: W.name || W.caseUniqueId
719
+ }))
720
+ );
721
+ } catch (F) {
722
+ if (w !== D.current) return;
723
+ C([]), q(0), A(F instanceof Error ? F.message : "加载案例列表失败");
647
724
  } finally {
648
- $ === K.current && S(!1);
725
+ w === D.current && x(!1);
649
726
  }
650
727
  },
651
- [n, v]
728
+ [n, k, a, r]
652
729
  );
653
- w(() => {
654
- h(1), F(1);
655
- }, [v, F]);
656
- const ie = (b) => {
730
+ z(() => {
731
+ p(1), ee(1);
732
+ }, [k, ee]);
733
+ const N = (_) => {
657
734
  if (!t) return;
658
- const B = jt(
659
- j,
660
- b,
661
- y,
662
- g
735
+ const V = on(
736
+ J,
737
+ _,
738
+ g,
739
+ b
663
740
  );
664
- B !== null && o(B);
665
- }, Y = () => {
666
- const b = Le(JSON.parse(v)), B = H || b.pageSize || 20, $ = Math.max(1, Math.ceil(T / B)), U = C >= $ ? 1 : C + 1;
667
- F(U);
741
+ V !== null && i(V);
742
+ }, L = () => {
743
+ const _ = We(JSON.parse(k)), V = le || _.pageSize || 20, w = Math.max(1, Math.ceil(O / V)), F = f >= w ? 1 : f + 1;
744
+ ee(F);
668
745
  };
669
- return /* @__PURE__ */ N(
746
+ return /* @__PURE__ */ I(
670
747
  "div",
671
748
  {
672
749
  className: "form-block-preview skopon-resume-select",
673
750
  "data-skopon-field": a || void 0,
674
751
  children: [
675
- l ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: l }) : null,
676
- p && _.length === 0 ? /* @__PURE__ */ N("div", { className: "skopon-resume-select-status", children: [
677
- /* @__PURE__ */ c(tt, { size: "small" }),
752
+ c ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: c }) : null,
753
+ v && R.length === 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-status", children: [
754
+ /* @__PURE__ */ u(ct, { size: "small" }),
678
755
  " 加载案例…"
679
756
  ] }) : null,
680
- !p && _.length === 0 ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-empty", children: I }) : null,
681
- _.length > 0 ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-list", children: _.map((b) => /* @__PURE__ */ c(
682
- br,
757
+ !v && R.length === 0 ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-empty", children: Z }) : null,
758
+ R.length > 0 ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-list", children: R.map((_) => /* @__PURE__ */ u(
759
+ zr,
683
760
  {
684
- item: b,
685
- selected: j.includes(b.caseUniqueId),
686
- disabled: $t(
687
- j,
688
- b.caseUniqueId,
761
+ item: _,
762
+ selected: J.includes(_.caseUniqueId),
763
+ disabled: sn(
764
+ J,
765
+ _.caseUniqueId,
689
766
  t,
690
- y,
691
- g
767
+ g,
768
+ b
692
769
  ),
693
- onToggle: () => ie(b.caseUniqueId)
770
+ onToggle: () => N(_.caseUniqueId)
694
771
  },
695
- b.caseUniqueId
772
+ _.caseUniqueId
696
773
  )) }) : null,
697
- d && n && je(k) ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ c(
698
- Me,
774
+ S && n && Ye(y) ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ u(
775
+ ze,
699
776
  {
700
777
  type: "default",
701
778
  size: "small",
702
- icon: /* @__PURE__ */ c(Mt, {}),
703
- loading: p,
779
+ icon: /* @__PURE__ */ u(Dt, {}),
780
+ loading: v,
704
781
  disabled: !t,
705
- onClick: Y,
782
+ onClick: L,
706
783
  children: "换一批"
707
784
  }
708
785
  ) }) : null,
709
- m ? /* @__PURE__ */ c(X.Text, { type: "secondary", className: "form-block-preview-help", children: m }) : null
786
+ d ? /* @__PURE__ */ u(te.Text, { type: "secondary", className: "form-block-preview-help", children: d }) : null
710
787
  ]
711
788
  }
712
789
  );
713
790
  }
714
- const Ar = J(
715
- Sr,
716
- kr
717
- ), Cr = {
791
+ const qr = Q(
792
+ Pr,
793
+ Or
794
+ ), Br = {
718
795
  type: "case_multiselect",
719
796
  componentName: "SkoponCaseSelect",
720
- toComponent: cr,
721
- fromComponent: ur,
722
- catalogComponents: [Ar]
797
+ toComponent: Cr,
798
+ fromComponent: Ar,
799
+ catalogComponents: [qr]
723
800
  };
724
- function Tt(e) {
801
+ function Vt(e) {
725
802
  if (e == null) return;
726
803
  const t = typeof e == "number" ? e : Number(e);
727
804
  if (!(!Number.isFinite(t) || t < 1))
728
805
  return Math.floor(t);
729
806
  }
730
- function _r(e, t) {
731
- var a, s, l, u;
807
+ function Lr(e, t) {
808
+ var s, a, l, c;
732
809
  const { id: n, label: r, path: o, withData: i } = t;
733
810
  return i({
734
811
  id: n,
@@ -738,106 +815,106 @@ function _r(e, t) {
738
815
  help: e.help ?? "",
739
816
  enableRefresh: e.resumeEnableRefresh !== !1,
740
817
  resumeFilter: {
741
- names: ((a = e.resumeFilter) == null ? void 0 : a.names) ?? [],
742
- agentUniqueIds: ((s = e.resumeFilter) == null ? void 0 : s.agentUniqueIds) ?? [],
818
+ names: ((s = e.resumeFilter) == null ? void 0 : s.names) ?? [],
819
+ agentUniqueIds: ((a = e.resumeFilter) == null ? void 0 : a.agentUniqueIds) ?? [],
743
820
  resumeUniqueIds: ((l = e.resumeFilter) == null ? void 0 : l.resumeUniqueIds) ?? [],
744
- pageSize: ((u = e.resumeFilter) == null ? void 0 : u.pageSize) ?? 20
821
+ pageSize: ((c = e.resumeFilter) == null ? void 0 : c.pageSize) ?? 20
745
822
  },
746
823
  ...e.resumeMinCount !== void 0 ? { minCount: e.resumeMinCount } : {},
747
824
  ...e.resumeMaxCount !== void 0 ? { maxCount: e.resumeMaxCount } : {},
748
825
  value: { path: o }
749
826
  });
750
827
  }
751
- function xr(e, t, n) {
828
+ function Vr(e, t, n) {
752
829
  const r = n.nameFromValue(e.value), o = {
753
830
  ...t("resume_multiselect"),
754
831
  name: r,
755
832
  resumeEnableRefresh: e.enableRefresh !== !1
756
833
  }, i = n.asLiteral(e.placeholder);
757
834
  i && (o.placeholder = i);
758
- const a = n.asLiteral(e.help);
759
- if (a && (o.help = a), e.resumeFilter && typeof e.resumeFilter == "object") {
760
- const u = e.resumeFilter;
835
+ const s = n.asLiteral(e.help);
836
+ if (s && (o.help = s), e.resumeFilter && typeof e.resumeFilter == "object") {
837
+ const c = e.resumeFilter;
761
838
  o.resumeFilter = {
762
- names: Array.isArray(u.names) ? u.names.map(String) : [],
763
- agentUniqueIds: Array.isArray(u.agentUniqueIds) ? u.agentUniqueIds.map(String) : [],
764
- resumeUniqueIds: Array.isArray(u.resumeUniqueIds) ? u.resumeUniqueIds.map(String) : [],
765
- pageSize: typeof u.pageSize == "number" ? u.pageSize : 20
839
+ names: Array.isArray(c.names) ? c.names.map(String) : [],
840
+ agentUniqueIds: Array.isArray(c.agentUniqueIds) ? c.agentUniqueIds.map(String) : [],
841
+ resumeUniqueIds: Array.isArray(c.resumeUniqueIds) ? c.resumeUniqueIds.map(String) : [],
842
+ pageSize: typeof c.pageSize == "number" ? c.pageSize : 20
766
843
  };
767
844
  }
768
- const s = Tt(e.minCount);
769
- s !== void 0 && (o.resumeMinCount = s);
770
- const l = Tt(e.maxCount);
845
+ const a = Vt(e.minCount);
846
+ a !== void 0 && (o.resumeMinCount = a);
847
+ const l = Vt(e.maxCount);
771
848
  return l !== void 0 && (o.resumeMaxCount = l), o;
772
849
  }
773
- const Kt = Ie(null);
774
- function Qe({
850
+ const cn = ye(null);
851
+ function it({
775
852
  resumeSearch: e,
776
853
  children: t
777
854
  }) {
778
- return /* @__PURE__ */ c(Kt.Provider, { value: e ?? null, children: t });
855
+ return /* @__PURE__ */ u(cn.Provider, { value: e ?? null, children: t });
779
856
  }
780
- function Tr() {
781
- return Ne(Kt);
857
+ function jr() {
858
+ return ve(cn);
782
859
  }
783
- function $e(e) {
860
+ function Qe(e) {
784
861
  return typeof e == "string" ? e : "";
785
862
  }
786
- function De(e) {
863
+ function Xe(e) {
787
864
  if (!e || typeof e != "object")
788
865
  return { names: [], agentUniqueIds: [], resumeUniqueIds: [], pageSize: 20 };
789
- const t = e, n = Array.isArray(t.names) ? t.names.map(String).filter(Boolean) : [], r = Array.isArray(t.agentUniqueIds) ? t.agentUniqueIds.map(String).filter(Boolean) : [], o = Array.isArray(t.resumeUniqueIds) ? t.resumeUniqueIds.map(String).filter(Boolean) : [], i = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), a = Number.isFinite(i) && i >= 1 && i <= 100 ? Math.floor(i) : 20;
790
- return { names: n, agentUniqueIds: r, resumeUniqueIds: o, pageSize: a };
866
+ const t = e, n = Array.isArray(t.names) ? t.names.map(String).filter(Boolean) : [], r = Array.isArray(t.agentUniqueIds) ? t.agentUniqueIds.map(String).filter(Boolean) : [], o = Array.isArray(t.resumeUniqueIds) ? t.resumeUniqueIds.map(String).filter(Boolean) : [], i = typeof t.pageSize == "number" ? t.pageSize : Number(t.pageSize), s = Number.isFinite(i) && i >= 1 && i <= 100 ? Math.floor(i) : 20;
867
+ return { names: n, agentUniqueIds: r, resumeUniqueIds: o, pageSize: s };
791
868
  }
792
- function Ir(e) {
869
+ function $r(e) {
793
870
  return JSON.stringify(e);
794
871
  }
795
- const Nr = {
872
+ const Dr = {
796
873
  name: "SkoponResumeSelect",
797
- schema: f.object({
798
- label: f.any().optional(),
799
- placeholder: f.any().optional(),
800
- help: f.any().optional(),
801
- enableRefresh: f.any().optional(),
802
- resumeFilter: f.any().optional(),
803
- minCount: f.any().optional(),
804
- maxCount: f.any().optional(),
805
- value: f.any().optional()
874
+ schema: h.object({
875
+ label: h.any().optional(),
876
+ placeholder: h.any().optional(),
877
+ help: h.any().optional(),
878
+ enableRefresh: h.any().optional(),
879
+ resumeFilter: h.any().optional(),
880
+ minCount: h.any().optional(),
881
+ maxCount: h.any().optional(),
882
+ value: h.any().optional()
806
883
  }).passthrough()
807
- }, Mr = 3, Fr = 2;
808
- function He(e, t) {
809
- const n = (t ?? []).filter(Boolean), r = n.slice(0, Mr), o = n.length - r.length;
810
- return /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-tags", children: [
811
- /* @__PURE__ */ c("span", { className: "skopon-resume-select-card-tags-label", children: e }),
812
- n.length > 0 ? /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-tags-list", children: [
813
- r.map((i) => /* @__PURE__ */ c(le, { className: "skopon-resume-select-card-tag", children: i }, i)),
814
- o > 0 ? /* @__PURE__ */ N(le, { className: "skopon-resume-select-card-tag", children: [
884
+ }, Hr = 3, Kr = 2;
885
+ function Ze(e, t) {
886
+ const n = (t ?? []).filter(Boolean), r = n.slice(0, Hr), o = n.length - r.length;
887
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-tags", children: [
888
+ /* @__PURE__ */ u("span", { className: "skopon-resume-select-card-tags-label", children: e }),
889
+ n.length > 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-tags-list", children: [
890
+ r.map((i) => /* @__PURE__ */ u(fe, { className: "skopon-resume-select-card-tag", children: i }, i)),
891
+ o > 0 ? /* @__PURE__ */ I(fe, { className: "skopon-resume-select-card-tag", children: [
815
892
  "+",
816
893
  o
817
894
  ] }) : null
818
- ] }) : /* @__PURE__ */ c("span", { className: "skopon-resume-select-card-tags-empty", children: "暂无" })
895
+ ] }) : /* @__PURE__ */ u("span", { className: "skopon-resume-select-card-tags-empty", children: "暂无" })
819
896
  ] });
820
897
  }
821
- function Ur(e) {
822
- return /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-field", children: [
823
- /* @__PURE__ */ c("span", { className: "skopon-resume-select-card-tags-label", children: "满意度" }),
824
- /* @__PURE__ */ c("span", { className: "skopon-resume-select-card-field-value", children: typeof e == "number" ? `${e}%` : "暂无" })
898
+ function Gr(e) {
899
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-field", children: [
900
+ /* @__PURE__ */ u("span", { className: "skopon-resume-select-card-tags-label", children: "满意度" }),
901
+ /* @__PURE__ */ u("span", { className: "skopon-resume-select-card-field-value", children: typeof e == "number" ? `${e}%` : "暂无" })
825
902
  ] });
826
903
  }
827
- function Er({ work: e }) {
828
- return /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-work", children: [
829
- /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-work-cover", children: e.coverUrl ? /* @__PURE__ */ c("img", { src: e.coverUrl, alt: "", className: "skopon-resume-select-card-work-img" }) : /* @__PURE__ */ c(Nn, { className: "skopon-resume-select-card-work-placeholder" }) }),
830
- /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-work-title", children: e.title || "未命名作品" })
904
+ function Jr({ work: e }) {
905
+ return /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-work", children: [
906
+ /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-work-cover", children: e.coverUrl ? /* @__PURE__ */ u("img", { src: e.coverUrl, alt: "", className: "skopon-resume-select-card-work-img" }) : /* @__PURE__ */ u(Vn, { className: "skopon-resume-select-card-work-placeholder" }) }),
907
+ /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-work-title", children: e.title || "未命名作品" })
831
908
  ] });
832
909
  }
833
- function Pr({
910
+ function Wr({
834
911
  item: e,
835
912
  selected: t,
836
913
  disabled: n,
837
914
  onToggle: r
838
915
  }) {
839
- const o = (e.works ?? []).slice(0, Fr);
840
- return /* @__PURE__ */ N(
916
+ const o = (e.works ?? []).slice(0, Kr);
917
+ return /* @__PURE__ */ I(
841
918
  "button",
842
919
  {
843
920
  type: "button",
@@ -845,193 +922,199 @@ function Pr({
845
922
  disabled: n,
846
923
  onClick: r,
847
924
  children: [
848
- /* @__PURE__ */ c(
849
- Sn,
925
+ /* @__PURE__ */ u(
926
+ Un,
850
927
  {
851
928
  size: 48,
852
929
  src: e.avatarUrl || void 0,
853
- icon: e.avatarUrl ? void 0 : /* @__PURE__ */ c(In, {}),
930
+ icon: e.avatarUrl ? void 0 : /* @__PURE__ */ u(Ln, {}),
854
931
  className: "skopon-resume-select-card-avatar"
855
932
  }
856
933
  ),
857
- /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-name", children: e.name || "未命名简历" }),
858
- /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-body", children: [
859
- Ur(e.satisfaction),
860
- He("性格", e.personality),
861
- He("专长", e.specialties),
862
- He("擅长领域", e.traits),
863
- /* @__PURE__ */ N("div", { className: "skopon-resume-select-card-works", children: [
864
- /* @__PURE__ */ c("span", { className: "skopon-resume-select-card-works-label", children: "过往作品" }),
865
- o.length > 0 ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-works-list", children: o.map((i, a) => /* @__PURE__ */ c(Er, { work: i }, `${i.title}-${a}`)) }) : /* @__PURE__ */ c("div", { className: "skopon-resume-select-card-works-empty", children: "暂无作品" })
934
+ /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-name", children: e.name || "未命名简历" }),
935
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-body", children: [
936
+ Gr(e.satisfaction),
937
+ Ze("性格", e.personality),
938
+ Ze("专长", e.specialties),
939
+ Ze("擅长领域", e.traits),
940
+ /* @__PURE__ */ I("div", { className: "skopon-resume-select-card-works", children: [
941
+ /* @__PURE__ */ u("span", { className: "skopon-resume-select-card-works-label", children: "过往作品" }),
942
+ o.length > 0 ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-works-list", children: o.map((i, s) => /* @__PURE__ */ u(Jr, { work: i }, `${i.title}-${s}`)) }) : /* @__PURE__ */ u("div", { className: "skopon-resume-select-card-works-empty", children: "暂无作品" })
866
943
  ] })
867
944
  ] })
868
945
  ]
869
946
  }
870
947
  );
871
948
  }
872
- function wr({ context: e }) {
873
- const { interactive: t } = ee(), n = Tr(), { value: r, setValue: o, setValueSilent: i, fieldName: a } = te(e, "value", {
949
+ function Yr({ context: e }) {
950
+ const { interactive: t } = oe(), n = jr(), { publishLiveOptions: r } = pt(), { value: o, setValue: i, setValueSilent: s, fieldName: a } = ie(e, "value", {
874
951
  component: "SkoponResumeSelect",
875
952
  changeAction: "click"
876
- }), s = e.componentModel.properties, l = $e(s.label), u = $e(s.placeholder), m = $e(s.help), d = s.enableRefresh !== !1, y = xe(s.minCount), g = xe(s.maxCount), k = R(() => De(s.resumeFilter), [s.resumeFilter]), v = Ir(k), [C, h] = E(1), [p, S] = E(!1), [A, x] = E(""), [_, z] = E([]), [T, D] = E(0), [H, oe] = E(k.pageSize ?? 20), K = P(0), j = G(r);
877
- w(() => {
878
- const b = Dt(j, g);
879
- b !== null && i(b);
880
- }, [g, j, i]);
881
- const I = L(
882
- async (b) => {
883
- const B = De(JSON.parse(v)), $ = ++K.current;
953
+ }), l = e.componentModel.properties, c = Qe(l.label), m = Qe(l.placeholder), d = Qe(l.help), S = l.enableRefresh !== !1, g = we(l.minCount), b = we(l.maxCount), y = j(() => Xe(l.resumeFilter), [l.resumeFilter]), k = $r(y), [f, p] = U(1), [v, x] = U(!1), [M, A] = U(""), [R, C] = U([]), [O, q] = U(0), [le, K] = U(y.pageSize ?? 20), D = T(0), J = Y(o);
954
+ z(() => {
955
+ const _ = an(J, b);
956
+ _ !== null && s(_);
957
+ }, [b, J, s]);
958
+ const Z = $(
959
+ async (_) => {
960
+ const V = Xe(JSON.parse(k)), w = ++D.current;
884
961
  if (!n) {
885
- z([]), D(0), x("未配置简历搜索服务"), S(!1);
962
+ C([]), q(0), A("未配置简历搜索服务"), x(!1);
886
963
  return;
887
964
  }
888
- S(!0), x("");
965
+ x(!0), A("");
889
966
  try {
890
- const U = await n({ filter: B, page: b });
891
- if ($ !== K.current) return;
892
- z(U.list), D(U.total), h(U.page), oe(U.pageSize);
893
- } catch (U) {
894
- if ($ !== K.current) return;
895
- z([]), D(0), x(U instanceof Error ? U.message : "加载简历列表失败");
967
+ const F = await n({ filter: V, page: _ });
968
+ if (w !== D.current) return;
969
+ C(F.list), q(F.total), p(F.page), K(F.pageSize), a && r(
970
+ a,
971
+ F.list.map((W) => ({
972
+ value: W.resumeUniqueId,
973
+ label: W.name || W.resumeUniqueId
974
+ }))
975
+ );
976
+ } catch (F) {
977
+ if (w !== D.current) return;
978
+ C([]), q(0), A(F instanceof Error ? F.message : "加载简历列表失败");
896
979
  } finally {
897
- $ === K.current && S(!1);
980
+ w === D.current && x(!1);
898
981
  }
899
982
  },
900
- [n, v]
983
+ [n, k, a, r]
901
984
  );
902
- w(() => {
903
- h(1), I(1);
904
- }, [v, I]);
905
- const F = (b) => {
985
+ z(() => {
986
+ p(1), Z(1);
987
+ }, [k, Z]);
988
+ const ee = (_) => {
906
989
  if (!t) return;
907
- const B = jt(
908
- j,
909
- b,
910
- y,
911
- g
990
+ const V = on(
991
+ J,
992
+ _,
993
+ g,
994
+ b
912
995
  );
913
- B !== null && o(B);
914
- }, ie = () => {
915
- const b = De(JSON.parse(v)), B = H || b.pageSize || 20, $ = Math.max(1, Math.ceil(T / B)), U = C >= $ ? 1 : C + 1;
916
- I(U);
917
- }, Y = u || "暂无匹配的简历";
918
- return /* @__PURE__ */ N(
996
+ V !== null && i(V);
997
+ }, N = () => {
998
+ const _ = Xe(JSON.parse(k)), V = le || _.pageSize || 20, w = Math.max(1, Math.ceil(O / V)), F = f >= w ? 1 : f + 1;
999
+ Z(F);
1000
+ }, L = m || "暂无匹配的简历";
1001
+ return /* @__PURE__ */ I(
919
1002
  "div",
920
1003
  {
921
1004
  className: "form-block-preview skopon-resume-select",
922
1005
  "data-skopon-field": a || void 0,
923
1006
  children: [
924
- l ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: l }) : null,
925
- p && _.length === 0 ? /* @__PURE__ */ N("div", { className: "skopon-resume-select-status", children: [
926
- /* @__PURE__ */ c(tt, { size: "small" }),
1007
+ c ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: c }) : null,
1008
+ v && R.length === 0 ? /* @__PURE__ */ I("div", { className: "skopon-resume-select-status", children: [
1009
+ /* @__PURE__ */ u(ct, { size: "small" }),
927
1010
  " 加载简历…"
928
1011
  ] }) : null,
929
- !p && A ? /* @__PURE__ */ c(X.Text, { type: "danger", className: "skopon-resume-select-status", children: A }) : null,
930
- !p && !A && _.length === 0 ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-empty", children: Y }) : null,
931
- _.length > 0 ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-list", children: _.map((b) => /* @__PURE__ */ c(
932
- Pr,
1012
+ !v && M ? /* @__PURE__ */ u(te.Text, { type: "danger", className: "skopon-resume-select-status", children: M }) : null,
1013
+ !v && !M && R.length === 0 ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-empty", children: L }) : null,
1014
+ R.length > 0 ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-list", children: R.map((_) => /* @__PURE__ */ u(
1015
+ Wr,
933
1016
  {
934
- item: b,
935
- selected: j.includes(b.resumeUniqueId),
936
- disabled: $t(
937
- j,
938
- b.resumeUniqueId,
1017
+ item: _,
1018
+ selected: J.includes(_.resumeUniqueId),
1019
+ disabled: sn(
1020
+ J,
1021
+ _.resumeUniqueId,
939
1022
  t,
940
- y,
941
- g
1023
+ g,
1024
+ b
942
1025
  ),
943
- onToggle: () => F(b.resumeUniqueId)
1026
+ onToggle: () => ee(_.resumeUniqueId)
944
1027
  },
945
- b.resumeUniqueId
1028
+ _.resumeUniqueId
946
1029
  )) }) : null,
947
- d && n ? /* @__PURE__ */ c("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ c(
948
- Me,
1030
+ S && n ? /* @__PURE__ */ u("div", { className: "skopon-resume-select-actions", children: /* @__PURE__ */ u(
1031
+ ze,
949
1032
  {
950
1033
  type: "default",
951
1034
  size: "small",
952
- icon: /* @__PURE__ */ c(Mt, {}),
953
- loading: p,
1035
+ icon: /* @__PURE__ */ u(Dt, {}),
1036
+ loading: v,
954
1037
  disabled: !t,
955
- onClick: ie,
1038
+ onClick: N,
956
1039
  children: "换一批"
957
1040
  }
958
1041
  ) }) : null,
959
- m ? /* @__PURE__ */ c(X.Text, { type: "secondary", className: "form-block-preview-help", children: m }) : null
1042
+ d ? /* @__PURE__ */ u(te.Text, { type: "secondary", className: "form-block-preview-help", children: d }) : null
960
1043
  ]
961
1044
  }
962
1045
  );
963
1046
  }
964
- const Rr = J(
965
- Nr,
966
- wr
967
- ), zr = {
1047
+ const Qr = Q(
1048
+ Dr,
1049
+ Yr
1050
+ ), Xr = {
968
1051
  type: "resume_multiselect",
969
1052
  componentName: "SkoponResumeSelect",
970
- toComponent: _r,
971
- fromComponent: xr,
972
- catalogComponents: [Rr]
973
- }, Ue = [zr, Cr], Br = new Map(
974
- Ue.map((e) => [e.type, e])
975
- ), qr = new Map(
976
- Ue.map((e) => [e.componentName, e])
1053
+ toComponent: Lr,
1054
+ fromComponent: Vr,
1055
+ catalogComponents: [Qr]
1056
+ }, qe = [Xr, Br], Zr = new Map(
1057
+ qe.map((e) => [e.type, e])
1058
+ ), eo = new Map(
1059
+ qe.map((e) => [e.componentName, e])
977
1060
  );
978
- function Or(e) {
979
- return Br.get(e);
1061
+ function to(e) {
1062
+ return Zr.get(e);
980
1063
  }
981
- function Vr(e) {
982
- return qr.get(e);
1064
+ function no(e) {
1065
+ return eo.get(e);
983
1066
  }
984
- function Lr() {
985
- return Ue.flatMap((e) => e.catalogComponents);
1067
+ function ro() {
1068
+ return qe.flatMap((e) => e.catalogComponents);
986
1069
  }
987
- function jr() {
988
- return Ue.map((e) => e.componentName);
1070
+ function oo() {
1071
+ return qe.map((e) => e.componentName);
989
1072
  }
990
- const Te = "root", Xe = "__title__", Ze = "__desc__", it = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
991
- function $r(e) {
1073
+ const Pe = "root", st = "__title__", at = "__desc__", ft = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
1074
+ function io(e) {
992
1075
  return `/${e}`;
993
1076
  }
994
- function It(e) {
1077
+ function jt(e) {
995
1078
  return e && typeof e == "object" && "path" in e ? String(e.path ?? "").replace(/^\//, "") : "";
996
1079
  }
997
- function O(e) {
1080
+ function H(e) {
998
1081
  if (typeof e == "string") return e;
999
1082
  }
1000
- function Dr(e) {
1001
- const t = e.id || me("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
1083
+ function so(e) {
1084
+ const t = e.id || Se("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
1002
1085
  return {
1003
1086
  id: t,
1004
1087
  component: "SkoponMedia",
1005
1088
  mediaType: n,
1006
- urls: Zn(e),
1007
- mediaSize: pe(e.mediaSize),
1089
+ urls: dr(e),
1090
+ mediaSize: ke(e.mediaSize),
1008
1091
  label: e.label ?? "",
1009
1092
  help: e.help ?? "",
1010
1093
  placeholder: e.placeholder ?? ""
1011
1094
  };
1012
1095
  }
1013
- function Hr(e) {
1096
+ function ao(e) {
1014
1097
  if (Array.isArray(e.urls))
1015
1098
  return e.urls.map((n) => String(n).trim()).filter(Boolean);
1016
- const t = O(e.url);
1099
+ const t = H(e.url);
1017
1100
  return t != null && t.trim() ? [t.trim()] : [];
1018
1101
  }
1019
- function be(e, t, n) {
1020
- const r = typeof e.id == "string" ? e.id : me("block-"), o = Hr(e), i = O(e.label) ?? O(e.description) ?? n, a = O(e.help), s = O(e.placeholder), l = pe(e.mediaSize);
1102
+ function Fe(e, t, n) {
1103
+ const r = typeof e.id == "string" ? e.id : Se("block-"), o = ao(e), i = H(e.label) ?? H(e.description) ?? n, s = H(e.help), a = H(e.placeholder), l = ke(e.mediaSize);
1021
1104
  return {
1022
1105
  id: r,
1023
1106
  type: t,
1024
1107
  label: i,
1025
- ...a ? { help: a } : {},
1026
- ...s ? { placeholder: s } : {},
1108
+ ...s ? { help: s } : {},
1109
+ ...a ? { placeholder: a } : {},
1027
1110
  mediaSize: l,
1028
1111
  mediaUrls: o.length > 0 ? o : [""]
1029
1112
  };
1030
1113
  }
1031
- function Kr(e) {
1114
+ function lo(e) {
1032
1115
  switch (e.type) {
1033
1116
  case "toggle":
1034
- return fe(e.defaultValue);
1117
+ return Ce(e.defaultValue);
1035
1118
  case "multiselect":
1036
1119
  case "checkbox":
1037
1120
  case "resume_multiselect":
@@ -1045,11 +1128,11 @@ function Kr(e) {
1045
1128
  return typeof e.defaultValue == "string" ? e.defaultValue : "";
1046
1129
  }
1047
1130
  }
1048
- function Gr(e) {
1049
- var u;
1050
- const t = e.id || me("a2-"), n = e.label ?? "", r = ((u = e.name) == null ? void 0 : u.trim()) || "", o = r ? $r(r) : void 0, i = (e.options ?? []).map((m) => ({ label: m.label, value: m.value })), a = (m) => r ? { node: m, dataKey: r, dataValue: Kr(e) } : { node: m }, s = { id: t, label: n, name: r, path: o, withData: a }, l = Or(e.type);
1131
+ function co(e) {
1132
+ var c;
1133
+ const t = e.id || Se("a2-"), n = e.label ?? "", r = ((c = e.name) == null ? void 0 : c.trim()) || "", o = r ? io(r) : void 0, i = (e.options ?? []).map((m) => ({ label: m.label, value: m.value })), s = (m) => r ? { node: m, dataKey: r, dataValue: lo(e) } : { node: m }, a = { id: t, label: n, name: r, path: o, withData: s }, l = to(e.type);
1051
1134
  if (l)
1052
- return l.toComponent(e, s);
1135
+ return l.toComponent(e, a);
1053
1136
  switch (e.type) {
1054
1137
  case "heading":
1055
1138
  return { node: { id: t, component: "Text", text: n, variant: "h3" } };
@@ -1058,7 +1141,7 @@ function Gr(e) {
1058
1141
  case "text":
1059
1142
  case "tel":
1060
1143
  case "url":
1061
- return a({
1144
+ return s({
1062
1145
  id: t,
1063
1146
  component: "TextField",
1064
1147
  label: n,
@@ -1067,17 +1150,17 @@ function Gr(e) {
1067
1150
  value: { path: o }
1068
1151
  });
1069
1152
  case "email":
1070
- return a({
1153
+ return s({
1071
1154
  id: t,
1072
1155
  component: "TextField",
1073
1156
  label: n,
1074
1157
  variant: "shortText",
1075
- validationRegexp: it,
1158
+ validationRegexp: ft,
1076
1159
  ...e.placeholder ? { placeholder: e.placeholder } : {},
1077
1160
  value: { path: o }
1078
1161
  });
1079
1162
  case "textarea":
1080
- return a({
1163
+ return s({
1081
1164
  id: t,
1082
1165
  component: "TextField",
1083
1166
  label: n,
@@ -1086,7 +1169,7 @@ function Gr(e) {
1086
1169
  value: { path: o }
1087
1170
  });
1088
1171
  case "number":
1089
- return a({
1172
+ return s({
1090
1173
  id: t,
1091
1174
  component: "TextField",
1092
1175
  label: n,
@@ -1095,7 +1178,7 @@ function Gr(e) {
1095
1178
  value: { path: o }
1096
1179
  });
1097
1180
  case "select":
1098
- return a({
1181
+ return s({
1099
1182
  id: t,
1100
1183
  component: "SkoponSelect",
1101
1184
  label: n,
@@ -1105,7 +1188,7 @@ function Gr(e) {
1105
1188
  value: { path: o }
1106
1189
  });
1107
1190
  case "radio":
1108
- return a({
1191
+ return s({
1109
1192
  id: t,
1110
1193
  component: "ChoicePicker",
1111
1194
  label: n,
@@ -1115,7 +1198,7 @@ function Gr(e) {
1115
1198
  value: { path: o }
1116
1199
  });
1117
1200
  case "multiselect":
1118
- return a({
1201
+ return s({
1119
1202
  id: t,
1120
1203
  component: "SkoponSelect",
1121
1204
  label: n,
@@ -1125,7 +1208,7 @@ function Gr(e) {
1125
1208
  value: { path: o }
1126
1209
  });
1127
1210
  case "checkbox":
1128
- return a({
1211
+ return s({
1129
1212
  id: t,
1130
1213
  component: "ChoicePicker",
1131
1214
  label: n,
@@ -1135,9 +1218,9 @@ function Gr(e) {
1135
1218
  value: { path: o }
1136
1219
  });
1137
1220
  case "toggle":
1138
- return a({ id: t, component: "CheckBox", label: n, value: { path: o } });
1221
+ return s({ id: t, component: "CheckBox", label: n, value: { path: o } });
1139
1222
  case "datetime":
1140
- return a({
1223
+ return s({
1141
1224
  id: t,
1142
1225
  component: "DateTimeInput",
1143
1226
  label: n,
@@ -1147,7 +1230,7 @@ function Gr(e) {
1147
1230
  value: { path: o }
1148
1231
  });
1149
1232
  case "time":
1150
- return a({
1233
+ return s({
1151
1234
  id: t,
1152
1235
  component: "DateTimeInput",
1153
1236
  label: n,
@@ -1158,9 +1241,9 @@ function Gr(e) {
1158
1241
  case "image":
1159
1242
  case "video":
1160
1243
  case "audio":
1161
- return { node: Dr(e) };
1244
+ return { node: so(e) };
1162
1245
  case "file":
1163
- return a({
1246
+ return s({
1164
1247
  id: t,
1165
1248
  component: "FileUpload",
1166
1249
  label: n,
@@ -1175,31 +1258,31 @@ function Gr(e) {
1175
1258
  return { node: null };
1176
1259
  }
1177
1260
  }
1178
- function et(e) {
1261
+ function lt(e) {
1179
1262
  if (!e || !Array.isArray(e.components) || e.components.length === 0) return !0;
1180
- const t = e.components.find((r) => r.id === Te);
1263
+ const t = e.components.find((r) => r.id === Pe);
1181
1264
  if (!t) return e.components.length === 0;
1182
1265
  const n = t.children;
1183
1266
  return !Array.isArray(n) || n.length === 0;
1184
1267
  }
1185
- function Gt(e, t) {
1186
- const n = [], r = [], o = {}, i = (t == null ? void 0 : t.includeHeader) !== !1, a = (e.title ?? "").trim(), s = (e.description ?? "").trim();
1187
- i && a && (n.push({ id: Xe, component: "Text", text: a, variant: "h2" }), r.push(Xe)), i && s && (n.push({ id: Ze, component: "Text", text: s, variant: "body" }), r.push(Ze));
1268
+ function un(e, t) {
1269
+ const n = [], r = [], o = {}, i = (t == null ? void 0 : t.includeHeader) !== !1, s = (e.title ?? "").trim(), a = (e.description ?? "").trim();
1270
+ i && s && (n.push({ id: st, component: "Text", text: s, variant: "h2" }), r.push(st)), i && a && (n.push({ id: at, component: "Text", text: a, variant: "body" }), r.push(at));
1188
1271
  for (const m of e.blocks ?? []) {
1189
- const { node: d, dataKey: y, dataValue: g } = Gr(m);
1190
- d && (n.push(d), r.push(d.id), y && (o[y] = g));
1272
+ const { node: d, dataKey: S, dataValue: g } = co(m);
1273
+ d && (n.push(d), r.push(d.id), S && (o[S] = g));
1191
1274
  }
1192
- n.unshift({ id: Te, component: "Column", children: r });
1193
- const l = { root: Te, components: n, dataModel: o }, u = t == null ? void 0 : t.styleId;
1194
- return u !== void 0 && (l.surfaceProperties = { styleId: u ?? null }), l;
1275
+ n.unshift({ id: Pe, component: "Column", children: r });
1276
+ const l = { root: Pe, components: n, dataModel: o }, c = t == null ? void 0 : t.styleId;
1277
+ return c !== void 0 && (l.surfaceProperties = { styleId: c ?? null }), l;
1195
1278
  }
1196
- function Jr(e) {
1279
+ function uo(e) {
1197
1280
  const t = /* @__PURE__ */ new Map();
1198
1281
  for (const n of e.components ?? [])
1199
1282
  n && typeof n.id == "string" && t.set(n.id, n);
1200
1283
  return t;
1201
1284
  }
1202
- function Ke(e) {
1285
+ function et(e) {
1203
1286
  const t = e.options;
1204
1287
  return Array.isArray(t) ? t.map((n) => {
1205
1288
  if (!n || typeof n != "object") return null;
@@ -1210,116 +1293,116 @@ function Ke(e) {
1210
1293
  };
1211
1294
  }).filter((n) => !!n) : [];
1212
1295
  }
1213
- function Wr(e) {
1214
- const t = typeof e.id == "string" ? e.id : me("block-"), n = String(e.component ?? ""), r = O(e.label) ?? O(e.text) ?? "", o = It(e.value), i = (s) => ({ id: t, type: s, label: r }), a = Vr(n);
1215
- if (a)
1216
- return a.fromComponent(e, i, { asLiteral: O, nameFromValue: It });
1296
+ function mo(e) {
1297
+ const t = typeof e.id == "string" ? e.id : Se("block-"), n = String(e.component ?? ""), r = H(e.label) ?? H(e.text) ?? "", o = jt(e.value), i = (a) => ({ id: t, type: a, label: r }), s = no(n);
1298
+ if (s)
1299
+ return s.fromComponent(e, i, { asLiteral: H, nameFromValue: jt });
1217
1300
  switch (n) {
1218
1301
  case "Text": {
1219
- const s = String(e.variant ?? "body"), l = /^h[1-6]$/i.test(s) || s === "title" || s === "subtitle";
1302
+ const a = String(e.variant ?? "body"), l = /^h[1-6]$/i.test(a) || a === "title" || a === "subtitle";
1220
1303
  return { id: t, type: l ? "heading" : "paragraph", label: r };
1221
1304
  }
1222
1305
  case "TextField": {
1223
- const s = String(e.variant ?? "shortText");
1306
+ const a = String(e.variant ?? "shortText");
1224
1307
  let l = "text";
1225
- s === "longText" ? l = "textarea" : s === "number" ? l = "number" : O(e.validationRegexp) === it && (l = "email");
1226
- const u = { ...i(l), name: o }, m = O(e.placeholder);
1227
- return m && (u.placeholder = m), u;
1308
+ a === "longText" ? l = "textarea" : a === "number" ? l = "number" : H(e.validationRegexp) === ft && (l = "email");
1309
+ const c = { ...i(l), name: o }, m = H(e.placeholder);
1310
+ return m && (c.placeholder = m), c;
1228
1311
  }
1229
1312
  case "CheckBox":
1230
1313
  return { ...i("toggle"), name: o };
1231
1314
  case "SkoponSelect": {
1232
- const l = String(e.mode ?? "single") === "multiple" ? "multiselect" : "select", u = {
1315
+ const l = String(e.mode ?? "single") === "multiple" ? "multiselect" : "select", c = {
1233
1316
  ...i(l),
1234
1317
  name: o,
1235
- options: Ke(e)
1236
- }, m = O(e.placeholder);
1237
- return m && (u.placeholder = m), u;
1318
+ options: et(e)
1319
+ }, m = H(e.placeholder);
1320
+ return m && (c.placeholder = m), c;
1238
1321
  }
1239
1322
  case "ChoicePicker": {
1240
- const s = O(e.skoponPickerType);
1241
- if (s === "select" || s === "multiselect" || s === "radio" || s === "checkbox") {
1323
+ const a = H(e.skoponPickerType);
1324
+ if (a === "select" || a === "multiselect" || a === "radio" || a === "checkbox") {
1242
1325
  const m = {
1243
- ...i(s),
1326
+ ...i(a),
1244
1327
  name: o,
1245
- options: Ke(e)
1246
- }, d = O(e.placeholder);
1328
+ options: et(e)
1329
+ }, d = H(e.placeholder);
1247
1330
  return d && (m.placeholder = d), m;
1248
1331
  }
1249
- const u = String(e.variant ?? "mutuallyExclusive") === "multipleSelection" ? "checkbox" : "radio";
1250
- return { ...i(u), name: o, options: Ke(e) };
1332
+ const c = String(e.variant ?? "mutuallyExclusive") === "multipleSelection" ? "checkbox" : "radio";
1333
+ return { ...i(c), name: o, options: et(e) };
1251
1334
  }
1252
1335
  case "DateTimeInput": {
1253
- const s = e.enableDate === !0, l = e.enableTime === !0, m = { ...i(!s && l ? "time" : "datetime"), name: o }, d = O(e.placeholder);
1336
+ const a = e.enableDate === !0, l = e.enableTime === !0, m = { ...i(!a && l ? "time" : "datetime"), name: o }, d = H(e.placeholder);
1254
1337
  return d && (m.placeholder = d), m;
1255
1338
  }
1256
1339
  case "SkoponMedia": {
1257
- const s = String(e.mediaType ?? "image");
1258
- return be(e, s === "video" ? "video" : s === "audio" ? "audio" : "image", r);
1340
+ const a = String(e.mediaType ?? "image");
1341
+ return Fe(e, a === "video" ? "video" : a === "audio" ? "audio" : "image", r);
1259
1342
  }
1260
1343
  case "Image":
1261
- return be(e, "image", r);
1344
+ return Fe(e, "image", r);
1262
1345
  case "Video":
1263
- return be(e, "video", r);
1346
+ return Fe(e, "video", r);
1264
1347
  case "AudioPlayer":
1265
- return be(e, "audio", r);
1348
+ return Fe(e, "audio", r);
1266
1349
  case "FileUpload": {
1267
- const s = O(e.accept) ?? "", l = { ...i("file"), name: o };
1268
- return s && (l.fileAcceptExtensions = s.split(",").map((u) => u.trim()).filter(Boolean)), Array.isArray(e.fileAcceptTypes) && (l.fileAcceptTypes = e.fileAcceptTypes.map(String)), typeof e.filePlaceholderIcon == "string" && (l.filePlaceholderIcon = e.filePlaceholderIcon), typeof e.minCount == "number" && (l.fileMinCount = e.minCount), typeof e.maxCount == "number" && (l.fileMaxCount = e.maxCount), l;
1350
+ const a = H(e.accept) ?? "", l = { ...i("file"), name: o };
1351
+ return a && (l.fileAcceptExtensions = a.split(",").map((c) => c.trim()).filter(Boolean)), Array.isArray(e.fileAcceptTypes) && (l.fileAcceptTypes = e.fileAcceptTypes.map(String)), typeof e.filePlaceholderIcon == "string" && (l.filePlaceholderIcon = e.filePlaceholderIcon), typeof e.minCount == "number" && (l.fileMinCount = e.minCount), typeof e.maxCount == "number" && (l.fileMaxCount = e.maxCount), l;
1269
1352
  }
1270
1353
  default:
1271
1354
  return null;
1272
1355
  }
1273
1356
  }
1274
- function Jt(e, t, n, r) {
1357
+ function mn(e, t, n, r) {
1275
1358
  if (n.has(e)) return;
1276
1359
  n.add(e);
1277
1360
  const o = t.get(e);
1278
1361
  if (!o) return;
1279
1362
  const i = String(o.component ?? "");
1280
1363
  if ((i === "Column" || i === "Row") && Array.isArray(o.children)) {
1281
- for (const a of o.children)
1282
- typeof a == "string" && Jt(a, t, n, r);
1364
+ for (const s of o.children)
1365
+ typeof s == "string" && mn(s, t, n, r);
1283
1366
  return;
1284
1367
  }
1285
1368
  r.push(o);
1286
1369
  }
1287
- function Yr(e, t) {
1370
+ function po(e, t) {
1288
1371
  return t ? e.map((n) => {
1289
1372
  var i;
1290
1373
  const r = (i = n.name) == null ? void 0 : i.trim();
1291
1374
  if (!r || !(r in t)) return n;
1292
1375
  const o = t[r];
1293
- return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: fe(o) } : { ...n, defaultValue: o };
1376
+ return o === void 0 ? n : n.type === "toggle" ? { ...n, defaultValue: Ce(o) } : { ...n, defaultValue: o };
1294
1377
  }) : e;
1295
1378
  }
1296
- function Qr(e) {
1379
+ function fo(e) {
1297
1380
  if (!e || !Array.isArray(e.components))
1298
- return _e({ title: "", description: "", blocks: [], jsonSchema: {} });
1299
- const t = Jr(e), n = [];
1300
- Jt(e.root ?? Te, t, /* @__PURE__ */ new Set(), n);
1381
+ return Re({ title: "", description: "", blocks: [], jsonSchema: {} });
1382
+ const t = uo(e), n = [];
1383
+ mn(e.root ?? Pe, t, /* @__PURE__ */ new Set(), n);
1301
1384
  let r = "", o = "";
1302
1385
  const i = [];
1303
- for (const a of n) {
1304
- if (a.id === Xe) {
1305
- r = O(a.text) ?? r;
1386
+ for (const s of n) {
1387
+ if (s.id === st) {
1388
+ r = H(s.text) ?? r;
1306
1389
  continue;
1307
1390
  }
1308
- if (a.id === Ze) {
1309
- o = O(a.text) ?? o;
1391
+ if (s.id === at) {
1392
+ o = H(s.text) ?? o;
1310
1393
  continue;
1311
1394
  }
1312
- const s = Wr(a);
1313
- s && i.push(s);
1395
+ const a = mo(s);
1396
+ a && i.push(a);
1314
1397
  }
1315
- return _e({
1398
+ return Re({
1316
1399
  title: r,
1317
1400
  description: o,
1318
- blocks: Yr(i, e.dataModel),
1401
+ blocks: po(i, e.dataModel),
1319
1402
  jsonSchema: {}
1320
1403
  });
1321
1404
  }
1322
- function Xr(e, t) {
1405
+ function ho(e, t) {
1323
1406
  const { surfaceId: n, catalogId: r } = t, o = [
1324
1407
  { version: "v0.9", createSurface: { surfaceId: n, catalogId: r } },
1325
1408
  {
@@ -1332,25 +1415,25 @@ function Xr(e, t) {
1332
1415
  updateDataModel: { surfaceId: n, path: "/", value: e.dataModel }
1333
1416
  }), o;
1334
1417
  }
1335
- function Wt(e) {
1418
+ function dn(e) {
1336
1419
  return !!e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.components);
1337
1420
  }
1338
- function Zr(e, t) {
1421
+ function go(e, t) {
1339
1422
  if (!e || typeof e != "object") return null;
1340
- const n = e, r = Wt(n.a2ui) ? n.a2ui : void 0;
1341
- if (r && !et(r)) return r;
1423
+ const n = e, r = dn(n.a2ui) ? n.a2ui : void 0;
1424
+ if (r && !lt(r)) return r;
1342
1425
  const o = Array.isArray(n.blocks) ? n.blocks : [];
1343
1426
  if (o.length === 0) return null;
1344
- const i = re({
1427
+ const i = me({
1345
1428
  title: typeof n.title == "string" ? n.title : "",
1346
1429
  description: typeof n.description == "string" ? n.description : "",
1347
1430
  blocks: o,
1348
- jsonSchema: ot(n.jsonSchema ?? n.json_schema)
1349
- }), a = Gt(i, t);
1350
- return et(a) ? null : a;
1431
+ jsonSchema: dt(n.jsonSchema ?? n.json_schema)
1432
+ }), s = un(i, t);
1433
+ return lt(s) ? null : s;
1351
1434
  }
1352
- function eo(e, t, n) {
1353
- return Gt(
1435
+ function yo(e, t, n) {
1436
+ return un(
1354
1437
  {
1355
1438
  title: e.title,
1356
1439
  description: e.description,
@@ -1359,92 +1442,92 @@ function eo(e, t, n) {
1359
1442
  n
1360
1443
  );
1361
1444
  }
1362
- function to(e) {
1445
+ function vo(e) {
1363
1446
  if (!e || typeof e != "object" || Array.isArray(e))
1364
1447
  return;
1365
1448
  const t = e;
1366
- return !(Array.isArray(t.blocks) && t.blocks.length > 0) && Wt(t.a2ui) ? Qr(t.a2ui) : re({
1449
+ return !(Array.isArray(t.blocks) && t.blocks.length > 0) && dn(t.a2ui) ? fo(t.a2ui) : me({
1367
1450
  title: typeof t.title == "string" ? t.title : "",
1368
1451
  description: typeof t.description == "string" ? t.description : "",
1369
1452
  blocks: Array.isArray(t.blocks) ? t.blocks : [],
1370
- jsonSchema: ot(t.jsonSchema ?? t.json_schema)
1453
+ jsonSchema: dt(t.jsonSchema ?? t.json_schema)
1371
1454
  });
1372
1455
  }
1373
- function no(e, t, n) {
1456
+ function So(e, t, n) {
1374
1457
  const r = e.model.surfacesMap.get(t);
1375
1458
  if (!r) return {};
1376
1459
  const o = {};
1377
1460
  for (const i of n) {
1378
- const a = i.trim();
1379
- a && (o[a] = r.dataModel.get(`/${a}`));
1461
+ const s = i.trim();
1462
+ s && (o[s] = r.dataModel.get(`/${s}`));
1380
1463
  }
1381
1464
  return o;
1382
1465
  }
1383
- function ro(e) {
1384
- return re({
1466
+ function bo(e) {
1467
+ return me({
1385
1468
  title: "",
1386
1469
  description: "",
1387
1470
  blocks: [e],
1388
1471
  jsonSchema: {}
1389
1472
  }).blocks[0];
1390
1473
  }
1391
- function oo(e, t) {
1474
+ function ko(e, t) {
1392
1475
  var o, i;
1393
1476
  const n = /* @__PURE__ */ new Map();
1394
- for (const a of t) {
1395
- const s = (o = a.name) == null ? void 0 : o.trim();
1396
- s && n.set(s, a);
1477
+ for (const s of t) {
1478
+ const a = (o = s.name) == null ? void 0 : o.trim();
1479
+ a && n.set(a, s);
1397
1480
  }
1398
1481
  const r = [];
1399
- for (const a of e.blocks) {
1400
- if (Fe(a.type)) {
1401
- r.push(ro(a));
1482
+ for (const s of e.blocks) {
1483
+ if (Oe(s.type)) {
1484
+ r.push(bo(s));
1402
1485
  continue;
1403
1486
  }
1404
- if (!ne(a.type)) continue;
1405
- const s = (i = a.name) == null ? void 0 : i.trim();
1406
- if (!s) continue;
1407
- const l = n.get(s);
1487
+ if (!ae(s.type)) continue;
1488
+ const a = (i = s.name) == null ? void 0 : i.trim();
1489
+ if (!a) continue;
1490
+ const l = n.get(a);
1408
1491
  l && r.push(l);
1409
1492
  }
1410
1493
  return r;
1411
1494
  }
1412
- function io(e, t) {
1495
+ function Co(e, t) {
1413
1496
  var r;
1414
1497
  const n = {
1415
1498
  ...e,
1416
1499
  name: ((r = e.name) == null ? void 0 : r.trim()) || t.name
1417
1500
  };
1418
- return t.defaultValue !== void 0 && (n.defaultValue = t.defaultValue), re({
1501
+ return t.defaultValue !== void 0 && (n.defaultValue = t.defaultValue), me({
1419
1502
  title: "",
1420
1503
  description: "",
1421
1504
  blocks: [n],
1422
1505
  jsonSchema: {}
1423
1506
  }).blocks[0];
1424
1507
  }
1425
- function Ee(e) {
1508
+ function Be(e) {
1426
1509
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1427
1510
  const t = e;
1428
- return Array.isArray(t.blocks) ? re({
1511
+ return Array.isArray(t.blocks) ? me({
1429
1512
  title: typeof t.title == "string" ? t.title : "",
1430
1513
  description: typeof t.description == "string" ? t.description : "",
1431
1514
  blocks: t.blocks,
1432
1515
  jsonSchema: {}
1433
1516
  }) : null;
1434
1517
  }
1435
- function ao(e, t) {
1436
- var i, a, s, l, u, m;
1518
+ function Ao(e, t) {
1519
+ var i, s, a, l, c, m;
1437
1520
  const n = /* @__PURE__ */ new Map();
1438
1521
  for (const d of (t == null ? void 0 : t.blocks) ?? [])
1439
- ne(d.type) && ((i = d.name) != null && i.trim()) && n.set(d.name.trim(), d);
1522
+ ae(d.type) && ((i = d.name) != null && i.trim()) && n.set(d.name.trim(), d);
1440
1523
  const r = [], o = [];
1441
1524
  for (const d of e.blocks) {
1442
- if (!ne(d.type)) continue;
1443
- const y = (a = d.name) == null ? void 0 : a.trim();
1444
- if (!y) continue;
1445
- const g = n.get(y);
1446
- g ? r.push(io(g, d)) : o.push(
1447
- re({
1525
+ if (!ae(d.type)) continue;
1526
+ const S = (s = d.name) == null ? void 0 : s.trim();
1527
+ if (!S) continue;
1528
+ const g = n.get(S);
1529
+ g ? r.push(Co(g, d)) : o.push(
1530
+ me({
1448
1531
  title: "",
1449
1532
  description: "",
1450
1533
  blocks: [d],
@@ -1455,88 +1538,88 @@ function ao(e, t) {
1455
1538
  return {
1456
1539
  matchedBlocks: r,
1457
1540
  extraBlocks: o,
1458
- renderBlocks: oo(e, r),
1459
- title: ((s = e.title) == null ? void 0 : s.trim()) || ((l = t == null ? void 0 : t.title) == null ? void 0 : l.trim()) || "",
1460
- description: ((u = e.description) == null ? void 0 : u.trim()) || ((m = t == null ? void 0 : t.description) == null ? void 0 : m.trim()) || ""
1541
+ renderBlocks: ko(e, r),
1542
+ title: ((a = e.title) == null ? void 0 : a.trim()) || ((l = t == null ? void 0 : t.title) == null ? void 0 : l.trim()) || "",
1543
+ description: ((c = e.description) == null ? void 0 : c.trim()) || ((m = t == null ? void 0 : t.description) == null ? void 0 : m.trim()) || ""
1461
1544
  };
1462
1545
  }
1463
- function so(e) {
1546
+ function _o(e) {
1464
1547
  const { type: t, defaultValue: n } = e;
1465
1548
  return n !== void 0 ? t === "toggle" ? n === !0 || n === "true" : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? Array.isArray(n) ? n.map(String) : typeof n == "string" && n ? [n] : [] : n : t === "toggle" ? !1 : t === "multiselect" || t === "checkbox" || t === "resume_multiselect" || t === "case_multiselect" ? [] : t === "number" ? null : "";
1466
1549
  }
1467
- function at(e) {
1550
+ function ht(e) {
1468
1551
  var n;
1469
1552
  const t = {};
1470
1553
  for (const r of e) {
1471
- if (!ne(r.type)) continue;
1554
+ if (!ae(r.type)) continue;
1472
1555
  const o = (n = r.name) == null ? void 0 : n.trim();
1473
- o && (t[o] = so(r));
1556
+ o && (t[o] = _o(r));
1474
1557
  }
1475
1558
  return t;
1476
1559
  }
1477
- function lo(e) {
1560
+ function To(e) {
1478
1561
  return e.blocks.some(
1479
1562
  (t) => {
1480
1563
  var n;
1481
- return ne(t.type) && !!((n = t.name) != null && n.trim());
1564
+ return ae(t.type) && !!((n = t.name) != null && n.trim());
1482
1565
  }
1483
1566
  );
1484
1567
  }
1485
- function co(e) {
1568
+ function xo(e) {
1486
1569
  return e.blocks.filter((t) => {
1487
1570
  var n;
1488
- return Fe(t.type) ? !0 : ne(t.type) && !!((n = t.name) != null && n.trim());
1571
+ return Oe(t.type) ? !0 : ae(t.type) && !!((n = t.name) != null && n.trim());
1489
1572
  });
1490
1573
  }
1491
- function uo(e) {
1574
+ function Io(e) {
1492
1575
  return e.blocks.filter((t) => {
1493
1576
  var n;
1494
- return ne(t.type) && ((n = t.name) == null ? void 0 : n.trim());
1577
+ return ae(t.type) && ((n = t.name) == null ? void 0 : n.trim());
1495
1578
  }).map((t) => t.name.trim());
1496
1579
  }
1497
- function st(e) {
1580
+ function gt(e) {
1498
1581
  return e.replace(/'/g, "'\\''");
1499
1582
  }
1500
- function Yt(e) {
1583
+ function pn(e) {
1501
1584
  var n;
1502
1585
  const t = (n = e == null ? void 0 : e.Authorization) == null ? void 0 : n.trim();
1503
- return t ? ` -H 'Authorization: ${st(t)}' \\` : " -H 'Authorization: Bearer <token>' \\";
1586
+ return t ? ` -H 'Authorization: ${gt(t)}' \\` : " -H 'Authorization: Bearer <token>' \\";
1504
1587
  }
1505
- function Qt(e, t, n) {
1588
+ function fn(e, t, n) {
1506
1589
  const r = (t ?? "").trim() || "<callback_url>", o = JSON.stringify(e ?? {}, null, 2);
1507
1590
  return [
1508
1591
  `curl -X POST '${r}' \\`,
1509
1592
  " -H 'Content-Type: application/json' \\",
1510
- Yt(n),
1511
- ` -d '${st(o)}'`
1593
+ pn(n),
1594
+ ` -d '${gt(o)}'`
1512
1595
  ].join(`
1513
1596
  `);
1514
1597
  }
1515
- function mo(e, t) {
1598
+ function Mo(e, t) {
1516
1599
  return JSON.stringify({ ...e, ...t }, null, 2);
1517
1600
  }
1518
- function po({
1601
+ function Fo({
1519
1602
  cardValues: e,
1520
1603
  extraValues: t = {},
1521
1604
  callbackUrl: n,
1522
1605
  headers: r
1523
1606
  }) {
1524
- const o = (n ?? "").trim() || "<callback_url>", i = mo(e, t);
1607
+ const o = (n ?? "").trim() || "<callback_url>", i = Mo(e, t);
1525
1608
  return [
1526
1609
  `curl -X POST '${o}' \\`,
1527
1610
  " -H 'Content-Type: application/json' \\",
1528
- Yt(r),
1529
- ` -d '${st(i)}'`
1611
+ pn(r),
1612
+ ` -d '${gt(i)}'`
1530
1613
  ].join(`
1531
1614
  `);
1532
1615
  }
1533
- function Ui(e, t, n) {
1534
- const r = Ee(e);
1535
- if (!r) return Qt(e, t, n);
1536
- const o = at(r.blocks);
1537
- return po({ cardValues: o, callbackUrl: t, headers: n });
1616
+ function es(e, t, n) {
1617
+ const r = Be(e);
1618
+ if (!r) return fn(e, t, n);
1619
+ const o = ht(r.blocks);
1620
+ return Fo({ cardValues: o, callbackUrl: t, headers: n });
1538
1621
  }
1539
- async function Xt(e, t, n) {
1622
+ async function hn(e, t, n) {
1540
1623
  const r = e.trim();
1541
1624
  if (!r)
1542
1625
  throw new Error("callback_url 为空");
@@ -1548,22 +1631,22 @@ async function Xt(e, t, n) {
1548
1631
  },
1549
1632
  body: JSON.stringify(t ?? {})
1550
1633
  });
1551
- let a;
1634
+ let s;
1552
1635
  if ((i.headers.get("content-type") ?? "").includes("application/json"))
1553
1636
  try {
1554
- a = await i.json();
1637
+ s = await i.json();
1555
1638
  } catch {
1556
- a = void 0;
1639
+ s = void 0;
1557
1640
  }
1558
1641
  else
1559
1642
  try {
1560
- a = await i.text();
1643
+ s = await i.text();
1561
1644
  } catch {
1562
- a = void 0;
1645
+ s = void 0;
1563
1646
  }
1564
- return { ok: i.ok, status: i.status, body: a };
1647
+ return { ok: i.ok, status: i.status, body: s };
1565
1648
  }
1566
- async function Ei(e) {
1649
+ async function ts(e) {
1567
1650
  var n;
1568
1651
  if (typeof navigator < "u" && ((n = navigator.clipboard) != null && n.writeText)) {
1569
1652
  await navigator.clipboard.writeText(e);
@@ -1579,7 +1662,7 @@ async function Ei(e) {
1579
1662
  document.body.removeChild(t);
1580
1663
  }
1581
1664
  }
1582
- async function lt(e) {
1665
+ async function yt(e) {
1583
1666
  let t;
1584
1667
  try {
1585
1668
  t = await e.json();
@@ -1592,8 +1675,8 @@ async function lt(e) {
1592
1675
  throw new Error(t.message || `响应缺少 data (${e.status})`);
1593
1676
  return t.data;
1594
1677
  }
1595
- const ct = "auth_user", fo = "token", ho = "answer_agent_callback_url", go = "realtime_ws_url", yo = "/api/v1/mock/ask_user_answer_mock";
1596
- function ut(e) {
1678
+ const vt = "auth_user", No = "token", Eo = "answer_agent_callback_url", Uo = "realtime_ws_url", Ro = "/api/v1/mock/ask_user_answer_mock";
1679
+ function St(e) {
1597
1680
  if (typeof window > "u") return null;
1598
1681
  try {
1599
1682
  return e === "localStorage" ? window.localStorage : window.sessionStorage;
@@ -1601,7 +1684,7 @@ function ut(e) {
1601
1684
  return null;
1602
1685
  }
1603
1686
  }
1604
- function mt(e) {
1687
+ function bt(e) {
1605
1688
  try {
1606
1689
  const t = JSON.parse(e);
1607
1690
  return !t || typeof t != "object" || Array.isArray(t) ? null : t;
@@ -1609,74 +1692,74 @@ function mt(e) {
1609
1692
  return null;
1610
1693
  }
1611
1694
  }
1612
- function vo(e, t) {
1613
- const n = mt(e);
1695
+ function wo(e, t) {
1696
+ const n = bt(e);
1614
1697
  if (!n) return "";
1615
1698
  const r = n[t];
1616
1699
  return typeof r == "string" ? r.trim().replace(/^bearer\s+/i, "").trim() : "";
1617
1700
  }
1618
- function So(e = {}) {
1619
- const t = e.storage ?? "sessionStorage", n = e.storageKey ?? ct, r = e.answerAgentCallbackUrlField ?? ho, o = ut(t);
1701
+ function Po(e = {}) {
1702
+ const t = e.storage ?? "sessionStorage", n = e.storageKey ?? vt, r = e.answerAgentCallbackUrlField ?? Eo, o = St(t);
1620
1703
  if (!o) return "";
1621
1704
  const i = o.getItem(n);
1622
1705
  if (!i) return "";
1623
- const a = mt(i);
1624
- if (!a) return "";
1625
- const s = a[r];
1626
- return (typeof s == "string" ? s.trim() : "") || yo;
1706
+ const s = bt(i);
1707
+ if (!s) return "";
1708
+ const a = s[r];
1709
+ return (typeof a == "string" ? a.trim() : "") || Ro;
1627
1710
  }
1628
- function bo(e = {}) {
1629
- const t = e.storage ?? "sessionStorage", n = e.storageKey ?? ct, r = e.realtimeWsUrlField ?? go, o = ut(t);
1711
+ function zo(e = {}) {
1712
+ const t = e.storage ?? "sessionStorage", n = e.storageKey ?? vt, r = e.realtimeWsUrlField ?? Uo, o = St(t);
1630
1713
  if (!o) return "";
1631
1714
  const i = o.getItem(n);
1632
1715
  if (!i) return "";
1633
- const a = mt(i);
1634
- if (!a) return "";
1635
- const s = a[r];
1636
- return typeof s == "string" ? s.trim() : "";
1716
+ const s = bt(i);
1717
+ if (!s) return "";
1718
+ const a = s[r];
1719
+ return typeof a == "string" ? a.trim() : "";
1637
1720
  }
1638
- function dt(e, t) {
1721
+ function kt(e, t) {
1639
1722
  return {
1640
- ...Zt(t),
1723
+ ...gn(t),
1641
1724
  ...e ?? {}
1642
1725
  };
1643
1726
  }
1644
- function Zt(e = {}) {
1645
- const t = e.storage ?? "sessionStorage", n = e.storageKey ?? ct, r = e.tokenField ?? fo, o = ut(t);
1727
+ function gn(e = {}) {
1728
+ const t = e.storage ?? "sessionStorage", n = e.storageKey ?? vt, r = e.tokenField ?? No, o = St(t);
1646
1729
  if (!o) return {};
1647
1730
  const i = o.getItem(n);
1648
1731
  if (!i) return {};
1649
- const a = vo(i, r);
1650
- return a ? { Authorization: `Bearer ${a}` } : {};
1732
+ const s = wo(i, r);
1733
+ return s ? { Authorization: `Bearer ${s}` } : {};
1651
1734
  }
1652
- async function pt(e = {}) {
1653
- return e.getHeaders ? await e.getHeaders() ?? {} : Zt(e.authStorage);
1735
+ async function Ct(e = {}) {
1736
+ return e.getHeaders ? await e.getHeaders() ?? {} : gn(e.authStorage);
1654
1737
  }
1655
- function ko(e = {}) {
1738
+ function Oo(e = {}) {
1656
1739
  const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.detailPath ?? "/dev/form/detail", r = e.fetch ?? fetch;
1657
1740
  async function o(i) {
1658
- const a = new URLSearchParams();
1741
+ const s = new URLSearchParams();
1659
1742
  if (i.formId !== void 0)
1660
- a.set("form_id", String(i.formId));
1743
+ s.set("form_id", String(i.formId));
1661
1744
  else if (i.formUniqueId)
1662
- a.set("form_unique_id", i.formUniqueId);
1745
+ s.set("form_unique_id", i.formUniqueId);
1663
1746
  else
1664
1747
  throw new Error("form_id 或 form_unique_id 至少传一个");
1665
- const s = await pt(e), l = await r(`${t}${n}?${a.toString()}`, {
1748
+ const a = await Ct(e), l = await r(`${t}${n}?${s.toString()}`, {
1666
1749
  method: "GET",
1667
- headers: s
1668
- }), u = await lt(l), m = to(u.form_definition);
1750
+ headers: a
1751
+ }), c = await yt(l), m = vo(c.form_definition);
1669
1752
  return {
1670
- formUniqueId: u.form_unique_id,
1671
- formId: u.form_id,
1672
- disabled: u.disabled === 1,
1753
+ formUniqueId: c.form_unique_id,
1754
+ formId: c.form_id,
1755
+ disabled: c.disabled === 1,
1673
1756
  formDefinition: m,
1674
- a2ui: Zr(u.form_definition) ?? void 0
1757
+ a2ui: go(c.form_definition) ?? void 0
1675
1758
  };
1676
1759
  }
1677
1760
  return { fetchDetail: o };
1678
1761
  }
1679
- function Ao(e) {
1762
+ function qo(e) {
1680
1763
  if (!e || typeof e != "object" || Array.isArray(e))
1681
1764
  return e ?? null;
1682
1765
  const t = e;
@@ -1686,13 +1769,13 @@ function Ao(e) {
1686
1769
  blocks: t.blocks
1687
1770
  } : e;
1688
1771
  }
1689
- function ft({
1772
+ function At({
1690
1773
  context: e,
1691
1774
  payload: t,
1692
1775
  form: n,
1693
1776
  answer: r
1694
1777
  }) {
1695
- const o = Ee(t) ?? t, i = n ? Ao(n) : o;
1778
+ const o = Be(t) ?? t, i = n ? qo(n) : o;
1696
1779
  return {
1697
1780
  mission_id: e.missionId ?? null,
1698
1781
  tenant_id: e.tenantId ?? null,
@@ -1705,7 +1788,7 @@ function ft({
1705
1788
  answer: r
1706
1789
  };
1707
1790
  }
1708
- function en(e) {
1791
+ function _t(e) {
1709
1792
  const t = e.callback_url;
1710
1793
  if (typeof t != "string" || !t.trim())
1711
1794
  return "callback_url 为空,无法提交";
@@ -1720,34 +1803,34 @@ function en(e) {
1720
1803
  const o = e.mission_id;
1721
1804
  return o == null || o === "" ? "mission_id 缺失,无法提交" : null;
1722
1805
  }
1723
- function Pi(e) {
1724
- return en(
1725
- ft({
1806
+ function ns(e) {
1807
+ return _t(
1808
+ At({
1726
1809
  context: e,
1727
1810
  payload: {},
1728
1811
  answer: {}
1729
1812
  })
1730
1813
  );
1731
1814
  }
1732
- const Nt = "answer_agent_callback_url 未配置,无法提交";
1733
- function Co(e) {
1815
+ const $t = "answer_agent_callback_url 未配置,无法提交";
1816
+ function Bo(e) {
1734
1817
  if ((e == null ? void 0 : e.answerAgentCallbackUrl) != null) {
1735
1818
  const n = e.answerAgentCallbackUrl.trim();
1736
1819
  if (!n)
1737
- throw new Error(Nt);
1820
+ throw new Error($t);
1738
1821
  return n;
1739
1822
  }
1740
- const t = So(e == null ? void 0 : e.authStorage).trim();
1823
+ const t = Po(e == null ? void 0 : e.authStorage).trim();
1741
1824
  if (!t)
1742
- throw new Error(Nt);
1825
+ throw new Error($t);
1743
1826
  return t;
1744
1827
  }
1745
- function tn(e) {
1828
+ function yn(e) {
1746
1829
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
1747
1830
  const n = e.data;
1748
1831
  return !n || typeof n != "object" || Array.isArray(n) ? null : n;
1749
1832
  }
1750
- function _o(e, t) {
1833
+ function Lo(e, t) {
1751
1834
  if (t && typeof t == "object" && t !== null && "message" in t) {
1752
1835
  const n = t.message;
1753
1836
  if (typeof n == "string" && n.trim())
@@ -1755,27 +1838,27 @@ function _o(e, t) {
1755
1838
  }
1756
1839
  return typeof t == "string" && t.trim() ? `提交失败 (${e}): ${t.trim()}` : `提交失败 (${e})`;
1757
1840
  }
1758
- function xo(e) {
1841
+ function Vo(e) {
1759
1842
  return `提交失败:${typeof e.error == "string" && e.error.trim() ? e.error.trim() : `回调 HTTP ${e.callback_status ?? "失败"}`}`;
1760
1843
  }
1761
- function nn(e) {
1762
- const t = tn(e.body);
1763
- return (t == null ? void 0 : t.callback_ok) === !1 ? { type: "error", message: xo(t) } : e.ok ? { type: "success", message: "提交成功" } : {
1844
+ function vn(e) {
1845
+ const t = yn(e.body);
1846
+ return (t == null ? void 0 : t.callback_ok) === !1 ? { type: "error", message: Vo(t) } : e.ok ? { type: "success", message: "提交成功" } : {
1764
1847
  type: "error",
1765
- message: _o(e.status, e.body)
1848
+ message: Lo(e.status, e.body)
1766
1849
  };
1767
1850
  }
1768
- async function rn(e, t) {
1769
- const n = en(e);
1851
+ async function Sn(e, t) {
1852
+ const n = _t(e);
1770
1853
  if (n)
1771
1854
  throw new Error(n);
1772
- const r = Co(t), o = await Xt(r, e, {
1855
+ const r = Bo(t), o = await hn(r, e, {
1773
1856
  ...t,
1774
- headers: dt(t == null ? void 0 : t.headers, t == null ? void 0 : t.authStorage)
1775
- }), i = tn(o.body);
1857
+ headers: kt(t == null ? void 0 : t.headers, t == null ? void 0 : t.authStorage)
1858
+ }), i = yn(o.body);
1776
1859
  return o.ok && (i == null ? void 0 : i.callback_ok) === !1 ? { ok: !1, status: o.status, body: o.body } : o;
1777
1860
  }
1778
- function To(e) {
1861
+ function jo(e) {
1779
1862
  return {
1780
1863
  resumeUniqueId: e.resume_unique_id,
1781
1864
  resumeId: e.resume_id,
@@ -1796,7 +1879,7 @@ function To(e) {
1796
1879
  }))
1797
1880
  };
1798
1881
  }
1799
- function Io(e, t) {
1882
+ function $o(e, t) {
1800
1883
  const n = new URLSearchParams();
1801
1884
  n.set("page", String(t)), n.set("page_size", String(e.pageSize ?? 20));
1802
1885
  for (const r of e.names ?? [])
@@ -1807,27 +1890,27 @@ function Io(e, t) {
1807
1890
  r && n.append("resume_unique_id", r);
1808
1891
  return n;
1809
1892
  }
1810
- function No(e = {}) {
1893
+ function Do(e = {}) {
1811
1894
  const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.searchPath ?? "/univ/resume/search", r = e.fetch ?? fetch;
1812
1895
  return async ({ filter: o, page: i }) => {
1813
- const a = await pt(e), s = Io(o, i), l = await r(`${t}${n}?${s.toString()}`, {
1896
+ const s = await Ct(e), a = $o(o, i), l = await r(`${t}${n}?${a.toString()}`, {
1814
1897
  method: "GET",
1815
- headers: a
1816
- }), u = await lt(l);
1898
+ headers: s
1899
+ }), c = await yt(l);
1817
1900
  return {
1818
- list: (u.list ?? []).map(To),
1819
- total: u.total ?? 0,
1820
- page: u.page ?? i,
1821
- pageSize: u.page_size ?? o.pageSize ?? 20
1901
+ list: (c.list ?? []).map(jo),
1902
+ total: c.total ?? 0,
1903
+ page: c.page ?? i,
1904
+ pageSize: c.page_size ?? o.pageSize ?? 20
1822
1905
  };
1823
1906
  };
1824
1907
  }
1825
- function Mo(e) {
1826
- var r, o, i, a;
1827
- const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!((o = e.agentUniqueId) != null && o.trim() && ((i = e.flowType) != null && i.trim()) && ((a = e.category) != null && a.trim()));
1908
+ function Ho(e) {
1909
+ var r, o, i, s;
1910
+ const t = !!((r = e.flowUniqueIds) != null && r.length), n = !!((o = e.agentUniqueId) != null && o.trim() && ((i = e.flowType) != null && i.trim()) && ((s = e.category) != null && s.trim()));
1828
1911
  return t || n;
1829
1912
  }
1830
- function Fo(e) {
1913
+ function Ko(e) {
1831
1914
  return {
1832
1915
  caseUniqueId: e.case_unique_id,
1833
1916
  caseId: e.case_id,
@@ -1838,33 +1921,33 @@ function Fo(e) {
1838
1921
  description: e.description ?? void 0
1839
1922
  };
1840
1923
  }
1841
- function Uo(e, t, n) {
1842
- var o, i, a;
1924
+ function Go(e, t, n) {
1925
+ var o, i, s;
1843
1926
  const r = new URLSearchParams();
1844
- r.set("page", String(t)), r.set("page_size", String(e.pageSize ?? 20)), r.set("published", String(n)), (o = e.agentUniqueId) != null && o.trim() && r.set("agent_unique_id", e.agentUniqueId.trim()), (i = e.flowType) != null && i.trim() && r.set("flow_type", e.flowType.trim()), (a = e.category) != null && a.trim() && r.set("category_unique_id", e.category.trim());
1845
- for (const s of e.flowUniqueIds ?? [])
1846
- s && r.append("flow_unique_ids", s);
1927
+ r.set("page", String(t)), r.set("page_size", String(e.pageSize ?? 20)), r.set("published", String(n)), (o = e.agentUniqueId) != null && o.trim() && r.set("agent_unique_id", e.agentUniqueId.trim()), (i = e.flowType) != null && i.trim() && r.set("flow_type", e.flowType.trim()), (s = e.category) != null && s.trim() && r.set("category_unique_id", e.category.trim());
1928
+ for (const a of e.flowUniqueIds ?? [])
1929
+ a && r.append("flow_unique_ids", a);
1847
1930
  return r;
1848
1931
  }
1849
- function Eo(e = {}) {
1932
+ function Jo(e = {}) {
1850
1933
  const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.listPath ?? "/univ/case/list", r = e.fetch ?? fetch, o = e.published ?? 1;
1851
- return async ({ filter: i, page: a }) => {
1852
- if (!Mo(i))
1934
+ return async ({ filter: i, page: s }) => {
1935
+ if (!Ho(i))
1853
1936
  return { list: [], total: 0, page: 1, pageSize: i.pageSize ?? 20 };
1854
- const s = await pt(e), l = Uo(i, a, o), u = await r(`${t}${n}?${l.toString()}`, {
1937
+ const a = await Ct(e), l = Go(i, s, o), c = await r(`${t}${n}?${l.toString()}`, {
1855
1938
  method: "GET",
1856
- headers: s
1857
- }), m = await lt(u);
1939
+ headers: a
1940
+ }), m = await yt(c);
1858
1941
  return {
1859
- list: (m.list ?? []).map(Fo),
1942
+ list: (m.list ?? []).map(Ko),
1860
1943
  total: m.total ?? 0,
1861
- page: m.page ?? a,
1944
+ page: m.page ?? s,
1862
1945
  pageSize: m.page_size ?? i.pageSize ?? 20
1863
1946
  };
1864
1947
  };
1865
1948
  }
1866
- function wi(e = {}) {
1867
- var r, o, i, a;
1949
+ function rs(e = {}) {
1950
+ var r, o, i, s;
1868
1951
  const t = {
1869
1952
  baseUrl: e.baseUrl,
1870
1953
  fetch: e.fetch,
@@ -1872,22 +1955,22 @@ function wi(e = {}) {
1872
1955
  authStorage: e.authStorage
1873
1956
  };
1874
1957
  return {
1875
- fetchDetail: ko({
1958
+ fetchDetail: Oo({
1876
1959
  ...t,
1877
1960
  detailPath: (r = e.form) == null ? void 0 : r.detailPath
1878
1961
  }).fetchDetail,
1879
- resumeSearch: No({
1962
+ resumeSearch: Do({
1880
1963
  ...t,
1881
1964
  searchPath: (o = e.resume) == null ? void 0 : o.searchPath
1882
1965
  }),
1883
- caseSearch: Eo({
1966
+ caseSearch: Jo({
1884
1967
  ...t,
1885
1968
  listPath: (i = e.case) == null ? void 0 : i.listPath,
1886
- published: (a = e.case) == null ? void 0 : a.published
1969
+ published: (s = e.case) == null ? void 0 : s.published
1887
1970
  })
1888
1971
  };
1889
1972
  }
1890
- function on(e, t) {
1973
+ function bn(e, t) {
1891
1974
  if (!t.trim()) return !0;
1892
1975
  try {
1893
1976
  return new RegExp(t).test(e);
@@ -1895,86 +1978,86 @@ function on(e, t) {
1895
1978
  return !0;
1896
1979
  }
1897
1980
  }
1898
- function an(e) {
1981
+ function kn(e) {
1899
1982
  return e == null ? !0 : typeof e == "string" ? !e.trim() : !1;
1900
1983
  }
1901
- function Po(e, t) {
1984
+ function Wo(e, t) {
1902
1985
  switch (e.type) {
1903
1986
  case "multiselect":
1904
1987
  case "checkbox":
1905
1988
  case "file":
1906
1989
  case "resume_multiselect":
1907
1990
  case "case_multiselect":
1908
- return G(t).length === 0;
1991
+ return Y(t).length === 0;
1909
1992
  case "toggle":
1910
- return !fe(t);
1993
+ return !Ce(t);
1911
1994
  case "number":
1912
1995
  return t == null || t === "";
1913
1996
  default:
1914
- return an(t);
1997
+ return kn(t);
1915
1998
  }
1916
1999
  }
1917
- function Ge(e, t) {
2000
+ function tt(e, t) {
1918
2001
  return e.required === !0 || t > 0;
1919
2002
  }
1920
- function wo(e, t) {
2003
+ function Yo(e, t) {
1921
2004
  var n, r;
1922
2005
  for (const o of e) {
1923
2006
  const i = (n = o.name) == null ? void 0 : n.trim();
1924
- if (!i || Fe(o.type) || Ce(o.type)) continue;
1925
- const a = t[i], s = ((r = o.label) == null ? void 0 : r.trim()) || i;
1926
- if (o.required && Po(o, a))
1927
- return { fieldName: i, label: s, message: `请填写「${s}」` };
1928
- if (o.type === "email" && !an(a)) {
1929
- const l = String(a).trim();
1930
- if (!on(l, it))
1931
- return { fieldName: i, label: s, message: `「${s}」格式不正确` };
2007
+ if (!i || Oe(o.type) || Ue(o.type)) continue;
2008
+ const s = t[i], a = ((r = o.label) == null ? void 0 : r.trim()) || i;
2009
+ if (o.required && Wo(o, s))
2010
+ return { fieldName: i, label: a, message: `请填写「${a}」` };
2011
+ if (o.type === "email" && !kn(s)) {
2012
+ const l = String(s).trim();
2013
+ if (!bn(l, ft))
2014
+ return { fieldName: i, label: a, message: `「${a}」格式不正确` };
1932
2015
  }
1933
2016
  if (o.type === "file") {
1934
- const l = o.fileMinCount ?? 0, u = G(a).length;
1935
- if (l > 0 && u < l && Ge(o, u))
2017
+ const l = o.fileMinCount ?? 0, c = Y(s).length;
2018
+ if (l > 0 && c < l && tt(o, c))
1936
2019
  return {
1937
2020
  fieldName: i,
1938
- label: s,
1939
- message: `「${s}」至少需要 ${l} 个文件`
2021
+ label: a,
2022
+ message: `「${a}」至少需要 ${l} 个文件`
1940
2023
  };
1941
2024
  }
1942
2025
  if (o.type === "resume_multiselect") {
1943
- const l = o.resumeMinCount, u = G(a).length;
1944
- if (l !== void 0 && u < l && Ge(o, u))
2026
+ const l = o.resumeMinCount, c = Y(s).length;
2027
+ if (l !== void 0 && c < l && tt(o, c))
1945
2028
  return {
1946
2029
  fieldName: i,
1947
- label: s,
1948
- message: `「${s}」至少选择 ${l} 项`
2030
+ label: a,
2031
+ message: `「${a}」至少选择 ${l} 项`
1949
2032
  };
1950
2033
  }
1951
2034
  if (o.type === "case_multiselect") {
1952
- const l = o.caseMinCount, u = G(a).length;
1953
- if (l !== void 0 && u < l && Ge(o, u))
2035
+ const l = o.caseMinCount, c = Y(s).length;
2036
+ if (l !== void 0 && c < l && tt(o, c))
1954
2037
  return {
1955
2038
  fieldName: i,
1956
- label: s,
1957
- message: `「${s}」至少选择 ${l} 项`
2039
+ label: a,
2040
+ message: `「${a}」至少选择 ${l} 项`
1958
2041
  };
1959
2042
  }
1960
2043
  }
1961
2044
  return null;
1962
2045
  }
1963
- const Ro = {
1964
- video: En,
1965
- audio: Un,
1966
- image: Fn,
1967
- file: Ut,
1968
- spreadsheet: Mn,
1969
- document: Ft
2046
+ const Qo = {
2047
+ video: Hn,
2048
+ audio: Dn,
2049
+ image: $n,
2050
+ file: Kt,
2051
+ spreadsheet: jn,
2052
+ document: Ht
1970
2053
  };
1971
- function zo({
2054
+ function Xo({
1972
2055
  type: e,
1973
2056
  size: t = 40,
1974
2057
  className: n
1975
2058
  }) {
1976
- const r = Ro[e] ?? Ut;
1977
- return /* @__PURE__ */ c(
2059
+ const r = Qo[e] ?? Kt;
2060
+ return /* @__PURE__ */ u(
1978
2061
  r,
1979
2062
  {
1980
2063
  className: n ?? "skopon-form-file-placeholder-icon",
@@ -1983,7 +2066,7 @@ function zo({
1983
2066
  }
1984
2067
  );
1985
2068
  }
1986
- const sn = "skopon-form-v0_9", Bo = /* @__PURE__ */ new Set([
2069
+ const Cn = "skopon-form-v0_9", Zo = /* @__PURE__ */ new Set([
1987
2070
  "SkoponMedia",
1988
2071
  "SkoponSelect",
1989
2072
  "Image",
@@ -1995,24 +2078,24 @@ const sn = "skopon-form-v0_9", Bo = /* @__PURE__ */ new Set([
1995
2078
  "FileUpload",
1996
2079
  "TextField",
1997
2080
  "Text",
1998
- ...jr()
1999
- ]), qo = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
2000
- function he(e) {
2001
- const t = [...Ae.components.values()].find((n) => n.name === e);
2081
+ ...oo()
2082
+ ]), ei = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
2083
+ function Ae(e) {
2084
+ const t = [...Ee.components.values()].find((n) => n.name === e);
2002
2085
  if (!t) throw new Error(`Missing basic catalog component: ${e}`);
2003
2086
  return t.schema;
2004
2087
  }
2005
- function M(e) {
2088
+ function E(e) {
2006
2089
  return typeof e == "string" ? e : "";
2007
2090
  }
2008
- function ln(e) {
2091
+ function An(e) {
2009
2092
  return Array.isArray(e) ? e.map((t) => {
2010
2093
  if (!t || typeof t != "object") return null;
2011
2094
  const n = t, r = String(n.value ?? n.label ?? ""), o = String(n.label ?? n.value ?? "");
2012
2095
  return { value: r, label: o };
2013
2096
  }).filter((t) => !!t) : [];
2014
2097
  }
2015
- function Pe({
2098
+ function Le({
2016
2099
  mediaType: e,
2017
2100
  urls: t,
2018
2101
  mediaSize: n,
@@ -2020,18 +2103,18 @@ function Pe({
2020
2103
  help: o,
2021
2104
  placeholder: i
2022
2105
  }) {
2023
- const a = r == null ? void 0 : r.trim(), s = o == null ? void 0 : o.trim(), l = tr(n), u = (i == null ? void 0 : i.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
2024
- return /* @__PURE__ */ N("div", { className: "form-block-preview", children: [
2025
- a ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: a }) : null,
2026
- t.length === 0 ? /* @__PURE__ */ c("div", { className: "form-media-preview form-media-preview--empty", children: u }) : /* @__PURE__ */ c("div", { className: l, children: t.map((m, d) => e === "image" ? /* @__PURE__ */ c(
2106
+ const s = r == null ? void 0 : r.trim(), a = o == null ? void 0 : o.trim(), l = fr(n), c = (i == null ? void 0 : i.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
2107
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", children: [
2108
+ s ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: s }) : null,
2109
+ t.length === 0 ? /* @__PURE__ */ u("div", { className: "form-media-preview form-media-preview--empty", children: c }) : /* @__PURE__ */ u("div", { className: l, children: t.map((m, d) => e === "image" ? /* @__PURE__ */ u(
2027
2110
  "img",
2028
2111
  {
2029
2112
  src: m,
2030
- alt: a || "图片",
2113
+ alt: s || "图片",
2031
2114
  className: "form-media-item"
2032
2115
  },
2033
2116
  `media-${d}`
2034
- ) : e === "video" ? /* @__PURE__ */ c(
2117
+ ) : e === "video" ? /* @__PURE__ */ u(
2035
2118
  "video",
2036
2119
  {
2037
2120
  src: m,
@@ -2039,7 +2122,7 @@ function Pe({
2039
2122
  className: "form-media-item"
2040
2123
  },
2041
2124
  `media-${d}`
2042
- ) : /* @__PURE__ */ c(
2125
+ ) : /* @__PURE__ */ u(
2043
2126
  "audio",
2044
2127
  {
2045
2128
  src: m,
@@ -2048,64 +2131,64 @@ function Pe({
2048
2131
  },
2049
2132
  `media-${d}`
2050
2133
  )) }),
2051
- s ? /* @__PURE__ */ c(X.Text, { type: "secondary", className: "form-block-preview-help", children: s }) : null
2134
+ a ? /* @__PURE__ */ u(te.Text, { type: "secondary", className: "form-block-preview-help", children: a }) : null
2052
2135
  ] });
2053
2136
  }
2054
- function we(e, t) {
2055
- const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : M(e.url).trim() ? [M(e.url).trim()] : [];
2137
+ function Ve(e, t) {
2138
+ const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : E(e.url).trim() ? [E(e.url).trim()] : [];
2056
2139
  return {
2057
2140
  mediaType: t,
2058
2141
  urls: n,
2059
- mediaSize: pe(e.mediaSize),
2060
- label: M(e.label) || M(e.description),
2061
- help: M(e.help),
2062
- placeholder: M(e.placeholder)
2142
+ mediaSize: ke(e.mediaSize),
2143
+ label: E(e.label) || E(e.description),
2144
+ help: E(e.help),
2145
+ placeholder: E(e.placeholder)
2063
2146
  };
2064
2147
  }
2065
- const Oo = {
2148
+ const ti = {
2066
2149
  name: "SkoponMedia",
2067
- schema: f.object({
2068
- mediaType: f.any().optional(),
2069
- urls: f.any().optional(),
2070
- mediaSize: f.any().optional(),
2071
- label: f.any().optional(),
2072
- help: f.any().optional(),
2073
- placeholder: f.any().optional()
2150
+ schema: h.object({
2151
+ mediaType: h.any().optional(),
2152
+ urls: h.any().optional(),
2153
+ mediaSize: h.any().optional(),
2154
+ label: h.any().optional(),
2155
+ help: h.any().optional(),
2156
+ placeholder: h.any().optional()
2074
2157
  }).passthrough()
2075
- }, Vo = J(Oo, ({ context: e }) => {
2076
- const t = e.componentModel.properties, n = M(t.mediaType);
2077
- return /* @__PURE__ */ c(Pe, { ...we(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
2078
- }), Lo = J(
2079
- { name: "Image", schema: he("Image") },
2080
- ({ context: e }) => /* @__PURE__ */ c(Pe, { ...we(e.componentModel.properties, "image") })
2081
- ), jo = J(
2082
- { name: "Video", schema: he("Video") },
2083
- ({ context: e }) => /* @__PURE__ */ c(Pe, { ...we(e.componentModel.properties, "video") })
2084
- ), $o = J(
2085
- { name: "AudioPlayer", schema: he("AudioPlayer") },
2086
- ({ context: e }) => /* @__PURE__ */ c(Pe, { ...we(e.componentModel.properties, "audio") })
2087
- ), Do = {
2158
+ }, ni = Q(ti, ({ context: e }) => {
2159
+ const t = e.componentModel.properties, n = E(t.mediaType);
2160
+ return /* @__PURE__ */ u(Le, { ...Ve(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
2161
+ }), ri = Q(
2162
+ { name: "Image", schema: Ae("Image") },
2163
+ ({ context: e }) => /* @__PURE__ */ u(Le, { ...Ve(e.componentModel.properties, "image") })
2164
+ ), oi = Q(
2165
+ { name: "Video", schema: Ae("Video") },
2166
+ ({ context: e }) => /* @__PURE__ */ u(Le, { ...Ve(e.componentModel.properties, "video") })
2167
+ ), ii = Q(
2168
+ { name: "AudioPlayer", schema: Ae("AudioPlayer") },
2169
+ ({ context: e }) => /* @__PURE__ */ u(Le, { ...Ve(e.componentModel.properties, "audio") })
2170
+ ), si = {
2088
2171
  name: "SkoponSelect",
2089
- schema: f.object({
2090
- label: f.any().optional(),
2091
- mode: f.any().optional(),
2092
- placeholder: f.any().optional(),
2093
- options: f.any().optional(),
2094
- value: f.any().optional()
2172
+ schema: h.object({
2173
+ label: h.any().optional(),
2174
+ mode: h.any().optional(),
2175
+ placeholder: h.any().optional(),
2176
+ options: h.any().optional(),
2177
+ value: h.any().optional()
2095
2178
  }).passthrough()
2096
2179
  };
2097
- function Ho({ context: e }) {
2098
- const { interactive: t } = ee(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = te(e, "value", {
2180
+ function ai({ context: e }) {
2181
+ const { interactive: t } = oe(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = ie(e, "value", {
2099
2182
  component: "SkoponSelect",
2100
2183
  changeAction: "select"
2101
- }), a = e.componentModel.properties, s = M(a.label), l = M(a.placeholder), u = ln(a.options), m = M(a.mode) === "multiple";
2102
- return w(() => {
2103
- const d = Lt(n, m);
2184
+ }), s = e.componentModel.properties, a = E(s.label), l = E(s.placeholder), c = An(s.options), m = E(s.mode) === "multiple";
2185
+ return z(() => {
2186
+ const d = rn(n, m);
2104
2187
  d !== null && o(d);
2105
- }, [m, n, o]), /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": i || void 0, children: [
2106
- s ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: s }) : null,
2107
- /* @__PURE__ */ c(
2108
- Je,
2188
+ }, [m, n, o]), /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": i || void 0, children: [
2189
+ a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
2190
+ /* @__PURE__ */ u(
2191
+ nt,
2109
2192
  {
2110
2193
  mode: m ? "multiple" : void 0,
2111
2194
  disabled: !t,
@@ -2113,29 +2196,29 @@ function Ho({ context: e }) {
2113
2196
  className: "form-block-preview-control",
2114
2197
  style: { width: "100%" },
2115
2198
  placeholder: l || (m ? "请选择多项" : "请选择"),
2116
- options: u,
2117
- value: m ? G(n) : ce(n),
2199
+ options: c,
2200
+ value: m ? Y(n) : he(n),
2118
2201
  onChange: (d) => r(m ? d ?? [] : d ?? "")
2119
2202
  }
2120
2203
  )
2121
2204
  ] });
2122
2205
  }
2123
- const Ko = J(
2124
- Do,
2125
- Ho
2206
+ const li = Q(
2207
+ si,
2208
+ ai
2126
2209
  );
2127
- function Go({ context: e }) {
2128
- const { interactive: t } = ee(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = te(e, "value", {
2210
+ function ci({ context: e }) {
2211
+ const { interactive: t } = oe(), { value: n, setValue: r, setValueSilent: o, fieldName: i } = ie(e, "value", {
2129
2212
  component: "ChoicePicker",
2130
2213
  changeAction: "select"
2131
- }), a = e.componentModel.properties, s = M(a.label), l = M(a.variant) || "mutuallyExclusive", u = M(a.skoponPickerType), m = M(a.placeholder), d = ln(a.options), g = u === "select" || u === "multiselect" || u === "radio" || u === "checkbox" ? u : l === "multipleSelection" ? "checkbox" : "radio", k = g === "multiselect" || g === "checkbox";
2132
- return w(() => {
2133
- const v = Lt(n, k);
2134
- v !== null && o(v);
2135
- }, [k, n, o]), /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": i || void 0, children: [
2136
- s ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: s }) : null,
2137
- g === "select" ? /* @__PURE__ */ c(
2138
- Je,
2214
+ }), s = e.componentModel.properties, a = E(s.label), l = E(s.variant) || "mutuallyExclusive", c = E(s.skoponPickerType), m = E(s.placeholder), d = An(s.options), g = c === "select" || c === "multiselect" || c === "radio" || c === "checkbox" ? c : l === "multipleSelection" ? "checkbox" : "radio", b = g === "multiselect" || g === "checkbox";
2215
+ return z(() => {
2216
+ const y = rn(n, b);
2217
+ y !== null && o(y);
2218
+ }, [b, n, o]), /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": i || void 0, children: [
2219
+ a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
2220
+ g === "select" ? /* @__PURE__ */ u(
2221
+ nt,
2139
2222
  {
2140
2223
  disabled: !t,
2141
2224
  allowClear: !0,
@@ -2143,11 +2226,11 @@ function Go({ context: e }) {
2143
2226
  style: { width: "100%" },
2144
2227
  placeholder: m || "请选择",
2145
2228
  options: d,
2146
- value: ce(n),
2147
- onChange: (v) => r(v ?? "")
2229
+ value: he(n),
2230
+ onChange: (y) => r(y ?? "")
2148
2231
  }
2149
- ) : g === "multiselect" ? /* @__PURE__ */ c(
2150
- Je,
2232
+ ) : g === "multiselect" ? /* @__PURE__ */ u(
2233
+ nt,
2151
2234
  {
2152
2235
  mode: "multiple",
2153
2236
  disabled: !t,
@@ -2156,325 +2239,325 @@ function Go({ context: e }) {
2156
2239
  style: { width: "100%" },
2157
2240
  placeholder: m || "请选择多项",
2158
2241
  options: d,
2159
- value: G(n),
2160
- onChange: (v) => r(v ?? [])
2242
+ value: Y(n),
2243
+ onChange: (y) => r(y ?? [])
2161
2244
  }
2162
- ) : g === "checkbox" ? /* @__PURE__ */ c(
2163
- bn.Group,
2245
+ ) : g === "checkbox" ? /* @__PURE__ */ u(
2246
+ Rn.Group,
2164
2247
  {
2165
2248
  disabled: !t,
2166
2249
  className: "form-block-preview-control",
2167
2250
  options: d,
2168
- value: G(n),
2169
- onChange: (v) => r(v)
2251
+ value: Y(n),
2252
+ onChange: (y) => r(y)
2170
2253
  }
2171
- ) : /* @__PURE__ */ c(
2172
- kn.Group,
2254
+ ) : /* @__PURE__ */ u(
2255
+ wn.Group,
2173
2256
  {
2174
2257
  disabled: !t,
2175
2258
  className: "form-block-preview-control",
2176
2259
  options: d,
2177
- value: ce(n),
2178
- onChange: (v) => r(v.target.value)
2260
+ value: he(n),
2261
+ onChange: (y) => r(y.target.value)
2179
2262
  }
2180
2263
  )
2181
2264
  ] });
2182
2265
  }
2183
- const Jo = J(
2266
+ const ui = Q(
2184
2267
  {
2185
2268
  name: "ChoicePicker",
2186
- schema: f.object({
2187
- label: f.any().optional(),
2188
- variant: f.any().optional(),
2189
- options: f.any().optional(),
2190
- value: f.any().optional(),
2191
- skoponPickerType: f.any().optional(),
2192
- placeholder: f.any().optional()
2269
+ schema: h.object({
2270
+ label: h.any().optional(),
2271
+ variant: h.any().optional(),
2272
+ options: h.any().optional(),
2273
+ value: h.any().optional(),
2274
+ skoponPickerType: h.any().optional(),
2275
+ placeholder: h.any().optional()
2193
2276
  }).passthrough()
2194
2277
  },
2195
- Go
2278
+ ci
2196
2279
  );
2197
- function Wo({ context: e }) {
2198
- const { interactive: t } = ee(), { value: n, setValue: r, fieldName: o } = te(e, "value", {
2280
+ function mi({ context: e }) {
2281
+ const { interactive: t } = oe(), { value: n, setValue: r, fieldName: o } = ie(e, "value", {
2199
2282
  component: "CheckBox",
2200
2283
  changeAction: "change"
2201
- }), i = e.componentModel.properties, a = M(i.label);
2202
- return /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2203
- a ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: a }) : null,
2204
- /* @__PURE__ */ c(
2205
- An,
2284
+ }), i = e.componentModel.properties, s = E(i.label);
2285
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2286
+ s ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: s }) : null,
2287
+ /* @__PURE__ */ u(
2288
+ Pn,
2206
2289
  {
2207
2290
  disabled: !t,
2208
2291
  className: "form-block-preview-control",
2209
- checked: fe(n),
2210
- onChange: (s) => r(s)
2292
+ checked: Ce(n),
2293
+ onChange: (a) => r(a)
2211
2294
  }
2212
2295
  )
2213
2296
  ] });
2214
2297
  }
2215
- const Yo = J(
2216
- { name: "CheckBox", schema: he("CheckBox") },
2217
- Wo
2298
+ const di = Q(
2299
+ { name: "CheckBox", schema: Ae("CheckBox") },
2300
+ mi
2218
2301
  );
2219
- function Qo(e, t, n) {
2220
- const r = ce(e);
2302
+ function pi(e, t, n) {
2303
+ const r = he(e);
2221
2304
  if (!r) return;
2222
2305
  if (!t && n) {
2223
- const i = At(r, "HH:mm", !0);
2306
+ const i = Ot(r, "HH:mm", !0);
2224
2307
  return i.isValid() ? i : void 0;
2225
2308
  }
2226
- const o = At(r);
2309
+ const o = Ot(r);
2227
2310
  return o.isValid() ? o : void 0;
2228
2311
  }
2229
- function Xo({ context: e }) {
2230
- const { interactive: t } = ee(), { value: n, setValue: r, fieldName: o, reportFocus: i } = te(e, "value", {
2312
+ function fi({ context: e }) {
2313
+ const { interactive: t } = oe(), { value: n, setValue: r, fieldName: o, reportFocus: i } = ie(e, "value", {
2231
2314
  component: "DateTimeInput",
2232
2315
  changeAction: "change"
2233
- }), a = e.componentModel.properties, s = M(a.label), l = M(a.placeholder), u = a.enableDate === !0, m = a.enableTime === !0, d = Qo(n, u, m), y = (g) => {
2316
+ }), s = e.componentModel.properties, a = E(s.label), l = E(s.placeholder), c = s.enableDate === !0, m = s.enableTime === !0, d = pi(n, c, m), S = (g) => {
2234
2317
  if (!g) {
2235
2318
  r("");
2236
2319
  return;
2237
2320
  }
2238
- if (!u && m) {
2321
+ if (!c && m) {
2239
2322
  r(g.format("HH:mm"));
2240
2323
  return;
2241
2324
  }
2242
- if (u && m) {
2325
+ if (c && m) {
2243
2326
  r(g.format("YYYY-MM-DDTHH:mm"));
2244
2327
  return;
2245
2328
  }
2246
2329
  r(g.format("YYYY-MM-DD"));
2247
2330
  };
2248
- return /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2249
- s ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: s }) : null,
2250
- !u && m ? /* @__PURE__ */ c(
2251
- Cn,
2331
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2332
+ a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
2333
+ !c && m ? /* @__PURE__ */ u(
2334
+ zn,
2252
2335
  {
2253
2336
  disabled: !t,
2254
2337
  className: "form-block-preview-control",
2255
2338
  style: { width: "100%" },
2256
2339
  placeholder: l || "选择时间",
2257
2340
  value: d,
2258
- onChange: y,
2341
+ onChange: S,
2259
2342
  onFocus: i
2260
2343
  }
2261
- ) : /* @__PURE__ */ c(
2262
- _n,
2344
+ ) : /* @__PURE__ */ u(
2345
+ On,
2263
2346
  {
2264
- showTime: u && m,
2347
+ showTime: c && m,
2265
2348
  disabled: !t,
2266
2349
  className: "form-block-preview-control",
2267
2350
  style: { width: "100%" },
2268
- placeholder: l || (u && m ? "选择日期时间" : "选择日期"),
2351
+ placeholder: l || (c && m ? "选择日期时间" : "选择日期"),
2269
2352
  value: d,
2270
- onChange: y,
2353
+ onChange: S,
2271
2354
  onFocus: i
2272
2355
  }
2273
2356
  )
2274
2357
  ] });
2275
2358
  }
2276
- const Zo = J(
2359
+ const hi = Q(
2277
2360
  {
2278
2361
  name: "DateTimeInput",
2279
- schema: f.object({
2280
- label: f.any().optional(),
2281
- enableDate: f.any().optional(),
2282
- enableTime: f.any().optional(),
2283
- placeholder: f.any().optional(),
2284
- value: f.any().optional(),
2285
- min: f.any().optional(),
2286
- max: f.any().optional()
2362
+ schema: h.object({
2363
+ label: h.any().optional(),
2364
+ enableDate: h.any().optional(),
2365
+ enableTime: h.any().optional(),
2366
+ placeholder: h.any().optional(),
2367
+ value: h.any().optional(),
2368
+ min: h.any().optional(),
2369
+ max: h.any().optional()
2287
2370
  }).passthrough()
2288
2371
  },
2289
- Xo
2290
- ), ei = {
2372
+ fi
2373
+ ), gi = {
2291
2374
  name: "FileUpload",
2292
- schema: f.object({
2293
- label: f.any().optional(),
2294
- accept: f.any().optional(),
2295
- fileAcceptTypes: f.any().optional(),
2296
- filePlaceholderIcon: f.any().optional(),
2297
- minCount: f.any().optional(),
2298
- maxCount: f.any().optional(),
2299
- value: f.any().optional()
2375
+ schema: h.object({
2376
+ label: h.any().optional(),
2377
+ accept: h.any().optional(),
2378
+ fileAcceptTypes: h.any().optional(),
2379
+ filePlaceholderIcon: h.any().optional(),
2380
+ minCount: h.any().optional(),
2381
+ maxCount: h.any().optional(),
2382
+ value: h.any().optional()
2300
2383
  }).passthrough()
2301
2384
  };
2302
- function ti({ context: e }) {
2303
- const { interactive: t } = ee(), { value: n, setValue: r, fieldName: o } = te(e, "value", {
2385
+ function yi({ context: e }) {
2386
+ const { interactive: t } = oe(), { value: n, setValue: r, fieldName: o } = ie(e, "value", {
2304
2387
  component: "FileUpload",
2305
2388
  changeAction: "change"
2306
- }), i = e.componentModel.properties, a = M(i.label), s = M(i.accept), l = Array.isArray(i.fileAcceptTypes) ? i.fileAcceptTypes.map(String) : void 0, u = s ? s.split(",").map((p) => p.trim()).filter(Boolean) : void 0, m = Jn(l, u), d = typeof i.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
2389
+ }), i = e.componentModel.properties, s = E(i.label), a = E(i.accept), l = Array.isArray(i.fileAcceptTypes) ? i.fileAcceptTypes.map(String) : void 0, c = a ? a.split(",").map((p) => p.trim()).filter(Boolean) : void 0, m = ar(l, c), d = typeof i.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
2307
2390
  i.filePlaceholderIcon
2308
- ) ? i.filePlaceholderIcon : "document", y = typeof i.minCount == "number" ? Math.max(0, i.minCount) : 0, g = typeof i.maxCount == "number" ? i.maxCount : 1, k = g > 0, v = G(n), C = k && v.length >= g, h = v.length < y;
2309
- return /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2310
- a ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: a }) : null,
2311
- /* @__PURE__ */ N(
2312
- qe.Dragger,
2391
+ ) ? i.filePlaceholderIcon : "document", S = typeof i.minCount == "number" ? Math.max(0, i.minCount) : 0, g = typeof i.maxCount == "number" ? i.maxCount : 1, b = g > 0, y = Y(n), k = b && y.length >= g, f = y.length < S;
2392
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2393
+ s ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: s }) : null,
2394
+ /* @__PURE__ */ I(
2395
+ Ke.Dragger,
2313
2396
  {
2314
- disabled: !t || C,
2315
- accept: Gn(l, u),
2397
+ disabled: !t || k,
2398
+ accept: sr(l, c),
2316
2399
  className: "form-file-upload-preview",
2317
- showUploadList: t && v.length > 0,
2318
- fileList: t ? v.map((p, S) => ({
2319
- uid: `${S}-${p}`,
2400
+ showUploadList: t && y.length > 0,
2401
+ fileList: t ? y.map((p, v) => ({
2402
+ uid: `${v}-${p}`,
2320
2403
  name: p,
2321
2404
  status: "done"
2322
2405
  })) : [],
2323
2406
  beforeUpload: (p) => {
2324
- if (!t) return qe.LIST_IGNORE;
2325
- const S = G(xt(e));
2326
- if (k && S.length >= g) return qe.LIST_IGNORE;
2327
- const A = k ? [...S, p.name].slice(0, g) : [...S, p.name];
2328
- return r(A), !1;
2407
+ if (!t) return Ke.LIST_IGNORE;
2408
+ const v = Y(Lt(e));
2409
+ if (b && v.length >= g) return Ke.LIST_IGNORE;
2410
+ const x = b ? [...v, p.name].slice(0, g) : [...v, p.name];
2411
+ return r(x), !1;
2329
2412
  },
2330
2413
  onRemove: (p) => {
2331
- const S = G(xt(e)), A = /^(\d+)-/.exec(p.uid ?? ""), x = A ? Number(A[1]) : -1, _ = x >= 0 && x < S.length ? S.filter((z, T) => T !== x) : S.filter((z) => z !== p.name);
2332
- if (_.length < y) return !1;
2333
- r(_);
2414
+ const v = Y(Lt(e)), x = /^(\d+)-/.exec(p.uid ?? ""), M = x ? Number(x[1]) : -1, A = M >= 0 && M < v.length ? v.filter((R, C) => C !== M) : v.filter((R) => R !== p.name);
2415
+ if (A.length < S) return !1;
2416
+ r(A);
2334
2417
  },
2335
2418
  children: [
2336
- /* @__PURE__ */ c("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ c(zo, { type: d, size: 40 }) }),
2337
- /* @__PURE__ */ c("p", { className: "form-file-upload-preview-text", children: "点击或拖拽文件到此处上传" })
2419
+ /* @__PURE__ */ u("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ u(Xo, { type: d, size: 40 }) }),
2420
+ /* @__PURE__ */ u("p", { className: "form-file-upload-preview-text", children: "点击或拖拽文件到此处上传" })
2338
2421
  ]
2339
2422
  }
2340
2423
  ),
2341
- /* @__PURE__ */ N(X.Text, { type: "secondary", className: "form-block-preview-help", children: [
2424
+ /* @__PURE__ */ I(te.Text, { type: "secondary", className: "form-block-preview-help", children: [
2342
2425
  "允许:",
2343
2426
  m ?? "全部类型",
2344
- y > 0 ? `;至少 ${y} 个文件` : "",
2345
- k ? `;最多 ${g} 个文件` : "",
2427
+ S > 0 ? `;至少 ${S} 个文件` : "",
2428
+ b ? `;最多 ${g} 个文件` : "",
2346
2429
  ";当前仅收集文件名(不含文件内容,需宿主另行上传)",
2347
- h && t ? `(当前 ${v.length} 个,未达下限)` : ""
2430
+ f && t ? `(当前 ${y.length} 个,未达下限)` : ""
2348
2431
  ] })
2349
2432
  ] });
2350
2433
  }
2351
- const ni = J(
2352
- ei,
2353
- ti
2434
+ const vi = Q(
2435
+ gi,
2436
+ yi
2354
2437
  );
2355
- function ri({ context: e }) {
2356
- const { interactive: t } = ee(), { value: n, setValue: r, fieldName: o, reportFocus: i } = te(e, "value", {
2438
+ function Si({ context: e }) {
2439
+ const { interactive: t } = oe(), { value: n, setValue: r, fieldName: o, reportFocus: i } = ie(e, "value", {
2357
2440
  component: "TextField",
2358
2441
  changeAction: "change",
2359
2442
  debounceChange: !0
2360
- }), a = e.componentModel.properties, s = M(a.label), l = M(a.placeholder), u = M(a.variant) || "shortText", m = M(a.validationRegexp), d = ce(n) ?? "", y = !t, [g, k] = E(""), v = (p) => {
2443
+ }), s = e.componentModel.properties, a = E(s.label), l = E(s.placeholder), c = E(s.variant) || "shortText", m = E(s.validationRegexp), d = he(n) ?? "", S = !t, [g, b] = U(""), y = (p) => {
2361
2444
  if (!m || !p.trim()) {
2362
- k("");
2445
+ b("");
2363
2446
  return;
2364
2447
  }
2365
- k(on(p, m) ? "" : "格式不正确");
2448
+ b(bn(p, m) ? "" : "格式不正确");
2366
2449
  };
2367
- w(() => {
2368
- v(d);
2450
+ z(() => {
2451
+ y(d);
2369
2452
  }, [m, d]);
2370
- const C = "form-block-preview-control";
2371
- let h;
2372
- if (u === "longText")
2373
- h = /* @__PURE__ */ c(
2374
- Oe.TextArea,
2453
+ const k = "form-block-preview-control";
2454
+ let f;
2455
+ if (c === "longText")
2456
+ f = /* @__PURE__ */ u(
2457
+ Ge.TextArea,
2375
2458
  {
2376
- disabled: y,
2377
- className: C,
2459
+ disabled: S,
2460
+ className: k,
2378
2461
  placeholder: l || "长文本回答...",
2379
2462
  autoSize: { minRows: 2, maxRows: 6 },
2380
2463
  value: d,
2381
2464
  status: g ? "error" : void 0,
2382
2465
  onChange: (p) => {
2383
- const S = p.target.value;
2384
- r(S), v(S);
2466
+ const v = p.target.value;
2467
+ r(v), y(v);
2385
2468
  },
2386
2469
  onFocus: i,
2387
- onBlur: (p) => v(p.target.value)
2470
+ onBlur: (p) => y(p.target.value)
2388
2471
  }
2389
2472
  );
2390
- else if (u === "number") {
2473
+ else if (c === "number") {
2391
2474
  const p = d && Number.isFinite(Number(d)) ? Number(d) : void 0;
2392
- h = /* @__PURE__ */ c(
2393
- xn,
2475
+ f = /* @__PURE__ */ u(
2476
+ qn,
2394
2477
  {
2395
- disabled: y,
2396
- className: C,
2478
+ disabled: S,
2479
+ className: k,
2397
2480
  style: { width: "100%" },
2398
2481
  placeholder: l || "数字",
2399
2482
  value: p,
2400
- onChange: (S) => r(S == null ? "" : String(S)),
2483
+ onChange: (v) => r(v == null ? "" : String(v)),
2401
2484
  onFocus: i
2402
2485
  }
2403
2486
  );
2404
- } else u === "obscured" ? h = /* @__PURE__ */ c(
2405
- Oe.Password,
2487
+ } else c === "obscured" ? f = /* @__PURE__ */ u(
2488
+ Ge.Password,
2406
2489
  {
2407
- disabled: y,
2408
- className: C,
2490
+ disabled: S,
2491
+ className: k,
2409
2492
  placeholder: l,
2410
2493
  value: d,
2411
2494
  onChange: (p) => r(p.target.value),
2412
2495
  onFocus: i
2413
2496
  }
2414
- ) : h = /* @__PURE__ */ c(
2415
- Oe,
2497
+ ) : f = /* @__PURE__ */ u(
2498
+ Ge,
2416
2499
  {
2417
- disabled: y,
2418
- className: C,
2500
+ disabled: S,
2501
+ className: k,
2419
2502
  placeholder: l,
2420
2503
  value: d,
2421
2504
  status: g ? "error" : void 0,
2422
2505
  onChange: (p) => {
2423
- const S = p.target.value;
2424
- r(S), v(S);
2506
+ const v = p.target.value;
2507
+ r(v), y(v);
2425
2508
  },
2426
2509
  onFocus: i,
2427
- onBlur: (p) => v(p.target.value)
2510
+ onBlur: (p) => y(p.target.value)
2428
2511
  }
2429
2512
  );
2430
- return /* @__PURE__ */ N("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2431
- s ? /* @__PURE__ */ c("div", { className: "form-block-preview-label", children: s }) : null,
2432
- h,
2433
- g ? /* @__PURE__ */ c(X.Text, { type: "danger", className: "form-block-preview-help", children: g }) : null
2513
+ return /* @__PURE__ */ I("div", { className: "form-block-preview", "data-skopon-field": o || void 0, children: [
2514
+ a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
2515
+ f,
2516
+ g ? /* @__PURE__ */ u(te.Text, { type: "danger", className: "form-block-preview-help", children: g }) : null
2434
2517
  ] });
2435
2518
  }
2436
- const oi = J(
2519
+ const bi = Q(
2437
2520
  {
2438
2521
  name: "TextField",
2439
- schema: f.object({
2440
- label: f.any().optional(),
2441
- variant: f.any().optional(),
2442
- placeholder: f.any().optional(),
2443
- validationRegexp: f.any().optional(),
2444
- value: f.any().optional()
2522
+ schema: h.object({
2523
+ label: h.any().optional(),
2524
+ variant: h.any().optional(),
2525
+ placeholder: h.any().optional(),
2526
+ validationRegexp: h.any().optional(),
2527
+ value: h.any().optional()
2445
2528
  }).passthrough()
2446
2529
  },
2447
- ri
2530
+ Si
2448
2531
  );
2449
- function ii({ context: e }) {
2450
- const t = e.componentModel.properties, n = M(t.text), r = M(t.variant) || "body";
2451
- return qo.has(r) ? r === "caption" ? /* @__PURE__ */ c(X.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ c("em", { children: n }) }) : /* @__PURE__ */ c(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ c(X.Paragraph, { className: "form-block-preview-paragraph", children: n });
2532
+ function ki({ context: e }) {
2533
+ const t = e.componentModel.properties, n = E(t.text), r = E(t.variant) || "body";
2534
+ return ei.has(r) ? r === "caption" ? /* @__PURE__ */ u(te.Text, { type: "secondary", className: "form-block-preview-paragraph", children: /* @__PURE__ */ u("em", { children: n }) }) : /* @__PURE__ */ u(r, { className: "form-block-preview-heading", children: n }) : /* @__PURE__ */ u(te.Paragraph, { className: "form-block-preview-paragraph", children: n });
2452
2535
  }
2453
- const ai = J(
2454
- { name: "Text", schema: he("Text") },
2455
- ii
2536
+ const Ci = Q(
2537
+ { name: "Text", schema: Ae("Text") },
2538
+ ki
2456
2539
  );
2457
- function cn() {
2540
+ function _n() {
2458
2541
  const t = [
2459
- ...[...Ae.components.values()].filter(
2460
- (r) => !Bo.has(r.name)
2542
+ ...[...Ee.components.values()].filter(
2543
+ (r) => !Zo.has(r.name)
2461
2544
  ),
2462
- Vo,
2463
- Ko,
2464
- Lo,
2465
- jo,
2466
- $o,
2467
- Jo,
2468
- Yo,
2469
- Zo,
2470
2545
  ni,
2546
+ li,
2547
+ ri,
2471
2548
  oi,
2472
- ai,
2473
- ...Lr()
2474
- ], n = [...Ae.functions.values()];
2475
- return new Pn(sn, t, n, Ae.themeSchema);
2549
+ ii,
2550
+ ui,
2551
+ di,
2552
+ hi,
2553
+ vi,
2554
+ bi,
2555
+ Ci,
2556
+ ...ro()
2557
+ ], n = [...Ee.functions.values()];
2558
+ return new Kn(Cn, t, n, Ee.themeSchema);
2476
2559
  }
2477
- const Z = {
2560
+ const re = {
2478
2561
  jade9: "#29a383",
2479
2562
  jade10: "#26997b",
2480
2563
  jade11: "#208368",
@@ -2486,20 +2569,20 @@ const Z = {
2486
2569
  primaryHover: "#26997b",
2487
2570
  primaryActive: "#1d3b31",
2488
2571
  onPrimary: "#ffffff"
2489
- }, si = {
2572
+ }, Ai = {
2490
2573
  cssVar: { key: "vidtempl" },
2491
2574
  token: {
2492
- colorPrimary: Z.primarySolid,
2493
- colorPrimaryHover: Z.primaryHover,
2494
- colorPrimaryActive: Z.primaryActive,
2495
- colorLink: Z.primary,
2496
- colorLinkHover: Z.primaryHover,
2497
- colorSuccess: Z.jade9,
2575
+ colorPrimary: re.primarySolid,
2576
+ colorPrimaryHover: re.primaryHover,
2577
+ colorPrimaryActive: re.primaryActive,
2578
+ colorLink: re.primary,
2579
+ colorLinkHover: re.primaryHover,
2580
+ colorSuccess: re.jade9,
2498
2581
  colorWarning: "#f5a623",
2499
2582
  gold6: "#f5a623",
2500
2583
  gold7: "#e6951a",
2501
2584
  colorError: "#e5484d",
2502
- colorInfo: Z.primary,
2585
+ colorInfo: re.primary,
2503
2586
  colorBgLayout: "#f9f9f9",
2504
2587
  colorBgContainer: "#ffffff",
2505
2588
  colorBgElevated: "#ffffff",
@@ -2559,7 +2642,7 @@ const Z = {
2559
2642
  },
2560
2643
  Tag: {
2561
2644
  defaultBg: "#e6f7ed",
2562
- defaultColor: Z.primary,
2645
+ defaultColor: re.primary,
2563
2646
  fontSizeSM: 13
2564
2647
  },
2565
2648
  Form: {
@@ -2571,85 +2654,85 @@ const Z = {
2571
2654
  }
2572
2655
  }
2573
2656
  };
2574
- function ue({
2657
+ function ge({
2575
2658
  children: e,
2576
2659
  locale: t,
2577
2660
  theme: n
2578
2661
  }) {
2579
- return /* @__PURE__ */ c(Tn, { theme: n ?? si, locale: t, children: e });
2662
+ return /* @__PURE__ */ u(Bn, { theme: n ?? Ai, locale: t, children: e });
2580
2663
  }
2581
- const li = yn(
2664
+ const _i = Nn(
2582
2665
  function({
2583
2666
  doc: t,
2584
2667
  surfaceId: n = "skopon-form",
2585
2668
  emptyHint: r = null,
2586
2669
  interactive: o = !0,
2587
2670
  fieldNames: i = [],
2588
- resumeSearch: a = null,
2589
- caseSearch: s = null,
2671
+ resumeSearch: s = null,
2672
+ caseSearch: a = null,
2590
2673
  wrapProvider: l = !0
2591
- }, u) {
2592
- w(() => {
2593
- Rt(), wt();
2674
+ }, c) {
2675
+ z(() => {
2676
+ Yt(), Wt();
2594
2677
  }, []);
2595
- const m = P(null), d = P(i);
2678
+ const m = T(null), d = T(i);
2596
2679
  d.current = i;
2597
- const y = R(() => {
2598
- if (et(t)) return "";
2680
+ const S = j(() => {
2681
+ if (lt(t)) return "";
2599
2682
  try {
2600
2683
  return JSON.stringify(t);
2601
2684
  } catch {
2602
2685
  return String(t);
2603
2686
  }
2604
- }, [t]), g = R(() => {
2605
- if (!y)
2687
+ }, [t]), g = j(() => {
2688
+ if (!S)
2606
2689
  return { surfaces: [], processor: null };
2607
2690
  try {
2608
- const h = JSON.parse(y), p = new Pt([cn()]), S = Xr(h, {
2691
+ const f = JSON.parse(S), p = new Jt([_n()]), v = ho(f, {
2609
2692
  surfaceId: n,
2610
- catalogId: sn
2693
+ catalogId: Cn
2611
2694
  });
2612
- return p.processMessages(S), {
2695
+ return p.processMessages(v), {
2613
2696
  surfaces: Array.from(p.model.surfacesMap.values()),
2614
2697
  processor: p
2615
2698
  };
2616
- } catch (h) {
2617
- return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", h), { surfaces: [], processor: null };
2699
+ } catch (f) {
2700
+ return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", f), { surfaces: [], processor: null };
2618
2701
  }
2619
- }, [y, n]), { surfaces: k, processor: v } = g;
2620
- if (m.current = v, vn(
2621
- u,
2702
+ }, [S, n]), { surfaces: b, processor: y } = g;
2703
+ if (m.current = y, En(
2704
+ c,
2622
2705
  () => ({
2623
- getValues(h) {
2706
+ getValues(f) {
2624
2707
  const p = m.current;
2625
2708
  if (!p) return {};
2626
- const S = (h ?? d.current).map((A) => A.trim()).filter(Boolean);
2627
- return no(p, n, S);
2709
+ const v = (f ?? d.current).map((x) => x.trim()).filter(Boolean);
2710
+ return So(p, n, v);
2628
2711
  },
2629
- setValues(h) {
2712
+ setValues(f) {
2630
2713
  const p = m.current;
2631
2714
  if (!p) return;
2632
- const S = p.model.surfacesMap.get(n);
2633
- if (S)
2634
- for (const [A, x] of Object.entries(h)) {
2635
- const _ = A.trim();
2636
- _ && S.dataModel.set(`/${_}`, x);
2715
+ const v = p.model.surfacesMap.get(n);
2716
+ if (v)
2717
+ for (const [x, M] of Object.entries(f)) {
2718
+ const A = x.trim();
2719
+ A && v.dataModel.set(`/${A}`, M);
2637
2720
  }
2638
2721
  }
2639
2722
  }),
2640
2723
  [n]
2641
- ), k.length === 0) {
2642
- const h = /* @__PURE__ */ c(Qe, { resumeSearch: a, children: /* @__PURE__ */ c(Ye, { caseSearch: s, children: /* @__PURE__ */ c(We, { interactive: o, children: r }) }) });
2643
- return l ? /* @__PURE__ */ c(ue, { children: h }) : h;
2724
+ ), b.length === 0) {
2725
+ const f = /* @__PURE__ */ u(it, { resumeSearch: s, children: /* @__PURE__ */ u(ot, { caseSearch: a, children: /* @__PURE__ */ u(rt, { interactive: o, children: r }) }) });
2726
+ return l ? /* @__PURE__ */ u(ge, { children: f }) : f;
2644
2727
  }
2645
- const C = /* @__PURE__ */ c(Qe, { resumeSearch: a, children: /* @__PURE__ */ c(Ye, { caseSearch: s, children: /* @__PURE__ */ c(We, { interactive: o, children: /* @__PURE__ */ c("div", { className: "a2ui-surface a2ui-container", children: k.map((h) => /* @__PURE__ */ c(Et, { surface: h }, h.id)) }) }) }) });
2646
- return l ? /* @__PURE__ */ c(ue, { children: C }) : C;
2728
+ const k = /* @__PURE__ */ u(it, { resumeSearch: s, children: /* @__PURE__ */ u(ot, { caseSearch: a, children: /* @__PURE__ */ u(rt, { interactive: o, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: b.map((f) => /* @__PURE__ */ u(Gt, { surface: f }, f.id)) }) }) }) });
2729
+ return l ? /* @__PURE__ */ u(ge, { children: k }) : k;
2647
2730
  }
2648
2731
  );
2649
- function ke() {
2650
- return new Pt([cn()]);
2732
+ function Ne() {
2733
+ return new Jt([_n()]);
2651
2734
  }
2652
- function Ri({
2735
+ function os({
2653
2736
  messages: e,
2654
2737
  surfaceId: t = "skopon-form-stream",
2655
2738
  emptyHint: n = null,
@@ -2657,93 +2740,146 @@ function Ri({
2657
2740
  resumeSearch: o = null,
2658
2741
  caseSearch: i = null
2659
2742
  }) {
2660
- w(() => {
2661
- Rt(), wt();
2743
+ z(() => {
2744
+ Yt(), Wt();
2662
2745
  }, []);
2663
- const a = P(null);
2664
- a.current === null && (a.current = ke());
2665
- const s = P(0), l = P(""), u = P(!0), m = P(t);
2666
- function d(h, p) {
2667
- a.current = h, s.current = p.length, l.current = JSON.stringify(p), u.current && (k(h), C(Array.from(h.model.surfacesMap.values())));
2746
+ const s = T(null);
2747
+ s.current === null && (s.current = Ne());
2748
+ const a = T(0), l = T(""), c = T(!0), m = T(t);
2749
+ function d(f, p) {
2750
+ s.current = f, a.current = p.length, l.current = JSON.stringify(p), c.current && (b(f), k(Array.from(f.model.surfacesMap.values())));
2668
2751
  }
2669
- function y(h, p) {
2752
+ function S(f, p) {
2670
2753
  if (p <= 0) return !1;
2671
- const S = JSON.stringify(h.slice(0, p)), A = l.current;
2672
- if (!A) return !0;
2754
+ const v = JSON.stringify(f.slice(0, p)), x = l.current;
2755
+ if (!x) return !0;
2673
2756
  try {
2674
- const x = JSON.parse(A);
2675
- return JSON.stringify(x.slice(0, p)) !== S;
2757
+ const M = JSON.parse(x);
2758
+ return JSON.stringify(M.slice(0, p)) !== v;
2676
2759
  } catch {
2677
2760
  return !0;
2678
2761
  }
2679
2762
  }
2680
- const [g, k] = E(
2681
- () => a.current
2682
- ), [v, C] = E(
2763
+ const [g, b] = U(
2764
+ () => s.current
2765
+ ), [y, k] = U(
2683
2766
  () => Array.from(
2684
- a.current.model.surfacesMap.values()
2767
+ s.current.model.surfacesMap.values()
2685
2768
  )
2686
2769
  );
2687
- return w(() => (u.current = !0, () => {
2688
- u.current = !1;
2689
- }), []), w(() => {
2690
- a.current = g;
2691
- }, [g]), w(() => {
2692
- const h = () => {
2693
- u.current && C(Array.from(g.model.surfacesMap.values()));
2694
- }, p = g.onSurfaceCreated(h), S = g.onSurfaceDeleted(h);
2770
+ return z(() => (c.current = !0, () => {
2771
+ c.current = !1;
2772
+ }), []), z(() => {
2773
+ s.current = g;
2774
+ }, [g]), z(() => {
2775
+ const f = () => {
2776
+ c.current && k(Array.from(g.model.surfacesMap.values()));
2777
+ }, p = g.onSurfaceCreated(f), v = g.onSurfaceDeleted(f);
2695
2778
  return () => {
2696
- p.unsubscribe(), S.unsubscribe();
2779
+ p.unsubscribe(), v.unsubscribe();
2697
2780
  };
2698
- }, [g]), w(() => {
2699
- let h = !1;
2781
+ }, [g]), z(() => {
2782
+ let f = !1;
2700
2783
  const p = m.current !== t;
2701
2784
  if (m.current = t, p) {
2702
- const _ = ke();
2703
- return Array.isArray(e) && e.length > 0 ? (_.processMessages(e), h || d(_, e)) : (a.current = _, s.current = 0, l.current = "", h || (k(_), C([]))), () => {
2704
- h = !0;
2785
+ const A = Ne();
2786
+ return Array.isArray(e) && e.length > 0 ? (A.processMessages(e), f || d(A, e)) : (s.current = A, a.current = 0, l.current = "", f || (b(A), k([]))), () => {
2787
+ f = !0;
2705
2788
  };
2706
2789
  }
2707
2790
  if (!Array.isArray(e) || e.length === 0) {
2708
- if (s.current > 0) {
2709
- const _ = ke();
2710
- a.current = _, s.current = 0, l.current = "", h || (k(_), C([]));
2791
+ if (a.current > 0) {
2792
+ const A = Ne();
2793
+ s.current = A, a.current = 0, l.current = "", f || (b(A), k([]));
2711
2794
  }
2712
2795
  return () => {
2713
- h = !0;
2796
+ f = !0;
2714
2797
  };
2715
2798
  }
2716
- const S = a.current, A = s.current;
2717
- if (e.length < A || y(e, A)) {
2718
- const _ = ke();
2719
- return _.processMessages(e), h || d(_, e), () => {
2720
- h = !0;
2799
+ const v = s.current, x = a.current;
2800
+ if (e.length < x || S(e, x)) {
2801
+ const A = Ne();
2802
+ return A.processMessages(e), f || d(A, e), () => {
2803
+ f = !0;
2721
2804
  };
2722
2805
  }
2723
- const x = e.slice(A);
2724
- return x.length === 0 ? () => {
2725
- h = !0;
2726
- } : (S.processMessages(x), s.current = e.length, l.current = JSON.stringify(e), h || C(Array.from(S.model.surfacesMap.values())), () => {
2727
- h = !0;
2806
+ const M = e.slice(x);
2807
+ return M.length === 0 ? () => {
2808
+ f = !0;
2809
+ } : (v.processMessages(M), a.current = e.length, l.current = JSON.stringify(e), f || k(Array.from(v.model.surfacesMap.values())), () => {
2810
+ f = !0;
2728
2811
  });
2729
- }, [e, t]), v.length === 0 ? /* @__PURE__ */ c(ue, { children: n }) : /* @__PURE__ */ c(ue, { children: /* @__PURE__ */ c(Qe, { resumeSearch: o, children: /* @__PURE__ */ c(Ye, { caseSearch: i, children: /* @__PURE__ */ c(We, { interactive: r, children: /* @__PURE__ */ c("div", { className: "a2ui-surface a2ui-container", children: v.map((h) => /* @__PURE__ */ c(Et, { surface: h }, h.id)) }) }) }) }) });
2812
+ }, [e, t]), y.length === 0 ? /* @__PURE__ */ u(ge, { children: n }) : /* @__PURE__ */ u(ge, { children: /* @__PURE__ */ u(it, { resumeSearch: o, children: /* @__PURE__ */ u(ot, { caseSearch: i, children: /* @__PURE__ */ u(rt, { interactive: r, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: y.map((f) => /* @__PURE__ */ u(Gt, { surface: f }, f.id)) }) }) }) }) });
2730
2813
  }
2731
- const ci = 100, ui = 3e4;
2732
- class mi {
2814
+ const Ti = 100, xi = 3e4, Ii = 1500, ue = /* @__PURE__ */ new Map();
2815
+ function Mi(e) {
2816
+ const t = e.trim();
2817
+ let n = ue.get(t);
2818
+ return n || (n = new Fi(t), ue.set(t, n)), n.acquire(), n;
2819
+ }
2820
+ class Fi {
2733
2821
  constructor(t) {
2734
- Q(this, "url");
2735
- Q(this, "askUserMessageId");
2736
- Q(this, "onAutoControl");
2737
- Q(this, "ws", null);
2738
- Q(this, "closed", !1);
2739
- Q(this, "reconnectAttempt", 0);
2740
- Q(this, "reconnectTimer", null);
2741
- Q(this, "sendQueue", []);
2742
- this.url = t.url, this.askUserMessageId = t.askUserMessageId, this.onAutoControl = t.onAutoControl;
2822
+ G(this, "url");
2823
+ G(this, "ws", null);
2824
+ G(this, "refCount", 0);
2825
+ G(this, "connectRequested", !1);
2826
+ G(this, "reconnectAttempt", 0);
2827
+ G(this, "reconnectTimer", null);
2828
+ G(this, "releaseTimer", null);
2829
+ G(this, "sendQueue", []);
2830
+ G(this, "handlers", /* @__PURE__ */ new Map());
2831
+ this.url = t;
2832
+ }
2833
+ acquire() {
2834
+ this.refCount += 1, this.clearReleaseTimer();
2835
+ }
2836
+ release() {
2837
+ this.refCount = Math.max(0, this.refCount - 1), !(this.refCount > 0) && (this.clearReleaseTimer(), this.releaseTimer = setTimeout(() => {
2838
+ this.releaseTimer = null, !(this.refCount > 0) && (this.teardown(), ue.get(this.url) === this && ue.delete(this.url));
2839
+ }, Ii));
2840
+ }
2841
+ /** 强制关闭(测试用),跳过宽限期。 */
2842
+ forceClose() {
2843
+ this.refCount = 0, this.teardown(), ue.get(this.url) === this && ue.delete(this.url);
2844
+ }
2845
+ subscribe(t, n) {
2846
+ const r = t.trim();
2847
+ if (!r) return () => {
2848
+ };
2849
+ let o = this.handlers.get(r);
2850
+ return o || (o = /* @__PURE__ */ new Set(), this.handlers.set(r, o)), o.add(n), () => {
2851
+ const i = this.handlers.get(r);
2852
+ i && (i.delete(n), i.size === 0 && this.handlers.delete(r));
2853
+ };
2743
2854
  }
2855
+ /** 懒建连:首个会话 connect() 时才真正打开 socket。 */
2744
2856
  connect() {
2745
- if (!(this.closed || typeof WebSocket > "u")) {
2746
- this.clearReconnectTimer();
2857
+ typeof WebSocket > "u" || (this.connectRequested = !0, !(this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) && this.openSocket());
2858
+ }
2859
+ send(t, n, r) {
2860
+ var s;
2861
+ if (this.refCount <= 0 && !this.connectRequested) return;
2862
+ const o = {
2863
+ type: n,
2864
+ ask_user_message_id: t,
2865
+ data: r
2866
+ };
2867
+ let i;
2868
+ try {
2869
+ i = JSON.stringify(o);
2870
+ } catch (a) {
2871
+ console.warn("[FormRuntimeConnection] serialize failed", a);
2872
+ return;
2873
+ }
2874
+ if (((s = this.ws) == null ? void 0 : s.readyState) === WebSocket.OPEN) {
2875
+ this.ws.send(i);
2876
+ return;
2877
+ }
2878
+ this.enqueue(i);
2879
+ }
2880
+ openSocket() {
2881
+ if (!(!this.connectRequested || this.refCount <= 0)) {
2882
+ this.clearReconnectTimer(), this.disposeSocket();
2747
2883
  try {
2748
2884
  const t = new WebSocket(this.url);
2749
2885
  this.ws = t, t.onopen = () => {
@@ -2751,37 +2887,19 @@ class mi {
2751
2887
  }, t.onmessage = (n) => {
2752
2888
  this.handleMessage(n.data);
2753
2889
  }, t.onclose = () => {
2754
- this.ws = null, this.scheduleReconnect();
2890
+ this.ws === t && (this.ws = null), this.scheduleReconnect();
2755
2891
  }, t.onerror = () => {
2756
2892
  };
2757
2893
  } catch (t) {
2758
- console.warn("[FormRuntimeWs] connect failed", t), this.scheduleReconnect();
2894
+ console.warn("[FormRuntimeConnection] connect failed", t), this.scheduleReconnect();
2759
2895
  }
2760
2896
  }
2761
2897
  }
2762
- send(t, n) {
2763
- var i;
2764
- if (this.closed) return;
2765
- const r = {
2766
- type: t,
2767
- ask_user_message_id: this.askUserMessageId,
2768
- data: n
2769
- };
2770
- let o;
2771
- try {
2772
- o = JSON.stringify(r);
2773
- } catch (a) {
2774
- console.warn("[FormRuntimeWs] serialize failed", a);
2775
- return;
2776
- }
2777
- if (((i = this.ws) == null ? void 0 : i.readyState) === WebSocket.OPEN) {
2778
- this.ws.send(o);
2779
- return;
2780
- }
2781
- this.enqueue(o);
2898
+ teardown() {
2899
+ this.connectRequested = !1, this.clearReconnectTimer(), this.clearReleaseTimer(), this.sendQueue = [], this.handlers.clear(), this.disposeSocket();
2782
2900
  }
2783
- close() {
2784
- if (this.closed = !0, this.clearReconnectTimer(), this.sendQueue = [], this.ws) {
2901
+ disposeSocket() {
2902
+ if (this.ws) {
2785
2903
  this.ws.onopen = null, this.ws.onmessage = null, this.ws.onclose = null, this.ws.onerror = null;
2786
2904
  try {
2787
2905
  this.ws.close();
@@ -2791,7 +2909,7 @@ class mi {
2791
2909
  }
2792
2910
  }
2793
2911
  enqueue(t) {
2794
- for (this.sendQueue.push(t); this.sendQueue.length > ci; )
2912
+ for (this.sendQueue.push(t); this.sendQueue.length > Ti; )
2795
2913
  this.sendQueue.shift();
2796
2914
  }
2797
2915
  flushQueue() {
@@ -2802,21 +2920,23 @@ class mi {
2802
2920
  this.ws.send(n);
2803
2921
  }
2804
2922
  scheduleReconnect() {
2805
- if (this.closed) return;
2923
+ if (!this.connectRequested || this.refCount <= 0) return;
2806
2924
  this.clearReconnectTimer();
2807
2925
  const t = Math.min(
2808
- ui,
2926
+ xi,
2809
2927
  1e3 * 2 ** Math.min(this.reconnectAttempt, 5)
2810
2928
  );
2811
2929
  this.reconnectAttempt += 1, this.reconnectTimer = setTimeout(() => {
2812
- this.reconnectTimer = null, this.connect();
2930
+ this.reconnectTimer = null, this.openSocket();
2813
2931
  }, t);
2814
2932
  }
2815
2933
  clearReconnectTimer() {
2816
2934
  this.reconnectTimer != null && (clearTimeout(this.reconnectTimer), this.reconnectTimer = null);
2817
2935
  }
2936
+ clearReleaseTimer() {
2937
+ this.releaseTimer != null && (clearTimeout(this.releaseTimer), this.releaseTimer = null);
2938
+ }
2818
2939
  handleMessage(t) {
2819
- var i;
2820
2940
  if (typeof t != "string") return;
2821
2941
  let n;
2822
2942
  try {
@@ -2826,36 +2946,67 @@ class mi {
2826
2946
  }
2827
2947
  if (!n || typeof n != "object" || Array.isArray(n)) return;
2828
2948
  const r = n;
2829
- if (r.type !== "form_auto_control_event" || String(r.ask_user_message_id ?? "") !== this.askUserMessageId) return;
2830
- const o = r.data;
2831
- !o || typeof o != "object" || Array.isArray(o) || (i = this.onAutoControl) == null || i.call(this, o, r);
2949
+ if (r.type !== "form_auto_control_event") return;
2950
+ const o = String(r.ask_user_message_id ?? "").trim();
2951
+ if (!o) return;
2952
+ const i = r.data;
2953
+ if (!i || typeof i != "object" || Array.isArray(i)) return;
2954
+ const s = this.handlers.get(o);
2955
+ if (!(!s || s.size === 0))
2956
+ for (const a of [...s])
2957
+ try {
2958
+ a(i, r);
2959
+ } catch (l) {
2960
+ console.warn("[FormRuntimeConnection] handler error", l);
2961
+ }
2832
2962
  }
2833
2963
  }
2834
- function un(e) {
2964
+ class Ni {
2965
+ constructor(t) {
2966
+ G(this, "askUserMessageId");
2967
+ G(this, "connection");
2968
+ G(this, "unsubscribe");
2969
+ G(this, "closed", !1);
2970
+ this.askUserMessageId = t.askUserMessageId.trim(), this.connection = Mi(t.url);
2971
+ const n = t.onAutoControl;
2972
+ this.unsubscribe = n ? this.connection.subscribe(this.askUserMessageId, n) : () => {
2973
+ };
2974
+ }
2975
+ connect() {
2976
+ this.closed || this.connection.connect();
2977
+ }
2978
+ send(t, n) {
2979
+ this.closed || this.connection.send(this.askUserMessageId, t, n);
2980
+ }
2981
+ close() {
2982
+ this.closed || (this.closed = !0, this.unsubscribe(), this.connection.release());
2983
+ }
2984
+ }
2985
+ function Tn(e) {
2835
2986
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
2836
2987
  }
2837
- function di(e, t) {
2988
+ function Ei(e, t) {
2838
2989
  if (!e) return !1;
2839
- const n = e.querySelector(`[data-skopon-field="${un(t)}"]`);
2990
+ const n = e.querySelector(`[data-skopon-field="${Tn(t)}"]`);
2840
2991
  return n instanceof HTMLElement ? ((n.querySelector(
2841
2992
  'input, textarea, select, button, [tabindex]:not([tabindex="-1"])'
2842
2993
  ) ?? n).focus(), !0) : !1;
2843
2994
  }
2844
- function pi(e, t) {
2995
+ function Ui(e, t) {
2845
2996
  if (!e) return !1;
2846
- const n = e.querySelector(`[data-skopon-field="${un(t)}"]`);
2997
+ const n = e.querySelector(`[data-skopon-field="${Tn(t)}"]`);
2847
2998
  return n instanceof HTMLElement ? ((n.querySelector(
2848
2999
  'button, [role="button"], .skopon-resume-select-card, input, label'
2849
3000
  ) ?? n).click(), !0) : !1;
2850
3001
  }
2851
- function fi(e, t, n) {
3002
+ function Ri(e, t, n) {
2852
3003
  const r = e.action;
2853
3004
  if (r !== "change" && r !== "select" && r !== "focus" && r !== "click" && r !== "submit") {
2854
3005
  console.warn("[FormAutoControl] unknown action", r);
2855
3006
  return;
2856
3007
  }
2857
3008
  n.runAutoControl(() => {
2858
- var a;
3009
+ var s;
2859
3010
  if (r === "submit")
2860
3011
  return t.submit();
2861
3012
  const o = typeof e.field == "string" ? e.field.trim() : "";
@@ -2863,7 +3014,7 @@ function fi(e, t, n) {
2863
3014
  console.warn("[FormAutoControl] missing field for action", r);
2864
3015
  return;
2865
3016
  }
2866
- const i = ((a = e.component) == null ? void 0 : a.trim()) || "Unknown";
3017
+ const i = ((s = e.component) == null ? void 0 : s.trim()) || "Unknown";
2867
3018
  if (r === "change" || r === "select") {
2868
3019
  if (e.value === void 0) {
2869
3020
  console.warn("[FormAutoControl] missing value for action", r);
@@ -2878,93 +3029,120 @@ function fi(e, t, n) {
2878
3029
  return;
2879
3030
  }
2880
3031
  if (r === "focus") {
2881
- di(t.rootElement, o), n.reportEvent({
3032
+ Ei(t.rootElement, o), n.reportEvent({
2882
3033
  action: "focus",
2883
3034
  component: i,
2884
3035
  field: o
2885
3036
  });
2886
3037
  return;
2887
3038
  }
2888
- pi(t.rootElement, o) || console.warn("[FormAutoControl] click target not found", o);
3039
+ Ui(t.rootElement, o) || console.warn("[FormAutoControl] click target not found", o);
2889
3040
  });
2890
3041
  }
2891
- function hi(e) {
2892
- const t = Ee(e);
2893
- return t ? at(t.blocks) : e && typeof e == "object" && !Array.isArray(e) ? e : {};
3042
+ function wi(e) {
3043
+ const t = {};
3044
+ for (const [n, r] of Object.entries(e))
3045
+ r !== void 0 && (t[n] = r);
3046
+ return t;
3047
+ }
3048
+ function Pi(e, t) {
3049
+ var o;
3050
+ const n = (o = e.name) == null ? void 0 : o.trim();
3051
+ if (!n || !t) return { ...e };
3052
+ const r = t.get(n);
3053
+ return r ? e.type !== "resume_multiselect" && e.type !== "case_multiselect" ? { ...e } : { ...e, options: r.map((i) => ({ ...i })) } : { ...e };
2894
3054
  }
2895
- function gi({
3055
+ function zi(e) {
3056
+ var i, s;
3057
+ const n = {
3058
+ blocks: (e.blocks ?? []).map(
3059
+ (a) => Pi(a, e.liveOptions)
3060
+ )
3061
+ }, r = (i = e.title) == null ? void 0 : i.trim(), o = (s = e.description) == null ? void 0 : s.trim();
3062
+ return r && (n.title = r), o && (n.description = o), {
3063
+ form_schema: n,
3064
+ form_values: wi(e.values ?? {}),
3065
+ form_change: [...e.formChange ?? []]
3066
+ };
3067
+ }
3068
+ function Oi(e) {
3069
+ const t = Be(e);
3070
+ return t ? ht(t.blocks) : e && typeof e == "object" && !Array.isArray(e) ? e : {};
3071
+ }
3072
+ function qi({
2896
3073
  payload: e,
2897
3074
  callbackUrl: t,
2898
3075
  title: n,
2899
3076
  unpublishedFormId: r,
2900
3077
  incompleteFormId: o,
2901
3078
  answerAgentContext: i,
2902
- submitHeaders: a,
2903
- onNotify: s
3079
+ submitHeaders: s,
3080
+ onNotify: a
2904
3081
  }) {
2905
- const [l, u] = E(!1), m = P(!0);
2906
- w(() => (m.current = !0, () => {
3082
+ const [l, c] = U(!1), m = T(!0);
3083
+ z(() => (m.current = !0, () => {
2907
3084
  m.current = !1;
2908
3085
  }), []);
2909
- const d = R(
2910
- () => dt(a),
2911
- [a]
2912
- ), y = R(
2913
- () => Qt(e, t, d),
3086
+ const d = j(
3087
+ () => kt(s),
3088
+ [s]
3089
+ ), S = j(
3090
+ () => fn(e, t, d),
2914
3091
  [e, t, d]
2915
- ), g = R(
3092
+ ), g = j(
2916
3093
  () => ({
2917
3094
  ...i,
2918
3095
  callbackUrl: (i == null ? void 0 : i.callbackUrl) ?? t ?? null
2919
3096
  }),
2920
3097
  [i, t]
2921
3098
  );
2922
- async function k() {
3099
+ async function b() {
2923
3100
  if (!l) {
2924
- u(!0);
3101
+ c(!0);
2925
3102
  try {
2926
- const v = hi(e), C = ft({
3103
+ const y = Oi(e), k = At({
2927
3104
  context: g,
2928
3105
  payload: e,
2929
- answer: v
2930
- }), h = await rn(C, {
3106
+ answer: y
3107
+ }), f = await Sn(k, {
2931
3108
  headers: d
2932
3109
  });
2933
3110
  if (!m.current) return;
2934
- const p = nn(h);
2935
- s == null || s(p.type, p.message);
2936
- } catch (v) {
3111
+ const p = vn(f);
3112
+ a == null || a(p.type, p.message);
3113
+ } catch (y) {
2937
3114
  if (!m.current) return;
2938
- const C = v instanceof Error ? v.message : "提交失败";
2939
- s == null || s("error", C);
3115
+ const k = y instanceof Error ? y.message : "提交失败";
3116
+ a == null || a("error", k);
2940
3117
  } finally {
2941
- m.current && u(!1);
3118
+ m.current && c(!1);
2942
3119
  }
2943
3120
  }
2944
3121
  }
2945
- return /* @__PURE__ */ N("div", { className: "ask-user-curl-card", children: [
2946
- /* @__PURE__ */ N("div", { className: "ask-user-curl-card-header", children: [
2947
- /* @__PURE__ */ N("div", { className: "ask-user-curl-card-header-title", children: [
2948
- /* @__PURE__ */ c(X.Text, { type: "secondary", children: n ?? "curl 命令" }),
2949
- r ? /* @__PURE__ */ c(se, { title: r, children: /* @__PURE__ */ c(le, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
2950
- o ? /* @__PURE__ */ c(se, { title: o, children: /* @__PURE__ */ c(le, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
3122
+ return /* @__PURE__ */ I("div", { className: "ask-user-curl-card", children: [
3123
+ /* @__PURE__ */ I("div", { className: "ask-user-curl-card-header", children: [
3124
+ /* @__PURE__ */ I("div", { className: "ask-user-curl-card-header-title", children: [
3125
+ /* @__PURE__ */ u(te.Text, { type: "secondary", children: n ?? "curl 命令" }),
3126
+ r ? /* @__PURE__ */ u(pe, { title: r, children: /* @__PURE__ */ u(fe, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
3127
+ o ? /* @__PURE__ */ u(pe, { title: o, children: /* @__PURE__ */ u(fe, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
2951
3128
  ] }),
2952
- /* @__PURE__ */ c(se, { title: "提交到 answer_agent_callback_url", children: /* @__PURE__ */ c(
2953
- Me,
3129
+ /* @__PURE__ */ u(pe, { title: "提交到 answer_agent_callback_url", children: /* @__PURE__ */ u(
3130
+ ze,
2954
3131
  {
2955
3132
  size: "small",
2956
3133
  type: "text",
2957
3134
  loading: l,
2958
3135
  disabled: l,
2959
- onClick: () => void k(),
3136
+ onClick: () => void b(),
2960
3137
  children: "提交"
2961
3138
  }
2962
3139
  ) })
2963
3140
  ] }),
2964
- /* @__PURE__ */ c("pre", { className: "skopon-form-curl-json", children: y })
3141
+ /* @__PURE__ */ u("pre", { className: "skopon-form-curl-json", children: S })
2965
3142
  ] });
2966
3143
  }
2967
- function yi(e, t) {
3144
+ const Bi = 80;
3145
+ function Li(e, t) {
2968
3146
  if (t && typeof t == "object" && t !== null && "message" in t) {
2969
3147
  const n = t.message;
2970
3148
  if (typeof n == "string" && n.trim())
@@ -2972,200 +3150,266 @@ function yi(e, t) {
2972
3150
  }
2973
3151
  return typeof t == "string" && t.trim() ? `提交失败 (${e}): ${t.trim()}` : `提交失败 (${e})`;
2974
3152
  }
2975
- function vi({
3153
+ function Vi({
2976
3154
  payload: e,
2977
3155
  formUniqueId: t,
2978
3156
  askUserMessageId: n,
2979
3157
  callbackUrl: r,
2980
3158
  submitMode: o = "curl",
2981
3159
  answerAgentContext: i,
2982
- submitHeaders: a,
2983
- fetchFormDetail: s,
3160
+ submitHeaders: s,
3161
+ fetchFormDetail: a,
2984
3162
  onNotify: l,
2985
- resumeSearch: u = null,
3163
+ resumeSearch: c = null,
2986
3164
  caseSearch: m = null,
2987
3165
  onSurfaceReadyChange: d,
2988
- onAutoControlReady: y
3166
+ onAutoControlReady: S
2989
3167
  }) {
2990
- const [g, k] = E(null), [v, C] = E(!1), [h, p] = E(!0), [S, A] = E(!1), x = P(null), _ = P(null), z = P(!0), T = P(l);
2991
- T.current = l;
2992
- const D = Ot(), H = (t == null ? void 0 : t.trim()) ?? "", oe = (n == null ? void 0 : n.trim()) ?? "", K = R(
2993
- () => dt(a),
2994
- [a]
2995
- ), j = R(
3168
+ const [g, b] = U(null), [y, k] = U(!1), [f, p] = U(!0), [v, x] = U(!1), M = T(null), A = T(null), R = T(!0), C = T(l);
3169
+ C.current = l;
3170
+ const O = tn(), q = pt(), le = T(""), K = T(null), D = (t == null ? void 0 : t.trim()) ?? "", J = (n == null ? void 0 : n.trim()) ?? "", Z = j(
3171
+ () => kt(s),
3172
+ [s]
3173
+ ), ee = j(
2996
3174
  () => ({
2997
3175
  ...i,
2998
3176
  callbackUrl: (i == null ? void 0 : i.callbackUrl) ?? r ?? null
2999
3177
  }),
3000
3178
  [i, r]
3001
3179
  );
3002
- w(() => (z.current = !0, () => {
3003
- z.current = !1;
3004
- }), []), w(() => {
3005
- let V = !1;
3006
- return H ? (p(!0), C(!1), s({ formUniqueId: H }).then((q) => {
3007
- V || (C(!!q.disabled), k(q.formDefinition ?? null));
3008
- }).catch((q) => {
3009
- var W;
3010
- if (!V) {
3011
- C(!1), k(null);
3012
- const ye = q instanceof Error ? q.message : "获取表单定义失败";
3013
- (W = T.current) == null || W.call(T, "error", ye);
3180
+ z(() => (R.current = !0, () => {
3181
+ R.current = !1, K.current != null && (clearTimeout(K.current), K.current = null);
3182
+ }), []), z(() => {
3183
+ let P = !1;
3184
+ return D ? (p(!0), k(!1), a({ formUniqueId: D }).then((B) => {
3185
+ P || (k(!!B.disabled), b(B.formDefinition ?? null));
3186
+ }).catch((B) => {
3187
+ var X;
3188
+ if (!P) {
3189
+ k(!1), b(null);
3190
+ const xe = B instanceof Error ? B.message : "获取表单定义失败";
3191
+ (X = C.current) == null || X.call(C, "error", xe);
3014
3192
  }
3015
3193
  }).finally(() => {
3016
- V || p(!1);
3194
+ P || p(!1);
3017
3195
  }), () => {
3018
- V = !0;
3019
- }) : (p(!1), C(!1), k(null), () => {
3020
- V = !0;
3196
+ P = !0;
3197
+ }) : (p(!1), k(!1), b(null), () => {
3198
+ P = !0;
3021
3199
  });
3022
- }, [H, s]);
3023
- const I = R(() => Ee(e), [e]), F = R(() => I ? ao(I, g ?? void 0) : null, [I, g]), ie = (F == null ? void 0 : F.matchedBlocks) ?? [], Y = !!(I && lo(I) && ie.length === 0), b = R(() => Y && I ? co(I) : F && F.renderBlocks.length > 0 ? F.renderBlocks : [], [F, Y, I]), B = R(
3024
- () => Y ? {} : at((F == null ? void 0 : F.extraBlocks) ?? []),
3025
- [Y, F]
3026
- ), $ = R(() => Y && I ? uo(I) : b.filter((V) => {
3027
- var q;
3028
- return (q = V.name) == null ? void 0 : q.trim();
3029
- }).map((V) => V.name.trim()), [Y, I, b]), U = R(() => {
3030
- if (b.length === 0) return null;
3031
- const V = (F == null ? void 0 : F.title) ?? (I == null ? void 0 : I.title) ?? "", q = (F == null ? void 0 : F.description) ?? (I == null ? void 0 : I.description) ?? "";
3032
- return eo({ title: V, description: q }, b);
3033
- }, [F, I, b]), mn = H ? `ask-user-${H}` : "ask-user-payload", ge = !!(!h && I && b.length > 0 && U);
3034
- w(() => (d(ge), () => d(!1)), [ge, d]);
3035
- const Re = L(async () => {
3036
- var V, q, W, ye, yt, vt, St;
3037
- if (!S) {
3038
- A(!0);
3200
+ }, [D, a]);
3201
+ const N = j(() => Be(e), [e]), L = j(() => N ? Ao(N, g ?? void 0) : null, [N, g]), _ = (L == null ? void 0 : L.matchedBlocks) ?? [], V = !!(N && To(N) && _.length === 0), w = j(() => V && N ? xo(N) : L && L.renderBlocks.length > 0 ? L.renderBlocks : [], [L, V, N]), F = j(
3202
+ () => V ? {} : ht((L == null ? void 0 : L.extraBlocks) ?? []),
3203
+ [V, L]
3204
+ ), W = j(() => V && N ? Io(N) : w.filter((P) => {
3205
+ var B;
3206
+ return (B = P.name) == null ? void 0 : B.trim();
3207
+ }).map((P) => P.name.trim()), [V, N, w]), _e = (L == null ? void 0 : L.title) ?? (N == null ? void 0 : N.title) ?? "", Te = (L == null ? void 0 : L.description) ?? (N == null ? void 0 : N.description) ?? "", ce = j(() => w.length === 0 ? null : yo(
3208
+ { title: _e, description: Te },
3209
+ w
3210
+ ), [_e, Te, w]), je = j(() => {
3211
+ if (!ce) return "";
3212
+ try {
3213
+ return JSON.stringify(ce);
3214
+ } catch {
3215
+ return String(ce);
3216
+ }
3217
+ }, [ce]), $e = D ? `ask-user-${D}` : "ask-user-payload", ne = !!(!f && N && w.length > 0 && ce);
3218
+ z(() => (d(ne), () => d(!1)), [ne, d]);
3219
+ const Tt = $(() => {
3220
+ var B;
3221
+ return { ...((B = M.current) == null ? void 0 : B.getValues(W)) ?? {}, ...F };
3222
+ }, [W, F]), se = $(
3223
+ (P) => {
3224
+ const B = zi({
3225
+ title: _e,
3226
+ description: Te,
3227
+ blocks: w,
3228
+ values: Tt(),
3229
+ liveOptions: q.liveOptions,
3230
+ formChange: P
3231
+ });
3232
+ O.reportData(B);
3233
+ },
3234
+ [
3235
+ _e,
3236
+ Te,
3237
+ w,
3238
+ Tt,
3239
+ q.liveOptions,
3240
+ O
3241
+ ]
3242
+ );
3243
+ z(() => {
3244
+ if (!ne || !je) return;
3245
+ const P = `${$e}::${je}`;
3246
+ if (le.current === P) return;
3247
+ le.current = P;
3248
+ const B = setTimeout(() => {
3249
+ R.current && se([]);
3250
+ }, 0);
3251
+ return () => clearTimeout(B);
3252
+ }, [ne, $e, je, se]), z(() => {
3253
+ if (!(!ne || q.version === 0) && q.pendingChangeFields.length !== 0)
3254
+ return K.current != null && clearTimeout(K.current), K.current = setTimeout(() => {
3255
+ if (K.current = null, !R.current) return;
3256
+ const P = [...q.pendingChangeFields];
3257
+ q.clearPendingChangeFields(), P.length !== 0 && se(P);
3258
+ }, Bi), () => {
3259
+ K.current != null && (clearTimeout(K.current), K.current = null);
3260
+ };
3261
+ }, [
3262
+ ne,
3263
+ q.version,
3264
+ q.pendingChangeFields,
3265
+ q.clearPendingChangeFields,
3266
+ se
3267
+ ]);
3268
+ const De = $(async () => {
3269
+ var P, B, X, xe, Mt, Ft, Nt, Et;
3270
+ if (!v) {
3271
+ x(!0);
3039
3272
  try {
3040
- const ae = ((V = x.current) == null ? void 0 : V.getValues($)) ?? {}, ve = wo(b, ae);
3041
- if (ve) {
3042
- (q = T.current) == null || q.call(T, "error", ve.message);
3273
+ const de = ((P = M.current) == null ? void 0 : P.getValues(W)) ?? {}, Ie = Yo(w, de);
3274
+ if (Ie) {
3275
+ (B = C.current) == null || B.call(C, "error", Ie.message);
3043
3276
  return;
3044
3277
  }
3045
- const ze = { ...ae, ...B };
3046
- if (D.reportData(ze), D.reportEvent({
3047
- action: "submit",
3048
- component: "SubmitButton"
3049
- }), o === "post") {
3050
- const kt = (r ?? "").trim();
3051
- if (!kt) {
3052
- (W = T.current) == null || W.call(T, "error", "callback_url 为空,无法提交");
3278
+ const Ut = { ...de, ...F };
3279
+ if (o === "post") {
3280
+ const zt = (r ?? "").trim();
3281
+ if (!zt) {
3282
+ (X = C.current) == null || X.call(C, "error", "callback_url 为空,无法提交");
3053
3283
  return;
3054
3284
  }
3055
- const Be = await Xt(kt, ze, {
3056
- headers: K
3285
+ se([]), O.reportEvent({
3286
+ action: "submit",
3287
+ component: "SubmitButton"
3288
+ });
3289
+ const He = await hn(zt, Ut, {
3290
+ headers: Z
3057
3291
  });
3058
- if (!z.current) return;
3059
- Be.ok ? (ye = T.current) == null || ye.call(T, "success", "提交成功") : (yt = T.current) == null || yt.call(T, "error", yi(Be.status, Be.body));
3292
+ if (!R.current) return;
3293
+ He.ok ? (xe = C.current) == null || xe.call(C, "success", "提交成功") : (Mt = C.current) == null || Mt.call(C, "error", Li(He.status, He.body));
3060
3294
  return;
3061
3295
  }
3062
- const dn = ft({
3063
- context: j,
3296
+ const Rt = At({
3297
+ context: ee,
3064
3298
  payload: e,
3065
- form: g ?? I,
3066
- answer: ze
3067
- }), pn = await rn(dn, {
3068
- headers: K
3299
+ form: g ?? N,
3300
+ answer: Ut
3301
+ }), wt = _t(Rt);
3302
+ if (wt) {
3303
+ (Ft = C.current) == null || Ft.call(C, "error", wt);
3304
+ return;
3305
+ }
3306
+ se([]), O.reportEvent({
3307
+ action: "submit",
3308
+ component: "SubmitButton"
3069
3309
  });
3070
- if (!z.current) return;
3071
- const bt = nn(pn);
3072
- (vt = T.current) == null || vt.call(T, bt.type, bt.message);
3073
- } catch (ae) {
3074
- if (!z.current) return;
3075
- const ve = ae instanceof Error ? ae.message : "提交失败";
3076
- (St = T.current) == null || St.call(T, "error", ve);
3310
+ const xn = await Sn(Rt, {
3311
+ headers: Z
3312
+ });
3313
+ if (!R.current) return;
3314
+ const Pt = vn(xn);
3315
+ (Nt = C.current) == null || Nt.call(C, Pt.type, Pt.message);
3316
+ } catch (de) {
3317
+ if (!R.current) return;
3318
+ const Ie = de instanceof Error ? de.message : "提交失败";
3319
+ (Et = C.current) == null || Et.call(C, "error", Ie);
3077
3320
  } finally {
3078
- z.current && A(!1);
3321
+ R.current && x(!1);
3079
3322
  }
3080
3323
  }
3081
3324
  }, [
3082
- S,
3083
- $,
3084
- b,
3085
- B,
3086
- D,
3325
+ v,
3326
+ W,
3327
+ w,
3328
+ F,
3329
+ se,
3330
+ O,
3087
3331
  o,
3088
3332
  r,
3089
- K,
3090
- j,
3333
+ Z,
3334
+ ee,
3091
3335
  e,
3092
3336
  g,
3093
- I
3094
- ]), ht = P(Re);
3095
- ht.current = Re;
3096
- const gt = L(
3097
- (V) => {
3098
- fi(
3099
- V,
3337
+ N
3338
+ ]), xt = T(De);
3339
+ xt.current = De;
3340
+ const It = $(
3341
+ (P) => {
3342
+ Ri(
3343
+ P,
3100
3344
  {
3101
- setValues: (q) => {
3102
- var W;
3103
- return (W = x.current) == null ? void 0 : W.setValues(q);
3345
+ setValues: (B) => {
3346
+ var X;
3347
+ return (X = M.current) == null ? void 0 : X.setValues(B);
3104
3348
  },
3105
- getValues: (q) => {
3106
- var W;
3107
- return ((W = x.current) == null ? void 0 : W.getValues(q)) ?? {};
3349
+ getValues: (B) => {
3350
+ var X;
3351
+ return ((X = M.current) == null ? void 0 : X.getValues(B)) ?? {};
3108
3352
  },
3109
- submit: () => ht.current(),
3110
- rootElement: _.current
3353
+ submit: () => xt.current(),
3354
+ rootElement: A.current
3111
3355
  },
3112
3356
  {
3113
- reportEvent: D.reportEvent,
3114
- runAutoControl: D.runAutoControl
3357
+ reportEvent: O.reportEvent,
3358
+ runAutoControl: O.runAutoControl
3115
3359
  }
3116
3360
  );
3117
3361
  },
3118
- [D]
3362
+ [O]
3119
3363
  );
3120
- return w(() => {
3121
- if (!ge) {
3122
- y(null);
3364
+ return z(() => {
3365
+ if (!ne) {
3366
+ S(null);
3123
3367
  return;
3124
3368
  }
3125
- return y(gt), () => y(null);
3126
- }, [ge, gt, y]), h ? /* @__PURE__ */ c("div", { className: "ask-user-form-card", children: /* @__PURE__ */ c(tt, { size: "small" }) }) : !I || b.length === 0 ? /* @__PURE__ */ c(
3127
- gi,
3369
+ return S(It), () => S(null);
3370
+ }, [ne, It, S]), f ? /* @__PURE__ */ u("div", { className: "ask-user-form-card", children: /* @__PURE__ */ u(ct, { size: "small" }) }) : !N || w.length === 0 ? /* @__PURE__ */ u(
3371
+ qi,
3128
3372
  {
3129
3373
  payload: e,
3130
3374
  callbackUrl: r,
3131
- answerAgentContext: j,
3132
- submitHeaders: a,
3133
- unpublishedFormId: v && H ? H : void 0,
3375
+ answerAgentContext: ee,
3376
+ submitHeaders: s,
3377
+ unpublishedFormId: y && D ? D : void 0,
3134
3378
  onNotify: l
3135
3379
  }
3136
- ) : /* @__PURE__ */ N(
3380
+ ) : /* @__PURE__ */ I(
3137
3381
  "div",
3138
3382
  {
3139
3383
  className: "ask-user-form-card",
3140
- ref: _,
3141
- "data-ask-user-message-id": oe || void 0,
3384
+ ref: A,
3385
+ "data-ask-user-message-id": J || void 0,
3142
3386
  children: [
3143
- v && H ? /* @__PURE__ */ c("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ c(se, { title: H, children: /* @__PURE__ */ c(le, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
3144
- /* @__PURE__ */ c(
3145
- li,
3387
+ y && D ? /* @__PURE__ */ u("div", { className: "ask-user-form-card-status", children: /* @__PURE__ */ u(pe, { title: D, children: /* @__PURE__ */ u(fe, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) }) : null,
3388
+ /* @__PURE__ */ u(
3389
+ _i,
3146
3390
  {
3147
- ref: x,
3148
- doc: U,
3149
- surfaceId: mn,
3150
- fieldNames: $,
3391
+ ref: M,
3392
+ doc: ce,
3393
+ surfaceId: $e,
3394
+ fieldNames: W,
3151
3395
  interactive: !0,
3152
3396
  wrapProvider: !1,
3153
- resumeSearch: u,
3397
+ resumeSearch: c,
3154
3398
  caseSearch: m
3155
3399
  }
3156
3400
  ),
3157
- /* @__PURE__ */ c("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ c(
3158
- se,
3401
+ /* @__PURE__ */ u("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ u(
3402
+ pe,
3159
3403
  {
3160
3404
  title: o === "post" ? "提交 JSON 到 callback_url" : "提交到 answer_agent_callback_url",
3161
- children: /* @__PURE__ */ c(
3162
- Me,
3405
+ children: /* @__PURE__ */ u(
3406
+ ze,
3163
3407
  {
3164
3408
  type: "primary",
3165
3409
  size: "small",
3166
- loading: S,
3167
- disabled: S,
3168
- onClick: () => void Re(),
3410
+ loading: v,
3411
+ disabled: v,
3412
+ onClick: () => void De(),
3169
3413
  children: "提交"
3170
3414
  }
3171
3415
  )
@@ -3175,97 +3419,95 @@ function vi({
3175
3419
  }
3176
3420
  );
3177
3421
  }
3178
- function zi(e) {
3179
- var d;
3180
- const t = ((d = e.askUserMessageId) == null ? void 0 : d.trim()) ?? "", n = R(() => bo(), []), [r, o] = E(!1), [i, a] = E(null), s = P(null), l = L((y) => {
3181
- o(y);
3182
- }, []), u = L(
3183
- (y) => {
3184
- s.current = y;
3422
+ function is(e) {
3423
+ var c;
3424
+ const t = ((c = e.askUserMessageId) == null ? void 0 : c.trim()) ?? "", n = j(() => zo(), []), [r, o] = U(!1), i = T(null), s = $((m) => {
3425
+ o(m);
3426
+ }, []), a = $(
3427
+ (m) => {
3428
+ i.current = m;
3185
3429
  },
3186
3430
  []
3187
- ), m = !!(n && t && r);
3188
- return w(() => {
3189
- if (!m || !n || !t) {
3190
- a(null);
3191
- return;
3431
+ ), l = j(() => !n || !t ? null : new Ni({
3432
+ url: n,
3433
+ askUserMessageId: t,
3434
+ onAutoControl: (m) => {
3435
+ var d;
3436
+ (d = i.current) == null || d.call(i, m);
3192
3437
  }
3193
- const y = new mi({
3194
- url: n,
3195
- askUserMessageId: t,
3196
- onAutoControl: (g) => {
3197
- var k;
3198
- (k = s.current) == null || k.call(s, g);
3199
- }
3200
- });
3201
- return y.connect(), a(y), () => {
3202
- y.close(), a(null);
3203
- };
3204
- }, [m, n, t]), /* @__PURE__ */ c(ue, { children: /* @__PURE__ */ c(fr, { client: i, children: /* @__PURE__ */ c(
3205
- vi,
3438
+ }), [n, t]);
3439
+ return z(() => {
3440
+ if (l)
3441
+ return () => {
3442
+ l.close();
3443
+ };
3444
+ }, [l]), z(() => {
3445
+ !l || !r || l.connect();
3446
+ }, [l, r]), /* @__PURE__ */ u(ge, { children: /* @__PURE__ */ u(Nr, { client: l, children: /* @__PURE__ */ u(xr, { children: /* @__PURE__ */ u(
3447
+ Vi,
3206
3448
  {
3207
3449
  ...e,
3208
- onSurfaceReadyChange: l,
3209
- onAutoControlReady: u
3450
+ onSurfaceReadyChange: s,
3451
+ onAutoControlReady: a
3210
3452
  }
3211
- ) }) });
3453
+ ) }) }) });
3212
3454
  }
3213
3455
  export {
3214
- Fi as A2UI_PROTOCOL_VERSION,
3215
- zi as AskUserFormCard,
3216
- Ye as CaseSearchProvider,
3217
- gi as CurlSubmitBlock,
3218
- yo as DEFAULT_ANSWER_AGENT_CALLBACK_URL,
3219
- ho as DEFAULT_AUTH_ANSWER_AGENT_CALLBACK_URL_FIELD,
3220
- go as DEFAULT_AUTH_REALTIME_WS_URL_FIELD,
3221
- ct as DEFAULT_AUTH_STORAGE_KEY,
3222
- fo as DEFAULT_AUTH_TOKEN_FIELD,
3223
- wn as FORM_MEDIA_SIZES,
3224
- Qe as ResumeSearchProvider,
3225
- Ri as SkoponA2uiStreamRenderer,
3226
- ue as SkoponFormProvider,
3227
- li as SkoponFormRenderer,
3228
- Qr as a2uiToBlocks,
3229
- Gt as blocksToA2ui,
3230
- ft as buildAnswerAgentBody,
3231
- mo as buildAskUserCurlBodyJson,
3232
- po as buildAskUserCurlStatement,
3233
- Ui as buildAskUserSubmitCurlFromPayload,
3234
- eo as buildAskUserSurface,
3235
- Qt as buildCurlStatement,
3236
- Ei as copyTextToClipboard,
3237
- Eo as createCaseSearchClient,
3238
- ko as createFormClient,
3239
- No as createResumeSearchClient,
3240
- wi as createSkoponSdkClients,
3241
- at as extractExtraBlockValues,
3242
- no as extractSurfaceValues,
3243
- nn as formatAnswerAgentSubmitMessage,
3244
- uo as getPayloadInputFieldNames,
3245
- co as getPayloadRenderableBlocks,
3246
- ao as intersectPayloadBlocksWithForm,
3247
- et as isA2uiSurfaceEmpty,
3248
- ne as isInputBlockType,
3249
- Fe as isLayoutBlockType,
3250
- Ce as isMediaBlockType,
3251
- to as mapFormDefinitionFromDto,
3252
- re as normalizeFormDefinition,
3253
- Ee as parsePayloadBlocksJson,
3254
- lo as payloadHasInputBlocks,
3255
- So as resolveAnswerAgentCallbackUrl,
3256
- pt as resolveClientHeaders,
3257
- bo as resolveRealtimeWsUrl,
3258
- Zt as resolveSkoponAuthHeaders,
3259
- dt as resolveSubmitAuthHeaders,
3260
- Zr as resolveSurfaceFromFormDefinition,
3261
- si as skoponAntdTheme,
3262
- Z as skoponBrandColors,
3263
- rn as submitAnswerAgent,
3264
- Xt as submitFormJson,
3265
- Xr as surfaceDocToMessages,
3266
- _e as syncFormDefinition,
3267
- yr as useCaseSearch,
3268
- Tr as useResumeSearch,
3269
- en as validateAnswerAgentBody,
3270
- Pi as validateAnswerAgentContext
3456
+ Zi as A2UI_PROTOCOL_VERSION,
3457
+ is as AskUserFormCard,
3458
+ ot as CaseSearchProvider,
3459
+ qi as CurlSubmitBlock,
3460
+ Ro as DEFAULT_ANSWER_AGENT_CALLBACK_URL,
3461
+ Eo as DEFAULT_AUTH_ANSWER_AGENT_CALLBACK_URL_FIELD,
3462
+ Uo as DEFAULT_AUTH_REALTIME_WS_URL_FIELD,
3463
+ vt as DEFAULT_AUTH_STORAGE_KEY,
3464
+ No as DEFAULT_AUTH_TOKEN_FIELD,
3465
+ Gn as FORM_MEDIA_SIZES,
3466
+ it as ResumeSearchProvider,
3467
+ os as SkoponA2uiStreamRenderer,
3468
+ ge as SkoponFormProvider,
3469
+ _i as SkoponFormRenderer,
3470
+ fo as a2uiToBlocks,
3471
+ un as blocksToA2ui,
3472
+ At as buildAnswerAgentBody,
3473
+ Mo as buildAskUserCurlBodyJson,
3474
+ Fo as buildAskUserCurlStatement,
3475
+ es as buildAskUserSubmitCurlFromPayload,
3476
+ yo as buildAskUserSurface,
3477
+ fn as buildCurlStatement,
3478
+ ts as copyTextToClipboard,
3479
+ Jo as createCaseSearchClient,
3480
+ Oo as createFormClient,
3481
+ Do as createResumeSearchClient,
3482
+ rs as createSkoponSdkClients,
3483
+ ht as extractExtraBlockValues,
3484
+ So as extractSurfaceValues,
3485
+ vn as formatAnswerAgentSubmitMessage,
3486
+ Io as getPayloadInputFieldNames,
3487
+ xo as getPayloadRenderableBlocks,
3488
+ Ao as intersectPayloadBlocksWithForm,
3489
+ lt as isA2uiSurfaceEmpty,
3490
+ ae as isInputBlockType,
3491
+ Oe as isLayoutBlockType,
3492
+ Ue as isMediaBlockType,
3493
+ vo as mapFormDefinitionFromDto,
3494
+ me as normalizeFormDefinition,
3495
+ Be as parsePayloadBlocksJson,
3496
+ To as payloadHasInputBlocks,
3497
+ Po as resolveAnswerAgentCallbackUrl,
3498
+ Ct as resolveClientHeaders,
3499
+ zo as resolveRealtimeWsUrl,
3500
+ gn as resolveSkoponAuthHeaders,
3501
+ kt as resolveSubmitAuthHeaders,
3502
+ go as resolveSurfaceFromFormDefinition,
3503
+ Ai as skoponAntdTheme,
3504
+ re as skoponBrandColors,
3505
+ Sn as submitAnswerAgent,
3506
+ hn as submitFormJson,
3507
+ ho as surfaceDocToMessages,
3508
+ Re as syncFormDefinition,
3509
+ Rr as useCaseSearch,
3510
+ jr as useResumeSearch,
3511
+ _t as validateAnswerAgentBody,
3512
+ ns as validateAnswerAgentContext
3271
3513
  };