@blocklet/pages-kit-inner-components 0.4.32 → 0.4.34

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/lib/es/setting.js CHANGED
@@ -1,145 +1,410 @@
1
- import { jsx as e, jsxs as w, Fragment as U } from "react/jsx-runtime";
2
- import { g as re, i as Te, b as Ke, h as le, E as tt, n as rt, j as ae } from "./_chunks/state-CVCmClC_.js";
3
- import { TextField as O, Stack as D, FormControlLabel as Ne, Switch as Be, Box as P, InputAdornment as oe, Dialog as pe, DialogTitle as Ue, DialogContent as We, DialogActions as Ve, Button as A, alpha as it, Tooltip as Q, buttonClasses as nt, Typography as V, Autocomplete as Fe, Paper as me, MenuItem as R, FormLabel as lt, Popper as _e, Table as ot, TableHead as st, TableRow as Oe, TableCell as ze, TableBody as ct } from "@blocklet/pages-kit/builtin/mui/material";
4
- import { forwardRef as Ee, useState as ie, useEffect as X, useImperativeHandle as He, lazy as dt, useCallback as ne, Suspense as ut, useRef as Z, useId as at, useMemo as pt } from "@blocklet/pages-kit/builtin/react";
5
- import he from "@arcblock/ux/lib/Empty";
6
- import { useLocaleContext as j } from "@blocklet/pages-kit/builtin/locale";
7
- import { styled as mt } from "@arcblock/ux/lib/Theme";
8
- import { cx as ht } from "@emotion/css";
9
- import { useReactive as ft, useBoolean as bt, useUpdate as yt } from "ahooks";
10
- import Re from "gradient-parser";
1
+ import { jsx as t, jsxs as S, Fragment as J } from "react/jsx-runtime";
2
+ import { g as oe, i as _e, b as Fe, h as ue, E as xt, n as Je, j as xe } from "./_chunks/state-CVCmClC_.js";
3
+ import te from "@arcblock/ux/lib/Empty";
4
+ import { useLocaleContext as N } from "@blocklet/pages-kit/builtin/locale";
5
+ import { CodeEditor as ge } from "@blocklet/code-editor";
6
+ import gt from "@mui/icons-material/AddRounded";
7
+ import kt from "@mui/icons-material/ArrowDownward";
8
+ import wt from "@mui/icons-material/ArrowUpward";
9
+ import Pt from "@mui/icons-material/DeleteOutline";
10
+ import { Typography as K, TextField as D, Stack as j, FormLabel as ne, Box as O, TableContainer as It, Paper as re, Table as $e, TableHead as Me, TableRow as se, TableCell as ce, TableBody as He, Button as A, IconButton as ke, FormControlLabel as Ye, Switch as Ge, InputAdornment as pe, Dialog as we, DialogTitle as qe, DialogContent as Le, DialogActions as Qe, alpha as St, Tooltip as X, buttonClasses as Ot, Autocomplete as Xe, MenuItem as he, Popper as Ze, Divider as jt } from "@blocklet/pages-kit/builtin/mui/material";
11
+ import T from "lodash/sortBy";
12
+ import { useMemo as de, useCallback as V, forwardRef as et, useState as Z, useEffect as $, useImperativeHandle as tt, lazy as zt, Suspense as Rt, useRef as F, useId as Dt } from "@blocklet/pages-kit/builtin/react";
13
+ import { useUpdate as rt, useDebounce as Nt } from "react-use";
14
+ import { styled as At } from "@arcblock/ux/lib/Theme";
15
+ import { cx as Ct } from "@emotion/css";
16
+ import { useReactive as Vt, useBoolean as Tt, useUpdate as Et } from "ahooks";
17
+ import Ee from "gradient-parser";
11
18
  import "lodash/without";
