@blocklet/pages-kit-inner-components 0.0.18 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/setting.js CHANGED
@@ -1,72 +1,75 @@
1
- import { jsx as e, jsxs as I, Fragment as $ } from "react/jsx-runtime";
2
- import { g as Z, i as Re, b as ze, h as re, E as qe, n as Qe, j as ce } from "../state-CETtldI3.mjs";
3
- import { TextField as V, Stack as R, FormControlLabel as Ve, Switch as Pe, Box as S, InputAdornment as de, Dialog as ae, DialogTitle as Oe, DialogContent as je, DialogActions as Ce, Button as N, alpha as Xe, Tooltip as ne, buttonClasses as Ze, Typography as Q, Autocomplete as Ae, MenuItem as T, FormLabel as Le, Popper as Te, Paper as Be, Table as et, TableHead as tt, TableRow as Se, TableCell as ke, TableBody as rt } from "@mui/material";
4
- import { forwardRef as We, useState as Ne, useEffect as L, useImperativeHandle as Ee, lazy as it, useCallback as ee, Suspense as lt, useRef as M, useId as nt } from "react";
5
- import ot from "@arcblock/ux/lib/Empty";
6
- import { useLocaleContext as W } from "@arcblock/ux/lib/Locale/context";
7
- import { styled as st } from "@arcblock/ux/lib/Theme";
8
- import { cx as ct } from "@emotion/css";
9
- import { useReactive as dt, useBoolean as at, useUpdate as ut } from "ahooks";
10
- import De from "gradient-parser";
1
+ import { jsx as e, jsxs as k, Fragment as N } from "react/jsx-runtime";
2
+ import { g as ee, i as Re, b as Oe, h as re, E as Qe, n as Xe, j as ce } from "../state-BfVA6vd8.mjs";
3
+ import { TextField as D, Stack as S, FormControlLabel as ze, Switch as je, Box as w, InputAdornment as de, Dialog as ae, DialogTitle as Ae, DialogContent as Te, DialogActions as Be, Button as j, alpha as Ze, Tooltip as ne, buttonClasses as Le, Typography as E, Autocomplete as Ne, MenuItem as R, FormLabel as et, Popper as We, Paper as Ee, Table as tt, TableHead as rt, TableRow as Se, TableCell as Ce, TableBody as it } from "@mui/material";
4
+ import { forwardRef as Ve, useState as ue, useEffect as Q, useImperativeHandle as _e, lazy as lt, useCallback as te, Suspense as nt, useRef as X, useId as ot } from "react";
5
+ import st from "@arcblock/ux/lib/Empty";
6
+ import { useLocaleContext as z } from "@arcblock/ux/lib/Locale/context";
7
+ import { styled as ct } from "@arcblock/ux/lib/Theme";
8
+ import { cx as dt } from "@emotion/css";
9
+ import { useReactive as at, useBoolean as ut, useUpdate as pt } from "ahooks";
10
+ import Pe from "gradient-parser";
11
11
  import "lodash/without";
