@skopon-cool/form-sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,30 +1,31 @@
1
- import { jsx as u, jsxs as b, Fragment as ae } from "react/jsx-runtime";
2
- import { createContext as Fe, useContext as we, useCallback as N, useSyncExternalStore as Oe, forwardRef as De, useEffect as C, useRef as M, useMemo as k, useImperativeHandle as je, useState as w } from "react";
3
- import { Catalog as Ve, MessageProcessor as le } from "@a2ui/web_core/v0_9";
4
- import { injectBasicCatalogStyles as ce } from "@a2ui/web_core/v0_9/basic_catalog";
5
- import { createBinderlessComponentImplementation as S, basicCatalog as O, A2uiSurface as se } from "@a2ui/react/v0_9";
6
- import { injectStyles as ue } from "@a2ui/react/styles";
7
- import { z as m } from "zod";
8
- import { Typography as J, Select as H, Checkbox as ze, Radio as Le, Switch as Re, TimePicker as Ue, DatePicker as Be, Upload as ee, Tooltip as Y, Tag as te, Button as pe, Spin as Ne } from "antd";
9
- import ne from "dayjs";
10
- import { FileTextOutlined as $e, FileExcelOutlined as He, FileOutlined as me, PictureOutlined as Ye, SoundOutlined as Ge, VideoCameraOutlined as Xe } from "@ant-design/icons";
11
- const bn = "v0.9", Ke = [
1
+ import './form-sdk.css';
2
+ import { jsx as u, jsxs as b, Fragment as le } from "react/jsx-runtime";
3
+ import { createContext as Fe, useContext as Oe, useCallback as $, useSyncExternalStore as De, forwardRef as je, useEffect as P, useRef as M, useMemo as A, useImperativeHandle as Ne, useState as j } from "react";
4
+ import { Catalog as Re, MessageProcessor as ce } from "@a2ui/web_core/v0_9";
5
+ import { injectBasicCatalogStyles as se } from "@a2ui/web_core/v0_9/basic_catalog";
6
+ import { basicCatalog as N, createBinderlessComponentImplementation as x, A2uiSurface as ue } from "@a2ui/react/v0_9";
7
+ import { injectStyles as pe } from "@a2ui/react/styles";
8
+ import { z as p } from "zod";
9
+ import { Typography as E, Select as G, Checkbox as Ve, Radio as ze, Switch as Le, TimePicker as Ue, DatePicker as Be, Upload as te, Input as H, InputNumber as $e, Tooltip as X, Tag as ne, Button as de, Spin as He } from "antd";
10
+ import re from "dayjs";
11
+ import { FileTextOutlined as Ye, FileExcelOutlined as Ge, FileOutlined as me, PictureOutlined as Xe, SoundOutlined as Ke, VideoCameraOutlined as qe } from "@ant-design/icons";
12
+ const Cn = "v0.9", Je = [
12
13
  "huge",
13
14
  "large",
14
15
  "medium",
15
16
  "small",
16
17
  "icon"
17
18
  ];
18
- function G(e) {
19
+ function K(e) {
19
20
  return e === "image" || e === "video" || e === "audio";
20
21
  }
21
- function qe(e) {
22
+ function We(e) {
22
23
  return e === "heading" || e === "paragraph";
23
24
  }
24
- function re(e) {
25
- return !qe(e) && !G(e);
25
+ function oe(e) {
26
+ return !We(e) && !K(e);
26
27
  }
27
- function Je() {
28
+ function Ze() {
28
29
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function")
29
30
  return crypto.randomUUID();
30
31
  if (typeof crypto < "u" && typeof crypto.getRandomValues == "function") {
@@ -38,30 +39,30 @@ function Je() {
38
39
  return (e === "x" ? t : t & 3 | 8).toString(16);
39
40
  });
40
41
  }
41
- function P(e) {
42
- const t = Je().replace(/-/g, "").slice(0, 8);
42
+ function w(e) {
43
+ const t = Ze().replace(/-/g, "").slice(0, 8);
43
44
  return `${e}${t}`;
44
45
  }
45
- function I(e) {
46
- return typeof e == "string" && Ke.includes(e) ? e : "medium";
46
+ function F(e) {
47
+ return typeof e == "string" && Je.includes(e) ? e : "medium";
47
48
  }
48
- function We(e, t) {
49
+ function Qe(e, t) {
49
50
  var o;
50
51
  const n = Math.max(1, t);
51
52
  let r = [];
52
- return Array.isArray(e.mediaUrls) ? r = e.mediaUrls.map((a) => String(a).trim()) : (o = e.mediaUrl) != null && o.trim() && (r = [e.mediaUrl.trim()]), r.length === 0 ? [""] : r.slice(0, n);
53
+ 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);
53
54
  }
54
- function Ze(e) {
55
+ function et(e) {
55
56
  var t;
56
57
  return Array.isArray(e.mediaUrls) ? e.mediaUrls.map((n) => n.trim()).filter(Boolean) : (t = e.mediaUrl) != null && t.trim() ? [e.mediaUrl.trim()] : [];
57
58
  }
58
- function Qe(e) {
59
- return `form-media-size-${I(e)}`;
59
+ function tt(e) {
60
+ return `form-media-size-${F(e)}`;
60
61
  }
61
- function et(e) {
62
- return `form-media-preview form-media-list ${Qe(e)}`;
62
+ function nt(e) {
63
+ return `form-media-preview form-media-list ${tt(e)}`;
63
64
  }
64
- const de = [
65
+ const fe = [
65
66
  { value: "image/*", label: "图片" },
66
67
  { value: "video/*", label: "视频" },
67
68
  { value: "audio/*", label: "音频" },
@@ -72,7 +73,7 @@ const de = [
72
73
  { value: "text/plain", label: "纯文本" },
73
74
  { value: "application/zip", label: "ZIP 压缩包" },
74
75
  { value: "application/x-rar-compressed", label: "RAR 压缩包" }
75
- ], tt = {
76
+ ], rt = {
76
77
  "image/*": ["image/*"],
77
78
  "video/*": ["video/*"],
78
79
  "audio/*": ["audio/*"],
@@ -92,7 +93,7 @@ const de = [
92
93
  "text/plain": ["text/plain"],
93
94
  "application/zip": ["application/zip"],
94
95
  "application/x-rar-compressed": ["application/x-rar-compressed"]
95
- }, nt = {
96
+ }, ot = {
96
97
  "image/*": [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"],
97
98
  "video/*": [".mp4", ".mov", ".avi", ".webm"],
98
99
  "audio/*": [".mp3", ".wav", ".ogg", ".m4a"],
@@ -103,14 +104,14 @@ const de = [
103
104
  "text/plain": [".txt"],
104
105
  "application/zip": [".zip", ".7z"],
105
106
  "application/x-rar-compressed": [".rar"]
106
- }, rt = {
107
+ }, at = {
107
108
  "application/msword": "office/word",
108
109
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "office/word",
109
110
  "application/vnd.ms-excel": "office/excel",
110
111
  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "office/excel",
111
112
  "application/vnd.ms-powerpoint": "office/ppt",
112
113
  "application/vnd.openxmlformats-officedocument.presentationml.presentation": "office/ppt"
113
- }, fe = [
114
+ }, he = [
114
115
  { value: ".jpg", label: ".jpg" },
115
116
  { value: ".jpeg", label: ".jpeg" },
116
117
  { value: ".png", label: ".png" },
@@ -136,16 +137,16 @@ const de = [
136
137
  { value: ".zip", label: ".zip" },
137
138
  { value: ".rar", label: ".rar" },
138
139
  { value: ".7z", label: ".7z" }
139
- ], ot = Object.fromEntries(
140
- de.map((e) => [e.value, e.label])
141
- ), it = Object.fromEntries(
140
+ ], it = Object.fromEntries(
142
141
  fe.map((e) => [e.value, e.label])
143
- ), at = new Set(de.map((e) => e.value));
144
- function lt(e) {
142
+ ), lt = Object.fromEntries(
143
+ he.map((e) => [e.value, e.label])
144
+ ), ct = new Set(fe.map((e) => e.value));
145
+ function st(e) {
145
146
  const t = e.trim();
146
- return t ? at.has(t) ? t : rt[t] ?? null : null;
147
+ return t ? ct.has(t) ? t : at[t] ?? null : null;
147
148
  }
148
- function ct(e) {
149
+ function ut(e) {
149
150
  return Array.isArray(e) ? e.map((t) => {
150
151
  const n = t.trim().toLowerCase();
151
152
  return n ? n.startsWith(".") ? n : `.${n}` : "";
@@ -155,98 +156,98 @@ function L(e) {
155
156
  if (!Array.isArray(e)) return [];
156
157
  const t = [], n = /* @__PURE__ */ new Set();
157
158
  for (const r of e) {
158
- const o = lt(r);
159
+ const o = st(r);
159
160
  o && !n.has(o) && (n.add(o), t.push(o));
160
161
  }
161
162
  return t;
162
163
  }
163
- function st(e) {
164
+ function pt(e) {
164
165
  const t = L(e), n = [];
165
166
  for (const r of t)
166
- n.push(...tt[r] ?? [r]);
167
+ n.push(...rt[r] ?? [r]);
167
168
  return n;
168
169
  }
169
- function ut(e) {
170
+ function dt(e) {
170
171
  const t = L(e);
171
172
  if (t.length === 0) return [];
172
173
  const n = /* @__PURE__ */ new Set();
173
174
  for (const r of t)
174
- for (const o of nt[r] ?? [])
175
+ for (const o of ot[r] ?? [])
175
176
  n.add(o);
176
- return fe.filter((r) => n.has(r.value));
177
+ return he.filter((r) => n.has(r.value));
177
178
  }
178
- function W(e, t) {
179
+ function Z(e, t) {
179
180
  const n = new Set(
180
- ut(e).map((r) => r.value)
181
+ dt(e).map((r) => r.value)
181
182
  );
182
- return ct(t).filter((r) => n.has(r));
183
+ return ut(t).filter((r) => n.has(r));
183
184
  }
184
- function pt(e, t) {
185
- const n = st(e), r = W(e, t), o = [...n, ...r];
185
+ function mt(e, t) {
186
+ const n = pt(e), r = Z(e, t), o = [...n, ...r];
186
187
  return o.length > 0 ? o.join(",") : void 0;
187
188
  }
188
- function mt(e, t) {
189
- const n = L(e), r = W(
189
+ function ft(e, t) {
190
+ const n = L(e), r = Z(
190
191
  n,
191
192
  t
192
193
  ), o = [
193
- ...n.map((a) => ot[a] ?? a),
194
- ...r.map((a) => it[a] ?? a)
194
+ ...n.map((i) => it[i] ?? i),
195
+ ...r.map((i) => lt[i] ?? i)
195
196
  ];
196
197
  return o.length === 0 ? null : o.join("、");
197
198
  }
198
- const dt = [
199
+ const ht = [
199
200
  "video",
200
201
  "audio",
201
202
  "image",
202
203
  "file",
203
204
  "spreadsheet",
204
205
  "document"
205
- ], ft = new Set(dt);
206
- function ht(e) {
207
- return e && ft.has(e) ? e : "file";
206
+ ], vt = new Set(ht);
207
+ function yt(e) {
208
+ return e && vt.has(e) ? e : "file";
208
209
  }
209
- const vt = 10;
210
- function oe(e, t = 1) {
210
+ const bt = 10;
211
+ function ae(e, t = 1) {
211
212
  const n = typeof e == "number" ? e : Number(e);
212
213
  return Number.isFinite(n) ? Math.max(0, Math.floor(n)) : t;
213
214
  }
214
- function yt(e, t) {
215
+ function gt(e, t) {
215
216
  if (t !== void 0)
216
217
  return e === "toggle" ? t === !0 : e === "multiselect" || e === "checkbox" ? 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);
217
218
  }
218
- function bt(e) {
219
+ function xt(e) {
219
220
  var r, o;
220
221
  const t = L(e.fileAcceptTypes), n = e.type;
221
222
  return {
222
- id: ((r = e.id) == null ? void 0 : r.trim()) || P("block-"),
223
+ id: ((r = e.id) == null ? void 0 : r.trim()) || w("block-"),
223
224
  type: n,
224
225
  name: ((o = e.name) == null ? void 0 : o.trim()) || void 0,
225
226
  label: e.label ?? "",
226
227
  placeholder: e.placeholder ?? "",
227
228
  help: e.help ?? "",
228
229
  required: e.required === !0,
229
- mediaUrls: G(n) ? We(e, vt) : void 0,
230
- mediaSize: G(n) ? I(e.mediaSize) : void 0,
230
+ mediaUrls: K(n) ? Qe(e, bt) : void 0,
231
+ mediaSize: K(n) ? F(e.mediaSize) : void 0,
231
232
  fileAcceptTypes: t,
232
- fileAcceptExtensions: W(
233
+ fileAcceptExtensions: Z(
233
234
  t,
234
235
  e.fileAcceptExtensions
235
236
  ),
236
- filePlaceholderIcon: ht(e.filePlaceholderIcon),
237
- fileMinCount: n === "file" ? oe(e.fileMinCount, 1) : void 0,
238
- fileMaxCount: n === "file" ? oe(e.fileMaxCount, 1) : void 0,
239
- defaultValue: yt(n, e.defaultValue),
240
- options: Array.isArray(e.options) ? e.options.map((a, i) => {
237
+ filePlaceholderIcon: yt(e.filePlaceholderIcon),
238
+ fileMinCount: n === "file" ? ae(e.fileMinCount, 1) : void 0,
239
+ fileMaxCount: n === "file" ? ae(e.fileMaxCount, 1) : void 0,
240
+ defaultValue: gt(n, e.defaultValue),
241
+ options: Array.isArray(e.options) ? e.options.map((i, a) => {
241
242
  var l, c;
242
243
  return {
243
- value: ((l = a.value) == null ? void 0 : l.trim()) || `option_${i + 1}`,
244
- label: ((c = a.label) == null ? void 0 : c.trim()) || `选项 ${i + 1}`
244
+ value: ((l = i.value) == null ? void 0 : l.trim()) || `option_${a + 1}`,
245
+ label: ((c = i.label) == null ? void 0 : c.trim()) || `选项 ${a + 1}`
245
246
  };
246
247
  }) : void 0
247
248
  };
248
249
  }
249
- function D(e) {
250
+ function R(e) {
250
251
  return {
251
252
  title: e.title ?? "",
252
253
  description: e.description ?? "",
@@ -254,59 +255,59 @@ function D(e) {
254
255
  jsonSchema: e.jsonSchema ?? {}
255
256
  };
256
257
  }
257
- function he(e) {
258
+ function ve(e) {
258
259
  if (!e || !Array.isArray(e.blocks))
259
- return D({ title: "", description: "", blocks: [], jsonSchema: {} });
260
- const t = e.blocks.map(bt);
261
- return D({
260
+ return R({ title: "", description: "", blocks: [], jsonSchema: {} });
261
+ const t = e.blocks.map(xt);
262
+ return R({
262
263
  title: typeof e.title == "string" ? e.title : "",
263
264
  description: typeof e.description == "string" ? e.description : "",
264
265
  blocks: t,
265
266
  jsonSchema: {}
266
267
  });
267
268
  }
268
- const j = "root", X = "__title__", K = "__desc__", ve = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
269
- function gt(e) {
269
+ const V = "root", q = "__title__", J = "__desc__", ye = "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$";
270
+ function St(e) {
270
271
  return `/${e}`;
271
272
  }
272
- function xt(e) {
273
+ function Tt(e) {
273
274
  return e && typeof e == "object" && "path" in e ? String(e.path ?? "").replace(/^\//, "") : "";
274
275
  }
275
276
  function y(e) {
276
277
  if (typeof e == "string") return e;
277
278
  }
278
- function St(e) {
279
- const t = e.id || P("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
279
+ function At(e) {
280
+ const t = e.id || w("a2-"), n = e.type === "video" ? "video" : e.type === "audio" ? "audio" : "image";
280
281
  return {
281
282
  id: t,
282
283
  component: "SkoponMedia",
283
284
  mediaType: n,
284
- urls: Ze(e),
285
- mediaSize: I(e.mediaSize),
285
+ urls: et(e),
286
+ mediaSize: F(e.mediaSize),
286
287
  label: e.label ?? "",
287
288
  help: e.help ?? "",
288
289
  placeholder: e.placeholder ?? ""
289
290
  };
290
291
  }
291
- function At(e) {
292
+ function kt(e) {
292
293
  if (Array.isArray(e.urls))
293
294
  return e.urls.map((n) => String(n).trim()).filter(Boolean);
294
295
  const t = y(e.url);
295
296
  return t != null && t.trim() ? [t.trim()] : [];
296
297
  }
297
- function F(e, t, n) {
298
- const r = typeof e.id == "string" ? e.id : P("block-"), o = At(e), a = y(e.label) ?? y(e.description) ?? n, i = y(e.help), l = y(e.placeholder), c = I(e.mediaSize);
298
+ function D(e, t, n) {
299
+ const r = typeof e.id == "string" ? e.id : w("block-"), o = kt(e), i = y(e.label) ?? y(e.description) ?? n, a = y(e.help), l = y(e.placeholder), c = F(e.mediaSize);
299
300
  return {
300
301
  id: r,
301
302
  type: t,
302
- label: a,
303
- ...i ? { help: i } : {},
303
+ label: i,
304
+ ...a ? { help: a } : {},
304
305
  ...l ? { placeholder: l } : {},
305
306
  mediaSize: c,
306
307
  mediaUrls: o.length > 0 ? o : [""]
307
308
  };
308
309
  }
309
- function kt(e) {
310
+ function Ct(e) {
310
311
  switch (e.type) {
311
312
  case "toggle":
312
313
  return typeof e.defaultValue == "boolean" ? e.defaultValue : !1;
@@ -319,9 +320,9 @@ function kt(e) {
319
320
  return typeof e.defaultValue == "string" ? e.defaultValue : "";
320
321
  }
321
322
  }
322
- function Tt(e) {
323
+ function It(e) {
323
324
  var l;
324
- const t = e.id || P("a2-"), n = e.label ?? "", r = ((l = e.name) == null ? void 0 : l.trim()) || "", o = r ? gt(r) : void 0, a = (e.options ?? []).map((c) => ({ label: c.label, value: c.value })), i = (c) => r ? { node: c, dataKey: r, dataValue: kt(e) } : { node: c };
325
+ const t = e.id || w("a2-"), n = e.label ?? "", r = ((l = e.name) == null ? void 0 : l.trim()) || "", o = r ? St(r) : void 0, i = (e.options ?? []).map((c) => ({ label: c.label, value: c.value })), a = (c) => r ? { node: c, dataKey: r, dataValue: Ct(e) } : { node: c };
325
326
  switch (e.type) {
326
327
  case "heading":
327
328
  return { node: { id: t, component: "Text", text: n, variant: "h3" } };
@@ -330,64 +331,86 @@ function Tt(e) {
330
331
  case "text":
331
332
  case "tel":
332
333
  case "url":
333
- return i({ id: t, component: "TextField", label: n, variant: "shortText", value: { path: o } });
334
+ return a({
335
+ id: t,
336
+ component: "TextField",
337
+ label: n,
338
+ variant: "shortText",
339
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
340
+ value: { path: o }
341
+ });
334
342
  case "email":
335
- return i({
343
+ return a({
336
344
  id: t,
337
345
  component: "TextField",
338
346
  label: n,
339
347
  variant: "shortText",
340
- validationRegexp: ve,
348
+ validationRegexp: ye,
349
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
341
350
  value: { path: o }
342
351
  });
343
352
  case "textarea":
344
- return i({ id: t, component: "TextField", label: n, variant: "longText", value: { path: o } });
353
+ return a({
354
+ id: t,
355
+ component: "TextField",
356
+ label: n,
357
+ variant: "longText",
358
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
359
+ value: { path: o }
360
+ });
345
361
  case "number":
346
- return i({ id: t, component: "TextField", label: n, variant: "number", value: { path: o } });
362
+ return a({
363
+ id: t,
364
+ component: "TextField",
365
+ label: n,
366
+ variant: "number",
367
+ ...e.placeholder ? { placeholder: e.placeholder } : {},
368
+ value: { path: o }
369
+ });
347
370
  case "select":
348
- return i({
371
+ return a({
349
372
  id: t,
350
373
  component: "SkoponSelect",
351
374
  label: n,
352
375
  mode: "single",
353
376
  placeholder: e.placeholder ?? "",
354
- options: a,
377
+ options: i,
355
378
  value: { path: o }
356
379
  });
357
380
  case "radio":
358
- return i({
381
+ return a({
359
382
  id: t,
360
383
  component: "ChoicePicker",
361
384
  label: n,
362
385
  variant: "mutuallyExclusive",
363
386
  skoponPickerType: "radio",
364
- options: a,
387
+ options: i,
365
388
  value: { path: o }
366
389
  });
367
390
  case "multiselect":
368
- return i({
391
+ return a({
369
392
  id: t,
370
393
  component: "SkoponSelect",
371
394
  label: n,
372
395
  mode: "multiple",
373
396
  placeholder: e.placeholder ?? "",
374
- options: a,
397
+ options: i,
375
398
  value: { path: o }
376
399
  });
377
400
  case "checkbox":
378
- return i({
401
+ return a({
379
402
  id: t,
380
403
  component: "ChoicePicker",
381
404
  label: n,
382
405
  variant: "multipleSelection",
383
406
  skoponPickerType: "checkbox",
384
- options: a,
407
+ options: i,
385
408
  value: { path: o }
386
409
  });
387
410
  case "toggle":
388
- return i({ id: t, component: "CheckBox", label: n, value: { path: o } });
411
+ return a({ id: t, component: "CheckBox", label: n, value: { path: o } });
389
412
  case "datetime":
390
- return i({
413
+ return a({
391
414
  id: t,
392
415
  component: "DateTimeInput",
393
416
  label: n,
@@ -397,7 +420,7 @@ function Tt(e) {
397
420
  value: { path: o }
398
421
  });
399
422
  case "time":
400
- return i({
423
+ return a({
401
424
  id: t,
402
425
  component: "DateTimeInput",
403
426
  label: n,
@@ -408,9 +431,9 @@ function Tt(e) {
408
431
  case "image":
409
432
  case "video":
410
433
  case "audio":
411
- return { node: St(e) };
434
+ return { node: At(e) };
412
435
  case "file":
413
- return i({
436
+ return a({
414
437
  id: t,
415
438
  component: "FileUpload",
416
439
  label: n,
@@ -425,31 +448,31 @@ function Tt(e) {
425
448
  return { node: null };
426
449
  }
427
450
  }
428
- function q(e) {
451
+ function W(e) {
429
452
  if (!e || !Array.isArray(e.components) || e.components.length === 0) return !0;
430
- const t = e.components.find((r) => r.id === j);
453
+ const t = e.components.find((r) => r.id === V);
431
454
  if (!t) return e.components.length === 0;
432
455
  const n = t.children;
433
456
  return !Array.isArray(n) || n.length === 0;
434
457
  }
435
- function ye(e, t) {
436
- const n = [], r = [], o = {}, a = (t == null ? void 0 : t.includeHeader) !== !1, i = (e.title ?? "").trim(), l = (e.description ?? "").trim();
437
- a && i && (n.push({ id: X, component: "Text", text: i, variant: "h2" }), r.push(X)), a && l && (n.push({ id: K, component: "Text", text: l, variant: "body" }), r.push(K));
438
- for (const p of e.blocks ?? []) {
439
- const { node: d, dataKey: f, dataValue: h } = Tt(p);
440
- d && (n.push(d), r.push(d.id), f && (o[f] = h));
458
+ function be(e, t) {
459
+ const n = [], r = [], o = {}, i = (t == null ? void 0 : t.includeHeader) !== !1, a = (e.title ?? "").trim(), l = (e.description ?? "").trim();
460
+ i && a && (n.push({ id: q, component: "Text", text: a, variant: "h2" }), r.push(q)), i && l && (n.push({ id: J, component: "Text", text: l, variant: "body" }), r.push(J));
461
+ for (const d of e.blocks ?? []) {
462
+ const { node: m, dataKey: f, dataValue: v } = It(d);
463
+ m && (n.push(m), r.push(m.id), f && (o[f] = v));
441
464
  }
442
- n.unshift({ id: j, component: "Column", children: r });
443
- const c = { root: j, components: n, dataModel: o }, s = t == null ? void 0 : t.styleId;
465
+ n.unshift({ id: V, component: "Column", children: r });
466
+ const c = { root: V, components: n, dataModel: o }, s = t == null ? void 0 : t.styleId;
444
467
  return s !== void 0 && (c.surfaceProperties = { styleId: s ?? null }), c;
445
468
  }
446
- function Ct(e) {
469
+ function Pt(e) {
447
470
  const t = /* @__PURE__ */ new Map();
448
471
  for (const n of e.components ?? [])
449
472
  n && typeof n.id == "string" && t.set(n.id, n);
450
473
  return t;
451
474
  }
452
- function $(e) {
475
+ function Y(e) {
453
476
  const t = e.options;
454
477
  return Array.isArray(t) ? t.map((n) => {
455
478
  if (!n || typeof n != "object") return null;
@@ -461,97 +484,99 @@ function $(e) {
461
484
  }).filter((n) => !!n) : [];
462
485
  }
463
486
  function Mt(e) {
464
- const t = typeof e.id == "string" ? e.id : P("block-"), n = String(e.component ?? ""), r = y(e.label) ?? y(e.text) ?? "", o = xt(e.value), a = (i) => ({ id: t, type: i, label: r });
487
+ const t = typeof e.id == "string" ? e.id : w("block-"), n = String(e.component ?? ""), r = y(e.label) ?? y(e.text) ?? "", o = Tt(e.value), i = (a) => ({ id: t, type: a, label: r });
465
488
  switch (n) {
466
489
  case "Text": {
467
- const i = String(e.variant ?? "body"), l = /^h[1-6]$/i.test(i) || i === "title" || i === "subtitle";
490
+ const a = String(e.variant ?? "body"), l = /^h[1-6]$/i.test(a) || a === "title" || a === "subtitle";
468
491
  return { id: t, type: l ? "heading" : "paragraph", label: r };
469
492
  }
470
493
  case "TextField": {
471
- const i = String(e.variant ?? "shortText");
494
+ const a = String(e.variant ?? "shortText");
472
495
  let l = "text";
473
- return i === "longText" ? l = "textarea" : i === "number" ? l = "number" : y(e.validationRegexp) === ve && (l = "email"), { ...a(l), name: o };
496
+ a === "longText" ? l = "textarea" : a === "number" ? l = "number" : y(e.validationRegexp) === ye && (l = "email");
497
+ const c = { ...i(l), name: o }, s = y(e.placeholder);
498
+ return s && (c.placeholder = s), c;
474
499
  }
475
500
  case "CheckBox":
476
- return { ...a("toggle"), name: o };
501
+ return { ...i("toggle"), name: o };
477
502
  case "SkoponSelect": {
478
503
  const l = String(e.mode ?? "single") === "multiple" ? "multiselect" : "select", c = {
479
- ...a(l),
504
+ ...i(l),
480
505
  name: o,
481
- options: $(e)
506
+ options: Y(e)
482
507
  }, s = y(e.placeholder);
483
508
  return s && (c.placeholder = s), c;
484
509
  }
485
510
  case "ChoicePicker": {
486
- const i = y(e.skoponPickerType);
487
- if (i === "select" || i === "multiselect" || i === "radio" || i === "checkbox") {
511
+ const a = y(e.skoponPickerType);
512
+ if (a === "select" || a === "multiselect" || a === "radio" || a === "checkbox") {
488
513
  const s = {
489
- ...a(i),
514
+ ...i(a),
490
515
  name: o,
491
- options: $(e)
492
- }, p = y(e.placeholder);
493
- return p && (s.placeholder = p), s;
516
+ options: Y(e)
517
+ }, d = y(e.placeholder);
518
+ return d && (s.placeholder = d), s;
494
519
  }
495
520
  const c = String(e.variant ?? "mutuallyExclusive") === "multipleSelection" ? "checkbox" : "radio";
496
- return { ...a(c), name: o, options: $(e) };
521
+ return { ...i(c), name: o, options: Y(e) };
497
522
  }
498
523
  case "DateTimeInput": {
499
- const i = e.enableDate === !0, l = e.enableTime === !0, s = { ...a(!i && l ? "time" : "datetime"), name: o }, p = y(e.placeholder);
500
- return p && (s.placeholder = p), s;
524
+ const a = e.enableDate === !0, l = e.enableTime === !0, s = { ...i(!a && l ? "time" : "datetime"), name: o }, d = y(e.placeholder);
525
+ return d && (s.placeholder = d), s;
501
526
  }
502
527
  case "SkoponMedia": {
503
- const i = String(e.mediaType ?? "image");
504
- return F(e, i === "video" ? "video" : i === "audio" ? "audio" : "image", r);
528
+ const a = String(e.mediaType ?? "image");
529
+ return D(e, a === "video" ? "video" : a === "audio" ? "audio" : "image", r);
505
530
  }
506
531
  case "Image":
507
- return F(e, "image", r);
532
+ return D(e, "image", r);
508
533
  case "Video":
509
- return F(e, "video", r);
534
+ return D(e, "video", r);
510
535
  case "AudioPlayer":
511
- return F(e, "audio", r);
536
+ return D(e, "audio", r);
512
537
  case "FileUpload": {
513
- const i = y(e.accept) ?? "", l = { ...a("file"), name: o };
514
- return i && (l.fileAcceptExtensions = i.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;
538
+ const a = y(e.accept) ?? "", l = { ...i("file"), name: o };
539
+ 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;
515
540
  }
516
541
  default:
517
542
  return null;
518
543
  }
519
544
  }
520
- function be(e, t, n, r) {
545
+ function ge(e, t, n, r) {
521
546
  if (n.has(e)) return;
522
547
  n.add(e);
523
548
  const o = t.get(e);
524
549
  if (!o) return;
525
- const a = String(o.component ?? "");
526
- if ((a === "Column" || a === "Row") && Array.isArray(o.children)) {
527
- for (const i of o.children)
528
- typeof i == "string" && be(i, t, n, r);
550
+ const i = String(o.component ?? "");
551
+ if ((i === "Column" || i === "Row") && Array.isArray(o.children)) {
552
+ for (const a of o.children)
553
+ typeof a == "string" && ge(a, t, n, r);
529
554
  return;
530
555
  }
531
556
  r.push(o);
532
557
  }
533
- function Pt(e) {
558
+ function Et(e) {
534
559
  if (!e || !Array.isArray(e.components))
535
- return D({ title: "", description: "", blocks: [], jsonSchema: {} });
536
- const t = Ct(e), n = [];
537
- be(e.root ?? j, t, /* @__PURE__ */ new Set(), n);
560
+ return R({ title: "", description: "", blocks: [], jsonSchema: {} });
561
+ const t = Pt(e), n = [];
562
+ ge(e.root ?? V, t, /* @__PURE__ */ new Set(), n);
538
563
  let r = "", o = "";
539
- const a = [];
540
- for (const i of n) {
541
- if (i.id === X) {
542
- r = y(i.text) ?? r;
564
+ const i = [];
565
+ for (const a of n) {
566
+ if (a.id === q) {
567
+ r = y(a.text) ?? r;
543
568
  continue;
544
569
  }
545
- if (i.id === K) {
546
- o = y(i.text) ?? o;
570
+ if (a.id === J) {
571
+ o = y(a.text) ?? o;
547
572
  continue;
548
573
  }
549
- const l = Mt(i);
550
- l && a.push(l);
574
+ const l = Mt(a);
575
+ l && i.push(l);
551
576
  }
552
- return D({ title: r, description: o, blocks: a, jsonSchema: {} });
577
+ return R({ title: r, description: o, blocks: i, jsonSchema: {} });
553
578
  }
554
- function It(e, t) {
579
+ function _t(e, t) {
555
580
  const { surfaceId: n, catalogId: r } = t, o = [
556
581
  { version: "v0.9", createSurface: { surfaceId: n, catalogId: r } },
557
582
  {
@@ -564,24 +589,24 @@ function It(e, t) {
564
589
  updateDataModel: { surfaceId: n, path: "/", value: e.dataModel }
565
590
  }), o;
566
591
  }
567
- function ge(e) {
592
+ function xe(e) {
568
593
  return !!e && typeof e == "object" && !Array.isArray(e) && Array.isArray(e.components);
569
594
  }
570
- function Et(e, t) {
595
+ function wt(e, t) {
571
596
  if (!e || typeof e != "object") return null;
572
- const n = e, r = ge(n.a2ui) ? n.a2ui : void 0;
573
- if (r && !q(r)) return r;
597
+ const n = e, r = xe(n.a2ui) ? n.a2ui : void 0;
598
+ if (r && !W(r)) return r;
574
599
  const o = Array.isArray(n.blocks) ? n.blocks : [];
575
600
  if (o.length === 0) return null;
576
- const a = he({
601
+ const i = ve({
577
602
  title: typeof n.title == "string" ? n.title : "",
578
603
  description: typeof n.description == "string" ? n.description : "",
579
604
  blocks: o
580
- }), i = ye(a, t);
581
- return q(i) ? null : i;
605
+ }), a = be(i, t);
606
+ return W(a) ? null : a;
582
607
  }
583
- function _t(e, t, n) {
584
- return ye(
608
+ function Ft(e, t, n) {
609
+ return be(
585
610
  {
586
611
  title: e.title,
587
612
  description: e.description,
@@ -590,62 +615,62 @@ function _t(e, t, n) {
590
615
  n
591
616
  );
592
617
  }
593
- function Ft(e) {
618
+ function Ot(e) {
594
619
  if (!e || typeof e != "object" || Array.isArray(e))
595
620
  return;
596
621
  const t = e;
597
- return !(Array.isArray(t.blocks) && t.blocks.length > 0) && ge(t.a2ui) ? Pt(t.a2ui) : he({
622
+ return !(Array.isArray(t.blocks) && t.blocks.length > 0) && xe(t.a2ui) ? Et(t.a2ui) : ve({
598
623
  title: typeof t.title == "string" ? t.title : "",
599
624
  description: typeof t.description == "string" ? t.description : "",
600
625
  blocks: Array.isArray(t.blocks) ? t.blocks : []
601
626
  });
602
627
  }
603
- function wt(e, t, n) {
628
+ function Dt(e, t, n) {
604
629
  const r = e.model.surfacesMap.get(t);
605
630
  if (!r) return {};
606
631
  const o = {};
607
- for (const a of n) {
608
- const i = a.trim();
609
- i && (o[i] = r.dataModel.get(`/${i}`));
632
+ for (const i of n) {
633
+ const a = i.trim();
634
+ a && (o[a] = r.dataModel.get(`/${a}`));
610
635
  }
611
636
  return o;
612
637
  }
613
- function Ot(e) {
638
+ function jt(e) {
614
639
  return e.replace(/'/g, "'\\''");
615
640
  }
616
- function xe(e, t) {
641
+ function Se(e, t) {
617
642
  const n = (t ?? "").trim() || "<callback_url>", r = JSON.stringify(e ?? {}, null, 2);
618
643
  return [
619
644
  `curl -X POST '${n}' \\`,
620
645
  " -H 'Content-Type: application/json' \\",
621
- ` -d '${Ot(r)}'`
646
+ ` -d '${jt(r)}'`
622
647
  ].join(`
623
648
  `);
624
649
  }
625
- function Dt(e) {
650
+ function Nt(e) {
626
651
  return !e || typeof e != "object" || Array.isArray(e) ? [] : Object.keys(e);
627
652
  }
628
- function jt(e, t) {
629
- const n = Dt(e), r = e ?? {}, o = (t == null ? void 0 : t.blocks) ?? [], a = new Set(
653
+ function Rt(e, t) {
654
+ const n = Nt(e), r = e ?? {}, o = (t == null ? void 0 : t.blocks) ?? [], i = new Set(
630
655
  o.filter((c) => {
631
656
  var s;
632
- return re(c.type) && ((s = c.name) == null ? void 0 : s.trim());
657
+ return oe(c.type) && ((s = c.name) == null ? void 0 : s.trim());
633
658
  }).map((c) => c.name.trim())
634
- ), i = o.filter(
659
+ ), a = o.filter(
635
660
  (c) => {
636
661
  var s;
637
- return re(c.type) && ((s = c.name) == null ? void 0 : s.trim()) && n.includes(c.name.trim());
662
+ return oe(c.type) && ((s = c.name) == null ? void 0 : s.trim()) && n.includes(c.name.trim());
638
663
  }
639
664
  ), l = {};
640
665
  for (const c of n)
641
- a.has(c) || (l[c] = r[c]);
642
- return { matchedBlocks: i, remainderPayload: l };
666
+ i.has(c) || (l[c] = r[c]);
667
+ return { matchedBlocks: a, remainderPayload: l };
643
668
  }
644
669
  async function Vt(e, t, n) {
645
670
  const r = e.trim();
646
671
  if (!r)
647
672
  throw new Error("callback_url 为空");
648
- const a = await ((n == null ? void 0 : n.fetch) ?? fetch)(r, {
673
+ const i = await ((n == null ? void 0 : n.fetch) ?? fetch)(r, {
649
674
  method: "POST",
650
675
  headers: {
651
676
  "Content-Type": "application/json",
@@ -653,22 +678,22 @@ async function Vt(e, t, n) {
653
678
  },
654
679
  body: JSON.stringify(t ?? {})
655
680
  });
656
- let i;
657
- if ((a.headers.get("content-type") ?? "").includes("application/json"))
681
+ let a;
682
+ if ((i.headers.get("content-type") ?? "").includes("application/json"))
658
683
  try {
659
- i = await a.json();
684
+ a = await i.json();
660
685
  } catch {
661
- i = void 0;
686
+ a = void 0;
662
687
  }
663
688
  else
664
689
  try {
665
- i = await a.text();
690
+ a = await i.text();
666
691
  } catch {
667
- i = void 0;
692
+ a = void 0;
668
693
  }
669
- return { ok: a.ok, status: a.status, body: i };
694
+ return { ok: i.ok, status: i.status, body: a };
670
695
  }
671
- async function Se(e) {
696
+ async function Te(e) {
672
697
  await navigator.clipboard.writeText(e);
673
698
  }
674
699
  async function zt(e) {
@@ -677,40 +702,40 @@ async function zt(e) {
677
702
  throw new Error(t.message || `请求失败 (${e.status})`);
678
703
  return t.data;
679
704
  }
680
- function gn(e = {}) {
705
+ function In(e = {}) {
681
706
  const t = (e.baseUrl ?? "/api/v1").replace(/\/$/, ""), n = e.detailPath ?? "/dev/form/detail", r = e.fetch ?? fetch;
682
- async function o(a) {
683
- var d;
684
- const i = new URLSearchParams();
685
- if (a.formId !== void 0)
686
- i.set("form_id", String(a.formId));
687
- else if (a.formUniqueId)
688
- i.set("form_unique_id", a.formUniqueId);
707
+ async function o(i) {
708
+ var m;
709
+ const a = new URLSearchParams();
710
+ if (i.formId !== void 0)
711
+ a.set("form_id", String(i.formId));
712
+ else if (i.formUniqueId)
713
+ a.set("form_unique_id", i.formUniqueId);
689
714
  else
690
715
  throw new Error("form_id 或 form_unique_id 至少传一个");
691
- const l = await ((d = e.getHeaders) == null ? void 0 : d.call(e)) ?? {}, c = await r(`${t}${n}?${i.toString()}`, {
716
+ const l = await ((m = e.getHeaders) == null ? void 0 : m.call(e)) ?? {}, c = await r(`${t}${n}?${a.toString()}`, {
692
717
  method: "GET",
693
718
  headers: l
694
- }), s = await zt(c), p = Ft(s.form_definition);
719
+ }), s = await zt(c), d = Ot(s.form_definition);
695
720
  return {
696
721
  formUniqueId: s.form_unique_id,
697
722
  formId: s.form_id,
698
723
  disabled: s.disabled === 1,
699
- formDefinition: p,
700
- a2ui: Et(s.form_definition) ?? void 0
724
+ formDefinition: d,
725
+ a2ui: wt(s.form_definition) ?? void 0
701
726
  };
702
727
  }
703
728
  return { fetchDetail: o };
704
729
  }
705
730
  const Lt = {
706
- video: Xe,
707
- audio: Ge,
708
- image: Ye,
731
+ video: qe,
732
+ audio: Ke,
733
+ image: Xe,
709
734
  file: me,
710
- spreadsheet: He,
711
- document: $e
735
+ spreadsheet: Ge,
736
+ document: Ye
712
737
  };
713
- function Rt({
738
+ function Ut({
714
739
  type: e,
715
740
  size: t = 40,
716
741
  className: n
@@ -732,25 +757,25 @@ function ke({
732
757
  }) {
733
758
  return /* @__PURE__ */ u(Ae.Provider, { value: { interactive: e }, children: t });
734
759
  }
735
- function E() {
736
- return we(Ae);
760
+ function k() {
761
+ return Oe(Ae);
737
762
  }
738
- function Ut(e) {
763
+ function Bt(e) {
739
764
  return e && typeof e == "object" && "path" in e && String(e.path ?? "").trim() || null;
740
765
  }
741
- function _(e, t = "value") {
742
- const r = e.componentModel.properties[t], o = Ut(r), a = N(
766
+ function C(e, t = "value") {
767
+ const r = e.componentModel.properties[t], o = Bt(r), i = $(
743
768
  (s) => {
744
769
  if (!o || r === void 0) return () => {
745
770
  };
746
- const p = e.dataContext.subscribeDynamicValue(r, () => s());
747
- return () => p.unsubscribe();
771
+ const d = e.dataContext.subscribeDynamicValue(r, () => s());
772
+ return () => d.unsubscribe();
748
773
  },
749
774
  [e, r, o]
750
- ), i = N(() => {
775
+ ), a = $(() => {
751
776
  if (!(!o || r === void 0))
752
777
  return e.dataContext.resolveDynamicValue(r);
753
- }, [e, r, o]), l = o ? Oe(a, i, i) : void 0, c = N(
778
+ }, [e, r, o]), l = o ? De(i, a, a) : void 0, c = $(
754
779
  (s) => {
755
780
  !o || !r || typeof r != "object" || !("path" in r) || e.dataContext.set(String(r.path), s);
756
781
  },
@@ -758,14 +783,14 @@ function _(e, t = "value") {
758
783
  );
759
784
  return { value: l, setValue: c, hasBinding: !!o };
760
785
  }
761
- function V(e) {
786
+ function _(e) {
762
787
  if (typeof e == "string") return e || void 0;
763
788
  if (typeof e == "number") return String(e);
764
789
  }
765
790
  function z(e) {
766
791
  return Array.isArray(e) ? e.map(String) : typeof e == "string" && e ? [e] : [];
767
792
  }
768
- const Te = "skopon-form-v0_9", Bt = /* @__PURE__ */ new Set([
793
+ const Ce = "skopon-form-v0_9", $t = /* @__PURE__ */ new Set([
769
794
  "SkoponMedia",
770
795
  "SkoponSelect",
771
796
  "Image",
@@ -774,17 +799,19 @@ const Te = "skopon-form-v0_9", Bt = /* @__PURE__ */ new Set([
774
799
  "ChoicePicker",
775
800
  "CheckBox",
776
801
  "DateTimeInput",
777
- "FileUpload"
778
- ]);
779
- function R(e) {
780
- const t = [...O.components.values()].find((n) => n.name === e);
802
+ "FileUpload",
803
+ "TextField",
804
+ "Text"
805
+ ]), Ht = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "caption"]);
806
+ function O(e) {
807
+ const t = [...N.components.values()].find((n) => n.name === e);
781
808
  if (!t) throw new Error(`Missing basic catalog component: ${e}`);
782
809
  return t.schema;
783
810
  }
784
- function v(e) {
811
+ function h(e) {
785
812
  return typeof e == "string" ? e : "";
786
813
  }
787
- function Ce(e) {
814
+ function Ie(e) {
788
815
  return Array.isArray(e) ? e.map((t) => {
789
816
  if (!t || typeof t != "object") return null;
790
817
  const n = t, r = String(n.value ?? n.label ?? ""), o = String(n.label ?? n.value ?? "");
@@ -797,112 +824,112 @@ function U({
797
824
  mediaSize: n,
798
825
  label: r,
799
826
  help: o,
800
- placeholder: a
827
+ placeholder: i
801
828
  }) {
802
- const i = r == null ? void 0 : r.trim(), l = o == null ? void 0 : o.trim(), c = et(n), s = (a == null ? void 0 : a.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
829
+ const a = r == null ? void 0 : r.trim(), l = o == null ? void 0 : o.trim(), c = nt(n), s = (i == null ? void 0 : i.trim()) || (e === "image" ? "未设置图片 URL" : e === "video" ? "未设置视频 URL" : "未设置音频 URL");
803
830
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
804
- i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
805
- t.length === 0 ? /* @__PURE__ */ u("div", { className: "form-media-preview form-media-preview--empty", children: s }) : /* @__PURE__ */ u("div", { className: c, children: t.map((p, d) => e === "image" ? /* @__PURE__ */ u(
831
+ a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
832
+ t.length === 0 ? /* @__PURE__ */ u("div", { className: "form-media-preview form-media-preview--empty", children: s }) : /* @__PURE__ */ u("div", { className: c, children: t.map((d, m) => e === "image" ? /* @__PURE__ */ u(
806
833
  "img",
807
834
  {
808
- src: p,
809
- alt: i || "图片",
835
+ src: d,
836
+ alt: a || "图片",
810
837
  className: "form-media-item"
811
838
  },
812
- `media-${d}`
839
+ `media-${m}`
813
840
  ) : e === "video" ? /* @__PURE__ */ u(
814
841
  "video",
815
842
  {
816
- src: p,
843
+ src: d,
817
844
  controls: !0,
818
845
  className: "form-media-item"
819
846
  },
820
- `media-${d}`
847
+ `media-${m}`
821
848
  ) : /* @__PURE__ */ u(
822
849
  "audio",
823
850
  {
824
- src: p,
851
+ src: d,
825
852
  controls: !0,
826
853
  className: "form-media-item form-media-item--audio"
827
854
  },
828
- `media-${d}`
855
+ `media-${m}`
829
856
  )) }),
830
- l ? /* @__PURE__ */ u(J.Text, { type: "secondary", className: "form-block-preview-help", children: l }) : null
857
+ l ? /* @__PURE__ */ u(E.Text, { type: "secondary", className: "form-block-preview-help", children: l }) : null
831
858
  ] });
832
859
  }
833
860
  function B(e, t) {
834
- const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : v(e.url).trim() ? [v(e.url).trim()] : [];
861
+ const n = Array.isArray(e.urls) ? e.urls.map((r) => String(r).trim()).filter(Boolean) : h(e.url).trim() ? [h(e.url).trim()] : [];
835
862
  return {
836
863
  mediaType: t,
837
864
  urls: n,
838
- mediaSize: I(e.mediaSize),
839
- label: v(e.label) || v(e.description),
840
- help: v(e.help),
841
- placeholder: v(e.placeholder)
865
+ mediaSize: F(e.mediaSize),
866
+ label: h(e.label) || h(e.description),
867
+ help: h(e.help),
868
+ placeholder: h(e.placeholder)
842
869
  };
843
870
  }
844
- const Nt = {
871
+ const Yt = {
845
872
  name: "SkoponMedia",
846
- schema: m.object({
847
- mediaType: m.any().optional(),
848
- urls: m.any().optional(),
849
- mediaSize: m.any().optional(),
850
- label: m.any().optional(),
851
- help: m.any().optional(),
852
- placeholder: m.any().optional()
873
+ schema: p.object({
874
+ mediaType: p.any().optional(),
875
+ urls: p.any().optional(),
876
+ mediaSize: p.any().optional(),
877
+ label: p.any().optional(),
878
+ help: p.any().optional(),
879
+ placeholder: p.any().optional()
853
880
  }).passthrough()
854
- }, $t = S(Nt, ({ context: e }) => {
855
- const t = e.componentModel.properties, n = v(t.mediaType);
881
+ }, Gt = x(Yt, ({ context: e }) => {
882
+ const t = e.componentModel.properties, n = h(t.mediaType);
856
883
  return /* @__PURE__ */ u(U, { ...B(t, n === "video" ? "video" : n === "audio" ? "audio" : "image") });
857
- }), Ht = S(
858
- { name: "Image", schema: R("Image") },
884
+ }), Xt = x(
885
+ { name: "Image", schema: O("Image") },
859
886
  ({ context: e }) => /* @__PURE__ */ u(U, { ...B(e.componentModel.properties, "image") })
860
- ), Yt = S(
861
- { name: "Video", schema: R("Video") },
887
+ ), Kt = x(
888
+ { name: "Video", schema: O("Video") },
862
889
  ({ context: e }) => /* @__PURE__ */ u(U, { ...B(e.componentModel.properties, "video") })
863
- ), Gt = S(
864
- { name: "AudioPlayer", schema: R("AudioPlayer") },
890
+ ), qt = x(
891
+ { name: "AudioPlayer", schema: O("AudioPlayer") },
865
892
  ({ context: e }) => /* @__PURE__ */ u(U, { ...B(e.componentModel.properties, "audio") })
866
- ), Xt = {
893
+ ), Jt = {
867
894
  name: "SkoponSelect",
868
- schema: m.object({
869
- label: m.any().optional(),
870
- mode: m.any().optional(),
871
- placeholder: m.any().optional(),
872
- options: m.any().optional(),
873
- value: m.any().optional()
895
+ schema: p.object({
896
+ label: p.any().optional(),
897
+ mode: p.any().optional(),
898
+ placeholder: p.any().optional(),
899
+ options: p.any().optional(),
900
+ value: p.any().optional()
874
901
  }).passthrough()
875
902
  };
876
- function Kt({ context: e }) {
877
- const { interactive: t } = E(), { value: n, setValue: r } = _(e), o = e.componentModel.properties, a = v(o.label), i = v(o.placeholder), l = Ce(o.options), c = v(o.mode) === "multiple";
903
+ function Wt({ context: e }) {
904
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label), a = h(o.placeholder), l = Ie(o.options), c = h(o.mode) === "multiple";
878
905
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
879
- a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
906
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
880
907
  /* @__PURE__ */ u(
881
- H,
908
+ G,
882
909
  {
883
910
  mode: c ? "multiple" : void 0,
884
911
  disabled: !t,
885
912
  allowClear: !0,
886
913
  className: "form-block-preview-control",
887
914
  style: { width: "100%" },
888
- placeholder: i || (c ? "请选择多项" : "请选择"),
915
+ placeholder: a || (c ? "请选择多项" : "请选择"),
889
916
  options: l,
890
- value: c ? z(n) : V(n),
917
+ value: c ? z(n) : _(n),
891
918
  onChange: (s) => r(c ? s ?? [] : s ?? "")
892
919
  }
893
920
  )
894
921
  ] });
895
922
  }
896
- const qt = S(
897
- Xt,
898
- Kt
923
+ const Zt = x(
924
+ Jt,
925
+ Wt
899
926
  );
900
- function Jt({ context: e }) {
901
- const { interactive: t } = E(), { value: n, setValue: r } = _(e), o = e.componentModel.properties, a = v(o.label), i = v(o.variant) || "mutuallyExclusive", l = v(o.skoponPickerType), c = v(o.placeholder), s = Ce(o.options), d = l === "select" || l === "multiselect" || l === "radio" || l === "checkbox" ? l : i === "multipleSelection" ? "checkbox" : "radio";
927
+ function Qt({ context: e }) {
928
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label), a = h(o.variant) || "mutuallyExclusive", l = h(o.skoponPickerType), c = h(o.placeholder), s = Ie(o.options), m = l === "select" || l === "multiselect" || l === "radio" || l === "checkbox" ? l : a === "multipleSelection" ? "checkbox" : "radio";
902
929
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
903
- a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
904
- d === "select" ? /* @__PURE__ */ u(
905
- H,
930
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
931
+ m === "select" ? /* @__PURE__ */ u(
932
+ G,
906
933
  {
907
934
  disabled: !t,
908
935
  allowClear: !0,
@@ -910,11 +937,11 @@ function Jt({ context: e }) {
910
937
  style: { width: "100%" },
911
938
  placeholder: c || "请选择",
912
939
  options: s,
913
- value: V(n),
940
+ value: _(n),
914
941
  onChange: (f) => r(f ?? "")
915
942
  }
916
- ) : d === "multiselect" ? /* @__PURE__ */ u(
917
- H,
943
+ ) : m === "multiselect" ? /* @__PURE__ */ u(
944
+ G,
918
945
  {
919
946
  mode: "multiple",
920
947
  disabled: !t,
@@ -926,8 +953,8 @@ function Jt({ context: e }) {
926
953
  value: z(n),
927
954
  onChange: (f) => r(f ?? [])
928
955
  }
929
- ) : d === "checkbox" ? /* @__PURE__ */ u(
930
- ze.Group,
956
+ ) : m === "checkbox" ? /* @__PURE__ */ u(
957
+ Ve.Group,
931
958
  {
932
959
  disabled: !t,
933
960
  className: "form-block-preview-control",
@@ -936,87 +963,87 @@ function Jt({ context: e }) {
936
963
  onChange: (f) => r(f)
937
964
  }
938
965
  ) : /* @__PURE__ */ u(
939
- Le.Group,
966
+ ze.Group,
940
967
  {
941
968
  disabled: !t,
942
969
  className: "form-block-preview-control",
943
970
  options: s,
944
- value: V(n),
971
+ value: _(n),
945
972
  onChange: (f) => r(f.target.value)
946
973
  }
947
974
  )
948
975
  ] });
949
976
  }
950
- const Wt = S(
977
+ const en = x(
951
978
  {
952
979
  name: "ChoicePicker",
953
- schema: m.object({
954
- label: m.any().optional(),
955
- variant: m.any().optional(),
956
- options: m.any().optional(),
957
- value: m.any().optional(),
958
- skoponPickerType: m.any().optional(),
959
- placeholder: m.any().optional()
980
+ schema: p.object({
981
+ label: p.any().optional(),
982
+ variant: p.any().optional(),
983
+ options: p.any().optional(),
984
+ value: p.any().optional(),
985
+ skoponPickerType: p.any().optional(),
986
+ placeholder: p.any().optional()
960
987
  }).passthrough()
961
988
  },
962
- Jt
989
+ Qt
963
990
  );
964
- function Zt({ context: e }) {
965
- const { interactive: t } = E(), { value: n, setValue: r } = _(e), o = e.componentModel.properties, a = v(o.label);
991
+ function tn({ context: e }) {
992
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label);
966
993
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
967
- a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
994
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
968
995
  /* @__PURE__ */ u(
969
- Re,
996
+ Le,
970
997
  {
971
998
  disabled: !t,
972
999
  className: "form-block-preview-control",
973
1000
  checked: n === !0,
974
- onChange: (i) => r(i)
1001
+ onChange: (a) => r(a)
975
1002
  }
976
1003
  )
977
1004
  ] });
978
1005
  }
979
- const Qt = S(
980
- { name: "CheckBox", schema: R("CheckBox") },
981
- Zt
1006
+ const nn = x(
1007
+ { name: "CheckBox", schema: O("CheckBox") },
1008
+ tn
982
1009
  );
983
- function en(e, t, n) {
984
- const r = V(e);
1010
+ function rn(e, t, n) {
1011
+ const r = _(e);
985
1012
  if (!r) return;
986
1013
  if (!t && n) {
987
- const a = ne(r, "HH:mm", !0);
988
- return a.isValid() ? a : void 0;
1014
+ const i = re(r, "HH:mm", !0);
1015
+ return i.isValid() ? i : void 0;
989
1016
  }
990
- const o = ne(r);
1017
+ const o = re(r);
991
1018
  return o.isValid() ? o : void 0;
992
1019
  }
993
- function tn({ context: e }) {
994
- const { interactive: t } = E(), { value: n, setValue: r } = _(e), o = e.componentModel.properties, a = v(o.label), i = v(o.placeholder), l = o.enableDate === !0, c = o.enableTime === !0, s = en(n, l, c), p = (d) => {
995
- if (!d) {
1020
+ function on({ context: e }) {
1021
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label), a = h(o.placeholder), l = o.enableDate === !0, c = o.enableTime === !0, s = rn(n, l, c), d = (m) => {
1022
+ if (!m) {
996
1023
  r("");
997
1024
  return;
998
1025
  }
999
1026
  if (!l && c) {
1000
- r(d.format("HH:mm"));
1027
+ r(m.format("HH:mm"));
1001
1028
  return;
1002
1029
  }
1003
1030
  if (l && c) {
1004
- r(d.format("YYYY-MM-DDTHH:mm"));
1031
+ r(m.format("YYYY-MM-DDTHH:mm"));
1005
1032
  return;
1006
1033
  }
1007
- r(d.format("YYYY-MM-DD"));
1034
+ r(m.format("YYYY-MM-DD"));
1008
1035
  };
1009
1036
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
1010
- a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
1037
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
1011
1038
  !l && c ? /* @__PURE__ */ u(
1012
1039
  Ue,
1013
1040
  {
1014
1041
  disabled: !t,
1015
1042
  className: "form-block-preview-control",
1016
1043
  style: { width: "100%" },
1017
- placeholder: i || "选择时间",
1044
+ placeholder: a || "选择时间",
1018
1045
  value: s,
1019
- onChange: p
1046
+ onChange: d
1020
1047
  }
1021
1048
  ) : /* @__PURE__ */ u(
1022
1049
  Be,
@@ -1025,161 +1052,230 @@ function tn({ context: e }) {
1025
1052
  disabled: !t,
1026
1053
  className: "form-block-preview-control",
1027
1054
  style: { width: "100%" },
1028
- placeholder: i || (l && c ? "选择日期时间" : "选择日期"),
1055
+ placeholder: a || (l && c ? "选择日期时间" : "选择日期"),
1029
1056
  value: s,
1030
- onChange: p
1057
+ onChange: d
1031
1058
  }
1032
1059
  )
1033
1060
  ] });
1034
1061
  }
1035
- const nn = S(
1062
+ const an = x(
1036
1063
  {
1037
1064
  name: "DateTimeInput",
1038
- schema: m.object({
1039
- label: m.any().optional(),
1040
- enableDate: m.any().optional(),
1041
- enableTime: m.any().optional(),
1042
- placeholder: m.any().optional(),
1043
- value: m.any().optional(),
1044
- min: m.any().optional(),
1045
- max: m.any().optional()
1065
+ schema: p.object({
1066
+ label: p.any().optional(),
1067
+ enableDate: p.any().optional(),
1068
+ enableTime: p.any().optional(),
1069
+ placeholder: p.any().optional(),
1070
+ value: p.any().optional(),
1071
+ min: p.any().optional(),
1072
+ max: p.any().optional()
1046
1073
  }).passthrough()
1047
1074
  },
1048
- tn
1049
- ), rn = {
1075
+ on
1076
+ ), ln = {
1050
1077
  name: "FileUpload",
1051
- schema: m.object({
1052
- label: m.any().optional(),
1053
- accept: m.any().optional(),
1054
- fileAcceptTypes: m.any().optional(),
1055
- filePlaceholderIcon: m.any().optional(),
1056
- minCount: m.any().optional(),
1057
- maxCount: m.any().optional(),
1058
- value: m.any().optional()
1078
+ schema: p.object({
1079
+ label: p.any().optional(),
1080
+ accept: p.any().optional(),
1081
+ fileAcceptTypes: p.any().optional(),
1082
+ filePlaceholderIcon: p.any().optional(),
1083
+ minCount: p.any().optional(),
1084
+ maxCount: p.any().optional(),
1085
+ value: p.any().optional()
1059
1086
  }).passthrough()
1060
1087
  };
1061
- function on({ context: e }) {
1062
- const { interactive: t } = E(), { value: n, setValue: r } = _(e), o = e.componentModel.properties, a = v(o.label), i = v(o.accept), l = Array.isArray(o.fileAcceptTypes) ? o.fileAcceptTypes.map(String) : void 0, c = i ? i.split(",").map((h) => h.trim()).filter(Boolean) : void 0, s = mt(l, c), p = typeof o.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
1088
+ function cn({ context: e }) {
1089
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label), a = h(o.accept), l = Array.isArray(o.fileAcceptTypes) ? o.fileAcceptTypes.map(String) : void 0, c = a ? a.split(",").map((v) => v.trim()).filter(Boolean) : void 0, s = ft(l, c), d = typeof o.filePlaceholderIcon == "string" && ["video", "audio", "image", "file", "spreadsheet", "document"].includes(
1063
1090
  o.filePlaceholderIcon
1064
- ) ? o.filePlaceholderIcon : "document", d = typeof o.maxCount == "number" ? o.maxCount : 1, f = z(n);
1091
+ ) ? o.filePlaceholderIcon : "document", m = typeof o.maxCount == "number" ? o.maxCount : 1, f = z(n);
1065
1092
  return /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
1066
- a ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: a }) : null,
1093
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
1067
1094
  /* @__PURE__ */ b(
1068
- ee.Dragger,
1095
+ te.Dragger,
1069
1096
  {
1070
1097
  disabled: !t,
1071
- accept: pt(l, c),
1098
+ accept: mt(l, c),
1072
1099
  className: "form-file-upload-preview",
1073
1100
  showUploadList: t && f.length > 0,
1074
- fileList: t ? f.map((h, A) => ({
1075
- uid: `${A}-${h}`,
1076
- name: h,
1101
+ fileList: t ? f.map((v, T) => ({
1102
+ uid: `${T}-${v}`,
1103
+ name: v,
1077
1104
  status: "done"
1078
1105
  })) : [],
1079
- beforeUpload: (h) => {
1080
- if (!t) return ee.LIST_IGNORE;
1081
- const A = [...f, h.name].slice(0, Math.max(1, d));
1082
- return r(A), !1;
1106
+ beforeUpload: (v) => {
1107
+ if (!t) return te.LIST_IGNORE;
1108
+ const T = [...f, v.name].slice(0, Math.max(1, m));
1109
+ return r(T), !1;
1083
1110
  },
1084
- onRemove: (h) => {
1085
- r(f.filter((A) => A !== h.name));
1111
+ onRemove: (v) => {
1112
+ r(f.filter((T) => T !== v.name));
1086
1113
  },
1087
1114
  children: [
1088
- /* @__PURE__ */ u("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ u(Rt, { type: p, size: 40 }) }),
1115
+ /* @__PURE__ */ u("p", { className: "form-file-upload-preview-icon", children: /* @__PURE__ */ u(Ut, { type: d, size: 40 }) }),
1089
1116
  /* @__PURE__ */ u("p", { className: "form-file-upload-preview-text", children: "点击或拖拽文件到此处上传" })
1090
1117
  ]
1091
1118
  }
1092
1119
  ),
1093
- /* @__PURE__ */ b(J.Text, { type: "secondary", className: "form-block-preview-help", children: [
1120
+ /* @__PURE__ */ b(E.Text, { type: "secondary", className: "form-block-preview-help", children: [
1094
1121
  "允许:",
1095
1122
  s ?? "全部类型"
1096
1123
  ] })
1097
1124
  ] });
1098
1125
  }
1099
- const an = S(
1100
- rn,
1101
- on
1126
+ const sn = x(
1127
+ ln,
1128
+ cn
1129
+ );
1130
+ function un({ context: e }) {
1131
+ const { interactive: t } = k(), { value: n, setValue: r } = C(e), o = e.componentModel.properties, i = h(o.label), a = h(o.placeholder), l = h(o.variant) || "shortText", c = _(n) ?? "", s = !t, d = "form-block-preview-control";
1132
+ let m;
1133
+ return l === "longText" ? m = /* @__PURE__ */ u(
1134
+ H.TextArea,
1135
+ {
1136
+ disabled: s,
1137
+ className: d,
1138
+ placeholder: a || "长文本回答...",
1139
+ autoSize: { minRows: 2, maxRows: 6 },
1140
+ value: c,
1141
+ onChange: (f) => r(f.target.value)
1142
+ }
1143
+ ) : l === "number" ? m = /* @__PURE__ */ u(
1144
+ $e,
1145
+ {
1146
+ disabled: s,
1147
+ className: d,
1148
+ style: { width: "100%" },
1149
+ placeholder: a || "数字",
1150
+ value: c ? Number(c) : void 0,
1151
+ onChange: (f) => r(f == null ? "" : String(f))
1152
+ }
1153
+ ) : l === "obscured" ? m = /* @__PURE__ */ u(
1154
+ H.Password,
1155
+ {
1156
+ disabled: s,
1157
+ className: d,
1158
+ placeholder: a,
1159
+ value: c,
1160
+ onChange: (f) => r(f.target.value)
1161
+ }
1162
+ ) : m = /* @__PURE__ */ u(
1163
+ H,
1164
+ {
1165
+ disabled: s,
1166
+ className: d,
1167
+ placeholder: a,
1168
+ value: c,
1169
+ onChange: (f) => r(f.target.value)
1170
+ }
1171
+ ), /* @__PURE__ */ b("div", { className: "form-block-preview", children: [
1172
+ i ? /* @__PURE__ */ u("div", { className: "form-block-preview-label", children: i }) : null,
1173
+ m
1174
+ ] });
1175
+ }
1176
+ const pn = x(
1177
+ {
1178
+ name: "TextField",
1179
+ schema: p.object({
1180
+ label: p.any().optional(),
1181
+ variant: p.any().optional(),
1182
+ placeholder: p.any().optional(),
1183
+ validationRegexp: p.any().optional(),
1184
+ value: p.any().optional()
1185
+ }).passthrough()
1186
+ },
1187
+ un
1102
1188
  );
1103
- function Me() {
1189
+ function dn({ context: e }) {
1190
+ const t = e.componentModel.properties, n = h(t.text), r = h(t.variant) || "body";
1191
+ return Ht.has(r) ? r === "caption" ? /* @__PURE__ */ u(E.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(E.Paragraph, { className: "form-block-preview-paragraph", children: n });
1192
+ }
1193
+ const mn = x(
1194
+ { name: "Text", schema: O("Text") },
1195
+ dn
1196
+ );
1197
+ function Pe() {
1104
1198
  const t = [
1105
- ...[...O.components.values()].filter(
1106
- (r) => !Bt.has(r.name)
1199
+ ...[...N.components.values()].filter(
1200
+ (r) => !$t.has(r.name)
1107
1201
  ),
1108
- $t,
1109
- qt,
1110
- Ht,
1111
- Yt,
1112
1202
  Gt,
1113
- Wt,
1114
- Qt,
1203
+ Zt,
1204
+ Xt,
1205
+ Kt,
1206
+ qt,
1207
+ en,
1115
1208
  nn,
1116
- an
1117
- ], n = [...O.functions.values()];
1118
- return new Ve(Te, t, n, O.themeSchema);
1119
- }
1120
- const ln = De(
1209
+ an,
1210
+ sn,
1211
+ pn,
1212
+ mn
1213
+ ], n = [...N.functions.values()];
1214
+ return new Re(Ce, t, n, N.themeSchema);
1215
+ }
1216
+ const fn = je(
1121
1217
  function({
1122
1218
  doc: t,
1123
1219
  surfaceId: n = "skopon-form",
1124
1220
  emptyHint: r = null,
1125
1221
  interactive: o = !0,
1126
- fieldNames: a = []
1127
- }, i) {
1128
- C(() => {
1129
- ue(), ce();
1222
+ fieldNames: i = []
1223
+ }, a) {
1224
+ P(() => {
1225
+ pe(), se();
1130
1226
  }, []);
1131
- const l = M(null), c = M(a);
1132
- c.current = a;
1133
- const s = k(() => {
1134
- if (q(t))
1227
+ const l = M(null), c = M(i);
1228
+ c.current = i;
1229
+ const s = A(() => {
1230
+ if (W(t))
1135
1231
  return l.current = null, [];
1136
1232
  try {
1137
- const p = new le([Me()]), d = It(t, {
1233
+ const d = new ce([Pe()]), m = _t(t, {
1138
1234
  surfaceId: n,
1139
- catalogId: Te
1235
+ catalogId: Ce
1140
1236
  });
1141
- return p.processMessages(d), l.current = p, Array.from(p.model.surfacesMap.values());
1142
- } catch (p) {
1143
- return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", p), l.current = null, [];
1237
+ return d.processMessages(m), l.current = d, Array.from(d.model.surfacesMap.values());
1238
+ } catch (d) {
1239
+ return console.error("[SkoponFormRenderer] 渲染 A2UI surface 失败", d), l.current = null, [];
1144
1240
  }
1145
1241
  }, [t, n]);
1146
- return je(
1147
- i,
1242
+ return Ne(
1243
+ a,
1148
1244
  () => ({
1149
- getValues(p) {
1150
- const d = l.current;
1151
- if (!d) return {};
1152
- const f = (p ?? c.current).map((h) => h.trim()).filter(Boolean);
1153
- return wt(d, n, f);
1245
+ getValues(d) {
1246
+ const m = l.current;
1247
+ if (!m) return {};
1248
+ const f = (d ?? c.current).map((v) => v.trim()).filter(Boolean);
1249
+ return Dt(m, n, f);
1154
1250
  }
1155
1251
  }),
1156
1252
  [n]
1157
- ), s.length === 0 ? /* @__PURE__ */ u(ae, { children: r }) : /* @__PURE__ */ u(ke, { interactive: o, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: s.map((p) => /* @__PURE__ */ u(se, { surface: p }, p.id)) }) });
1253
+ ), s.length === 0 ? /* @__PURE__ */ u(le, { children: r }) : /* @__PURE__ */ u(ke, { interactive: o, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: s.map((d) => /* @__PURE__ */ u(ue, { surface: d }, d.id)) }) });
1158
1254
  }
1159
1255
  );
1160
- function xn({
1256
+ function Pn({
1161
1257
  messages: e,
1162
1258
  surfaceId: t = "skopon-form-stream",
1163
1259
  emptyHint: n = null,
1164
1260
  interactive: r = !0
1165
1261
  }) {
1166
- C(() => {
1167
- ue(), ce();
1262
+ P(() => {
1263
+ pe(), se();
1168
1264
  }, []);
1169
- const o = M(null), a = M(0), i = k(() => {
1170
- const s = new le([Me()]);
1171
- return o.current = s, a.current = 0, s;
1172
- }, [t]), [l, c] = w(() => Array.from(i.model.surfacesMap.values()));
1173
- return C(() => {
1174
- const s = () => c(Array.from(i.model.surfacesMap.values())), p = i.onSurfaceCreated(s), d = i.onSurfaceDeleted(s);
1265
+ const o = M(null), i = M(0), a = A(() => {
1266
+ const s = new ce([Pe()]);
1267
+ return o.current = s, i.current = 0, s;
1268
+ }, [t]), [l, c] = j(() => Array.from(a.model.surfacesMap.values()));
1269
+ return P(() => {
1270
+ const s = () => c(Array.from(a.model.surfacesMap.values())), d = a.onSurfaceCreated(s), m = a.onSurfaceDeleted(s);
1175
1271
  return () => {
1176
- p.unsubscribe(), d.unsubscribe();
1272
+ d.unsubscribe(), m.unsubscribe();
1177
1273
  };
1178
- }, [i]), C(() => {
1274
+ }, [a]), P(() => {
1179
1275
  if (!Array.isArray(e) || e.length === 0) return;
1180
- const s = e.slice(a.current);
1181
- s.length !== 0 && (i.processMessages(s), a.current = e.length, c(Array.from(i.model.surfacesMap.values())));
1182
- }, [e, i]), l.length === 0 ? /* @__PURE__ */ u(ae, { children: n }) : /* @__PURE__ */ u(ke, { interactive: r, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: l.map((s) => /* @__PURE__ */ u(se, { surface: s }, s.id)) }) });
1276
+ const s = e.slice(i.current);
1277
+ s.length !== 0 && (a.processMessages(s), i.current = e.length, c(Array.from(a.model.surfacesMap.values())));
1278
+ }, [e, a]), l.length === 0 ? /* @__PURE__ */ u(le, { children: n }) : /* @__PURE__ */ u(ke, { interactive: r, children: /* @__PURE__ */ u("div", { className: "a2ui-surface a2ui-container", children: l.map((s) => /* @__PURE__ */ u(ue, { surface: s }, s.id)) }) });
1183
1279
  }
1184
1280
  function ie({
1185
1281
  payload: e,
@@ -1187,146 +1283,146 @@ function ie({
1187
1283
  title: n,
1188
1284
  unpublishedFormId: r,
1189
1285
  incompleteFormId: o,
1190
- onNotify: a
1286
+ onNotify: i
1191
1287
  }) {
1192
- const i = k(
1193
- () => xe(e, t),
1288
+ const a = A(
1289
+ () => Se(e, t),
1194
1290
  [e, t]
1195
1291
  );
1196
1292
  async function l() {
1197
1293
  try {
1198
- await Se(i), a == null || a("success", "已复制到剪贴板");
1294
+ await Te(a), i == null || i("success", "已复制到剪贴板");
1199
1295
  } catch {
1200
- a == null || a("error", "复制失败");
1296
+ i == null || i("error", "复制失败");
1201
1297
  }
1202
1298
  }
1203
1299
  return /* @__PURE__ */ b("div", { className: "ask-user-curl-card", children: [
1204
1300
  /* @__PURE__ */ b("div", { className: "ask-user-curl-card-header", children: [
1205
1301
  /* @__PURE__ */ b("div", { className: "ask-user-curl-card-header-title", children: [
1206
- /* @__PURE__ */ u(J.Text, { type: "secondary", children: n ?? "curl 命令" }),
1207
- r ? /* @__PURE__ */ u(Y, { title: r, children: /* @__PURE__ */ u(te, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
1208
- o ? /* @__PURE__ */ u(Y, { title: o, children: /* @__PURE__ */ u(te, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
1302
+ /* @__PURE__ */ u(E.Text, { type: "secondary", children: n ?? "curl 命令" }),
1303
+ r ? /* @__PURE__ */ u(X, { title: r, children: /* @__PURE__ */ u(ne, { className: "ask-user-curl-unpublished-tag", children: "卡片 ID 未发布" }) }) : null,
1304
+ o ? /* @__PURE__ */ u(X, { title: o, children: /* @__PURE__ */ u(ne, { className: "ask-user-curl-incomplete-tag", children: "卡片 ID 待补足" }) }) : null
1209
1305
  ] }),
1210
- /* @__PURE__ */ u(pe, { size: "small", type: "text", onClick: () => void l(), children: "复制" })
1306
+ /* @__PURE__ */ u(de, { size: "small", type: "text", onClick: () => void l(), children: "复制" })
1211
1307
  ] }),
1212
- /* @__PURE__ */ u("pre", { className: "skopon-form-curl-json", children: i })
1308
+ /* @__PURE__ */ u("pre", { className: "skopon-form-curl-json", children: a })
1213
1309
  ] });
1214
1310
  }
1215
- function Sn({
1311
+ function Mn({
1216
1312
  payload: e,
1217
1313
  formUniqueId: t,
1218
1314
  callbackUrl: n,
1219
1315
  submitMode: r = "curl",
1220
1316
  fetchFormDetail: o,
1221
- onNotify: a
1317
+ onNotify: i
1222
1318
  }) {
1223
- const [i, l] = w(null), [c, s] = w(!1), [p, d] = w(!0), f = M(null);
1224
- C(() => {
1319
+ const [a, l] = j(null), [c, s] = j(!1), [d, m] = j(!0), f = M(null);
1320
+ P(() => {
1225
1321
  let g = !1;
1226
- return d(!0), s(!1), o({ formUniqueId: t }).then((x) => {
1227
- g || (s(!!x.disabled), l(x.disabled ? null : x.formDefinition ?? null));
1322
+ return m(!0), s(!1), o({ formUniqueId: t }).then((S) => {
1323
+ g || (s(!!S.disabled), l(S.disabled ? null : S.formDefinition ?? null));
1228
1324
  }).catch(() => {
1229
1325
  g || (s(!1), l(null));
1230
1326
  }).finally(() => {
1231
- g || d(!1);
1327
+ g || m(!1);
1232
1328
  }), () => {
1233
1329
  g = !0;
1234
1330
  };
1235
1331
  }, [t, o]);
1236
- const { matchedBlocks: h, remainderPayload: A } = k(
1237
- () => jt(e, i ?? void 0),
1238
- [e, i]
1239
- ), Z = k(
1240
- () => h.map((g) => {
1241
- var x;
1242
- return (x = g.name) == null ? void 0 : x.trim();
1332
+ const { matchedBlocks: v, remainderPayload: T } = A(
1333
+ () => Rt(e, a ?? void 0),
1334
+ [e, a]
1335
+ ), Q = A(
1336
+ () => v.map((g) => {
1337
+ var S;
1338
+ return (S = g.name) == null ? void 0 : S.trim();
1243
1339
  }).filter((g) => !!g),
1244
- [h]
1245
- ), Pe = k(() => !i || h.length === 0 ? null : _t(i, h), [i, h]);
1246
- if (p)
1247
- return /* @__PURE__ */ u("div", { className: "ask-user-form-card", children: /* @__PURE__ */ u(Ne, { size: "small" }) });
1248
- if (h.length === 0)
1340
+ [v]
1341
+ ), Me = A(() => !a || v.length === 0 ? null : Ft(a, v), [a, v]);
1342
+ if (d)
1343
+ return /* @__PURE__ */ u("div", { className: "ask-user-form-card", children: /* @__PURE__ */ u(He, { size: "small" }) });
1344
+ if (v.length === 0)
1249
1345
  return /* @__PURE__ */ u(
1250
1346
  ie,
1251
1347
  {
1252
1348
  payload: e,
1253
1349
  callbackUrl: n,
1254
1350
  unpublishedFormId: c ? t : void 0,
1255
- onNotify: a
1351
+ onNotify: i
1256
1352
  }
1257
1353
  );
1258
- const Ie = Object.keys(A).length > 0;
1259
- async function Ee() {
1260
- var x;
1261
- const g = ((x = f.current) == null ? void 0 : x.getValues(Z)) ?? {};
1354
+ const Ee = Object.keys(T).length > 0;
1355
+ async function _e() {
1356
+ var S;
1357
+ const g = ((S = f.current) == null ? void 0 : S.getValues(Q)) ?? {};
1262
1358
  if (r === "post") {
1263
- const Q = (n ?? "").trim();
1264
- if (!Q) {
1265
- a == null || a("error", "callback_url 为空,无法提交");
1359
+ const ee = (n ?? "").trim();
1360
+ if (!ee) {
1361
+ i == null || i("error", "callback_url 为空,无法提交");
1266
1362
  return;
1267
1363
  }
1268
1364
  try {
1269
- const T = await Vt(Q, g);
1270
- T.ok ? a == null || a("success", "提交成功") : a == null || a("error", `提交失败 (${T.status})`);
1271
- } catch (T) {
1272
- const _e = T instanceof Error ? T.message : "提交失败";
1273
- a == null || a("error", _e);
1365
+ const I = await Vt(ee, g);
1366
+ I.ok ? i == null || i("success", "提交成功") : i == null || i("error", `提交失败 (${I.status})`);
1367
+ } catch (I) {
1368
+ const we = I instanceof Error ? I.message : "提交失败";
1369
+ i == null || i("error", we);
1274
1370
  }
1275
1371
  return;
1276
1372
  }
1277
1373
  try {
1278
- await Se(xe(g, n)), a == null || a("success", "已复制 curl 到剪贴板");
1374
+ await Te(Se(g, n)), i == null || i("success", "已复制 curl 到剪贴板");
1279
1375
  } catch {
1280
- a == null || a("error", "复制失败");
1376
+ i == null || i("error", "复制失败");
1281
1377
  }
1282
1378
  }
1283
1379
  return /* @__PURE__ */ b("div", { className: "ask-user-form-card", children: [
1284
1380
  /* @__PURE__ */ u(
1285
- ln,
1381
+ fn,
1286
1382
  {
1287
1383
  ref: f,
1288
- doc: Pe,
1384
+ doc: Me,
1289
1385
  surfaceId: `ask-user-${t}`,
1290
- fieldNames: Z,
1386
+ fieldNames: Q,
1291
1387
  interactive: !0
1292
1388
  }
1293
1389
  ),
1294
- /* @__PURE__ */ u("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ u(Y, { title: r === "curl" ? "点击复制 curl" : "提交 JSON 到 callback_url", children: /* @__PURE__ */ u(pe, { type: "primary", size: "small", onClick: () => void Ee(), children: "提交" }) }) }),
1295
- Ie ? /* @__PURE__ */ u(
1390
+ /* @__PURE__ */ u("div", { className: "ask-user-form-actions", children: /* @__PURE__ */ u(X, { title: r === "curl" ? "点击复制 curl" : "提交 JSON 到 callback_url", children: /* @__PURE__ */ u(de, { type: "primary", size: "small", onClick: () => void _e(), children: "提交" }) }) }),
1391
+ Ee ? /* @__PURE__ */ u(
1296
1392
  ie,
1297
1393
  {
1298
- payload: A,
1394
+ payload: T,
1299
1395
  callbackUrl: n,
1300
1396
  title: "以下字段不在表单中,请使用 curl 提交",
1301
1397
  incompleteFormId: t,
1302
- onNotify: a
1398
+ onNotify: i
1303
1399
  }
1304
1400
  ) : null
1305
1401
  ] });
1306
1402
  }
1307
1403
  export {
1308
- bn as A2UI_PROTOCOL_VERSION,
1309
- Sn as AskUserFormCard,
1404
+ Cn as A2UI_PROTOCOL_VERSION,
1405
+ Mn as AskUserFormCard,
1310
1406
  ie as CurlSubmitBlock,
1311
- Ke as FORM_MEDIA_SIZES,
1312
- xn as SkoponA2uiStreamRenderer,
1313
- ln as SkoponFormRenderer,
1314
- Pt as a2uiToBlocks,
1315
- ye as blocksToA2ui,
1316
- _t as buildAskUserSurface,
1317
- xe as buildCurlStatement,
1318
- Se as copyTextToClipboard,
1319
- gn as createFormClient,
1320
- wt as extractSurfaceValues,
1321
- jt as intersectPayloadWithForm,
1322
- q as isA2uiSurfaceEmpty,
1323
- re as isInputBlockType,
1324
- qe as isLayoutBlockType,
1325
- G as isMediaBlockType,
1326
- Ft as mapFormDefinitionFromDto,
1327
- he as normalizeFormDefinition,
1328
- Et as resolveSurfaceFromFormDefinition,
1407
+ Je as FORM_MEDIA_SIZES,
1408
+ Pn as SkoponA2uiStreamRenderer,
1409
+ fn as SkoponFormRenderer,
1410
+ Et as a2uiToBlocks,
1411
+ be as blocksToA2ui,
1412
+ Ft as buildAskUserSurface,
1413
+ Se as buildCurlStatement,
1414
+ Te as copyTextToClipboard,
1415
+ In as createFormClient,
1416
+ Dt as extractSurfaceValues,
1417
+ Rt as intersectPayloadWithForm,
1418
+ W as isA2uiSurfaceEmpty,
1419
+ oe as isInputBlockType,
1420
+ We as isLayoutBlockType,
1421
+ K as isMediaBlockType,
1422
+ Ot as mapFormDefinitionFromDto,
1423
+ ve as normalizeFormDefinition,
1424
+ wt as resolveSurfaceFromFormDefinition,
1329
1425
  Vt as submitFormJson,
1330
- It as surfaceDocToMessages,
1331
- D as syncFormDefinition
1426
+ _t as surfaceDocToMessages,
1427
+ R as syncFormDefinition
1332
1428
  };