@reformer/renderer-json 9.0.0-beta.1 → 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,171 +1,229 @@
1
- import { jsx as m, jsxs as R } from "react/jsx-runtime";
2
- import { useContext as $, createContext as O, useMemo as w, useState as F, useEffect as j } from "react";
3
- import { createRenderSchema as k, FormRenderer as v } from "@reformer/renderer-react";
4
- import { i as p, a as E, p as d, b as A } from "./index-Bu5XPCQ7.js";
5
- import { c as rr, f as er, g as tr, d as nr } from "./index-Bu5XPCQ7.js";
6
- class u {
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 u(), o = (s) => {
29
- if (s instanceof u)
30
- s.own.forEach((i, a) => n.own.set(a, i));
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));
31
37
  else
32
- for (const i of s.names()) {
33
- const a = s.get(i);
34
- a && n.own.set(i, a);
38
+ for (const f of i.names()) {
39
+ const a = i.get(f);
40
+ a && r.own.set(f, a);
35
41
  }
36
42
  };
37
- return e instanceof u ? n.parent = e : o(e), o(t), n;
43
+ return e instanceof p ? r.parent = e : o(e), o(n), r;
38
44
  }
39
45
  }
40
- function K(r) {
41
- const e = new u();
42
- return r({
43
- component(n, o, s) {
44
- e._set(n, { component: o, type: "component", description: s });
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 });
54
+ },
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 });
45
61
  },
46
- dataSource(n, o, s) {
47
- e._set(n, { component: o, type: "dataSource", description: s });
62
+ locale(r, o) {
63
+ const i = typeof r == "function" ? { resolve: r } : r;
64
+ e._set(D, { component: i, type: "locale", description: o });
48
65
  }
49
66
  }), e;
50
67
  }
51
- const C = "$fieldWrapper", P = O({});
52
- function Q({ settings: r, children: e }) {
53
- const t = $(P), n = w(() => t.registry && r.registry ? u.withParent(t.registry, r.registry) : r.registry ?? t.registry, [t.registry, r.registry]), o = w(() => {
54
- const s = n?.get(C)?.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;
55
72
  return {
73
+ ...n,
56
74
  ...t,
57
- ...r,
58
- registry: n,
59
- fieldWrapper: r.fieldWrapper ?? s ?? t.fieldWrapper
75
+ registry: r,
76
+ fieldWrapper: t.fieldWrapper ?? i ?? n.fieldWrapper
60
77
  };
61
- }, [t, r, n]);
62
- return /* @__PURE__ */ m(P.Provider, { value: o, children: e });
78
+ }, [n, t, r]);
79
+ return /* @__PURE__ */ v(j.Provider, { value: o, children: e });
63
80
  }