12
- import vt from "tinycolor2";
13
- import { red as xt, pink as gt, purple as kt, indigo as It, blue as wt, cyan as St, teal as Pt, green as Ct, lime as Dt, yellow as Ot, amber as zt, orange as Rt, brown as jt, grey as At, blueGrey as Tt } from "@mui/material/colors";
14
- import { getImageSize as de, getVideoSize as ue, UploaderButton as fe, UploaderProvider as be, useUploader as Kt } from "./uploader.js";
15
- import { Icon as Nt } from "@iconify-icon/react";
16
- import { useDebounce as Bt, useUpdate as Ut } from "react-use";
17
- import { sortBy as F, omit as Wt, isNil as L, isEmpty as Vt } from "lodash";
18
- import je from "@arcblock/ux/lib/Toast";
19
- import { CodeEditor as Je } from "@blocklet/code-editor";
20
- import { CustomComponentRenderer as Me, transpileAndLoadScript as Ft, getPropertiesFromCode as _t } from "@blocklet/pages-kit/components";
21
- import { ClickAwayListener as $e, unstable_useNumberInput as Et } from "@mui/base";
22
- import { VisibilityOffRounded as Ht, VisibilityRounded as Jt, DeleteOutlineRounded as Mt, DragIndicatorRounded as $t, AddRounded as Yt, TranslateRounded as Ye, InfoRounded as Ge, SettingsRounded as qe, StarRounded as Gt } from "@mui/icons-material";
23
- import { getYjsValue as _ } from "@syncedstore/core";
24
- import qt from "lodash/has";
25
- import Qt from "lodash/keyBy";
26
- import Xt from "lodash/pick";
27
- import { usePopupState as se, bindTrigger as ce, bindDialog as Qe, bindPopper as Xe } from "material-ui-popup-state/hooks";
28
- import { ErrorBoundary as Zt } from "react-error-boundary";
29
- import Lt from "lodash/sortBy";
30
- import { useDrop as Ze, useDrag as er } from "react-dnd";
31
- xt[300], gt[300], kt[300], // deepPurple['300'],
32
- It[300], wt[300], // lightBlue['300'],
33
- St[300], Pt[300], Ct[300], // lightGreen['300'],
34
- Dt[300], Ot[300], zt[300], Rt[300], // deepOrange['300'],
35
- jt[300], At[300], Tt[300];
36
- const tr = Ee(function({ showMarkdown: r, markdown: i, onMarkdownChange: n, showUploader: u, value: v, meta: c, onChange: a, ...k }, l) {
37
- const [y, f] = ie("");
38
- X(() => {
39
- f(v || "");
40
- }, [v, f]);
41
- const p = async () => {
42
- if (y !== v) {
43
- const o = re(y);
44
- if (!o) {
45
- a(y, void 0);
19
+ import Ut from "tinycolor2";
20
+ import { red as Wt, pink as Bt, purple as Kt, indigo as _t, blue as Ft, cyan as Jt, teal as $t, green as Mt, lime as Ht, yellow as Yt, amber as Gt, orange as qt, brown as Lt, grey as Qt, blueGrey as Xt } from "@mui/material/colors";
21
+ import { getImageSize as be, getVideoSize as ye, UploaderButton as Pe, UploaderProvider as Ie, useUploader as Zt } from "./uploader.js";
22
+ import { Icon as er } from "@iconify-icon/react";
23
+ import it from "lodash/isEmpty";
24
+ import lt from "lodash/set";
25
+ import * as ae from "yaml";
26
+ import "lodash";
27
+ import Ue from "@arcblock/ux/lib/Toast";
28
+ import { CustomComponentRenderer as ot, transpileAndLoadScript as tr, getPropertiesFromCode as rr } from "@blocklet/pages-kit/components";
29
+ import { unstable_useNumberInput as ir, ClickAwayListener as nt } from "@mui/base";
30
+ import { VisibilityOffRounded as lr, VisibilityRounded as or, DeleteOutlineRounded as nr, DragIndicatorRounded as sr, TranslateRounded as st, AddRounded as ct, InfoRounded as dt, StarRounded as cr, SettingsRounded as at } from "@mui/icons-material";
31
+ import { alpha as We } from "@mui/material/styles";
32
+ import { getYjsValue as M } from "@syncedstore/core";
33
+ import dr from "lodash/assign";
34
+ import ar from "lodash/has";
35
+ import ee from "lodash/isNil";
36
+ import ur from "lodash/isObject";
37
+ import pr from "lodash/keyBy";
38
+ import mr from "lodash/omit";
39
+ import fr from "lodash/pick";
40
+ import hr from "lodash/reduce";
41
+ import { usePopupState as me, bindTrigger as fe, bindDialog as ut, bindPopper as pt } from "material-ui-popup-state/hooks";
42
+ import { ErrorBoundary as br } from "react-error-boundary";
43
+ import { useDrop as mt, useDrag as yr } from "react-dnd";
44
+ function vr({
45
+ onClick: e,
46
+ disabled: r,
47
+ sx: l,
48
+ ...i
49
+ }) {
50
+ return /* @__PURE__ */ t(ke, { size: "small", color: "warning", variant: "outlined", disabled: r, onClick: e, ...i, children: /* @__PURE__ */ t(Pt, { fontSize: "small" }) });
51
+ }
52
+ function xr({
53
+ onClick: e,
54
+ disabled: r,
55
+ sx: l,
56
+ ...i
57
+ }) {
58
+ return /* @__PURE__ */ t(ke, { size: "small", color: "primary", disabled: r, onClick: e, ...i, children: /* @__PURE__ */ t(wt, { fontSize: "small" }) });
59
+ }
60
+ function gr({
61
+ onClick: e,
62
+ disabled: r,
63
+ sx: l,
64
+ ...i
65
+ }) {
66
+ return /* @__PURE__ */ t(ke, { size: "small", color: "primary", disabled: r, onClick: e, ...i, children: /* @__PURE__ */ t(kt, { fontSize: "small" }) });
67
+ }
68
+ function kr({
69
+ label: e,
70
+ value: r,
71
+ onChange: l,
72
+ disabled: i = !1,
73
+ itemLabel: c = "",
74
+ emptyHeight: b = 40,
75
+ property: a,
76
+ renderItem: u,
77
+ ...k
78
+ }) {
79
+ const { t: h, locale: g } = N(), y = rt(), o = de(() => Array.isArray(r) ? r : [], [r]), p = V(() => {
80
+ const f = [...o, ""];
81
+ l(f), y();
82
+ }, [o, l, y]), s = V(() => {
83
+ if (!a || !a.subProperties)
84
+ return p();
85
+ const f = {};
86
+ T(Object.values(a.subProperties), "index").forEach(({ data: R }) => {
87
+ var E, U;
88
+ if (!R.key) return;
89
+ const C = ((U = (E = R.locales) == null ? void 0 : E[g]) == null ? void 0 : U.defaultValue) ?? "";
90
+ f[R.key] = C;
91
+ });
92
+ const z = [...o, f];
93
+ l(z), y();
94
+ }, [o, l, y, a, g, p]), d = V(
95
+ (f) => {
96
+ try {
97
+ const P = JSON.parse(f);
98
+ Array.isArray(P) ? l(P) : console.error("JSON解析结果不是数组");
99
+ } catch (P) {
100
+ console.error("JSON解析错误:", P);
101
+ }
102
+ },
103
+ [l]
104
+ ), m = V(
105
+ (f) => {
106
+ const P = o.filter((z, R) => R !== f);
107
+ l(P), y();
108
+ },
109
+ [o, l, y]
110
+ ), w = V(
111
+ (f) => {
112
+ if (f <= 0) return;
113
+ const P = [...o], z = P[f];
114
+ P[f] = P[f - 1], P[f - 1] = z, l(P), y();
115
+ },
116
+ [o, l, y]
117
+ ), n = V(
118
+ (f) => {
119
+ if (f >= o.length - 1) return;
120
+ const P = [...o], z = P[f];
121
+ P[f] = P[f + 1], P[f + 1] = z, l(P), y();
122
+ },
123
+ [o, l, y]
124
+ ), v = V(
125
+ (f, P) => {
126
+ const z = [...o];
127
+ z[f] = P, l(z);
128
+ },
129
+ [o, l]
130
+ ), x = a && a.subProperties && Object.keys(a.subProperties).length > 0, I = de(() => [
131
+ {
132
+ field: "index",
133
+ headerName: "#",
134
+ width: 40,
135
+ align: "center",
136
+ renderCell: ({ index: f }) => /* @__PURE__ */ t(
137
+ K,
138
+ {
139
+ variant: "body1",
140
+ sx: {
141
+ bgcolor: "action.hover",
142
+ borderRadius: "50%",
143
+ width: 24,
144
+ height: 24,
145
+ display: "flex",
146
+ alignItems: "center",
147
+ justifyContent: "center",
148
+ color: "text.secondary"
149
+ },
150
+ children: f + 1
151
+ }
152
+ )
153
+ },
154
+ {
155
+ field: "content",
156
+ headerName: "",
157
+ renderCell: ({ row: f, index: P }) => u && x ? u({
158
+ item: f,
159
+ index: P,
160
+ property: a,
161
+ onChange: (z) => v(P, z)
162
+ }) : /* @__PURE__ */ t(
163
+ D,
164
+ {
165
+ fullWidth: !0,
166
+ size: "small",
167
+ disabled: i,
168
+ value: f,
169
+ placeholder: c || `${h("item")} ${P + 1}`,
170
+ onChange: (z) => v(P, z.target.value),
171
+ ...k
172
+ }
173
+ )
174
+ },
175
+ {
176
+ field: "actions",
177
+ headerName: "",
178
+ width: 30,
179
+ // 增加宽度以容纳更多按钮
180
+ align: "center",
181
+ renderCell: ({ index: f }) => /* @__PURE__ */ S(j, { direction: "column", spacing: 0.25, children: [
182
+ /* @__PURE__ */ t(xr, { disabled: i || f === 0, onClick: () => w(f) }),
183
+ /* @__PURE__ */ t(
184
+ gr,
185
+ {
186
+ disabled: i || f === o.length - 1,
187
+ onClick: () => n(f)
188
+ }
189
+ ),
190
+ /* @__PURE__ */ t(vr, { disabled: i, onClick: () => m(f) })
191
+ ] })
192
+ }
193
+ ], [
194
+ u,
195
+ x,
196
+ a,
197
+ v,
198
+ c,
199
+ h,
200
+ i,
201
+ k,
202
+ m,
203
+ w,
204
+ n,
205
+ o.length
206
+ ]);
207
+ return x ? /* @__PURE__ */ S(j, { width: "100%", gap: 1, children: [
208
+ e && /* @__PURE__ */ t(ne, { children: e }),
209
+ o.length > 0 ? /* @__PURE__ */ t(It, { component: re, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ S(
210
+ $e,
211
+ {
212
+ size: "small",
213
+ sx: {
214
+ "& .MuiTableCell-root": {
215
+ py: 0.25,
216
+ px: 1,
217
+ whiteSpace: "nowrap"
218
+ },
219
+ "& .MuiTableCell-head": {
220
+ backgroundColor: "action.hover",
221
+ py: 0.25,
222
+ px: 1
223
+ },
224
+ borderCollapse: "collapse"
225
+ },
226
+ children: [
227
+ /* @__PURE__ */ t(Me, { sx: { display: "none" }, children: /* @__PURE__ */ t(se, { children: I.map((f) => /* @__PURE__ */ t(
228
+ ce,
229
+ {
230
+ width: f.width,
231
+ align: f.align || "left",
232
+ sx: { fontWeight: "bold" },
233
+ children: f.renderHeader ? f.renderHeader() : f.headerName
234
+ },
235
+ f.field
236
+ )) }) }),
237
+ /* @__PURE__ */ t(He, { children: o.map((f, P, z) => /* @__PURE__ */ t(
238
+ se,
239
+ {
240
+ sx: {
241
+ borderBottom: P < z.length - 1 ? "1px solid" : "none",
242
+ borderColor: "divider",
243
+ "&:hover": {
244
+ backgroundColor: "action.hover"
245
+ }
246
+ },
247
+ children: I.map((R) => /* @__PURE__ */ t(
248
+ ce,
249
+ {
250
+ width: R.width,
251
+ align: R.align || "left",
252
+ sx: {
253
+ borderBottom: "none"
254
+ },
255
+ children: R.renderCell({
256
+ row: f,
257
+ index: P,
258
+ onChange: (C) => v(P, C)
259
+ })
260
+ },
261
+ `${P}-${R.field}`
262
+ ))
263
+ },
264
+ P
265
+ )) })
266
+ ]
267
+ }
268
+ ) }) : /* @__PURE__ */ t(te, { style: { fontSize: 12, height: b }, children: h("maker.properties.arrayEmpty") }),
269
+ /* @__PURE__ */ t(
270
+ A,
271
+ {
272
+ fullWidth: !0,
273
+ size: "small",
274
+ variant: "outlined",
275
+ disabled: i,
276
+ startIcon: /* @__PURE__ */ t(gt, {}),
277
+ onClick: s,
278
+ children: h("maker.properties.addArrayItem")
279
+ }
280
+ )
281
+ ] }) : /* @__PURE__ */ S(j, { width: "100%", gap: 1, children: [
282
+ e && /* @__PURE__ */ t(ne, { children: e }),
283
+ /* @__PURE__ */ t(O, { sx: { border: 1, borderColor: "divider", borderRadius: 1, minHeight: 150 }, children: /* @__PURE__ */ t(
284
+ ge,
285
+ {
286
+ keyId: a.id,
287
+ locale: g,
288
+ language: "json",
289
+ value: JSON.stringify(o, null, 2),
290
+ onChange: (f) => d(f || "")
291
+ },
292
+ a.id
293
+ ) })
294
+ ] });
295
+ }
296
+ Wt[300], Bt[300], Kt[300], // deepPurple['300'],
297
+ _t[300], Ft[300], // lightBlue['300'],
298
+ Jt[300], $t[300], Mt[300], // lightGreen['300'],
299
+ Ht[300], Yt[300], Gt[300], qt[300], // deepOrange['300'],
300
+ Lt[300], Qt[300], Xt[300];
301
+ const wr = et(function({ showMarkdown: r, markdown: l, onMarkdownChange: i, showUploader: c, value: b, meta: a, onChange: u, ...k }, h) {
302
+ const [g, y] = Z("");
303
+ $(() => {
304
+ y(b || "");
305
+ }, [b, y]);
306
+ const o = async () => {
307
+ if (g !== b) {
308
+ const s = oe(g);
309
+ if (!s) {
310
+ u(g, void 0);
46
311
  return;
47
312
  }
48
- const s = await de(o).catch(() => ue(o)).catch(() => {
313
+ const d = await be(s).catch(() => ye(s)).catch(() => {
49
314
  });
50
- a(y, { ...s, filename: y });
315
+ u(g, { ...d, filename: g });
51
316
  }
52
317
  };
53
- Bt(
318
+ Nt(
54
319
  () => {
55
- y !== v && a(y);
320
+ g !== b && u(g);
56
321
  },
57
322
  300,
58
- [y]
59
- ), He(l, () => ({
60
- submit: p
323
+ [g]
324
+ ), tt(h, () => ({
325
+ submit: o
61
326
  }));
62
- const x = {};
63
- return u && (x.InputProps = {
327
+ const p = {};
328
+ return c && (p.InputProps = {
64
329
  sx: { pr: 0 },
65
- endAdornment: /* @__PURE__ */ e(oe, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ e(
66
- fe,
330
+ endAdornment: /* @__PURE__ */ t(pe, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ t(
331
+ Pe,
67
332
  {
68
- onChange: async ({ response: o }) => {
69
- var b;
70
- const s = (b = o == null ? void 0 : o.data) == null ? void 0 : b.filename, g = re(s) || "";
71
- let I = {};
72
- g && (I = await de(g).catch(() => ue(g)).catch(() => {
73
- })), a(s, {
74
- ...I,
75
- filename: s
333
+ onChange: async ({ response: s }) => {
334
+ var n;
335
+ const d = (n = s == null ? void 0 : s.data) == null ? void 0 : n.filename, m = oe(d) || "";
336
+ let w = {};
337
+ m && (w = await be(m).catch(() => ye(m)).catch(() => {
338
+ })), u(d, {
339
+ ...w,
340
+ filename: d
76
341
  });
77
342
  }
78
343
  }
79
344
  ) })
80
- }), /* @__PURE__ */ e(
81
- O,
345
+ }), /* @__PURE__ */ t(
346
+ D,
82
347
  {
83
348
  size: "small",
84
349
  fullWidth: !0,
85
350
  ...k,
86
- label: /* @__PURE__ */ w(D, { direction: "row", spacing: 1, alignItems: "center", children: [
351
+ label: /* @__PURE__ */ S(j, { direction: "row", spacing: 1, alignItems: "center", children: [
87
352
  k.label,
88
- r && /* @__PURE__ */ w(U, { children: [
353
+ r && /* @__PURE__ */ S(J, { children: [
89
354
  " (",
90
- /* @__PURE__ */ e(
91
- Ne,
355
+ /* @__PURE__ */ t(
356
+ Ye,
92
357
  {
93
- checked: i,
94
- label: /* @__PURE__ */ e(P, { component: Nt, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
358
+ checked: l,
359
+ label: /* @__PURE__ */ t(O, { component: er, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
95
360
  labelPlacement: "start",
96
- control: /* @__PURE__ */ e(Be, { size: "small" }),
361
+ control: /* @__PURE__ */ t(Ge, { size: "small" }),
97
362
  sx: { ml: 0.25, pr: 1 },
98
- onChange: (o, s) => n == null ? void 0 : n(s)
363
+ onChange: (s, d) => i == null ? void 0 : i(d)
99
364
  }
100
365
  ),
101
366
  ")"
102
367
  ] })
103
368
  ] }),
104
369
  InputLabelProps: { shrink: !0, ...k.InputLabelProps },
105
- value: y,
106
- onChange: (o) => f(o.target.value),
107
- ...x,
108
- onKeyDown: (o) => {
109
- o.keyCode !== 229 && o.key === "Enter" && p();
370
+ value: g,
371
+ onChange: (s) => y(s.target.value),
372
+ ...p,
373
+ onKeyDown: (s) => {
374
+ s.keyCode !== 229 && s.key === "Enter" && o();
110
375
  }
111
376
  }
112
377
  );
113
- }), rr = dt(() => import("react-best-gradient-color-picker"));
114
- function ir(t) {
378
+ }), Pr = zt(() => import("react-best-gradient-color-picker"));
379
+ function Ir(e) {
115
380
  try {
116
- const i = Re.parse(t).map((u) => {
117
- const v = u.colorStops.map((c) => {
118
- if (c.type !== "rgba") {
119
- const a = vt(c.value).toRgb();
381
+ const l = Ee.parse(e).map((c) => {
382
+ const b = c.colorStops.map((a) => {
383
+ if (a.type !== "rgba") {
384
+ const u = Ut(a.value).toRgb();
120
385
  return {
121
- ...c,
122
- value: [a.r, a.g, a.b, a.a],
386
+ ...a,
387
+ value: [u.r, u.g, u.b, u.a],
123
388
  type: "rgba"
124
389
  };
125
390
  }
126
- return c;
391
+ return a;
127
392
  });
128
393
  return {
129
- ...u,
130
- colorStops: v
394
+ ...c,
395
+ colorStops: b
131
396
  };
132
397
  });
133
- return Re.stringify(i);
398
+ return Ee.stringify(l);
134
399
  } catch {
135
- return Ke(t) ? t : "";
400
+ return Fe(e) ? e : "";
136
401
  }
137
402
  }
138
- function nr({ color: t, sx: r = {}, ...i }) {
139
- Ke(t);
140
- const n = {};
141
- return Te(t) ? n.backgroundImage = t : n.backgroundColor = t, /* @__PURE__ */ e(
142
- P,
403
+ function Sr({ color: e, sx: r = {}, ...l }) {
404
+ Fe(e);
405
+ const i = {};
406
+ return _e(e) ? i.backgroundImage = e : i.backgroundColor = e, /* @__PURE__ */ t(
407
+ O,
143
408
  {
144
409
  sx: {
145
410
  ...r,
@@ -152,41 +417,41 @@ function nr({ color: t, sx: r = {}, ...i }) {
152
417
  "&:hover": {
153
418
  opacity: 0.75
154
419
  },
155
- ...n
420
+ ...i
156
421
  },
157
- ...i
422
+ ...l
158
423
  }
159
424
  );
160
425
  }
161
- const lr = Ee(function({ onSave: r }, i) {
162
- const n = ft({
426
+ const Or = et(function({ onSave: r }, l) {
427
+ const i = Vt({
163
428
  value: ""
164
- }), { t: u } = j(), v = {};
165
- n.value ? Te(n.value) ? v.backgroundImage = n.value : v.backgroundColor = n.value : v.border = "1px solid #ccc";
166
- const [c, { setFalse: a, setTrue: k }] = bt(!1), l = ne(() => {
167
- a();
168
- }, [a]), y = () => {
169
- r({ value: n.value }, l);
429
+ }), { t: c } = N(), b = {};
430
+ i.value ? _e(i.value) ? b.backgroundImage = i.value : b.backgroundColor = i.value : b.border = "1px solid #ccc";
431
+ const [a, { setFalse: u, setTrue: k }] = Tt(!1), h = V(() => {
432
+ u();
433
+ }, [u]), g = () => {
434
+ r({ value: i.value }, h);
170
435
  };
171
- return He(i, () => ({
172
- open({ value: f } = { value: "" }) {
173
- n.value = f, k();
436
+ return tt(l, () => ({
437
+ open({ value: y } = { value: "" }) {
438
+ i.value = y, k();
174
439
  },
175
440
  close() {
176
- l();
441
+ h();
177
442
  }
178
- })), /* @__PURE__ */ w(pe, { open: c, onClose: l, hideBackdrop: !0, children: [
179
- /* @__PURE__ */ e(Ue, { children: u("maker.configBackground") }),
180
- /* @__PURE__ */ e(We, { sx: { width: 600 }, children: /* @__PURE__ */ w(P, { width: "100%", display: "flex", children: [
181
- /* @__PURE__ */ e(P, { flex: 1, mr: 1, sx: v, children: !n.value && /* @__PURE__ */ e(he, { children: u("error.notConfig") }) }),
182
- /* @__PURE__ */ e(ut, { children: /* @__PURE__ */ e(
183
- rr,
443
+ })), /* @__PURE__ */ S(we, { open: a, onClose: h, hideBackdrop: !0, children: [
444
+ /* @__PURE__ */ t(qe, { children: c("maker.configBackground") }),
445
+ /* @__PURE__ */ t(Le, { sx: { width: 600 }, children: /* @__PURE__ */ S(O, { width: "100%", display: "flex", children: [
446
+ /* @__PURE__ */ t(O, { flex: 1, mr: 1, sx: b, children: !i.value && /* @__PURE__ */ t(te, { children: c("error.notConfig") }) }),
447
+ /* @__PURE__ */ t(Rt, { children: /* @__PURE__ */ t(
448
+ Pr,
184
449
  {
185
450
  width: 200,
186
451
  height: 200,
187
- value: ir(n.value),
188
- onChange: (f) => {
189
- n.value = f;
452
+ value: Ir(i.value),
453
+ onChange: (y) => {
454
+ i.value = y;
190
455
  },
191
456
  hidePresets: !0,
192
457
  hideAdvancedSliders: !0,
@@ -195,13 +460,13 @@ const lr = Ee(function({ onSave: r }, i) {
195
460
  }
196
461
  ) })
197
462
  ] }) }),
198
- /* @__PURE__ */ w(Ve, { children: [
199
- /* @__PURE__ */ e(A, { variant: "outlined", size: "small", onClick: l, children: u("common.cancel") }),
200
- /* @__PURE__ */ e(A, { variant: "contained", size: "small", onClick: y, children: u("maker.save") })
463
+ /* @__PURE__ */ S(Qe, { children: [
464
+ /* @__PURE__ */ t(A, { variant: "outlined", size: "small", onClick: h, children: c("common.cancel") }),
465
+ /* @__PURE__ */ t(A, { variant: "contained", size: "small", onClick: g, children: c("maker.save") })
201
466
  ] })
202
467
  ] });
203
468
  });
204
- mt(P)`
469
+ At(O)`
205
470
  .color-item {
206
471
  position: relative;
207
472
  }
@@ -222,198 +487,396 @@ mt(P)`
222
487
  right: 0;
223
488
  }
224
489
  `;
225
- function or({
226
- value: t,
490
+ function jr({
491
+ value: e,
227
492
  onChange: r,
228
- ...i
493
+ ...l
229
494
  }) {
230
- const n = Z(null);
231
- return /* @__PURE__ */ w(U, { children: [
232
- /* @__PURE__ */ e(
233
- tr,
495
+ const i = F(null);
496
+ return /* @__PURE__ */ S(J, { children: [
497
+ /* @__PURE__ */ t(
498
+ wr,
234
499
  {
235
- ...i,
236
- value: t,
500
+ ...l,
501
+ value: e,
237
502
  onChange: r,
238
503
  InputProps: {
239
- endAdornment: /* @__PURE__ */ e(oe, { position: "end", children: /* @__PURE__ */ e(
240
- nr,
504
+ endAdornment: /* @__PURE__ */ t(pe, { position: "end", children: /* @__PURE__ */ t(
505
+ Sr,
241
506
  {
242
- color: t ?? "",
507
+ color: e ?? "",
243
508
  style: { width: "1.5rem", height: "1.5rem", padding: 0 },
244
509
  onClick: () => {
245
- var u;
246
- (u = n.current) == null || u.open({ value: t ?? "" });
510
+ var c;
511
+ (c = i.current) == null || c.open({ value: e ?? "" });
247
512
  }
248
513
  }
249
514
  ) })
250
515
  }
251
516
  }
252
517
  ),
253
- /* @__PURE__ */ e(
254
- lr,
518
+ /* @__PURE__ */ t(
519
+ Or,
255
520
  {
256
- ref: n,
257
- onSave: ({ value: u }, v) => {
258
- r(u), v();
521
+ ref: i,
522
+ onSave: ({ value: c }, b) => {
523
+ r(c), b();
259
524
  }
260
525
  }
261
526
  )
262
527
  ] });
263
528
  }
264
- const Ae = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
265
- function sr({
266
- disabled: t,
529
+ function ft(e, r) {
530
+ return r === "yaml" ? ae.stringify(e, { indent: 2 }) : r === "json" ? JSON.parse(JSON.stringify(e)) : e;
531
+ }
532
+ function zr({
533
+ label: e,
534
+ value: r,
535
+ onChange: l,
536
+ property: i,
537
+ component: c,
538
+ defaultLocale: b,
539
+ allComponents: a,
540
+ PropertyValueField: u,
541
+ onUpload: k
542
+ }) {
543
+ const { locale: h } = N(), g = F(null);
544
+ if (!it(i.subProperties)) {
545
+ const o = T(Object.values(i.subProperties || {}), "index").filter(
546
+ (p) => p.data.visible !== !1 && p.data.key
547
+ );
548
+ return /* @__PURE__ */ S(j, { width: "100%", children: [
549
+ /* @__PURE__ */ t(ne, { sx: { px: 0.25, py: 0.5 }, children: e }),
550
+ /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(O, { sx: { position: "relative" }, children: o.map((p, s) => {
551
+ const { data: d } = p, m = d.key ?? d.id, w = s === o.length - 1;
552
+ let n = null;
553
+ try {
554
+ r && typeof r == "object" ? n = r[m] : typeof r == "string" && (n = (i.type === "yaml" ? ae.parse(r || "") : JSON.parse(r || "{}"))[m]);
555
+ } catch {
556
+ }
557
+ n == null && (d.locales && h && d.locales[h] ? n = d.locales[h].defaultValue : d.locales && b && d.locales[b] && (n = d.locales[b].defaultValue));
558
+ const v = (I) => {
559
+ try {
560
+ let f = {};
561
+ if (typeof r == "string")
562
+ try {
563
+ f = i.type === "yaml" ? ae.parse(r || "") : JSON.parse(r || "{}");
564
+ } catch {
565
+ }
566
+ else typeof r == "object" && r !== null && (f = { ...r });
567
+ lt(f, m, I);
568
+ const P = ft(f, i.type);
569
+ l == null || l(P);
570
+ } catch (f) {
571
+ console.error("Error updating property:", f);
572
+ }
573
+ }, x = 8;
574
+ return /* @__PURE__ */ S(
575
+ O,
576
+ {
577
+ sx: {
578
+ mb: w ? 0 : 1,
579
+ // 底部边距,最后一项不需要
580
+ display: "flex",
581
+ flexDirection: "row"
582
+ },
583
+ children: [
584
+ /* @__PURE__ */ S(
585
+ O,
586
+ {
587
+ sx: {
588
+ position: "relative",
589
+ width: 24,
590
+ flexShrink: 0
591
+ },
592
+ children: [
593
+ /* @__PURE__ */ t(
594
+ O,
595
+ {
596
+ sx: {
597
+ position: "absolute",
598
+ left: x,
599
+ top: 0,
600
+ height: 16,
601
+ // 连接到字段中点的高度
602
+ width: 0,
603
+ borderLeft: "1px dashed",
604
+ borderColor: "divider"
605
+ }
606
+ }
607
+ ),
608
+ /* @__PURE__ */ t(
609
+ O,
610
+ {
611
+ sx: {
612
+ position: "absolute",
613
+ left: x,
614
+ top: 16,
615
+ // 连接到字段中点
616
+ width: 12,
617
+ height: 0,
618
+ borderTop: "1px dashed",
619
+ borderColor: "divider"
620
+ }
621
+ }
622
+ ),
623
+ !w && /* @__PURE__ */ t(
624
+ O,
625
+ {
626
+ sx: {
627
+ position: "absolute",
628
+ left: x,
629
+ top: 16,
630
+ // 从当前项中点
631
+ bottom: -8,
632
+ // 延伸到下一项
633
+ width: 0,
634
+ borderLeft: "1px dashed",
635
+ borderColor: "divider"
636
+ }
637
+ }
638
+ )
639
+ ]
640
+ }
641
+ ),
642
+ /* @__PURE__ */ t(O, { sx: { flexGrow: 1 }, children: /* @__PURE__ */ t(
643
+ u,
644
+ {
645
+ component: c,
646
+ property: d,
647
+ value: n,
648
+ onChange: v,
649
+ size: "small",
650
+ fullWidth: !0,
651
+ defaultLocale: b,
652
+ allComponents: a
653
+ }
654
+ ) })
655
+ ]
656
+ },
657
+ d.id
658
+ );
659
+ }) }) })
660
+ ] });
661
+ }
662
+ return /* @__PURE__ */ t(j, { width: "100%", gap: 2, children: /* @__PURE__ */ S(
663
+ j,
664
+ {
665
+ sx: {
666
+ width: "100%",
667
+ position: "relative",
668
+ pt: 1,
669
+ pb: "6px",
670
+ px: "1px",
671
+ minHeight: 50,
672
+ ".monaco-editor,.overflow-guard": { borderRadius: 1 }
673
+ },
674
+ children: [
675
+ /* @__PURE__ */ t(
676
+ ne,
677
+ {
678
+ sx: {
679
+ position: "absolute",
680
+ left: 0,
681
+ top: 0,
682
+ transform: "translate(0px, -7px) scale(0.75)"
683
+ },
684
+ children: e
685
+ }
686
+ ),
687
+ /* @__PURE__ */ t(
688
+ ge,
689
+ {
690
+ keyId: i.id,
691
+ locale: h,
692
+ language: i.type === "yaml" ? "yaml" : "json",
693
+ value: typeof r == "string" ? r : "",
694
+ onChange: (o) => {
695
+ l == null || l(o);
696
+ },
697
+ onUpload: (o) => {
698
+ g.current = o, k && k(o);
699
+ }
700
+ },
701
+ i.id
702
+ ),
703
+ /* @__PURE__ */ t(
704
+ O,
705
+ {
706
+ component: "fieldset",
707
+ sx: {
708
+ pointerEvents: "none",
709
+ position: "absolute",
710
+ left: 0,
711
+ top: -5,
712
+ width: "100%",
713
+ height: "100%",
714
+ border: 1,
715
+ borderColor: "rgba(0, 0, 0, 0.23)",
716
+ borderRadius: 1,
717
+ px: 1,
718
+ py: 0
719
+ },
720
+ children: /* @__PURE__ */ t(O, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ t(O, { component: "span", sx: { opacity: 0 }, children: e }) })
721
+ }
722
+ )
723
+ ]
724
+ }
725
+ ) });
726
+ }
727
+ const Be = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
728
+ function ht({
729
+ disabled: e,
267
730
  list: r,
268
- renderItem: i,
269
- ...n
731
+ renderItem: l,
732
+ ...i
270
733
  }) {
271
- const u = Z(null), v = at(), c = yt(), a = Lt(Object.entries(r), (x) => x[1].index).map((x) => x[0]), k = Z(a), l = ne(
272
- (x) => {
273
- k.current = x, c();
734
+ const c = F(null), b = Dt(), a = Et(), u = T(Object.entries(r), (p) => p[1].index).map((p) => p[0]), k = F(u), h = V(
735
+ (p) => {
736
+ k.current = p, a();
274
737
  },
275
- [c]
276
- ), y = ne(
277
- ({ index: x }, { index: o }) => {
278
- const s = [...k.current];
279
- s.splice(o, 0, ...s.splice(x, 1)), l(s);
738
+ [a]
739
+ ), g = V(
740
+ ({ index: p }, { index: s }) => {
741
+ const d = [...k.current];
742
+ d.splice(s, 0, ...d.splice(p, 1)), h(d);
280
743
  },
281
- [l]
744
+ [h]
282
745
  );
283
- X(() => {
284
- l(a);
285
- }, [a.join("-")]);
286
- const [{ isOver: f }, p] = Ze({
287
- accept: v,
288
- collect: (x) => ({
289
- isOver: x.isOver()
746
+ $(() => {
747
+ h(u);
748
+ }, [u.join("-")]);
749
+ const [{ isOver: y }, o] = mt({
750
+ accept: b,
751
+ collect: (p) => ({
752
+ isOver: p.isOver()
290
753
  }),
291
- canDrop: () => !t,
754
+ canDrop: () => !e,
292
755
  drop: () => {
293
- var s;
294
- const x = () => {
295
- k.current.forEach((g, I) => {
296
- const b = r[g];
297
- b && (b.index = I);
756
+ var d;
757
+ const p = () => {
758
+ k.current.forEach((m, w) => {
759
+ const n = r[m];
760
+ n && (n.index = w);
298
761
  });
299
- }, o = (s = _(r)) == null ? void 0 : s.doc;
300
- o ? o.transact(() => {
301
- x();
302
- }) : x();
762
+ }, s = (d = M(r)) == null ? void 0 : d.doc;
763
+ s ? s.transact(() => {
764
+ p();
765
+ }) : p();
303
766
  }
304
767
  });
305
- return X(() => {
306
- f || l(a);
307
- }, [f]), p(u), /* @__PURE__ */ e(P, { ...n, ref: u, className: ht(f && "isDragging"), children: k.current.map((x, o) => /* @__PURE__ */ e(
308
- cr,
768
+ return $(() => {
769
+ y || h(u);
770
+ }, [y]), o(c), /* @__PURE__ */ t(O, { ...i, ref: c, className: Ct(y && "isDragging"), children: k.current.map((p, s) => /* @__PURE__ */ t(
771
+ Rr,
309
772
  {
310
- type: v,
311
- disabled: t,
312
- id: x,
313
- index: o,
314
- itemIndex: (s) => k.current.indexOf(s),
315
- move: y,
316
- children: (s) => {
317
- const g = r[x];
318
- return g ? i(g.data, o, s) : null;
773
+ type: b,
774
+ disabled: e,
775
+ id: p,
776
+ index: s,
777
+ itemIndex: (d) => k.current.indexOf(d),
778
+ move: g,
779
+ children: (d) => {
780
+ const m = r[p];
781
+ return m ? l(m.data, s, d) : null;
319
782
  }
320
783
  },
321
- x
784
+ p
322
785
  )) });
323
786
  }
324
- function cr({
325
- disabled: t,
787
+ function Rr({
788
+ disabled: e,
326
789
  id: r,
327
- index: i,
328
- type: n,
329
- children: u,
330
- itemIndex: v,
331
- move: c
790
+ index: l,
791
+ type: i,
792
+ children: c,
793
+ itemIndex: b,
794
+ move: a
332
795
  }) {
333
- const a = Z(), [{ isDragging: k }, l, y] = er({
334
- type: n,
796
+ const u = F(), [{ isDragging: k }, h, g] = yr({
797
+ type: i,
335
798
  item: () => ({ id: r }),
336
- canDrag: () => !t,
337
- collect: (p) => ({ isDragging: p.isDragging() })
338
- }), [, f] = Ze({
339
- accept: n,
340
- canDrop: () => !t,
341
- hover(p, x) {
342
- var h;
343
- if (!a.current)
799
+ canDrag: () => !e,
800
+ collect: (o) => ({ isDragging: o.isDragging() })
801
+ }), [, y] = mt({
802
+ accept: i,
803
+ canDrop: () => !e,
804
+ hover(o, p) {
805
+ var x;
806
+ if (!u.current)
344
807
  return;
345
- const o = v(p.id), s = i;
346
- if (o === s)
808
+ const s = b(o.id), d = l;
809
+ if (s === d)
347
810
  return;
348
- const g = (h = a.current) == null ? void 0 : h.getBoundingClientRect(), I = (g.bottom - g.top) / 2, d = x.getClientOffset().y - g.top;
349
- o < s && d < I || o > s && d > I || c({ id: p.id, index: o }, { id: r, index: i });
811
+ const m = (x = u.current) == null ? void 0 : x.getBoundingClientRect(), w = (m.bottom - m.top) / 2, v = p.getClientOffset().y - m.top;
812
+ s < d && v < w || s > d && v > w || a({ id: o.id, index: s }, { id: r, index: l });
350
813
  }
351
814
  });
352
- return typeof u == "function" ? u({
815
+ return typeof c == "function" ? c({
353
816
  isDragging: k,
354
- drag: l,
355
- drop: (p) => (a.current = p, f(p)),
356
- preview: y
357
- }) : (l(f(y(a))), /* @__PURE__ */ e(P, { ref: a, children: u }));
817
+ drag: h,
818
+ drop: (o) => (u.current = o, y(o)),
819
+ preview: g
820
+ }) : (h(y(g(u))), /* @__PURE__ */ t(O, { ref: u, children: c }));
358
821
  }
359
- function dr({
360
- drop: t,
822
+ function Dr({
823
+ drop: e,
361
824
  preview: r,
362
- drag: i,
363
- disabled: n,
364
- isDragging: u,
365
- children: v,
366
- onDelete: c,
367
- onVisibilityChange: a,
825
+ drag: l,
826
+ disabled: i,
827
+ isDragging: c,
828
+ children: b,
829
+ onDelete: a,
830
+ onVisibilityChange: u,
368
831
  visible: k = !0,
369
- actions: l,
370
- alwaysShowActions: y = !1
832
+ actions: h,
833
+ alwaysShowActions: g = !1
371
834
  }) {
372
- const { t: f } = j();
373
- return /* @__PURE__ */ e(
374
- P,
835
+ const { t: y } = N();
836
+ return /* @__PURE__ */ t(
837
+ O,
375
838
  {
376
- ref: t,
839
+ ref: e,
377
840
  sx: {
378
841
  ":hover .hover-visible": { maxWidth: "100%" },
379
842
  opacity: k ? 1 : 0.5
380
843
  },
381
- children: /* @__PURE__ */ w(P, { sx: { position: "relative" }, children: [
382
- /* @__PURE__ */ e(
383
- P,
844
+ children: /* @__PURE__ */ S(O, { sx: { position: "relative" }, children: [
845
+ /* @__PURE__ */ t(
846
+ O,
384
847
  {
385
848
  ref: r,
386
849
  sx: {
387
850
  flex: 1,
388
851
  borderRadius: 0.5,
389
- bgcolor: u ? "action.hover" : "background.paper",
852
+ bgcolor: c ? "action.hover" : "background.paper",
390
853
  opacity: 0.9999
391
854
  // NOTE: make preview effective
392
855
  },
393
- children: v
856
+ children: b
394
857
  }
395
858
  ),
396
- !n && /* @__PURE__ */ e(
397
- P,
859
+ !i && /* @__PURE__ */ t(
860
+ O,
398
861
  {
399
- className: y ? "" : "hover-visible",
862
+ className: g ? "" : "hover-visible",
400
863
  sx: {
401
- maxWidth: y ? "100%" : 0,
864
+ maxWidth: g ? "100%" : 0,
402
865
  overflow: "hidden",
403
866
  position: "absolute",
404
867
  right: 2,
405
868
  top: 2,
406
869
  transition: "max-width 0.3s ease-in-out"
407
870
  },
408
- children: /* @__PURE__ */ w(
409
- D,
871
+ children: /* @__PURE__ */ S(
872
+ j,
410
873
  {
411
874
  direction: "row",
412
875
  sx: {
413
- bgcolor: (p) => it(p.palette.grey[200], 0.9),
876
+ bgcolor: (o) => St(o.palette.grey[200], 0.9),
414
877
  borderRadius: 1,
415
878
  p: 0.5,
416
- [`.${nt.root}`]: {
879
+ [`.${Ot.root}`]: {
417
880
  minWidth: 24,
418
881
  width: 24,
419
882
  height: 24,
@@ -421,10 +884,10 @@ function dr({
421
884
  }
422
885
  },
423
886
  children: [
424
- l,
425
- a && /* @__PURE__ */ e(Q, { title: f(k ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: () => a(!k), children: k ? /* @__PURE__ */ e(Ht, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ e(Jt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
426
- c && /* @__PURE__ */ e(Q, { title: f("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: c, children: /* @__PURE__ */ e(Mt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
427
- /* @__PURE__ */ e(Q, { title: f("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { ref: i, children: /* @__PURE__ */ e($t, { sx: { color: "grey.500" } }) }) })
887
+ h,
888
+ u && /* @__PURE__ */ t(X, { title: y(k ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(A, { onClick: () => u(!k), children: k ? /* @__PURE__ */ t(lr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ t(or, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
889
+ a && /* @__PURE__ */ t(X, { title: y("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(A, { onClick: a, children: /* @__PURE__ */ t(nr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
890
+ /* @__PURE__ */ t(X, { title: y("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ t(A, { ref: l, children: /* @__PURE__ */ t(sr, { sx: { color: "grey.500" } }) }) })
428
891
  ]
429
892
  }
430
893
  )
@@ -434,146 +897,170 @@ function dr({
434
897
  }
435
898
  );
436
899
  }
437
- function ur({
438
- label: t,
900
+ function Nr({
901
+ label: e,
439
902
  value: r,
440
- onChange: i
903
+ onChange: l
441
904
  }) {
442
- const [n, u] = ie(!1);
443
- return /* @__PURE__ */ w(D, { gap: 1, children: [
444
- /* @__PURE__ */ e(
445
- O,
905
+ const [i, c] = Z(!1);
906
+ return /* @__PURE__ */ S(j, { gap: 1, children: [
907
+ /* @__PURE__ */ t(
908
+ D,
446
909
  {
447
- label: t,
910
+ label: e,
448
911
  size: "small",
449
912
  value: r,
450
- onChange: (v) => i == null ? void 0 : i(v.target.value),
913
+ onChange: (b) => l == null ? void 0 : l(b.target.value),
451
914
  InputProps: {
452
- endAdornment: /* @__PURE__ */ e(
453
- fe,
915
+ endAdornment: /* @__PURE__ */ t(
916
+ Pe,
454
917
  {
455
- onChange: ({ response: v }) => {
456
- var a;
457
- const c = (a = v == null ? void 0 : v.data) == null ? void 0 : a.filename;
458
- c && (i == null || i(c));
918
+ onChange: ({ response: b }) => {
919
+ var u;
920
+ const a = (u = b == null ? void 0 : b.data) == null ? void 0 : u.filename;
921
+ a && (l == null || l(a));
459
922
  }
460
923
  }
461
924
  )
462
925
  }
463
926
  }
464
927
  ),
465
- r && /* @__PURE__ */ e(
466
- P,
928
+ r && /* @__PURE__ */ t(
929
+ O,
467
930
  {
468
931
  component: "img",
469
932
  sx: { objectFit: "contain", borderRadius: 1, cursor: "pointer" },
470
- src: re(r),
471
- alt: t,
933
+ src: oe(r),
934
+ alt: e,
472
935
  maxWidth: 100,
473
936
  maxHeight: 100,
474
937
  width: "100%",
475
- onClick: () => u(!0)
938
+ onClick: () => c(!0)
476
939
  }
477
940
  ),
478
- /* @__PURE__ */ e(pe, { open: n, onClose: () => u(!1), children: /* @__PURE__ */ e(P, { component: "img", sx: { objectFit: "contain" }, src: re(r), alt: t }) })
941
+ /* @__PURE__ */ t(we, { open: i, onClose: () => c(!1), children: /* @__PURE__ */ t(O, { component: "img", sx: { objectFit: "contain" }, src: oe(r), alt: e }) })
479
942
  ] });
480
943
  }
481
- function te(t, r, i) {
482
- return !t || !i ? !1 : Object.values(t).some(({ data: n }) => n.id !== r && n.key === i);
944
+ function ve(e, r = "") {
945
+ return hr(
946
+ e,
947
+ (l, i, c) => {
948
+ const b = r ? `${r}.${c}` : c;
949
+ return ur(i) ? dr(l, ve(i, b)) : l[b] = i, l;
950
+ },
951
+ {}
952
+ );
953
+ }
954
+ const Ar = [
955
+ { value: "string", label: "Text" },
956
+ { value: "multiline", label: "Text (Multiline)" },
957
+ { value: "number", label: "Number" },
958
+ { value: "decimal", label: "Decimal" },
959
+ { value: "boolean", label: "Boolean" },
960
+ { value: "color", label: "Color" },
961
+ { value: "url", label: "URL (Upload)" },
962
+ { value: "json", label: "JSON" },
963
+ { value: "yaml", label: "YAML" },
964
+ { value: "array", label: "Array" },
965
+ { value: "component", label: "Component" },
966
+ { value: "custom", label: "Custom (Render by a Component)" }
967
+ ];
968
+ function le(e, r, l) {
969
+ return !e || !l ? !1 : Object.values(e).some(({ data: i }) => i.id !== r && i.key === l);
483
970
  }
484
- function Le(t, r) {
485
- var i;
486
- return !t || !r ? !1 : ((i = t[r]) == null ? void 0 : i.data.visible) ?? !0;
971
+ function bt(e, r) {
972
+ var l;
973
+ return !e || !r ? !1 : ((l = e[r]) == null ? void 0 : l.data.visible) ?? !0;
487
974
  }
488
- function Zr({ componentId: t }) {
975
+ function Vi({ componentId: e }) {
489
976
  const {
490
977
  state: { components: r }
491
- } = le(), i = r[t], n = i == null ? void 0 : i.data;
492
- return n ? /* @__PURE__ */ e(D, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(P, { p: 2, children: /* @__PURE__ */ e(Zt, { FallbackComponent: tt, resetKeys: [t], children: /* @__PURE__ */ e(ar, { value: n }) }) }) }) : null;
978
+ } = ue(), l = r[e], i = l == null ? void 0 : l.data;
979
+ return i ? /* @__PURE__ */ t(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ t(O, { p: 2, children: /* @__PURE__ */ t(br, { FallbackComponent: xt, resetKeys: [e], children: /* @__PURE__ */ t(Cr, { value: i }) }) }) }) : null;
493
980
  }
494
- function ar({ value: t }) {
495
- var k, l, y;
496
- const { t: r } = j(), {
497
- localState: { currentLocale: i, componentDebugProps: n },
981
+ function Cr({ value: e }) {
982
+ var k, h, g;
983
+ const { t: r } = N(), {
984
+ localState: { currentLocale: l, componentDebugProps: i },
498
985
  state: {
499
- config: { defaultLocale: u }
986
+ config: { defaultLocale: c }
500
987
  },
501
- localActions: { setComponentDebugProps: v }
502
- } = le(), c = _(t).doc, a = ae();
503
- return /* @__PURE__ */ e(D, { height: "100%", children: /* @__PURE__ */ w(D, { gap: 2, children: [
504
- /* @__PURE__ */ e(pr, { config: t }),
505
- /* @__PURE__ */ e(
506
- mr,
988
+ localActions: { setComponentDebugProps: b }
989
+ } = ue(), a = M(e).doc, u = xe();
990
+ return /* @__PURE__ */ t(j, { height: "100%", children: /* @__PURE__ */ S(j, { gap: 2, children: [
991
+ /* @__PURE__ */ t(Vr, { config: e }),
992
+ /* @__PURE__ */ t(
993
+ Er,
507
994
  {
508
- config: t,
509
- currentLocale: i,
510
- defaultLocale: u,
511
- allComponents: a,
512
- onUpdateConfig: (f) => {
513
- c.transact(() => {
514
- f(t);
995
+ config: e,
996
+ currentLocale: l,
997
+ defaultLocale: c,
998
+ allComponents: u,
999
+ onUpdateConfig: (y) => {
1000
+ a.transact(() => {
1001
+ y(e);
515
1002
  });
516
1003
  }
517
1004
  }
518
1005
  ),
519
- /* @__PURE__ */ w(D, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
520
- /* @__PURE__ */ e(V, { variant: "subtitle1", children: r("renderer") }),
521
- /* @__PURE__ */ w(
522
- O,
1006
+ /* @__PURE__ */ S(j, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1007
+ /* @__PURE__ */ t(K, { variant: "subtitle1", children: r("renderer") }),
1008
+ /* @__PURE__ */ S(
1009
+ D,
523
1010
  {
524
1011
  hiddenLabel: !0,
525
1012
  size: "small",
526
1013
  select: !0,
527
1014
  SelectProps: { autoWidth: !0 },
528
- value: ((k = t.renderer) == null ? void 0 : k.type) || "react-component",
529
- onChange: (f) => {
530
- c.transact(() => {
531
- const p = f.target.value;
532
- t.renderer ?? (t.renderer = { type: p }), t.renderer.type = p;
1015
+ value: ((k = e.renderer) == null ? void 0 : k.type) || "react-component",
1016
+ onChange: (y) => {
1017
+ a.transact(() => {
1018
+ const o = y.target.value;
1019
+ e.renderer ?? (e.renderer = { type: o }), e.renderer.type = o;
533
1020
  });
534
1021
  },
535
1022
  children: [
536
- /* @__PURE__ */ e(R, { value: "react-component", children: "React Component" }),
537
- /* @__PURE__ */ e(R, { value: "component", children: "Custom Component" })
1023
+ /* @__PURE__ */ t(he, { value: "react-component", children: "React Component" }),
1024
+ /* @__PURE__ */ t(he, { value: "component", children: "Custom Component" })
538
1025
  ]
539
1026
  }
540
1027
  )
541
1028
  ] }),
542
- ((l = t.renderer) == null ? void 0 : l.type) === "component" ? /* @__PURE__ */ e(gr, { value: t }) : ((y = t.renderer) == null ? void 0 : y.type) === "react-component" ? /* @__PURE__ */ e(xr, { value: t }) : null,
543
- /* @__PURE__ */ e(
544
- kr,
1029
+ ((h = e.renderer) == null ? void 0 : h.type) === "component" ? /* @__PURE__ */ t($r, { value: e }) : ((g = e.renderer) == null ? void 0 : g.type) === "react-component" ? /* @__PURE__ */ t(Jr, { value: e }) : null,
1030
+ /* @__PURE__ */ t(
1031
+ Mr,
545
1032
  {
546
- config: t,
547
- currentLocale: i,
548
- defaultLocale: u,
549
- allComponents: a,
550
- onChange: ({ key: f, value: p }) => {
551
- v({
552
- [f]: p.value
1033
+ config: e,
1034
+ currentLocale: l,
1035
+ defaultLocale: c,
1036
+ allComponents: u,
1037
+ onChange: ({ key: y, value: o }) => {
1038
+ b({
1039
+ [y]: o.value
553
1040
  });
554
1041
  },
555
1042
  props: {
556
- ...n
1043
+ ...i
557
1044
  }
558
1045
  }
559
1046
  )
560
1047
  ] }) });
561
1048
  }
562
- function pr({ config: t }) {
563
- const { t: r } = j();
564
- return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
565
- /* @__PURE__ */ e(V, { variant: "subtitle1", children: r("basicInfo") }),
566
- /* @__PURE__ */ e(
567
- O,
1049
+ function Vr({ config: e }) {
1050
+ const { t: r } = N();
1051
+ return /* @__PURE__ */ t(Ie, { children: /* @__PURE__ */ S(j, { gap: 2, children: [
1052
+ /* @__PURE__ */ t(K, { variant: "subtitle1", children: r("basicInfo") }),
1053
+ /* @__PURE__ */ t(
1054
+ D,
568
1055
  {
569
1056
  label: r("name"),
570
1057
  size: "small",
571
- value: t.name || "",
572
- onChange: (i) => t.name = i.target.value
1058
+ value: e.name || "",
1059
+ onChange: (l) => e.name = l.target.value
573
1060
  }
574
1061
  ),
575
- /* @__PURE__ */ e(
576
- O,
1062
+ /* @__PURE__ */ t(
1063
+ D,
577
1064
  {
578
1065
  label: r("description"),
579
1066
  size: "small",
@@ -581,636 +1068,806 @@ function pr({ config: t }) {
581
1068
  minRows: 2,
582
1069
  maxRows: 10,
583
1070
  inputProps: { maxLength: 200 },
584
- value: t.description || "",
585
- onChange: (i) => t.description = i.target.value
1071
+ value: e.description || "",
1072
+ onChange: (l) => e.description = l.target.value
586
1073
  }
587
1074
  ),
588
- /* @__PURE__ */ e(
589
- Fe,
1075
+ /* @__PURE__ */ t(
1076
+ Xe,
590
1077
  {
591
1078
  size: "small",
592
1079
  options: [],
593
1080
  multiple: !0,
594
1081
  freeSolo: !0,
595
- value: t.tags ?? [],
596
- onChange: (i, n) => t.tags = n,
597
- renderInput: (i) => /* @__PURE__ */ e(O, { label: r("tags"), ...i })
1082
+ value: e.tags ?? [],
1083
+ onChange: (l, i) => e.tags = i,
1084
+ renderInput: (l) => /* @__PURE__ */ t(D, { label: r("tags"), ...l })
598
1085
  }
599
1086
  ),
600
- /* @__PURE__ */ e(
601
- ur,
1087
+ /* @__PURE__ */ t(
1088
+ Nr,
602
1089
  {
603
1090
  label: r("previewImage"),
604
- value: t.previewImage || "",
605
- onChange: (i) => t.previewImage = i
1091
+ value: e.previewImage || "",
1092
+ onChange: (l) => e.previewImage = l
606
1093
  }
607
1094
  )
608
1095
  ] }) });
609
1096
  }
610
- function mr({
611
- config: t,
612
- currentLocale: r,
613
- defaultLocale: i,
614
- allComponents: n,
615
- onUpdateConfig: u,
616
- useI18nEditor: v = !0
1097
+ function yt({
1098
+ data: e,
1099
+ params: r,
1100
+ visible: l,
1101
+ config: i,
1102
+ currentLocale: c,
1103
+ defaultLocale: b,
1104
+ allComponents: a,
1105
+ onUpdateConfig: u
617
1106
  }) {
618
- const { t: c } = j(), a = se({ variant: "dialog" }), k = t.properties && F(Object.values(t.properties), "index");
619
- return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
620
- /* @__PURE__ */ w(D, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
621
- /* @__PURE__ */ e(V, { variant: "subtitle1", children: c("properties") }),
622
- /* @__PURE__ */ e(P, { flex: 1 }),
623
- /* @__PURE__ */ e(
624
- A,
625
- {
626
- onClick: () => {
627
- u((l) => {
628
- var f;
629
- const y = rt();
630
- l.properties ?? (l.properties = {}), (f = l.properties)[y] ?? (f[y] = { index: (k == null ? void 0 : k.length) || 0, data: { id: y } });
1107
+ var g, y, o, p, s, d;
1108
+ const { t: k } = N(), h = de(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? Br : B, [e.type]);
1109
+ return /* @__PURE__ */ t(
1110
+ Dr,
1111
+ {
1112
+ preview: r.preview,
1113
+ drop: r.drop,
1114
+ drag: r.drag,
1115
+ isDragging: r.isDragging,
1116
+ onDelete: () => {
1117
+ u((m) => {
1118
+ if (m.properties) {
1119
+ const n = Object.entries(m.properties).sort(([, x], [, I]) => x.index - I.index);
1120
+ delete m.properties[e.id], n.filter(([x]) => x !== e.id).forEach(([, x], I) => {
1121
+ x.index = I;
631
1122
  });
632
- },
633
- startIcon: /* @__PURE__ */ e(Yt, {}),
634
- children: c("addObject", { object: c("property") })
635
- }
636
- ),
637
- v && /* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(a), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
1123
+ }
1124
+ });
1125
+ },
1126
+ visible: l,
1127
+ onVisibilityChange: (m) => {
1128
+ u((w) => {
1129
+ const n = w.properties[e.id].data;
1130
+ n.visible = m;
1131
+ });
1132
+ },
1133
+ alwaysShowActions: !0,
1134
+ children: /* @__PURE__ */ S(j, { direction: "column", gap: 2, children: [
1135
+ /* @__PURE__ */ t(
1136
+ D,
1137
+ {
1138
+ label: k("key"),
1139
+ size: "small",
1140
+ required: !0,
1141
+ sx: {
1142
+ width: "calc(100% - 80px - 8px)",
1143
+ flex: 1,
1144
+ "& .MuiOutlinedInput-root": {
1145
+ borderColor: e.key ? le(i.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
1146
+ },
1147
+ "& .MuiFormLabel-root": {
1148
+ color: e.key ? le(i.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
1149
+ },
1150
+ "& .MuiFormLabel-root.Mui-focused": {
1151
+ color: e.key ? le(i.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
1152
+ }
1153
+ },
1154
+ value: e.key || "",
1155
+ onChange: (m) => {
1156
+ u((w) => {
1157
+ const n = w.properties[e.id].data;
1158
+ n.key = m.target.value.trim();
1159
+ });
1160
+ },
1161
+ InputProps: {
1162
+ endAdornment: !e.key || e.key && le(i.properties, e.id, e.key) ? /* @__PURE__ */ t(
1163
+ pe,
1164
+ {
1165
+ position: "end",
1166
+ sx: {
1167
+ width: 16,
1168
+ ml: 0
1169
+ },
1170
+ children: /* @__PURE__ */ t(X, { title: e.key ? k("duplicateKey") : k("requiredKey"), children: /* @__PURE__ */ t(
1171
+ dt,
1172
+ {
1173
+ sx: {
1174
+ color: e.key ? "warning.main" : "error.main",
1175
+ fontSize: 16
1176
+ }
1177
+ }
1178
+ ) })
1179
+ }
1180
+ ) : null
1181
+ }
1182
+ }
1183
+ ),
1184
+ /* @__PURE__ */ S(j, { direction: "row", gap: 1, children: [
1185
+ /* @__PURE__ */ t(
1186
+ D,
1187
+ {
1188
+ label: k("label"),
1189
+ size: "small",
1190
+ sx: { flex: 1 },
1191
+ value: (((y = (g = e.locales) == null ? void 0 : g[c]) == null ? void 0 : y.name) ?? ((p = (o = e.locales) == null ? void 0 : o[b]) == null ? void 0 : p.name)) || "",
1192
+ onChange: (m) => {
1193
+ u((w) => {
1194
+ var v;
1195
+ const n = w.properties[e.id].data;
1196
+ n.locales ?? (n.locales = {}), (v = n.locales)[c] ?? (v[c] = {}), n.locales[c].name = m.target.value;
1197
+ });
1198
+ }
1199
+ }
1200
+ ),
1201
+ /* @__PURE__ */ t(
1202
+ D,
1203
+ {
1204
+ label: k("type"),
1205
+ size: "small",
1206
+ select: !0,
1207
+ sx: { flex: 1 },
1208
+ value: e.type === "string" && e.multiline ? "multiline" : e.type || "string",
1209
+ onChange: (m) => {
1210
+ u((w) => {
1211
+ const n = w.properties[e.id].data;
1212
+ if (n.locales)
1213
+ for (const x of Object.keys(n.locales))
1214
+ n.locales[x].defaultValue = void 0;
1215
+ const v = m.target.value;
1216
+ v === "multiline" ? (n.type = "string", n.multiline = !0) : (typeof n.multiline < "u" && delete n.multiline, n.type = v);
1217
+ });
1218
+ },
1219
+ children: Ar.map((m) => /* @__PURE__ */ t(he, { value: m.value, children: m.label }, m.value))
1220
+ }
1221
+ )
1222
+ ] }),
1223
+ /* @__PURE__ */ S(j, { direction: "row", gap: 1, children: [
1224
+ /* @__PURE__ */ t(
1225
+ h,
1226
+ {
1227
+ allComponents: a,
1228
+ defaultLocale: b,
1229
+ component: i,
1230
+ property: e,
1231
+ label: k("defaultValue"),
1232
+ size: "small",
1233
+ fullWidth: !0,
1234
+ value: (d = (s = e.locales) == null ? void 0 : s[c]) == null ? void 0 : d.defaultValue,
1235
+ onChange: (m, w) => {
1236
+ u((n) => {
1237
+ var x;
1238
+ const v = n.properties[e.id].data;
1239
+ if (w != null && w.forceUpdateProperty) {
1240
+ const I = ve(v), f = ve(m);
1241
+ Object.keys(f).forEach((P) => {
1242
+ I[P] || lt(v, P, f[P]);
1243
+ });
1244
+ } else
1245
+ v.locales ?? (v.locales = {}), (x = v.locales)[c] ?? (x[c] = {}), v.locales[c].defaultValue = m;
1246
+ });
1247
+ }
1248
+ }
1249
+ ),
1250
+ e.type === "custom" ? /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(Ur, { property: e, allComponents: a }) }) : null
1251
+ ] })
1252
+ ] })
1253
+ }
1254
+ );
1255
+ }
1256
+ function Tr(e) {
1257
+ const [r, l] = Z(0);
1258
+ return $(() => {
1259
+ if (e.current) {
1260
+ let i = e.current.parentElement, c = 0;
1261
+ for (; i; )
1262
+ i.classList.contains("property-container") && c++, i = i.parentElement;
1263
+ l(c);
1264
+ }
1265
+ }, []), r;
1266
+ }
1267
+ function Er({
1268
+ config: e,
1269
+ currentLocale: r,
1270
+ defaultLocale: l,
1271
+ allComponents: i,
1272
+ onUpdateConfig: c,
1273
+ useI18nEditor: b = !0
1274
+ }) {
1275
+ const { t: a } = N(), u = me({ variant: "dialog" }), k = e.properties && T(Object.values(e.properties), "index");
1276
+ return /* @__PURE__ */ t(Ie, { children: /* @__PURE__ */ S(j, { gap: 2, children: [
1277
+ /* @__PURE__ */ S(j, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
1278
+ /* @__PURE__ */ t(K, { variant: "subtitle1", children: a("properties") }),
1279
+ /* @__PURE__ */ t(O, { flex: 1 }),
1280
+ b && /* @__PURE__ */ t(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...fe(u), children: /* @__PURE__ */ t(st, { fontSize: "small" }) })
638
1281
  ] }),
639
- t.properties && Object.keys(t.properties).length > 0 ? /* @__PURE__ */ e(
640
- sr,
1282
+ e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ t(
1283
+ ht,
641
1284
  {
642
- component: D,
1285
+ component: j,
643
1286
  gap: 2,
644
- list: t.properties,
645
- renderItem: (l, y, f) => {
646
- var x, o, s, g, I, b;
647
- const p = Le(t.properties, l.id);
648
- return /* @__PURE__ */ e(
649
- me,
1287
+ list: e.properties,
1288
+ renderItem: (h, g, y) => {
1289
+ const o = bt(e.properties, h.id);
1290
+ return /* @__PURE__ */ t(
1291
+ re,
650
1292
  {
651
1293
  elevation: 0,
1294
+ className: "property-container",
652
1295
  sx: {
653
1296
  p: 1.25,
654
- bgcolor: "background.paper",
655
1297
  borderRadius: 1,
656
- border: p ? "1px solid" : "1px dashed",
1298
+ border: o ? "1px solid" : "1px dashed",
657
1299
  borderColor: "divider"
658
1300
  },
659
- children: /* @__PURE__ */ e(D, { gap: 2, children: /* @__PURE__ */ e(
660
- dr,
1301
+ children: /* @__PURE__ */ t(j, { gap: 2, children: /* @__PURE__ */ t(
1302
+ yt,
661
1303
  {
662
- preview: f.preview,
663
- drop: f.drop,
664
- drag: f.drag,
665
- isDragging: f.isDragging,
666
- onDelete: () => {
667
- u((d) => {
668
- if (d.properties) {
669
- const m = Object.entries(d.properties).sort(([, C], [, z]) => C.index - z.index);
670
- delete d.properties[l.id], m.filter(([C]) => C !== l.id).forEach(([, C], z) => {
671
- C.index = z;
672
- });
673
- }
674
- });
675
- },
676
- visible: p,
677
- onVisibilityChange: (d) => {
678
- u((h) => {
679
- const m = h.properties[l.id].data;
680
- m.visible = d;
681
- });
682
- },
683
- alwaysShowActions: !0,
684
- children: /* @__PURE__ */ w(D, { direction: "column", gap: 2, children: [
685
- /* @__PURE__ */ e(
686
- O,
687
- {
688
- label: c("key"),
689
- size: "small",
690
- required: !0,
691
- sx: {
692
- width: "calc(100% - 80px - 8px)",
693
- flex: 1,
694
- "& .MuiOutlinedInput-root": {
695
- borderColor: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : void 0 : "error.main"
696
- },
697
- "& .MuiFormLabel-root": {
698
- color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "text.secondary" : "error.main"
699
- },
700
- "& .MuiFormLabel-root.Mui-focused": {
701
- color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "primary.main" : "error.main"
702
- }
703
- },
704
- value: l.key || "",
705
- onChange: (d) => {
706
- u((h) => {
707
- const m = h.properties[l.id].data;
708
- m.key = d.target.value.trim();
709
- });
710
- },
711
- InputProps: {
712
- endAdornment: !l.key || l.key && te(t.properties, l.id, l.key) ? /* @__PURE__ */ e(
713
- oe,
714
- {
715
- position: "end",
716
- sx: {
717
- width: 16,
718
- ml: 0
719
- },
720
- children: /* @__PURE__ */ e(Q, { title: l.key ? c("duplicateKey") : c("requiredKey"), children: /* @__PURE__ */ e(
721
- Ge,
722
- {
723
- sx: {
724
- color: l.key ? "warning.main" : "error.main",
725
- fontSize: 16
726
- }
727
- }
728
- ) })
729
- }
730
- ) : null
731
- }
732
- }
733
- ),
734
- /* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
735
- /* @__PURE__ */ e(
736
- O,
737
- {
738
- label: c("label"),
739
- size: "small",
740
- sx: { flex: 1 },
741
- value: (((o = (x = l.locales) == null ? void 0 : x[r]) == null ? void 0 : o.name) ?? ((g = (s = l.locales) == null ? void 0 : s[i]) == null ? void 0 : g.name)) || "",
742
- onChange: (d) => {
743
- u((h) => {
744
- var S;
745
- const m = h.properties[l.id].data;
746
- m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].name = d.target.value;
747
- });
748
- }
749
- }
750
- ),
751
- /* @__PURE__ */ w(
752
- O,
753
- {
754
- label: c("type"),
755
- size: "small",
756
- select: !0,
757
- sx: { flex: 1 },
758
- value: l.type === "string" && l.multiline ? "multiline" : l.type || "string",
759
- onChange: (d) => {
760
- u((h) => {
761
- const m = h.properties[l.id].data;
762
- if (m.locales)
763
- for (const C of Object.keys(m.locales))
764
- m.locales[C].defaultValue = void 0;
765
- const S = d.target.value;
766
- S === "multiline" ? (m.type = "string", m.multiline = !0) : (typeof m.multiline < "u" && delete m.multiline, m.type = S);
767
- });
768
- },
769
- children: [
770
- /* @__PURE__ */ e(R, { value: "string", children: "Text" }),
771
- /* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
772
- /* @__PURE__ */ e(R, { value: "number", children: "Number" }),
773
- /* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
774
- /* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
775
- /* @__PURE__ */ e(R, { value: "color", children: "Color" }),
776
- /* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
777
- /* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
778
- /* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
779
- /* @__PURE__ */ e(R, { value: "component", children: "Component" }),
780
- /* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
781
- ]
782
- }
783
- )
784
- ] }),
785
- /* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
786
- /* @__PURE__ */ e(
787
- W,
788
- {
789
- allComponents: n,
790
- defaultLocale: i,
791
- component: t,
792
- property: l,
793
- label: c("defaultValue"),
794
- size: "small",
795
- fullWidth: !0,
796
- value: (b = (I = l.locales) == null ? void 0 : I[r]) == null ? void 0 : b.defaultValue,
797
- onChange: (d) => {
798
- u((h) => {
799
- var S;
800
- const m = h.properties[l.id].data;
801
- m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].defaultValue = d;
802
- });
803
- }
804
- }
805
- ),
806
- l.type === "custom" ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(hr, { property: l, allComponents: n }) }) : null
807
- ] })
808
- ] })
1304
+ data: h,
1305
+ params: y,
1306
+ visible: o,
1307
+ config: e,
1308
+ currentLocale: r,
1309
+ defaultLocale: l,
1310
+ allComponents: i,
1311
+ onUpdateConfig: c
809
1312
  }
810
1313
  ) })
811
1314
  },
812
- l.id
1315
+ h.id
813
1316
  );
814
1317
  }
815
1318
  }
816
- ) : /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: c("maker.properties.noProperties") }),
817
- v && /* @__PURE__ */ e(et, { ...Qe(a), component: t })
1319
+ ) : /* @__PURE__ */ t(te, { style: { fontSize: 12 }, children: a("maker.properties.noProperties") }),
1320
+ /* @__PURE__ */ t(
1321
+ A,
1322
+ {
1323
+ fullWidth: !0,
1324
+ variant: "outlined",
1325
+ className: "ignore-style-override",
1326
+ onClick: () => {
1327
+ c((h) => {
1328
+ var y;
1329
+ const g = Je();
1330
+ h.properties ?? (h.properties = {}), (y = h.properties)[g] ?? (y[g] = { index: (k == null ? void 0 : k.length) || 0, data: { id: g } });
1331
+ });
1332
+ },
1333
+ startIcon: /* @__PURE__ */ t(ct, {}),
1334
+ children: a("addObject", { object: a("property") })
1335
+ }
1336
+ ),
1337
+ b && /* @__PURE__ */ t(vt, { ...ut(u), component: e })
818
1338
  ] }) });
819
1339
  }
820
- function hr({
821
- property: t,
1340
+ function Ur({
1341
+ property: e,
822
1342
  allComponents: r
823
1343
  }) {
824
- const i = se({ variant: "popper" });
825
- return /* @__PURE__ */ w(U, { children: [
826
- /* @__PURE__ */ e(A, { sx: { minWidth: 0 }, ...ce(i), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
827
- /* @__PURE__ */ e(_e, { ...Xe(i), children: /* @__PURE__ */ e($e, { onClickAway: i.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(P, { width: 500, p: 2, children: /* @__PURE__ */ e(
828
- ye,
1344
+ const l = me({ variant: "popper" });
1345
+ return /* @__PURE__ */ S(J, { children: [
1346
+ /* @__PURE__ */ t(A, { sx: { minWidth: 0 }, ...fe(l), children: /* @__PURE__ */ t(at, { fontSize: "small" }) }),
1347
+ /* @__PURE__ */ t(Ze, { ...pt(l), children: /* @__PURE__ */ t(nt, { onClickAway: l.close, children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(O, { width: 500, p: 2, children: /* @__PURE__ */ t(
1348
+ Se,
829
1349
  {
830
- value: t.componentId,
831
- onChange: (n, u) => t.componentId = u,
1350
+ value: e.componentId,
1351
+ onChange: (i, c) => e.componentId = c,
832
1352
  allComponents: r
833
1353
  }
834
1354
  ) }) }) }) })
835
1355
  ] });
836
1356
  }
837
- function fr({
838
- value: t,
1357
+ function Wr({
1358
+ value: e,
839
1359
  valueImmutable: r,
840
- onChange: i,
841
- defaultLocale: n,
842
- allComponents: u
1360
+ onChange: l,
1361
+ defaultLocale: i,
1362
+ allComponents: c
843
1363
  }) {
844
1364
  var k;
845
- const v = se({ variant: "popper" }), { locale: c } = j(), a = typeof (t == null ? void 0 : t.componentId) == "string" ? (k = u[t.componentId]) == null ? void 0 : k.data : void 0;
846
- return a ? /* @__PURE__ */ w(U, { children: [
847
- /* @__PURE__ */ e(A, { sx: { minWidth: 0 }, disabled: !a, ...ce(v), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
848
- /* @__PURE__ */ e(
849
- _e,
1365
+ const b = me({ variant: "popper" }), { locale: a } = N(), u = typeof (e == null ? void 0 : e.componentId) == "string" ? (k = c[e.componentId]) == null ? void 0 : k.data : void 0;
1366
+ return u ? /* @__PURE__ */ S(J, { children: [
1367
+ /* @__PURE__ */ t(A, { sx: { minWidth: 0 }, disabled: !u, ...fe(b), children: /* @__PURE__ */ t(at, { fontSize: "small" }) }),
1368
+ /* @__PURE__ */ t(
1369
+ Ze,
850
1370
  {
851
- ...Xe(v),
1371
+ ...pt(b),
852
1372
  sx: {
853
1373
  zIndex: 1e3
854
1374
  },
855
- children: /* @__PURE__ */ e($e, { onClickAway: v.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ w(P, { width: 500, p: 2, children: [
856
- /* @__PURE__ */ e(V, { variant: "subtitle1", children: "Parameters" }),
857
- /* @__PURE__ */ e(D, { gap: 1, children: (a == null ? void 0 : a.properties) && F(Object.values(a.properties), "index").map(({ data: l }) => {
858
- var y, f, p, x, o, s, g, I;
859
- return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
860
- W,
1375
+ children: /* @__PURE__ */ t(nt, { onClickAway: b.close, children: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ S(O, { width: 500, p: 2, children: [
1376
+ /* @__PURE__ */ t(K, { variant: "subtitle1", children: "Parameters" }),
1377
+ /* @__PURE__ */ t(j, { gap: 1, children: (u == null ? void 0 : u.properties) && T(Object.values(u.properties), "index").map(({ data: h }) => {
1378
+ var g, y, o, p, s, d, m, w;
1379
+ return /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
1380
+ B,
861
1381
  {
862
- allComponents: u,
863
- defaultLocale: n,
1382
+ allComponents: c,
1383
+ defaultLocale: i,
864
1384
  size: "small",
865
1385
  fullWidth: !0,
866
- component: a,
867
- property: l,
868
- valueImmutable: L((f = (y = t.properties) == null ? void 0 : y[l.id]) == null ? void 0 : f.value),
869
- value: ((x = (p = t.properties) == null ? void 0 : p[l.id]) == null ? void 0 : x.value) ?? ((s = (o = l.locales) == null ? void 0 : o[c]) == null ? void 0 : s.defaultValue) ?? ((I = (g = l.locales) == null ? void 0 : g[n]) == null ? void 0 : I.defaultValue),
870
- onChange: (b) => {
1386
+ component: u,
1387
+ property: h,
1388
+ valueImmutable: ee((y = (g = e.properties) == null ? void 0 : g[h.id]) == null ? void 0 : y.value),
1389
+ value: ((p = (o = e.properties) == null ? void 0 : o[h.id]) == null ? void 0 : p.value) ?? ((d = (s = h.locales) == null ? void 0 : s[a]) == null ? void 0 : d.defaultValue) ?? ((w = (m = h.locales) == null ? void 0 : m[i]) == null ? void 0 : w.defaultValue),
1390
+ onChange: (n) => {
871
1391
  if (r) {
872
- const d = JSON.parse(JSON.stringify(t));
873
- i == null || i({ ...d, properties: { ...d.properties, [l.id]: { value: b } } });
1392
+ const v = JSON.parse(JSON.stringify(e));
1393
+ l == null || l({ ...v, properties: { ...v.properties, [h.id]: { value: n } } });
874
1394
  } else
875
- _(a).doc.transact(() => {
876
- t.properties ?? (t.properties = {}), t.properties[l.id] = { value: b };
1395
+ M(u).doc.transact(() => {
1396
+ e.properties ?? (e.properties = {}), e.properties[h.id] = { value: n };
877
1397
  });
878
1398
  }
879
1399
  }
880
- ) }, l.id);
1400
+ ) }, h.id);
881
1401
  }) })
882
1402
  ] }) }) })
883
1403
  }
884
1404
  )
885
1405
  ] }) : null;
886
1406
  }
887
- function et({
888
- type: t = "properties",
1407
+ function vt({
1408
+ type: e = "properties",
889
1409
  component: r,
890
- ...i
1410
+ ...l
891
1411
  }) {
892
- var f, p, x;
893
- const { t: n } = j(), {
1412
+ var y, o, p;
1413
+ const { t: i } = N(), {
894
1414
  state: {
895
- components: u,
896
- supportedLocales: v,
897
- config: { defaultLocale: c }
1415
+ components: c,
1416
+ supportedLocales: b,
1417
+ config: { defaultLocale: a }
898
1418
  }
899
- } = le(), a = ae(), k = _(r).doc, l = t === "properties" ? r.properties : t === "parameters" && ((f = r.renderer) == null ? void 0 : f.type) === "component" ? (p = u[r.renderer.componentId]) == null ? void 0 : p.data.properties : void 0, y = ((x = r.renderer) == null ? void 0 : x.type) === "component" ? r : void 0;
900
- return /* @__PURE__ */ w(pe, { ...i, fullWidth: !0, maxWidth: "lg", children: [
901
- /* @__PURE__ */ e(Ue, { children: n("i18nEditorTitle") }),
902
- /* @__PURE__ */ e(We, { children: l && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ w(ot, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
903
- /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e(Oe, { children: v.map(({ locale: o, name: s }) => /* @__PURE__ */ w(ze, { children: [
904
- s,
905
- c === o && /* @__PURE__ */ e(Gt, { sx: { fontSize: 12, color: "text.secondary" } })
906
- ] }, o)) }) }),
907
- /* @__PURE__ */ e(ct, { children: F(Object.values(l), "index").map(({ data: o }) => /* @__PURE__ */ e(Oe, { children: v.map(({ locale: s }) => {
908
- var g, I, b, d, h, m, S, C, z, T, K, E, H, J, ee, M, $, Y, G, q, ve, xe, ge, ke, Ie, we;
909
- return /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(D, { gap: 1, children: t === "properties" ? /* @__PURE__ */ w(U, { children: [
910
- /* @__PURE__ */ e(
911
- O,
1419
+ } = ue(), u = xe(), k = M(r).doc, h = e === "properties" ? r.properties : e === "parameters" && ((y = r.renderer) == null ? void 0 : y.type) === "component" ? (o = c[r.renderer.componentId]) == null ? void 0 : o.data.properties : void 0, g = ((p = r.renderer) == null ? void 0 : p.type) === "component" ? r : void 0;
1420
+ return /* @__PURE__ */ S(we, { ...l, fullWidth: !0, maxWidth: "lg", children: [
1421
+ /* @__PURE__ */ t(qe, { children: i("i18nEditorTitle") }),
1422
+ /* @__PURE__ */ t(Le, { children: h && /* @__PURE__ */ t(j, { children: /* @__PURE__ */ S($e, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1423
+ /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ t(se, { children: b.map(({ locale: s, name: d }) => /* @__PURE__ */ S(ce, { children: [
1424
+ d,
1425
+ a === s && /* @__PURE__ */ t(cr, { sx: { fontSize: 12, color: "text.secondary" } })
1426
+ ] }, s)) }) }),
1427
+ /* @__PURE__ */ t(He, { children: T(Object.values(h), "index").map(({ data: s }) => /* @__PURE__ */ t(se, { children: b.map(({ locale: d }) => {
1428
+ var m, w, n, v, x, I, f, P, z, R, C, E, U, H, ie, Y, G, q, L, Q, Oe, je, ze, Re, De, Ne;
1429
+ return /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ S(J, { children: [
1430
+ /* @__PURE__ */ t(
1431
+ D,
912
1432
  {
913
1433
  size: "small",
914
1434
  label: "Key",
915
- value: o.key || "",
916
- onChange: (B) => {
1435
+ value: s.key || "",
1436
+ onChange: (_) => {
917
1437
  k.transact(() => {
918
- o.key = B.target.value.trim();
1438
+ s.key = _.target.value.trim();
919
1439
  });
920
1440
  }
921
1441
  }
922
1442
  ),
923
- /* @__PURE__ */ e(
924
- O,
1443
+ /* @__PURE__ */ t(
1444
+ D,
925
1445
  {
926
1446
  size: "small",
927
- label: n("label"),
928
- value: (((I = (g = o.locales) == null ? void 0 : g[s]) == null ? void 0 : I.name) ?? ((d = (b = o.locales) == null ? void 0 : b[c]) == null ? void 0 : d.name)) || "",
929
- onChange: (B) => {
1447
+ label: i("label"),
1448
+ value: (((w = (m = s.locales) == null ? void 0 : m[d]) == null ? void 0 : w.name) ?? ((v = (n = s.locales) == null ? void 0 : n[a]) == null ? void 0 : v.name)) || "",
1449
+ onChange: (_) => {
930
1450
  k.transact(() => {
931
- var N;
932
- o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].name = B.target.value;
1451
+ var W;
1452
+ s.locales ?? (s.locales = {}), (W = s.locales)[d] ?? (W[d] = {}), s.locales[d].name = _.target.value;
933
1453
  });
934
1454
  }
935
1455
  }
936
1456
  ),
937
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
938
- W,
1457
+ /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
1458
+ B,
939
1459
  {
940
- allComponents: a,
941
- defaultLocale: c,
1460
+ allComponents: u,
1461
+ defaultLocale: a,
942
1462
  component: r,
943
- property: o,
1463
+ property: s,
944
1464
  size: "small",
945
1465
  fullWidth: !0,
946
1466
  label: "Default Value",
947
- valueImmutable: L((m = (h = o.locales) == null ? void 0 : h[s]) == null ? void 0 : m.defaultValue),
948
- value: ((C = (S = o.locales) == null ? void 0 : S[s]) == null ? void 0 : C.defaultValue) ?? ((T = (z = o.locales) == null ? void 0 : z[c]) == null ? void 0 : T.defaultValue),
949
- onChange: (B) => {
1467
+ valueImmutable: ee((I = (x = s.locales) == null ? void 0 : x[d]) == null ? void 0 : I.defaultValue),
1468
+ value: ((P = (f = s.locales) == null ? void 0 : f[d]) == null ? void 0 : P.defaultValue) ?? ((R = (z = s.locales) == null ? void 0 : z[a]) == null ? void 0 : R.defaultValue),
1469
+ onChange: (_) => {
950
1470
  k.transact(() => {
951
- var N;
952
- o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].defaultValue = B;
1471
+ var W;
1472
+ s.locales ?? (s.locales = {}), (W = s.locales)[d] ?? (W[d] = {}), s.locales[d].defaultValue = _;
953
1473
  });
954
1474
  }
955
1475
  }
956
1476
  ) })
957
- ] }) : t === "parameters" && y ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
958
- W,
1477
+ ] }) : e === "parameters" && g ? /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
1478
+ B,
959
1479
  {
960
- allComponents: a,
961
- defaultLocale: c,
1480
+ allComponents: u,
1481
+ defaultLocale: a,
962
1482
  component: r,
963
- property: o,
1483
+ property: s,
964
1484
  size: "small",
965
1485
  fullWidth: !0,
966
- valueImmutable: L(
967
- (J = (H = (E = (K = y.renderer.properties) == null ? void 0 : K[o.id]) == null ? void 0 : E.locales) == null ? void 0 : H[s]) == null ? void 0 : J.value
1486
+ valueImmutable: ee(
1487
+ (H = (U = (E = (C = g.renderer.properties) == null ? void 0 : C[s.id]) == null ? void 0 : E.locales) == null ? void 0 : U[d]) == null ? void 0 : H.value
968
1488
  ),
969
- value: ((Y = ($ = (M = (ee = y.renderer.properties) == null ? void 0 : ee[o.id]) == null ? void 0 : M.locales) == null ? void 0 : $[s]) == null ? void 0 : Y.value) ?? ((xe = (ve = (q = (G = y.renderer.properties) == null ? void 0 : G[o.id]) == null ? void 0 : q.locales) == null ? void 0 : ve[c]) == null ? void 0 : xe.value) ?? ((ke = (ge = o.locales) == null ? void 0 : ge[s]) == null ? void 0 : ke.defaultValue) ?? ((we = (Ie = o.locales) == null ? void 0 : Ie[c]) == null ? void 0 : we.defaultValue),
970
- onChange: (B) => {
1489
+ value: ((q = (G = (Y = (ie = g.renderer.properties) == null ? void 0 : ie[s.id]) == null ? void 0 : Y.locales) == null ? void 0 : G[d]) == null ? void 0 : q.value) ?? ((je = (Oe = (Q = (L = g.renderer.properties) == null ? void 0 : L[s.id]) == null ? void 0 : Q.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((Re = (ze = s.locales) == null ? void 0 : ze[d]) == null ? void 0 : Re.defaultValue) ?? ((Ne = (De = s.locales) == null ? void 0 : De[a]) == null ? void 0 : Ne.defaultValue),
1490
+ onChange: (_) => {
971
1491
  k.transact(() => {
972
- var N, Se, Pe, Ce, De;
973
- (N = y.renderer).properties ?? (N.properties = {}), (Se = y.renderer.properties)[Pe = o.id] ?? (Se[Pe] = {}), (Ce = y.renderer.properties[o.id]).locales ?? (Ce.locales = {}), (De = y.renderer.properties[o.id].locales)[s] ?? (De[s] = {}), y.renderer.properties[o.id].locales[s].value = B;
1492
+ var W, Ae, Ce, Ve, Te;
1493
+ (W = g.renderer).properties ?? (W.properties = {}), (Ae = g.renderer.properties)[Ce = s.id] ?? (Ae[Ce] = {}), (Ve = g.renderer.properties[s.id]).locales ?? (Ve.locales = {}), (Te = g.renderer.properties[s.id].locales)[d] ?? (Te[d] = {}), g.renderer.properties[s.id].locales[d].value = _;
974
1494
  });
975
1495
  }
976
1496
  }
977
- ) }) : null }, o.id) }, s);
978
- }) }, o.id)) })
1497
+ ) }) : null }, s.id) }, d);
1498
+ }) }, s.id)) })
979
1499
  ] }) }) }),
980
- /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(A, { onClick: (o) => {
981
- var s;
982
- return (s = i.onClose) == null ? void 0 : s.call(i, o, "escapeKeyDown");
983
- }, children: n("close") }) })
1500
+ /* @__PURE__ */ t(Qe, { children: /* @__PURE__ */ t(A, { onClick: (s) => {
1501
+ var d;
1502
+ return (d = l.onClose) == null ? void 0 : d.call(l, s, "escapeKeyDown");
1503
+ }, children: i("close") }) })
1504
+ ] });
1505
+ }
1506
+ const Ke = (e, r) => (l) => {
1507
+ const i = [
1508
+ l.palette.primary.main,
1509
+ l.palette.secondary.main,
1510
+ l.palette.success.main,
1511
+ l.palette.warning.main,
1512
+ l.palette.info.main
1513
+ ], c = e % i.length, b = i[c % i.length], a = We(b, 0.5), u = We(b, 1);
1514
+ return {
1515
+ // 保留原有的边框样式
1516
+ borderColor: `${a} !important`,
1517
+ borderLeft: "3px solid !important",
1518
+ // 稍粗的左侧边框
1519
+ borderLeftColor: a,
1520
+ // 使用透明度适应深色/浅色模式
1521
+ color: u,
1522
+ ...r
1523
+ };
1524
+ };
1525
+ function Br({
1526
+ property: e,
1527
+ onChange: r,
1528
+ defaultLocale: l,
1529
+ allComponents: i
1530
+ }) {
1531
+ const { t: c, locale: b } = N(), a = F(null), u = Tr(a), k = V(() => {
1532
+ if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
1533
+ try {
1534
+ const h = {};
1535
+ T(Object.values(e.subProperties), "index").filter(
1536
+ (o) => o.data.visible !== !1 && o.data.key
1537
+ ).forEach(({ data: o }) => {
1538
+ var s, d, m, w;
1539
+ if (!o.key) return;
1540
+ let p = ((d = (s = o.locales) == null ? void 0 : s[b]) == null ? void 0 : d.defaultValue) ?? ((w = (m = o.locales) == null ? void 0 : m[l]) == null ? void 0 : w.defaultValue);
1541
+ if (o.type === "number")
1542
+ p = Number(p);
1543
+ else if (o.type === "boolean")
1544
+ p = p === !0 || p === "true";
1545
+ else if ((o.type === "json" || o.type === "yaml") && typeof p == "string")
1546
+ try {
1547
+ o.type === "json" ? p = JSON.parse(p) : p = ae.parse(p);
1548
+ } catch (n) {
1549
+ console.error("Error parsing nested value", p, n), p = {};
1550
+ }
1551
+ h[o.key] = p;
1552
+ });
1553
+ const y = ft(h, e.type);
1554
+ r == null || r(y);
1555
+ } catch (h) {
1556
+ console.error("Error converting structure to text:", h);
1557
+ }
1558
+ }, [e, b, l, r]);
1559
+ return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ S(j, { direction: "column", gap: 1.5, sx: { width: "100%" }, children: [
1560
+ /* @__PURE__ */ t(jt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(K, { variant: "caption", color: "text.secondary", children: c("maker.properties.subProperties") }) }),
1561
+ e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ t(
1562
+ ht,
1563
+ {
1564
+ component: j,
1565
+ gap: 2,
1566
+ list: e.subProperties,
1567
+ renderItem: (h, g, y) => {
1568
+ const o = h.visible !== !1;
1569
+ return /* @__PURE__ */ t(
1570
+ re,
1571
+ {
1572
+ ref: a,
1573
+ elevation: 0,
1574
+ className: "property-container",
1575
+ sx: {
1576
+ p: 1.25,
1577
+ borderRadius: 1,
1578
+ border: o ? "1px solid" : "1px dashed",
1579
+ "&": Ke(u)
1580
+ },
1581
+ children: /* @__PURE__ */ t(j, { gap: 2, children: /* @__PURE__ */ t(
1582
+ yt,
1583
+ {
1584
+ data: h,
1585
+ params: y,
1586
+ visible: o,
1587
+ config: {
1588
+ properties: e.subProperties
1589
+ },
1590
+ currentLocale: b,
1591
+ defaultLocale: l,
1592
+ allComponents: i,
1593
+ onUpdateConfig: (p) => {
1594
+ try {
1595
+ const s = { properties: e.subProperties || {} };
1596
+ p(s);
1597
+ const d = {
1598
+ ...e,
1599
+ subProperties: s.properties
1600
+ };
1601
+ r == null || r(d, { forceUpdateProperty: !0 }), k();
1602
+ } catch (s) {
1603
+ console.error("Error updating property:", s);
1604
+ }
1605
+ }
1606
+ }
1607
+ ) })
1608
+ },
1609
+ h.id
1610
+ );
1611
+ }
1612
+ }
1613
+ ) : /* @__PURE__ */ t(te, { style: { fontSize: 12, height: 100 }, children: c("maker.properties.noSubProperties") }),
1614
+ /* @__PURE__ */ t(
1615
+ A,
1616
+ {
1617
+ fullWidth: !0,
1618
+ variant: "outlined",
1619
+ className: "ignore-style-override",
1620
+ size: "small",
1621
+ startIcon: /* @__PURE__ */ t(ct, {}),
1622
+ onClick: () => {
1623
+ try {
1624
+ const h = e.subProperties || {}, g = Je(), o = {
1625
+ index: Object.values(h).length,
1626
+ data: {
1627
+ id: g,
1628
+ key: "",
1629
+ type: "string",
1630
+ visible: !0,
1631
+ locales: {
1632
+ [b]: {
1633
+ name: "",
1634
+ defaultValue: ""
1635
+ }
1636
+ },
1637
+ // 为嵌套属性预初始化
1638
+ subProperties: {}
1639
+ }
1640
+ }, p = {
1641
+ ...e,
1642
+ subProperties: {
1643
+ ...h,
1644
+ [g]: o
1645
+ }
1646
+ };
1647
+ r == null || r(p, { forceUpdateProperty: !0 }), k();
1648
+ } catch (h) {
1649
+ console.error("Error adding property:", h);
1650
+ }
1651
+ },
1652
+ sx: {
1653
+ "&": Ke(u, {
1654
+ // borderLeft: undefined,
1655
+ })
1656
+ },
1657
+ children: c("maker.properties.addSubProperty")
1658
+ }
1659
+ )
984
1660
  ] });
985
1661
  }
986
- function W({
987
- component: t,
1662
+ function B({
1663
+ component: e,
988
1664
  property: r,
989
- value: i,
990
- onChange: n,
991
- valueImmutable: u,
992
- defaultLocale: v,
993
- allComponents: c,
994
- ...a
1665
+ value: l,
1666
+ onChange: i,
1667
+ valueImmutable: c,
1668
+ defaultLocale: b,
1669
+ allComponents: a,
1670
+ ...u
995
1671
  }) {
996
- var x, o, s, g, I;
997
- const { locale: k } = j(), l = Kt(), y = Z(null), f = () => {
998
- var d;
999
- const b = (d = l == null ? void 0 : l.current) == null ? void 0 : d.getUploader();
1000
- b == null || b.open(), y.current && b.onceUploadSuccess(({ response: h }) => {
1001
- var S, C;
1002
- let m = ((S = h == null ? void 0 : h.data) == null ? void 0 : S.filename) || "";
1003
- m && (m = `mediakit://${m}`, i && !i.includes("mediakit://") && (m += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (C = y.current) == null || C.call(y, m);
1672
+ var p, s, d, m, w;
1673
+ const { locale: k } = N(), h = Zt(), g = F(null), y = () => {
1674
+ var v;
1675
+ const n = (v = h == null ? void 0 : h.current) == null ? void 0 : v.getUploader();
1676
+ n == null || n.open(), g.current && n.onceUploadSuccess(({ response: x }) => {
1677
+ var f, P;
1678
+ let I = ((f = x == null ? void 0 : x.data) == null ? void 0 : f.filename) || "";
1679
+ I && (I = `mediakit://${I}`, l && !l.includes("mediakit://") && (I += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (P = g.current) == null || P.call(g, I);
1004
1680
  });
1005
- }, p = a.label || ((o = (x = r.locales) == null ? void 0 : x[k]) == null ? void 0 : o.name) || ((g = (s = r.locales) == null ? void 0 : s[v]) == null ? void 0 : g.name) || r.key || r.id;
1681
+ }, o = u.label || ((s = (p = r.locales) == null ? void 0 : p[k]) == null ? void 0 : s.name) || ((m = (d = r.locales) == null ? void 0 : d[b]) == null ? void 0 : m.name) || r.key || r.id;
1006
1682
  if (r.type === "number")
1007
- return /* @__PURE__ */ e(
1008
- br,
1683
+ return /* @__PURE__ */ t(
1684
+ Kr,
1009
1685
  {
1010
- ...a,
1011
- label: p,
1686
+ ...u,
1687
+ label: o,
1012
1688
  NumberProps: {
1013
- value: ["number", "string"].includes(typeof i) ? i : null,
1014
- onChange: (b, d) => n == null ? void 0 : n(d)
1689
+ value: ["number", "string"].includes(typeof l) ? l : null,
1690
+ onChange: (n, v) => i == null ? void 0 : i(v)
1015
1691
  }
1016
1692
  }
1017
1693
  );
1018
1694
  if (r.type === "decimal")
1019
- return /* @__PURE__ */ e(
1020
- O,
1695
+ return /* @__PURE__ */ t(
1696
+ D,
1021
1697
  {
1022
- ...a,
1023
- label: p,
1698
+ ...u,
1699
+ label: o,
1024
1700
  type: "text",
1025
- value: i ?? "",
1026
- onChange: (b) => {
1027
- const d = b.target.value;
1028
- if (d === "" || d === "-") {
1029
- n == null || n(d);
1701
+ value: l ?? "",
1702
+ onChange: (n) => {
1703
+ const v = n.target.value;
1704
+ if (v === "" || v === "-") {
1705
+ i == null || i(v);
1030
1706
  return;
1031
1707
  }
1032
- if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(d)) {
1033
- let m = d;
1034
- /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(m) && (m = Number(m)), n == null || n(m);
1708
+ if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(v)) {
1709
+ let I = v;
1710
+ /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(I) && (I = Number(I)), i == null || i(I);
1035
1711
  }
1036
1712
  }
1037
1713
  }
1038
1714
  );
1039
1715
  if (r.type === "boolean")
1040
- return /* @__PURE__ */ e(
1041
- Ne,
1716
+ return /* @__PURE__ */ t(
1717
+ Ye,
1042
1718
  {
1043
- label: p,
1719
+ label: o,
1044
1720
  labelPlacement: "start",
1045
- control: /* @__PURE__ */ e(Be, { checked: i === !0, onChange: (b, d) => n == null ? void 0 : n(d) })
1721
+ control: /* @__PURE__ */ t(Ge, { checked: l === !0, onChange: (n, v) => i == null ? void 0 : i(v) })
1046
1722
  }
1047
1723
  );
1048
1724
  if (r.type === "color")
1049
- return /* @__PURE__ */ e(
1050
- or,
1725
+ return /* @__PURE__ */ t(
1726
+ jr,
1051
1727
  {
1052
- label: p,
1053
- value: i,
1054
- onChange: (b) => {
1055
- n == null || n(b);
1728
+ label: o,
1729
+ value: l,
1730
+ onChange: (n) => {
1731
+ i == null || i(n);
1056
1732
  }
1057
1733
  }
1058
1734
  );
1059
1735
  if (r.type === "json" || r.type === "yaml")
1060
- return /* @__PURE__ */ w(
1061
- D,
1736
+ return /* @__PURE__ */ t(
1737
+ zr,
1062
1738
  {
1063
- sx: {
1064
- width: "100%",
1065
- position: "relative",
1066
- pt: 1,
1067
- pb: "6px",
1068
- px: "1px",
1069
- minHeight: 50,
1070
- ".monaco-editor,.overflow-guard": { borderRadius: 1 }
1739
+ label: o,
1740
+ value: l,
1741
+ onChange: (n) => {
1742
+ i == null || i(n);
1071
1743
  },
1072
- children: [
1073
- /* @__PURE__ */ e(
1074
- lt,
1075
- {
1076
- sx: {
1077
- position: "absolute",
1078
- left: 0,
1079
- top: 0,
1080
- transform: "translate(0px, -7px) scale(0.75)"
1081
- },
1082
- children: p
1083
- }
1084
- ),
1085
- /* @__PURE__ */ e(
1086
- Je,
1087
- {
1088
- keyId: r.id,
1089
- locale: k,
1090
- language: r.type === "yaml" ? "yaml" : "json",
1091
- value: typeof i == "string" ? i : "",
1092
- onChange: (b) => n == null ? void 0 : n(b),
1093
- onUpload: (b) => {
1094
- y.current = b, f();
1095
- }
1096
- },
1097
- r.id
1098
- ),
1099
- /* @__PURE__ */ e(
1100
- P,
1101
- {
1102
- component: "fieldset",
1103
- sx: {
1104
- pointerEvents: "none",
1105
- position: "absolute",
1106
- left: 0,
1107
- top: -5,
1108
- width: "100%",
1109
- height: "100%",
1110
- border: 1,
1111
- borderColor: "rgba(0, 0, 0, 0.23)",
1112
- borderRadius: 1,
1113
- px: 1,
1114
- py: 0
1115
- },
1116
- children: /* @__PURE__ */ e(P, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(P, { component: "span", sx: { opacity: 0 }, children: a.label }) })
1117
- }
1118
- )
1119
- ]
1744
+ property: r,
1745
+ component: e,
1746
+ defaultLocale: b,
1747
+ allComponents: a,
1748
+ PropertyValueField: B,
1749
+ onUpload: (n) => {
1750
+ g.current = n, y();
1751
+ }
1120
1752
  }
1121
1753
  );
1122
1754
  if (r.type === "custom") {
1123
- const b = (I = c[r.componentId]) == null ? void 0 : I.data;
1124
- return b ? /* @__PURE__ */ e(P, { width: "100%", children: /* @__PURE__ */ e(
1125
- Me,
1755
+ const n = (w = a[r.componentId]) == null ? void 0 : w.data;
1756
+ return n ? /* @__PURE__ */ t(O, { width: "100%", children: /* @__PURE__ */ t(
1757
+ ot,
1126
1758
  {
1127
- componentId: b.id,
1128
- props: { label: p, value: i, onChange: n },
1759
+ componentId: n.id,
1760
+ props: { label: o, value: l, onChange: i },
1129
1761
  locale: k,
1130
1762
  dev: {
1131
1763
  mode: "draft",
1132
- components: c,
1133
- defaultLocale: v
1764
+ components: a,
1765
+ defaultLocale: b
1134
1766
  }
1135
1767
  }
1136
- ) }) : /* @__PURE__ */ e(O, { ...a, label: p, disabled: !0, placeholder: "Click right button select a component" });
1768
+ ) }) : /* @__PURE__ */ t(D, { ...u, label: o, disabled: !0, placeholder: "Click right button select a component" });
1137
1769
  }
1138
1770
  if (r.type === "component")
1139
- return /* @__PURE__ */ w(D, { width: "100%", direction: "row", gap: 1, children: [
1140
- /* @__PURE__ */ e(P, { flex: 1, children: /* @__PURE__ */ e(
1141
- ye,
1771
+ return /* @__PURE__ */ S(j, { width: "100%", direction: "row", gap: 1, children: [
1772
+ /* @__PURE__ */ t(O, { flex: 1, children: /* @__PURE__ */ t(
1773
+ Se,
1142
1774
  {
1143
- allComponents: c,
1144
- label: p,
1145
- value: i == null ? void 0 : i.componentId,
1146
- onChange: (b, d) => {
1147
- u || !i ? n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: d }) : typeof i == "object" && (i.componentId = d);
1775
+ allComponents: a,
1776
+ label: o,
1777
+ value: l == null ? void 0 : l.componentId,
1778
+ onChange: (n, v) => {
1779
+ c || !l ? i == null || i({ ...l && JSON.parse(JSON.stringify(l)), componentId: v }) : typeof l == "object" && (l.componentId = v);
1148
1780
  }
1149
1781
  }
1150
1782
  ) }),
1151
- /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1152
- fr,
1783
+ /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
1784
+ Wr,
1153
1785
  {
1154
- value: i,
1155
- valueImmutable: u,
1156
- onChange: n,
1157
- defaultLocale: v,
1158
- allComponents: c
1786
+ value: l,
1787
+ valueImmutable: c,
1788
+ onChange: i,
1789
+ defaultLocale: b,
1790
+ allComponents: a
1159
1791
  }
1160
1792
  ) })
1161
1793
  ] });
1162
1794
  if (!r.type || ["string", "url"].includes(r.type)) {
1163
- const b = r.type === "string" ? r.multiline : void 0, d = r.type === "url" ? i == null ? void 0 : i.url : i;
1164
- return /* @__PURE__ */ e(
1165
- O,
1795
+ const n = r.type === "string" ? r.multiline : void 0, v = r.type === "url" ? l == null ? void 0 : l.url : l;
1796
+ return /* @__PURE__ */ t(
1797
+ D,
1166
1798
  {
1167
- ...a,
1168
- label: p,
1169
- value: typeof d == "string" ? d : "",
1170
- multiline: b,
1171
- minRows: b ? 2 : void 0,
1172
- maxRows: b ? 10 : void 0,
1173
- onChange: (h) => n == null ? void 0 : n(
1174
- r.type === "url" ? { ...i, url: h.target.value, mediaKitUrl: h.target.value } : h.target.value
1799
+ ...u,
1800
+ label: o,
1801
+ value: typeof v == "string" ? v : "",
1802
+ multiline: n,
1803
+ minRows: n ? 2 : void 0,
1804
+ maxRows: n ? 10 : void 0,
1805
+ onChange: (x) => i == null ? void 0 : i(
1806
+ r.type === "url" ? { ...l, url: x.target.value, mediaKitUrl: x.target.value } : x.target.value
1175
1807
  ),
1176
1808
  InputProps: r.type === "url" ? {
1177
1809
  sx: { pr: 0 },
1178
- endAdornment: /* @__PURE__ */ w(oe, { position: "end", children: [
1179
- /* @__PURE__ */ e(
1180
- fe,
1810
+ endAdornment: /* @__PURE__ */ S(pe, { position: "end", children: [
1811
+ /* @__PURE__ */ t(
1812
+ Pe,
1181
1813
  {
1182
- onChange: async ({ response: h }) => {
1183
- var z, T, K;
1184
- const m = ((z = h == null ? void 0 : h.data) == null ? void 0 : z.url) || ((T = h == null ? void 0 : h.data) == null ? void 0 : T.fileUrl);
1185
- let S;
1186
- m && (S = await de(m).catch(() => ue(m)).catch(() => {
1814
+ onChange: async ({ response: x }) => {
1815
+ var z, R, C;
1816
+ const I = ((z = x == null ? void 0 : x.data) == null ? void 0 : z.url) || ((R = x == null ? void 0 : x.data) == null ? void 0 : R.fileUrl);
1817
+ let f;
1818
+ I && (f = await be(I).catch(() => ye(I)).catch(() => {
1187
1819
  }));
1188
- let C = ((K = h == null ? void 0 : h.data) == null ? void 0 : K.filename) || "";
1189
- C && (C = `mediakit://${C}`), n == null || n({
1190
- url: m,
1191
- mediaKitUrl: C,
1192
- width: S == null ? void 0 : S.naturalWidth,
1193
- height: S == null ? void 0 : S.naturalHeight
1820
+ let P = ((C = x == null ? void 0 : x.data) == null ? void 0 : C.filename) || "";
1821
+ P && (P = `mediakit://${P}`), i == null || i({
1822
+ url: I,
1823
+ mediaKitUrl: P,
1824
+ width: f == null ? void 0 : f.naturalWidth,
1825
+ height: f == null ? void 0 : f.naturalHeight
1194
1826
  });
1195
1827
  }
1196
1828
  }
1197
1829
  ),
1198
- /* @__PURE__ */ e(Q, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ e(Ge, { sx: { cursor: "default" }, fontSize: "small" }) })
1830
+ /* @__PURE__ */ t(X, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ t(dt, { sx: { cursor: "default" }, fontSize: "small" }) })
1199
1831
  ] })
1200
1832
  } : void 0
1201
1833
  }
1202
1834
  );
1203
1835
  }
1204
- return console.error("Unsupported property type", r.type), null;
1836
+ return r.type === "array" ? /* @__PURE__ */ t(
1837
+ kr,
1838
+ {
1839
+ label: o,
1840
+ value: Array.isArray(l) ? l : [],
1841
+ onChange: (n) => i == null ? void 0 : i(n),
1842
+ property: r,
1843
+ renderItem: ({ item: n, index: v, onChange: x }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(j, { gap: 1, width: "100%", children: T(Object.values(r.subProperties), "index").filter((I) => I.data.visible !== !1).map(({ data: I }) => I.key ? /* @__PURE__ */ t(
1844
+ B,
1845
+ {
1846
+ component: e,
1847
+ property: I,
1848
+ value: n[I.key],
1849
+ onChange: (f) => {
1850
+ const P = { ...n, [I.key]: f };
1851
+ x(P);
1852
+ },
1853
+ size: "small",
1854
+ fullWidth: !0,
1855
+ defaultLocale: b,
1856
+ allComponents: a
1857
+ },
1858
+ I.id
1859
+ ) : null) }, v) : /* @__PURE__ */ t(D, { size: u.size, fullWidth: !0, value: n, onChange: (I) => x(I.target.value) })
1860
+ }
1861
+ ) : (console.error("Unsupported property type", r.type), null);
1205
1862
  }
1206
- function br({
1207
- NumberProps: t,
1863
+ function Kr({
1864
+ NumberProps: e,
1208
1865
  ...r
1209
1866
  }) {
1210
- const { getInputProps: i } = Et(t), n = i();
1211
- return /* @__PURE__ */ e(O, { ...r, inputProps: n });
1867
+ const { getInputProps: l } = ir(e), i = l();
1868
+ return /* @__PURE__ */ t(D, { ...r, inputProps: i });
1212
1869
  }
1213
- const yr = `import React from '@blocklet/pages-kit/builtin/react'
1870
+ const _r = `import React from '@blocklet/pages-kit/builtin/react'
1214
1871
  import { Box } from '@blocklet/pages-kit/builtin/mui/material'
1215
1872
 
1216
1873
  export default function () {
@@ -1219,227 +1876,227 @@ export default function () {
1219
1876
  Hello World
1220
1877
  </Box>
1221
1878
  )
1222
- }`, vr = `console.log('hello')
1879
+ }`, Fr = `console.log('hello')
1223
1880
  `;
1224
- function xr({
1225
- value: t
1881
+ function Jr({
1882
+ value: e
1226
1883
  }) {
1227
- const { locale: r } = j(), i = Ut(), n = _(t).doc;
1228
- return X(() => {
1229
- var u;
1230
- (u = t.renderer) != null && u.script || (n.transact(() => {
1231
- t.renderer.script = t.renderer.type === "react-component" ? yr : vr;
1232
- }), i());
1233
- }, [t]), /* @__PURE__ */ e(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
1234
- Je,
1884
+ const { locale: r } = N(), l = rt(), i = M(e).doc;
1885
+ return $(() => {
1886
+ var c;
1887
+ (c = e.renderer) != null && c.script || (i.transact(() => {
1888
+ e.renderer.script = e.renderer.type === "react-component" ? _r : Fr;
1889
+ }), l());
1890
+ }, [e]), /* @__PURE__ */ t(O, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ t(
1891
+ ge,
1235
1892
  {
1236
- keyId: t.id,
1893
+ keyId: e.id,
1237
1894
  locale: r,
1238
1895
  language: "typescript",
1239
- value: t.renderer.script || "",
1240
- onChange: (u) => t.renderer.script = u,
1896
+ value: e.renderer.script || "",
1897
+ onChange: (c) => e.renderer.script = c,
1241
1898
  typeScriptNoValidation: !1
1242
1899
  },
1243
- t.id
1900
+ e.id
1244
1901
  ) });
1245
1902
  }
1246
- function gr({ value: t }) {
1247
- var y, f, p;
1248
- const { t: r } = j(), i = _(t).doc, {
1903
+ function $r({ value: e }) {
1904
+ var g, y, o;
1905
+ const { t: r } = N(), l = M(e).doc, {
1249
1906
  state: {
1250
- components: n,
1251
- config: { defaultLocale: u },
1252
- resources: v
1907
+ components: i,
1908
+ config: { defaultLocale: c },
1909
+ resources: b
1253
1910
  },
1254
- localState: { currentLocale: c }
1255
- } = le(), a = ae(), k = ((y = n[t.renderer.componentId]) == null ? void 0 : y.data) ?? ((p = (f = v.components) == null ? void 0 : f[t.renderer.componentId]) == null ? void 0 : p.component), l = se({ variant: "dialog" });
1256
- return /* @__PURE__ */ w(D, { gap: 1, children: [
1257
- /* @__PURE__ */ e(
1258
- ye,
1911
+ localState: { currentLocale: a }
1912
+ } = ue(), u = xe(), k = ((g = i[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((o = (y = b.components) == null ? void 0 : y[e.renderer.componentId]) == null ? void 0 : o.component), h = me({ variant: "dialog" });
1913
+ return /* @__PURE__ */ S(j, { gap: 1, children: [
1914
+ /* @__PURE__ */ t(
1915
+ Se,
1259
1916
  {
1260
- allComponents: a,
1261
- excludes: [t.id],
1262
- value: t.renderer.componentId,
1263
- onChange: (x, o) => t.renderer.componentId = o
1917
+ allComponents: u,
1918
+ excludes: [e.id],
1919
+ value: e.renderer.componentId,
1920
+ onChange: (p, s) => e.renderer.componentId = s
1264
1921
  }
1265
1922
  ),
1266
- k && /* @__PURE__ */ w(U, { children: [
1267
- /* @__PURE__ */ w(D, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1268
- /* @__PURE__ */ e(V, { variant: "subtitle2", children: r("parameters") }),
1269
- /* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(l), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
1923
+ k && /* @__PURE__ */ S(J, { children: [
1924
+ /* @__PURE__ */ S(j, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1925
+ /* @__PURE__ */ t(K, { variant: "subtitle2", children: r("parameters") }),
1926
+ /* @__PURE__ */ t(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...fe(h), children: /* @__PURE__ */ t(st, { fontSize: "small" }) })
1270
1927
  ] }),
1271
- k.properties && F(Object.values(k.properties), "index").map(({ data: x }) => {
1272
- var o, s, g, I, b, d, h, m, S, C, z, T, K, E, H, J;
1273
- return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1274
- W,
1928
+ k.properties && T(Object.values(k.properties), "index").map(({ data: p }) => {
1929
+ var s, d, m, w, n, v, x, I, f, P, z, R, C, E, U, H;
1930
+ return /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
1931
+ B,
1275
1932
  {
1276
- allComponents: a,
1277
- defaultLocale: u,
1933
+ allComponents: u,
1934
+ defaultLocale: c,
1278
1935
  component: k,
1279
- property: x,
1936
+ property: p,
1280
1937
  fullWidth: !0,
1281
1938
  size: "small",
1282
- valueImmutable: L((I = (g = (s = (o = t.renderer.properties) == null ? void 0 : o[x.id]) == null ? void 0 : s.locales) == null ? void 0 : g[c]) == null ? void 0 : I.value),
1283
- value: ((m = (h = (d = (b = t.renderer.properties) == null ? void 0 : b[x.id]) == null ? void 0 : d.locales) == null ? void 0 : h[c]) == null ? void 0 : m.value) ?? ((T = (z = (C = (S = t.renderer.properties) == null ? void 0 : S[x.id]) == null ? void 0 : C.locales) == null ? void 0 : z[u]) == null ? void 0 : T.value) ?? ((E = (K = x.locales) == null ? void 0 : K[c]) == null ? void 0 : E.defaultValue) ?? ((J = (H = x.locales) == null ? void 0 : H[u]) == null ? void 0 : J.defaultValue),
1284
- onChange: (ee) => {
1285
- i.transact(() => {
1286
- var M, $, Y, G, q;
1287
- (M = t.renderer).properties ?? (M.properties = {}), ($ = t.renderer.properties)[Y = x.id] ?? ($[Y] = {}), (G = t.renderer.properties[x.id]).locales ?? (G.locales = {}), (q = t.renderer.properties[x.id].locales)[c] ?? (q[c] = {}), t.renderer.properties[x.id].locales[c].value = ee;
1939
+ valueImmutable: ee((w = (m = (d = (s = e.renderer.properties) == null ? void 0 : s[p.id]) == null ? void 0 : d.locales) == null ? void 0 : m[a]) == null ? void 0 : w.value),
1940
+ value: ((I = (x = (v = (n = e.renderer.properties) == null ? void 0 : n[p.id]) == null ? void 0 : v.locales) == null ? void 0 : x[a]) == null ? void 0 : I.value) ?? ((R = (z = (P = (f = e.renderer.properties) == null ? void 0 : f[p.id]) == null ? void 0 : P.locales) == null ? void 0 : z[c]) == null ? void 0 : R.value) ?? ((E = (C = p.locales) == null ? void 0 : C[a]) == null ? void 0 : E.defaultValue) ?? ((H = (U = p.locales) == null ? void 0 : U[c]) == null ? void 0 : H.defaultValue),
1941
+ onChange: (ie) => {
1942
+ l.transact(() => {
1943
+ var Y, G, q, L, Q;
1944
+ (Y = e.renderer).properties ?? (Y.properties = {}), (G = e.renderer.properties)[q = p.id] ?? (G[q] = {}), (L = e.renderer.properties[p.id]).locales ?? (L.locales = {}), (Q = e.renderer.properties[p.id].locales)[a] ?? (Q[a] = {}), e.renderer.properties[p.id].locales[a].value = ie;
1288
1945
  });
1289
1946
  }
1290
1947
  }
1291
- ) }, x.id);
1948
+ ) }, p.id);
1292
1949
  }),
1293
- /* @__PURE__ */ e(et, { ...Qe(l), component: t, type: "parameters" })
1950
+ /* @__PURE__ */ t(vt, { ...ut(h), component: e, type: "parameters" })
1294
1951
  ] })
1295
1952
  ] });
1296
1953
  }
1297
- function ye({
1298
- label: t,
1954
+ function Se({
1955
+ label: e,
1299
1956
  options: r,
1300
- excludes: i,
1301
- value: n,
1302
- onChange: u,
1303
- allComponents: v,
1304
- ...c
1957
+ excludes: l,
1958
+ value: i,
1959
+ onChange: c,
1960
+ allComponents: b,
1961
+ ...a
1305
1962
  }) {
1306
- var y;
1307
- const { t: a } = j(), k = r ?? F(Object.values(Wt(v, ...i ?? [])), "index").map((f) => f.data), l = (typeof n == "string" ? (y = v[n]) == null ? void 0 : y.data : void 0) ?? null;
1308
- return /* @__PURE__ */ e(
1309
- Fe,
1963
+ var g;
1964
+ const { t: u } = N(), k = r ?? T(Object.values(mr(b, ...l ?? [])), "index").map((y) => y.data), h = (typeof i == "string" ? (g = b[i]) == null ? void 0 : g.data : void 0) ?? null;
1965
+ return /* @__PURE__ */ t(
1966
+ Xe,
1310
1967
  {
1311
- ...c,
1968
+ ...a,
1312
1969
  size: "small",
1313
1970
  options: k,
1314
1971
  autoHighlight: !0,
1315
- isOptionEqualToValue: (f, p) => f.id === p.id,
1316
- getOptionKey: (f) => f.id,
1317
- getOptionLabel: (f) => f.name || f.id,
1318
- renderInput: (f) => /* @__PURE__ */ e(O, { label: t || a("component"), ...f }),
1319
- value: l,
1320
- onChange: (f, p) => {
1321
- var o, s, g, I, b, d;
1322
- let x = {};
1323
- p && (x = {
1324
- blockletId: (o = v[p == null ? void 0 : p.id]) == null ? void 0 : o.blockletId,
1325
- blockletTitle: (s = v[p == null ? void 0 : p.id]) == null ? void 0 : s.blockletTitle,
1326
- componentName: ((I = (g = v[p == null ? void 0 : p.id]) == null ? void 0 : g.data) == null ? void 0 : I.name) || ((d = (b = v[p == null ? void 0 : p.id]) == null ? void 0 : b.data) == null ? void 0 : d.id)
1327
- }), u == null || u(f, p == null ? void 0 : p.id, x);
1972
+ isOptionEqualToValue: (y, o) => y.id === o.id,
1973
+ getOptionKey: (y) => y.id,
1974
+ getOptionLabel: (y) => y.name || y.id,
1975
+ renderInput: (y) => /* @__PURE__ */ t(D, { label: e || u("component"), ...y }),
1976
+ value: h,
1977
+ onChange: (y, o) => {
1978
+ var s, d, m, w, n, v;
1979
+ let p = {};
1980
+ o && (p = {
1981
+ blockletId: (s = b[o == null ? void 0 : o.id]) == null ? void 0 : s.blockletId,
1982
+ blockletTitle: (d = b[o == null ? void 0 : o.id]) == null ? void 0 : d.blockletTitle,
1983
+ componentName: ((w = (m = b[o == null ? void 0 : o.id]) == null ? void 0 : m.data) == null ? void 0 : w.name) || ((v = (n = b[o == null ? void 0 : o.id]) == null ? void 0 : n.data) == null ? void 0 : v.id)
1984
+ }), c == null || c(y, o == null ? void 0 : o.id, p);
1328
1985
  }
1329
1986
  }
1330
1987
  );
1331
1988
  }
1332
- function kr({
1333
- config: t,
1989
+ function Mr({
1990
+ config: e,
1334
1991
  allComponents: r,
1335
- defaultLocale: i,
1336
- propertiesValue: n,
1337
- currentLocale: u,
1338
- onChange: v,
1339
- props: c
1992
+ defaultLocale: l,
1993
+ propertiesValue: i,
1994
+ currentLocale: c,
1995
+ onChange: b,
1996
+ props: a
1340
1997
  }) {
1341
- const { t: a } = j(), [k, l] = ie(t == null ? void 0 : t.properties), [y, f] = ie(null);
1342
- X(() => {
1998
+ const { t: u } = N(), [k, h] = Z(e == null ? void 0 : e.properties), [g, y] = Z(null);
1999
+ $(() => {
1343
2000
  (() => {
1344
- var I, b;
1345
- ((I = t == null ? void 0 : t.renderer) == null ? void 0 : I.type) === "react-component" && Vt(t == null ? void 0 : t.properties) ? Ft((b = t == null ? void 0 : t.renderer) == null ? void 0 : b.script).then((d) => {
1346
- const h = _t(d);
1347
- l(h);
1348
- }) : l(t == null ? void 0 : t.properties);
2001
+ var w, n;
2002
+ ((w = e == null ? void 0 : e.renderer) == null ? void 0 : w.type) === "react-component" && it(e == null ? void 0 : e.properties) ? tr((n = e == null ? void 0 : e.renderer) == null ? void 0 : n.script).then((v) => {
2003
+ const x = rr(v);
2004
+ h(x);
2005
+ }) : h(e == null ? void 0 : e.properties);
1349
2006
  })();
1350
- }, [JSON.stringify(t)]);
1351
- const p = ne(() => !t || !k ? {} : Object.values(k).reduce(
1352
- (g, { data: I }) => {
1353
- var d, h, m, S, C;
1354
- const b = I.key || I.id;
1355
- return g[I.id] = {
1356
- key: b,
1357
- value: (c == null ? void 0 : c[b]) ?? ((d = n == null ? void 0 : n[I.id]) == null ? void 0 : d.value) ?? ((m = (h = I.locales) == null ? void 0 : h[u]) == null ? void 0 : m.defaultValue) ?? ((C = (S = I.locales) == null ? void 0 : S[i]) == null ? void 0 : C.defaultValue),
1358
- id: I.id,
1359
- type: I.type
1360
- }, g;
2007
+ }, [JSON.stringify(e)]);
2008
+ const o = V(() => !e || !k ? {} : Object.values(k).reduce(
2009
+ (m, { data: w }) => {
2010
+ var v, x, I, f, P;
2011
+ const n = w.key || w.id;
2012
+ return m[w.id] = {
2013
+ key: n,
2014
+ value: (a == null ? void 0 : a[n]) ?? ((v = i == null ? void 0 : i[w.id]) == null ? void 0 : v.value) ?? ((I = (x = w.locales) == null ? void 0 : x[c]) == null ? void 0 : I.defaultValue) ?? ((P = (f = w.locales) == null ? void 0 : f[l]) == null ? void 0 : P.defaultValue),
2015
+ id: w.id,
2016
+ type: w.type
2017
+ }, m;
1361
2018
  },
1362
2019
  {}
1363
- ), [JSON.stringify(k), t, n, u, i]), x = pt(() => {
2020
+ ), [JSON.stringify(k), e, i, c, l]), p = de(() => {
1364
2021
  if (!k)
1365
2022
  return {
1366
2023
  canUseProperties: [],
1367
2024
  visibleProperties: [],
1368
2025
  canUsePropertiesKeys: []
1369
2026
  };
1370
- const g = F(Object.values(k), "index"), I = g.filter(({ data: h }) => h.key && Le(k, h.id)), b = g.filter(({ data: h }) => h.key), d = b.map(({ data: h }) => h.key);
2027
+ const m = T(Object.values(k), "index"), w = m.filter(({ data: x }) => x.key && bt(k, x.id)), n = m.filter(({ data: x }) => x.key), v = n.map(({ data: x }) => x.key);
1371
2028
  return {
1372
- canUseProperties: b,
1373
- visibleProperties: I,
1374
- canUsePropertiesKeys: d
2029
+ canUseProperties: n,
2030
+ visibleProperties: w,
2031
+ canUsePropertiesKeys: v
1375
2032
  };
1376
- }, [JSON.stringify(k)]), o = p(), s = Qt(o, "key");
1377
- return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
1378
- /* @__PURE__ */ e(V, { variant: "subtitle1", children: a("maker.properties.parameters") }),
1379
- !t || x.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: a("maker.properties.noParameters") }) : /* @__PURE__ */ w(U, { children: [
1380
- /* @__PURE__ */ e(D, { gap: 2, children: x.visibleProperties.map(({ data: g }) => {
1381
- var I, b;
1382
- return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1383
- W,
2033
+ }, [JSON.stringify(k)]), s = o(), d = pr(s, "key");
2034
+ return /* @__PURE__ */ t(Ie, { children: /* @__PURE__ */ S(j, { gap: 2, children: [
2035
+ /* @__PURE__ */ t(K, { variant: "subtitle1", children: u("maker.properties.parameters") }),
2036
+ !e || p.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ t(te, { style: { fontSize: 12 }, children: u("maker.properties.noParameters") }) : /* @__PURE__ */ S(J, { children: [
2037
+ /* @__PURE__ */ t(j, { gap: 2, children: p.visibleProperties.map(({ data: m }) => {
2038
+ var w, n;
2039
+ return /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(
2040
+ B,
1384
2041
  {
1385
2042
  allComponents: r,
1386
- defaultLocale: i,
2043
+ defaultLocale: l,
1387
2044
  size: "small",
1388
2045
  fullWidth: !0,
1389
- component: t,
1390
- property: g,
1391
- valueImmutable: L((I = n == null ? void 0 : n[g.id]) == null ? void 0 : I.value),
1392
- value: (c == null ? void 0 : c[g.key || g.id]) ?? ((b = o[g.id]) == null ? void 0 : b.value),
1393
- onChange: (d) => {
1394
- v({
1395
- path: ["properties", g.id],
1396
- value: { value: d },
1397
- shouldSync: !(!g.type || Ae.includes(g.type)),
2046
+ component: e,
2047
+ property: m,
2048
+ valueImmutable: ee((w = i == null ? void 0 : i[m.id]) == null ? void 0 : w.value),
2049
+ value: (a == null ? void 0 : a[m.key || m.id]) ?? ((n = s[m.id]) == null ? void 0 : n.value),
2050
+ onChange: (v) => {
2051
+ b({
2052
+ path: ["properties", m.id],
2053
+ value: { value: v },
2054
+ shouldSync: !(!m.type || Be.includes(m.type)),
1398
2055
  excludeKeys: [],
1399
- key: g.key || g.id
2056
+ key: m.key || m.id
1400
2057
  });
1401
2058
  }
1402
2059
  }
1403
- ) }, g.id);
2060
+ ) }, m.id);
1404
2061
  }) }),
1405
- /* @__PURE__ */ e(D, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ e(
1406
- Me,
2062
+ /* @__PURE__ */ t(j, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ t(
2063
+ ot,
1407
2064
  {
1408
- componentId: (t == null ? void 0 : t.id) || "",
2065
+ componentId: (e == null ? void 0 : e.id) || "",
1409
2066
  renderType: "setting",
1410
- locale: u,
1411
- properties: o,
1412
- dev: { mode: "draft", components: r, defaultLocale: i },
2067
+ locale: c,
2068
+ properties: s,
2069
+ dev: { mode: "draft", components: r, defaultLocale: l },
1413
2070
  props: {
1414
- ...Xt(c ?? {}, x.canUsePropertiesKeys),
1415
- onChange: (g) => {
1416
- const { canUsePropertiesKeys: I } = x;
1417
- Object.keys(g).filter((d) => {
1418
- var h;
1419
- return g[d] !== ((h = s == null ? void 0 : s[d]) == null ? void 0 : h.value);
1420
- }).filter((d) => !(d === "locale" && !qt(s[d], "locale"))).reduce((d, h) => d.then(() => {
1421
- const m = s[h], S = I.includes(h);
1422
- if (m != null && m.id && S)
1423
- return v({
1424
- path: ["properties", m.id],
1425
- value: { value: g[h] },
1426
- shouldSync: !(!m.type || Ae.includes(m.type)),
2071
+ ...fr(a ?? {}, p.canUsePropertiesKeys),
2072
+ onChange: (m) => {
2073
+ const { canUsePropertiesKeys: w } = p;
2074
+ Object.keys(m).filter((v) => {
2075
+ var x;
2076
+ return m[v] !== ((x = d == null ? void 0 : d[v]) == null ? void 0 : x.value);
2077
+ }).filter((v) => !(v === "locale" && !ar(d[v], "locale"))).reduce((v, x) => v.then(() => {
2078
+ const I = d[x], f = w.includes(x);
2079
+ if (I != null && I.id && f)
2080
+ return b({
2081
+ path: ["properties", I.id],
2082
+ value: { value: m[x] },
2083
+ shouldSync: !(!I.type || Be.includes(I.type)),
1427
2084
  excludeKeys: [],
1428
- key: m.key || m.id
2085
+ key: I.key || I.id
1429
2086
  }), Promise.resolve();
1430
- const C = `propertyNotFound${h}`;
1431
- if (y === C)
2087
+ const P = `propertyNotFound${x}`;
2088
+ if (g === P)
1432
2089
  return Promise.resolve();
1433
- je.close(y);
1434
- const z = je.warning(
1435
- a("maker.properties.propertyNotFound", {
1436
- key: h
2090
+ Ue.close(g);
2091
+ const z = Ue.warning(
2092
+ u("maker.properties.propertyNotFound", {
2093
+ key: x
1437
2094
  }),
1438
2095
  {
1439
- key: C
2096
+ key: P
1440
2097
  }
1441
2098
  );
1442
- return f(z), Promise.resolve();
2099
+ return y(z), Promise.resolve();
1443
2100
  }), Promise.resolve());
1444
2101
  }
1445
2102
  }
@@ -1449,12 +2106,12 @@ function kr({
1449
2106
  ] }) });
1450
2107
  }
1451
2108
  export {
1452
- pr as BasicInfo,
1453
- ye as CustomComponentAutocomplete,
1454
- Zr as CustomComponentSettings,
1455
- yr as DefaultReactComponentScriptTemplate,
1456
- vr as DefaultWebComponentScriptTemplate,
1457
- kr as ParametersConfig,
1458
- mr as PropertiesConfig,
1459
- W as PropertyValueField
2109
+ Vr as BasicInfo,
2110
+ Se as CustomComponentAutocomplete,
2111
+ Vi as CustomComponentSettings,
2112
+ _r as DefaultReactComponentScriptTemplate,
2113
+ Fr as DefaultWebComponentScriptTemplate,
2114
+ Mr as ParametersConfig,
2115
+ Er as PropertiesConfig,
2116
+ B as PropertyValueField
1460
2117
  };