12
- import pt from "tinycolor2";
13
- import { red as mt, pink as ht, purple as ft, indigo as bt, blue as gt, cyan as vt, teal as xt, green as yt, lime as It, yellow as wt, amber as St, orange as kt, brown as Dt, grey as Rt, blueGrey as zt } from "@mui/material/colors";
14
- import { getImageSize as oe, getVideoSize as se, UploaderButton as ue, UploaderProvider as He } from "./uploader.js";
15
- import { Icon as Vt } from "@iconify-icon/react";
16
- import { useDebounce as Pt, useUpdate as Ot } from "react-use";
17
- import { CodeEditor as _e } from "@blocklet/code-editor";
18
- import { CustomComponentRenderer as Fe } from "@blocklet/pages-kit/components";
19
- import { ClickAwayListener as Ue, unstable_useNumberInput as jt } from "@mui/base";
20
- import { DeleteOutlineRounded as Ct, DragIndicatorRounded as At, AddRounded as Tt, TranslateRounded as Ke, InfoRounded as Bt, SettingsRounded as $e, StarRounded as Wt } from "@mui/icons-material";
21
- import { getYjsValue as J } from "@syncedstore/core";
22
- import { sortBy as X, omit as Nt, isNil as te } from "lodash";
23
- import { usePopupState as ie, bindTrigger as le, bindDialog as Je, bindPopper as Ye } from "material-ui-popup-state/hooks";
24
- import { ErrorBoundary as Et } from "react-error-boundary";
25
- import Ht from "lodash/sortBy";
26
- import { useDrop as Ge, useDrag as _t } from "react-dnd";
27
- mt[300], ht[300], ft[300], // deepPurple['300'],
28
- bt[300], gt[300], // lightBlue['300'],
29
- vt[300], xt[300], yt[300], // lightGreen['300'],
30
- It[300], wt[300], St[300], kt[300], // deepOrange['300'],
31
- Dt[300], Rt[300], zt[300];
32
- const Ft = We(function({ showMarkdown: r, markdown: l, onMarkdownChange: i, showUploader: s, value: a, meta: d, onChange: c, ...b }, v) {
33
- const [u, g] = Ne("");
34
- L(() => {
35
- g(a || "");
36
- }, [a, g]);
37
- const h = async () => {
38
- if (u !== a) {
39
- const n = Z(u);
40
- if (!n) {
41
- c(u, void 0);
12
+ import mt from "tinycolor2";
13
+ import { red as ht, pink as ft, purple as bt, indigo as vt, blue as yt, cyan as gt, teal as xt, green as It, lime as kt, yellow as wt, amber as St, orange as Ct, brown as Pt, grey as Dt, blueGrey as Rt } from "@mui/material/colors";
14
+ import { getImageSize as oe, getVideoSize as se, UploaderButton as pe, UploaderProvider as Ke } from "./uploader.js";
15
+ import { Icon as Ot } from "@iconify-icon/react";
16
+ import { useDebounce as zt, useUpdate as jt } from "react-use";
17
+ import { sortBy as V, omit as At, isNil as Z, isEmpty as Tt } from "lodash";
18
+ import Bt from "@arcblock/ux/lib/Toast";
19
+ import { CodeEditor as Fe } from "@blocklet/code-editor";
20
+ import { CustomComponentRenderer as He, transpileAndLoadScript as Nt, getPropertiesFromCode as Wt } from "@blocklet/pages-kit/components";
21
+ import { ClickAwayListener as Ue, unstable_useNumberInput as Et } from "@mui/base";
22
+ import { DeleteOutlineRounded as Vt, DragIndicatorRounded as _t, AddRounded as Kt, TranslateRounded as Je, InfoRounded as Ft, SettingsRounded as Ye, StarRounded as Ht } from "@mui/icons-material";
23
+ import { getYjsValue as _ } from "@syncedstore/core";
24
+ import Ut from "lodash/has";
25
+ import Jt from "lodash/keyBy";
26
+ import { usePopupState as ie, bindTrigger as le, bindDialog as $e, bindPopper as Ge } from "material-ui-popup-state/hooks";
27
+ import { ErrorBoundary as Yt } from "react-error-boundary";
28
+ import $t from "lodash/sortBy";
29
+ import { useDrop as qe, useDrag as Gt } from "react-dnd";
30
+ ht[300], ft[300], bt[300], // deepPurple['300'],
31
+ vt[300], yt[300], // lightBlue['300'],
32
+ gt[300], xt[300], It[300], // lightGreen['300'],
33
+ kt[300], wt[300], St[300], Ct[300], // deepOrange['300'],
34
+ Pt[300], Dt[300], Rt[300];
35
+ const qt = Ve(function({ showMarkdown: i, markdown: n, onMarkdownChange: r, showUploader: a, value: b, meta: p, onChange: u, ...v }, c) {
36
+ const [h, m] = ue("");
37
+ Q(() => {
38
+ m(b || "");
39
+ }, [b, m]);
40
+ const f = async () => {
41
+ if (h !== b) {
42
+ const l = ee(h);
43
+ if (!l) {
44
+ u(h, void 0);
42
45
  return;
43
46
  }
44
- const o = await oe(n).catch(() => se(n)).catch(() => {
47
+ const o = await oe(l).catch(() => se(l)).catch(() => {
45
48
  });
46
- c(u, { ...o, filename: u });
49
+ u(h, { ...o, filename: h });
47
50
  }
48
51
  };
49
- Pt(
52
+ zt(
50
53
  () => {
51
- u !== a && c(u);
54
+ h !== b && u(h);
52
55
  },
53
56
  300,
54
- [u]
55
- ), Ee(v, () => ({
56
- submit: h
57
+ [h]
58
+ ), _e(c, () => ({
59
+ submit: f
57
60
  }));
58
- const m = {};
59
- return s && (m.InputProps = {
61
+ const s = {};
62
+ return a && (s.InputProps = {
60
63
  sx: { pr: 0 },
61
64
  endAdornment: /* @__PURE__ */ e(de, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ e(
62
- ue,
65
+ pe,
63
66
  {
64
- onChange: async ({ response: n }) => {
67
+ onChange: async ({ response: l }) => {
65
68
  var y;
66
- const o = (y = n == null ? void 0 : n.data) == null ? void 0 : y.filename, f = Z(o) || "";
69
+ const o = (y = l == null ? void 0 : l.data) == null ? void 0 : y.filename, d = ee(o) || "";
67
70
  let x = {};
68
- f && (x = await oe(f).catch(() => se(f)).catch(() => {
69
- })), c(o, {
71
+ d && (x = await oe(d).catch(() => se(d)).catch(() => {
72
+ })), u(o, {
70
73
  ...x,
71
74
  filename: o
72
75
  });
@@ -74,71 +77,71 @@ const Ft = We(function({ showMarkdown: r, markdown: l, onMarkdownChange: i, show
74
77
  }
75
78
  ) })
76
79
  }), /* @__PURE__ */ e(
77
- V,
80
+ D,
78
81
  {
79
82
  size: "small",
80
83
  fullWidth: !0,
81
- ...b,
82
- label: /* @__PURE__ */ I(R, { direction: "row", spacing: 1, alignItems: "center", children: [
83
- b.label,
84
- r && /* @__PURE__ */ I($, { children: [
84
+ ...v,
85
+ label: /* @__PURE__ */ k(S, { direction: "row", spacing: 1, alignItems: "center", children: [
86
+ v.label,
87
+ i && /* @__PURE__ */ k(N, { children: [
85
88
  " (",
86
89
  /* @__PURE__ */ e(
87
- Ve,
90
+ ze,
88
91
  {
89
- checked: l,
90
- label: /* @__PURE__ */ e(S, { component: Vt, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
92
+ checked: n,
93
+ label: /* @__PURE__ */ e(w, { component: Ot, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
91
94
  labelPlacement: "start",
92
- control: /* @__PURE__ */ e(Pe, { size: "small" }),
95
+ control: /* @__PURE__ */ e(je, { size: "small" }),
93
96
  sx: { ml: 0.25, pr: 1 },
94
- onChange: (n, o) => i == null ? void 0 : i(o)
97
+ onChange: (l, o) => r == null ? void 0 : r(o)
95
98
  }
96
99
  ),
97
100
  ")"
98
101
  ] })
99
102
  ] }),
100
- InputLabelProps: { shrink: !0, ...b.InputLabelProps },
101
- value: u,
102
- onChange: (n) => g(n.target.value),
103
- ...m,
104
- onKeyDown: (n) => {
105
- n.keyCode !== 229 && n.key === "Enter" && h();
103
+ InputLabelProps: { shrink: !0, ...v.InputLabelProps },
104
+ value: h,
105
+ onChange: (l) => m(l.target.value),
106
+ ...s,
107
+ onKeyDown: (l) => {
108
+ l.keyCode !== 229 && l.key === "Enter" && f();
106
109
  }
107
110
  }
108
111
  );
109
- }), Ut = it(() => import("react-best-gradient-color-picker"));
110
- function Kt(t) {
112
+ }), Mt = lt(() => import("react-best-gradient-color-picker"));
113
+ function Qt(t) {
111
114
  try {
112
- const l = De.parse(t).map((s) => {
113
- const a = s.colorStops.map((d) => {
114
- if (d.type !== "rgba") {
115
- const c = pt(d.value).toRgb();
115
+ const n = Pe.parse(t).map((a) => {
116
+ const b = a.colorStops.map((p) => {
117
+ if (p.type !== "rgba") {
118
+ const u = mt(p.value).toRgb();
116
119
  return {
117
- ...d,
118
- value: [c.r, c.g, c.b, c.a],
120
+ ...p,
121
+ value: [u.r, u.g, u.b, u.a],
119
122
  type: "rgba"
120
123
  };
121
124
  }
122
- return d;
125
+ return p;
123
126
  });
124
127
  return {
125
- ...s,
126
- colorStops: a
128
+ ...a,
129
+ colorStops: b
127
130
  };
128
131
  });
129
- return De.stringify(l);
132
+ return Pe.stringify(n);
130
133
  } catch {
131
- return ze(t) ? t : "";
134
+ return Oe(t) ? t : "";
132
135
  }
133
136
  }
134
- function $t({ color: t, sx: r = {}, ...l }) {
135
- ze(t);
136
- const i = {};
137
- return Re(t) ? i.backgroundImage = t : i.backgroundColor = t, /* @__PURE__ */ e(
138
- S,
137
+ function Xt({ color: t, sx: i = {}, ...n }) {
138
+ Oe(t);
139
+ const r = {};
140
+ return Re(t) ? r.backgroundImage = t : r.backgroundColor = t, /* @__PURE__ */ e(
141
+ w,
139
142
  {
140
143
  sx: {
141
- ...r,
144
+ ...i,
142
145
  width: "100%",
143
146
  paddingBottom: "100%",
144
147
  cursor: "pointer",
@@ -148,41 +151,41 @@ function $t({ color: t, sx: r = {}, ...l }) {
148
151
  "&:hover": {
149
152
  opacity: 0.75
150
153
  },
151
- ...i
154
+ ...r
152
155
  },
153
- ...l
156
+ ...n
154
157
  }
155
158
  );
156
159
  }
157
- const Jt = We(function({ onSave: r }, l) {
158
- const i = dt({
160
+ const Zt = Ve(function({ onSave: i }, n) {
161
+ const r = at({
159
162
  value: ""
160
- }), { t: s } = W(), a = {};
161
- i.value ? Re(i.value) ? a.backgroundImage = i.value : a.backgroundColor = i.value : a.border = "1px solid #ccc";
162
- const [d, { setFalse: c, setTrue: b }] = at(!1), v = ee(() => {
163
- c();
164
- }, [c]), u = () => {
165
- r({ value: i.value }, v);
163
+ }), { t: a } = z(), b = {};
164
+ r.value ? Re(r.value) ? b.backgroundImage = r.value : b.backgroundColor = r.value : b.border = "1px solid #ccc";
165
+ const [p, { setFalse: u, setTrue: v }] = ut(!1), c = te(() => {
166
+ u();
167
+ }, [u]), h = () => {
168
+ i({ value: r.value }, c);
166
169
  };
167
- return Ee(l, () => ({
168
- open({ value: g } = { value: "" }) {
169
- i.value = g, b();
170
+ return _e(n, () => ({
171
+ open({ value: m } = { value: "" }) {
172
+ r.value = m, v();
170
173
  },
171
174
  close() {
172
- v();
175
+ c();
173
176
  }
174
- })), /* @__PURE__ */ I(ae, { open: d, onClose: v, hideBackdrop: !0, children: [
175
- /* @__PURE__ */ e(Oe, { children: s("maker.configBackground") }),
176
- /* @__PURE__ */ e(je, { sx: { width: 600 }, children: /* @__PURE__ */ I(S, { width: "100%", display: "flex", children: [
177
- /* @__PURE__ */ e(S, { flex: 1, mr: 1, sx: a, children: !i.value && /* @__PURE__ */ e(ot, { children: s("error.notConfig") }) }),
178
- /* @__PURE__ */ e(lt, { children: /* @__PURE__ */ e(
179
- Ut,
177
+ })), /* @__PURE__ */ k(ae, { open: p, onClose: c, hideBackdrop: !0, children: [
178
+ /* @__PURE__ */ e(Ae, { children: a("maker.configBackground") }),
179
+ /* @__PURE__ */ e(Te, { sx: { width: 600 }, children: /* @__PURE__ */ k(w, { width: "100%", display: "flex", children: [
180
+ /* @__PURE__ */ e(w, { flex: 1, mr: 1, sx: b, children: !r.value && /* @__PURE__ */ e(st, { children: a("error.notConfig") }) }),
181
+ /* @__PURE__ */ e(nt, { children: /* @__PURE__ */ e(
182
+ Mt,
180
183
  {
181
184
  width: 200,
182
185
  height: 200,
183
- value: Kt(i.value),
184
- onChange: (g) => {
185
- i.value = g;
186
+ value: Qt(r.value),
187
+ onChange: (m) => {
188
+ r.value = m;
186
189
  },
187
190
  hidePresets: !0,
188
191
  hideAdvancedSliders: !0,
@@ -191,13 +194,13 @@ const Jt = We(function({ onSave: r }, l) {
191
194
  }
192
195
  ) })
193
196
  ] }) }),
194
- /* @__PURE__ */ I(Ce, { children: [
195
- /* @__PURE__ */ e(N, { variant: "outlined", size: "small", onClick: v, children: s("common.cancel") }),
196
- /* @__PURE__ */ e(N, { variant: "contained", size: "small", onClick: u, children: s("maker.save") })
197
+ /* @__PURE__ */ k(Be, { children: [
198
+ /* @__PURE__ */ e(j, { variant: "outlined", size: "small", onClick: c, children: a("common.cancel") }),
199
+ /* @__PURE__ */ e(j, { variant: "contained", size: "small", onClick: h, children: a("maker.save") })
197
200
  ] })
198
201
  ] });
199
202
  });
200
- st(S)`
203
+ ct(w)`
201
204
  .color-item {
202
205
  position: relative;
203
206
  }
@@ -218,28 +221,28 @@ st(S)`
218
221
  right: 0;
219
222
  }
220
223
  `;
221
- function Yt({
224
+ function Lt({
222
225
  value: t,
223
- onChange: r,
224
- ...l
226
+ onChange: i,
227
+ ...n
225
228
  }) {
226
- const i = M(null);
227
- return /* @__PURE__ */ I($, { children: [
229
+ const r = X(null);
230
+ return /* @__PURE__ */ k(N, { children: [
228
231
  /* @__PURE__ */ e(
229
- Ft,
232
+ qt,
230
233
  {
231
- ...l,
234
+ ...n,
232
235
  value: t,
233
- onChange: r,
236
+ onChange: i,
234
237
  InputProps: {
235
238
  endAdornment: /* @__PURE__ */ e(de, { position: "end", children: /* @__PURE__ */ e(
236
- $t,
239
+ Xt,
237
240
  {
238
241
  color: t ?? "",
239
242
  style: { width: "1.5rem", height: "1.5rem", padding: 0 },
240
243
  onClick: () => {
241
- var s;
242
- (s = i.current) == null || s.open({ value: t ?? "" });
244
+ var a;
245
+ (a = r.current) == null || a.open({ value: t ?? "" });
243
246
  }
244
247
  }
245
248
  ) })
@@ -247,150 +250,151 @@ function Yt({
247
250
  }
248
251
  ),
249
252
  /* @__PURE__ */ e(
250
- Jt,
253
+ Zt,
251
254
  {
252
- ref: i,
253
- onSave: ({ value: s }, a) => {
254
- r(s), a();
255
+ ref: r,
256
+ onSave: ({ value: a }, b) => {
257
+ i(a), b();
255
258
  }
256
259
  }
257
260
  )
258
261
  ] });
259
262
  }
260
- function Gt({
263
+ const De = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
264
+ function er({
261
265
  disabled: t,
262
- list: r,
263
- renderItem: l,
264
- ...i
266
+ list: i,
267
+ renderItem: n,
268
+ ...r
265
269
  }) {
266
- const s = M(null), a = nt(), d = ut(), c = Ht(Object.entries(r), (m) => m[1].index).map((m) => m[0]), b = M(c), v = ee(
267
- (m) => {
268
- b.current = m, d();
270
+ const a = X(null), b = ot(), p = pt(), u = $t(Object.entries(i), (s) => s[1].index).map((s) => s[0]), v = X(u), c = te(
271
+ (s) => {
272
+ v.current = s, p();
269
273
  },
270
- [d]
271
- ), u = ee(
272
- ({ index: m }, { index: n }) => {
273
- const o = [...b.current];
274
- o.splice(n, 0, ...o.splice(m, 1)), v(o);
274
+ [p]
275
+ ), h = te(
276
+ ({ index: s }, { index: l }) => {
277
+ const o = [...v.current];
278
+ o.splice(l, 0, ...o.splice(s, 1)), c(o);
275
279
  },
276
- [v]
280
+ [c]
277
281
  );
278
- L(() => {
279
- v(c);
280
- }, [c.join("-")]);
281
- const [{ isOver: g }, h] = Ge({
282
- accept: a,
283
- collect: (m) => ({
284
- isOver: m.isOver()
282
+ Q(() => {
283
+ c(u);
284
+ }, [u.join("-")]);
285
+ const [{ isOver: m }, f] = qe({
286
+ accept: b,
287
+ collect: (s) => ({
288
+ isOver: s.isOver()
285
289
  }),
286
290
  canDrop: () => !t,
287
291
  drop: () => {
288
292
  var o;
289
- const m = () => {
290
- b.current.forEach((f, x) => {
291
- const y = r[f];
293
+ const s = () => {
294
+ v.current.forEach((d, x) => {
295
+ const y = i[d];
292
296
  y && (y.index = x);
293
297
  });
294
- }, n = (o = J(r)) == null ? void 0 : o.doc;
295
- n ? n.transact(() => {
296
- m();
297
- }) : m();
298
+ }, l = (o = _(i)) == null ? void 0 : o.doc;
299
+ l ? l.transact(() => {
300
+ s();
301
+ }) : s();
298
302
  }
299
303
  });
300
- return L(() => {
301
- g || v(c);
302
- }, [g]), h(s), /* @__PURE__ */ e(S, { ...i, ref: s, className: ct(g && "isDragging"), children: b.current.map((m, n) => /* @__PURE__ */ e(
303
- Mt,
304
+ return Q(() => {
305
+ m || c(u);
306
+ }, [m]), f(a), /* @__PURE__ */ e(w, { ...r, ref: a, className: dt(m && "isDragging"), children: v.current.map((s, l) => /* @__PURE__ */ e(
307
+ tr,
304
308
  {
305
- type: a,
309
+ type: b,
306
310
  disabled: t,
307
- id: m,
308
- index: n,
309
- itemIndex: (o) => b.current.indexOf(o),
310
- move: u,
311
+ id: s,
312
+ index: l,
313
+ itemIndex: (o) => v.current.indexOf(o),
314
+ move: h,
311
315
  children: (o) => {
312
- const f = r[m];
313
- return f ? l(f.data, n, o) : null;
316
+ const d = i[s];
317
+ return d ? n(d.data, l, o) : null;
314
318
  }
315
319
  },
316
- m
320
+ s
317
321
  )) });
318
322
  }
319
- function Mt({
323
+ function tr({
320
324
  disabled: t,
321
- id: r,
322
- index: l,
323
- type: i,
324
- children: s,
325
- itemIndex: a,
326
- move: d
325
+ id: i,
326
+ index: n,
327
+ type: r,
328
+ children: a,
329
+ itemIndex: b,
330
+ move: p
327
331
  }) {
328
- const c = M(), [{ isDragging: b }, v, u] = _t({
329
- type: i,
330
- item: () => ({ id: r }),
332
+ const u = X(), [{ isDragging: v }, c, h] = Gt({
333
+ type: r,
334
+ item: () => ({ id: i }),
331
335
  canDrag: () => !t,
332
- collect: (h) => ({ isDragging: h.isDragging() })
333
- }), [, g] = Ge({
334
- accept: i,
336
+ collect: (f) => ({ isDragging: f.isDragging() })
337
+ }), [, m] = qe({
338
+ accept: r,
335
339
  canDrop: () => !t,
336
- hover(h, m) {
337
- var w;
338
- if (!c.current)
340
+ hover(f, s) {
341
+ var g;
342
+ if (!u.current)
339
343
  return;
340
- const n = a(h.id), o = l;
341
- if (n === o)
344
+ const l = b(f.id), o = n;
345
+ if (l === o)
342
346
  return;
343
- const f = (w = c.current) == null ? void 0 : w.getBoundingClientRect(), x = (f.bottom - f.top) / 2, p = m.getClientOffset().y - f.top;
344
- n < o && p < x || n > o && p > x || d({ id: h.id, index: n }, { id: r, index: l });
347
+ const d = (g = u.current) == null ? void 0 : g.getBoundingClientRect(), x = (d.bottom - d.top) / 2, I = s.getClientOffset().y - d.top;
348
+ l < o && I < x || l > o && I > x || p({ id: f.id, index: l }, { id: i, index: n });
345
349
  }
346
350
  });
347
- return typeof s == "function" ? s({
348
- isDragging: b,
349
- drag: v,
350
- drop: (h) => (c.current = h, g(h)),
351
- preview: u
352
- }) : (v(g(u(c))), /* @__PURE__ */ e(S, { ref: c, children: s }));
351
+ return typeof a == "function" ? a({
352
+ isDragging: v,
353
+ drag: c,
354
+ drop: (f) => (u.current = f, m(f)),
355
+ preview: h
356
+ }) : (c(m(h(u))), /* @__PURE__ */ e(w, { ref: u, children: a }));
353
357
  }
354
- function qt({
358
+ function rr({
355
359
  drop: t,
356
- preview: r,
357
- drag: l,
358
- disabled: i,
359
- isDragging: s,
360
- children: a,
361
- onDelete: d,
362
- actions: c
360
+ preview: i,
361
+ drag: n,
362
+ disabled: r,
363
+ isDragging: a,
364
+ children: b,
365
+ onDelete: p,
366
+ actions: u
363
367
  }) {
364
- const { t: b } = W();
365
- return /* @__PURE__ */ e(S, { ref: t, sx: { ":hover .hover-visible": { maxHeight: "100%" } }, children: /* @__PURE__ */ I(S, { sx: { position: "relative" }, children: [
368
+ const { t: v } = z();
369
+ return /* @__PURE__ */ e(w, { ref: t, sx: { ":hover .hover-visible": { maxHeight: "100%" } }, children: /* @__PURE__ */ k(w, { sx: { position: "relative" }, children: [
366
370
  /* @__PURE__ */ e(
367
- S,
371
+ w,
368
372
  {
369
- ref: r,
373
+ ref: i,
370
374
  sx: {
371
375
  flex: 1,
372
376
  borderRadius: 1,
373
- bgcolor: s ? "action.hover" : "background.paper",
377
+ bgcolor: a ? "action.hover" : "background.paper",
374
378
  opacity: 0.9999
375
379
  // NOTE: make preview effective
376
380
  },
377
- children: a
381
+ children: b
378
382
  }
379
383
  ),
380
- !i && /* @__PURE__ */ e(
381
- S,
384
+ !r && /* @__PURE__ */ e(
385
+ w,
382
386
  {
383
387
  className: "hover-visible",
384
388
  sx: { maxHeight: 0, overflow: "hidden", position: "absolute", right: 2, top: 2 },
385
- children: /* @__PURE__ */ I(
386
- R,
389
+ children: /* @__PURE__ */ k(
390
+ S,
387
391
  {
388
392
  direction: "row",
389
393
  sx: {
390
- bgcolor: (v) => Xe(v.palette.grey[300], 0.9),
394
+ bgcolor: (c) => Ze(c.palette.grey[300], 0.9),
391
395
  borderRadius: 1,
392
396
  p: 0.5,
393
- [`.${Ze.root}`]: {
397
+ [`.${Le.root}`]: {
394
398
  minWidth: 24,
395
399
  width: 24,
396
400
  height: 24,
@@ -398,9 +402,9 @@ function qt({
398
402
  }
399
403
  },
400
404
  children: [
401
- c,
402
- d && /* @__PURE__ */ e(ne, { title: b("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(N, { onClick: d, children: /* @__PURE__ */ e(Ct, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
403
- /* @__PURE__ */ e(ne, { title: b("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(N, { ref: l, children: /* @__PURE__ */ e(At, { sx: { color: "grey.500" } }) }) })
405
+ u,
406
+ p && /* @__PURE__ */ e(ne, { title: v("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(j, { onClick: p, children: /* @__PURE__ */ e(Vt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
407
+ /* @__PURE__ */ e(ne, { title: v("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(j, { ref: n, children: /* @__PURE__ */ e(_t, { sx: { color: "grey.500" } }) }) })
404
408
  ]
405
409
  }
406
410
  )
@@ -408,403 +412,383 @@ function qt({
408
412
  )
409
413
  ] }) });
410
414
  }
411
- function Qt({
415
+ function ir({
412
416
  label: t,
413
- value: r,
414
- onChange: l
417
+ value: i,
418
+ onChange: n
415
419
  }) {
416
- const [i, s] = Ne(!1);
417
- return /* @__PURE__ */ I(R, { gap: 1, children: [
420
+ const [r, a] = ue(!1);
421
+ return /* @__PURE__ */ k(S, { gap: 1, children: [
418
422
  /* @__PURE__ */ e(
419
- V,
423
+ D,
420
424
  {
421
425
  label: t,
422
426
  size: "small",
423
- value: r,
424
- onChange: (a) => l == null ? void 0 : l(a.target.value),
427
+ value: i,
428
+ onChange: (b) => n == null ? void 0 : n(b.target.value),
425
429
  InputProps: {
426
430
  endAdornment: /* @__PURE__ */ e(
427
- ue,
431
+ pe,
428
432
  {
429
- onChange: ({ response: a }) => {
430
- var c;
431
- const d = (c = a == null ? void 0 : a.data) == null ? void 0 : c.filename;
432
- d && (l == null || l(d));
433
+ onChange: ({ response: b }) => {
434
+ var u;
435
+ const p = (u = b == null ? void 0 : b.data) == null ? void 0 : u.filename;
436
+ p && (n == null || n(p));
433
437
  }
434
438
  }
435
439
  )
436
440
  }
437
441
  }
438
442
  ),
439
- r && /* @__PURE__ */ e(
440
- S,
443
+ i && /* @__PURE__ */ e(
444
+ w,
441
445
  {
442
446
  component: "img",
443
447
  sx: { objectFit: "contain", borderRadius: 1, cursor: "pointer" },
444
- src: Z(r),
448
+ src: ee(i),
445
449
  alt: t,
446
450
  maxWidth: 100,
447
451
  maxHeight: 100,
448
452
  width: "100%",
449
- onClick: () => s(!0)
453
+ onClick: () => a(!0)
450
454
  }
451
455
  ),
452
- /* @__PURE__ */ e(ae, { open: i, onClose: () => s(!1), children: /* @__PURE__ */ e(S, { component: "img", sx: { objectFit: "contain" }, src: Z(r), alt: t }) })
456
+ /* @__PURE__ */ e(ae, { open: r, onClose: () => a(!1), children: /* @__PURE__ */ e(w, { component: "img", sx: { objectFit: "contain" }, src: ee(i), alt: t }) })
453
457
  ] });
454
458
  }
455
- function Ar({ componentId: t }) {
459
+ function Jr({ componentId: t }) {
456
460
  const {
457
- state: { components: r }
458
- } = re(), l = r[t], i = l == null ? void 0 : l.data;
459
- return i ? /* @__PURE__ */ e(R, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(S, { p: 2, children: /* @__PURE__ */ e(Et, { FallbackComponent: qe, resetKeys: [t], children: /* @__PURE__ */ e(Xt, { value: i }) }) }) }) : null;
461
+ state: { components: i }
462
+ } = re(), n = i[t], r = n == null ? void 0 : n.data;
463
+ return r ? /* @__PURE__ */ e(S, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(w, { p: 2, children: /* @__PURE__ */ e(Yt, { FallbackComponent: Qe, resetKeys: [t], children: /* @__PURE__ */ e(lr, { value: r }) }) }) }) : null;
460
464
  }
461
- function Xt({ value: t }) {
462
- var d, c, b;
463
- const { t: r } = W(), {
464
- localState: { currentLocale: l },
465
+ function lr({ value: t }) {
466
+ var v, c, h;
467
+ const { t: i } = z(), {
468
+ localState: { currentLocale: n },
465
469
  state: {
466
- config: { defaultLocale: i }
467
- }
468
- } = re(), s = J(t).doc, a = ce();
469
- return /* @__PURE__ */ e(R, { height: "100%", children: /* @__PURE__ */ I(R, { gap: 2, children: [
470
- /* @__PURE__ */ e(Zt, { config: t }),
470
+ config: { defaultLocale: r }
471
+ },
472
+ currentPage: a,
473
+ currentSection: b
474
+ } = re(), p = _(t).doc, u = ce();
475
+ return /* @__PURE__ */ e(S, { height: "100%", children: /* @__PURE__ */ k(S, { gap: 2, children: [
476
+ /* @__PURE__ */ e(nr, { config: t }),
471
477
  /* @__PURE__ */ e(
472
- Lt,
478
+ or,
473
479
  {
474
480
  config: t,
475
- currentLocale: l,
476
- defaultLocale: i,
477
- allComponents: a,
478
- onUpdateConfig: (v) => {
479
- s.transact(() => {
480
- v(t);
481
+ currentLocale: n,
482
+ defaultLocale: r,
483
+ allComponents: u,
484
+ onUpdateConfig: (m) => {
485
+ p.transact(() => {
486
+ m(t);
481
487
  });
482
488
  }
483
489
  }
484
490
  ),
485
- /* @__PURE__ */ I(R, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
486
- /* @__PURE__ */ e(Q, { variant: "subtitle1", children: r("renderer") }),
487
- /* @__PURE__ */ I(
488
- V,
491
+ /* @__PURE__ */ k(S, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
492
+ /* @__PURE__ */ e(E, { variant: "subtitle1", children: i("renderer") }),
493
+ /* @__PURE__ */ k(
494
+ D,
489
495
  {
490
496
  hiddenLabel: !0,
491
497
  size: "small",
492
498
  select: !0,
493
499
  SelectProps: { autoWidth: !0 },
494
- value: ((d = t.renderer) == null ? void 0 : d.type) || "react-component",
495
- onChange: (v) => {
496
- s.transact(() => {
497
- const u = v.target.value;
498
- t.renderer ?? (t.renderer = { type: u }), t.renderer.type = u;
500
+ value: ((v = t.renderer) == null ? void 0 : v.type) || "react-component",
501
+ onChange: (m) => {
502
+ p.transact(() => {
503
+ const f = m.target.value;
504
+ t.renderer ?? (t.renderer = { type: f }), t.renderer.type = f;
499
505
  });
500
506
  },
501
507
  children: [
502
- /* @__PURE__ */ e(T, { value: "react-component", children: "React Component" }),
503
- /* @__PURE__ */ e(T, { value: "component", children: "Custom Component" })
508
+ /* @__PURE__ */ e(R, { value: "react-component", children: "React Component" }),
509
+ /* @__PURE__ */ e(R, { value: "component", children: "Custom Component" })
504
510
  ]
505
511
  }
506
512
  )
507
513
  ] }),
508
- ((c = t.renderer) == null ? void 0 : c.type) === "component" ? /* @__PURE__ */ e(or, { value: t }) : ((b = t.renderer) == null ? void 0 : b.type) === "react-component" ? /* @__PURE__ */ e(nr, { value: t }) : null
514
+ ((c = t.renderer) == null ? void 0 : c.type) === "component" ? /* @__PURE__ */ e(mr, { value: t }) : ((h = t.renderer) == null ? void 0 : h.type) === "react-component" ? /* @__PURE__ */ e(pr, { value: t }) : null,
515
+ /* @__PURE__ */ e(
516
+ hr,
517
+ {
518
+ config: t,
519
+ currentLocale: n,
520
+ defaultLocale: r,
521
+ allComponents: u,
522
+ onChange: (m) => {
523
+ console.warn(m, JSON.parse(JSON.stringify({ currentPage: a, currentSection: b })));
524
+ },
525
+ props: {}
526
+ }
527
+ )
509
528
  ] }) });
510
529
  }
511
- function Zt({ config: t }) {
512
- const { t: r } = W();
513
- return /* @__PURE__ */ e(He, { children: /* @__PURE__ */ I(R, { gap: 2, children: [
514
- /* @__PURE__ */ e(Q, { variant: "subtitle1", children: r("basicInfo") }),
530
+ function nr({ config: t }) {
531
+ const { t: i } = z();
532
+ return /* @__PURE__ */ e(Ke, { children: /* @__PURE__ */ k(S, { gap: 2, children: [
533
+ /* @__PURE__ */ e(E, { variant: "subtitle1", children: i("basicInfo") }),
515
534
  /* @__PURE__ */ e(
516
- V,
535
+ D,
517
536
  {
518
- label: r("name"),
537
+ label: i("name"),
519
538
  size: "small",
520
539
  value: t.name || "",
521
- onChange: (l) => t.name = l.target.value
540
+ onChange: (n) => t.name = n.target.value
522
541
  }
523
542
  ),
524
543
  /* @__PURE__ */ e(
525
- V,
544
+ D,
526
545
  {
527
- label: r("description"),
546
+ label: i("description"),
528
547
  size: "small",
529
548
  multiline: !0,
530
549
  minRows: 2,
531
550
  maxRows: 10,
532
551
  inputProps: { maxLength: 200 },
533
552
  value: t.description || "",
534
- onChange: (l) => t.description = l.target.value
553
+ onChange: (n) => t.description = n.target.value
535
554
  }
536
555
  ),
537
556
  /* @__PURE__ */ e(
538
- Ae,
557
+ Ne,
539
558
  {
540
559
  size: "small",
541
560
  options: [],
542
561
  multiple: !0,
543
562
  freeSolo: !0,
544
563
  value: t.tags ?? [],
545
- onChange: (l, i) => t.tags = i,
546
- renderInput: (l) => /* @__PURE__ */ e(V, { label: r("tags"), ...l })
564
+ onChange: (n, r) => t.tags = r,
565
+ renderInput: (n) => /* @__PURE__ */ e(D, { label: i("tags"), ...n })
547
566
  }
548
567
  ),
549
568
  /* @__PURE__ */ e(
550
- Qt,
569
+ ir,
551
570
  {
552
- label: r("previewImage"),
571
+ label: i("previewImage"),
553
572
  value: t.previewImage || "",
554
- onChange: (l) => t.previewImage = l
573
+ onChange: (n) => t.previewImage = n
555
574
  }
556
575
  )
557
576
  ] }) });
558
577
  }
559
- function Lt({
578
+ function or({
560
579
  config: t,
561
- currentLocale: r,
562
- defaultLocale: l,
563
- allComponents: i,
564
- onUpdateConfig: s,
565
- useI18nEditor: a = !0
580
+ currentLocale: i,
581
+ defaultLocale: n,
582
+ allComponents: r,
583
+ onUpdateConfig: a,
584
+ useI18nEditor: b = !0
566
585
  }) {
567
- var u, g, h, m, n, o, f, x, y;
568
- const { t: d } = W(), c = ie({ variant: "dialog" }), b = t.properties && X(Object.values(t.properties), "index"), v = ee(
569
- (p) => {
570
- s((w) => {
571
- var D, O, j;
572
- w.properties ?? (w.properties = {}), (D = w.properties).customSettings ?? (D.customSettings = {
573
- index: 0,
574
- data: {
575
- id: "customSettings",
576
- key: "customSettings",
577
- type: "custom-settings",
578
- locales: {
579
- [r]: {
580
- defaultValue: {}
581
- }
582
- }
583
- }
584
- }), (O = w.properties.customSettings.data).locales ?? (O.locales = {}), (j = w.properties.customSettings.data.locales)[r] ?? (j[r] = {}), w.properties.customSettings.data.locales[r].defaultValue = p;
585
- });
586
- },
587
- [r, s]
588
- );
589
- return /* @__PURE__ */ e(He, { children: /* @__PURE__ */ I(R, { gap: 2, children: [
590
- /* @__PURE__ */ I(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
591
- /* @__PURE__ */ e(Q, { variant: "subtitle1", children: d("properties") }),
592
- /* @__PURE__ */ e(S, { flex: 1 }),
586
+ const { t: p } = z(), u = ie({ variant: "dialog" }), v = t.properties && V(Object.values(t.properties), "index");
587
+ return /* @__PURE__ */ e(Ke, { children: /* @__PURE__ */ k(S, { gap: 2, children: [
588
+ /* @__PURE__ */ k(S, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
589
+ /* @__PURE__ */ e(E, { variant: "subtitle1", children: p("properties") }),
590
+ /* @__PURE__ */ e(w, { flex: 1 }),
593
591
  /* @__PURE__ */ e(
594
- N,
592
+ j,
595
593
  {
596
594
  onClick: () => {
597
- s((p) => {
598
- var D;
599
- const w = Qe();
600
- p.properties ?? (p.properties = {}), (D = p.properties)[w] ?? (D[w] = { index: (b == null ? void 0 : b.length) || 0, data: { id: w } });
595
+ a((c) => {
596
+ var m;
597
+ const h = Xe();
598
+ c.properties ?? (c.properties = {}), (m = c.properties)[h] ?? (m[h] = { index: (v == null ? void 0 : v.length) || 0, data: { id: h } });
601
599
  });
602
600
  },
603
- startIcon: /* @__PURE__ */ e(Tt, {}),
604
- children: d("addObject", { object: d("property") })
601
+ startIcon: /* @__PURE__ */ e(Kt, {}),
602
+ children: p("addObject", { object: p("property") })
605
603
  }
606
604
  ),
607
- a && /* @__PURE__ */ e(N, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(c), children: /* @__PURE__ */ e(Ke, { fontSize: "small" }) })
605
+ b && /* @__PURE__ */ e(j, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(u), children: /* @__PURE__ */ e(Je, { fontSize: "small" }) })
608
606
  ] }),
609
607
  t.properties && /* @__PURE__ */ e(
610
- Gt,
608
+ er,
611
609
  {
612
- component: R,
610
+ component: S,
613
611
  gap: 2,
614
612
  list: t.properties,
615
- renderItem: (p, w, D) => {
616
- var O, j, B, H, _, F;
617
- return p.type === "custom-settings" ? null : /* @__PURE__ */ I(R, { gap: 1, bgcolor: "background.paper", children: [
613
+ renderItem: (c, h, m) => {
614
+ var f, s, l, o, d, x;
615
+ return c.type === "custom-settings" ? null : /* @__PURE__ */ k(S, { gap: 1, bgcolor: "background.paper", children: [
618
616
  /* @__PURE__ */ e(
619
- qt,
617
+ rr,
620
618
  {
621
- preview: D.preview,
622
- drop: D.drop,
623
- drag: D.drag,
624
- isDragging: D.isDragging,
619
+ preview: m.preview,
620
+ drop: m.drop,
621
+ drag: m.drag,
622
+ isDragging: m.isDragging,
625
623
  onDelete: () => {
626
- s((z) => {
627
- if (z.properties) {
628
- const k = Object.entries(z.properties).sort(([, A], [, E]) => A.index - E.index);
629
- delete z.properties[p.id], k.filter(([A]) => A !== p.id).forEach(([, A], E) => {
630
- A.index = E;
624
+ a((y) => {
625
+ if (y.properties) {
626
+ const g = Object.entries(y.properties).sort(([, P], [, O]) => P.index - O.index);
627
+ delete y.properties[c.id], g.filter(([P]) => P !== c.id).forEach(([, P], O) => {
628
+ P.index = O;
631
629
  });
632
630
  }
633
631
  });
634
632
  },
635
- children: /* @__PURE__ */ I(R, { direction: "row", gap: 1, children: [
633
+ children: /* @__PURE__ */ k(S, { direction: "row", gap: 1, children: [
636
634
  /* @__PURE__ */ e(
637
- V,
635
+ D,
638
636
  {
639
- label: d("key"),
637
+ label: p("key"),
640
638
  size: "small",
641
639
  sx: { flex: 1 },
642
- value: p.key || "",
643
- onChange: (z) => {
644
- s((C) => {
645
- const k = C.properties[p.id].data;
646
- k.key = z.target.value.trim();
640
+ value: c.key || "",
641
+ onChange: (y) => {
642
+ a((I) => {
643
+ const g = I.properties[c.id].data;
644
+ g.key = y.target.value.trim();
647
645
  });
648
646
  }
649
647
  }
650
648
  ),
651
649
  /* @__PURE__ */ e(
652
- V,
650
+ D,
653
651
  {
654
- label: d("label"),
652
+ label: p("label"),
655
653
  size: "small",
656
654
  sx: { flex: 1 },
657
- value: (((j = (O = p.locales) == null ? void 0 : O[r]) == null ? void 0 : j.name) ?? ((H = (B = p.locales) == null ? void 0 : B[l]) == null ? void 0 : H.name)) || "",
658
- onChange: (z) => {
659
- s((C) => {
660
- var P;
661
- const k = C.properties[p.id].data;
662
- k.locales ?? (k.locales = {}), (P = k.locales)[r] ?? (P[r] = {}), k.locales[r].name = z.target.value;
655
+ value: (((s = (f = c.locales) == null ? void 0 : f[i]) == null ? void 0 : s.name) ?? ((o = (l = c.locales) == null ? void 0 : l[n]) == null ? void 0 : o.name)) || "",
656
+ onChange: (y) => {
657
+ a((I) => {
658
+ var C;
659
+ const g = I.properties[c.id].data;
660
+ g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].name = y.target.value;
663
661
  });
664
662
  }
665
663
  }
666
664
  ),
667
- /* @__PURE__ */ I(
668
- V,
665
+ /* @__PURE__ */ k(
666
+ D,
669
667
  {
670
- label: d("type"),
668
+ label: p("type"),
671
669
  size: "small",
672
670
  select: !0,
673
671
  sx: { flex: 1 },
674
- value: p.type === "string" && p.multiline ? "multiline" : p.type || "string",
675
- onChange: (z) => {
676
- s((C) => {
677
- const k = C.properties[p.id].data;
678
- if (k.locales)
679
- for (const A of Object.keys(k.locales))
680
- k.locales[A].defaultValue = void 0;
681
- const P = z.target.value;
682
- P === "multiline" ? (k.type = "string", k.multiline = !0) : (typeof k.multiline < "u" && delete k.multiline, k.type = P);
672
+ value: c.type === "string" && c.multiline ? "multiline" : c.type || "string",
673
+ onChange: (y) => {
674
+ a((I) => {
675
+ const g = I.properties[c.id].data;
676
+ if (g.locales)
677
+ for (const P of Object.keys(g.locales))
678
+ g.locales[P].defaultValue = void 0;
679
+ const C = y.target.value;
680
+ C === "multiline" ? (g.type = "string", g.multiline = !0) : (typeof g.multiline < "u" && delete g.multiline, g.type = C);
683
681
  });
684
682
  },
685
683
  children: [
686
- /* @__PURE__ */ e(T, { value: "string", children: "Text" }),
687
- /* @__PURE__ */ e(T, { value: "multiline", children: "Text (Multiline)" }),
688
- /* @__PURE__ */ e(T, { value: "number", children: "Number" }),
689
- /* @__PURE__ */ e(T, { value: "decimal", children: "Decimal" }),
690
- /* @__PURE__ */ e(T, { value: "boolean", children: "Boolean" }),
691
- /* @__PURE__ */ e(T, { value: "color", children: "Color" }),
692
- /* @__PURE__ */ e(T, { value: "url", children: "URL (Upload)" }),
693
- /* @__PURE__ */ e(T, { value: "json", children: "JSON" }),
694
- /* @__PURE__ */ e(T, { value: "yaml", children: "YAML" }),
695
- /* @__PURE__ */ e(T, { value: "component", children: "Component" }),
696
- /* @__PURE__ */ e(T, { value: "custom", children: "Custom (Render by a Component)" })
684
+ /* @__PURE__ */ e(R, { value: "string", children: "Text" }),
685
+ /* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
686
+ /* @__PURE__ */ e(R, { value: "number", children: "Number" }),
687
+ /* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
688
+ /* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
689
+ /* @__PURE__ */ e(R, { value: "color", children: "Color" }),
690
+ /* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
691
+ /* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
692
+ /* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
693
+ /* @__PURE__ */ e(R, { value: "component", children: "Component" }),
694
+ /* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
697
695
  ]
698
696
  }
699
697
  )
700
698
  ] })
701
699
  }
702
700
  ),
703
- /* @__PURE__ */ I(R, { direction: "row", gap: 1, children: [
701
+ /* @__PURE__ */ k(S, { direction: "row", gap: 1, children: [
704
702
  /* @__PURE__ */ e(
705
- q,
703
+ W,
706
704
  {
707
- allComponents: i,
708
- defaultLocale: l,
705
+ allComponents: r,
706
+ defaultLocale: n,
709
707
  component: t,
710
- property: p,
711
- label: d("defaultValue"),
708
+ property: c,
709
+ label: p("defaultValue"),
712
710
  size: "small",
713
711
  fullWidth: !0,
714
- value: (F = (_ = p.locales) == null ? void 0 : _[r]) == null ? void 0 : F.defaultValue,
715
- onChange: (z) => {
716
- s((C) => {
717
- var P;
718
- const k = C.properties[p.id].data;
719
- k.locales ?? (k.locales = {}), (P = k.locales)[r] ?? (P[r] = {}), k.locales[r].defaultValue = z;
712
+ value: (x = (d = c.locales) == null ? void 0 : d[i]) == null ? void 0 : x.defaultValue,
713
+ onChange: (y) => {
714
+ a((I) => {
715
+ var C;
716
+ const g = I.properties[c.id].data;
717
+ g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].defaultValue = y;
720
718
  });
721
719
  }
722
720
  }
723
721
  ),
724
- p.type === "custom" ? /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(er, { property: p, allComponents: i }) }) : null
722
+ c.type === "custom" ? /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(sr, { property: c, allComponents: r }) }) : null
725
723
  ] })
726
- ] }, p.id);
724
+ ] }, c.id);
727
725
  }
728
726
  }
729
727
  ),
730
- ((u = i == null ? void 0 : i[t.id]) == null ? void 0 : u.data) && /* @__PURE__ */ e(S, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
731
- Fe,
732
- {
733
- componentId: t.id,
734
- renderType: "setting",
735
- locale: r,
736
- properties: {},
737
- dev: { mode: "draft", components: i, defaultLocale: l },
738
- props: {
739
- value: ((n = (m = (h = (g = t.properties) == null ? void 0 : g.customSettings) == null ? void 0 : h.data.locales) == null ? void 0 : m[r]) == null ? void 0 : n.defaultValue) ?? ((y = (x = (f = (o = t.properties) == null ? void 0 : o.customSettings) == null ? void 0 : f.data.locales) == null ? void 0 : x[l]) == null ? void 0 : y.defaultValue) ?? null,
740
- onChange: v
741
- }
742
- }
743
- ) }),
744
- a && /* @__PURE__ */ e(Me, { ...Je(c), component: t })
728
+ b && /* @__PURE__ */ e(Me, { ...$e(u), component: t })
745
729
  ] }) });
746
730
  }
747
- function er({
731
+ function sr({
748
732
  property: t,
749
- allComponents: r
733
+ allComponents: i
750
734
  }) {
751
- const l = ie({ variant: "popper" });
752
- return /* @__PURE__ */ I($, { children: [
753
- /* @__PURE__ */ e(N, { sx: { minWidth: 0 }, ...le(l), children: /* @__PURE__ */ e($e, { fontSize: "small" }) }),
754
- /* @__PURE__ */ e(Te, { ...Ye(l), children: /* @__PURE__ */ e(Ue, { onClickAway: l.close, children: /* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(S, { width: 500, p: 2, children: /* @__PURE__ */ e(
755
- pe,
735
+ const n = ie({ variant: "popper" });
736
+ return /* @__PURE__ */ k(N, { children: [
737
+ /* @__PURE__ */ e(j, { sx: { minWidth: 0 }, ...le(n), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) }),
738
+ /* @__PURE__ */ e(We, { ...Ge(n), children: /* @__PURE__ */ e(Ue, { onClickAway: n.close, children: /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ e(w, { width: 500, p: 2, children: /* @__PURE__ */ e(
739
+ me,
756
740
  {
757
741
  value: t.componentId,
758
- onChange: (i, s) => t.componentId = s,
759
- allComponents: r
742
+ onChange: (r, a) => t.componentId = a,
743
+ allComponents: i
760
744
  }
761
745
  ) }) }) }) })
762
746
  ] });
763
747
  }
764
- function tr({
748
+ function cr({
765
749
  value: t,
766
- valueImmutable: r,
767
- onChange: l,
768
- defaultLocale: i,
769
- allComponents: s
750
+ valueImmutable: i,
751
+ onChange: n,
752
+ defaultLocale: r,
753
+ allComponents: a
770
754
  }) {
771
- var b;
772
- const a = ie({ variant: "popper" }), { locale: d } = W(), c = typeof (t == null ? void 0 : t.componentId) == "string" ? (b = s[t.componentId]) == null ? void 0 : b.data : void 0;
773
- return c ? /* @__PURE__ */ I($, { children: [
774
- /* @__PURE__ */ e(N, { sx: { minWidth: 0 }, disabled: !c, ...le(a), children: /* @__PURE__ */ e($e, { fontSize: "small" }) }),
755
+ var v;
756
+ const b = ie({ variant: "popper" }), { locale: p } = z(), u = typeof (t == null ? void 0 : t.componentId) == "string" ? (v = a[t.componentId]) == null ? void 0 : v.data : void 0;
757
+ return u ? /* @__PURE__ */ k(N, { children: [
758
+ /* @__PURE__ */ e(j, { sx: { minWidth: 0 }, disabled: !u, ...le(b), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) }),
775
759
  /* @__PURE__ */ e(
776
- Te,
760
+ We,
777
761
  {
778
- ...Ye(a),
762
+ ...Ge(b),
779
763
  sx: {
780
764
  zIndex: 1e3
781
765
  },
782
- children: /* @__PURE__ */ e(Ue, { onClickAway: a.close, children: /* @__PURE__ */ e(Be, { children: /* @__PURE__ */ I(S, { width: 500, p: 2, children: [
783
- /* @__PURE__ */ e(Q, { variant: "subtitle1", children: "Parameters" }),
784
- /* @__PURE__ */ e(R, { gap: 1, children: (c == null ? void 0 : c.properties) && X(Object.values(c.properties), "index").map(({ data: v }) => {
785
- var u, g, h, m, n, o, f, x;
786
- return /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
787
- q,
766
+ children: /* @__PURE__ */ e(Ue, { onClickAway: b.close, children: /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ k(w, { width: 500, p: 2, children: [
767
+ /* @__PURE__ */ e(E, { variant: "subtitle1", children: "Parameters" }),
768
+ /* @__PURE__ */ e(S, { gap: 1, children: (u == null ? void 0 : u.properties) && V(Object.values(u.properties), "index").map(({ data: c }) => {
769
+ var h, m, f, s, l, o, d, x;
770
+ return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
771
+ W,
788
772
  {
789
- allComponents: s,
790
- defaultLocale: i,
773
+ allComponents: a,
774
+ defaultLocale: r,
791
775
  size: "small",
792
776
  fullWidth: !0,
793
- component: c,
794
- property: v,
795
- valueImmutable: te((g = (u = t.properties) == null ? void 0 : u[v.id]) == null ? void 0 : g.value),
796
- value: ((m = (h = t.properties) == null ? void 0 : h[v.id]) == null ? void 0 : m.value) ?? ((o = (n = v.locales) == null ? void 0 : n[d]) == null ? void 0 : o.defaultValue) ?? ((x = (f = v.locales) == null ? void 0 : f[i]) == null ? void 0 : x.defaultValue),
777
+ component: u,
778
+ property: c,
779
+ valueImmutable: Z((m = (h = t.properties) == null ? void 0 : h[c.id]) == null ? void 0 : m.value),
780
+ value: ((s = (f = t.properties) == null ? void 0 : f[c.id]) == null ? void 0 : s.value) ?? ((o = (l = c.locales) == null ? void 0 : l[p]) == null ? void 0 : o.defaultValue) ?? ((x = (d = c.locales) == null ? void 0 : d[r]) == null ? void 0 : x.defaultValue),
797
781
  onChange: (y) => {
798
- if (r) {
799
- const p = JSON.parse(JSON.stringify(t));
800
- l == null || l({ ...p, properties: { ...p.properties, [v.id]: { value: y } } });
782
+ if (i) {
783
+ const I = JSON.parse(JSON.stringify(t));
784
+ n == null || n({ ...I, properties: { ...I.properties, [c.id]: { value: y } } });
801
785
  } else
802
- J(c).doc.transact(() => {
803
- t.properties ?? (t.properties = {}), t.properties[v.id] = { value: y };
786
+ _(u).doc.transact(() => {
787
+ t.properties ?? (t.properties = {}), t.properties[c.id] = { value: y };
804
788
  });
805
789
  }
806
790
  }
807
- ) }, v.id);
791
+ ) }, c.id);
808
792
  }) })
809
793
  ] }) }) })
810
794
  }
@@ -813,173 +797,173 @@ function tr({
813
797
  }
814
798
  function Me({
815
799
  type: t = "properties",
816
- component: r,
817
- ...l
800
+ component: i,
801
+ ...n
818
802
  }) {
819
- var g, h, m;
820
- const { t: i } = W(), {
803
+ var m, f, s;
804
+ const { t: r } = z(), {
821
805
  state: {
822
- components: s,
823
- supportedLocales: a,
824
- config: { defaultLocale: d }
806
+ components: a,
807
+ supportedLocales: b,
808
+ config: { defaultLocale: p }
825
809
  }
826
- } = re(), c = ce(), b = J(r).doc, v = t === "properties" ? r.properties : t === "parameters" && ((g = r.renderer) == null ? void 0 : g.type) === "component" ? (h = s[r.renderer.componentId]) == null ? void 0 : h.data.properties : void 0, u = ((m = r.renderer) == null ? void 0 : m.type) === "component" ? r : void 0;
827
- return /* @__PURE__ */ I(ae, { ...l, fullWidth: !0, maxWidth: "lg", children: [
828
- /* @__PURE__ */ e(Oe, { children: i("i18nEditorTitle") }),
829
- /* @__PURE__ */ e(je, { children: v && /* @__PURE__ */ e(R, { children: /* @__PURE__ */ I(et, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
830
- /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ e(Se, { children: a.map(({ locale: n, name: o }) => /* @__PURE__ */ I(ke, { children: [
810
+ } = re(), u = ce(), v = _(i).doc, c = t === "properties" ? i.properties : t === "parameters" && ((m = i.renderer) == null ? void 0 : m.type) === "component" ? (f = a[i.renderer.componentId]) == null ? void 0 : f.data.properties : void 0, h = ((s = i.renderer) == null ? void 0 : s.type) === "component" ? i : void 0;
811
+ return /* @__PURE__ */ k(ae, { ...n, fullWidth: !0, maxWidth: "lg", children: [
812
+ /* @__PURE__ */ e(Ae, { children: r("i18nEditorTitle") }),
813
+ /* @__PURE__ */ e(Te, { children: c && /* @__PURE__ */ e(S, { children: /* @__PURE__ */ k(tt, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
814
+ /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(Se, { children: b.map(({ locale: l, name: o }) => /* @__PURE__ */ k(Ce, { children: [
831
815
  o,
832
- d === n && /* @__PURE__ */ e(Wt, { sx: { fontSize: 12, color: "text.secondary" } })
833
- ] }, n)) }) }),
834
- /* @__PURE__ */ e(rt, { children: X(Object.values(v), "index").map(({ data: n }) => /* @__PURE__ */ e(Se, { children: a.map(({ locale: o }) => {
835
- var f, x, y, p, w, D, O, j, B, H, _, F, z, C, k, P, A, E, Y, G, me, he, fe, be, ge, ve;
836
- return /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(R, { gap: 1, children: t === "properties" ? /* @__PURE__ */ I($, { children: [
816
+ p === l && /* @__PURE__ */ e(Ht, { sx: { fontSize: 12, color: "text.secondary" } })
817
+ ] }, l)) }) }),
818
+ /* @__PURE__ */ e(it, { children: V(Object.values(c), "index").map(({ data: l }) => /* @__PURE__ */ e(Se, { children: b.map(({ locale: o }) => {
819
+ var d, x, y, I, g, C, P, O, A, K, F, H, U, J, L, Y, $, G, q, M, he, fe, be, ve, ye, ge;
820
+ return /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(S, { gap: 1, children: t === "properties" ? /* @__PURE__ */ k(N, { children: [
837
821
  /* @__PURE__ */ e(
838
- V,
822
+ D,
839
823
  {
840
824
  size: "small",
841
825
  label: "Key",
842
- value: n.key || "",
843
- onChange: (K) => {
844
- b.transact(() => {
845
- n.key = K.target.value.trim();
826
+ value: l.key || "",
827
+ onChange: (B) => {
828
+ v.transact(() => {
829
+ l.key = B.target.value.trim();
846
830
  });
847
831
  }
848
832
  }
849
833
  ),
850
834
  /* @__PURE__ */ e(
851
- V,
835
+ D,
852
836
  {
853
837
  size: "small",
854
- label: i("label"),
855
- value: (((x = (f = n.locales) == null ? void 0 : f[o]) == null ? void 0 : x.name) ?? ((p = (y = n.locales) == null ? void 0 : y[d]) == null ? void 0 : p.name)) || "",
856
- onChange: (K) => {
857
- b.transact(() => {
858
- var U;
859
- n.locales ?? (n.locales = {}), (U = n.locales)[o] ?? (U[o] = {}), n.locales[o].name = K.target.value;
838
+ label: r("label"),
839
+ value: (((x = (d = l.locales) == null ? void 0 : d[o]) == null ? void 0 : x.name) ?? ((I = (y = l.locales) == null ? void 0 : y[p]) == null ? void 0 : I.name)) || "",
840
+ onChange: (B) => {
841
+ v.transact(() => {
842
+ var T;
843
+ l.locales ?? (l.locales = {}), (T = l.locales)[o] ?? (T[o] = {}), l.locales[o].name = B.target.value;
860
844
  });
861
845
  }
862
846
  }
863
847
  ),
864
- /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
865
- q,
848
+ /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
849
+ W,
866
850
  {
867
- allComponents: c,
868
- defaultLocale: d,
869
- component: r,
870
- property: n,
851
+ allComponents: u,
852
+ defaultLocale: p,
853
+ component: i,
854
+ property: l,
871
855
  size: "small",
872
856
  fullWidth: !0,
873
857
  label: "Default Value",
874
- valueImmutable: te((D = (w = n.locales) == null ? void 0 : w[o]) == null ? void 0 : D.defaultValue),
875
- value: ((j = (O = n.locales) == null ? void 0 : O[o]) == null ? void 0 : j.defaultValue) ?? ((H = (B = n.locales) == null ? void 0 : B[d]) == null ? void 0 : H.defaultValue),
876
- onChange: (K) => {
877
- b.transact(() => {
878
- var U;
879
- n.locales ?? (n.locales = {}), (U = n.locales)[o] ?? (U[o] = {}), n.locales[o].defaultValue = K;
858
+ valueImmutable: Z((C = (g = l.locales) == null ? void 0 : g[o]) == null ? void 0 : C.defaultValue),
859
+ value: ((O = (P = l.locales) == null ? void 0 : P[o]) == null ? void 0 : O.defaultValue) ?? ((K = (A = l.locales) == null ? void 0 : A[p]) == null ? void 0 : K.defaultValue),
860
+ onChange: (B) => {
861
+ v.transact(() => {
862
+ var T;
863
+ l.locales ?? (l.locales = {}), (T = l.locales)[o] ?? (T[o] = {}), l.locales[o].defaultValue = B;
880
864
  });
881
865
  }
882
866
  }
883
867
  ) })
884
- ] }) : t === "parameters" && u ? /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
885
- q,
868
+ ] }) : t === "parameters" && h ? /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
869
+ W,
886
870
  {
887
- allComponents: c,
888
- defaultLocale: d,
889
- component: r,
890
- property: n,
871
+ allComponents: u,
872
+ defaultLocale: p,
873
+ component: i,
874
+ property: l,
891
875
  size: "small",
892
876
  fullWidth: !0,
893
- valueImmutable: te(
894
- (C = (z = (F = (_ = u.renderer.properties) == null ? void 0 : _[n.id]) == null ? void 0 : F.locales) == null ? void 0 : z[o]) == null ? void 0 : C.value
877
+ valueImmutable: Z(
878
+ (J = (U = (H = (F = h.renderer.properties) == null ? void 0 : F[l.id]) == null ? void 0 : H.locales) == null ? void 0 : U[o]) == null ? void 0 : J.value
895
879
  ),
896
- value: ((E = (A = (P = (k = u.renderer.properties) == null ? void 0 : k[n.id]) == null ? void 0 : P.locales) == null ? void 0 : A[o]) == null ? void 0 : E.value) ?? ((he = (me = (G = (Y = u.renderer.properties) == null ? void 0 : Y[n.id]) == null ? void 0 : G.locales) == null ? void 0 : me[d]) == null ? void 0 : he.value) ?? ((be = (fe = n.locales) == null ? void 0 : fe[o]) == null ? void 0 : be.defaultValue) ?? ((ve = (ge = n.locales) == null ? void 0 : ge[d]) == null ? void 0 : ve.defaultValue),
897
- onChange: (K) => {
898
- b.transact(() => {
899
- var U, xe, ye, Ie, we;
900
- (U = u.renderer).properties ?? (U.properties = {}), (xe = u.renderer.properties)[ye = n.id] ?? (xe[ye] = {}), (Ie = u.renderer.properties[n.id]).locales ?? (Ie.locales = {}), (we = u.renderer.properties[n.id].locales)[o] ?? (we[o] = {}), u.renderer.properties[n.id].locales[o].value = K;
880
+ value: ((G = ($ = (Y = (L = h.renderer.properties) == null ? void 0 : L[l.id]) == null ? void 0 : Y.locales) == null ? void 0 : $[o]) == null ? void 0 : G.value) ?? ((fe = (he = (M = (q = h.renderer.properties) == null ? void 0 : q[l.id]) == null ? void 0 : M.locales) == null ? void 0 : he[p]) == null ? void 0 : fe.value) ?? ((ve = (be = l.locales) == null ? void 0 : be[o]) == null ? void 0 : ve.defaultValue) ?? ((ge = (ye = l.locales) == null ? void 0 : ye[p]) == null ? void 0 : ge.defaultValue),
881
+ onChange: (B) => {
882
+ v.transact(() => {
883
+ var T, xe, Ie, ke, we;
884
+ (T = h.renderer).properties ?? (T.properties = {}), (xe = h.renderer.properties)[Ie = l.id] ?? (xe[Ie] = {}), (ke = h.renderer.properties[l.id]).locales ?? (ke.locales = {}), (we = h.renderer.properties[l.id].locales)[o] ?? (we[o] = {}), h.renderer.properties[l.id].locales[o].value = B;
901
885
  });
902
886
  }
903
887
  }
904
- ) }) : null }, n.id) }, o);
905
- }) }, n.id)) })
888
+ ) }) : null }, l.id) }, o);
889
+ }) }, l.id)) })
906
890
  ] }) }) }),
907
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(N, { onClick: (n) => {
891
+ /* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(j, { onClick: (l) => {
908
892
  var o;
909
- return (o = l.onClose) == null ? void 0 : o.call(l, n, "escapeKeyDown");
910
- }, children: i("close") }) })
893
+ return (o = n.onClose) == null ? void 0 : o.call(n, l, "escapeKeyDown");
894
+ }, children: r("close") }) })
911
895
  ] });
912
896
  }
913
- function q({
897
+ function W({
914
898
  component: t,
915
- property: r,
916
- value: l,
917
- onChange: i,
918
- valueImmutable: s,
919
- defaultLocale: a,
920
- allComponents: d,
921
- ...c
899
+ property: i,
900
+ value: n,
901
+ onChange: r,
902
+ valueImmutable: a,
903
+ defaultLocale: b,
904
+ allComponents: p,
905
+ ...u
922
906
  }) {
923
- var g, h, m, n, o;
924
- const { locale: b } = W(), v = M(null), u = c.label || ((h = (g = r.locales) == null ? void 0 : g[b]) == null ? void 0 : h.name) || ((n = (m = r.locales) == null ? void 0 : m[a]) == null ? void 0 : n.name) || r.key || r.id;
925
- if (r.type === "number")
907
+ var m, f, s, l, o;
908
+ const { locale: v } = z(), c = X(null), h = u.label || ((f = (m = i.locales) == null ? void 0 : m[v]) == null ? void 0 : f.name) || ((l = (s = i.locales) == null ? void 0 : s[b]) == null ? void 0 : l.name) || i.key || i.id;
909
+ if (i.type === "number")
926
910
  return /* @__PURE__ */ e(
927
- rr,
911
+ dr,
928
912
  {
929
- ...c,
930
- label: u,
913
+ ...u,
914
+ label: h,
931
915
  NumberProps: {
932
- value: ["number", "string"].includes(typeof l) ? l : null,
933
- onChange: (f, x) => i == null ? void 0 : i(x)
916
+ value: ["number", "string"].includes(typeof n) ? n : null,
917
+ onChange: (d, x) => r == null ? void 0 : r(x)
934
918
  }
935
919
  }
936
920
  );
937
- if (r.type === "custom-settings")
921
+ if (i.type === "custom-settings")
938
922
  return null;
939
- if (r.type === "decimal")
923
+ if (i.type === "decimal")
940
924
  return /* @__PURE__ */ e(
941
- V,
925
+ D,
942
926
  {
943
- ...c,
944
- label: u,
927
+ ...u,
928
+ label: h,
945
929
  type: "text",
946
- value: l ?? "",
947
- onChange: (f) => {
948
- const x = f.target.value;
930
+ value: n ?? "",
931
+ onChange: (d) => {
932
+ const x = d.target.value;
949
933
  if (x === "" || x === "-") {
950
- i == null || i(x);
934
+ r == null || r(x);
951
935
  return;
952
936
  }
953
937
  if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(x)) {
954
- let p = x;
955
- /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(p) && (p = Number(p)), i == null || i(p);
938
+ let I = x;
939
+ /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(I) && (I = Number(I)), r == null || r(I);
956
940
  }
957
941
  }
958
942
  }
959
943
  );
960
- if (r.type === "boolean")
944
+ if (i.type === "boolean")
961
945
  return /* @__PURE__ */ e(
962
- Ve,
946
+ ze,
963
947
  {
964
- label: u,
948
+ label: h,
965
949
  labelPlacement: "start",
966
- control: /* @__PURE__ */ e(Pe, { checked: l === !0, onChange: (f, x) => i == null ? void 0 : i(x) })
950
+ control: /* @__PURE__ */ e(je, { checked: n === !0, onChange: (d, x) => r == null ? void 0 : r(x) })
967
951
  }
968
952
  );
969
- if (r.type === "color")
953
+ if (i.type === "color")
970
954
  return /* @__PURE__ */ e(
971
- Yt,
955
+ Lt,
972
956
  {
973
- label: u,
974
- value: l,
975
- onChange: (f) => {
976
- i == null || i(f);
957
+ label: h,
958
+ value: n,
959
+ onChange: (d) => {
960
+ r == null || r(d);
977
961
  }
978
962
  }
979
963
  );
980
- if (r.type === "json" || r.type === "yaml")
981
- return /* @__PURE__ */ I(
982
- R,
964
+ if (i.type === "json" || i.type === "yaml")
965
+ return /* @__PURE__ */ k(
966
+ S,
983
967
  {
984
968
  sx: {
985
969
  width: "100%",
@@ -992,7 +976,7 @@ function q({
992
976
  },
993
977
  children: [
994
978
  /* @__PURE__ */ e(
995
- Le,
979
+ et,
996
980
  {
997
981
  sx: {
998
982
  position: "absolute",
@@ -1000,25 +984,25 @@ function q({
1000
984
  top: 0,
1001
985
  transform: "translate(0px, -7px) scale(0.75)"
1002
986
  },
1003
- children: u
987
+ children: h
1004
988
  }
1005
989
  ),
1006
990
  /* @__PURE__ */ e(
1007
- _e,
991
+ Fe,
1008
992
  {
1009
- keyId: r.id,
1010
- locale: b,
1011
- language: r.type === "yaml" ? "yaml" : "json",
1012
- value: typeof l == "string" ? l : "",
1013
- onChange: (f) => i == null ? void 0 : i(f),
1014
- onUpload: (f) => {
1015
- v.current = f;
993
+ keyId: i.id,
994
+ locale: v,
995
+ language: i.type === "yaml" ? "yaml" : "json",
996
+ value: typeof n == "string" ? n : "",
997
+ onChange: (d) => r == null ? void 0 : r(d),
998
+ onUpload: (d) => {
999
+ c.current = d;
1016
1000
  }
1017
1001
  },
1018
- r.id
1002
+ i.id
1019
1003
  ),
1020
1004
  /* @__PURE__ */ e(
1021
- S,
1005
+ w,
1022
1006
  {
1023
1007
  component: "fieldset",
1024
1008
  sx: {
@@ -1034,104 +1018,104 @@ function q({
1034
1018
  px: 1,
1035
1019
  py: 0
1036
1020
  },
1037
- children: /* @__PURE__ */ e(S, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(S, { component: "span", sx: { opacity: 0 }, children: c.label }) })
1021
+ children: /* @__PURE__ */ e(w, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(w, { component: "span", sx: { opacity: 0 }, children: u.label }) })
1038
1022
  }
1039
1023
  )
1040
1024
  ]
1041
1025
  }
1042
1026
  );
1043
- if (r.type === "custom") {
1044
- const f = (o = d[r.componentId]) == null ? void 0 : o.data;
1045
- return f ? /* @__PURE__ */ e(S, { width: "100%", children: /* @__PURE__ */ e(
1046
- Fe,
1027
+ if (i.type === "custom") {
1028
+ const d = (o = p[i.componentId]) == null ? void 0 : o.data;
1029
+ return d ? /* @__PURE__ */ e(w, { width: "100%", children: /* @__PURE__ */ e(
1030
+ He,
1047
1031
  {
1048
- componentId: f.id,
1049
- props: { label: u, value: l, onChange: i },
1050
- locale: b,
1032
+ componentId: d.id,
1033
+ props: { label: h, value: n, onChange: r },
1034
+ locale: v,
1051
1035
  dev: {
1052
1036
  mode: "draft",
1053
- components: d,
1054
- defaultLocale: a
1037
+ components: p,
1038
+ defaultLocale: b
1055
1039
  }
1056
1040
  }
1057
- ) }) : /* @__PURE__ */ e(V, { ...c, label: u, disabled: !0, placeholder: "Click right button select a component" });
1041
+ ) }) : /* @__PURE__ */ e(D, { ...u, label: h, disabled: !0, placeholder: "Click right button select a component" });
1058
1042
  }
1059
- if (r.type === "component")
1060
- return /* @__PURE__ */ I(R, { width: "100%", direction: "row", gap: 1, children: [
1061
- /* @__PURE__ */ e(S, { flex: 1, children: /* @__PURE__ */ e(
1062
- pe,
1043
+ if (i.type === "component")
1044
+ return /* @__PURE__ */ k(S, { width: "100%", direction: "row", gap: 1, children: [
1045
+ /* @__PURE__ */ e(w, { flex: 1, children: /* @__PURE__ */ e(
1046
+ me,
1063
1047
  {
1064
- allComponents: d,
1065
- label: u,
1066
- value: l == null ? void 0 : l.componentId,
1067
- onChange: (f, x) => {
1068
- s || !l ? i == null || i({ ...l && JSON.parse(JSON.stringify(l)), componentId: x }) : typeof l == "object" && (l.componentId = x);
1048
+ allComponents: p,
1049
+ label: h,
1050
+ value: n == null ? void 0 : n.componentId,
1051
+ onChange: (d, x) => {
1052
+ a || !n ? r == null || r({ ...n && JSON.parse(JSON.stringify(n)), componentId: x }) : typeof n == "object" && (n.componentId = x);
1069
1053
  }
1070
1054
  }
1071
1055
  ) }),
1072
- /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
1073
- tr,
1056
+ /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1057
+ cr,
1074
1058
  {
1075
- value: l,
1076
- valueImmutable: s,
1077
- onChange: i,
1078
- defaultLocale: a,
1079
- allComponents: d
1059
+ value: n,
1060
+ valueImmutable: a,
1061
+ onChange: r,
1062
+ defaultLocale: b,
1063
+ allComponents: p
1080
1064
  }
1081
1065
  ) })
1082
1066
  ] });
1083
- if (!r.type || ["string", "url"].includes(r.type)) {
1084
- const f = r.type === "string" ? r.multiline : void 0, x = r.type === "url" ? l == null ? void 0 : l.url : l;
1067
+ if (!i.type || ["string", "url"].includes(i.type)) {
1068
+ const d = i.type === "string" ? i.multiline : void 0, x = i.type === "url" ? n == null ? void 0 : n.url : n;
1085
1069
  return /* @__PURE__ */ e(
1086
- V,
1070
+ D,
1087
1071
  {
1088
- ...c,
1089
- label: u,
1072
+ ...u,
1073
+ label: h,
1090
1074
  value: typeof x == "string" ? x : "",
1091
- multiline: f,
1092
- minRows: f ? 2 : void 0,
1093
- maxRows: f ? 10 : void 0,
1094
- onChange: (y) => i == null ? void 0 : i(
1095
- r.type === "url" ? { ...l, url: y.target.value, mediaKitUrl: y.target.value } : y.target.value
1075
+ multiline: d,
1076
+ minRows: d ? 2 : void 0,
1077
+ maxRows: d ? 10 : void 0,
1078
+ onChange: (y) => r == null ? void 0 : r(
1079
+ i.type === "url" ? { ...n, url: y.target.value, mediaKitUrl: y.target.value } : y.target.value
1096
1080
  ),
1097
- InputProps: r.type === "url" ? {
1081
+ InputProps: i.type === "url" ? {
1098
1082
  sx: { pr: 0 },
1099
- endAdornment: /* @__PURE__ */ I(de, { position: "end", children: [
1083
+ endAdornment: /* @__PURE__ */ k(de, { position: "end", children: [
1100
1084
  /* @__PURE__ */ e(
1101
- ue,
1085
+ pe,
1102
1086
  {
1103
1087
  onChange: async ({ response: y }) => {
1104
- var O, j, B;
1105
- const p = ((O = y == null ? void 0 : y.data) == null ? void 0 : O.url) || ((j = y == null ? void 0 : y.data) == null ? void 0 : j.fileUrl);
1106
- let w;
1107
- p && (w = await oe(p).catch(() => se(p)).catch(() => {
1088
+ var P, O, A;
1089
+ const I = ((P = y == null ? void 0 : y.data) == null ? void 0 : P.url) || ((O = y == null ? void 0 : y.data) == null ? void 0 : O.fileUrl);
1090
+ let g;
1091
+ I && (g = await oe(I).catch(() => se(I)).catch(() => {
1108
1092
  }));
1109
- let D = ((B = y == null ? void 0 : y.data) == null ? void 0 : B.filename) || "";
1110
- D && (D = `mediakit://${D}`), i == null || i({
1111
- url: p,
1112
- mediaKitUrl: D,
1113
- width: w == null ? void 0 : w.naturalWidth,
1114
- height: w == null ? void 0 : w.naturalHeight
1093
+ let C = ((A = y == null ? void 0 : y.data) == null ? void 0 : A.filename) || "";
1094
+ C && (C = `mediakit://${C}`), r == null || r({
1095
+ url: I,
1096
+ mediaKitUrl: C,
1097
+ width: g == null ? void 0 : g.naturalWidth,
1098
+ height: g == null ? void 0 : g.naturalHeight
1115
1099
  });
1116
1100
  }
1117
1101
  }
1118
1102
  ),
1119
- /* @__PURE__ */ e(ne, { 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(Bt, { sx: { cursor: "default" }, fontSize: "small" }) })
1103
+ /* @__PURE__ */ e(ne, { 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(Ft, { sx: { cursor: "default" }, fontSize: "small" }) })
1120
1104
  ] })
1121
1105
  } : void 0
1122
1106
  }
1123
1107
  );
1124
1108
  }
1125
- return console.error("Unsupported property type", r.type), null;
1109
+ return console.error("Unsupported property type", i.type), null;
1126
1110
  }
1127
- function rr({
1111
+ function dr({
1128
1112
  NumberProps: t,
1129
- ...r
1113
+ ...i
1130
1114
  }) {
1131
- const { getInputProps: l } = jt(t), i = l();
1132
- return /* @__PURE__ */ e(V, { ...r, inputProps: i });
1115
+ const { getInputProps: n } = Et(t), r = n();
1116
+ return /* @__PURE__ */ e(D, { ...i, inputProps: r });
1133
1117
  }
1134
- const ir = `import React from '@blocklet/pages-kit/builtin/react'
1118
+ const ar = `import React from '@blocklet/pages-kit/builtin/react'
1135
1119
  import { Box } from '@blocklet/pages-kit/builtin/mui/material'
1136
1120
 
1137
1121
  export default function () {
@@ -1140,122 +1124,212 @@ export default function () {
1140
1124
  Hello World
1141
1125
  </Box>
1142
1126
  )
1143
- }`, lr = `console.log('hello')
1127
+ }`, ur = `console.log('hello')
1144
1128
  `;
1145
- function nr({
1129
+ function pr({
1146
1130
  value: t
1147
1131
  }) {
1148
- const { locale: r } = W(), l = Ot(), i = J(t).doc;
1149
- return L(() => {
1150
- var s;
1151
- (s = t.renderer) != null && s.script || (i.transact(() => {
1152
- t.renderer.script = t.renderer.type === "react-component" ? ir : lr;
1153
- }), l());
1154
- }, [t]), /* @__PURE__ */ e(S, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
1155
- _e,
1132
+ const { locale: i } = z(), n = jt(), r = _(t).doc;
1133
+ return Q(() => {
1134
+ var a;
1135
+ (a = t.renderer) != null && a.script || (r.transact(() => {
1136
+ t.renderer.script = t.renderer.type === "react-component" ? ar : ur;
1137
+ }), n());
1138
+ }, [t]), /* @__PURE__ */ e(w, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
1139
+ Fe,
1156
1140
  {
1157
1141
  keyId: t.id,
1158
- locale: r,
1142
+ locale: i,
1159
1143
  language: "typescript",
1160
1144
  value: t.renderer.script || "",
1161
- onChange: (s) => t.renderer.script = s,
1145
+ onChange: (a) => t.renderer.script = a,
1162
1146
  typeScriptNoValidation: !1
1163
1147
  },
1164
1148
  t.id
1165
1149
  ) });
1166
1150
  }
1167
- function or({ value: t }) {
1168
- var u, g, h;
1169
- const { t: r } = W(), l = J(t).doc, {
1151
+ function mr({ value: t }) {
1152
+ var h, m, f;
1153
+ const { t: i } = z(), n = _(t).doc, {
1170
1154
  state: {
1171
- components: i,
1172
- config: { defaultLocale: s },
1173
- resources: a
1155
+ components: r,
1156
+ config: { defaultLocale: a },
1157
+ resources: b
1174
1158
  },
1175
- localState: { currentLocale: d }
1176
- } = re(), c = ce(), b = ((u = i[t.renderer.componentId]) == null ? void 0 : u.data) ?? ((h = (g = a.components) == null ? void 0 : g[t.renderer.componentId]) == null ? void 0 : h.component), v = ie({ variant: "dialog" });
1177
- return /* @__PURE__ */ I(R, { gap: 1, children: [
1159
+ localState: { currentLocale: p }
1160
+ } = re(), u = ce(), v = ((h = r[t.renderer.componentId]) == null ? void 0 : h.data) ?? ((f = (m = b.components) == null ? void 0 : m[t.renderer.componentId]) == null ? void 0 : f.component), c = ie({ variant: "dialog" });
1161
+ return /* @__PURE__ */ k(S, { gap: 1, children: [
1178
1162
  /* @__PURE__ */ e(
1179
- pe,
1163
+ me,
1180
1164
  {
1181
- allComponents: c,
1165
+ allComponents: u,
1182
1166
  excludes: [t.id],
1183
1167
  value: t.renderer.componentId,
1184
- onChange: (m, n) => t.renderer.componentId = n
1168
+ onChange: (s, l) => t.renderer.componentId = l
1185
1169
  }
1186
1170
  ),
1187
- b && /* @__PURE__ */ I($, { children: [
1188
- /* @__PURE__ */ I(R, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1189
- /* @__PURE__ */ e(Q, { variant: "subtitle2", children: r("parameters") }),
1190
- /* @__PURE__ */ e(N, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(v), children: /* @__PURE__ */ e(Ke, { fontSize: "small" }) })
1171
+ v && /* @__PURE__ */ k(N, { children: [
1172
+ /* @__PURE__ */ k(S, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1173
+ /* @__PURE__ */ e(E, { variant: "subtitle2", children: i("parameters") }),
1174
+ /* @__PURE__ */ e(j, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(c), children: /* @__PURE__ */ e(Je, { fontSize: "small" }) })
1191
1175
  ] }),
1192
- b.properties && X(Object.values(b.properties), "index").map(({ data: m }) => {
1193
- var n, o, f, x, y, p, w, D, O, j, B, H, _, F, z, C;
1194
- return /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(
1195
- q,
1176
+ v.properties && V(Object.values(v.properties), "index").map(({ data: s }) => {
1177
+ var l, o, d, x, y, I, g, C, P, O, A, K, F, H, U, J;
1178
+ return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1179
+ W,
1196
1180
  {
1197
- allComponents: c,
1198
- defaultLocale: s,
1199
- component: b,
1200
- property: m,
1181
+ allComponents: u,
1182
+ defaultLocale: a,
1183
+ component: v,
1184
+ property: s,
1201
1185
  fullWidth: !0,
1202
1186
  size: "small",
1203
- valueImmutable: te((x = (f = (o = (n = t.renderer.properties) == null ? void 0 : n[m.id]) == null ? void 0 : o.locales) == null ? void 0 : f[d]) == null ? void 0 : x.value),
1204
- value: ((D = (w = (p = (y = t.renderer.properties) == null ? void 0 : y[m.id]) == null ? void 0 : p.locales) == null ? void 0 : w[d]) == null ? void 0 : D.value) ?? ((H = (B = (j = (O = t.renderer.properties) == null ? void 0 : O[m.id]) == null ? void 0 : j.locales) == null ? void 0 : B[s]) == null ? void 0 : H.value) ?? ((F = (_ = m.locales) == null ? void 0 : _[d]) == null ? void 0 : F.defaultValue) ?? ((C = (z = m.locales) == null ? void 0 : z[s]) == null ? void 0 : C.defaultValue),
1205
- onChange: (k) => {
1206
- l.transact(() => {
1207
- var P, A, E, Y, G;
1208
- (P = t.renderer).properties ?? (P.properties = {}), (A = t.renderer.properties)[E = m.id] ?? (A[E] = {}), (Y = t.renderer.properties[m.id]).locales ?? (Y.locales = {}), (G = t.renderer.properties[m.id].locales)[d] ?? (G[d] = {}), t.renderer.properties[m.id].locales[d].value = k;
1187
+ valueImmutable: Z((x = (d = (o = (l = t.renderer.properties) == null ? void 0 : l[s.id]) == null ? void 0 : o.locales) == null ? void 0 : d[p]) == null ? void 0 : x.value),
1188
+ value: ((C = (g = (I = (y = t.renderer.properties) == null ? void 0 : y[s.id]) == null ? void 0 : I.locales) == null ? void 0 : g[p]) == null ? void 0 : C.value) ?? ((K = (A = (O = (P = t.renderer.properties) == null ? void 0 : P[s.id]) == null ? void 0 : O.locales) == null ? void 0 : A[a]) == null ? void 0 : K.value) ?? ((H = (F = s.locales) == null ? void 0 : F[p]) == null ? void 0 : H.defaultValue) ?? ((J = (U = s.locales) == null ? void 0 : U[a]) == null ? void 0 : J.defaultValue),
1189
+ onChange: (L) => {
1190
+ n.transact(() => {
1191
+ var Y, $, G, q, M;
1192
+ (Y = t.renderer).properties ?? (Y.properties = {}), ($ = t.renderer.properties)[G = s.id] ?? ($[G] = {}), (q = t.renderer.properties[s.id]).locales ?? (q.locales = {}), (M = t.renderer.properties[s.id].locales)[p] ?? (M[p] = {}), t.renderer.properties[s.id].locales[p].value = L;
1209
1193
  });
1210
1194
  }
1211
1195
  }
1212
- ) }, m.id);
1196
+ ) }, s.id);
1213
1197
  }),
1214
- /* @__PURE__ */ e(Me, { ...Je(v), component: t, type: "parameters" })
1198
+ /* @__PURE__ */ e(Me, { ...$e(c), component: t, type: "parameters" })
1215
1199
  ] })
1216
1200
  ] });
1217
1201
  }
1218
- function pe({
1202
+ function me({
1219
1203
  label: t,
1220
- options: r,
1221
- excludes: l,
1222
- value: i,
1223
- onChange: s,
1224
- allComponents: a,
1225
- ...d
1204
+ options: i,
1205
+ excludes: n,
1206
+ value: r,
1207
+ onChange: a,
1208
+ allComponents: b,
1209
+ ...p
1226
1210
  }) {
1227
- var u;
1228
- const { t: c } = W(), b = r ?? X(Object.values(Nt(a, ...l ?? [])), "index").map((g) => g.data), v = (typeof i == "string" ? (u = a[i]) == null ? void 0 : u.data : void 0) ?? null;
1211
+ var h;
1212
+ const { t: u } = z(), v = i ?? V(Object.values(At(b, ...n ?? [])), "index").map((m) => m.data), c = (typeof r == "string" ? (h = b[r]) == null ? void 0 : h.data : void 0) ?? null;
1229
1213
  return /* @__PURE__ */ e(
1230
- Ae,
1214
+ Ne,
1231
1215
  {
1232
- ...d,
1216
+ ...p,
1233
1217
  size: "small",
1234
- options: b,
1218
+ options: v,
1235
1219
  autoHighlight: !0,
1236
- isOptionEqualToValue: (g, h) => g.id === h.id,
1237
- getOptionKey: (g) => g.id,
1238
- getOptionLabel: (g) => g.name || g.id,
1239
- renderInput: (g) => /* @__PURE__ */ e(V, { label: t || c("component"), ...g }),
1240
- value: v,
1241
- onChange: (g, h) => {
1242
- var n, o, f, x, y, p;
1243
- let m = {};
1244
- h && (m = {
1245
- blockletId: (n = a[h == null ? void 0 : h.id]) == null ? void 0 : n.blockletId,
1246
- blockletTitle: (o = a[h == null ? void 0 : h.id]) == null ? void 0 : o.blockletTitle,
1247
- componentName: ((x = (f = a[h == null ? void 0 : h.id]) == null ? void 0 : f.data) == null ? void 0 : x.name) || ((p = (y = a[h == null ? void 0 : h.id]) == null ? void 0 : y.data) == null ? void 0 : p.id)
1248
- }), s == null || s(g, h == null ? void 0 : h.id, m);
1220
+ isOptionEqualToValue: (m, f) => m.id === f.id,
1221
+ getOptionKey: (m) => m.id,
1222
+ getOptionLabel: (m) => m.name || m.id,
1223
+ renderInput: (m) => /* @__PURE__ */ e(D, { label: t || u("component"), ...m }),
1224
+ value: c,
1225
+ onChange: (m, f) => {
1226
+ var l, o, d, x, y, I;
1227
+ let s = {};
1228
+ f && (s = {
1229
+ blockletId: (l = b[f == null ? void 0 : f.id]) == null ? void 0 : l.blockletId,
1230
+ blockletTitle: (o = b[f == null ? void 0 : f.id]) == null ? void 0 : o.blockletTitle,
1231
+ componentName: ((x = (d = b[f == null ? void 0 : f.id]) == null ? void 0 : d.data) == null ? void 0 : x.name) || ((I = (y = b[f == null ? void 0 : f.id]) == null ? void 0 : y.data) == null ? void 0 : I.id)
1232
+ }), a == null || a(m, f == null ? void 0 : f.id, s);
1249
1233
  }
1250
1234
  }
1251
1235
  );
1252
1236
  }
1237
+ function hr({
1238
+ config: t,
1239
+ allComponents: i,
1240
+ defaultLocale: n,
1241
+ propertiesValue: r,
1242
+ currentLocale: a,
1243
+ onChange: b,
1244
+ props: p
1245
+ }) {
1246
+ const { t: u } = z(), [v, c] = ue(t == null ? void 0 : t.properties);
1247
+ Q(() => {
1248
+ (() => {
1249
+ var l, o;
1250
+ ((l = t == null ? void 0 : t.renderer) == null ? void 0 : l.type) === "react-component" && Tt(t == null ? void 0 : t.properties) ? Nt((o = t == null ? void 0 : t.renderer) == null ? void 0 : o.script).then((d) => {
1251
+ const x = Wt(d);
1252
+ c(x);
1253
+ }) : c(t == null ? void 0 : t.properties);
1254
+ })();
1255
+ }, [t]);
1256
+ const m = te(() => !t || !v ? {} : Object.values(v).reduce(
1257
+ (s, { data: l }) => {
1258
+ var d, x, y, I, g;
1259
+ const o = l.key || l.id;
1260
+ return s[l.id] = {
1261
+ value: (p == null ? void 0 : p[o]) ?? ((d = r == null ? void 0 : r[l.id]) == null ? void 0 : d.value) ?? ((y = (x = l.locales) == null ? void 0 : x[a]) == null ? void 0 : y.defaultValue) ?? ((g = (I = l.locales) == null ? void 0 : I[n]) == null ? void 0 : g.defaultValue),
1262
+ key: o,
1263
+ id: l.id,
1264
+ type: l.type
1265
+ }, s;
1266
+ },
1267
+ {}
1268
+ ), [v, t, r, a, n])(), f = Jt(m, "key");
1269
+ return /* @__PURE__ */ k(N, { children: [
1270
+ /* @__PURE__ */ e(E, { variant: "subtitle1", children: u("maker.properties.parameters") }),
1271
+ /* @__PURE__ */ e(S, { gap: 1, children: t && v && V(Object.values(v), "index").map(({ data: s }) => {
1272
+ var l, o;
1273
+ return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1274
+ W,
1275
+ {
1276
+ allComponents: i,
1277
+ defaultLocale: n,
1278
+ size: "small",
1279
+ fullWidth: !0,
1280
+ component: t,
1281
+ property: s,
1282
+ valueImmutable: Z((l = r == null ? void 0 : r[s.id]) == null ? void 0 : l.value),
1283
+ value: (o = m[s.id]) == null ? void 0 : o.value,
1284
+ onChange: (d) => {
1285
+ b({
1286
+ path: ["properties", s.id],
1287
+ value: { value: d },
1288
+ shouldSync: !(!s.type || De.includes(s.type)),
1289
+ excludeKeys: [],
1290
+ key: s.key || s.id
1291
+ });
1292
+ }
1293
+ }
1294
+ ) }, s.id);
1295
+ }) }),
1296
+ /* @__PURE__ */ e(w, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1297
+ He,
1298
+ {
1299
+ componentId: (t == null ? void 0 : t.id) || "",
1300
+ renderType: "setting",
1301
+ locale: a,
1302
+ properties: m,
1303
+ dev: { mode: "draft", components: i, defaultLocale: n },
1304
+ props: {
1305
+ ...p,
1306
+ onChange: (s) => {
1307
+ Object.keys(s).filter((o) => {
1308
+ var d;
1309
+ return s[o] !== ((d = f == null ? void 0 : f[o]) == null ? void 0 : d.value);
1310
+ }).filter((o) => !(o === "locale" && !Ut(f[o], "locale"))).forEach((o) => {
1311
+ const d = f[o];
1312
+ d != null && d.id ? b({
1313
+ path: ["properties", d.id],
1314
+ value: { value: s[o] },
1315
+ shouldSync: !(!d.type || De.includes(d.type)),
1316
+ excludeKeys: [],
1317
+ key: d.key || d.id
1318
+ }) : (console.warn("property not found: ", o), Bt.warning(u("maker.properties.propertyNotFound", { key: o })));
1319
+ });
1320
+ }
1321
+ }
1322
+ }
1323
+ ) })
1324
+ ] });
1325
+ }
1253
1326
  export {
1254
- Zt as BasicInfo,
1255
- pe as CustomComponentAutocomplete,
1256
- Ar as CustomComponentSettings,
1257
- ir as DefaultReactComponentScriptTemplate,
1258
- lr as DefaultWebComponentScriptTemplate,
1259
- Lt as PropertiesConfig,
1260
- q as PropertyValueField
1327
+ nr as BasicInfo,
1328
+ me as CustomComponentAutocomplete,
1329
+ Jr as CustomComponentSettings,
1330
+ ar as DefaultReactComponentScriptTemplate,
1331
+ ur as DefaultWebComponentScriptTemplate,
1332
+ hr as ParametersConfig,
1333
+ or as PropertiesConfig,
1334
+ W as PropertyValueField
1261
1335
  };