64
- function W() {
65
- return $(P);
81
+ function at() {
82
+ return N(j);
66
83
  }
67
- function J(r) {
68
- const e = r;
69
- return p(e.array) && typeof e.item == "object" && e.item !== null && "$template" in e.item;
84
+ function I(t) {
85
+ const e = t;
86
+ return h(e.array) && typeof e.item == "object" && e.item !== null && "$template" in e.item;
70
87
  }
71
- function M(r) {
72
- return p(r.value);
88
+ function _(t) {
89
+ return h(t.value);
73
90
  }
74
- function D(r) {
75
- return E(r.component) && !M(r) && !J(r);
91
+ function ut(t) {
92
+ return C(t.component) && !_(t) && !I(t);
93
+ }
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;
76
106
  }
77
- function y(r, e) {
78
- if (!r) return;
79
- const t = d(r)?.arg;
80
- if (!t) throw new Error(`Invalid $component operator: "${r}"`);
107
+ function lt(t, e) {
81
108
  const n = e.get(t);
82
109
  if (!n)
83
110
  throw new Error(
84
- `Component "${t}" not found in registry. Available: ${e.names().join(", ")}`
111
+ `Data source "${t}" not found in registry. Available: ${e.names().join(", ")}`
85
112
  );
86
- if (n.type === "dataSource")
87
- 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(...)`);
88
115
  return n.component;
89
116
  }
90
- function L(r, e) {
91
- const t = e.get(r);
92
- if (!t)
117
+ function ht(t, e) {
118
+ const n = e.get(t);
119
+ if (!n)
93
120
  throw new Error(
94
- `Data source "${r}" not found in registry. Available: ${e.names().join(", ")}`
121
+ `Function "${t}" not found in registry. Available: ${e.names().join(", ")}`
95
122
  );
96
- if (t.type !== "dataSource")
97
- throw new Error(`Entry "${r}" is a '${t.type}' and cannot be used as $dataSource(...)`);
98
- return t.component;
99
- }
100
- function V(r, e) {
101
- return e.split(".").reduce((t, n) => t == null ? t : t[n], r);
102
- }
103
- function q(r) {
104
- if (r === null || typeof r != "object") return !1;
105
- const e = r;
106
- return p(e.value) || p(e.array) || E(e.component);
107
- }
108
- function T(r) {
109
- return r == null ? r : JSON.parse(JSON.stringify(r));
110
- }
111
- function b(r, e, t) {
112
- if (A(r)) return L(d(r).arg, t);
113
- if (E(r)) return y(r, t);
114
- if (p(r)) return e.signalAt(d(r).arg);
115
- if (q(r)) return h(r, e, t);
116
- if (Array.isArray(r)) return r.map((n) => b(n, e, t));
117
- if (r !== null && typeof r == "object") {
118
- const n = r, o = {};
119
- for (const s of Object.keys(n)) o[s] = b(n[s], 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);
120
178
  return o;
121
179
  }
122
- return r;
180
+ return t;
123
181
  }
124
- function S(r, e, t) {
125
- if (!r) return;
126
- const n = {};
127
- for (const o of Object.keys(r)) n[o] = b(r[o], e, t);
128
- 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;
129
187
  }
130
- function h(r, e, t) {
131
- if (J(r)) {
132
- const n = V(e, d(r.array).arg), o = r.item.$template, s = 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;
133
191
  return {
134
- ...r.selector ? { selector: r.selector } : {},
135
- array: n,
136
- initialValue: () => s ? T(s) : {},
137
- item: (i) => h(o, i, t),
138
- 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)
139
197
  };
140
198
  }
141
- if (M(r)) {
142
- const n = d(r.value).arg, o = e.signalAt(n);
143
- !o && typeof console < "u" && console.warn(`[JsonRenderer/M1] No model signal for "${n}".`);
144
- const s = S(r.componentProps, e, t), i = r.wrapper ? y(r.wrapper.component, t) : void 0;
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;
145
203
  return {
146
- ...r.selector ? { selector: r.selector } : {},
204
+ ...t.selector ? { selector: t.selector } : {},
147
205
  value: o,
148
- component: y(r.component, t),
149
- componentProps: i ? { ...s ?? {}, fieldWrapper: i } : s
206
+ component: E(t.component, n),
207
+ componentProps: f ? { ...i ?? {}, fieldWrapper: f } : i
150
208
  };
151
209
  }
152
- if (D(r))
210
+ if (ut(t))
153
211
  return {
154
- ...r.selector ? { selector: r.selector } : {},
155
- component: y(r.component, t),
156
- componentProps: S(r.componentProps, e, t),
157
- children: r.children?.map((n) => h(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))
158
216
  };
159
- throw new Error(`Invalid JSON node (M1): ${JSON.stringify(r)}`);
217
+ throw new Error(`Invalid JSON node (M1): ${JSON.stringify(t)}`);
160
218
  }
161
- function U(r, e, t) {
162
- return h(r.root, t, e);
219
+ function Mt(t, e, n) {
220
+ return b(t.root, n, e);
163
221
  }
164
- function z(r, e, t) {
165
- return () => h(r.root, t, e);
222
+ function St(t, e, n) {
223
+ return () => b(t.root, n, e);
166
224
  }
167
- function I({ errors: r }) {
168
- return /* @__PURE__ */ R(
225
+ function wt({ errors: t }) {
226
+ return /* @__PURE__ */ M(
169
227
  "div",
170
228
  {
171
229
  role: "alert",
@@ -179,43 +237,43 @@ function I({ errors: r }) {
179
237
  font: "14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace"
180
238
  },
181
239
  children: [
182
- /* @__PURE__ */ R("strong", { style: { display: "block", marginBottom: 8, fontSize: 15 }, children: [
240
+ /* @__PURE__ */ M("strong", { style: { display: "block", marginBottom: 8, fontSize: 15 }, children: [
183
241
  "Невалидная JSON-схема формы (",
184
- r.length,
242
+ t.length,
185
243
  ")"
186
244
  ] }),
187
- /* @__PURE__ */ m("ul", { style: { margin: 0, paddingLeft: 20 }, children: r.map((e, t) => /* @__PURE__ */ m("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)) })
188
246
  ]
189
247
  }
190
248
  );
191
249
  }
192
- function X({
193
- schema: r,
250
+ function At({
251
+ schema: t,
194
252
  renderBehavior: e,
195
- onSchemaReady: t,
196
- validate: n = !1
253
+ onSchemaReady: n,
254
+ validate: r = !1
197
255
  }) {
198
- const { registry: o, model: s, ...i } = W(), [a, g] = F(
199
- n ? void 0 : null
256
+ const { registry: o, model: i, ...f } = at(), [a, $] = Y(
257
+ r ? void 0 : null
200
258
  );
201
- j(() => {
202
- if (!n) {
203
- g(null);
259
+ tt(() => {
260
+ if (!r) {
261
+ $(null);
204
262
  return;
205
263
  }
206
- let f = !1;
207
- return g(void 0), import("./validate.js").then(({ validateFormSchema: c }) => {
208
- if (f) return;
209
- const { valid: N, errors: x } = c(r, { registry: o });
210
- g(N ? null : x);
211
- }).catch((c) => {
212
- f || g([`Schema validator failed to load: ${String(c)}`]);
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)}`]);
213
271
  }), () => {
214
- f = !0;
272
+ S = !0;
215
273
  };
216
- }, [n, r, o]);
217
- const l = w(() => {
218
- if (!s)
274
+ }, [r, t, o]);
275
+ const g = x(() => {
276
+ if (!i)
219
277
  throw new Error(
220
278
  "JsonFormRenderer: settings.model is required (M1). Pass the FormModel via JsonRendererProvider."
221
279
  );
@@ -224,31 +282,352 @@ function X({
224
282
  throw new Error(
225
283
  "JsonFormRenderer: settings.registry is required. Pass a ComponentRegistry via JsonRendererProvider."
226
284
  );
227
- const f = z(r, o, s), c = k(f);
228
- return e && e(c), c;
229
- }, [r, o, e, s, a]);
230
- return w(() => {
231
- l && t && t(l);
232
- }, [l]), a && a.length > 0 ? /* @__PURE__ */ m(I, { errors: a }) : l ? /* @__PURE__ */ m(v, { render: l, settings: i }) : null;
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);
233
599
  }
234
600
  export {
235
- C as FIELD_WRAPPER,
236
- X as JsonFormRenderer,
237
- Q as JsonRendererProvider,
238
- I as SchemaErrorPanel,
239
- rr as buildFormSchemaMetaSchema,
240
- U as convertJsonToM1Tree,
241
- z as createRenderSchemaFromJsonM1,
242
- K as defineRegistry,
243
- er as formSchemaMetaSchema,
244
- tr as getComponentNames,
245
- nr as getDataSourceNames,
246
- J as isArrayNode,
247
- E as isComponentOp,
248
- D as isContainerNode,
249
- A as isDataSourceOp,
250
- M as isFieldNode,
251
- p as isModelOp,
252
- d as parseOperator,
253
- W 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
254
633
  };