@reformer/renderer-json 8.0.0 → 9.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,160 +1,228 @@
1
- import { jsx as u, jsxs as M } from "react/jsx-runtime";
2
- import { useContext as N, createContext as O, useMemo as g, useState as C, useEffect as F } from "react";
3
- import { createRenderSchema as j, FormRenderer as k } from "@reformer/renderer-react";
4
- import { i as f, a as R, p as m, b as A } from "./index-BZLcW0SX.js";
5
- import { c as rr, f as er, g as tr, d as nr } from "./index-BZLcW0SX.js";
6
- class h {
1
+ import { jsx as v, jsxs as M } from "react/jsx-runtime";
2
+ import { useContext as N, createContext as V, useMemo as x, useState as Y, useEffect as tt, useRef as et, useCallback as A, useSyncExternalStore as nt } from "react";
3
+ import { createRenderSchema as rt, FormRenderer as ot } from "@reformer/renderer-react";
4
+ import { i as h, a as C, p as u, b as it, c as st, d as ft } from "./index-DrpWfdbU.js";
5
+ import { e as Zt, f as Kt, g as Tt, h as zt, j as Bt, k as Gt } from "./index-DrpWfdbU.js";
6
+ const ct = "$fieldWrapper", D = "$localeService";
7
+ class p {
7
8
  own = /* @__PURE__ */ new Map();
8
9
  parent = null;
9
10
  get(e) {
10
11
  return this.own.get(e) ?? this.parent?.get(e);
11
12
  }
12
13
  getDataSource(e) {
13
- const t = this.get(e);
14
- if (!(!t || t.type !== "dataSource"))
15
- return t.component;
14
+ const n = this.get(e);
15
+ if (!(!n || n.type !== "dataSource"))
16
+ return n.component;
17
+ }
18
+ getLocale() {
19
+ const e = this.get(D);
20
+ if (!(!e || e.type !== "locale"))
21
+ return e.component;
16
22
  }
17
23
  has(e) {
18
24
  return this.own.has(e) || (this.parent?.has(e) ?? !1);
19
25
  }
20
26
  names() {
21
- const e = this.parent?.names() ?? [], t = Array.from(this.own.keys());
22
- return [.../* @__PURE__ */ new Set([...e, ...t])];
27
+ const e = this.parent?.names() ?? [], n = Array.from(this.own.keys());
28
+ return [.../* @__PURE__ */ new Set([...e, ...n])];
23
29
  }
24
- _set(e, t) {
25
- this.own.has(e) && console.warn(`[ComponentRegistry] Overwriting entry: ${e}`), this.own.set(e, t);
30
+ _set(e, n) {
31
+ this.own.has(e) && console.warn(`[ComponentRegistry] Overwriting entry: ${e}`), this.own.set(e, n);
26
32
  }
27
- static withParent(e, t) {
28
- const n = new h();
29
- return n.parent = e, t.own.forEach((o, i) => {
30
- n.own.set(i, o);
31
- }), n;
33
+ static withParent(e, n) {
34
+ const r = new p(), o = (i) => {
35
+ if (i instanceof p)
36
+ i.own.forEach((f, a) => r.own.set(a, f));
37
+ else
38
+ for (const f of i.names()) {
39
+ const a = i.get(f);
40
+ a && r.own.set(f, a);
41
+ }
42
+ };
43
+ return e instanceof p ? r.parent = e : o(e), o(n), r;
32
44
  }
33
45
  }
34
- function K(r) {
35
- const e = new h();
36
- return r({
37
- component(n, o, i) {
38
- e._set(n, { component: o, type: "component", description: i });
46
+ function Jt(t) {
47
+ const e = new p();
48
+ return t({
49
+ component(r, o, i) {
50
+ e._set(r, { component: o, type: "component", description: i });
51
+ },
52
+ dataSource(r, o, i) {
53
+ e._set(r, { component: o, type: "dataSource", description: i });
39
54
  },
40
- dataSource(n, o, i) {
41
- e._set(n, { component: o, type: "dataSource", description: i });
55
+ fn(r, o, i) {
56
+ if (typeof o != "function")
57
+ throw new Error(
58
+ `reg.fn("${r}") expects a function, got ${typeof o}. Use reg.dataSource(...) for non-function values.`
59
+ );
60
+ e._set(r, { component: o, type: "fn", description: i });
61
+ },
62
+ locale(r, o) {
63
+ const i = typeof r == "function" ? { resolve: r } : r;
64
+ e._set(D, { component: i, type: "locale", description: o });
42
65
  }
43
66
  }), e;
44
67
  }
45
- const v = "$fieldWrapper", w = O({});
46
- function Q({ settings: r, children: e }) {
47
- const t = N(w), n = g(() => t.registry && r.registry ? h.withParent(t.registry, r.registry) : r.registry ?? t.registry, [t.registry, r.registry]), o = g(() => {
48
- const i = n?.get(v)?.component;
68
+ const j = V({});
69
+ function Ft({ settings: t, children: e }) {
70
+ const n = N(j), r = x(() => n.registry && t.registry ? p.withParent(n.registry, t.registry) : t.registry ?? n.registry, [n.registry, t.registry]), o = x(() => {
71
+ const i = r?.get(ct)?.component;
49
72
  return {
73
+ ...n,
50
74
  ...t,
51
- ...r,
52
- registry: n,
53
- fieldWrapper: r.fieldWrapper ?? i ?? t.fieldWrapper
75
+ registry: r,
76
+ fieldWrapper: t.fieldWrapper ?? i ?? n.fieldWrapper
54
77
  };
55
- }, [t, r, n]);
56
- return /* @__PURE__ */ u(w.Provider, { value: o, children: e });
78
+ }, [n, t, r]);
79
+ return /* @__PURE__ */ v(j.Provider, { value: o, children: e });
80
+ }
81
+ function at() {
82
+ return N(j);
57
83
  }
58
- function D() {
59
- return N(w);
84
+ function I(t) {
85
+ const e = t;
86
+ return h(e.array) && typeof e.item == "object" && e.item !== null && "$template" in e.item;
60
87
  }
61
- function $(r) {
62
- const e = r;
63
- return f(e.array) && typeof e.item == "object" && e.item !== null && "$template" in e.item;
88
+ function _(t) {
89
+ return h(t.value);
64
90
  }
65
- function E(r) {
66
- return f(r.value);
91
+ function ut(t) {
92
+ return C(t.component) && !_(t) && !I(t);
67
93
  }
68
- function W(r) {
69
- return R(r.component) && !E(r) && !$(r);
94
+ function E(t, e) {
95
+ if (!t) return;
96
+ const n = u(t)?.arg;
97
+ if (!n) throw new Error(`Invalid $component operator: "${t}"`);
98
+ const r = e.get(n);
99
+ if (!r)
100
+ throw new Error(
101
+ `Component "${n}" not found in registry. Available: ${e.names().join(", ")}`
102
+ );
103
+ if (r.type !== "component")
104
+ throw new Error(`Entry "${n}" is a '${r.type}' and cannot be used as $component(...)`);
105
+ return r.component;
70
106
  }
71
- function P(r, e) {
72
- if (!r) return;
73
- const t = m(r)?.arg;
74
- if (!t) throw new Error(`Invalid $component operator: "${r}"`);
107
+ function lt(t, e) {
75
108
  const n = e.get(t);
76
109
  if (!n)
77
110
  throw new Error(
78
- `Component "${t}" not found in registry. Available: ${e.names().join(", ")}`
111
+ `Data source "${t}" not found in registry. Available: ${e.names().join(", ")}`
79
112
  );
80
- if (n.type === "dataSource")
81
- throw new Error(`Entry "${t}" is a 'dataSource' and cannot be used as $component(...)`);
113
+ if (n.type !== "dataSource")
114
+ throw new Error(`Entry "${t}" is a '${n.type}' and cannot be used as $dataSource(...)`);
82
115
  return n.component;
83
116
  }
84
- function L(r, e) {
85
- const t = e.get(r);
86
- if (!t)
117
+ function ht(t, e) {
118
+ const n = e.get(t);
119
+ if (!n)
87
120
  throw new Error(
88
- `Data source "${r}" not found in registry. Available: ${e.names().join(", ")}`
121
+ `Function "${t}" not found in registry. Available: ${e.names().join(", ")}`
89
122
  );
90
- return t.component;
91
- }
92
- function I(r, e) {
93
- return e.split(".").reduce((t, n) => t == null ? t : t[n], r);
94
- }
95
- function V(r) {
96
- if (r === null || typeof r != "object") return !1;
97
- const e = r;
98
- return f(e.value) || f(e.array) || R(e.component);
99
- }
100
- function _(r) {
101
- return r == null ? r : JSON.parse(JSON.stringify(r));
102
- }
103
- function b(r, e, t) {
104
- if (A(r)) return L(m(r).arg, t);
105
- if (R(r)) return P(r, t);
106
- if (f(r)) return e.signalAt(m(r).arg);
107
- if (V(r)) return p(r, e, t);
108
- if (Array.isArray(r)) return r.map((n) => b(n, e, t));
109
- if (r !== null && typeof r == "object") {
110
- const n = r, o = {};
111
- for (const i of Object.keys(n)) o[i] = b(n[i], e, t);
123
+ if (n.type !== "fn")
124
+ throw new Error(`Entry "${t}" is a '${n.type}' and cannot be used as $fn(...)`);
125
+ return n.component;
126
+ }
127
+ function W(t, e, n) {
128
+ return e.getLocale?.()?.resolve(t, n) ?? t;
129
+ }
130
+ function dt(t) {
131
+ return t !== null && typeof t == "object" && typeof t.$locale == "string";
132
+ }
133
+ function pt(t, e) {
134
+ if (!t) return t;
135
+ let n = !1;
136
+ const r = {};
137
+ for (const o of Object.keys(t)) {
138
+ const i = t[o];
139
+ if (h(i)) {
140
+ const f = e.signalAt(u(i).arg);
141
+ r[o] = f?.peek?.(), n = !0;
142
+ } else
143
+ r[o] = i;
144
+ }
145
+ return n ? r : t;
146
+ }
147
+ function vt(t, e) {
148
+ if (!(!e || typeof console > "u"))
149
+ for (const n of Object.keys(e))
150
+ h(e[n]) && console.warn(
151
+ `[JsonRenderer] $locale("${t}"): параметр "${n}" (=${String(e[n])}) взят снимком значения на момент рендера и не обновляется при изменении модели. Для реактивного значения используй I18n: { component: "$component(I18n)", componentProps: { id: "${t}", values: { ${n}: "${String(e[n])}" } } }.`
152
+ );
153
+ }
154
+ function mt(t, e) {
155
+ return e.split(".").reduce((n, r) => n == null ? n : n[r], t);
156
+ }
157
+ function yt(t) {
158
+ if (t === null || typeof t != "object") return !1;
159
+ const e = t;
160
+ return h(e.value) || h(e.array) || C(e.component);
161
+ }
162
+ function gt(t) {
163
+ return t == null ? t : JSON.parse(JSON.stringify(t));
164
+ }
165
+ function L(t, e, n) {
166
+ if (it(t)) return lt(u(t).arg, n);
167
+ if (C(t)) return E(t, n);
168
+ if (st(t)) return ht(u(t).arg, n);
169
+ if (ft(t)) return W(u(t).arg, n);
170
+ if (h(t)) return e.signalAt(u(t).arg);
171
+ if (dt(t))
172
+ return vt(t.$locale, t.params), W(t.$locale, n, pt(t.params, e));
173
+ if (yt(t)) return b(t, e, n);
174
+ if (Array.isArray(t)) return t.map((r) => L(r, e, n));
175
+ if (t !== null && typeof t == "object") {
176
+ const r = t, o = {};
177
+ for (const i of Object.keys(r)) o[i] = L(r[i], e, n);
112
178
  return o;
113
179
  }
114
- return r;
180
+ return t;
115
181
  }
116
- function S(r, e, t) {
117
- if (!r) return;
118
- const n = {};
119
- for (const o of Object.keys(r)) n[o] = b(r[o], e, t);
120
- return n;
182
+ function R(t, e, n) {
183
+ if (!t) return;
184
+ const r = {};
185
+ for (const o of Object.keys(t)) r[o] = L(t[o], e, n);
186
+ return r;
121
187
  }
122
- function p(r, e, t) {
123
- if ($(r)) {
124
- const n = I(e, m(r.array).arg), o = r.item.$template, i = r.initialValue;
188
+ function b(t, e, n) {
189
+ if (I(t)) {
190
+ const r = mt(e, u(t.array).arg), o = t.item.$template, i = t.initialValue;
125
191
  return {
126
- ...r.selector ? { selector: r.selector } : {},
127
- array: n,
128
- initialValue: () => i ? _(i) : {},
129
- item: (y) => p(o, y, t),
130
- componentProps: S(r.componentProps, e, t)
192
+ ...t.selector ? { selector: t.selector } : {},
193
+ array: r,
194
+ initialValue: () => i ? gt(i) : {},
195
+ item: (f) => b(o, f, n),
196
+ componentProps: R(t.componentProps, e, n)
131
197
  };
132
198
  }
133
- if (E(r)) {
134
- const n = m(r.value).arg, o = e.signalAt(n);
135
- return !o && typeof console < "u" && console.warn(`[JsonRenderer/M1] No model signal for "${n}".`), {
136
- ...r.selector ? { selector: r.selector } : {},
199
+ if (_(t)) {
200
+ const r = u(t.value).arg, o = e.signalAt(r);
201
+ !o && typeof console < "u" && console.warn(`[JsonRenderer/M1] No model signal for "${r}".`);
202
+ const i = R(t.componentProps, e, n), f = t.wrapper ? E(t.wrapper.component, n) : void 0;
203
+ return {
204
+ ...t.selector ? { selector: t.selector } : {},
137
205
  value: o,
138
- component: P(r.component, t),
139
- componentProps: S(r.componentProps, e, t)
206
+ component: E(t.component, n),
207
+ componentProps: f ? { ...i ?? {}, fieldWrapper: f } : i
140
208
  };
141
209
  }
142
- if (W(r))
210
+ if (ut(t))
143
211
  return {
144
- ...r.selector ? { selector: r.selector } : {},
145
- component: P(r.component, t),
146
- componentProps: S(r.componentProps, e, t),
147
- children: r.children?.map((n) => p(n, e, t))
212
+ ...t.selector ? { selector: t.selector } : {},
213
+ component: E(t.component, n),
214
+ componentProps: R(t.componentProps, e, n),
215
+ children: t.children?.map((r) => b(r, e, n))
148
216
  };
149
- throw new Error(`Invalid JSON node (M1): ${JSON.stringify(r)}`);
217
+ throw new Error(`Invalid JSON node (M1): ${JSON.stringify(t)}`);
150
218
  }
151
- function U(r, e, t) {
152
- return p(r.root, t, e);
219
+ function Mt(t, e, n) {
220
+ return b(t.root, n, e);
153
221
  }
154
- function T(r, e, t) {
155
- return () => p(r.root, t, e);
222
+ function St(t, e, n) {
223
+ return () => b(t.root, n, e);
156
224
  }
157
- function q({ errors: r }) {
225
+ function wt({ errors: t }) {
158
226
  return /* @__PURE__ */ M(
159
227
  "div",
160
228
  {
@@ -171,70 +239,395 @@ function q({ errors: r }) {
171
239
  children: [
172
240
  /* @__PURE__ */ M("strong", { style: { display: "block", marginBottom: 8, fontSize: 15 }, children: [
173
241
  "Невалидная JSON-схема формы (",
174
- r.length,
242
+ t.length,
175
243
  ")"
176
244
  ] }),
177
- /* @__PURE__ */ u("ul", { style: { margin: 0, paddingLeft: 20 }, children: r.map((e, t) => /* @__PURE__ */ u("li", { style: { marginBottom: 4 }, children: e }, t)) })
245
+ /* @__PURE__ */ v("ul", { style: { margin: 0, paddingLeft: 20 }, children: t.map((e, n) => /* @__PURE__ */ v("li", { style: { marginBottom: 4 }, children: e }, n)) })
178
246
  ]
179
247
  }
180
248
  );
181
249
  }
182
- function X({
183
- schema: r,
250
+ function At({
251
+ schema: t,
184
252
  renderBehavior: e,
185
- onSchemaReady: t,
186
- validate: n = !1
253
+ onSchemaReady: n,
254
+ validate: r = !1
187
255
  }) {
188
- const { registry: o, model: i, ...y } = D(), [a, d] = C(
189
- n ? void 0 : null
256
+ const { registry: o, model: i, ...f } = at(), [a, $] = Y(
257
+ r ? void 0 : null
190
258
  );
191
- F(() => {
192
- if (!n) {
193
- d(null);
259
+ tt(() => {
260
+ if (!r) {
261
+ $(null);
194
262
  return;
195
263
  }
196
- let l = !1;
197
- return d(void 0), import("./validate.js").then(({ validateFormSchema: s }) => {
198
- if (l) return;
199
- const { valid: J, errors: x } = s(r, { registry: o });
200
- d(J ? null : x);
201
- }).catch((s) => {
202
- l || d([`Schema validator failed to load: ${String(s)}`]);
264
+ let S = !1;
265
+ return $(void 0), import("./validate.js").then(({ validateFormSchema: d }) => {
266
+ if (S) return;
267
+ const { valid: Q, errors: X } = d(t, { registry: o });
268
+ $(Q ? null : X);
269
+ }).catch((d) => {
270
+ S || $([`Schema validator failed to load: ${String(d)}`]);
203
271
  }), () => {
204
- l = !0;
272
+ S = !0;
205
273
  };
206
- }, [n, r, o]);
207
- const c = g(() => {
274
+ }, [r, t, o]);
275
+ const g = x(() => {
208
276
  if (!i)
209
277
  throw new Error(
210
278
  "JsonFormRenderer: settings.model is required (M1). Pass the FormModel via JsonRendererProvider."
211
279
  );
212
280
  if (a !== null) return null;
213
- const l = T(r, o, i), s = j(l);
214
- return e && e(s), s;
215
- }, [r, o, e, i, a]);
216
- return g(() => {
217
- c && t && t(c);
218
- }, [c]), a && a.length > 0 ? /* @__PURE__ */ u(q, { errors: a }) : c ? /* @__PURE__ */ u(k, { render: c, settings: y }) : null;
281
+ if (!o)
282
+ throw new Error(
283
+ "JsonFormRenderer: settings.registry is required. Pass a ComponentRegistry via JsonRendererProvider."
284
+ );
285
+ const S = St(t, o, i), d = rt(S);
286
+ return e && e(d), d;
287
+ }, [t, o, e, i, a]);
288
+ return x(() => {
289
+ g && n && n(g);
290
+ }, [g]), a && a.length > 0 ? /* @__PURE__ */ v(wt, { errors: a }) : g ? /* @__PURE__ */ v(ot, { render: g, settings: f }) : null;
291
+ }
292
+ const Wt = (t) => t;
293
+ function Ut(t) {
294
+ return { resolve: (e) => t[e] ?? e, keys: Object.keys(t) };
295
+ }
296
+ function Vt(t) {
297
+ return { resolve: (e, n) => t[e]?.(n) ?? e, keys: Object.keys(t) };
298
+ }
299
+ const bt = { resolve: (t) => t }, q = V(bt);
300
+ function Dt({ service: t, children: e }) {
301
+ return /* @__PURE__ */ v(q.Provider, { value: t, children: e });
302
+ }
303
+ function $t() {
304
+ return N(q);
305
+ }
306
+ var Et = Symbol.for("preact-signals");
307
+ function J() {
308
+ if (l > 1)
309
+ l--;
310
+ else {
311
+ var t, e = !1;
312
+ for ((function() {
313
+ var o = P;
314
+ for (P = void 0; o !== void 0; )
315
+ o.S.v === o.v && (o.S.i = o.i), o = o.o;
316
+ })(); w !== void 0; ) {
317
+ var n = w;
318
+ for (w = void 0, O++; n !== void 0; ) {
319
+ var r = n.u;
320
+ if (n.u = void 0, n.f &= -3, !(8 & n.f) && T(n)) try {
321
+ n.c();
322
+ } catch (o) {
323
+ e || (t = o, e = !0);
324
+ }
325
+ n = r;
326
+ }
327
+ }
328
+ if (O = 0, l--, e) throw t;
329
+ }
330
+ }
331
+ var s = void 0;
332
+ function Z(t) {
333
+ var e = s;
334
+ s = void 0;
335
+ try {
336
+ return t();
337
+ } finally {
338
+ s = e;
339
+ }
340
+ }
341
+ var w = void 0, l = 0, O = 0, U = 0, P = void 0, k = 0;
342
+ function K(t) {
343
+ if (s !== void 0) {
344
+ var e = t.n;
345
+ if (e === void 0 || e.t !== s)
346
+ return e = { i: 0, S: t, p: s.s, n: void 0, t: s, e: void 0, x: void 0, r: e }, s.s !== void 0 && (s.s.n = e), s.s = e, t.n = e, 32 & s.f && t.S(e), e;
347
+ if (e.i === -1)
348
+ return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = s.s, e.n = void 0, s.s.n = e, s.s = e), e;
349
+ }
350
+ }
351
+ function c(t, e) {
352
+ this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
353
+ }
354
+ c.prototype.brand = Et;
355
+ c.prototype.h = function() {
356
+ return !0;
357
+ };
358
+ c.prototype.S = function(t) {
359
+ var e = this, n = this.t;
360
+ n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : Z(function() {
361
+ var r;
362
+ (r = e.W) == null || r.call(e);
363
+ }));
364
+ };
365
+ c.prototype.U = function(t) {
366
+ var e = this;
367
+ if (this.t !== void 0) {
368
+ var n = t.e, r = t.x;
369
+ n !== void 0 && (n.x = r, t.e = void 0), r !== void 0 && (r.e = n, t.x = void 0), t === this.t && (this.t = r, r === void 0 && Z(function() {
370
+ var o;
371
+ (o = e.Z) == null || o.call(e);
372
+ }));
373
+ }
374
+ };
375
+ c.prototype.subscribe = function(t) {
376
+ var e = this;
377
+ return H(function() {
378
+ var n = e.value, r = s;
379
+ s = void 0;
380
+ try {
381
+ t(n);
382
+ } finally {
383
+ s = r;
384
+ }
385
+ }, { name: "sub" });
386
+ };
387
+ c.prototype.valueOf = function() {
388
+ return this.value;
389
+ };
390
+ c.prototype.toString = function() {
391
+ return this.value + "";
392
+ };
393
+ c.prototype.toJSON = function() {
394
+ return this.value;
395
+ };
396
+ c.prototype.peek = function() {
397
+ var t = s;
398
+ s = void 0;
399
+ try {
400
+ return this.value;
401
+ } finally {
402
+ s = t;
403
+ }
404
+ };
405
+ Object.defineProperty(c.prototype, "value", { get: function() {
406
+ var t = K(this);
407
+ return t !== void 0 && (t.i = this.i), this.v;
408
+ }, set: function(t) {
409
+ if (t !== this.v) {
410
+ if (O > 100) throw new Error("Cycle detected");
411
+ (function(n) {
412
+ l !== 0 && O === 0 && n.l !== U && (n.l = U, P = { S: n, v: n.v, i: n.i, o: P });
413
+ })(this), this.v = t, this.i++, k++, l++;
414
+ try {
415
+ for (var e = this.t; e !== void 0; e = e.x) e.t.N();
416
+ } finally {
417
+ J();
418
+ }
419
+ }
420
+ } });
421
+ function T(t) {
422
+ for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
423
+ return !1;
424
+ }
425
+ function z(t) {
426
+ for (var e = t.s; e !== void 0; e = e.n) {
427
+ var n = e.S.n;
428
+ if (n !== void 0 && (e.r = n), e.S.n = e, e.i = -1, e.n === void 0) {
429
+ t.s = e;
430
+ break;
431
+ }
432
+ }
433
+ }
434
+ function B(t) {
435
+ for (var e = t.s, n = void 0; e !== void 0; ) {
436
+ var r = e.p;
437
+ e.i === -1 ? (e.S.U(e), r !== void 0 && (r.n = e.n), e.n !== void 0 && (e.n.p = r)) : n = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = r;
438
+ }
439
+ t.s = n;
440
+ }
441
+ function m(t, e) {
442
+ c.call(this, void 0), this.x = t, this.s = void 0, this.g = k - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
443
+ }
444
+ m.prototype = new c();
445
+ m.prototype.h = function() {
446
+ if (this.f &= -3, 1 & this.f) return !1;
447
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === k)) return !0;
448
+ if (this.g = k, this.f |= 1, this.i > 0 && !T(this))
449
+ return this.f &= -2, !0;
450
+ var t = s;
451
+ try {
452
+ z(this), s = this;
453
+ var e = this.x();
454
+ (16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
455
+ } catch (n) {
456
+ this.v = n, this.f |= 16, this.i++;
457
+ }
458
+ return s = t, B(this), this.f &= -2, !0;
459
+ };
460
+ m.prototype.S = function(t) {
461
+ if (this.t === void 0) {
462
+ this.f |= 36;
463
+ for (var e = this.s; e !== void 0; e = e.n) e.S.S(e);
464
+ }
465
+ c.prototype.S.call(this, t);
466
+ };
467
+ m.prototype.U = function(t) {
468
+ if (this.t !== void 0 && (c.prototype.U.call(this, t), this.t === void 0)) {
469
+ this.f &= -33;
470
+ for (var e = this.s; e !== void 0; e = e.n) e.S.U(e);
471
+ }
472
+ };
473
+ m.prototype.N = function() {
474
+ if (!(2 & this.f)) {
475
+ this.f |= 6;
476
+ for (var t = this.t; t !== void 0; t = t.x) t.t.N();
477
+ }
478
+ };
479
+ Object.defineProperty(m.prototype, "value", { get: function() {
480
+ if (1 & this.f) throw new Error("Cycle detected");
481
+ var t = K(this);
482
+ if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
483
+ return this.v;
484
+ } });
485
+ function G(t) {
486
+ var e = t.m;
487
+ if (t.m = void 0, typeof e == "function") {
488
+ l++;
489
+ var n = s;
490
+ s = void 0;
491
+ try {
492
+ e();
493
+ } catch (r) {
494
+ throw t.f &= -2, t.f |= 8, F(t), r;
495
+ } finally {
496
+ s = n, J();
497
+ }
498
+ }
499
+ }
500
+ function F(t) {
501
+ for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
502
+ t.x = void 0, t.s = void 0, G(t);
503
+ }
504
+ function xt(t) {
505
+ if (s !== this) throw new Error("Out-of-order effect");
506
+ B(this), s = t, this.f &= -2, 8 & this.f && F(this), J();
507
+ }
508
+ function y(t, e) {
509
+ this.x = t, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = e?.name;
510
+ }
511
+ y.prototype.c = function() {
512
+ var t = this.S();
513
+ try {
514
+ if (8 & this.f || this.x === void 0) return;
515
+ var e = this.x();
516
+ typeof e == "function" && (this.m = e);
517
+ } finally {
518
+ t();
519
+ }
520
+ };
521
+ y.prototype.S = function() {
522
+ if (1 & this.f) throw new Error("Cycle detected");
523
+ this.f |= 1, this.f &= -9, G(this), z(this), l++;
524
+ var t = s;
525
+ return s = this, xt.bind(this, t);
526
+ };
527
+ y.prototype.N = function() {
528
+ 2 & this.f || (this.f |= 2, this.u = w, w = this);
529
+ };
530
+ y.prototype.d = function() {
531
+ this.f |= 8, 1 & this.f || F(this);
532
+ };
533
+ y.prototype.dispose = function() {
534
+ this.d();
535
+ };
536
+ function H(t, e) {
537
+ var n = new y(t, e);
538
+ try {
539
+ n.c();
540
+ } catch (o) {
541
+ throw n.d(), o;
542
+ }
543
+ var r = n.d.bind(n);
544
+ return r[Symbol.dispose] = r, r;
545
+ }
546
+ function Ot(t) {
547
+ if (!t) return t;
548
+ let e = !1;
549
+ const n = {};
550
+ for (const r of Object.keys(t)) {
551
+ const o = t[r];
552
+ o instanceof c ? (n[r] = o.value, e = !0) : n[r] = o;
553
+ }
554
+ return e ? n : t;
555
+ }
556
+ function Pt(t) {
557
+ const e = [];
558
+ if (t)
559
+ for (const n of Object.keys(t)) {
560
+ const r = t[n];
561
+ r instanceof c && e.push(r);
562
+ }
563
+ return e;
564
+ }
565
+ function kt(t, e) {
566
+ if (t === e) return !0;
567
+ if (!t || !e) return !1;
568
+ const n = Object.keys(t), r = Object.keys(e);
569
+ if (n.length !== r.length) return !1;
570
+ for (const o of n) if (t[o] !== e[o]) return !1;
571
+ return !0;
572
+ }
573
+ function Rt(t) {
574
+ const e = et(void 0), n = A(
575
+ (o) => {
576
+ const i = Pt(t);
577
+ if (i.length === 0) return () => {
578
+ };
579
+ let f = !0;
580
+ return H(() => {
581
+ for (const a of i) a.value;
582
+ if (f) {
583
+ f = !1;
584
+ return;
585
+ }
586
+ o();
587
+ });
588
+ },
589
+ [t]
590
+ ), r = A(() => {
591
+ const o = Ot(t);
592
+ return kt(e.current, o) ? e.current : (e.current = o, o);
593
+ }, [t]);
594
+ return nt(n, r, r);
595
+ }
596
+ function It({ id: t, values: e }) {
597
+ const n = $t(), r = Rt(e);
598
+ return n.render ? n.render(t, r) : n.resolve(t, r);
219
599
  }
220
600
  export {
221
- v as FIELD_WRAPPER,
222
- X as JsonFormRenderer,
223
- Q as JsonRendererProvider,
224
- q as SchemaErrorPanel,
225
- rr as buildFormSchemaMetaSchema,
226
- U as convertJsonToM1Tree,
227
- T as createRenderSchemaFromJsonM1,
228
- K as defineRegistry,
229
- er as formSchemaMetaSchema,
230
- tr as getComponentNames,
231
- nr as getDataSourceNames,
232
- $ as isArrayNode,
233
- R as isComponentOp,
234
- W as isContainerNode,
235
- A as isDataSourceOp,
236
- E as isFieldNode,
237
- f as isModelOp,
238
- m as parseOperator,
239
- D as useJsonRendererSettings
601
+ ct as FIELD_WRAPPER,
602
+ It as I18n,
603
+ At as JsonFormRenderer,
604
+ Ft as JsonRendererProvider,
605
+ D as LOCALE_SERVICE,
606
+ Dt as LocaleProvider,
607
+ wt as SchemaErrorPanel,
608
+ Zt as buildFormSchemaMetaSchema,
609
+ Mt as convertJsonToM1Tree,
610
+ Ut as createLocaleResolver,
611
+ Vt as createLocaleService,
612
+ St as createRenderSchemaFromJsonM1,
613
+ Wt as defaultLocaleResolver,
614
+ Jt as defineRegistry,
615
+ Kt as formSchemaMetaSchema,
616
+ Tt as getComponentNames,
617
+ zt as getDataSourceNames,
618
+ Bt as getFnNames,
619
+ Gt as getLocaleKeys,
620
+ I as isArrayNode,
621
+ C as isComponentOp,
622
+ ut as isContainerNode,
623
+ it as isDataSourceOp,
624
+ _ as isFieldNode,
625
+ st as isFnOp,
626
+ ft as isLocaleOp,
627
+ h as isModelOp,
628
+ u as parseOperator,
629
+ Ot as unwrapSignalValues,
630
+ at as useJsonRendererSettings,
631
+ $t as useLocale,
632
+ Rt as useSignalValues
240
633
  };