@reformer/core 11.0.0-beta.8 → 11.0.0-beta.9
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/README.md +91 -73
- package/dist/behaviors-value-HA_Q03hc.js +108 -0
- package/dist/behaviors.js +370 -242
- package/dist/{create-model-BBRHhHwK.js → create-model-BvcbNPgL.js} +6 -6
- package/dist/date-utils-90-qZbse.js +43 -0
- package/dist/{en-CjAqn7h0.js → en-HP8XEych.js} +6 -3
- package/dist/form/aggregate-signals.d.ts +21 -63
- package/dist/form/behaviors/collections.d.ts +28 -7
- package/dist/form/behaviors/context.d.ts +19 -2
- package/dist/form/behaviors/index.d.ts +3 -3
- package/dist/form/behaviors/internals.d.ts +9 -2
- package/dist/form/behaviors/node.d.ts +25 -2
- package/dist/form/behaviors/operators.d.ts +17 -9
- package/dist/form/behaviors/schema-operators.d.ts +6 -4
- package/dist/form/behaviors/types.d.ts +12 -4
- package/dist/form/create-form.d.ts +47 -35
- package/dist/form/flow/flow.d.ts +87 -0
- package/dist/form/form-bundle.d.ts +45 -28
- package/dist/form/form-config-base.d.ts +46 -0
- package/dist/form/form-level.d.ts +121 -0
- package/dist/form/form-proxy-builder.d.ts +6 -22
- package/dist/form/index.d.ts +16 -21
- package/dist/form/nodes/form-array-node.d.ts +100 -0
- package/dist/form/nodes/form-control-node.d.ts +73 -0
- package/dist/form/nodes/form-group-node.d.ts +66 -0
- package/dist/form/nodes/node-kind.d.ts +29 -0
- package/dist/form/nodes/state/availability.d.ts +6 -0
- package/dist/form/nodes/state/component.d.ts +6 -0
- package/dist/form/nodes/state/index.d.ts +12 -0
- package/dist/form/nodes/state/interaction.d.ts +13 -0
- package/dist/form/nodes/state/issues.d.ts +9 -0
- package/dist/form/nodes/state/pending.d.ts +6 -0
- package/dist/form/schema/compile.d.ts +59 -0
- package/dist/form/schema/compiled.d.ts +143 -0
- package/dist/form/schema/row-key.d.ts +11 -0
- package/dist/form/schema-controller.d.ts +30 -14
- package/dist/form/signal-node-registry.d.ts +6 -7
- package/dist/form/submission.d.ts +93 -0
- package/dist/form/type-guards.d.ts +14 -73
- package/dist/form/types/contracts.d.ts +19 -92
- package/dist/form/types/field-config.d.ts +27 -0
- package/dist/form/types/index.d.ts +5 -57
- package/dist/form/types/nodes.d.ts +159 -0
- package/dist/form/types/schema-node.d.ts +139 -63
- package/dist/form/types/validation-schema.d.ts +23 -27
- package/dist/form/validation/context.d.ts +42 -7
- package/dist/form/validation/index.d.ts +9 -8
- package/dist/form/validation/operators.d.ts +22 -30
- package/dist/form/validation/run.d.ts +93 -18
- package/dist/form/validation/strategy.d.ts +41 -13
- package/dist/form/validation/types.d.ts +74 -20
- package/dist/form/validators/date-utils.d.ts +13 -1
- package/dist/form/validators/email.d.ts +8 -7
- package/dist/form/validators/file-type.d.ts +8 -7
- package/dist/form/validators/file-utils.d.ts +2 -1
- package/dist/form/validators/future-date.d.ts +8 -7
- package/dist/form/validators/index.d.ts +1 -1
- package/dist/form/validators/integer.d.ts +8 -7
- package/dist/form/validators/is-date.d.ts +11 -9
- package/dist/form/validators/is-number.d.ts +11 -9
- package/dist/form/validators/max-age.d.ts +13 -9
- package/dist/form/validators/max-date.d.ts +8 -7
- package/dist/form/validators/max-file-size.d.ts +8 -7
- package/dist/form/validators/max-files.d.ts +8 -7
- package/dist/form/validators/max-length.d.ts +14 -7
- package/dist/form/validators/max-total-file-size.d.ts +8 -7
- package/dist/form/validators/max.d.ts +10 -8
- package/dist/form/validators/min-age.d.ts +12 -9
- package/dist/form/validators/min-date.d.ts +8 -7
- package/dist/form/validators/min-file-size.d.ts +8 -7
- package/dist/form/validators/min-files.d.ts +11 -9
- package/dist/form/validators/min-length.d.ts +14 -7
- package/dist/form/validators/min.d.ts +10 -8
- package/dist/form/validators/multiple-of.d.ts +10 -8
- package/dist/form/validators/non-negative.d.ts +8 -7
- package/dist/form/validators/non-zero.d.ts +8 -7
- package/dist/form/validators/past-date.d.ts +8 -7
- package/dist/form/validators/pattern.d.ts +9 -8
- package/dist/form/validators/phone.d.ts +8 -7
- package/dist/form/validators/required.d.ts +11 -9
- package/dist/form/validators/url.d.ts +20 -13
- package/dist/form/validators/validation-issue.d.ts +8 -0
- package/dist/i18n/descriptor.d.ts +1 -1
- package/dist/i18n/en.json.d.ts +5 -1
- package/dist/i18n/locale-store.d.ts +7 -0
- package/dist/i18n/message-format.d.ts +24 -4
- package/dist/i18n/ru.json.d.ts +5 -1
- package/dist/i18n/translator.d.ts +11 -0
- package/dist/i18n/validation-message.d.ts +42 -7
- package/dist/i18n.d.ts +7 -12
- package/dist/i18n.js +66 -283
- package/dist/index.d.ts +16 -7
- package/dist/index.js +924 -2855
- package/dist/loader-BWkigpVe.js +52 -0
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.json +4 -1
- package/dist/locale/ru.js +4 -1
- package/dist/locale/ru.json +4 -1
- package/dist/locale-CG54AU2Q.js +219 -0
- package/dist/locale.js +1 -1
- package/dist/model/behaviors-value.d.ts +24 -6
- package/dist/model/create-model.d.ts +2 -2
- package/dist/model/derived-registry.d.ts +1 -1
- package/dist/model/index.d.ts +11 -5
- package/dist/model/model-nodes.d.ts +79 -12
- package/dist/model/model-signals-proxy.d.ts +5 -6
- package/dist/model/model-value-proxy.d.ts +20 -15
- package/dist/model/safe-effect.d.ts +33 -1
- package/dist/model/types.d.ts +63 -13
- package/dist/model.js +20 -18
- package/dist/node-kind-C-r6ZMdo.js +15 -0
- package/dist/platforms/react/field-binding/field-adapter.d.ts +1 -1
- package/dist/platforms/react/field-binding/field-handle.d.ts +5 -2
- package/dist/platforms/react/form-bundle-context.d.ts +2 -2
- package/dist/platforms/react/hooks/types.d.ts +57 -38
- package/dist/platforms/react/hooks/use-form-bundle.d.ts +19 -4
- package/dist/platforms/react/hooks/use-form-flow.d.ts +40 -0
- package/dist/platforms/react/hooks/use-form-validation.d.ts +12 -6
- package/dist/platforms/react/hooks/useArrayLength.d.ts +6 -6
- package/dist/platforms/react/hooks/useFormControl.d.ts +7 -9
- package/dist/platforms/react/hooks/useFormControlValue.d.ts +18 -19
- package/dist/platforms/react/hooks/useSignalSubscription.d.ts +9 -1
- package/dist/platforms/react/i18n/context.d.ts +6 -1
- package/dist/platforms/react/i18n/hooks.d.ts +16 -10
- package/dist/platforms/react/i18n/provider.d.ts +9 -2
- package/dist/platforms/react/index.d.ts +6 -4
- package/dist/react.d.ts +22 -0
- package/dist/react.js +505 -0
- package/dist/runtime-token.d.ts +1 -2
- package/dist/safe-effect-BbtX3KuN.js +643 -0
- package/dist/schema-controller-CpiO2JoK.js +143 -0
- package/dist/signals.d.ts +15 -9
- package/dist/signals.js +11 -6
- package/dist/strategy-CoFSemuP.js +375 -0
- package/dist/type-guards-D-N_5Ddh.js +19 -0
- package/dist/validation-issue-B9mjI8jz.js +7 -0
- package/dist/validation-message-Ced9MGxs.js +194 -0
- package/dist/validation.js +9 -9
- package/dist/validators/email.js +5 -5
- package/dist/validators/future-date.js +8 -8
- package/dist/validators/integer.js +3 -3
- package/dist/validators/is-date.js +4 -4
- package/dist/validators/is-number.js +4 -4
- package/dist/validators/max-age.js +8 -9
- package/dist/validators/max-date.js +8 -8
- package/dist/validators/max-length.js +7 -7
- package/dist/validators/max.js +4 -4
- package/dist/validators/min-age.js +10 -8
- package/dist/validators/min-date.js +3 -3
- package/dist/validators/min-length.js +5 -5
- package/dist/validators/min.js +4 -4
- package/dist/validators/multiple-of.js +11 -7
- package/dist/validators/non-negative.js +3 -3
- package/dist/validators/non-zero.js +3 -3
- package/dist/validators/past-date.js +8 -8
- package/dist/validators/pattern.js +5 -5
- package/dist/validators/phone.js +11 -9
- package/dist/validators/required.js +2 -2
- package/dist/validators/url.js +48 -12
- package/dist/validators.js +17 -17
- package/docs/llms/01-api-reference.md +60 -34
- package/docs/llms/02-quick-start.md +111 -80
- package/docs/llms/03-api-signatures.md +368 -153
- package/docs/llms/04-common-patterns.md +58 -56
- package/docs/llms/05-common-mistakes.md +69 -44
- package/docs/llms/06-troubleshooting.md +14 -9
- package/docs/llms/07-complete-import.md +74 -43
- package/docs/llms/08-form-types.md +11 -4
- package/docs/llms/09-formschema.md +129 -81
- package/docs/llms/10-arrays.md +106 -75
- package/docs/llms/11-async-watchfield.md +2 -2
- package/docs/llms/13-multi-step.md +134 -63
- package/docs/llms/14-extended-mistakes.md +20 -17
- package/docs/llms/15-project-structure.md +221 -74
- package/docs/llms/16-ui-components.md +55 -42
- package/docs/llms/17-nonexistent-api.md +199 -32
- package/docs/llms/18-conditional-fields.md +66 -32
- package/docs/llms/19-reading-values.md +15 -3
- package/docs/llms/20-compute-vs-watch.md +16 -10
- package/docs/llms/21-array-operations.md +51 -27
- package/docs/llms/22-cycle-detection.md +1 -1
- package/docs/llms/23-copy-from.md +2 -2
- package/docs/llms/24-sync-fields.md +6 -5
- package/docs/llms/25-reset-when.md +14 -7
- package/docs/llms/26-transform-value.md +4 -4
- package/docs/llms/27-revalidate-when.md +16 -15
- package/docs/llms/28-submit-and-reset.md +276 -128
- package/docs/llms/29-async-preload.md +39 -29
- package/docs/llms/30-type-safety-recipes.md +105 -51
- package/docs/llms/31-async-validator-debounce.md +96 -53
- package/docs/llms/33-validation-strategy.md +177 -65
- package/docs/llms/34-i18n.md +69 -43
- package/docs/llms/35-unified-contract.md +100 -39
- package/docs/llms/36-issue-messages.md +284 -0
- package/docs/llms/37-compiled-schema.md +332 -0
- package/docs/llms/38-form-flow.md +397 -0
- package/llms-index.json +1 -1
- package/llms.txt +6084 -3420
- package/package.json +23 -4
- package/dist/behaviors-value-C7dSEhCc.js +0 -134
- package/dist/date-utils-dTT_x_Be.js +0 -31
- package/dist/form/create-core-form.d.ts +0 -72
- package/dist/form/factories/index.d.ts +0 -6
- package/dist/form/factories/node-factory.d.ts +0 -189
- package/dist/form/form-submitter.d.ts +0 -121
- package/dist/form/nodes/array-node.d.ts +0 -276
- package/dist/form/nodes/field-node.d.ts +0 -297
- package/dist/form/nodes/form-node.d.ts +0 -326
- package/dist/form/nodes/group-node.d.ts +0 -284
- package/dist/form/nodes/model-array-node.d.ts +0 -126
- package/dist/form/nodes/subscription-manager.d.ts +0 -180
- package/dist/form/status-machine.d.ts +0 -115
- package/dist/form/types/deep-schema.d.ts +0 -107
- package/dist/form/types/form-proxy.d.ts +0 -141
- package/dist/form/unique-id.d.ts +0 -45
- package/dist/form/validation/config.d.ts +0 -73
- package/dist/form/validation/error-handler.d.ts +0 -166
- package/dist/form/validators/validation-error.d.ts +0 -8
- package/dist/index-BrNkQj1y.js +0 -105
- package/dist/loader-Dv_Hl7JC.js +0 -216
- package/dist/model-value-proxy-caTmAiUd.js +0 -419
- package/dist/node-BeV_lV5i.js +0 -100
- package/dist/strategy-DgzELWno.js +0 -204
- package/dist/validation-error-B-U3RsV0.js +0 -11
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import { isSignal as I } from "./signals.js";
|
|
2
|
+
import { batch as S, signal as F, computed as G } from "@preact/signals-core";
|
|
3
|
+
const h = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function oe(e) {
|
|
5
|
+
h.set(e, (h.get(e) ?? 0) + 1);
|
|
6
|
+
}
|
|
7
|
+
function ae(e) {
|
|
8
|
+
const t = h.get(e);
|
|
9
|
+
t !== void 0 && (t <= 1 ? h.delete(e) : h.set(e, t - 1));
|
|
10
|
+
}
|
|
11
|
+
function $(e) {
|
|
12
|
+
return h.has(e);
|
|
13
|
+
}
|
|
14
|
+
const l = (e) => !(e === null || typeof e != "object" || Array.isArray(e) || e instanceof Date || typeof Blob < "u" && e instanceof Blob || typeof File < "u" && e instanceof File), d = (e, t) => e === "" ? String(t) : `${e}.${t}`, p = (e) => /^\d+$/.test(e), f = (e) => {
|
|
15
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
16
|
+
if (Array.isArray(e)) return e.map(f);
|
|
17
|
+
if (l(e)) {
|
|
18
|
+
const t = {};
|
|
19
|
+
for (const r of Object.keys(e)) t[r] = f(e[r]);
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
return e;
|
|
23
|
+
}, O = (e, t) => {
|
|
24
|
+
if (e === t || Number.isNaN(e) && Number.isNaN(t)) return !0;
|
|
25
|
+
if (e instanceof Date && t instanceof Date) return Object.is(e.getTime(), t.getTime());
|
|
26
|
+
if (Array.isArray(e) && Array.isArray(t))
|
|
27
|
+
return e.length !== t.length ? !1 : e.every((r, n) => O(r, t[n]));
|
|
28
|
+
if (l(e) && l(t)) {
|
|
29
|
+
const r = Object.keys(e), n = Object.keys(t);
|
|
30
|
+
return r.length !== n.length ? !1 : r.every((s) => O(e[s], t[s]));
|
|
31
|
+
}
|
|
32
|
+
return !1;
|
|
33
|
+
}, T = Symbol.for("@reformer/core:arrayBlank"), j = (e) => Array.isArray(e) ? e[T] : void 0, H = (e, t) => l(e) ? e[t] : void 0;
|
|
34
|
+
function B(e, t) {
|
|
35
|
+
if (!l(e) || !l(t)) return t;
|
|
36
|
+
const r = { ...e };
|
|
37
|
+
for (const [n, s] of Object.entries(t))
|
|
38
|
+
r[n] = s === void 0 ? e[n] : B(e[n], s);
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
function ce(e, t = []) {
|
|
42
|
+
const r = [...t];
|
|
43
|
+
return Object.defineProperty(r, T, { value: e }), r;
|
|
44
|
+
}
|
|
45
|
+
const R = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
function J(e) {
|
|
47
|
+
return R.get(e);
|
|
48
|
+
}
|
|
49
|
+
class X {
|
|
50
|
+
constructor(t, r) {
|
|
51
|
+
this.path = r;
|
|
52
|
+
const n = F(t);
|
|
53
|
+
n.__path = r, this.signal = n, this.initial = f(t), R.set(this.signal, this);
|
|
54
|
+
}
|
|
55
|
+
kind = "leaf";
|
|
56
|
+
signal;
|
|
57
|
+
initial;
|
|
58
|
+
rebase(t) {
|
|
59
|
+
this.path = t, this.signal.__path = t;
|
|
60
|
+
}
|
|
61
|
+
/** Реактивное чтение (внутри effect/computed создаёт зависимость). */
|
|
62
|
+
read() {
|
|
63
|
+
return this.signal.value;
|
|
64
|
+
}
|
|
65
|
+
/** Нереактивный снимок. */
|
|
66
|
+
peek() {
|
|
67
|
+
return this.signal.peek();
|
|
68
|
+
}
|
|
69
|
+
set(t) {
|
|
70
|
+
this.signal.value = t;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Вернуть значение к снимку. Производное поле (цель `compute`, поле сервера с `markDerived`)
|
|
74
|
+
* сброс не пишет — как `set` и `patch`: значением владеет поведение, а снимок такого поля снят
|
|
75
|
+
* до первого расчёта, и `compute` пересчитал бы его только при смене источников.
|
|
76
|
+
*/
|
|
77
|
+
resetToInitial() {
|
|
78
|
+
$(this.signal) || (this.signal.value = f(this.initial));
|
|
79
|
+
}
|
|
80
|
+
captureInitial() {
|
|
81
|
+
this.initial = f(this.signal.peek());
|
|
82
|
+
}
|
|
83
|
+
/** Значение точки отсчёта — копия: правка полученного снимок не трогает. */
|
|
84
|
+
reference() {
|
|
85
|
+
return f(this.initial);
|
|
86
|
+
}
|
|
87
|
+
dirty() {
|
|
88
|
+
return this.differsFrom(this.initial);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Отличается ли значение от снимка. Производное поле отличием не считается: его пишет поведение,
|
|
92
|
+
* а не пользователь — иначе форма без единой правки была бы «изменённой».
|
|
93
|
+
*/
|
|
94
|
+
differsFrom(t) {
|
|
95
|
+
return !$(this.signal) && !O(this.signal.peek(), t);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class Q {
|
|
99
|
+
/**
|
|
100
|
+
* @param shape Образец той же группы из шаблона родительского массива: из него вложенные
|
|
101
|
+
* массивы берут шаблоны, если значение пришло обычными данными (см. {@link ModelArrayNode}).
|
|
102
|
+
*/
|
|
103
|
+
constructor(t, r, n) {
|
|
104
|
+
this.path = r;
|
|
105
|
+
for (const s of Object.keys(t)) {
|
|
106
|
+
const i = n && (() => H(n(), s));
|
|
107
|
+
this.children.set(s, W(t[s], d(r, s), i));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
kind = "group";
|
|
111
|
+
children = /* @__PURE__ */ new Map();
|
|
112
|
+
rebase(t) {
|
|
113
|
+
this.path = t;
|
|
114
|
+
for (const [r, n] of this.children) n.rebase(d(t, r));
|
|
115
|
+
}
|
|
116
|
+
/** Реактивное чтение поддерева (внутри effect/computed подписывает на все листья группы). */
|
|
117
|
+
read() {
|
|
118
|
+
const t = {};
|
|
119
|
+
for (const [r, n] of this.children) t[r] = n.read();
|
|
120
|
+
return t;
|
|
121
|
+
}
|
|
122
|
+
peek() {
|
|
123
|
+
const t = {};
|
|
124
|
+
for (const [r, n] of this.children) t[r] = n.peek();
|
|
125
|
+
return t;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Полная установка: значение ожидается целиком. Ключи, которых в нём нет, остаются прежними —
|
|
129
|
+
* как у {@link patch}, — но в dev о них сообщает предупреждение: неполный объект в `set` — почти
|
|
130
|
+
* всегда ошибка вызывающего кода, а не намерение.
|
|
131
|
+
*/
|
|
132
|
+
set(t) {
|
|
133
|
+
const r = [];
|
|
134
|
+
if (this.write(t, r), r.length > 0 && process.env.NODE_ENV !== "production") {
|
|
135
|
+
const n = this.path === "" ? "model" : `model.${this.path}`, s = t == null || typeof t != "object" ? "значение не объект — группа осталась прежней" : `в значении нет ключей ${r.map((i) => `«${i}»`).join(", ")} — эти поля остались прежними`;
|
|
136
|
+
console.warn(
|
|
137
|
+
`[@reformer/core] ${n}.set(...): ${s}. \`set\` ожидает объект целиком; для частичного обновления есть \`patch\`.`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Частичное обновление: записываются только переданные ключи. Вложенная группа сливается так
|
|
143
|
+
* же, массив заменяется целиком.
|
|
144
|
+
*/
|
|
145
|
+
patch(t) {
|
|
146
|
+
this.write(t, void 0, !0);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Запись значения по ключам группы. Лишние ключи значения игнорируются, производные поля не
|
|
150
|
+
* затираются.
|
|
151
|
+
*
|
|
152
|
+
* @param missing - Куда складывать пути ключей, для которых значение не пришло. Передаётся при
|
|
153
|
+
* полной установке ({@link set}); при частичной ({@link patch}) — `undefined`.
|
|
154
|
+
* @param partial - Частичное обновление: ключ со значением `undefined` — «не трогать», как в
|
|
155
|
+
* частичном значении элемента массива (`DeepPartial` допускает `{ ключ: undefined }`).
|
|
156
|
+
*/
|
|
157
|
+
write(t, r, n = !1) {
|
|
158
|
+
if (t == null || typeof t != "object") {
|
|
159
|
+
r?.push(this.path);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const s = t;
|
|
163
|
+
S(() => {
|
|
164
|
+
for (const [i, a] of this.children)
|
|
165
|
+
if (!(a.kind === "leaf" && $(a.signal))) {
|
|
166
|
+
if (!(i in s)) {
|
|
167
|
+
r?.push(d(this.path, i));
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
n && s[i] === void 0 || (a.kind === "group" ? a.write(s[i], r, n) : a.set(s[i]));
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
resetToInitial() {
|
|
175
|
+
S(() => {
|
|
176
|
+
for (const t of this.children.values()) t.resetToInitial();
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
captureInitial() {
|
|
180
|
+
for (const t of this.children.values()) t.captureInitial();
|
|
181
|
+
}
|
|
182
|
+
dirty() {
|
|
183
|
+
for (const t of this.children.values()) if (t.dirty()) return !0;
|
|
184
|
+
return !1;
|
|
185
|
+
}
|
|
186
|
+
/** Отличается ли группа от снимка её значения (строка массива сверяется со снимком массива). */
|
|
187
|
+
differsFrom(t) {
|
|
188
|
+
if (!l(t)) return !0;
|
|
189
|
+
for (const [r, n] of this.children) if (n.differsFrom(t[r])) return !0;
|
|
190
|
+
return !1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
class U {
|
|
194
|
+
/** @param shape Образец того же массива из шаблона родителя (см. {@link ModelGroupNode}). */
|
|
195
|
+
constructor(t, r, n) {
|
|
196
|
+
this.path = r, this.shape = n, this.blank = j(t), this.items = F(t.map((s, i) => this.build(s, i))), this.initial = f(t);
|
|
197
|
+
}
|
|
198
|
+
kind = "array";
|
|
199
|
+
items;
|
|
200
|
+
initial;
|
|
201
|
+
// Шаблон нового элемента (`arrayOf`). Принадлежит узлу, а не значению: `set`/`reset` заменяют
|
|
202
|
+
// элементы, узел остаётся — и шаблон с ним.
|
|
203
|
+
blank;
|
|
204
|
+
// Запасной шаблон — от того, кто строит модель извне (сборка формы передаёт `initialValue`).
|
|
205
|
+
fallback;
|
|
206
|
+
// Образец элемента — один вызов шаблона. Нужен только ради вложенных шаблонов: элемент из
|
|
207
|
+
// обычных данных (`set` с сервера, `push(значение)`) метку `arrayOf` на своих массивах не несёт.
|
|
208
|
+
sample;
|
|
209
|
+
/** Шаблон по старшинству: свой (`arrayOf`) → из шаблона родителя → запасной извне. */
|
|
210
|
+
template() {
|
|
211
|
+
return this.blank ??= j(this.shape?.()), this.blank ?? this.fallback;
|
|
212
|
+
}
|
|
213
|
+
// Образец читается лениво — лишний вызов шаблона случается, только когда вложенному массиву
|
|
214
|
+
// элемента из обычных данных понадобился свой шаблон.
|
|
215
|
+
itemShape = () => {
|
|
216
|
+
if (!this.sample) {
|
|
217
|
+
const t = this.template();
|
|
218
|
+
if (!t) return;
|
|
219
|
+
this.sample = { value: t() };
|
|
220
|
+
}
|
|
221
|
+
return this.sample.value;
|
|
222
|
+
};
|
|
223
|
+
build(t, r) {
|
|
224
|
+
return W(t, d(this.path, r), this.itemShape);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Значение нового элемента: из шаблона; переданный объект накладывается поверх шаблона —
|
|
228
|
+
* недостающие ключи берутся из шаблона, поэтому `push({ type: 'house' })` даёт полный элемент.
|
|
229
|
+
*/
|
|
230
|
+
fresh(t) {
|
|
231
|
+
const r = this.template();
|
|
232
|
+
if (t !== void 0) return r ? B(r(), t) : t;
|
|
233
|
+
if (!r)
|
|
234
|
+
throw new Error(
|
|
235
|
+
`[@reformer/core] ${this.path || "массив"}: добавление элемента без значения, а шаблона у массива нет. Объявите его в модели — \`arrayOf(() => ({ … }))\` — либо передайте значение: \`push(значение)\`.`
|
|
236
|
+
);
|
|
237
|
+
return r();
|
|
238
|
+
}
|
|
239
|
+
/** Запасной шаблон извне (сборка формы передаёт `initialValue`): шаблон модели главнее. */
|
|
240
|
+
provideBlank(t) {
|
|
241
|
+
this.fallback ??= t;
|
|
242
|
+
}
|
|
243
|
+
rebase(t) {
|
|
244
|
+
this.path = t, this.items.peek().forEach((r, n) => r.rebase(d(t, n)));
|
|
245
|
+
}
|
|
246
|
+
reindex() {
|
|
247
|
+
this.items.peek().forEach((t, r) => t.rebase(d(this.path, r)));
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Индекс за концом массива — ошибка, а не «в конец»: `splice` молча сдвигал бы элемент на
|
|
251
|
+
* другой индекс, и вызывающий код получал бы путь, которого не просил.
|
|
252
|
+
*/
|
|
253
|
+
beyondEnd(t, r, n) {
|
|
254
|
+
const s = this.path === "" ? "model" : `model.${this.path}`, i = this.items.peek().length;
|
|
255
|
+
return new RangeError(
|
|
256
|
+
`[@reformer/core] ${s}.${t}: индекс ${r} за концом массива (длина ${i}, наибольший допустимый — ${n}).` + (t.startsWith("insertAt") ? " Добавить в конец — push(…) или insertAt(length, …)." : "")
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
push(t) {
|
|
260
|
+
const r = this.items.peek();
|
|
261
|
+
this.items.value = [...r, this.build(this.fresh(t), r.length)];
|
|
262
|
+
}
|
|
263
|
+
insertAt(t, r) {
|
|
264
|
+
if (!Number.isInteger(t) || t < 0) return;
|
|
265
|
+
const n = [...this.items.peek()];
|
|
266
|
+
if (t > n.length) throw this.beyondEnd(`insertAt(${t})`, t, n.length);
|
|
267
|
+
n.splice(t, 0, this.build(this.fresh(r), t)), this.items.value = n, this.reindex();
|
|
268
|
+
}
|
|
269
|
+
removeAt(t) {
|
|
270
|
+
const r = [...this.items.peek()];
|
|
271
|
+
!Number.isInteger(t) || t < 0 || t >= r.length || (r.splice(t, 1), this.items.value = r, this.reindex());
|
|
272
|
+
}
|
|
273
|
+
move(t, r) {
|
|
274
|
+
const n = [...this.items.peek()];
|
|
275
|
+
if (!Number.isInteger(t) || !Number.isInteger(r) || t < 0 || r < 0) return;
|
|
276
|
+
const s = n.length - 1;
|
|
277
|
+
if (t > s) throw this.beyondEnd(`move(${t}, ${r})`, t, s);
|
|
278
|
+
if (r > s) throw this.beyondEnd(`move(${t}, ${r})`, r, s);
|
|
279
|
+
if (t === r) return;
|
|
280
|
+
const [i] = n.splice(t, 1);
|
|
281
|
+
i && n.splice(r, 0, i), this.items.value = n, this.reindex();
|
|
282
|
+
}
|
|
283
|
+
swap(t, r) {
|
|
284
|
+
const n = [...this.items.peek()];
|
|
285
|
+
t < 0 || r < 0 || t >= n.length || r >= n.length || t === r || ([n[t], n[r]] = [n[r], n[t]], this.items.value = n, this.reindex());
|
|
286
|
+
}
|
|
287
|
+
clear() {
|
|
288
|
+
this.items.value = [];
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Реактивное чтение массива. Читаем `items.value` (а не `.peek()`) — внутри effect/computed это
|
|
292
|
+
* подписка на СОСТАВ массива, поэтому push/removeAt/move ретригерят наравне с правкой элемента.
|
|
293
|
+
*/
|
|
294
|
+
read() {
|
|
295
|
+
return this.items.value.map((t) => t.read());
|
|
296
|
+
}
|
|
297
|
+
peek() {
|
|
298
|
+
return this.items.peek().map((t) => t.peek());
|
|
299
|
+
}
|
|
300
|
+
set(t) {
|
|
301
|
+
const r = Array.isArray(t) ? t : [];
|
|
302
|
+
this.items.value = r.map((n, s) => this.build(n, s));
|
|
303
|
+
}
|
|
304
|
+
resetToInitial() {
|
|
305
|
+
this.set(f(this.initial));
|
|
306
|
+
}
|
|
307
|
+
captureInitial() {
|
|
308
|
+
this.initial = f(this.peek());
|
|
309
|
+
}
|
|
310
|
+
/** Элементы точки отсчёта — копия: правка полученного снимок не трогает. */
|
|
311
|
+
reference() {
|
|
312
|
+
return f(this.initial);
|
|
313
|
+
}
|
|
314
|
+
dirty() {
|
|
315
|
+
return this.differsFrom(this.initial);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Отличается ли массив от снимка: другая длина либо отличается элемент. Сверка идёт по узлам, а
|
|
319
|
+
* не по значению целиком — производные поля строк (цели `compute` поведения строки) не в счёт.
|
|
320
|
+
*/
|
|
321
|
+
differsFrom(t) {
|
|
322
|
+
const r = this.items.peek();
|
|
323
|
+
return !Array.isArray(t) || t.length !== r.length ? !0 : r.some((n, s) => n.differsFrom(t[s]));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function W(e, t, r) {
|
|
327
|
+
return Array.isArray(e) ? new U(e, t, r) : l(e) ? new Q(e, t, r) : new X(e, t);
|
|
328
|
+
}
|
|
329
|
+
const Y = (e) => typeof e == "function" ? e : () => f(e), _ = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap();
|
|
330
|
+
function Z(e) {
|
|
331
|
+
const t = G(
|
|
332
|
+
() => process.env.NODE_ENV === "production" ? e.read() : A(e.read(), e)
|
|
333
|
+
);
|
|
334
|
+
return {
|
|
335
|
+
get value() {
|
|
336
|
+
return t.value;
|
|
337
|
+
},
|
|
338
|
+
peek: () => t.peek(),
|
|
339
|
+
subscribe: (r) => t.subscribe(r),
|
|
340
|
+
valueOf: () => t.value,
|
|
341
|
+
toString: () => String(t.value),
|
|
342
|
+
toJSON: () => t.value,
|
|
343
|
+
brand: t.brand
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function A(e, t) {
|
|
347
|
+
if (t.kind === "leaf" || e === null || typeof e != "object") return e;
|
|
348
|
+
const r = e;
|
|
349
|
+
if (t.kind === "group")
|
|
350
|
+
for (const [n, s] of t.children) A(r[n], s);
|
|
351
|
+
else
|
|
352
|
+
t.items.peek().forEach((n, s) => A(r[s], n));
|
|
353
|
+
return Object.freeze(e);
|
|
354
|
+
}
|
|
355
|
+
function m(e) {
|
|
356
|
+
if (e.kind === "leaf") return e.signal;
|
|
357
|
+
const t = _.get(e);
|
|
358
|
+
if (t) return t;
|
|
359
|
+
const r = Z(e), n = e.kind === "group", s = (c) => n ? e.children.get(c) : p(c) ? e.items.value[Number(c)] : void 0, i = n ? {} : Object.defineProperty({}, "length", {
|
|
360
|
+
get: () => e.items.value.length,
|
|
361
|
+
enumerable: !1,
|
|
362
|
+
configurable: !0
|
|
363
|
+
}), a = new Proxy(i, {
|
|
364
|
+
get: (c, o, k) => {
|
|
365
|
+
if (o === "__path") return e.path;
|
|
366
|
+
if (o === "__kind") return e.kind;
|
|
367
|
+
if (typeof o != "string") return Reflect.get(r, o, r);
|
|
368
|
+
const g = s(o);
|
|
369
|
+
return g ? m(g) : !n && Object.prototype.hasOwnProperty.call(c, o) ? Reflect.get(c, o, k) : Reflect.get(r, o, r);
|
|
370
|
+
},
|
|
371
|
+
set: (c, o, k) => {
|
|
372
|
+
if (!n && o === "value")
|
|
373
|
+
return e.set(k), !0;
|
|
374
|
+
const g = e.path === "" ? "model.$" : `model.$.${e.path}`;
|
|
375
|
+
throw new TypeError(
|
|
376
|
+
`[@reformer/core] ${g}: запись в «${String(o)}» ` + (n ? "узла-группы невозможна — группа читается целиком, а пишется по полям (model.$.<поле>.value) либо через model.patch(...)" : "узла-массива невозможна — массив заменяется целиком через .value, а элемент правится своим сигналом (model.$.<массив>[i].value)")
|
|
377
|
+
);
|
|
378
|
+
},
|
|
379
|
+
has: (c, o) => typeof o == "string" && (s(o) !== void 0 || !n && Object.prototype.hasOwnProperty.call(c, o)),
|
|
380
|
+
ownKeys: () => n ? [...e.children.keys()] : [...e.items.value.keys()].map(String).concat("length"),
|
|
381
|
+
getOwnPropertyDescriptor: (c, o) => typeof o == "string" && s(o) ? { enumerable: !0, configurable: !0 } : n ? void 0 : Reflect.getOwnPropertyDescriptor(c, o)
|
|
382
|
+
});
|
|
383
|
+
return _.set(e, a), C.set(a, e), a;
|
|
384
|
+
}
|
|
385
|
+
function q(e) {
|
|
386
|
+
if (!(e == null || typeof e != "object"))
|
|
387
|
+
return C.get(e);
|
|
388
|
+
}
|
|
389
|
+
function E(e) {
|
|
390
|
+
if (e == null || typeof e != "object") return !1;
|
|
391
|
+
const t = e.__kind;
|
|
392
|
+
return t === "group" || t === "array";
|
|
393
|
+
}
|
|
394
|
+
function y(e) {
|
|
395
|
+
return e == null || typeof e != "object" ? !1 : e.__kind === "array";
|
|
396
|
+
}
|
|
397
|
+
function fe(e) {
|
|
398
|
+
return y(e) || I(e) && !E(e);
|
|
399
|
+
}
|
|
400
|
+
function ee(e, t) {
|
|
401
|
+
if (!t) return;
|
|
402
|
+
let r = e;
|
|
403
|
+
for (const n of t.split(".")) {
|
|
404
|
+
if (!r) return;
|
|
405
|
+
if (r.kind === "group") r = r.children.get(n);
|
|
406
|
+
else if (r.kind === "array") r = r.items.peek()[Number(n)];
|
|
407
|
+
else return;
|
|
408
|
+
}
|
|
409
|
+
if (r)
|
|
410
|
+
return r.kind === "leaf" ? r.signal : r.kind === "array" ? m(r) : void 0;
|
|
411
|
+
}
|
|
412
|
+
function u(e) {
|
|
413
|
+
if (e)
|
|
414
|
+
return e.kind === "group" ? K(e) : e.kind === "array" ? x(e) : e.read();
|
|
415
|
+
}
|
|
416
|
+
const D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap();
|
|
417
|
+
function x(e) {
|
|
418
|
+
const t = D.get(e);
|
|
419
|
+
if (t) return t;
|
|
420
|
+
const r = {
|
|
421
|
+
get length() {
|
|
422
|
+
return e.items.value.length;
|
|
423
|
+
},
|
|
424
|
+
push: (s) => e.push(s),
|
|
425
|
+
insertAt: (s, i) => e.insertAt(s, i),
|
|
426
|
+
removeAt: (s) => e.removeAt(s),
|
|
427
|
+
move: (s, i) => e.move(s, i),
|
|
428
|
+
swap: (s, i) => e.swap(s, i),
|
|
429
|
+
clear: () => e.clear(),
|
|
430
|
+
at: (s) => u(e.items.value[s]),
|
|
431
|
+
map: (s) => e.items.value.map((i, a) => s(u(i), a)),
|
|
432
|
+
forEach: (s) => e.items.value.forEach((i, a) => s(u(i), a)),
|
|
433
|
+
toArray: () => e.peek(),
|
|
434
|
+
toJSON: () => e.peek(),
|
|
435
|
+
[Symbol.iterator]: function* () {
|
|
436
|
+
const s = e.items.value;
|
|
437
|
+
for (let i = 0; i < s.length; i++) yield u(s[i]);
|
|
438
|
+
}
|
|
439
|
+
}, n = new Proxy(r, {
|
|
440
|
+
get: (s, i, a) => i === "__path" ? e.path : typeof i == "string" && p(i) ? u(e.items.value[Number(i)]) : Reflect.get(s, i, a),
|
|
441
|
+
has: (s, i) => typeof i == "string" && p(i) ? Number(i) < e.items.value.length : Reflect.has(s, i),
|
|
442
|
+
// Перечисляются данные, как у массива: индексы и неперечислимый `length`, а не методы API.
|
|
443
|
+
ownKeys: () => [...e.items.value.keys()].map(String).concat("length"),
|
|
444
|
+
getOwnPropertyDescriptor: (s, i) => {
|
|
445
|
+
if (i === "length")
|
|
446
|
+
return { ...Reflect.getOwnPropertyDescriptor(s, i), enumerable: !1 };
|
|
447
|
+
if (typeof i == "string" && p(i) && Number(i) < e.items.value.length)
|
|
448
|
+
return {
|
|
449
|
+
enumerable: !0,
|
|
450
|
+
configurable: !0,
|
|
451
|
+
writable: !0,
|
|
452
|
+
value: u(e.items.value[Number(i)])
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
set: (s, i, a) => {
|
|
456
|
+
const c = e.path === "" ? "model" : `model.${e.path}`;
|
|
457
|
+
if (typeof i == "string" && p(i)) {
|
|
458
|
+
const o = e.items.peek()[Number(i)];
|
|
459
|
+
if (o)
|
|
460
|
+
return o.set(a), !0;
|
|
461
|
+
throw new TypeError(
|
|
462
|
+
`[@reformer/core] ${c}[${i}]: элемента нет — добавляйте через push(…) / insertAt(…).`
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
throw new TypeError(
|
|
466
|
+
`[@reformer/core] ${c}: запись в «${String(i)}» невозможна — элементы пишутся по индексу или через push / insertAt / removeAt / move / swap / clear.`
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
return D.set(e, n), v.set(n, e), n;
|
|
471
|
+
}
|
|
472
|
+
const w = /* @__PURE__ */ new Set([
|
|
473
|
+
"$",
|
|
474
|
+
"get",
|
|
475
|
+
"set",
|
|
476
|
+
"patch",
|
|
477
|
+
"isDirty",
|
|
478
|
+
"reset",
|
|
479
|
+
"captureInitial",
|
|
480
|
+
"signalAt"
|
|
481
|
+
]), te = () => "[object Object]", M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap();
|
|
482
|
+
function K(e) {
|
|
483
|
+
const t = M.get(e);
|
|
484
|
+
if (t) return t;
|
|
485
|
+
const r = {
|
|
486
|
+
$: m(e),
|
|
487
|
+
get: () => e.peek(),
|
|
488
|
+
set: (s) => e.set(s),
|
|
489
|
+
patch: (s) => e.patch(s),
|
|
490
|
+
isDirty: () => e.dirty(),
|
|
491
|
+
reset: () => e.resetToInitial(),
|
|
492
|
+
captureInitial: () => e.captureInitial(),
|
|
493
|
+
signalAt: (s) => ee(e, s)
|
|
494
|
+
}, n = new Proxy(
|
|
495
|
+
{},
|
|
496
|
+
{
|
|
497
|
+
get: (s, i) => {
|
|
498
|
+
if (i === "__path") return e.path;
|
|
499
|
+
if (typeof i != "string") return;
|
|
500
|
+
const a = e.children.get(i);
|
|
501
|
+
if (a) return u(a);
|
|
502
|
+
if (w.has(i)) return r[i];
|
|
503
|
+
if (i === "toString") return te;
|
|
504
|
+
},
|
|
505
|
+
set: (s, i, a) => {
|
|
506
|
+
const c = typeof i == "string" ? e.children.get(i) : void 0;
|
|
507
|
+
if (c)
|
|
508
|
+
return c.set(a), !0;
|
|
509
|
+
const o = e.path === "" ? "model" : `model.${e.path}`;
|
|
510
|
+
throw new TypeError(
|
|
511
|
+
`[@reformer/core] ${o}: поля «${String(i)}» в модели нет — запись невозможна. Состав полей задаёт начальное значение модели` + (typeof i == "string" && w.has(i) ? `; «${i}» — метод API модели.` : ".")
|
|
512
|
+
);
|
|
513
|
+
},
|
|
514
|
+
has: (s, i) => typeof i == "string" && (e.children.has(i) || w.has(i)),
|
|
515
|
+
ownKeys: () => [...e.children.keys()],
|
|
516
|
+
getOwnPropertyDescriptor: (s, i) => typeof i == "string" && e.children.has(i) ? { enumerable: !0, configurable: !0 } : void 0
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
return M.set(e, n), N.set(n, e), n;
|
|
520
|
+
}
|
|
521
|
+
function le(e) {
|
|
522
|
+
const t = q(e);
|
|
523
|
+
if (!t) {
|
|
524
|
+
const r = e?.__path, n = typeof r == "string" && r !== "" ? ` «${r}»` : "";
|
|
525
|
+
throw new TypeError(
|
|
526
|
+
I(e) && !E(e) ? `[@reformer/core] modelOf: ручка${n} — лист, у него нет под-модели. Группа или массив, созданные из начального null, в модели тоже лист: задайте начальное значение объектом или массивом.` : "[@reformer/core] modelOf: ожидалась ручка группы или массива из дерева model.$ (например, model.$.address или model.$.items)."
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
return t.kind === "group" ? K(t) : x(t);
|
|
530
|
+
}
|
|
531
|
+
function V(e) {
|
|
532
|
+
if (e == null || typeof e != "object") return;
|
|
533
|
+
const t = v.get(e);
|
|
534
|
+
if (t) return m(t);
|
|
535
|
+
const r = N.get(e);
|
|
536
|
+
return r ? m(r) : void 0;
|
|
537
|
+
}
|
|
538
|
+
function ue(e) {
|
|
539
|
+
if (y(e)) return e;
|
|
540
|
+
const t = V(e);
|
|
541
|
+
return y(t) ? t : void 0;
|
|
542
|
+
}
|
|
543
|
+
function he(e) {
|
|
544
|
+
const t = E(e) ? e : V(e);
|
|
545
|
+
return t !== void 0 && !y(t) ? t : void 0;
|
|
546
|
+
}
|
|
547
|
+
function de(e, t) {
|
|
548
|
+
const r = q(e);
|
|
549
|
+
r?.kind === "array" && r.provideBlank(Y(t));
|
|
550
|
+
}
|
|
551
|
+
function pe(e) {
|
|
552
|
+
if (typeof e != "object" || e === null) return;
|
|
553
|
+
const t = v.get(e);
|
|
554
|
+
if (t !== void 0) return { value: t.reference() };
|
|
555
|
+
const r = J(e);
|
|
556
|
+
return r === void 0 ? void 0 : { value: r.reference() };
|
|
557
|
+
}
|
|
558
|
+
function me(e) {
|
|
559
|
+
return e == null || typeof e != "object" ? !1 : v.has(e) || N.has(e);
|
|
560
|
+
}
|
|
561
|
+
const re = "runOutsideEffect";
|
|
562
|
+
function P(e, t) {
|
|
563
|
+
process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e);
|
|
564
|
+
}
|
|
565
|
+
function ne(e) {
|
|
566
|
+
return typeof e == "object" && e !== null && typeof e.then == "function";
|
|
567
|
+
}
|
|
568
|
+
function L(e, t) {
|
|
569
|
+
try {
|
|
570
|
+
const r = e();
|
|
571
|
+
ne(r) && r.then(void 0, (n) => P(n, t));
|
|
572
|
+
} catch (r) {
|
|
573
|
+
P(r, t);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function ge(e) {
|
|
577
|
+
return (...t) => {
|
|
578
|
+
z(() => e(...t));
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
function z(e) {
|
|
582
|
+
let t = !1;
|
|
583
|
+
return b++, queueMicrotask(() => {
|
|
584
|
+
b--, !t && L(e, re);
|
|
585
|
+
}), () => {
|
|
586
|
+
t = !0;
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
let b = 0;
|
|
590
|
+
function ye() {
|
|
591
|
+
if (b !== 0)
|
|
592
|
+
return new Promise((e) => {
|
|
593
|
+
const t = () => {
|
|
594
|
+
b > 0 ? queueMicrotask(t) : e();
|
|
595
|
+
};
|
|
596
|
+
queueMicrotask(t);
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
function be() {
|
|
600
|
+
const e = /* @__PURE__ */ new Set();
|
|
601
|
+
return {
|
|
602
|
+
schedule(t) {
|
|
603
|
+
const r = z(() => {
|
|
604
|
+
e.delete(r), t();
|
|
605
|
+
});
|
|
606
|
+
e.add(r);
|
|
607
|
+
},
|
|
608
|
+
cancelAll() {
|
|
609
|
+
e.forEach((t) => t()), e.clear();
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function ve(e, t) {
|
|
614
|
+
return () => {
|
|
615
|
+
t(() => L(e, "safeDebouncedCallback"));
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
export {
|
|
619
|
+
Q as M,
|
|
620
|
+
ce as a,
|
|
621
|
+
fe as b,
|
|
622
|
+
oe as c,
|
|
623
|
+
$ as d,
|
|
624
|
+
ve as e,
|
|
625
|
+
ye as f,
|
|
626
|
+
O as g,
|
|
627
|
+
be as h,
|
|
628
|
+
E as i,
|
|
629
|
+
K as j,
|
|
630
|
+
N as k,
|
|
631
|
+
m as l,
|
|
632
|
+
le as m,
|
|
633
|
+
he as n,
|
|
634
|
+
ue as o,
|
|
635
|
+
y as p,
|
|
636
|
+
pe as q,
|
|
637
|
+
z as r,
|
|
638
|
+
ge as s,
|
|
639
|
+
q as t,
|
|
640
|
+
ae as u,
|
|
641
|
+
me as v,
|
|
642
|
+
de as w
|
|
643
|
+
};
|