@tmagic/form 1.8.0-beta.24 → 1.8.0-beta.26

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.
Files changed (131) hide show
  1. package/dist/es/Form.vue_vue_type_script_setup_true_lang.js +47 -120
  2. package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +3 -3
  3. package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +3 -3
  4. package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +3 -3
  5. package/dist/es/containers/Col.vue_vue_type_script_setup_true_lang.js +3 -0
  6. package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +36 -51
  7. package/dist/es/containers/Fieldset.vue_vue_type_script_setup_true_lang.js +6 -0
  8. package/dist/es/containers/FlexLayout.vue_vue_type_script_setup_true_lang.js +4 -1
  9. package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +37 -15
  10. package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +109 -97
  11. package/dist/es/containers/Panel.vue_vue_type_script_setup_true_lang.js +7 -2
  12. package/dist/es/containers/Row.vue_vue_type_script_setup_true_lang.js +3 -0
  13. package/dist/es/containers/Step.vue_vue_type_script_setup_true_lang.js +4 -1
  14. package/dist/es/containers/Tabs.vue_vue_type_script_setup_true_lang.js +7 -0
  15. package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +7 -5
  16. package/dist/es/containers/table/useTableColumns.js +5 -13
  17. package/dist/es/containers/table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js +71 -78
  18. package/dist/es/containers/table-group-list/useAdd.js +26 -16
  19. package/dist/es/containers/table-group-list/useScrollLastItemIntoView.js +72 -0
  20. package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +1 -1
  21. package/dist/es/fields/CheckboxGroup/Index.js +5 -0
  22. package/dist/es/fields/{CheckboxGroup.vue_vue_type_script_setup_true_lang.js → CheckboxGroup/Index.vue_vue_type_script_setup_true_lang.js} +6 -7
  23. package/dist/es/fields/CheckboxGroup/effect.js +8 -0
  24. package/dist/es/fields/Date/Index.js +5 -0
  25. package/dist/es/fields/{Date.vue_vue_type_script_setup_true_lang.js → Date/Index.vue_vue_type_script_setup_true_lang.js} +5 -7
  26. package/dist/es/fields/Date/effect.js +10 -0
  27. package/dist/es/fields/DateTime/Index.js +5 -0
  28. package/dist/es/fields/{DateTime.vue_vue_type_script_setup_true_lang.js → DateTime/Index.vue_vue_type_script_setup_true_lang.js} +5 -9
  29. package/dist/es/fields/DateTime/effect.js +15 -0
  30. package/dist/es/fields/Display/Index.js +5 -0
  31. package/dist/es/fields/{Display.vue_vue_type_script_setup_true_lang.js → Display/Index.vue_vue_type_script_setup_true_lang.js} +6 -7
  32. package/dist/es/fields/Display/effect.js +8 -0
  33. package/dist/es/fields/DynamicField/Index.js +5 -0
  34. package/dist/es/fields/{DynamicField.vue_vue_type_script_setup_true_lang.js → DynamicField/Index.vue_vue_type_script_setup_true_lang.js} +11 -15
  35. package/dist/es/fields/DynamicField/effect.js +40 -0
  36. package/dist/es/fields/Link.vue_vue_type_script_setup_true_lang.js +1 -1
  37. package/dist/es/fields/Number.vue_vue_type_script_setup_true_lang.js +1 -1
  38. package/dist/es/fields/NumberRange/Index.js +5 -0
  39. package/dist/es/fields/{NumberRange.vue_vue_type_script_setup_true_lang.js → NumberRange/Index.vue_vue_type_script_setup_true_lang.js} +5 -6
  40. package/dist/es/fields/NumberRange/effect.js +8 -0
  41. package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +2 -2
  42. package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +1 -1
  43. package/dist/es/headless.js +13 -0
  44. package/dist/es/index.js +17 -12
  45. package/dist/es/plugin.js +57 -41
  46. package/dist/es/schema.js +6 -8
  47. package/dist/es/style.css +85 -1
  48. package/dist/es/submitForm.js +44 -194
  49. package/dist/es/utils/builtInFields.js +49 -0
  50. package/dist/es/utils/collectFields.js +407 -0
  51. package/dist/es/utils/config.js +1 -8
  52. package/dist/es/utils/fieldInnerConfig.js +42 -0
  53. package/dist/es/utils/fieldValueEffects.js +80 -0
  54. package/dist/es/utils/form.js +96 -43
  55. package/dist/es/utils/formStateProxy.js +75 -0
  56. package/dist/es/utils/registerField.js +158 -0
  57. package/dist/es/utils/submitHeadless.js +54 -0
  58. package/dist/es/utils/tableGroupList.js +85 -0
  59. package/dist/es/utils/typeMatch.js +17 -19
  60. package/dist/es/utils/validateError.js +57 -0
  61. package/dist/es/utils/validateValues.js +115 -0
  62. package/dist/style.css +85 -1
  63. package/dist/themes/magic-admin.css +87 -7
  64. package/dist/tmagic-form-headless.umd.cjs +4044 -0
  65. package/dist/tmagic-form.umd.cjs +1975 -874
  66. package/package.json +10 -4
  67. package/src/Form.vue +49 -149
  68. package/src/FormBox.vue +5 -4
  69. package/src/FormDialog.vue +5 -5
  70. package/src/FormDrawer.vue +5 -5
  71. package/src/containers/Col.vue +2 -0
  72. package/src/containers/Container.vue +86 -157
  73. package/src/containers/Fieldset.vue +5 -0
  74. package/src/containers/FlexLayout.vue +2 -0
  75. package/src/containers/GroupList.vue +41 -11
  76. package/src/containers/GroupListItem.vue +83 -80
  77. package/src/containers/Panel.vue +3 -0
  78. package/src/containers/Row.vue +2 -0
  79. package/src/containers/Step.vue +2 -0
  80. package/src/containers/Tabs.vue +13 -0
  81. package/src/containers/table/ActionsColumn.vue +1 -1
  82. package/src/containers/table/Table.vue +4 -3
  83. package/src/containers/table/usePagination.ts +1 -1
  84. package/src/containers/table/useSortable.ts +1 -1
  85. package/src/containers/table/useTableColumns.ts +9 -19
  86. package/src/containers/table-group-list/TableGroupList.vue +43 -71
  87. package/src/containers/table-group-list/useAdd.ts +40 -25
  88. package/src/containers/table-group-list/useScrollLastItemIntoView.ts +94 -0
  89. package/src/fields/{CheckboxGroup.vue → CheckboxGroup/Index.vue} +3 -8
  90. package/src/fields/CheckboxGroup/effect.ts +27 -0
  91. package/src/fields/{Date.vue → Date/Index.vue} +2 -5
  92. package/src/fields/Date/effect.ts +29 -0
  93. package/src/fields/{DateTime.vue → DateTime/Index.vue} +2 -16
  94. package/src/fields/DateTime/effect.ts +36 -0
  95. package/src/fields/{Display.vue → Display/Index.vue} +3 -7
  96. package/src/fields/Display/effect.ts +28 -0
  97. package/src/fields/{DynamicField.vue → DynamicField/Index.vue} +11 -11
  98. package/src/fields/DynamicField/effect.ts +74 -0
  99. package/src/fields/{NumberRange.vue → NumberRange/Index.vue} +2 -6
  100. package/src/fields/NumberRange/effect.ts +27 -0
  101. package/src/headless.ts +78 -0
  102. package/src/index.ts +32 -15
  103. package/src/plugin.ts +63 -42
  104. package/src/schema.ts +6 -8
  105. package/src/submitForm.ts +81 -409
  106. package/src/theme/form-box.scss +5 -0
  107. package/src/theme/group-list.scss +107 -1
  108. package/src/theme/themes/magic-admin/index.scss +2 -8
  109. package/src/utils/builtInFields.ts +69 -0
  110. package/src/utils/collectFields.ts +561 -0
  111. package/src/utils/config.ts +1 -15
  112. package/src/utils/fieldInnerConfig.ts +127 -0
  113. package/src/utils/fieldValueEffects.ts +140 -0
  114. package/src/utils/form.ts +141 -75
  115. package/src/utils/formStateProxy.ts +104 -0
  116. package/src/utils/registerField.ts +308 -0
  117. package/src/utils/submitHeadless.ts +206 -0
  118. package/src/utils/tableGroupList.ts +120 -0
  119. package/src/utils/typeMatch.ts +19 -15
  120. package/src/utils/validateError.ts +92 -0
  121. package/src/utils/validateValues.ts +177 -0
  122. package/types/headless.d.ts +682 -0
  123. package/types/index.d.ts +631 -272
  124. package/dist/es/fields/CheckboxGroup.js +0 -5
  125. package/dist/es/fields/Date.js +0 -5
  126. package/dist/es/fields/DateTime.js +0 -5
  127. package/dist/es/fields/Display.js +0 -5
  128. package/dist/es/fields/DynamicField.js +0 -5
  129. package/dist/es/fields/NumberRange.js +0 -5
  130. package/dist/es/utils/silentLeafFieldTypes.js +0 -49
  131. package/src/utils/silentLeafFieldTypes.ts +0 -71
@@ -0,0 +1,4044 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("dayjs"), require("dayjs/plugin/utc.js"), require("@tmagic/design/headless"), require("@tmagic/utils"), require("dayjs/plugin/customParseFormat.js"), require("async-validator")) : typeof define === "function" && define.amd ? define([
3
+ "exports",
4
+ "vue",
5
+ "dayjs",
6
+ "dayjs/plugin/utc.js",
7
+ "@tmagic/design/headless",
8
+ "@tmagic/utils",
9
+ "dayjs/plugin/customParseFormat.js",
10
+ "async-validator"
11
+ ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.TMagicFormHeadless = {}, global.Vue, global.dayjs, global.dayjs_plugin_utc_js, global._tmagic_design_headless, global._tmagic_utils, global.dayjs_plugin_customParseFormat_js, global.async_validator));
12
+ })(this, function(exports, vue, dayjs, dayjs_plugin_utc_js, _tmagic_design_headless, _tmagic_utils, dayjs_plugin_customParseFormat_js, async_validator) {
13
+ Object.defineProperty(exports, globalThis.Symbol.toStringTag, { value: "Module" });
14
+ //#region \0rolldown/runtime.js
15
+ var __create = Object.create;
16
+ var __defProp = Object.defineProperty;
17
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
+ var __getOwnPropNames = Object.getOwnPropertyNames;
19
+ var __getProtoOf = Object.getPrototypeOf;
20
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
+ key = keys[i];
24
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
+ get: ((k) => from[k]).bind(null, key),
26
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
+ });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
32
+ value: mod,
33
+ enumerable: true
34
+ }) : target, mod));
35
+ //#endregion
36
+ dayjs = __toESM(dayjs, 1);
37
+ dayjs_plugin_utc_js = __toESM(dayjs_plugin_utc_js, 1);
38
+ dayjs_plugin_customParseFormat_js = __toESM(dayjs_plugin_customParseFormat_js, 1);
39
+ async_validator = __toESM(async_validator, 1);
40
+ //#region packages/form/src/schema.ts
41
+ var FORM_DIFF_CONFIG_KEY = Symbol("mFormDiffConfig");
42
+ var FORM_TYPE_MATCH_VALID_KEY = Symbol("mFormTypeMatchValid");
43
+ /**
44
+ * 宿主业务上下文,由 `MForm`(或更外层的 Editor)通过 `provide` 下发。
45
+ *
46
+ * 嵌套表单(Link 子表单、FormBox、临时校验表单等)会自动继承最近祖先的 context,
47
+ * 无需层层透传。
48
+ *
49
+ * 配置回调统一通过 `mForm.xxx` 读取,由 formState 的读穿 Proxy 落到这里。
50
+ */
51
+ var FORM_CONTEXT_KEY = Symbol("mFormContext");
52
+ //#endregion
53
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
54
+ /** Detect free variable `global` from Node.js. */
55
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
56
+ //#endregion
57
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js
58
+ /** Detect free variable `self`. */
59
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
60
+ /** Used as a reference to the global object. */
61
+ var root = freeGlobal || freeSelf || Function("return this")();
62
+ //#endregion
63
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js
64
+ /** Built-in value references. */
65
+ var Symbol$1 = root.Symbol;
66
+ //#endregion
67
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js
68
+ /** Used for built-in method references. */
69
+ var objectProto$3 = Object.prototype;
70
+ /** Used to check objects for own properties. */
71
+ var hasOwnProperty$9 = objectProto$3.hasOwnProperty;
72
+ /**
73
+ * Used to resolve the
74
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
75
+ * of values.
76
+ */
77
+ var nativeObjectToString$1 = objectProto$3.toString;
78
+ /** Built-in value references. */
79
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
80
+ /**
81
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
82
+ *
83
+ * @private
84
+ * @param {*} value The value to query.
85
+ * @returns {string} Returns the raw `toStringTag`.
86
+ */
87
+ function getRawTag(value) {
88
+ var isOwn = hasOwnProperty$9.call(value, symToStringTag$1), tag = value[symToStringTag$1];
89
+ try {
90
+ value[symToStringTag$1] = void 0;
91
+ var unmasked = true;
92
+ } catch (e) {}
93
+ var result = nativeObjectToString$1.call(value);
94
+ if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
95
+ else delete value[symToStringTag$1];
96
+ return result;
97
+ }
98
+ //#endregion
99
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
100
+ /**
101
+ * Used to resolve the
102
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
103
+ * of values.
104
+ */
105
+ var nativeObjectToString = Object.prototype.toString;
106
+ /**
107
+ * Converts `value` to a string using `Object.prototype.toString`.
108
+ *
109
+ * @private
110
+ * @param {*} value The value to convert.
111
+ * @returns {string} Returns the converted string.
112
+ */
113
+ function objectToString(value) {
114
+ return nativeObjectToString.call(value);
115
+ }
116
+ //#endregion
117
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
118
+ /** `Object#toString` result references. */
119
+ var nullTag = "[object Null]";
120
+ var undefinedTag = "[object Undefined]";
121
+ /** Built-in value references. */
122
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
123
+ /**
124
+ * The base implementation of `getTag` without fallbacks for buggy environments.
125
+ *
126
+ * @private
127
+ * @param {*} value The value to query.
128
+ * @returns {string} Returns the `toStringTag`.
129
+ */
130
+ function baseGetTag(value) {
131
+ if (value == null) return value === void 0 ? undefinedTag : nullTag;
132
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
133
+ }
134
+ //#endregion
135
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
136
+ /**
137
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
138
+ * and has a `typeof` result of "object".
139
+ *
140
+ * @static
141
+ * @memberOf _
142
+ * @since 4.0.0
143
+ * @category Lang
144
+ * @param {*} value The value to check.
145
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
146
+ * @example
147
+ *
148
+ * _.isObjectLike({});
149
+ * // => true
150
+ *
151
+ * _.isObjectLike([1, 2, 3]);
152
+ * // => true
153
+ *
154
+ * _.isObjectLike(_.noop);
155
+ * // => false
156
+ *
157
+ * _.isObjectLike(null);
158
+ * // => false
159
+ */
160
+ function isObjectLike(value) {
161
+ return value != null && typeof value == "object";
162
+ }
163
+ //#endregion
164
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js
165
+ /**
166
+ * Checks if `value` is classified as an `Array` object.
167
+ *
168
+ * @static
169
+ * @memberOf _
170
+ * @since 0.1.0
171
+ * @category Lang
172
+ * @param {*} value The value to check.
173
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
174
+ * @example
175
+ *
176
+ * _.isArray([1, 2, 3]);
177
+ * // => true
178
+ *
179
+ * _.isArray(document.body.children);
180
+ * // => false
181
+ *
182
+ * _.isArray('abc');
183
+ * // => false
184
+ *
185
+ * _.isArray(_.noop);
186
+ * // => false
187
+ */
188
+ var isArray = Array.isArray;
189
+ //#endregion
190
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
191
+ /**
192
+ * Checks if `value` is the
193
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
194
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
195
+ *
196
+ * @static
197
+ * @memberOf _
198
+ * @since 0.1.0
199
+ * @category Lang
200
+ * @param {*} value The value to check.
201
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
202
+ * @example
203
+ *
204
+ * _.isObject({});
205
+ * // => true
206
+ *
207
+ * _.isObject([1, 2, 3]);
208
+ * // => true
209
+ *
210
+ * _.isObject(_.noop);
211
+ * // => true
212
+ *
213
+ * _.isObject(null);
214
+ * // => false
215
+ */
216
+ function isObject(value) {
217
+ var type = typeof value;
218
+ return value != null && (type == "object" || type == "function");
219
+ }
220
+ //#endregion
221
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js
222
+ /** `Object#toString` result references. */
223
+ var asyncTag = "[object AsyncFunction]";
224
+ var funcTag$2 = "[object Function]";
225
+ var genTag$1 = "[object GeneratorFunction]";
226
+ var proxyTag = "[object Proxy]";
227
+ /**
228
+ * Checks if `value` is classified as a `Function` object.
229
+ *
230
+ * @static
231
+ * @memberOf _
232
+ * @since 0.1.0
233
+ * @category Lang
234
+ * @param {*} value The value to check.
235
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
236
+ * @example
237
+ *
238
+ * _.isFunction(_);
239
+ * // => true
240
+ *
241
+ * _.isFunction(/abc/);
242
+ * // => false
243
+ */
244
+ function isFunction(value) {
245
+ if (!isObject(value)) return false;
246
+ var tag = baseGetTag(value);
247
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
248
+ }
249
+ //#endregion
250
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js
251
+ /** Used to detect overreaching core-js shims. */
252
+ var coreJsData = root["__core-js_shared__"];
253
+ //#endregion
254
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js
255
+ /** Used to detect methods masquerading as native. */
256
+ var maskSrcKey = function() {
257
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
258
+ return uid ? "Symbol(src)_1." + uid : "";
259
+ }();
260
+ /**
261
+ * Checks if `func` has its source masked.
262
+ *
263
+ * @private
264
+ * @param {Function} func The function to check.
265
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
266
+ */
267
+ function isMasked(func) {
268
+ return !!maskSrcKey && maskSrcKey in func;
269
+ }
270
+ //#endregion
271
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js
272
+ /** Used to resolve the decompiled source of functions. */
273
+ var funcToString$1 = Function.prototype.toString;
274
+ /**
275
+ * Converts `func` to its source code.
276
+ *
277
+ * @private
278
+ * @param {Function} func The function to convert.
279
+ * @returns {string} Returns the source code.
280
+ */
281
+ function toSource(func) {
282
+ if (func != null) {
283
+ try {
284
+ return funcToString$1.call(func);
285
+ } catch (e) {}
286
+ try {
287
+ return func + "";
288
+ } catch (e) {}
289
+ }
290
+ return "";
291
+ }
292
+ //#endregion
293
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js
294
+ /**
295
+ * Used to match `RegExp`
296
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
297
+ */
298
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
299
+ /** Used to detect host constructors (Safari). */
300
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
301
+ /** Used for built-in method references. */
302
+ var funcProto = Function.prototype;
303
+ var objectProto$2 = Object.prototype;
304
+ /** Used to resolve the decompiled source of functions. */
305
+ var funcToString = funcProto.toString;
306
+ /** Used to check objects for own properties. */
307
+ var hasOwnProperty$8 = objectProto$2.hasOwnProperty;
308
+ /** Used to detect if a method is native. */
309
+ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$8).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
310
+ /**
311
+ * The base implementation of `_.isNative` without bad shim checks.
312
+ *
313
+ * @private
314
+ * @param {*} value The value to check.
315
+ * @returns {boolean} Returns `true` if `value` is a native function,
316
+ * else `false`.
317
+ */
318
+ function baseIsNative(value) {
319
+ if (!isObject(value) || isMasked(value)) return false;
320
+ return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
321
+ }
322
+ //#endregion
323
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
324
+ /**
325
+ * Gets the value at `key` of `object`.
326
+ *
327
+ * @private
328
+ * @param {Object} [object] The object to query.
329
+ * @param {string} key The key of the property to get.
330
+ * @returns {*} Returns the property value.
331
+ */
332
+ function getValue(object, key) {
333
+ return object == null ? void 0 : object[key];
334
+ }
335
+ //#endregion
336
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js
337
+ /**
338
+ * Gets the native function at `key` of `object`.
339
+ *
340
+ * @private
341
+ * @param {Object} object The object to query.
342
+ * @param {string} key The key of the method to get.
343
+ * @returns {*} Returns the function if it's native, else `undefined`.
344
+ */
345
+ function getNative(object, key) {
346
+ var value = getValue(object, key);
347
+ return baseIsNative(value) ? value : void 0;
348
+ }
349
+ //#endregion
350
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js
351
+ var WeakMap = getNative(root, "WeakMap");
352
+ //#endregion
353
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js
354
+ /** Built-in value references. */
355
+ var objectCreate = Object.create;
356
+ /**
357
+ * The base implementation of `_.create` without support for assigning
358
+ * properties to the created object.
359
+ *
360
+ * @private
361
+ * @param {Object} proto The object to inherit from.
362
+ * @returns {Object} Returns the new object.
363
+ */
364
+ var baseCreate = function() {
365
+ function object() {}
366
+ return function(proto) {
367
+ if (!isObject(proto)) return {};
368
+ if (objectCreate) return objectCreate(proto);
369
+ object.prototype = proto;
370
+ var result = new object();
371
+ object.prototype = void 0;
372
+ return result;
373
+ };
374
+ }();
375
+ //#endregion
376
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js
377
+ /**
378
+ * Copies the values of `source` to `array`.
379
+ *
380
+ * @private
381
+ * @param {Array} source The array to copy values from.
382
+ * @param {Array} [array=[]] The array to copy values to.
383
+ * @returns {Array} Returns `array`.
384
+ */
385
+ function copyArray(source, array) {
386
+ var index = -1, length = source.length;
387
+ array || (array = Array(length));
388
+ while (++index < length) array[index] = source[index];
389
+ return array;
390
+ }
391
+ //#endregion
392
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js
393
+ var defineProperty = function() {
394
+ try {
395
+ var func = getNative(Object, "defineProperty");
396
+ func({}, "", {});
397
+ return func;
398
+ } catch (e) {}
399
+ }();
400
+ //#endregion
401
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js
402
+ /**
403
+ * A specialized version of `_.forEach` for arrays without support for
404
+ * iteratee shorthands.
405
+ *
406
+ * @private
407
+ * @param {Array} [array] The array to iterate over.
408
+ * @param {Function} iteratee The function invoked per iteration.
409
+ * @returns {Array} Returns `array`.
410
+ */
411
+ function arrayEach(array, iteratee) {
412
+ var index = -1, length = array == null ? 0 : array.length;
413
+ while (++index < length) if (iteratee(array[index], index, array) === false) break;
414
+ return array;
415
+ }
416
+ //#endregion
417
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js
418
+ /** Used as references for various `Number` constants. */
419
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
420
+ /** Used to detect unsigned integer values. */
421
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
422
+ /**
423
+ * Checks if `value` is a valid array-like index.
424
+ *
425
+ * @private
426
+ * @param {*} value The value to check.
427
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
428
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
429
+ */
430
+ function isIndex(value, length) {
431
+ var type = typeof value;
432
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
433
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
434
+ }
435
+ //#endregion
436
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js
437
+ /**
438
+ * The base implementation of `assignValue` and `assignMergeValue` without
439
+ * value checks.
440
+ *
441
+ * @private
442
+ * @param {Object} object The object to modify.
443
+ * @param {string} key The key of the property to assign.
444
+ * @param {*} value The value to assign.
445
+ */
446
+ function baseAssignValue(object, key, value) {
447
+ if (key == "__proto__" && defineProperty) defineProperty(object, key, {
448
+ "configurable": true,
449
+ "enumerable": true,
450
+ "value": value,
451
+ "writable": true
452
+ });
453
+ else object[key] = value;
454
+ }
455
+ //#endregion
456
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js
457
+ /**
458
+ * Performs a
459
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
460
+ * comparison between two values to determine if they are equivalent.
461
+ *
462
+ * @static
463
+ * @memberOf _
464
+ * @since 4.0.0
465
+ * @category Lang
466
+ * @param {*} value The value to compare.
467
+ * @param {*} other The other value to compare.
468
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
469
+ * @example
470
+ *
471
+ * var object = { 'a': 1 };
472
+ * var other = { 'a': 1 };
473
+ *
474
+ * _.eq(object, object);
475
+ * // => true
476
+ *
477
+ * _.eq(object, other);
478
+ * // => false
479
+ *
480
+ * _.eq('a', 'a');
481
+ * // => true
482
+ *
483
+ * _.eq('a', Object('a'));
484
+ * // => false
485
+ *
486
+ * _.eq(NaN, NaN);
487
+ * // => true
488
+ */
489
+ function eq(value, other) {
490
+ return value === other || value !== value && other !== other;
491
+ }
492
+ //#endregion
493
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js
494
+ /** Used to check objects for own properties. */
495
+ var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
496
+ /**
497
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
498
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
499
+ * for equality comparisons.
500
+ *
501
+ * @private
502
+ * @param {Object} object The object to modify.
503
+ * @param {string} key The key of the property to assign.
504
+ * @param {*} value The value to assign.
505
+ */
506
+ function assignValue(object, key, value) {
507
+ var objValue = object[key];
508
+ if (!(hasOwnProperty$7.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
509
+ }
510
+ //#endregion
511
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js
512
+ /**
513
+ * Copies properties of `source` to `object`.
514
+ *
515
+ * @private
516
+ * @param {Object} source The object to copy properties from.
517
+ * @param {Array} props The property identifiers to copy.
518
+ * @param {Object} [object={}] The object to copy properties to.
519
+ * @param {Function} [customizer] The function to customize copied values.
520
+ * @returns {Object} Returns `object`.
521
+ */
522
+ function copyObject(source, props, object, customizer) {
523
+ var isNew = !object;
524
+ object || (object = {});
525
+ var index = -1, length = props.length;
526
+ while (++index < length) {
527
+ var key = props[index];
528
+ var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
529
+ if (newValue === void 0) newValue = source[key];
530
+ if (isNew) baseAssignValue(object, key, newValue);
531
+ else assignValue(object, key, newValue);
532
+ }
533
+ return object;
534
+ }
535
+ //#endregion
536
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js
537
+ /** Used as references for various `Number` constants. */
538
+ var MAX_SAFE_INTEGER = 9007199254740991;
539
+ /**
540
+ * Checks if `value` is a valid array-like length.
541
+ *
542
+ * **Note:** This method is loosely based on
543
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
544
+ *
545
+ * @static
546
+ * @memberOf _
547
+ * @since 4.0.0
548
+ * @category Lang
549
+ * @param {*} value The value to check.
550
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
551
+ * @example
552
+ *
553
+ * _.isLength(3);
554
+ * // => true
555
+ *
556
+ * _.isLength(Number.MIN_VALUE);
557
+ * // => false
558
+ *
559
+ * _.isLength(Infinity);
560
+ * // => false
561
+ *
562
+ * _.isLength('3');
563
+ * // => false
564
+ */
565
+ function isLength(value) {
566
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
567
+ }
568
+ //#endregion
569
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js
570
+ /**
571
+ * Checks if `value` is array-like. A value is considered array-like if it's
572
+ * not a function and has a `value.length` that's an integer greater than or
573
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
574
+ *
575
+ * @static
576
+ * @memberOf _
577
+ * @since 4.0.0
578
+ * @category Lang
579
+ * @param {*} value The value to check.
580
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
581
+ * @example
582
+ *
583
+ * _.isArrayLike([1, 2, 3]);
584
+ * // => true
585
+ *
586
+ * _.isArrayLike(document.body.children);
587
+ * // => true
588
+ *
589
+ * _.isArrayLike('abc');
590
+ * // => true
591
+ *
592
+ * _.isArrayLike(_.noop);
593
+ * // => false
594
+ */
595
+ function isArrayLike(value) {
596
+ return value != null && isLength(value.length) && !isFunction(value);
597
+ }
598
+ //#endregion
599
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js
600
+ /** Used for built-in method references. */
601
+ var objectProto$1 = Object.prototype;
602
+ /**
603
+ * Checks if `value` is likely a prototype object.
604
+ *
605
+ * @private
606
+ * @param {*} value The value to check.
607
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
608
+ */
609
+ function isPrototype(value) {
610
+ var Ctor = value && value.constructor;
611
+ return value === (typeof Ctor == "function" && Ctor.prototype || objectProto$1);
612
+ }
613
+ //#endregion
614
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js
615
+ /**
616
+ * The base implementation of `_.times` without support for iteratee shorthands
617
+ * or max array length checks.
618
+ *
619
+ * @private
620
+ * @param {number} n The number of times to invoke `iteratee`.
621
+ * @param {Function} iteratee The function invoked per iteration.
622
+ * @returns {Array} Returns the array of results.
623
+ */
624
+ function baseTimes(n, iteratee) {
625
+ var index = -1, result = Array(n);
626
+ while (++index < n) result[index] = iteratee(index);
627
+ return result;
628
+ }
629
+ //#endregion
630
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js
631
+ /** `Object#toString` result references. */
632
+ var argsTag$2 = "[object Arguments]";
633
+ /**
634
+ * The base implementation of `_.isArguments`.
635
+ *
636
+ * @private
637
+ * @param {*} value The value to check.
638
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
639
+ */
640
+ function baseIsArguments(value) {
641
+ return isObjectLike(value) && baseGetTag(value) == argsTag$2;
642
+ }
643
+ //#endregion
644
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js
645
+ /** Used for built-in method references. */
646
+ var objectProto = Object.prototype;
647
+ /** Used to check objects for own properties. */
648
+ var hasOwnProperty$6 = objectProto.hasOwnProperty;
649
+ /** Built-in value references. */
650
+ var propertyIsEnumerable$1 = objectProto.propertyIsEnumerable;
651
+ /**
652
+ * Checks if `value` is likely an `arguments` object.
653
+ *
654
+ * @static
655
+ * @memberOf _
656
+ * @since 0.1.0
657
+ * @category Lang
658
+ * @param {*} value The value to check.
659
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
660
+ * else `false`.
661
+ * @example
662
+ *
663
+ * _.isArguments(function() { return arguments; }());
664
+ * // => true
665
+ *
666
+ * _.isArguments([1, 2, 3]);
667
+ * // => false
668
+ */
669
+ var isArguments = baseIsArguments(function() {
670
+ return arguments;
671
+ }()) ? baseIsArguments : function(value) {
672
+ return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
673
+ };
674
+ //#endregion
675
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js
676
+ /**
677
+ * This method returns `false`.
678
+ *
679
+ * @static
680
+ * @memberOf _
681
+ * @since 4.13.0
682
+ * @category Util
683
+ * @returns {boolean} Returns `false`.
684
+ * @example
685
+ *
686
+ * _.times(2, _.stubFalse);
687
+ * // => [false, false]
688
+ */
689
+ function stubFalse() {
690
+ return false;
691
+ }
692
+ //#endregion
693
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js
694
+ /** Detect free variable `exports`. */
695
+ var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
696
+ /** Detect free variable `module`. */
697
+ var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
698
+ /** Built-in value references. */
699
+ var Buffer$2 = freeModule$2 && freeModule$2.exports === freeExports$2 ? root.Buffer : void 0;
700
+ /**
701
+ * Checks if `value` is a buffer.
702
+ *
703
+ * @static
704
+ * @memberOf _
705
+ * @since 4.3.0
706
+ * @category Lang
707
+ * @param {*} value The value to check.
708
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
709
+ * @example
710
+ *
711
+ * _.isBuffer(new Buffer(2));
712
+ * // => true
713
+ *
714
+ * _.isBuffer(new Uint8Array(2));
715
+ * // => false
716
+ */
717
+ var isBuffer = (Buffer$2 ? Buffer$2.isBuffer : void 0) || stubFalse;
718
+ //#endregion
719
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js
720
+ /** `Object#toString` result references. */
721
+ var argsTag$1 = "[object Arguments]";
722
+ var arrayTag$1 = "[object Array]";
723
+ var boolTag$2 = "[object Boolean]";
724
+ var dateTag$2 = "[object Date]";
725
+ var errorTag$1 = "[object Error]";
726
+ var funcTag$1 = "[object Function]";
727
+ var mapTag$4 = "[object Map]";
728
+ var numberTag$2 = "[object Number]";
729
+ var objectTag$2 = "[object Object]";
730
+ var regexpTag$2 = "[object RegExp]";
731
+ var setTag$4 = "[object Set]";
732
+ var stringTag$2 = "[object String]";
733
+ var weakMapTag$2 = "[object WeakMap]";
734
+ var arrayBufferTag$2 = "[object ArrayBuffer]";
735
+ var dataViewTag$3 = "[object DataView]";
736
+ var float32Tag$2 = "[object Float32Array]";
737
+ var float64Tag$2 = "[object Float64Array]";
738
+ var int8Tag$2 = "[object Int8Array]";
739
+ var int16Tag$2 = "[object Int16Array]";
740
+ var int32Tag$2 = "[object Int32Array]";
741
+ var uint8Tag$2 = "[object Uint8Array]";
742
+ var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
743
+ var uint16Tag$2 = "[object Uint16Array]";
744
+ var uint32Tag$2 = "[object Uint32Array]";
745
+ /** Used to identify `toStringTag` values of typed arrays. */
746
+ var typedArrayTags = {};
747
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
748
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false;
749
+ /**
750
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
751
+ *
752
+ * @private
753
+ * @param {*} value The value to check.
754
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
755
+ */
756
+ function baseIsTypedArray(value) {
757
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
758
+ }
759
+ //#endregion
760
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js
761
+ /**
762
+ * The base implementation of `_.unary` without support for storing metadata.
763
+ *
764
+ * @private
765
+ * @param {Function} func The function to cap arguments for.
766
+ * @returns {Function} Returns the new capped function.
767
+ */
768
+ function baseUnary(func) {
769
+ return function(value) {
770
+ return func(value);
771
+ };
772
+ }
773
+ //#endregion
774
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js
775
+ /** Detect free variable `exports`. */
776
+ var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
777
+ /** Detect free variable `module`. */
778
+ var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
779
+ /** Detect free variable `process` from Node.js. */
780
+ var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && freeGlobal.process;
781
+ /** Used to access faster Node.js helpers. */
782
+ var nodeUtil = function() {
783
+ try {
784
+ var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
785
+ if (types) return types;
786
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
787
+ } catch (e) {}
788
+ }();
789
+ //#endregion
790
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js
791
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
792
+ /**
793
+ * Checks if `value` is classified as a typed array.
794
+ *
795
+ * @static
796
+ * @memberOf _
797
+ * @since 3.0.0
798
+ * @category Lang
799
+ * @param {*} value The value to check.
800
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
801
+ * @example
802
+ *
803
+ * _.isTypedArray(new Uint8Array);
804
+ * // => true
805
+ *
806
+ * _.isTypedArray([]);
807
+ * // => false
808
+ */
809
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
810
+ //#endregion
811
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js
812
+ /** Used to check objects for own properties. */
813
+ var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
814
+ /**
815
+ * Creates an array of the enumerable property names of the array-like `value`.
816
+ *
817
+ * @private
818
+ * @param {*} value The value to query.
819
+ * @param {boolean} inherited Specify returning inherited property names.
820
+ * @returns {Array} Returns the array of property names.
821
+ */
822
+ function arrayLikeKeys(value, inherited) {
823
+ var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
824
+ for (var key in value) if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
825
+ return result;
826
+ }
827
+ //#endregion
828
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js
829
+ /**
830
+ * Creates a unary function that invokes `func` with its argument transformed.
831
+ *
832
+ * @private
833
+ * @param {Function} func The function to wrap.
834
+ * @param {Function} transform The argument transform.
835
+ * @returns {Function} Returns the new function.
836
+ */
837
+ function overArg(func, transform) {
838
+ return function(arg) {
839
+ return func(transform(arg));
840
+ };
841
+ }
842
+ //#endregion
843
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js
844
+ var nativeKeys = overArg(Object.keys, Object);
845
+ //#endregion
846
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js
847
+ /** Used to check objects for own properties. */
848
+ var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
849
+ /**
850
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
851
+ *
852
+ * @private
853
+ * @param {Object} object The object to query.
854
+ * @returns {Array} Returns the array of property names.
855
+ */
856
+ function baseKeys(object) {
857
+ if (!isPrototype(object)) return nativeKeys(object);
858
+ var result = [];
859
+ for (var key in Object(object)) if (hasOwnProperty$4.call(object, key) && key != "constructor") result.push(key);
860
+ return result;
861
+ }
862
+ //#endregion
863
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js
864
+ /**
865
+ * Creates an array of the own enumerable property names of `object`.
866
+ *
867
+ * **Note:** Non-object values are coerced to objects. See the
868
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
869
+ * for more details.
870
+ *
871
+ * @static
872
+ * @since 0.1.0
873
+ * @memberOf _
874
+ * @category Object
875
+ * @param {Object} object The object to query.
876
+ * @returns {Array} Returns the array of property names.
877
+ * @example
878
+ *
879
+ * function Foo() {
880
+ * this.a = 1;
881
+ * this.b = 2;
882
+ * }
883
+ *
884
+ * Foo.prototype.c = 3;
885
+ *
886
+ * _.keys(new Foo);
887
+ * // => ['a', 'b'] (iteration order is not guaranteed)
888
+ *
889
+ * _.keys('hi');
890
+ * // => ['0', '1']
891
+ */
892
+ function keys(object) {
893
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
894
+ }
895
+ //#endregion
896
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js
897
+ /**
898
+ * This function is like
899
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
900
+ * except that it includes inherited enumerable properties.
901
+ *
902
+ * @private
903
+ * @param {Object} object The object to query.
904
+ * @returns {Array} Returns the array of property names.
905
+ */
906
+ function nativeKeysIn(object) {
907
+ var result = [];
908
+ if (object != null) for (var key in Object(object)) result.push(key);
909
+ return result;
910
+ }
911
+ //#endregion
912
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js
913
+ /** Used to check objects for own properties. */
914
+ var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
915
+ /**
916
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
917
+ *
918
+ * @private
919
+ * @param {Object} object The object to query.
920
+ * @returns {Array} Returns the array of property names.
921
+ */
922
+ function baseKeysIn(object) {
923
+ if (!isObject(object)) return nativeKeysIn(object);
924
+ var isProto = isPrototype(object), result = [];
925
+ for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$3.call(object, key)))) result.push(key);
926
+ return result;
927
+ }
928
+ //#endregion
929
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js
930
+ /**
931
+ * Creates an array of the own and inherited enumerable property names of `object`.
932
+ *
933
+ * **Note:** Non-object values are coerced to objects.
934
+ *
935
+ * @static
936
+ * @memberOf _
937
+ * @since 3.0.0
938
+ * @category Object
939
+ * @param {Object} object The object to query.
940
+ * @returns {Array} Returns the array of property names.
941
+ * @example
942
+ *
943
+ * function Foo() {
944
+ * this.a = 1;
945
+ * this.b = 2;
946
+ * }
947
+ *
948
+ * Foo.prototype.c = 3;
949
+ *
950
+ * _.keysIn(new Foo);
951
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
952
+ */
953
+ function keysIn(object) {
954
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
955
+ }
956
+ //#endregion
957
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js
958
+ var nativeCreate = getNative(Object, "create");
959
+ //#endregion
960
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js
961
+ /**
962
+ * Removes all key-value entries from the hash.
963
+ *
964
+ * @private
965
+ * @name clear
966
+ * @memberOf Hash
967
+ */
968
+ function hashClear() {
969
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
970
+ this.size = 0;
971
+ }
972
+ //#endregion
973
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js
974
+ /**
975
+ * Removes `key` and its value from the hash.
976
+ *
977
+ * @private
978
+ * @name delete
979
+ * @memberOf Hash
980
+ * @param {Object} hash The hash to modify.
981
+ * @param {string} key The key of the value to remove.
982
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
983
+ */
984
+ function hashDelete(key) {
985
+ var result = this.has(key) && delete this.__data__[key];
986
+ this.size -= result ? 1 : 0;
987
+ return result;
988
+ }
989
+ //#endregion
990
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js
991
+ /** Used to stand-in for `undefined` hash values. */
992
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
993
+ /** Used to check objects for own properties. */
994
+ var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
995
+ /**
996
+ * Gets the hash value for `key`.
997
+ *
998
+ * @private
999
+ * @name get
1000
+ * @memberOf Hash
1001
+ * @param {string} key The key of the value to get.
1002
+ * @returns {*} Returns the entry value.
1003
+ */
1004
+ function hashGet(key) {
1005
+ var data = this.__data__;
1006
+ if (nativeCreate) {
1007
+ var result = data[key];
1008
+ return result === HASH_UNDEFINED$1 ? void 0 : result;
1009
+ }
1010
+ return hasOwnProperty$2.call(data, key) ? data[key] : void 0;
1011
+ }
1012
+ //#endregion
1013
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js
1014
+ /** Used to check objects for own properties. */
1015
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1016
+ /**
1017
+ * Checks if a hash value for `key` exists.
1018
+ *
1019
+ * @private
1020
+ * @name has
1021
+ * @memberOf Hash
1022
+ * @param {string} key The key of the entry to check.
1023
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1024
+ */
1025
+ function hashHas(key) {
1026
+ var data = this.__data__;
1027
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty$1.call(data, key);
1028
+ }
1029
+ //#endregion
1030
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js
1031
+ /** Used to stand-in for `undefined` hash values. */
1032
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1033
+ /**
1034
+ * Sets the hash `key` to `value`.
1035
+ *
1036
+ * @private
1037
+ * @name set
1038
+ * @memberOf Hash
1039
+ * @param {string} key The key of the value to set.
1040
+ * @param {*} value The value to set.
1041
+ * @returns {Object} Returns the hash instance.
1042
+ */
1043
+ function hashSet(key, value) {
1044
+ var data = this.__data__;
1045
+ this.size += this.has(key) ? 0 : 1;
1046
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
1047
+ return this;
1048
+ }
1049
+ //#endregion
1050
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js
1051
+ /**
1052
+ * Creates a hash object.
1053
+ *
1054
+ * @private
1055
+ * @constructor
1056
+ * @param {Array} [entries] The key-value pairs to cache.
1057
+ */
1058
+ function Hash(entries) {
1059
+ var index = -1, length = entries == null ? 0 : entries.length;
1060
+ this.clear();
1061
+ while (++index < length) {
1062
+ var entry = entries[index];
1063
+ this.set(entry[0], entry[1]);
1064
+ }
1065
+ }
1066
+ Hash.prototype.clear = hashClear;
1067
+ Hash.prototype["delete"] = hashDelete;
1068
+ Hash.prototype.get = hashGet;
1069
+ Hash.prototype.has = hashHas;
1070
+ Hash.prototype.set = hashSet;
1071
+ //#endregion
1072
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js
1073
+ /**
1074
+ * Removes all key-value entries from the list cache.
1075
+ *
1076
+ * @private
1077
+ * @name clear
1078
+ * @memberOf ListCache
1079
+ */
1080
+ function listCacheClear() {
1081
+ this.__data__ = [];
1082
+ this.size = 0;
1083
+ }
1084
+ //#endregion
1085
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js
1086
+ /**
1087
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
1088
+ *
1089
+ * @private
1090
+ * @param {Array} array The array to inspect.
1091
+ * @param {*} key The key to search for.
1092
+ * @returns {number} Returns the index of the matched value, else `-1`.
1093
+ */
1094
+ function assocIndexOf(array, key) {
1095
+ var length = array.length;
1096
+ while (length--) if (eq(array[length][0], key)) return length;
1097
+ return -1;
1098
+ }
1099
+ //#endregion
1100
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js
1101
+ /** Built-in value references. */
1102
+ var splice = Array.prototype.splice;
1103
+ /**
1104
+ * Removes `key` and its value from the list cache.
1105
+ *
1106
+ * @private
1107
+ * @name delete
1108
+ * @memberOf ListCache
1109
+ * @param {string} key The key of the value to remove.
1110
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1111
+ */
1112
+ function listCacheDelete(key) {
1113
+ var data = this.__data__, index = assocIndexOf(data, key);
1114
+ if (index < 0) return false;
1115
+ if (index == data.length - 1) data.pop();
1116
+ else splice.call(data, index, 1);
1117
+ --this.size;
1118
+ return true;
1119
+ }
1120
+ //#endregion
1121
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js
1122
+ /**
1123
+ * Gets the list cache value for `key`.
1124
+ *
1125
+ * @private
1126
+ * @name get
1127
+ * @memberOf ListCache
1128
+ * @param {string} key The key of the value to get.
1129
+ * @returns {*} Returns the entry value.
1130
+ */
1131
+ function listCacheGet(key) {
1132
+ var data = this.__data__, index = assocIndexOf(data, key);
1133
+ return index < 0 ? void 0 : data[index][1];
1134
+ }
1135
+ //#endregion
1136
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js
1137
+ /**
1138
+ * Checks if a list cache value for `key` exists.
1139
+ *
1140
+ * @private
1141
+ * @name has
1142
+ * @memberOf ListCache
1143
+ * @param {string} key The key of the entry to check.
1144
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1145
+ */
1146
+ function listCacheHas(key) {
1147
+ return assocIndexOf(this.__data__, key) > -1;
1148
+ }
1149
+ //#endregion
1150
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js
1151
+ /**
1152
+ * Sets the list cache `key` to `value`.
1153
+ *
1154
+ * @private
1155
+ * @name set
1156
+ * @memberOf ListCache
1157
+ * @param {string} key The key of the value to set.
1158
+ * @param {*} value The value to set.
1159
+ * @returns {Object} Returns the list cache instance.
1160
+ */
1161
+ function listCacheSet(key, value) {
1162
+ var data = this.__data__, index = assocIndexOf(data, key);
1163
+ if (index < 0) {
1164
+ ++this.size;
1165
+ data.push([key, value]);
1166
+ } else data[index][1] = value;
1167
+ return this;
1168
+ }
1169
+ //#endregion
1170
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js
1171
+ /**
1172
+ * Creates an list cache object.
1173
+ *
1174
+ * @private
1175
+ * @constructor
1176
+ * @param {Array} [entries] The key-value pairs to cache.
1177
+ */
1178
+ function ListCache(entries) {
1179
+ var index = -1, length = entries == null ? 0 : entries.length;
1180
+ this.clear();
1181
+ while (++index < length) {
1182
+ var entry = entries[index];
1183
+ this.set(entry[0], entry[1]);
1184
+ }
1185
+ }
1186
+ ListCache.prototype.clear = listCacheClear;
1187
+ ListCache.prototype["delete"] = listCacheDelete;
1188
+ ListCache.prototype.get = listCacheGet;
1189
+ ListCache.prototype.has = listCacheHas;
1190
+ ListCache.prototype.set = listCacheSet;
1191
+ //#endregion
1192
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js
1193
+ var Map$1 = getNative(root, "Map");
1194
+ //#endregion
1195
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js
1196
+ /**
1197
+ * Removes all key-value entries from the map.
1198
+ *
1199
+ * @private
1200
+ * @name clear
1201
+ * @memberOf MapCache
1202
+ */
1203
+ function mapCacheClear() {
1204
+ this.size = 0;
1205
+ this.__data__ = {
1206
+ "hash": new Hash(),
1207
+ "map": new (Map$1 || ListCache)(),
1208
+ "string": new Hash()
1209
+ };
1210
+ }
1211
+ //#endregion
1212
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js
1213
+ /**
1214
+ * Checks if `value` is suitable for use as unique object key.
1215
+ *
1216
+ * @private
1217
+ * @param {*} value The value to check.
1218
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1219
+ */
1220
+ function isKeyable(value) {
1221
+ var type = typeof value;
1222
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1223
+ }
1224
+ //#endregion
1225
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js
1226
+ /**
1227
+ * Gets the data for `map`.
1228
+ *
1229
+ * @private
1230
+ * @param {Object} map The map to query.
1231
+ * @param {string} key The reference key.
1232
+ * @returns {*} Returns the map data.
1233
+ */
1234
+ function getMapData(map, key) {
1235
+ var data = map.__data__;
1236
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1237
+ }
1238
+ //#endregion
1239
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js
1240
+ /**
1241
+ * Removes `key` and its value from the map.
1242
+ *
1243
+ * @private
1244
+ * @name delete
1245
+ * @memberOf MapCache
1246
+ * @param {string} key The key of the value to remove.
1247
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1248
+ */
1249
+ function mapCacheDelete(key) {
1250
+ var result = getMapData(this, key)["delete"](key);
1251
+ this.size -= result ? 1 : 0;
1252
+ return result;
1253
+ }
1254
+ //#endregion
1255
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js
1256
+ /**
1257
+ * Gets the map value for `key`.
1258
+ *
1259
+ * @private
1260
+ * @name get
1261
+ * @memberOf MapCache
1262
+ * @param {string} key The key of the value to get.
1263
+ * @returns {*} Returns the entry value.
1264
+ */
1265
+ function mapCacheGet(key) {
1266
+ return getMapData(this, key).get(key);
1267
+ }
1268
+ //#endregion
1269
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js
1270
+ /**
1271
+ * Checks if a map value for `key` exists.
1272
+ *
1273
+ * @private
1274
+ * @name has
1275
+ * @memberOf MapCache
1276
+ * @param {string} key The key of the entry to check.
1277
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1278
+ */
1279
+ function mapCacheHas(key) {
1280
+ return getMapData(this, key).has(key);
1281
+ }
1282
+ //#endregion
1283
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js
1284
+ /**
1285
+ * Sets the map `key` to `value`.
1286
+ *
1287
+ * @private
1288
+ * @name set
1289
+ * @memberOf MapCache
1290
+ * @param {string} key The key of the value to set.
1291
+ * @param {*} value The value to set.
1292
+ * @returns {Object} Returns the map cache instance.
1293
+ */
1294
+ function mapCacheSet(key, value) {
1295
+ var data = getMapData(this, key), size = data.size;
1296
+ data.set(key, value);
1297
+ this.size += data.size == size ? 0 : 1;
1298
+ return this;
1299
+ }
1300
+ //#endregion
1301
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js
1302
+ /**
1303
+ * Creates a map cache object to store key-value pairs.
1304
+ *
1305
+ * @private
1306
+ * @constructor
1307
+ * @param {Array} [entries] The key-value pairs to cache.
1308
+ */
1309
+ function MapCache(entries) {
1310
+ var index = -1, length = entries == null ? 0 : entries.length;
1311
+ this.clear();
1312
+ while (++index < length) {
1313
+ var entry = entries[index];
1314
+ this.set(entry[0], entry[1]);
1315
+ }
1316
+ }
1317
+ MapCache.prototype.clear = mapCacheClear;
1318
+ MapCache.prototype["delete"] = mapCacheDelete;
1319
+ MapCache.prototype.get = mapCacheGet;
1320
+ MapCache.prototype.has = mapCacheHas;
1321
+ MapCache.prototype.set = mapCacheSet;
1322
+ //#endregion
1323
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js
1324
+ /**
1325
+ * Appends the elements of `values` to `array`.
1326
+ *
1327
+ * @private
1328
+ * @param {Array} array The array to modify.
1329
+ * @param {Array} values The values to append.
1330
+ * @returns {Array} Returns `array`.
1331
+ */
1332
+ function arrayPush(array, values) {
1333
+ var index = -1, length = values.length, offset = array.length;
1334
+ while (++index < length) array[offset + index] = values[index];
1335
+ return array;
1336
+ }
1337
+ //#endregion
1338
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js
1339
+ /** Built-in value references. */
1340
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
1341
+ //#endregion
1342
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js
1343
+ /**
1344
+ * Removes all key-value entries from the stack.
1345
+ *
1346
+ * @private
1347
+ * @name clear
1348
+ * @memberOf Stack
1349
+ */
1350
+ function stackClear() {
1351
+ this.__data__ = new ListCache();
1352
+ this.size = 0;
1353
+ }
1354
+ //#endregion
1355
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js
1356
+ /**
1357
+ * Removes `key` and its value from the stack.
1358
+ *
1359
+ * @private
1360
+ * @name delete
1361
+ * @memberOf Stack
1362
+ * @param {string} key The key of the value to remove.
1363
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1364
+ */
1365
+ function stackDelete(key) {
1366
+ var data = this.__data__, result = data["delete"](key);
1367
+ this.size = data.size;
1368
+ return result;
1369
+ }
1370
+ //#endregion
1371
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js
1372
+ /**
1373
+ * Gets the stack value for `key`.
1374
+ *
1375
+ * @private
1376
+ * @name get
1377
+ * @memberOf Stack
1378
+ * @param {string} key The key of the value to get.
1379
+ * @returns {*} Returns the entry value.
1380
+ */
1381
+ function stackGet(key) {
1382
+ return this.__data__.get(key);
1383
+ }
1384
+ //#endregion
1385
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js
1386
+ /**
1387
+ * Checks if a stack value for `key` exists.
1388
+ *
1389
+ * @private
1390
+ * @name has
1391
+ * @memberOf Stack
1392
+ * @param {string} key The key of the entry to check.
1393
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1394
+ */
1395
+ function stackHas(key) {
1396
+ return this.__data__.has(key);
1397
+ }
1398
+ //#endregion
1399
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js
1400
+ /** Used as the size to enable large array optimizations. */
1401
+ var LARGE_ARRAY_SIZE = 200;
1402
+ /**
1403
+ * Sets the stack `key` to `value`.
1404
+ *
1405
+ * @private
1406
+ * @name set
1407
+ * @memberOf Stack
1408
+ * @param {string} key The key of the value to set.
1409
+ * @param {*} value The value to set.
1410
+ * @returns {Object} Returns the stack cache instance.
1411
+ */
1412
+ function stackSet(key, value) {
1413
+ var data = this.__data__;
1414
+ if (data instanceof ListCache) {
1415
+ var pairs = data.__data__;
1416
+ if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1417
+ pairs.push([key, value]);
1418
+ this.size = ++data.size;
1419
+ return this;
1420
+ }
1421
+ data = this.__data__ = new MapCache(pairs);
1422
+ }
1423
+ data.set(key, value);
1424
+ this.size = data.size;
1425
+ return this;
1426
+ }
1427
+ //#endregion
1428
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js
1429
+ /**
1430
+ * Creates a stack cache object to store key-value pairs.
1431
+ *
1432
+ * @private
1433
+ * @constructor
1434
+ * @param {Array} [entries] The key-value pairs to cache.
1435
+ */
1436
+ function Stack(entries) {
1437
+ var data = this.__data__ = new ListCache(entries);
1438
+ this.size = data.size;
1439
+ }
1440
+ Stack.prototype.clear = stackClear;
1441
+ Stack.prototype["delete"] = stackDelete;
1442
+ Stack.prototype.get = stackGet;
1443
+ Stack.prototype.has = stackHas;
1444
+ Stack.prototype.set = stackSet;
1445
+ //#endregion
1446
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
1447
+ /**
1448
+ * The base implementation of `_.assign` without support for multiple sources
1449
+ * or `customizer` functions.
1450
+ *
1451
+ * @private
1452
+ * @param {Object} object The destination object.
1453
+ * @param {Object} source The source object.
1454
+ * @returns {Object} Returns `object`.
1455
+ */
1456
+ function baseAssign(object, source) {
1457
+ return object && copyObject(source, keys(source), object);
1458
+ }
1459
+ //#endregion
1460
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
1461
+ /**
1462
+ * The base implementation of `_.assignIn` without support for multiple sources
1463
+ * or `customizer` functions.
1464
+ *
1465
+ * @private
1466
+ * @param {Object} object The destination object.
1467
+ * @param {Object} source The source object.
1468
+ * @returns {Object} Returns `object`.
1469
+ */
1470
+ function baseAssignIn(object, source) {
1471
+ return object && copyObject(source, keysIn(source), object);
1472
+ }
1473
+ //#endregion
1474
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js
1475
+ /** Detect free variable `exports`. */
1476
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
1477
+ /** Detect free variable `module`. */
1478
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
1479
+ /** Built-in value references. */
1480
+ var Buffer$1 = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0;
1481
+ var allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : void 0;
1482
+ /**
1483
+ * Creates a clone of `buffer`.
1484
+ *
1485
+ * @private
1486
+ * @param {Buffer} buffer The buffer to clone.
1487
+ * @param {boolean} [isDeep] Specify a deep clone.
1488
+ * @returns {Buffer} Returns the cloned buffer.
1489
+ */
1490
+ function cloneBuffer(buffer, isDeep) {
1491
+ if (isDeep) return buffer.slice();
1492
+ var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1493
+ buffer.copy(result);
1494
+ return result;
1495
+ }
1496
+ //#endregion
1497
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js
1498
+ /**
1499
+ * A specialized version of `_.filter` for arrays without support for
1500
+ * iteratee shorthands.
1501
+ *
1502
+ * @private
1503
+ * @param {Array} [array] The array to iterate over.
1504
+ * @param {Function} predicate The function invoked per iteration.
1505
+ * @returns {Array} Returns the new filtered array.
1506
+ */
1507
+ function arrayFilter(array, predicate) {
1508
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
1509
+ while (++index < length) {
1510
+ var value = array[index];
1511
+ if (predicate(value, index, array)) result[resIndex++] = value;
1512
+ }
1513
+ return result;
1514
+ }
1515
+ //#endregion
1516
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js
1517
+ /**
1518
+ * This method returns a new empty array.
1519
+ *
1520
+ * @static
1521
+ * @memberOf _
1522
+ * @since 4.13.0
1523
+ * @category Util
1524
+ * @returns {Array} Returns the new empty array.
1525
+ * @example
1526
+ *
1527
+ * var arrays = _.times(2, _.stubArray);
1528
+ *
1529
+ * console.log(arrays);
1530
+ * // => [[], []]
1531
+ *
1532
+ * console.log(arrays[0] === arrays[1]);
1533
+ * // => false
1534
+ */
1535
+ function stubArray() {
1536
+ return [];
1537
+ }
1538
+ //#endregion
1539
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js
1540
+ /** Built-in value references. */
1541
+ var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
1542
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1543
+ /**
1544
+ * Creates an array of the own enumerable symbols of `object`.
1545
+ *
1546
+ * @private
1547
+ * @param {Object} object The object to query.
1548
+ * @returns {Array} Returns the array of symbols.
1549
+ */
1550
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1551
+ if (object == null) return [];
1552
+ object = Object(object);
1553
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
1554
+ return propertyIsEnumerable.call(object, symbol);
1555
+ });
1556
+ };
1557
+ //#endregion
1558
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
1559
+ /**
1560
+ * Copies own symbols of `source` to `object`.
1561
+ *
1562
+ * @private
1563
+ * @param {Object} source The object to copy symbols from.
1564
+ * @param {Object} [object={}] The object to copy symbols to.
1565
+ * @returns {Object} Returns `object`.
1566
+ */
1567
+ function copySymbols(source, object) {
1568
+ return copyObject(source, getSymbols(source), object);
1569
+ }
1570
+ //#endregion
1571
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
1572
+ /**
1573
+ * Creates an array of the own and inherited enumerable symbols of `object`.
1574
+ *
1575
+ * @private
1576
+ * @param {Object} object The object to query.
1577
+ * @returns {Array} Returns the array of symbols.
1578
+ */
1579
+ var getSymbolsIn = !Object.getOwnPropertySymbols ? stubArray : function(object) {
1580
+ var result = [];
1581
+ while (object) {
1582
+ arrayPush(result, getSymbols(object));
1583
+ object = getPrototype(object);
1584
+ }
1585
+ return result;
1586
+ };
1587
+ //#endregion
1588
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
1589
+ /**
1590
+ * Copies own and inherited symbols of `source` to `object`.
1591
+ *
1592
+ * @private
1593
+ * @param {Object} source The object to copy symbols from.
1594
+ * @param {Object} [object={}] The object to copy symbols to.
1595
+ * @returns {Object} Returns `object`.
1596
+ */
1597
+ function copySymbolsIn(source, object) {
1598
+ return copyObject(source, getSymbolsIn(source), object);
1599
+ }
1600
+ //#endregion
1601
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js
1602
+ /**
1603
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1604
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1605
+ * symbols of `object`.
1606
+ *
1607
+ * @private
1608
+ * @param {Object} object The object to query.
1609
+ * @param {Function} keysFunc The function to get the keys of `object`.
1610
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
1611
+ * @returns {Array} Returns the array of property names and symbols.
1612
+ */
1613
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1614
+ var result = keysFunc(object);
1615
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1616
+ }
1617
+ //#endregion
1618
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js
1619
+ /**
1620
+ * Creates an array of own enumerable property names and symbols of `object`.
1621
+ *
1622
+ * @private
1623
+ * @param {Object} object The object to query.
1624
+ * @returns {Array} Returns the array of property names and symbols.
1625
+ */
1626
+ function getAllKeys(object) {
1627
+ return baseGetAllKeys(object, keys, getSymbols);
1628
+ }
1629
+ //#endregion
1630
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
1631
+ /**
1632
+ * Creates an array of own and inherited enumerable property names and
1633
+ * symbols of `object`.
1634
+ *
1635
+ * @private
1636
+ * @param {Object} object The object to query.
1637
+ * @returns {Array} Returns the array of property names and symbols.
1638
+ */
1639
+ function getAllKeysIn(object) {
1640
+ return baseGetAllKeys(object, keysIn, getSymbolsIn);
1641
+ }
1642
+ //#endregion
1643
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js
1644
+ var DataView = getNative(root, "DataView");
1645
+ //#endregion
1646
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js
1647
+ var Promise$1 = getNative(root, "Promise");
1648
+ //#endregion
1649
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Set.js
1650
+ var Set$1 = getNative(root, "Set");
1651
+ //#endregion
1652
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js
1653
+ /** `Object#toString` result references. */
1654
+ var mapTag$3 = "[object Map]";
1655
+ var objectTag$1 = "[object Object]";
1656
+ var promiseTag = "[object Promise]";
1657
+ var setTag$3 = "[object Set]";
1658
+ var weakMapTag$1 = "[object WeakMap]";
1659
+ var dataViewTag$2 = "[object DataView]";
1660
+ /** Used to detect maps, sets, and weakmaps. */
1661
+ var dataViewCtorString = toSource(DataView);
1662
+ var mapCtorString = toSource(Map$1);
1663
+ var promiseCtorString = toSource(Promise$1);
1664
+ var setCtorString = toSource(Set$1);
1665
+ var weakMapCtorString = toSource(WeakMap);
1666
+ /**
1667
+ * Gets the `toStringTag` of `value`.
1668
+ *
1669
+ * @private
1670
+ * @param {*} value The value to query.
1671
+ * @returns {string} Returns the `toStringTag`.
1672
+ */
1673
+ var getTag = baseGetTag;
1674
+ if (DataView && getTag(new DataView(/* @__PURE__ */ new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag(new Map$1()) != mapTag$3 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$3 || WeakMap && getTag(new WeakMap()) != weakMapTag$1) getTag = function(value) {
1675
+ var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1676
+ if (ctorString) switch (ctorString) {
1677
+ case dataViewCtorString: return dataViewTag$2;
1678
+ case mapCtorString: return mapTag$3;
1679
+ case promiseCtorString: return promiseTag;
1680
+ case setCtorString: return setTag$3;
1681
+ case weakMapCtorString: return weakMapTag$1;
1682
+ }
1683
+ return result;
1684
+ };
1685
+ var _getTag_default = getTag;
1686
+ //#endregion
1687
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
1688
+ /** Used to check objects for own properties. */
1689
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1690
+ /**
1691
+ * Initializes an array clone.
1692
+ *
1693
+ * @private
1694
+ * @param {Array} array The array to clone.
1695
+ * @returns {Array} Returns the initialized clone.
1696
+ */
1697
+ function initCloneArray(array) {
1698
+ var length = array.length, result = new array.constructor(length);
1699
+ if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
1700
+ result.index = array.index;
1701
+ result.input = array.input;
1702
+ }
1703
+ return result;
1704
+ }
1705
+ //#endregion
1706
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js
1707
+ /** Built-in value references. */
1708
+ var Uint8Array$1 = root.Uint8Array;
1709
+ //#endregion
1710
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js
1711
+ /**
1712
+ * Creates a clone of `arrayBuffer`.
1713
+ *
1714
+ * @private
1715
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
1716
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
1717
+ */
1718
+ function cloneArrayBuffer(arrayBuffer) {
1719
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1720
+ new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
1721
+ return result;
1722
+ }
1723
+ //#endregion
1724
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js
1725
+ /**
1726
+ * Creates a clone of `dataView`.
1727
+ *
1728
+ * @private
1729
+ * @param {Object} dataView The data view to clone.
1730
+ * @param {boolean} [isDeep] Specify a deep clone.
1731
+ * @returns {Object} Returns the cloned data view.
1732
+ */
1733
+ function cloneDataView(dataView, isDeep) {
1734
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
1735
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
1736
+ }
1737
+ //#endregion
1738
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js
1739
+ /** Used to match `RegExp` flags from their coerced string values. */
1740
+ var reFlags = /\w*$/;
1741
+ /**
1742
+ * Creates a clone of `regexp`.
1743
+ *
1744
+ * @private
1745
+ * @param {Object} regexp The regexp to clone.
1746
+ * @returns {Object} Returns the cloned regexp.
1747
+ */
1748
+ function cloneRegExp(regexp) {
1749
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
1750
+ result.lastIndex = regexp.lastIndex;
1751
+ return result;
1752
+ }
1753
+ //#endregion
1754
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js
1755
+ /** Used to convert symbols to primitives and strings. */
1756
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
1757
+ var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1758
+ /**
1759
+ * Creates a clone of the `symbol` object.
1760
+ *
1761
+ * @private
1762
+ * @param {Object} symbol The symbol object to clone.
1763
+ * @returns {Object} Returns the cloned symbol object.
1764
+ */
1765
+ function cloneSymbol(symbol) {
1766
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
1767
+ }
1768
+ //#endregion
1769
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js
1770
+ /**
1771
+ * Creates a clone of `typedArray`.
1772
+ *
1773
+ * @private
1774
+ * @param {Object} typedArray The typed array to clone.
1775
+ * @param {boolean} [isDeep] Specify a deep clone.
1776
+ * @returns {Object} Returns the cloned typed array.
1777
+ */
1778
+ function cloneTypedArray(typedArray, isDeep) {
1779
+ var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
1780
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1781
+ }
1782
+ //#endregion
1783
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js
1784
+ /** `Object#toString` result references. */
1785
+ var boolTag$1 = "[object Boolean]";
1786
+ var dateTag$1 = "[object Date]";
1787
+ var mapTag$2 = "[object Map]";
1788
+ var numberTag$1 = "[object Number]";
1789
+ var regexpTag$1 = "[object RegExp]";
1790
+ var setTag$2 = "[object Set]";
1791
+ var stringTag$1 = "[object String]";
1792
+ var symbolTag$1 = "[object Symbol]";
1793
+ var arrayBufferTag$1 = "[object ArrayBuffer]";
1794
+ var dataViewTag$1 = "[object DataView]";
1795
+ var float32Tag$1 = "[object Float32Array]";
1796
+ var float64Tag$1 = "[object Float64Array]";
1797
+ var int8Tag$1 = "[object Int8Array]";
1798
+ var int16Tag$1 = "[object Int16Array]";
1799
+ var int32Tag$1 = "[object Int32Array]";
1800
+ var uint8Tag$1 = "[object Uint8Array]";
1801
+ var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
1802
+ var uint16Tag$1 = "[object Uint16Array]";
1803
+ var uint32Tag$1 = "[object Uint32Array]";
1804
+ /**
1805
+ * Initializes an object clone based on its `toStringTag`.
1806
+ *
1807
+ * **Note:** This function only supports cloning values with tags of
1808
+ * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
1809
+ *
1810
+ * @private
1811
+ * @param {Object} object The object to clone.
1812
+ * @param {string} tag The `toStringTag` of the object to clone.
1813
+ * @param {boolean} [isDeep] Specify a deep clone.
1814
+ * @returns {Object} Returns the initialized clone.
1815
+ */
1816
+ function initCloneByTag(object, tag, isDeep) {
1817
+ var Ctor = object.constructor;
1818
+ switch (tag) {
1819
+ case arrayBufferTag$1: return cloneArrayBuffer(object);
1820
+ case boolTag$1:
1821
+ case dateTag$1: return new Ctor(+object);
1822
+ case dataViewTag$1: return cloneDataView(object, isDeep);
1823
+ case float32Tag$1:
1824
+ case float64Tag$1:
1825
+ case int8Tag$1:
1826
+ case int16Tag$1:
1827
+ case int32Tag$1:
1828
+ case uint8Tag$1:
1829
+ case uint8ClampedTag$1:
1830
+ case uint16Tag$1:
1831
+ case uint32Tag$1: return cloneTypedArray(object, isDeep);
1832
+ case mapTag$2: return new Ctor();
1833
+ case numberTag$1:
1834
+ case stringTag$1: return new Ctor(object);
1835
+ case regexpTag$1: return cloneRegExp(object);
1836
+ case setTag$2: return new Ctor();
1837
+ case symbolTag$1: return cloneSymbol(object);
1838
+ }
1839
+ }
1840
+ //#endregion
1841
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js
1842
+ /**
1843
+ * Initializes an object clone.
1844
+ *
1845
+ * @private
1846
+ * @param {Object} object The object to clone.
1847
+ * @returns {Object} Returns the initialized clone.
1848
+ */
1849
+ function initCloneObject(object) {
1850
+ return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
1851
+ }
1852
+ //#endregion
1853
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
1854
+ /** `Object#toString` result references. */
1855
+ var mapTag$1 = "[object Map]";
1856
+ /**
1857
+ * The base implementation of `_.isMap` without Node.js optimizations.
1858
+ *
1859
+ * @private
1860
+ * @param {*} value The value to check.
1861
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
1862
+ */
1863
+ function baseIsMap(value) {
1864
+ return isObjectLike(value) && _getTag_default(value) == mapTag$1;
1865
+ }
1866
+ //#endregion
1867
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
1868
+ var nodeIsMap = nodeUtil && nodeUtil.isMap;
1869
+ /**
1870
+ * Checks if `value` is classified as a `Map` object.
1871
+ *
1872
+ * @static
1873
+ * @memberOf _
1874
+ * @since 4.3.0
1875
+ * @category Lang
1876
+ * @param {*} value The value to check.
1877
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
1878
+ * @example
1879
+ *
1880
+ * _.isMap(new Map);
1881
+ * // => true
1882
+ *
1883
+ * _.isMap(new WeakMap);
1884
+ * // => false
1885
+ */
1886
+ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
1887
+ //#endregion
1888
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js
1889
+ /** `Object#toString` result references. */
1890
+ var setTag$1 = "[object Set]";
1891
+ /**
1892
+ * The base implementation of `_.isSet` without Node.js optimizations.
1893
+ *
1894
+ * @private
1895
+ * @param {*} value The value to check.
1896
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
1897
+ */
1898
+ function baseIsSet(value) {
1899
+ return isObjectLike(value) && _getTag_default(value) == setTag$1;
1900
+ }
1901
+ //#endregion
1902
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
1903
+ var nodeIsSet = nodeUtil && nodeUtil.isSet;
1904
+ /**
1905
+ * Checks if `value` is classified as a `Set` object.
1906
+ *
1907
+ * @static
1908
+ * @memberOf _
1909
+ * @since 4.3.0
1910
+ * @category Lang
1911
+ * @param {*} value The value to check.
1912
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
1913
+ * @example
1914
+ *
1915
+ * _.isSet(new Set);
1916
+ * // => true
1917
+ *
1918
+ * _.isSet(new WeakSet);
1919
+ * // => false
1920
+ */
1921
+ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
1922
+ //#endregion
1923
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js
1924
+ /** Used to compose bitmasks for cloning. */
1925
+ var CLONE_DEEP_FLAG$1 = 1;
1926
+ var CLONE_FLAT_FLAG = 2;
1927
+ var CLONE_SYMBOLS_FLAG$1 = 4;
1928
+ /** `Object#toString` result references. */
1929
+ var argsTag = "[object Arguments]";
1930
+ var arrayTag = "[object Array]";
1931
+ var boolTag = "[object Boolean]";
1932
+ var dateTag = "[object Date]";
1933
+ var errorTag = "[object Error]";
1934
+ var funcTag = "[object Function]";
1935
+ var genTag = "[object GeneratorFunction]";
1936
+ var mapTag = "[object Map]";
1937
+ var numberTag = "[object Number]";
1938
+ var objectTag = "[object Object]";
1939
+ var regexpTag = "[object RegExp]";
1940
+ var setTag = "[object Set]";
1941
+ var stringTag = "[object String]";
1942
+ var symbolTag = "[object Symbol]";
1943
+ var weakMapTag = "[object WeakMap]";
1944
+ var arrayBufferTag = "[object ArrayBuffer]";
1945
+ var dataViewTag = "[object DataView]";
1946
+ var float32Tag = "[object Float32Array]";
1947
+ var float64Tag = "[object Float64Array]";
1948
+ var int8Tag = "[object Int8Array]";
1949
+ var int16Tag = "[object Int16Array]";
1950
+ var int32Tag = "[object Int32Array]";
1951
+ var uint8Tag = "[object Uint8Array]";
1952
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
1953
+ var uint16Tag = "[object Uint16Array]";
1954
+ var uint32Tag = "[object Uint32Array]";
1955
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
1956
+ var cloneableTags = {};
1957
+ cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
1958
+ cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
1959
+ /**
1960
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
1961
+ * traversed objects.
1962
+ *
1963
+ * @private
1964
+ * @param {*} value The value to clone.
1965
+ * @param {boolean} bitmask The bitmask flags.
1966
+ * 1 - Deep clone
1967
+ * 2 - Flatten inherited properties
1968
+ * 4 - Clone symbols
1969
+ * @param {Function} [customizer] The function to customize cloning.
1970
+ * @param {string} [key] The key of `value`.
1971
+ * @param {Object} [object] The parent object of `value`.
1972
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
1973
+ * @returns {*} Returns the cloned value.
1974
+ */
1975
+ function baseClone(value, bitmask, customizer, key, object, stack) {
1976
+ var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
1977
+ if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
1978
+ if (result !== void 0) return result;
1979
+ if (!isObject(value)) return value;
1980
+ var isArr = isArray(value);
1981
+ if (isArr) {
1982
+ result = initCloneArray(value);
1983
+ if (!isDeep) return copyArray(value, result);
1984
+ } else {
1985
+ var tag = _getTag_default(value), isFunc = tag == funcTag || tag == genTag;
1986
+ if (isBuffer(value)) return cloneBuffer(value, isDeep);
1987
+ if (tag == objectTag || tag == argsTag || isFunc && !object) {
1988
+ result = isFlat || isFunc ? {} : initCloneObject(value);
1989
+ if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
1990
+ } else {
1991
+ if (!cloneableTags[tag]) return object ? value : {};
1992
+ result = initCloneByTag(value, tag, isDeep);
1993
+ }
1994
+ }
1995
+ stack || (stack = new Stack());
1996
+ var stacked = stack.get(value);
1997
+ if (stacked) return stacked;
1998
+ stack.set(value, result);
1999
+ if (isSet(value)) value.forEach(function(subValue) {
2000
+ result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
2001
+ });
2002
+ else if (isMap(value)) value.forEach(function(subValue, key) {
2003
+ result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
2004
+ });
2005
+ var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
2006
+ arrayEach(props || value, function(subValue, key) {
2007
+ if (props) {
2008
+ key = subValue;
2009
+ subValue = value[key];
2010
+ }
2011
+ assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
2012
+ });
2013
+ return result;
2014
+ }
2015
+ //#endregion
2016
+ //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js
2017
+ /** Used to compose bitmasks for cloning. */
2018
+ var CLONE_DEEP_FLAG = 1;
2019
+ var CLONE_SYMBOLS_FLAG = 4;
2020
+ /**
2021
+ * This method is like `_.clone` except that it recursively clones `value`.
2022
+ *
2023
+ * @static
2024
+ * @memberOf _
2025
+ * @since 1.0.0
2026
+ * @category Lang
2027
+ * @param {*} value The value to recursively clone.
2028
+ * @returns {*} Returns the deep cloned value.
2029
+ * @see _.clone
2030
+ * @example
2031
+ *
2032
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
2033
+ *
2034
+ * var deep = _.cloneDeep(objects);
2035
+ * console.log(deep[0] === objects[0]);
2036
+ * // => false
2037
+ */
2038
+ function cloneDeep(value) {
2039
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
2040
+ }
2041
+ //#endregion
2042
+ //#region packages/form/src/utils/config.ts
2043
+ var $MAGIC_FORM = {};
2044
+ (0, vue.ref)(false);
2045
+ var getConfig = (key) => $MAGIC_FORM[key];
2046
+ //#endregion
2047
+ //#region packages/form/src/utils/typeMatch.ts
2048
+ dayjs.default.extend(dayjs_plugin_customParseFormat_js.default);
2049
+ var extraTypeMatchRules = /* @__PURE__ */ new Map();
2050
+ var builtInTypeMatchRules = /* @__PURE__ */ new Map();
2051
+ var isPromise = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
2052
+ /** 注册或覆盖某个字段 type 的 typeMatch 校验规则。`builtIn` 登记不受 `clearTypeMatchRules` / `deleteTypeMatchRule` 影响。 */
2053
+ var registerTypeMatchRule = (type, validator, builtIn = false) => {
2054
+ (builtIn ? builtInTypeMatchRules : extraTypeMatchRules).set((0, _tmagic_utils.toLine)(type), validator);
2055
+ };
2056
+ /** 获取某个字段 type 的 typeMatch 校验规则(业务侧优先于内置) */
2057
+ var getTypeMatchRule = (type) => {
2058
+ const key = (0, _tmagic_utils.toLine)(type);
2059
+ return extraTypeMatchRules.get(key) ?? builtInTypeMatchRules.get(key);
2060
+ };
2061
+ /** 删除业务侧 typeMatch 校验规则(不影响内置) */
2062
+ var deleteTypeMatchRule = (type) => extraTypeMatchRules.delete((0, _tmagic_utils.toLine)(type));
2063
+ /** 清空业务侧 typeMatch 校验规则(不影响内置) */
2064
+ var clearTypeMatchRules = () => {
2065
+ extraTypeMatchRules.clear();
2066
+ };
2067
+ /** 本地解析配置函数,避免与 form.ts 循环依赖 */
2068
+ var resolveConfig = (mForm, config, props) => {
2069
+ if (typeof config === "function") return config(mForm, {
2070
+ values: (0, vue.readonly)(mForm?.initValues || {}),
2071
+ model: (0, vue.readonly)(props.model),
2072
+ parent: (0, vue.readonly)(mForm?.parentValues || {}),
2073
+ formValue: (0, vue.readonly)(mForm?.values || props.model),
2074
+ prop: props.prop,
2075
+ config: props.config,
2076
+ index: props.index,
2077
+ getFormValue: (prop) => (0, _tmagic_utils.getValueByKeyPath)(prop, mForm?.values || props.model)
2078
+ });
2079
+ return config;
2080
+ };
2081
+ var SKIP_TYPES = /* @__PURE__ */ new Set([
2082
+ "display",
2083
+ "hidden",
2084
+ "row",
2085
+ "tab",
2086
+ "dynamic-tab",
2087
+ "fieldset",
2088
+ "panel",
2089
+ "step",
2090
+ "flex-layout",
2091
+ "link",
2092
+ "component",
2093
+ "dynamic-field",
2094
+ "dynamicfield",
2095
+ "form",
2096
+ "container"
2097
+ ]);
2098
+ var STRING_TYPES = /* @__PURE__ */ new Set([
2099
+ "text",
2100
+ "textarea",
2101
+ "color-picker",
2102
+ "html",
2103
+ ""
2104
+ ]);
2105
+ var DATE_LIKE_TYPES = /* @__PURE__ */ new Set([
2106
+ "date",
2107
+ "datetime",
2108
+ "time"
2109
+ ]);
2110
+ var DATE_LIKE_DEFAULT_VALUE_FORMAT = {
2111
+ date: "YYYY/MM/DD",
2112
+ datetime: "YYYY/MM/DD HH:mm:ss",
2113
+ time: "HH:mm:ss",
2114
+ daterange: "YYYY/MM/DD HH:mm:ss",
2115
+ timerange: "HH:mm:ss"
2116
+ };
2117
+ var TIMESTAMP_VALUE_FORMATS = /* @__PURE__ */ new Set(["x", "timestamp"]);
2118
+ /**
2119
+ * 将值格式化为可读的参考示例字符串。
2120
+ */
2121
+ var stringifyExampleValue = (value) => {
2122
+ if (typeof value === "string") return `"${value}"`;
2123
+ if (value === null || value === void 0) return String(value);
2124
+ if (typeof value === "object") try {
2125
+ return JSON.stringify(value);
2126
+ } catch {
2127
+ return String(value);
2128
+ }
2129
+ return String(value);
2130
+ };
2131
+ /** 参考建议中可选值全量展示上限;超出时仅举例 EXAMPLE_SUGGESTION_COUNT 个并标明总数。 */
2132
+ var MAX_SUGGESTION_OPTIONS = 20;
2133
+ var EXAMPLE_SUGGESTION_COUNT = 5;
2134
+ /**
2135
+ * 生成可选项参考建议;无可选值时返回空字符串(不追加建议)。
2136
+ * 未超过 MAX_SUGGESTION_OPTIONS 时全部列举;超过时仅举例前 EXAMPLE_SUGGESTION_COUNT 个并标明总数,避免 AI 误以为仅有举例值合法。
2137
+ */
2138
+ var optionSuggestion = (optionValues) => {
2139
+ const values = optionValues.filter((item) => typeof item !== "undefined");
2140
+ if (!values.length) return "";
2141
+ const truncated = values.length > 20;
2142
+ const shown = values.slice(0, truncated ? EXAMPLE_SUGGESTION_COUNT : values.length).map(stringifyExampleValue);
2143
+ if (truncated) return `请从可选项中选用合法值(共 ${values.length} 个,例如:${shown.join(";")})`;
2144
+ return `请使用以下某一个值:${shown.join(";")}`;
2145
+ };
2146
+ /**
2147
+ * 基于真实 options 生成类型不匹配场景的「参考示例值」。
2148
+ *
2149
+ * - expectArray 为 true 时,取前若干个真实可选值组成数组示例;
2150
+ * - 否则取第一个真实可选值作为标量示例。
2151
+ * 无可用 options 时回退到通用示例。
2152
+ */
2153
+ var optionExampleSuggestion = (optionValues, fallbackExample, expectArray) => {
2154
+ const values = optionValues.filter((item) => typeof item !== "undefined");
2155
+ if (!values.length) return `请参考以下示例值:${fallbackExample}`;
2156
+ return `请参考以下示例值:${expectArray ? stringifyExampleValue(values.slice(0, 2)) : stringifyExampleValue(values[0])}`;
2157
+ };
2158
+ /**
2159
+ * 生成开关类字段的参考建议,列出合法的开关值。
2160
+ */
2161
+ var toggleSuggestion = (activeValue, inactiveValue) => `请使用以下某一个值:${stringifyExampleValue(activeValue)};${stringifyExampleValue(inactiveValue)}`;
2162
+ /**
2163
+ * 解析字段配置中的真实默认值(defaultValue),用于生成「真实」的参考示例值。
2164
+ * defaultValue 可能是函数,交由 resolveConfig 处理;未配置时返回 undefined。
2165
+ */
2166
+ var resolveFieldDefaultValue = (mForm, props) => {
2167
+ const { defaultValue } = props.config || {};
2168
+ if (typeof defaultValue === "undefined" || defaultValue === "undefined") return void 0;
2169
+ const resolvedDefaultValue = resolveConfig(mForm, defaultValue, props);
2170
+ if (isPromise(resolvedDefaultValue)) return;
2171
+ return resolvedDefaultValue;
2172
+ };
2173
+ var isNumberValue = (value) => typeof value === "number" && !Number.isNaN(value);
2174
+ var isStringValue = (value) => typeof value === "string";
2175
+ var isObjectValue = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2176
+ var isObjectArrayValue = (value) => Array.isArray(value) && value.every((item) => isObjectValue(item));
2177
+ var isNumberRangeValue = (value) => Array.isArray(value) && value.length === 2 && value.every((item) => isNumberValue(item));
2178
+ /**
2179
+ * 生成类型不匹配场景的「参考示例值」。
2180
+ *
2181
+ * 优先使用字段配置的真实默认值(defaultValue,需符合期望类型);无可用默认值时回退到通用示例。
2182
+ */
2183
+ var typeExampleSuggestion = (mForm, props, fallbackExample, isValid) => {
2184
+ const defaultValue = resolveFieldDefaultValue(mForm, props);
2185
+ return `请参考以下示例值:${typeof defaultValue !== "undefined" && isValid(defaultValue) ? stringifyExampleValue(defaultValue) : fallbackExample}`;
2186
+ };
2187
+ /**
2188
+ * 返回最终错误文案。
2189
+ *
2190
+ * - 传入了自定义 `message` 时,直接使用自定义文案(不追加建议);
2191
+ * - 否则使用默认文案 `fallback`,并在其后拼接「参考建议」。
2192
+ * 参考建议给出一个可参考的示例值(如可选项列表、示例数据),仅用于错误汇总展示;
2193
+ * form-item 行内错误不展示建议(由 @tmagic/design FormItem 在渲染时截断建议)。
2194
+ * 主文案与建议的拼接/截断统一复用 @tmagic/design 的 `appendValidateSuggestion`。
2195
+ */
2196
+ var defaultMessage = (message, fallback, suggestion) => {
2197
+ if (message) return message;
2198
+ return (0, _tmagic_design_headless.appendValidateSuggestion)(fallback, suggestion);
2199
+ };
2200
+ var isEmptyValue = (value) => value === void 0 || value === null || value === "";
2201
+ var isEmptyArray = (value) => Array.isArray(value) && value.length === 0;
2202
+ var resolveDateValueFormat = (fieldType, config) => config.valueFormat || DATE_LIKE_DEFAULT_VALUE_FORMAT[fieldType] || "YYYY/MM/DD HH:mm:ss";
2203
+ var isTimestampValueFormat = (valueFormat) => TIMESTAMP_VALUE_FORMATS.has(valueFormat);
2204
+ var isValidDateValueByFormat = (value, valueFormat) => {
2205
+ if (isTimestampValueFormat(valueFormat)) return typeof value === "number" && !Number.isNaN(value);
2206
+ if (typeof value !== "string") return false;
2207
+ return (0, dayjs.default)(value, valueFormat, true).isValid();
2208
+ };
2209
+ /**
2210
+ * 生成单个日期类字段的参考示例值:时间戳格式给出当前时间戳,其余按 valueFormat 格式化当前时间。
2211
+ */
2212
+ var dateSuggestion = (valueFormat) => isTimestampValueFormat(valueFormat) ? `请参考以下示例值:${Date.now()}` : `请参考以下示例值:"${(0, dayjs.default)().format(valueFormat)}"`;
2213
+ /**
2214
+ * 生成日期范围类字段的参考示例值(长度为 2 的数组)。
2215
+ */
2216
+ var dateRangeSuggestion = (valueFormat) => {
2217
+ if (isTimestampValueFormat(valueFormat)) return `请参考以下示例值:[${Date.now()}, ${Date.now()}]`;
2218
+ const example = (0, dayjs.default)().format(valueFormat);
2219
+ return `请参考以下示例值:["${example}", "${example}"]`;
2220
+ };
2221
+ var dateValueFormatErrorMessage = (message, valueFormat) => defaultMessage(message, isTimestampValueFormat(valueFormat) ? "值类型应为时间戳数字" : `值格式应为 ${valueFormat}`, dateSuggestion(valueFormat));
2222
+ var resolveToggleValues = (config) => {
2223
+ const filterIsNumber = config.filter === "number";
2224
+ const { activeValue: configActiveValue, inactiveValue: configInactiveValue } = config;
2225
+ let activeValue = configActiveValue;
2226
+ let inactiveValue = configInactiveValue;
2227
+ if (typeof activeValue === "undefined") activeValue = filterIsNumber ? 1 : true;
2228
+ if (typeof inactiveValue === "undefined") inactiveValue = filterIsNumber ? 0 : false;
2229
+ return {
2230
+ activeValue,
2231
+ inactiveValue
2232
+ };
2233
+ };
2234
+ var flattenSelectOptions = (options) => {
2235
+ const values = [];
2236
+ options.forEach((option) => {
2237
+ if (Array.isArray(option?.options)) {
2238
+ option.options.forEach((child) => {
2239
+ if (typeof child?.value !== "undefined") values.push(child.value);
2240
+ });
2241
+ return;
2242
+ }
2243
+ if (typeof option?.value !== "undefined") values.push(option.value);
2244
+ });
2245
+ return values;
2246
+ };
2247
+ var resolveOptions = (props) => {
2248
+ const { options } = props.config || {};
2249
+ return Array.isArray(options) ? options : [];
2250
+ };
2251
+ var includesOptionValue = (optionValues, value) => optionValues.some((item) => Object.is(item, value));
2252
+ var collectCascaderLeafValues = (options, result = []) => {
2253
+ options.forEach((option) => {
2254
+ if (option.children?.length) collectCascaderLeafValues(option.children, result);
2255
+ else if (typeof option.value !== "undefined") result.push(option.value);
2256
+ });
2257
+ return result;
2258
+ };
2259
+ var isValidCascaderPath = (options, path) => {
2260
+ if (!path.length) return false;
2261
+ let currentOptions = options;
2262
+ for (let i = 0; i < path.length; i++) {
2263
+ const node = currentOptions.find((option) => Object.is(option.value, path[i]));
2264
+ if (!node) return false;
2265
+ if (i === path.length - 1) return true;
2266
+ currentOptions = node.children || [];
2267
+ }
2268
+ return false;
2269
+ };
2270
+ /**
2271
+ * 取 cascader options 的第一条完整路径(从顶层到叶子的 value 数组)。
2272
+ */
2273
+ var firstCascaderPath = (options) => {
2274
+ const path = [];
2275
+ let current = options;
2276
+ while (current?.length) {
2277
+ const node = current[0];
2278
+ if (typeof node.value === "undefined") break;
2279
+ path.push(node.value);
2280
+ current = node.children;
2281
+ }
2282
+ return path;
2283
+ };
2284
+ /**
2285
+ * 基于真实 cascader options 生成类型不匹配场景的「参考示例值」。
2286
+ *
2287
+ * 依据 valueSeparator / multiple / emitPath 组织真实选中值的形态;无可用 options 时回退到通用示例。
2288
+ */
2289
+ var cascaderExampleSuggestion = (options, config, valueSeparator, fallbackExample) => {
2290
+ const path = firstCascaderPath(options);
2291
+ if (!path.length) return `请参考以下示例值:${fallbackExample}`;
2292
+ const emitPath = config.emitPath !== false;
2293
+ const multiple = Boolean(config.multiple);
2294
+ const single = emitPath ? path : path[path.length - 1];
2295
+ let example;
2296
+ if (valueSeparator) example = path.join(valueSeparator);
2297
+ else if (multiple) example = [single];
2298
+ else example = single;
2299
+ return `请参考以下示例值:${stringifyExampleValue(example)}`;
2300
+ };
2301
+ var validateSelectValue = (value, config, optionValues, message) => {
2302
+ if (optionValues.length === 0) return;
2303
+ if (config.allowCreate || config.remote) {
2304
+ if (config.multiple) {
2305
+ if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, optionExampleSuggestion(optionValues, "[\"选项1\", \"选项2\"]", true));
2306
+ return;
2307
+ }
2308
+ if (typeof value === "object") return defaultMessage(message, `${value} 类型不合法`, optionExampleSuggestion(optionValues, "\"文本内容\" 或 123", false));
2309
+ return;
2310
+ }
2311
+ const isStaticOptions = Array.isArray(config.options);
2312
+ if (config.multiple) {
2313
+ if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, optionExampleSuggestion(optionValues, "[\"选项1\", \"选项2\"]", true));
2314
+ if (isStaticOptions && value.some((item) => !includesOptionValue(optionValues, item))) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
2315
+ return;
2316
+ }
2317
+ if (isStaticOptions && !includesOptionValue(optionValues, value)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
2318
+ };
2319
+ var validateCascaderValue = (value, config, props, mForm, message) => {
2320
+ const options = resolveOptions(props);
2321
+ if (!options.length) return;
2322
+ const valueSeparator = resolveConfig(mForm, config.valueSeparator, props);
2323
+ if (isPromise(valueSeparator)) return;
2324
+ const emitPath = config.emitPath !== false;
2325
+ const multiple = Boolean(config.multiple);
2326
+ const cascaderExample = (fallbackExample) => cascaderExampleSuggestion(options, config, valueSeparator, fallbackExample);
2327
+ if (valueSeparator) {
2328
+ if (typeof value !== "string" && !Array.isArray(value)) return defaultMessage(message, `${value} 类型应为字符串或数组`, cascaderExample("\"选项1,选项2\" 或 [\"选项1\", \"选项2\"]"));
2329
+ } else if (multiple) {
2330
+ if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, cascaderExample("[\"选项1\", \"选项2\"]"));
2331
+ } else if (emitPath && !Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, cascaderExample("[\"选项1\", \"选项2\"]"));
2332
+ if (config.remote) return;
2333
+ if (!options.length) return;
2334
+ const normalizedValue = typeof value === "string" && valueSeparator ? value.split(valueSeparator) : value;
2335
+ if (multiple) {
2336
+ if (!Array.isArray(normalizedValue)) return defaultMessage(message, `${value} 类型应为数组`, cascaderExample("[\"选项1\", \"选项2\"]"));
2337
+ if (normalizedValue.some((item) => {
2338
+ if (emitPath) return !Array.isArray(item) || !isValidCascaderPath(options, item);
2339
+ return !includesOptionValue(collectCascaderLeafValues(options), item);
2340
+ })) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(collectCascaderLeafValues(options)));
2341
+ return;
2342
+ }
2343
+ if (emitPath) {
2344
+ if (!Array.isArray(normalizedValue) || !isValidCascaderPath(options, normalizedValue)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(collectCascaderLeafValues(options)));
2345
+ return;
2346
+ }
2347
+ if (!includesOptionValue(collectCascaderLeafValues(options), normalizedValue)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(collectCascaderLeafValues(options)));
2348
+ };
2349
+ var validateBuiltinTypeMatch = (value, fieldType, mForm, props, message) => {
2350
+ if (SKIP_TYPES.has(fieldType)) return;
2351
+ const config = props.config || {};
2352
+ if (STRING_TYPES.has(fieldType)) {
2353
+ if (config.filter === "number") {
2354
+ if (typeof value !== "number" || Number.isNaN(value)) return defaultMessage(message, `${value} 类型应为数字`, typeExampleSuggestion(mForm, props, "123", isNumberValue));
2355
+ return;
2356
+ }
2357
+ if (typeof config.filter === "function") return;
2358
+ if (fieldType === "text" && isNumberValue(value)) return;
2359
+ if (typeof value !== "string") return defaultMessage(message, `${value} 类型应为字符串`, typeExampleSuggestion(mForm, props, "\"文本内容\"", isStringValue));
2360
+ return;
2361
+ }
2362
+ if (DATE_LIKE_TYPES.has(fieldType)) {
2363
+ const valueFormat = resolveDateValueFormat(fieldType, config);
2364
+ if (!isValidDateValueByFormat(value, valueFormat)) return dateValueFormatErrorMessage(message, valueFormat);
2365
+ return;
2366
+ }
2367
+ if (fieldType === "number") {
2368
+ if (typeof value !== "number" || Number.isNaN(value)) return defaultMessage(message, `${value} 类型应为数字`, typeExampleSuggestion(mForm, props, "123", isNumberValue));
2369
+ return;
2370
+ }
2371
+ if (fieldType === "number-range") {
2372
+ if (!Array.isArray(value) || value.length !== 2 || value.some((item) => typeof item !== "number" || Number.isNaN(item))) return defaultMessage(message, `${value} 类型应为长度为 2 的数字数组`, typeExampleSuggestion(mForm, props, "[0, 100]", isNumberRangeValue));
2373
+ return;
2374
+ }
2375
+ if (fieldType === "switch" || fieldType === "checkbox") {
2376
+ const { activeValue, inactiveValue } = resolveToggleValues(config);
2377
+ if (!Object.is(value, activeValue) && !Object.is(value, inactiveValue)) return defaultMessage(message, `${value} 不在合法开关值中`, toggleSuggestion(activeValue, inactiveValue));
2378
+ return;
2379
+ }
2380
+ if (fieldType === "select") return validateSelectValue(value, config, flattenSelectOptions(resolveOptions(props)), message);
2381
+ if (fieldType === "radio-group") {
2382
+ const optionValues = flattenSelectOptions(resolveOptions(props));
2383
+ if (optionValues.length === 0) return;
2384
+ if (!includesOptionValue(optionValues, value)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
2385
+ return;
2386
+ }
2387
+ if (fieldType === "checkbox-group") {
2388
+ const optionValues = flattenSelectOptions(resolveOptions(props));
2389
+ if (optionValues.length === 0) return;
2390
+ if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, optionExampleSuggestion(optionValues, "[\"选项1\", \"选项2\"]", true));
2391
+ if (value.some((item) => !includesOptionValue(optionValues, item))) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
2392
+ return;
2393
+ }
2394
+ if (fieldType === "cascader") return validateCascaderValue(value, config, props, mForm, message);
2395
+ if (fieldType === "daterange" || fieldType === "timerange") {
2396
+ if (config.names) return;
2397
+ const valueFormat = resolveDateValueFormat(fieldType, config);
2398
+ if (!Array.isArray(value) || value.length !== 2 || value.some((item) => !isValidDateValueByFormat(item, valueFormat))) return defaultMessage(message, isTimestampValueFormat(valueFormat) ? `${value} 类型应为长度为 2 的时间戳数字数组` : `${value} 格式应为长度为 2 的 ${valueFormat} 数组`, dateRangeSuggestion(valueFormat));
2399
+ return;
2400
+ }
2401
+ if (fieldType === "table" || fieldType === "group-list" || fieldType === "grouplist") {
2402
+ if (!Array.isArray(value) || value.some((item) => !isObjectValue(item))) return defaultMessage(message, `${value} 类型应为对象数组`, typeExampleSuggestion(mForm, props, "[{}]", isObjectArrayValue));
2403
+ return;
2404
+ }
2405
+ };
2406
+ /**
2407
+ * 校验取值与字段 type 是否匹配;通过返回 undefined,否则返回错误文案。
2408
+ *
2409
+ * 命中的自定义规则是异步校验器时返回 Promise,内置规则始终同步返回。
2410
+ */
2411
+ var validateTypeMatch = (value, mForm, props, message) => {
2412
+ if (isEmptyValue(value) || isEmptyArray(value)) return;
2413
+ if (!props.config?.name) return;
2414
+ const rawFieldType = "type" in (props.config || {}) ? props.config.type : "";
2415
+ if (typeof rawFieldType !== "string" || !rawFieldType) return;
2416
+ const fieldType = (0, _tmagic_utils.toLine)(rawFieldType);
2417
+ const customValidator = getTypeMatchRule(fieldType);
2418
+ if (customValidator) return customValidator(value, {
2419
+ fieldType,
2420
+ mForm,
2421
+ props,
2422
+ message
2423
+ });
2424
+ return validateBuiltinTypeMatch(value, fieldType, mForm, props, message);
2425
+ };
2426
+ var toError = (error) => error instanceof Error ? error : /* @__PURE__ */ new Error(`${error}`);
2427
+ var createTypeMatchValidator = (mForm, props, rule) => {
2428
+ const originalValidator = typeof rule.validator === "function" ? rule.validator : void 0;
2429
+ /**
2430
+ * 每次校验取一个自增序号,只有最新一轮的结论会被采用。
2431
+ *
2432
+ * 旧值的在途校验不能用自己的结论结算:它可能晚于新校验结束,用过期结论覆盖新结论
2433
+ * (表单取最后结束的那次结果);也不能在新校验开始时无条件按通过结算,否则
2434
+ * `form.validate()` 会对一个还没校验过的值返回成功。因此所有尚未结算的调用都登记在
2435
+ * pendingSettlers 中,等最新一轮出结论后用同一个结论一起结算。
2436
+ *
2437
+ * 不比较取值本身:配了 names 或取值为对象/数组时拿到的是同一个引用,就地修改后比较不出变化。
2438
+ */
2439
+ let generation = 0;
2440
+ let pendingSettlers = [];
2441
+ return (asyncValidatorRule, value, callback, source, options) => {
2442
+ const actualValue = props.config?.names ? props.model : value;
2443
+ generation += 1;
2444
+ const currentGeneration = generation;
2445
+ /** 已有更新的一轮校验开始,本轮结论作废 */
2446
+ const isStale = () => currentGeneration !== generation;
2447
+ pendingSettlers.push((args) => callback(...args));
2448
+ /**
2449
+ * 结算本轮与被本轮取代的所有在途校验。
2450
+ *
2451
+ * async-validator 的 callback 不幂等:重复调用会让它的内部计数提前满足、错误信息重复;
2452
+ * 原始 validator 写成 async 时很容易既调 callback 又返回 Promise,故所有回调都收敛到这里,
2453
+ * 由「取出即出队」保证每个调用的 callback 只会被调用一次。
2454
+ */
2455
+ const conclude = (...args) => {
2456
+ if (isStale()) return;
2457
+ const settlers = pendingSettlers;
2458
+ pendingSettlers = [];
2459
+ for (const settle of settlers) settle(args);
2460
+ };
2461
+ /**
2462
+ * 执行原始 validator 并把结果统一转成 callback。
2463
+ *
2464
+ * async-validator 只解析同步返回给它的返回值(true / false / Error / 错误数组 / Promise,
2465
+ * 抛错转成错误信息),异步路径已脱离它的调用栈,这些约定会失效导致校验永不结束,故复刻一份。
2466
+ */
2467
+ const settleWithOriginalValidator = () => {
2468
+ if (isStale()) return;
2469
+ if (!originalValidator) {
2470
+ conclude();
2471
+ return;
2472
+ }
2473
+ let result;
2474
+ try {
2475
+ result = originalValidator({
2476
+ rule: asyncValidatorRule,
2477
+ value: actualValue,
2478
+ callback: conclude,
2479
+ source,
2480
+ options
2481
+ }, {
2482
+ values: mForm?.initValues || {},
2483
+ model: props.model,
2484
+ parent: mForm?.parentValues || {},
2485
+ formValue: mForm?.values || props.model,
2486
+ prop: props.prop,
2487
+ config: props.config
2488
+ }, mForm);
2489
+ } catch (err) {
2490
+ conclude(toError(err));
2491
+ return;
2492
+ }
2493
+ if (isPromise(result)) result.then(() => conclude(), (err) => conclude(toError(err)));
2494
+ else if (result === true) conclude();
2495
+ else if (result === false) {
2496
+ const field = asyncValidatorRule?.fullField || asyncValidatorRule?.field || props.prop;
2497
+ conclude(new Error(rule.message || `${field} fails`));
2498
+ } else if (result instanceof Error || Array.isArray(result)) conclude(result);
2499
+ };
2500
+ const skipFailedTypeMatch = (err) => {
2501
+ console.error(err);
2502
+ settleWithOriginalValidator();
2503
+ };
2504
+ let error;
2505
+ try {
2506
+ error = validateTypeMatch(actualValue, mForm, props, rule.message);
2507
+ } catch (err) {
2508
+ skipFailedTypeMatch(err);
2509
+ return;
2510
+ }
2511
+ if (isPromise(error)) {
2512
+ error.then((asyncMessage) => {
2513
+ if (asyncMessage) {
2514
+ conclude(new Error(asyncMessage));
2515
+ return;
2516
+ }
2517
+ settleWithOriginalValidator();
2518
+ }, skipFailedTypeMatch);
2519
+ return;
2520
+ }
2521
+ if (error) {
2522
+ conclude(new Error(error));
2523
+ return;
2524
+ }
2525
+ settleWithOriginalValidator();
2526
+ };
2527
+ };
2528
+ //#endregion
2529
+ //#region packages/form/src/utils/formStateProxy.ts
2530
+ /** 无上下文时共用的空对象,避免每次读取都分配新对象 */
2531
+ var EMPTY_CONTEXT = Object.freeze({});
2532
+ /**
2533
+ * 按优先级分层合并上下文,**靠后的层优先**。
2534
+ *
2535
+ * 用读穿 Proxy 而非 `{ ...a, ...b }`:展开会立即执行 accessor,
2536
+ * 而宿主允许用 `{ get stage() { ... } }` 这类读时求值的描述符。
2537
+ */
2538
+ var mergeFormContexts = (...layers) => {
2539
+ const stack = layers.filter((layer) => Boolean(layer));
2540
+ if (stack.length === 0) return EMPTY_CONTEXT;
2541
+ if (stack.length === 1) return stack[0];
2542
+ const ordered = stack.slice().reverse();
2543
+ const owner = (k) => ordered.find((layer) => Reflect.has(layer, k));
2544
+ return new Proxy({}, {
2545
+ get: (_t, k) => owner(k)?.[k],
2546
+ has: (_t, k) => Boolean(owner(k)),
2547
+ ownKeys: () => [...new Set(ordered.flatMap((layer) => Reflect.ownKeys(layer)))],
2548
+ getOwnPropertyDescriptor: (_t, k) => {
2549
+ for (const layer of ordered) {
2550
+ const descriptor = Object.getOwnPropertyDescriptor(layer, k);
2551
+ if (descriptor) return {
2552
+ ...descriptor,
2553
+ configurable: true
2554
+ };
2555
+ }
2556
+ }
2557
+ });
2558
+ };
2559
+ /**
2560
+ * 将 coreState 与宿主业务上下文关联:读取时优先 core,miss 再读穿到 context。
2561
+ *
2562
+ * - `get` 用属性访问而非 `Reflect.get(t, k, receiver)`,避免破坏 Vue reactive 的 `__v_raw`;
2563
+ * - symbol 键一律只走 core,四个 trap 保持一致。context 是业务数据袋,不承载 symbol 键,
2564
+ * 把 Vue / 工具链的内部 symbol 隔离在 core 上才能让 `toRaw` / `isReactive` 判定正确;
2565
+ * - `ownKeys` + `getOwnPropertyDescriptor` 保证 `Object.entries(formState)` 能枚举到扩展字段
2566
+ * (admin-web-next 的 `pickPanelFormStateExtendFields` 依赖此语义);
2567
+ * - `set` 写入 coreState,第三方 `formState.xxx = v` 仍生效且优先于 context。
2568
+ *
2569
+ * 独立成文件,避免与 `form.ts` ↔ `typeMatch.ts` 形成循环依赖。
2570
+ */
2571
+ var createFormStateProxy = (coreState, getContext) => {
2572
+ const resolve = () => (typeof getContext === "function" ? getContext() : (0, vue.unref)(getContext)) || EMPTY_CONTEXT;
2573
+ return new Proxy(coreState, {
2574
+ get(t, k) {
2575
+ if (typeof k === "symbol") return Reflect.get(t, k);
2576
+ const v = t[k];
2577
+ if (v !== void 0 || Reflect.has(t, k)) return v;
2578
+ return resolve()[k];
2579
+ },
2580
+ set(t, k, value) {
2581
+ t[k] = value;
2582
+ return true;
2583
+ },
2584
+ has: (t, k) => Reflect.has(t, k) || typeof k !== "symbol" && k in resolve(),
2585
+ ownKeys: (t) => [.../* @__PURE__ */ new Set([...Reflect.ownKeys(t), ...Reflect.ownKeys(resolve()).filter((k) => typeof k !== "symbol")])],
2586
+ getOwnPropertyDescriptor: (t, k) => {
2587
+ const own = Reflect.getOwnPropertyDescriptor(t, k);
2588
+ if (own) return own;
2589
+ if (typeof k === "symbol") return void 0;
2590
+ const ctx = resolve();
2591
+ if (!(k in ctx)) return void 0;
2592
+ return {
2593
+ configurable: true,
2594
+ enumerable: true,
2595
+ writable: true,
2596
+ value: ctx[k]
2597
+ };
2598
+ }
2599
+ });
2600
+ };
2601
+ //#endregion
2602
+ //#region packages/form/src/utils/form.ts
2603
+ var isTDesignAdapter = () => (0, _tmagic_design_headless.getDesignConfig)("adapterType") === "tdesign-vue-next";
2604
+ /**
2605
+ * 将 async-validator(Element Plus)风格的 validator 适配到当前 UI 库。
2606
+ * TDesign 调用签名为 `(val) => boolean | CustomValidateObj | Promise`,无 callback。
2607
+ */
2608
+ var adaptFormValidator = (validator) => {
2609
+ return (arg1, arg2, arg3, arg4, arg5) => {
2610
+ if (!isTDesignAdapter()) return validator(arg1, arg2, arg3, arg4, arg5);
2611
+ const value = arg1;
2612
+ return new Promise((resolve) => {
2613
+ let settled = false;
2614
+ const callback = (error) => {
2615
+ if (settled) return;
2616
+ settled = true;
2617
+ const first = Array.isArray(error) ? error[0] : error;
2618
+ if (first) resolve({
2619
+ result: false,
2620
+ message: typeof first === "string" ? first : first.message
2621
+ });
2622
+ else resolve(true);
2623
+ };
2624
+ try {
2625
+ const result = validator(void 0, value, callback);
2626
+ if (result && typeof result.then === "function") Promise.resolve(result).then(() => {
2627
+ if (!settled) callback();
2628
+ }, (err) => {
2629
+ callback(err instanceof Error ? err : new Error(String(err)));
2630
+ });
2631
+ } catch (e) {
2632
+ callback(e instanceof Error ? e : new Error(String(e)));
2633
+ }
2634
+ });
2635
+ };
2636
+ };
2637
+ var TABLE_SELECT_TYPES = /* @__PURE__ */ new Set(["table-select", "tableSelect"]);
2638
+ var isTableSelect = (type) => typeof type === "string" && TABLE_SELECT_TYPES.has(type);
2639
+ var asyncLoadConfig = (value, initValue, { asyncLoad, name, type }) => {
2640
+ if (type === "html" && typeof asyncLoad === "object" && typeof name !== "undefined") {
2641
+ asyncLoad.name = name;
2642
+ value.asyncLoad = typeof initValue.asyncLoad === "object" ? initValue.asyncLoad : asyncLoad;
2643
+ }
2644
+ };
2645
+ var MULTIPLE_VALUE_TYPES = /* @__PURE__ */ new Set([
2646
+ "checkbox-group",
2647
+ "checkboxGroup",
2648
+ "table",
2649
+ "cascader",
2650
+ "group-list",
2651
+ "groupList"
2652
+ ]);
2653
+ var isMultipleValue = (type) => typeof type === "string" && MULTIPLE_VALUE_TYPES.has(type);
2654
+ var initItemsValue = (mForm, value, initValue, { items, name, extensible }) => {
2655
+ if (Array.isArray(initValue[name])) value[name] = initValue[name].map((v, index) => createValues(mForm, items, v, value[name]?.[index]));
2656
+ else {
2657
+ value[name] = createValues(mForm, items, initValue[name], value[name]);
2658
+ if (extensible) value[name] = Object.assign({}, initValue[name], value[name]);
2659
+ }
2660
+ };
2661
+ var setValue = (mForm, value, initValue, item) => {
2662
+ const { items, name, type, checkbox } = item;
2663
+ if (isMultipleValue(type) || type === "tab" && item.dynamic) value[name] = initValue[name] || [];
2664
+ if (items) initItemsValue(mForm, value, initValue, item);
2665
+ else value[name] = getDefaultValue(mForm, item);
2666
+ if (type === "fieldset" && checkbox) {
2667
+ const checkboxName = typeof checkbox === "object" && typeof checkbox.name === "string" ? checkbox.name : "value";
2668
+ const checkboxFalseValue = typeof checkbox === "object" && typeof checkbox.falseValue !== "undefined" ? checkbox.falseValue : 0;
2669
+ if (name && typeof value[name] === "object") value[name][checkboxName] = typeof initValue[name] === "object" ? initValue[name][checkboxName] || checkboxFalseValue : checkboxFalseValue;
2670
+ }
2671
+ };
2672
+ var initValueItem = function(mForm, item, initValue, value) {
2673
+ const { items } = item;
2674
+ const { names } = item;
2675
+ const type = "type" in item ? item.type : "";
2676
+ const { name } = item;
2677
+ if (isTableSelect(type) && name) {
2678
+ value[name] = initValue[name] ?? "";
2679
+ return value;
2680
+ }
2681
+ asyncLoadConfig(value, initValue, item);
2682
+ if (name && !items && typeof initValue?.[name] !== "undefined") {
2683
+ if (typeof value[name] === "undefined") value[name] = type === "number" ? Number(initValue[name]) : initValue[name];
2684
+ return value;
2685
+ }
2686
+ if (names) return names.forEach((n) => value[n] = initValue[n] ?? "");
2687
+ if (!name) return createValues(mForm, items, initValue, value);
2688
+ setValue(mForm, value, initValue, item);
2689
+ if (type === "table") {
2690
+ const tableConfig = item;
2691
+ if (tableConfig.defautSort) sortChange(value[name], tableConfig.defautSort);
2692
+ else if (tableConfig.defaultSort) sortChange(value[name], tableConfig.defaultSort);
2693
+ if (tableConfig.sort && tableConfig.sortKey) value[name].sort((a, b) => b[tableConfig.sortKey] - a[tableConfig.sortKey]);
2694
+ }
2695
+ return value;
2696
+ };
2697
+ var createValues = function(mForm, config = [], initValue = {}, value = {}) {
2698
+ if (Array.isArray(config)) config.forEach((item) => {
2699
+ initValueItem(mForm, item, initValue, value);
2700
+ });
2701
+ return value;
2702
+ };
2703
+ var getDefaultValue = function(mForm, { defaultValue, type, filter, multiple, names }) {
2704
+ if (typeof defaultValue === "function") return defaultValue(mForm);
2705
+ if (defaultValue === "undefined") return;
2706
+ if (typeof defaultValue !== "undefined") return defaultValue;
2707
+ if (type === "number" || filter === "number") return 0;
2708
+ if (["switch", "checkbox"].includes(type)) return false;
2709
+ if (multiple || type === "number-range") return [];
2710
+ if (type === "daterange" && !names) return [];
2711
+ return "";
2712
+ };
2713
+ /**
2714
+ * formState 中与表单 props 无关的公共部分:字段注册表、消息组件、post 请求。
2715
+ *
2716
+ * 由渲染式表单(`Form.vue`)与无渲染校验(`createHeadlessFormState`)共用,
2717
+ * 保证两者提供给字段配置(`onChange` / `validator` / 异步 options 等)的能力一致。
2718
+ */
2719
+ var fallbackMessage = {
2720
+ error: (msg) => console.error(msg),
2721
+ success: (msg) => console.log(msg),
2722
+ warning: (msg) => console.warn(msg),
2723
+ info: (msg) => console.info(msg),
2724
+ closeAll: () => void 0
2725
+ };
2726
+ var fallbackMessageBox = {
2727
+ alert: (msg) => console.log(msg),
2728
+ confirm: (msg) => console.log(msg),
2729
+ close: (msg) => console.log(msg)
2730
+ };
2731
+ var createFormStateBase = (ui) => {
2732
+ const fields = /* @__PURE__ */ new Map();
2733
+ const requestFuc = getConfig("request");
2734
+ return {
2735
+ fields,
2736
+ setField: (prop, field) => fields.set(prop, field),
2737
+ getField: (prop) => fields.get(prop),
2738
+ deleteField: (prop) => fields.delete(prop),
2739
+ $messageBox: ui?.$messageBox ?? fallbackMessageBox,
2740
+ $message: ui?.$message ?? fallbackMessage,
2741
+ post: (options) => {
2742
+ if (requestFuc) return requestFuc({
2743
+ method: "POST",
2744
+ ...options
2745
+ });
2746
+ }
2747
+ };
2748
+ };
2749
+ /**
2750
+ * 配置项的 `name` 是否可用于从 model 中下钻取值。
2751
+ *
2752
+ * 供 `Container.vue` 与无渲染校验(`collectValidatableFields`)共用,两者对「该不该下钻」
2753
+ * 的判断必须一致。
2754
+ */
2755
+ var isValidName = (name) => {
2756
+ const valueType = typeof name;
2757
+ if (valueType !== "string" && valueType !== "symbol" && valueType !== "number") return false;
2758
+ if (name === "") return false;
2759
+ if (valueType === "number") return name >= 0;
2760
+ return true;
2761
+ };
2762
+ /**
2763
+ * 在 `prop` 后追加一段路径。
2764
+ *
2765
+ * 用于容器把 `prop` 透传给子级时再拼上索引 / key(如 group-list 的行、table 的行)。
2766
+ */
2767
+ var appendProp = (prop = "", key) => `${prop}${prop ? "." : ""}${key}`;
2768
+ /**
2769
+ * 由父级 `prop` 与配置项 `name` 拼出该配置项的完整 `prop`(即 FormItem 的 prop)。
2770
+ *
2771
+ * 调用方传入的 name 已按 `config.name || ''` 归一化,空 name 表示该配置项不占据值路径上的一层,
2772
+ * 此时沿用父级 `prop`。
2773
+ */
2774
+ var getItemProp = (prop = "", name = "") => name === "" ? prop ?? "" : appendProp(prop, name);
2775
+ /**
2776
+ * 归一化配置项的 `type`:求值动态 type、剥离容器语义的 type、驼峰转中划线、补默认值。
2777
+ *
2778
+ * 供 `Container.vue` 与无渲染校验共用,保证两者分派到的 type 完全一致。
2779
+ */
2780
+ var resolveItemType = (mForm, config, props) => {
2781
+ let type = "type" in (config || {}) ? config.type : "";
2782
+ type = type && filterFunction(mForm, type, props);
2783
+ if (type === "form" || type === "container") return "";
2784
+ return type?.replace(/([A-Z])/g, "-$1").toLowerCase() || (config?.items ? "" : "text");
2785
+ };
2786
+ var filterFunction = (mForm, config, props) => {
2787
+ if (typeof config === "function") return config(mForm, {
2788
+ values: (0, vue.readonly)(mForm?.initValues || {}),
2789
+ model: (0, vue.readonly)(props.model),
2790
+ parent: (0, vue.readonly)(mForm?.parentValues || {}),
2791
+ formValue: (0, vue.readonly)(mForm?.values || props.model),
2792
+ prop: props.prop,
2793
+ config: props.config,
2794
+ index: props.index,
2795
+ getFormValue: (prop) => (0, _tmagic_utils.getValueByKeyPath)(prop, mForm?.values || props.model)
2796
+ });
2797
+ return config;
2798
+ };
2799
+ var display = function(mForm, config, props) {
2800
+ if (config === "expand") return config;
2801
+ if (typeof config === "function") return filterFunction(mForm, config, props);
2802
+ if (config === false) return false;
2803
+ return true;
2804
+ };
2805
+ var buildRules = function(mForm, r = [], props, typeMatchValid, adapt = (validator) => validator) {
2806
+ let rules = cloneDeep(r);
2807
+ if (typeof rules === "object" && !Array.isArray(rules)) rules = [rules];
2808
+ if ((0, vue.unref)(typeMatchValid) && !rules.some((r) => typeof r.typeMatch !== "undefined")) rules.push({ typeMatch: true });
2809
+ return rules.map((item) => {
2810
+ if (item.typeMatch) {
2811
+ item.validator = adapt(createTypeMatchValidator(mForm, props, item));
2812
+ return item;
2813
+ }
2814
+ if (typeof item.validator === "function") {
2815
+ const fnc = item.validator;
2816
+ item.validator = adapt((rule, value, callback, source, options) => fnc({
2817
+ rule,
2818
+ value: props.config.names ? props.model : value,
2819
+ callback,
2820
+ source,
2821
+ options
2822
+ }, {
2823
+ values: mForm?.initValues || {},
2824
+ model: props.model,
2825
+ parent: mForm?.parentValues || {},
2826
+ formValue: mForm?.values || props.model,
2827
+ prop: props.prop,
2828
+ config: props.config
2829
+ }, mForm));
2830
+ }
2831
+ return item;
2832
+ }).filter((item) => {
2833
+ if (item.typeMatch === false && typeof item.validator !== "function") return false;
2834
+ return true;
2835
+ });
2836
+ };
2837
+ var getRules = function(mForm, r = [], props, typeMatchValid) {
2838
+ return buildRules(mForm, r, props, typeMatchValid, adaptFormValidator);
2839
+ };
2840
+ /**
2841
+ * 与 `getRules` 相同,但 validator 保持 async-validator(Element Plus)原生签名,不做 UI 库适配。
2842
+ *
2843
+ * 供无渲染校验(`validateValues`)使用:它直接把规则交给 async-validator 执行,
2844
+ * 不经过 TDesign 的 `validator(val)` 调用约定,因此不能套 `adaptFormValidator`。
2845
+ */
2846
+ var getNativeRules = function(mForm, r = [], props, typeMatchValid) {
2847
+ return buildRules(mForm, r, props, typeMatchValid);
2848
+ };
2849
+ var initValue = async (mForm, { initValues, config }) => {
2850
+ if (!Array.isArray(config)) throw new Error("config应该为数组");
2851
+ const initValuesCopy = cloneDeep(initValues);
2852
+ let valuesTmp = createValues(mForm, config, initValuesCopy, {});
2853
+ const [firstForm] = config;
2854
+ if (firstForm && typeof firstForm.onInitValue === "function") valuesTmp = await firstForm.onInitValue(mForm, {
2855
+ formValue: valuesTmp,
2856
+ initValue: initValuesCopy
2857
+ });
2858
+ return valuesTmp || {};
2859
+ };
2860
+ var datetimeFormatter = (v, defaultValue = "-", format = "YYYY-MM-DD HH:mm:ss") => {
2861
+ if (v) {
2862
+ let time;
2863
+ if (["x", "timestamp"].includes(format)) time = (0, dayjs.default)(Number.isNaN(Number(v)) ? v : Number(v)).valueOf();
2864
+ else if (typeof v === "string" && v.includes("Z") || v instanceof Date) {
2865
+ dayjs.default.extend(dayjs_plugin_utc_js.default);
2866
+ time = (0, dayjs.default)(v).utcOffset(8).format(format);
2867
+ } else time = (0, dayjs.default)(v).format(format);
2868
+ if (time !== "Invalid Date") return time;
2869
+ return defaultValue;
2870
+ }
2871
+ return defaultValue;
2872
+ };
2873
+ var getDataByPage = (data = [], pagecontext, pagesize) => {
2874
+ const start = pagecontext * pagesize;
2875
+ return data.slice(start, start + pagesize);
2876
+ };
2877
+ var sortArray = (data, newIndex, oldIndex, sortKey) => {
2878
+ if (newIndex === oldIndex) return data;
2879
+ if (newIndex < 0 || newIndex >= data.length || oldIndex < 0 || oldIndex >= data.length) return data;
2880
+ const item = data[oldIndex];
2881
+ const newData = data.toSpliced(oldIndex, 1).toSpliced(newIndex, 0, item);
2882
+ if (sortKey) for (let i = newData.length - 1, v = 0; i >= 0; i--, v++) newData[v][sortKey] = i;
2883
+ return cloneDeep(newData);
2884
+ };
2885
+ var sortChange = (data, { prop, order }) => {
2886
+ if (order === "ascending") data.sort((a, b) => a[prop] - b[prop]);
2887
+ else if (order === "descending") data.sort((a, b) => b[prop] - a[prop]);
2888
+ };
2889
+ var createObjectProp = (prop, key, name) => {
2890
+ if (prop === "") return key;
2891
+ const itemPath = `${prop}`.split(".");
2892
+ if (name) {
2893
+ if (`${itemPath[itemPath.length - 1]}` === `${name}`) return `${[...itemPath.slice(0, -1), key].join(".")}`;
2894
+ }
2895
+ return `${[...itemPath, key].join(".")}`;
2896
+ };
2897
+ //#endregion
2898
+ //#region packages/form/src/fields/CheckboxGroup/effect.ts
2899
+ /** 空值初始化为空数组。 */
2900
+ var effect$5 = ({ config, model }) => {
2901
+ const { name } = config;
2902
+ if (model && !model[name]) model[name] = [];
2903
+ };
2904
+ //#endregion
2905
+ //#region packages/form/src/fields/Date/effect.ts
2906
+ /** 按 `valueFormat` 归一化日期值。 */
2907
+ var effect$4 = ({ config, model }) => {
2908
+ if (!model) return;
2909
+ const { name, valueFormat } = config;
2910
+ model[name] = datetimeFormatter(model[name], "", valueFormat || "YYYY/MM/DD");
2911
+ };
2912
+ //#endregion
2913
+ //#region packages/form/src/fields/DateTime/effect.ts
2914
+ /** 按 `valueFormat` 归一化日期时间值,空值与非法值统一为空字符串。 */
2915
+ var effect$3 = ({ config, model }) => {
2916
+ if (!model) return;
2917
+ const { name, valueFormat } = config;
2918
+ const value = model[name]?.toString();
2919
+ if (!value || value === "Invalid Date") {
2920
+ model[name] = "";
2921
+ return;
2922
+ }
2923
+ model[name] = datetimeFormatter(model[name], "", valueFormat || "YYYY/MM/DD HH:mm:ss");
2924
+ };
2925
+ //#endregion
2926
+ //#region packages/form/src/fields/Display/effect.ts
2927
+ /** 把 `initValue` 写入 model。 */
2928
+ var effect$2 = ({ config, model }) => {
2929
+ const { initValue, name } = config;
2930
+ if (initValue && model) model[name] = initValue;
2931
+ };
2932
+ //#endregion
2933
+ //#region packages/form/src/fields/DynamicField/effect.ts
2934
+ /**
2935
+ * 遍历动态字段列表,按「原值为空且声明了 defaultValue 则取默认值」求出每个字段当前的值。
2936
+ *
2937
+ * `isDefaultApplied` 为真表示该值来自 `defaultValue`,需要写回表单值
2938
+ * (组件通过 emit change 写回,初始化写入直接写 `values`)。
2939
+ */
2940
+ var eachDynamicField = (fields, model, onField) => {
2941
+ for (const field of fields) {
2942
+ if (typeof field !== "object" || field?.name === void 0) continue;
2943
+ let value = model?.[field.name] || "";
2944
+ let isDefaultApplied = false;
2945
+ if (!value && field.defaultValue !== void 0) {
2946
+ value = field.defaultValue;
2947
+ isDefaultApplied = true;
2948
+ }
2949
+ onField(field, value, isDefaultApplied);
2950
+ }
2951
+ };
2952
+ /**
2953
+ * 同步 `returnFields` 的 defaultValue 按 prop 写入值根对象。
2954
+ *
2955
+ * 该组件读取的是同级 model,但写入走 Container 的 modifyKey 分支,落在 `${prop}.${key}`,
2956
+ * 这里保持与渲染一致(含这层不对称),避免两条链路产出不同的值。
2957
+ * 异步 returnFields 由组件挂载后的 watch 负责,此处不等待。
2958
+ */
2959
+ var effect$1 = ({ config, model, prop, values }) => {
2960
+ const { returnFields, dynamicKey } = config;
2961
+ if (typeof returnFields !== "function" || !model) return;
2962
+ if (model[dynamicKey] === "") return;
2963
+ const result = returnFields(config, model, getConfig("request"));
2964
+ if (!result || typeof result.then === "function" || !Array.isArray(result)) return;
2965
+ eachDynamicField(result, model, (field, value, isDefaultApplied) => {
2966
+ if (isDefaultApplied) (0, _tmagic_utils.setValueByKeyPath)(`${prop}.${field.name}`, value, values || model);
2967
+ });
2968
+ };
2969
+ //#endregion
2970
+ //#region packages/form/src/fields/NumberRange/effect.ts
2971
+ /** 值不是数组时修正为空数组。 */
2972
+ var effect = ({ config, model }) => {
2973
+ const { name } = config;
2974
+ if (model && !Array.isArray(model[name])) model[name] = [];
2975
+ };
2976
+ //#endregion
2977
+ //#region packages/form/src/utils/fieldInnerConfig.ts
2978
+ /** 内置内部配置(由 `registerBuiltInFields` 写入;`clearFields` 不会清掉) */
2979
+ var builtInInnerConfigs = /* @__PURE__ */ new Map();
2980
+ /** 业务侧登记的内部配置 */
2981
+ var extraInnerConfigs = /* @__PURE__ */ new Map();
2982
+ /**
2983
+ * 登记复合字段的内部配置:无渲染校验遇到该 type 时,用返回值继续遍历内部字段。
2984
+ *
2985
+ * `type` 会按 Container 的规则归一化为中划线形式(`codeSelect` 与 `code-select` 等价)。
2986
+ * 重复登记以最后一次为准,便于业务侧覆盖内置实现。
2987
+ * `builtIn` 登记不受 `deleteFieldInnerConfig` / `clearFieldInnerConfigs` 影响。
2988
+ *
2989
+ * @param type - 字段 type
2990
+ * @param resolve - innerConfig 回调
2991
+ * @param [builtIn=false] - 是否写入内置表
2992
+ */
2993
+ var registerFieldInnerConfig = (type, resolve, builtIn = false) => {
2994
+ if (typeof type !== "string" || !type || typeof resolve !== "function") return;
2995
+ (builtIn ? builtInInnerConfigs : extraInnerConfigs).set((0, _tmagic_utils.toLine)(type), resolve);
2996
+ };
2997
+ /**
2998
+ * 获取指定 type 的 innerConfig 回调(业务侧优先于内置)。
2999
+ *
3000
+ * @param type - 字段 type
3001
+ * @returns innerConfig 回调;未登记则为 `undefined`
3002
+ */
3003
+ var getFieldInnerConfig = (type) => {
3004
+ const key = (0, _tmagic_utils.toLine)(type);
3005
+ return extraInnerConfigs.get(key) ?? builtInInnerConfigs.get(key);
3006
+ };
3007
+ /**
3008
+ * 删除业务侧登记的 innerConfig(不影响内置)。
3009
+ *
3010
+ * @param type - 字段 type
3011
+ * @returns 是否删除成功
3012
+ */
3013
+ var deleteFieldInnerConfig = (type) => extraInnerConfigs.delete((0, _tmagic_utils.toLine)(type));
3014
+ /** 清空业务侧登记的 innerConfig(不影响内置;主要用于单测)。 */
3015
+ var clearFieldInnerConfigs = () => extraInnerConfigs.clear();
3016
+ //#endregion
3017
+ //#region packages/form/src/utils/fieldValueEffects.ts
3018
+ /**
3019
+ * @fileoverview 叶子字段登记表:哪些 type 是叶子,以及该字段对表单值的初始化写入。
3020
+ *
3021
+ * 无渲染校验据此判定该 type 没有属于父表单的嵌套字段。
3022
+ * 业务自定义字段通过 `registerField` / `registerFields` 登记。
3023
+ * 内置叶子字段由 `MagicForm.install` 的 `registerBuiltInFields` 写入。
3024
+ * 未登记且没有 innerConfig 的 type:有 `items` 会下钻子项,自身有 `rules` 会校验自身。
3025
+ *
3026
+ * 这里只是登记表。各字段的 effect 写在对应组件同目录的 `fields/<Field>/effect.ts`,
3027
+ * 执行收口在 `collectFields` 的 `applyMountValueEffects`:渲染(`Form.vue`)
3028
+ * 与无渲染(`validateValues`)都在表单值初始化完成后调用它一次,
3029
+ * 字段组件自身不再在 setup 里改写 model。
3030
+ *
3031
+ * @module fieldValueEffects
3032
+ */
3033
+ /** 内置叶子字段(由 `MagicForm.install` 写入;clearFields 不会清掉) */
3034
+ var builtInLeafFieldTypes = /* @__PURE__ */ new Set();
3035
+ var builtInMountValueEffects = /* @__PURE__ */ new Map();
3036
+ /** 业务侧登记的叶子字段与其挂载副作用 */
3037
+ var extraLeafFieldTypes = /* @__PURE__ */ new Set();
3038
+ var extraMountValueEffects = /* @__PURE__ */ new Map();
3039
+ /**
3040
+ * 登记一个叶子字段 type。由 `registerField` 调用,业务侧请走 `registerField`。
3041
+ *
3042
+ * 传了 `effect` 会覆盖该 type 已有的 extra effect(含覆盖内置);不传则清掉 extra effect,
3043
+ * 内置 effect 仍生效。
3044
+ *
3045
+ * @param type - 字段 type
3046
+ * @param [effect] - 挂载时改写 model 的副作用
3047
+ * @param [builtIn=false] - 是否写入内置表
3048
+ */
3049
+ var registerLeafFieldType = (type, effect, builtIn = false) => {
3050
+ if (typeof type !== "string" || !type) return;
3051
+ const key = (0, _tmagic_utils.toLine)(type);
3052
+ const types = builtIn ? builtInLeafFieldTypes : extraLeafFieldTypes;
3053
+ const effects = builtIn ? builtInMountValueEffects : extraMountValueEffects;
3054
+ types.add(key);
3055
+ if (typeof effect === "function") effects.set(key, effect);
3056
+ else if (!builtIn) effects.delete(key);
3057
+ };
3058
+ /**
3059
+ * 是否为叶子字段 type(内置 ∪ 已登记)。
3060
+ *
3061
+ * @param type - 字段 type
3062
+ * @returns 是否为叶子
3063
+ */
3064
+ var isLeafFieldType = (type) => {
3065
+ const key = (0, _tmagic_utils.toLine)(type);
3066
+ return extraLeafFieldTypes.has(key) || builtInLeafFieldTypes.has(key);
3067
+ };
3068
+ /**
3069
+ * 获取指定 type 挂载时改写 model 的副作用(已登记的优先于内置)。
3070
+ *
3071
+ * @param type - 字段 type
3072
+ * @returns 副作用函数;未登记则为 `undefined`
3073
+ */
3074
+ var getFieldMountValueEffect = (type) => {
3075
+ const key = (0, _tmagic_utils.toLine)(type);
3076
+ return extraMountValueEffects.get(key) ?? builtInMountValueEffects.get(key);
3077
+ };
3078
+ /**
3079
+ * 删除业务侧登记的叶子字段(不影响内置;主要用于单测)。
3080
+ *
3081
+ * @param type - 字段 type
3082
+ * @returns 是否删除成功
3083
+ */
3084
+ var deleteLeafFieldType = (type) => {
3085
+ const key = (0, _tmagic_utils.toLine)(type);
3086
+ extraMountValueEffects.delete(key);
3087
+ return extraLeafFieldTypes.delete(key);
3088
+ };
3089
+ /** 清空业务侧登记的叶子字段(不影响内置;主要用于单测)。 */
3090
+ var clearLeafFieldTypes = () => {
3091
+ extraLeafFieldTypes.clear();
3092
+ extraMountValueEffects.clear();
3093
+ };
3094
+ //#endregion
3095
+ //#region packages/form/src/utils/tableGroupList.ts
3096
+ /**
3097
+ * table / group-list 是同一份配置的两种展示形态,可以互相切换(`TableGroupList.vue`)。
3098
+ *
3099
+ * 本模块收口两种形态之间的配置派生,以及各形态下「子项配置怎么算出来」的规则,
3100
+ * 供渲染(`TableGroupList.vue` / `GroupListItem.vue` / `useTableColumns.ts`)与无渲染校验
3101
+ * (`collectValidatableFields`)共用,避免两条链路各写一份而产生偏差。
3102
+ */
3103
+ /** group-list 形态的 type(兼容驼峰与中划线两种写法) */
3104
+ var isGroupListType = (type) => type === "groupList" || type === "group-list";
3105
+ /** 按 label 文案长度估算 label 宽度(中文按 20px、其他按 8px,最小 80px) */
3106
+ var calcLabelWidth = (label) => {
3107
+ if (!label) return "0px";
3108
+ const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
3109
+ const chLength = label.length - zhLength;
3110
+ return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
3111
+ };
3112
+ /** 由 group-list 形态的配置派生出 table 形态所需的配置;本身已是 table 形态则原样返回 */
3113
+ var toTableConfig = (config) => {
3114
+ if (!isGroupListType(config.type)) return config;
3115
+ const source = config;
3116
+ return {
3117
+ ...config,
3118
+ type: "table",
3119
+ groupItems: source.items,
3120
+ items: source.tableItems || source.items.map((item) => ({
3121
+ ...item,
3122
+ label: item.label || item.text,
3123
+ text: null
3124
+ }))
3125
+ };
3126
+ };
3127
+ /** 由 table 形态的配置派生出 group-list 形态所需的配置;本身已是 group-list 形态则原样返回 */
3128
+ var toGroupListConfig = (config) => {
3129
+ if (isGroupListType(config.type)) return config;
3130
+ const source = config;
3131
+ return {
3132
+ ...config,
3133
+ type: "groupList",
3134
+ tableItems: source.items,
3135
+ items: source.groupItems || source.items.map((item) => {
3136
+ const text = item.text || item.label;
3137
+ return {
3138
+ ...item,
3139
+ text,
3140
+ labelWidth: calcLabelWidth(text),
3141
+ span: item.span || 12
3142
+ };
3143
+ })
3144
+ };
3145
+ };
3146
+ /**
3147
+ * group-list 每一行渲染的 row 容器配置(`GroupListItem.vue` 渲染的 `Container` 的 config)。
3148
+ *
3149
+ * `keyProp` 由调用方从 `mForm.keyProp` 取,默认 `__key`。
3150
+ */
3151
+ var getGroupListRowConfig = (config, index, keyProp) => {
3152
+ const key = keyProp || "__key";
3153
+ return {
3154
+ type: "row",
3155
+ span: config.span || 24,
3156
+ items: config.items,
3157
+ labelWidth: config.labelWidth,
3158
+ labelPosition: config.labelPosition,
3159
+ [key]: `${config[key]}${String(index)}`
3160
+ };
3161
+ };
3162
+ /**
3163
+ * 列是否会被渲染成一列(`hidden` 列不渲染,`display` 为假的列也不渲染)。
3164
+ *
3165
+ * `display` 的求值上下文是表格自身的 props,由调用方通过 `evalDisplay` 注入。
3166
+ */
3167
+ var isTableColumnRendered = (column, evalDisplay) => column.type !== "hidden" && Boolean(evalDisplay(column.display));
3168
+ /**
3169
+ * 单元格内 `Container` 实际收到的列配置:按行求值 `itemsFunction`,并去掉已在列层面消费过的 `display`。
3170
+ */
3171
+ var makeTableColumnConfig = (column, row) => {
3172
+ const newConfig = cloneDeep(column);
3173
+ if (typeof column.itemsFunction === "function") newConfig.items = column.itemsFunction(row);
3174
+ delete newConfig.display;
3175
+ return newConfig;
3176
+ };
3177
+ //#endregion
3178
+ //#region packages/form/src/utils/collectFields.ts
3179
+ /** 已登记的 innerConfig 回调自身抛错时抛出(机制故障,不是漏登记) */
3180
+ var FieldInnerConfigError = class extends Error {
3181
+ code = "FIELD_INNER_CONFIG";
3182
+ type;
3183
+ prop;
3184
+ constructor(type, prop, cause) {
3185
+ const reason = cause instanceof Error ? cause.message : String(cause);
3186
+ super(`[MForm] innerConfig for "${type}" at "${prop}" failed: ${reason}`);
3187
+ this.name = "FieldInnerConfigError";
3188
+ this.type = type;
3189
+ this.prop = prop;
3190
+ if (cause instanceof Error) this.cause = cause;
3191
+ }
3192
+ };
3193
+ var isFieldInnerConfigError = (error) => error instanceof FieldInnerConfigError || typeof error === "object" && error !== null && error.code === "FIELD_INNER_CONFIG";
3194
+ /** `effects` 模式下遍历全部配置,不受 display / 折叠状态影响 */
3195
+ var ignoresDisplay = (ctx) => ctx.mode === "effects";
3196
+ var extraContainerWalkers = /* @__PURE__ */ new Map();
3197
+ var builtInContainerWalkers = /* @__PURE__ */ new Map();
3198
+ var registerContainerWalker = (type, walker, builtIn = false) => {
3199
+ if (typeof type !== "string" || !type || typeof walker !== "function") return;
3200
+ const key = (0, _tmagic_utils.toLine)(type);
3201
+ if (builtIn) {
3202
+ builtInContainerWalkers.set(key, walker);
3203
+ return;
3204
+ }
3205
+ extraContainerWalkers.set(key, walker);
3206
+ };
3207
+ var getContainerWalker = (type) => {
3208
+ const key = (0, _tmagic_utils.toLine)(type);
3209
+ return extraContainerWalkers.get(key) ?? builtInContainerWalkers.get(key);
3210
+ };
3211
+ var deleteContainerWalker = (type) => extraContainerWalkers.delete((0, _tmagic_utils.toLine)(type));
3212
+ var clearContainerWalkers = () => extraContainerWalkers.clear();
3213
+ var getItems = (config) => config?.items;
3214
+ /**
3215
+ * `resolveItemType` 的静态版本:不求值函数型 `type`,由调用方按「未知」处理。
3216
+ *
3217
+ * 两者必须保持一致,否则预扫描判定的 type 与实际遍历的不同,会漏执行 effect。
3218
+ */
3219
+ var staticItemType = (config) => {
3220
+ const type = "type" in config ? config.type : "";
3221
+ if (type === "form" || type === "container") return "";
3222
+ return `${type || ""}`.replace(/([A-Z])/g, "-$1").toLowerCase() || (config.items ? "" : "text");
3223
+ };
3224
+ /**
3225
+ * 静态预判一份配置子树是否可能触发值初始化写入。
3226
+ *
3227
+ * 只有「确定不会」时才返回 false。函数型 `type`、`itemsFunction`、业务登记的容器遍历器、
3228
+ * 登记了 innerConfig 的复合字段,其运行期结构静态看不出来,一律按可能触发处理。
3229
+ *
3230
+ * 只用在同一份 `items` 会被逐行 / 逐标签页重复展开的地方(table、group-list、dynamic tab):
3231
+ * 预判成本是 O(子项数),跳过省下的是 O(行数 × 子项数),无 effect 的多行表格能省一个量级。
3232
+ * 其余位置不做预判——扫描与遍历的单节点成本相当,扫完再遍历只会更慢。
3233
+ *
3234
+ * 只看 `items`:table / group-list 只遍历当前形态的子项,另一形态的
3235
+ * `tableItems` / `groupItems` 不参与遍历,判定范围与遍历保持一致。
3236
+ */
3237
+ var mayRunEffects = (config) => {
3238
+ if (!config) return false;
3239
+ if (typeof config.type === "function" || typeof config.itemsFunction === "function") return true;
3240
+ const type = staticItemType(config);
3241
+ if (type === "hidden") return false;
3242
+ if (type) {
3243
+ const key = (0, _tmagic_utils.toLine)(type);
3244
+ if (extraContainerWalkers.has(key)) return true;
3245
+ if (!builtInContainerWalkers.has(key)) {
3246
+ if (getFieldInnerConfig(type) || getFieldMountValueEffect(type)) return true;
3247
+ if (isLeafFieldType(type)) return false;
3248
+ }
3249
+ }
3250
+ return itemsMayRunEffects(config.items);
3251
+ };
3252
+ var itemsMayRunEffects = (items) => Array.isArray(items) && items.some((item) => mayRunEffects(item));
3253
+ /**
3254
+ * 复刻 `Container.vue` 的 `display`。
3255
+ *
3256
+ * 与渲染的唯一差异:`display: 'expand'`(「展开更多配置」按钮背后的字段)在此视为可见。
3257
+ * 「是否已展开」纯粹是交互状态,不改变字段是否属于这份配置,无渲染校验按配置声明的范围校验。
3258
+ */
3259
+ var resolveDisplay = (ctx, config, nodeProps) => {
3260
+ if (ignoresDisplay(ctx)) return true;
3261
+ const value = display(ctx.mForm, config?.display, nodeProps);
3262
+ if (value === "expand") return true;
3263
+ return Boolean(value);
3264
+ };
3265
+ var addField = (ctx, node, itemProp, nodeProps) => {
3266
+ if (ctx.mode !== "collect") return;
3267
+ const rules = getNativeRules(ctx.mForm, node.config.rules, nodeProps, ctx.typeMatchValid);
3268
+ if (!rules.length) return;
3269
+ ctx.fields.push({
3270
+ prop: itemProp,
3271
+ rules,
3272
+ config: node.config,
3273
+ model: node.model
3274
+ });
3275
+ };
3276
+ var walkChildren = (ctx, items, model, prop) => {
3277
+ if (!Array.isArray(items)) return;
3278
+ for (const item of items) {
3279
+ if (!item) continue;
3280
+ walkNode(ctx, {
3281
+ config: item,
3282
+ model,
3283
+ prop
3284
+ });
3285
+ }
3286
+ };
3287
+ var getContainerScope = (node) => {
3288
+ const { config, model } = node;
3289
+ const name = config.name || "";
3290
+ return {
3291
+ config,
3292
+ model,
3293
+ name,
3294
+ items: getItems(config),
3295
+ childModel: name ? model?.[name] : model
3296
+ };
3297
+ };
3298
+ /** containers/Tabs.vue */
3299
+ var expandTab = (ctx, node, itemProp) => {
3300
+ const { config, model, name, items, childModel } = getContainerScope(node);
3301
+ const tabsProps = {
3302
+ model,
3303
+ config,
3304
+ prop: itemProp
3305
+ };
3306
+ if (config.dynamic) {
3307
+ if (!name) return;
3308
+ const tabs = model?.[name] || [];
3309
+ if (!tabs.length) return;
3310
+ if (ctx.mode === "effects" && !itemsMayRunEffects(items)) return;
3311
+ tabs.forEach((_tab, tabIndex) => {
3312
+ walkChildren(ctx, items, childModel?.[tabIndex], appendProp(itemProp, tabIndex));
3313
+ });
3314
+ return;
3315
+ }
3316
+ const tabs = ignoresDisplay(ctx) ? items || [] : (items || []).filter((item) => display(ctx.mForm, item?.display, tabsProps));
3317
+ for (const tab of tabs) {
3318
+ const tabName = tab.name;
3319
+ walkChildren(ctx, getItems(tab), tabName ? childModel?.[tabName] : childModel, tabName ? appendProp(itemProp, tabName) : itemProp);
3320
+ }
3321
+ };
3322
+ /** containers/Row.vue → Col.vue:col 用 v-show 控制显隐,始终渲染 */
3323
+ var expandRow = (ctx, node, itemProp) => {
3324
+ const { items, childModel } = getContainerScope(node);
3325
+ walkChildren(ctx, items, childModel, itemProp);
3326
+ };
3327
+ /** containers/Fieldset.vue */
3328
+ var expandFieldset = (ctx, node, itemProp) => {
3329
+ const { config, items, childModel } = getContainerScope(node);
3330
+ if (!childModel) return;
3331
+ const { checkbox } = config;
3332
+ const checkboxName = typeof checkbox === "object" && typeof checkbox.name === "string" ? checkbox.name : "value";
3333
+ const checkboxTrueValue = typeof checkbox === "object" && typeof checkbox.trueValue !== "undefined" ? checkbox.trueValue : 1;
3334
+ if (!ignoresDisplay(ctx) && config.expand && childModel?.[checkboxName] !== checkboxTrueValue) return;
3335
+ walkChildren(ctx, items, childModel, itemProp);
3336
+ };
3337
+ /** containers/Panel.vue:折叠仅 display:none,子项照常渲染 */
3338
+ var expandPanel = (ctx, node, itemProp) => {
3339
+ const { items, childModel } = getContainerScope(node);
3340
+ if (!items?.length) return;
3341
+ walkChildren(ctx, items, childModel, itemProp);
3342
+ };
3343
+ /** containers/Step.vue:非当前步仅 v-show 隐藏,子项照常渲染;prop 基准被重置为 step.name */
3344
+ var expandStep = (ctx, node, _itemProp) => {
3345
+ const { model, items } = getContainerScope(node);
3346
+ for (const step of items || []) {
3347
+ const stepName = step?.name;
3348
+ walkChildren(ctx, getItems(step), stepName ? model?.[stepName] : model, `${stepName}`);
3349
+ }
3350
+ };
3351
+ /**
3352
+ * 遍历 table / group-list。
3353
+ *
3354
+ * `TableGroupList.vue` 按原始 `config.type` 决定初始展示形态(table 或 groupList),
3355
+ * 两种形态的子项结构不同,这里分别复刻(形态间的配置派生复用 `utils/tableGroupList`,
3356
+ * 与渲染式实现同源):
3357
+ * - table:逐列(跳过 hidden 列与 display 为假的列)× 逐行渲染 Container,行 prop 为 `${prop}.${index}`;
3358
+ * - groupList:逐行渲染一个 row 容器,包含 `items` 全部字段。
3359
+ *
3360
+ * 与渲染的差异:不做分页截断(table)、不跳过折叠行(groupList)。二者都是列表的视图状态,
3361
+ * 与「这些行的值是否合法」无关,无渲染校验覆盖全部行。
3362
+ */
3363
+ var expandTableGroupList = (ctx, node, itemProp) => {
3364
+ const { config, model } = node;
3365
+ const name = config.name || "";
3366
+ const rows = model?.[name];
3367
+ if (!Array.isArray(rows) || !rows.length) return;
3368
+ if (isGroupListType(config.type)) {
3369
+ const groupListConfig = toGroupListConfig(config);
3370
+ if (ctx.mode === "effects" && !itemsMayRunEffects(groupListConfig.items)) return;
3371
+ rows.forEach((row, index) => {
3372
+ walkNode(ctx, {
3373
+ config: getGroupListRowConfig(groupListConfig, index, ctx.mForm?.keyProp),
3374
+ model: row,
3375
+ prop: appendProp(itemProp, index)
3376
+ });
3377
+ });
3378
+ return;
3379
+ }
3380
+ const tableItems = toTableConfig(config).items;
3381
+ if (!Array.isArray(tableItems)) return;
3382
+ if (ctx.mode === "effects" && !itemsMayRunEffects(tableItems)) return;
3383
+ const tableProps = {
3384
+ model,
3385
+ config,
3386
+ prop: itemProp
3387
+ };
3388
+ const evalDisplay = (display$1) => display(ctx.mForm, display$1, tableProps);
3389
+ const isRendered = (column) => ignoresDisplay(ctx) || isTableColumnRendered(column, evalDisplay);
3390
+ rows.forEach((row, index) => {
3391
+ for (const column of tableItems) {
3392
+ if (!column || !isRendered(column)) continue;
3393
+ walkNode(ctx, {
3394
+ config: makeTableColumnConfig(column, row),
3395
+ model: row,
3396
+ prop: appendProp(itemProp, index)
3397
+ });
3398
+ }
3399
+ });
3400
+ };
3401
+ /**
3402
+ * 执行某个叶子字段登记的值初始化写入。
3403
+ *
3404
+ * 跑在表单初始化路径上,单个字段的 effect 抛错不应该让整张表单渲染不出来,因此只记录并继续。
3405
+ */
3406
+ var runMountValueEffect = (ctx, type, node, itemProp) => {
3407
+ const effect = getFieldMountValueEffect(type);
3408
+ if (!effect) return;
3409
+ try {
3410
+ effect({
3411
+ config: node.config,
3412
+ model: node.model,
3413
+ prop: itemProp,
3414
+ mForm: ctx.mForm,
3415
+ values: ctx.values
3416
+ });
3417
+ } catch (e) {
3418
+ console.error(`[MForm] mount value effect for "${type}" at "${itemProp}" failed:`, e);
3419
+ }
3420
+ };
3421
+ /**
3422
+ * 遍历已登记 innerConfig 的复合字段。
3423
+ *
3424
+ * `collect` 模式下回调抛错视为机制故障,包装成 `FieldInnerConfigError` 抛出,由校验流程暴露。
3425
+ * `effects` 模式跑在表单初始化路径上,抛出会让整张表单渲染不出来,因此只记录并跳过该子树。
3426
+ */
3427
+ var walkInnerConfig = (ctx, type, node, itemProp) => {
3428
+ const resolve = getFieldInnerConfig(type);
3429
+ if (!resolve) return false;
3430
+ let result;
3431
+ try {
3432
+ result = resolve({
3433
+ config: node.config,
3434
+ model: node.model,
3435
+ prop: itemProp,
3436
+ parentProp: node.prop,
3437
+ mForm: ctx.mForm
3438
+ });
3439
+ } catch (e) {
3440
+ if (ctx.mode === "collect") throw new FieldInnerConfigError(type, itemProp, e);
3441
+ console.error(new FieldInnerConfigError(type, itemProp, e));
3442
+ return true;
3443
+ }
3444
+ if (!result) return true;
3445
+ const innerModel = result.model ?? node.model;
3446
+ const innerProp = result.prop ?? itemProp;
3447
+ walkChildren(ctx, Array.isArray(result.config) ? result.config : [result.config], innerModel, innerProp);
3448
+ return true;
3449
+ };
3450
+ /**
3451
+ * 遍历一个 Container 节点,分支顺序与 `Container.vue` 的模板保持一致。
3452
+ *
3453
+ * 对比模式(`isCompare`)在此被忽略:它只改变同一个 prop 渲染几份 FormItem,
3454
+ * 规则与取值完全相同,对校验结果没有影响。
3455
+ */
3456
+ var walkNode = (ctx, node) => {
3457
+ const { config, prop } = node;
3458
+ const model = node.model ?? {};
3459
+ const nodeProps = {
3460
+ model,
3461
+ config,
3462
+ prop
3463
+ };
3464
+ const name = config.name || "";
3465
+ const items = getItems(config);
3466
+ const type = resolveItemType(ctx.mForm, config, nodeProps);
3467
+ const itemProp = getItemProp(prop, name);
3468
+ const text = filterFunction(ctx.mForm, config.text, nodeProps);
3469
+ if (type === "hidden") {
3470
+ addField(ctx, {
3471
+ ...node,
3472
+ model
3473
+ }, itemProp, nodeProps);
3474
+ return;
3475
+ }
3476
+ const display = resolveDisplay(ctx, config, nodeProps);
3477
+ if (items && !text && type && display) {
3478
+ dispatchByType(ctx, type, {
3479
+ ...node,
3480
+ model
3481
+ }, itemProp);
3482
+ return;
3483
+ }
3484
+ if (type && display) {
3485
+ addField(ctx, {
3486
+ ...node,
3487
+ model
3488
+ }, itemProp, nodeProps);
3489
+ dispatchByType(ctx, type, {
3490
+ ...node,
3491
+ model
3492
+ }, itemProp);
3493
+ return;
3494
+ }
3495
+ if (items && display) {
3496
+ const childModel = isValidName(name) ? model[name] : model;
3497
+ if (!childModel) return;
3498
+ walkChildren(ctx, items, childModel, itemProp);
3499
+ }
3500
+ };
3501
+ /**
3502
+ * 按 type 分派:已登记 walk 的容器 → 按容器模板遍历;
3503
+ * `effects` 模式下先执行本字段的 effect(可与 innerConfig 并存,如 `code-select` 先归一化再下钻);
3504
+ * 登记了 innerConfig 的复合字段 → 遍历其内部配置;叶子字段无子树。
3505
+ *
3506
+ * 未登记的 type:配置里若有 `items` 则按普通容器下钻;否则视为没有嵌套表单项。
3507
+ * 自身 rules 已在 FormItem 分支收集,有 rules 就会校验。
3508
+ */
3509
+ var dispatchByType = (ctx, type, node, itemProp) => {
3510
+ const walkContainer = getContainerWalker(type);
3511
+ if (walkContainer) {
3512
+ walkContainer(ctx, node, itemProp);
3513
+ return;
3514
+ }
3515
+ if (ctx.mode === "effects") runMountValueEffect(ctx, type, node, itemProp);
3516
+ if (walkInnerConfig(ctx, type, node, itemProp)) return;
3517
+ if (isLeafFieldType(type)) return;
3518
+ const items = getItems(node.config);
3519
+ if (items?.length) {
3520
+ const { childModel } = getContainerScope(node);
3521
+ walkChildren(ctx, items, childModel, itemProp);
3522
+ }
3523
+ };
3524
+ /**
3525
+ * 纯逻辑收集「一份 config + 一份 values」中所有参与校验的字段。
3526
+ *
3527
+ * 遍历规则与 `Container.vue` 及各容器组件的模板一一对应,因此产出的 prop / rules
3528
+ * 与渲染式校验(挂载 MForm 后调用 `validate()`)等价,无需任何 DOM 或组件实例。
3529
+ *
3530
+ * 本函数只读不写。字段的值初始化副作用由 `applyMountValueEffects` 负责,
3531
+ * 调用方需在初始化表单值之后、收集字段之前执行一次(`validateValues` 已经这么做)。
3532
+ *
3533
+ * @param mForm - 表单状态;无渲染时由 `createHeadlessFormState` 构造
3534
+ * @param config - 表单配置
3535
+ * @param values - 表单值
3536
+ * @param [typeMatchValid] - 是否自动注入 typeMatch 规则;为 true 时,未显式声明
3537
+ * `typeMatch` 的字段会补上 `{ typeMatch: true }`,按字段 type 校验值形态
3538
+ * @returns 带规则的字段列表
3539
+ */
3540
+ var collectValidatableFields = (mForm, config, values, typeMatchValid) => {
3541
+ const ctx = {
3542
+ mForm,
3543
+ typeMatchValid,
3544
+ fields: [],
3545
+ values,
3546
+ mode: "collect"
3547
+ };
3548
+ if (Array.isArray(config)) walkChildren(ctx, config, values, "");
3549
+ return ctx.fields;
3550
+ };
3551
+ /**
3552
+ * 执行「一份 config + 一份 values」中所有叶子字段登记的值初始化写入,就地改写 `values`。
3553
+ *
3554
+ * 渲染与无渲染两条链路共用的唯一执行点:字段组件自身不再在 setup 里改写 model,
3555
+ * 由持有完整表单值的一方(`Form.vue` / `validateValues`)在表单值初始化完成、
3556
+ * 且已挂到 `mForm.values` 之后调用一次。这样 effect 与动态 `type` 回调读到的
3557
+ * `formValue` 就是最新值,而不是上一轮的旧值。
3558
+ *
3559
+ * 与 `collectValidatableFields` 的差异:不看 `display`(`display: false` 的字段也会规整)。
3560
+ * `type: 'hidden'` 会在该节点停止遍历,内部字段不执行 effect。
3561
+ *
3562
+ * `prop` 与 `values` 都以传入的 `values` 为根,因此也可以用于 tab / table 新增行这类
3563
+ * 「先构造一份子树的值,再挂到表单上」的场景:传入子树配置与该行的值即可。
3564
+ *
3565
+ * @param mForm - 表单状态;无渲染时由 `createHeadlessFormState` 构造
3566
+ * @param config - 表单配置
3567
+ * @param values - 表单值(会被就地修改)
3568
+ */
3569
+ var applyMountValueEffects = (mForm, config, values) => {
3570
+ if (!Array.isArray(config)) return;
3571
+ walkChildren({
3572
+ mForm,
3573
+ fields: [],
3574
+ values,
3575
+ mode: "effects"
3576
+ }, config, values, "");
3577
+ };
3578
+ //#endregion
3579
+ //#region packages/form/src/utils/builtInFields.ts
3580
+ /**
3581
+ * 内置字段的无渲染登记表(不含 Vue 组件)。
3582
+ *
3583
+ * 本模块只导出数据,不登记。调用方自行 `registerBuiltInFields(builtInFields)`,
3584
+ * 或 `app.use(MagicForm)`(install 里会登记叠上 Vue 组件后的表)。
3585
+ */
3586
+ var builtInFields = {
3587
+ text: {},
3588
+ "img-upload": {},
3589
+ number: {},
3590
+ "number-range": { effect },
3591
+ textarea: {},
3592
+ hidden: {},
3593
+ date: { effect: effect$4 },
3594
+ datetime: { effect: effect$3 },
3595
+ daterange: {},
3596
+ timerange: {},
3597
+ time: {},
3598
+ checkbox: {},
3599
+ switch: {},
3600
+ "color-picker": {},
3601
+ "checkbox-group": { effect: effect$5 },
3602
+ "radio-group": {},
3603
+ display: { effect: effect$2 },
3604
+ link: {},
3605
+ select: {},
3606
+ cascader: {},
3607
+ "dynamic-field": { effect: effect$1 },
3608
+ component: {},
3609
+ tab: { walk: expandTab },
3610
+ row: { walk: expandRow },
3611
+ "flex-layout": { walk: expandRow },
3612
+ fieldset: { walk: expandFieldset },
3613
+ panel: { walk: expandPanel },
3614
+ step: { walk: expandStep },
3615
+ table: { walk: expandTableGroupList },
3616
+ "group-list": { walk: expandTableGroupList },
3617
+ "table-group-list": { walk: expandTableGroupList }
3618
+ };
3619
+ //#endregion
3620
+ //#region packages/form/src/utils/registerField.ts
3621
+ var extraComponents = /* @__PURE__ */ new Map();
3622
+ var builtInComponents = /* @__PURE__ */ new Map();
3623
+ var applyVueComponent = (type, component, app, builtIn, kind) => {
3624
+ const key = (0, _tmagic_utils.toLine)(type);
3625
+ if (builtIn) builtInComponents.set(key, component);
3626
+ else extraComponents.set(key, component);
3627
+ app?.component(`m-${kind}-${key}`, component);
3628
+ };
3629
+ /**
3630
+ * 把多份字段登记表按 type 浅合并。后一份只覆盖自己带了的 key,未出现的 key 保留前一份。
3631
+ *
3632
+ * 安装插件时用:Node 侧只登记 `headless`,浏览器再补 `component` / `container`。
3633
+ *
3634
+ * @param tables - 待合并的登记表,`undefined` 会被跳过
3635
+ * @returns 合并后的登记表
3636
+ */
3637
+ var mergeFieldOptions = (...tables) => {
3638
+ const result = {};
3639
+ for (const table of tables) {
3640
+ if (!table) continue;
3641
+ for (const [type, options] of Object.entries(table)) result[type] = {
3642
+ ...result[type],
3643
+ ...pickDefinedFieldOptions(options)
3644
+ };
3645
+ }
3646
+ return result;
3647
+ };
3648
+ var FIELD_OPTION_KEYS = [
3649
+ "component",
3650
+ "container",
3651
+ "effect",
3652
+ "walk",
3653
+ "innerConfig",
3654
+ "typeMatch"
3655
+ ];
3656
+ var pickDefinedFieldOptions = (options) => {
3657
+ if (!options) return {};
3658
+ const next = {};
3659
+ for (const key of FIELD_OPTION_KEYS) if (options[key] !== void 0) next[key] = options[key];
3660
+ return next;
3661
+ };
3662
+ var extraFieldOptions = /* @__PURE__ */ new Map();
3663
+ var builtInFieldOptions = /* @__PURE__ */ new Map();
3664
+ var removeFormComponent = (type) => {
3665
+ extraComponents.delete((0, _tmagic_utils.toLine)(type));
3666
+ };
3667
+ var clearFormComponents = () => {
3668
+ extraComponents.clear();
3669
+ };
3670
+ /**
3671
+ * 按字段 type 取已登记的渲染组件(`codeSelect` 与 `code-select` 等价)。
3672
+ *
3673
+ * @param type - 字段 type
3674
+ * @returns 已登记的 Vue 组件;未登记则为 `undefined`
3675
+ */
3676
+ var getField = (type) => {
3677
+ const key = (0, _tmagic_utils.toLine)(type);
3678
+ return extraComponents.get(key) ?? builtInComponents.get(key);
3679
+ };
3680
+ var registerFieldImpl = (type, options, app, builtIn) => {
3681
+ if (typeof type !== "string" || !type) return;
3682
+ const key = (0, _tmagic_utils.toLine)(type);
3683
+ const store = builtIn ? builtInFieldOptions : extraFieldOptions;
3684
+ const incoming = pickDefinedFieldOptions(options);
3685
+ const merged = {
3686
+ ...store.get(key),
3687
+ ...incoming
3688
+ };
3689
+ store.set(key, merged);
3690
+ if (incoming.walk && (incoming.innerConfig || typeof incoming.effect === "function")) console.warn(`[MForm] registerField("${key}"): walk is set together with innerConfig/effect; headless validation will use walk and innerConfig/effect will be ignored.`);
3691
+ if (incoming.component && incoming.container) console.warn(`[MForm] registerField("${key}"): component and container are both set; getField will use container, and both m-fields-* / m-form-* will be registered.`);
3692
+ if (merged.component) applyVueComponent(type, merged.component, app, builtIn, "fields");
3693
+ if (merged.container) applyVueComponent(type, merged.container, app, builtIn, "form");
3694
+ if (merged.typeMatch) registerTypeMatchRule(type, merged.typeMatch, builtIn);
3695
+ if (merged.walk) {
3696
+ registerContainerWalker(type, merged.walk, builtIn);
3697
+ if (!builtIn) {
3698
+ deleteLeafFieldType(type);
3699
+ deleteFieldInnerConfig(type);
3700
+ }
3701
+ return;
3702
+ }
3703
+ if (!builtIn) deleteContainerWalker(type);
3704
+ if (merged.innerConfig) {
3705
+ registerFieldInnerConfig(type, merged.innerConfig, builtIn);
3706
+ if (typeof merged.effect === "function") registerLeafFieldType(type, merged.effect, builtIn);
3707
+ else if (!builtIn) deleteLeafFieldType(type);
3708
+ return;
3709
+ }
3710
+ if (merged.container && !merged.component && typeof merged.effect !== "function") {
3711
+ if (!builtIn) deleteLeafFieldType(type);
3712
+ return;
3713
+ }
3714
+ if (!builtIn) deleteFieldInnerConfig(type);
3715
+ registerLeafFieldType(type, merged.effect, builtIn);
3716
+ };
3717
+ /**
3718
+ * 登记一个字段 type 在无渲染校验里的行为,以及可选的渲染组件。
3719
+ *
3720
+ * `type` 会按 Container 的规则归一化为中划线形式(`codeSelect` 与 `code-select` 等价)。
3721
+ * 对同一 type 重复登记按字段浅合并:后一次只覆盖自己传入的 key,未传入的 key 保留。
3722
+ * 传入 `app` 且带了 `component` / `container` 时,会同步 `app.component('m-fields-*'` / `'m-form-*')`。
3723
+ *
3724
+ * @param type - 字段 type
3725
+ * @param [options] - 登记项;省略或空对象视为叶子
3726
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
3727
+ */
3728
+ var registerField = (type, options, app) => {
3729
+ registerFieldImpl(type, options, app, false);
3730
+ };
3731
+ /**
3732
+ * 批量登记字段。
3733
+ *
3734
+ * @param fields - type 到登记项的映射
3735
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
3736
+ */
3737
+ var registerFields = (fields, app) => {
3738
+ for (const [type, options] of Object.entries(fields)) registerFieldImpl(type, options, app, false);
3739
+ };
3740
+ /**
3741
+ * 登记内置字段(`clearFields` / `unregisterField` 不会清掉)。
3742
+ *
3743
+ * @param fields - type 到登记项的映射
3744
+ * @param [app] - Vue 应用;省略则不调用 `app.component`
3745
+ */
3746
+ var registerBuiltInFields = (fields, app) => {
3747
+ for (const [type, options] of Object.entries(fields)) registerFieldImpl(type, options, app, true);
3748
+ };
3749
+ /**
3750
+ * 删除业务侧对指定 type 的登记(不影响内置;主要用于单测)。
3751
+ *
3752
+ * @param type - 字段 type
3753
+ */
3754
+ var unregisterField = (type) => {
3755
+ extraFieldOptions.delete((0, _tmagic_utils.toLine)(type));
3756
+ deleteLeafFieldType(type);
3757
+ deleteFieldInnerConfig(type);
3758
+ deleteTypeMatchRule(type);
3759
+ deleteContainerWalker(type);
3760
+ removeFormComponent(type);
3761
+ };
3762
+ /** 清空业务侧登记(不影响内置;主要用于单测)。 */
3763
+ var clearFields = () => {
3764
+ extraFieldOptions.clear();
3765
+ clearLeafFieldTypes();
3766
+ clearFieldInnerConfigs();
3767
+ clearTypeMatchRules();
3768
+ clearContainerWalkers();
3769
+ clearFormComponents();
3770
+ };
3771
+ //#endregion
3772
+ //#region packages/form/src/utils/validateError.ts
3773
+ /**
3774
+ * 通过 name 从 config 中查找对应的 text
3775
+ *
3776
+ * @param name - 字段名,支持点分隔的路径格式,如 'a.b.c'
3777
+ * @param config - 表单配置数组
3778
+ * @returns 找到的 text 值,如果未找到则返回 undefined
3779
+ */
3780
+ var getTextByName = (name, config = []) => {
3781
+ if (!name || !Array.isArray(config)) return void 0;
3782
+ const nameParts = name.split(".");
3783
+ const findInConfig = (configs, parts) => {
3784
+ if (parts.length === 0) return void 0;
3785
+ const [currentPart, ...remainingParts] = parts;
3786
+ for (const item of configs) {
3787
+ if (item.name === currentPart) {
3788
+ if (remainingParts.length === 0) return typeof item.text === "string" ? item.text : void 0;
3789
+ if ("items" in item && Array.isArray(item.items)) {
3790
+ const result = findInConfig(item.items, remainingParts);
3791
+ if (result !== void 0) return result;
3792
+ }
3793
+ }
3794
+ if ("items" in item && Array.isArray(item.items)) {
3795
+ const result = findInConfig(item.items, parts);
3796
+ if (result !== void 0) return result;
3797
+ }
3798
+ }
3799
+ };
3800
+ return findInConfig(config, nameParts);
3801
+ };
3802
+ /**
3803
+ * 将校验返回的 invalidFields 汇总为可读的错误文案(多条以 `<br>` 拼接)。
3804
+ *
3805
+ * `useFieldTextInError` 为 `true`(默认)时用字段的 text 文案作为错误前缀,找不到则回退为字段 name。
3806
+ *
3807
+ * 由渲染式校验(Form.vue 的 `submitForm` / `validate`)与无渲染校验(`validateValues`)共用,
3808
+ * 保证两条校验链路产出的错误文案格式完全一致。
3809
+ *
3810
+ * @param invalidFields - async-validator 产出的字段错误表
3811
+ * @param [options] - 文案选项
3812
+ * @param [options.config] - 用于查找 text 的表单配置
3813
+ * @param [options.useFieldTextInError=true] - 错误前缀是否使用字段 text
3814
+ * @returns 拼接后的错误文案;无错误时为空串
3815
+ */
3816
+ var formatValidateError = (invalidFields, { config = [], useFieldTextInError = true } = {}) => {
3817
+ const error = [];
3818
+ Object.entries(invalidFields).forEach(([prop, validateError]) => {
3819
+ validateError.forEach(({ field, message }) => {
3820
+ const name = field || prop;
3821
+ const text = (useFieldTextInError ? getTextByName(name, config) : void 0) || name;
3822
+ error.push(`${text} -> ${message}`);
3823
+ });
3824
+ });
3825
+ return error.join("<br>");
3826
+ };
3827
+ //#endregion
3828
+ //#region packages/form/src/utils/validateValues.ts
3829
+ /**
3830
+ * 构造一个不依赖组件实例的 `formState`。
3831
+ *
3832
+ * 字段结构与 `Form.vue` 中 provide 给子树的 `mForm` 保持一致,使配置里的
3833
+ * `display` / `rules.validator` / `filter` 等回调拿到的上下文与渲染式校验相同。
3834
+ *
3835
+ * 差异:没有真实的表单实例,因此 `$emit` 为空实现、`fields` 注册表始终为空
3836
+ * (该注册表在整个仓库中只写不读,不参与校验)。
3837
+ */
3838
+ var createHeadlessFormState = (options) => {
3839
+ const context = options.context ?? {};
3840
+ const state = {
3841
+ keyProp: options.keyProp ?? "__key",
3842
+ popperClass: options.popperClass ?? "",
3843
+ config: options.config,
3844
+ initValues: options.initValues ?? {},
3845
+ isCompare: false,
3846
+ lastValues: {},
3847
+ parentValues: options.parentValues ?? {},
3848
+ values: {},
3849
+ lastValuesProcessed: {},
3850
+ $emit: () => void 0,
3851
+ ...createFormStateBase()
3852
+ };
3853
+ return createFormStateProxy((0, vue.reactive)(state), () => context);
3854
+ };
3855
+ /**
3856
+ * 按 prop 路径从表单值中取字段值,路径中断时返回 `undefined`。
3857
+ *
3858
+ * 不复用 `@tmagic/utils` 的 `getValueByKeyPath`:后者在路径中断时抛错,
3859
+ * 而 Element Plus 的 FormItem 取值是宽松的(拿不到就是 `undefined`),此处与之对齐。
3860
+ */
3861
+ var getFieldValue = (prop, values) => {
3862
+ if (!prop) return void 0;
3863
+ return prop.split(".").reduce((acc, key) => {
3864
+ if (acc === null || typeof acc !== "object") return void 0;
3865
+ return acc[key];
3866
+ }, values);
3867
+ };
3868
+ /**
3869
+ * 校验单个字段,返回 async-validator 的 `fields` 错误映射(通过则返回 `null`)。
3870
+ *
3871
+ * 与 Element Plus 的 FormItem 逐字段校验保持一致:
3872
+ * 每个字段独立构造一个 `Schema({ [prop]: rules })`,以字段自身的值为 source,
3873
+ * 并开启 `firstFields` 只取每个字段的首条错误;`trigger` 是 FormItem 用来筛选规则的
3874
+ * 元信息,交给 async-validator 前必须剔除,否则会改变规则的匹配方式。
3875
+ */
3876
+ var validateField = async (field, values) => {
3877
+ const rules = field.rules.map(({ trigger, ...rule }) => rule);
3878
+ if (!rules.length) return null;
3879
+ const value = getFieldValue(field.prop, values);
3880
+ try {
3881
+ await new async_validator.default({ [field.prop]: rules }).validate({ [field.prop]: value }, { firstFields: true });
3882
+ return null;
3883
+ } catch (err) {
3884
+ if (err?.fields) return err.fields;
3885
+ return { [field.prop]: [{
3886
+ field: field.prop,
3887
+ message: err?.message ?? `${err}`
3888
+ }] };
3889
+ }
3890
+ };
3891
+ /**
3892
+ * 不挂载任何组件,纯逻辑地对「一份 config + 一份值」执行一次完整校验。
3893
+ *
3894
+ * 流程与渲染式校验一一对应,但不需要 DOM,也不会实例化任何字段组件:
3895
+ *
3896
+ * 1. 构造 headless `formState` 并挂上 `context` 读穿;
3897
+ * 2. `initValue` 初始化表单值(默认值、嵌套结构、`onInitValue` 等);
3898
+ * 3. `applyMountValueEffects` 执行字段登记的值初始化写入(与渲染式共用同一份登记表);
3899
+ * 4. 遍历 config 树收集所有带规则的字段(等价于渲染出的 FormItem 集合);
3900
+ * 5. 逐字段交给 async-validator 执行,汇总错误文案。
3901
+ *
3902
+ * @example
3903
+ * ```ts
3904
+ * const { error, values } = await validateValues({
3905
+ * config: [...],
3906
+ * initValues: { name: '' },
3907
+ * typeMatchValid: true,
3908
+ * });
3909
+ * ```
3910
+ */
3911
+ var validateValues = async (options) => {
3912
+ const { config, initValues = {}, typeMatchValid, useFieldTextInError = true } = options;
3913
+ const formState = createHeadlessFormState(options);
3914
+ const values = await initValue(formState, {
3915
+ initValues,
3916
+ config
3917
+ });
3918
+ formState.values = values;
3919
+ applyMountValueEffects(formState, config, values);
3920
+ const fields = collectValidatableFields(formState, config, values, Boolean(typeMatchValid));
3921
+ const invalidFields = {};
3922
+ for (const field of fields) {
3923
+ const fieldErrors = await validateField(field, values);
3924
+ if (fieldErrors) Object.assign(invalidFields, fieldErrors);
3925
+ }
3926
+ return {
3927
+ values,
3928
+ invalidFields,
3929
+ error: formatValidateError(invalidFields, {
3930
+ config,
3931
+ useFieldTextInError
3932
+ })
3933
+ };
3934
+ };
3935
+ //#endregion
3936
+ //#region packages/form/src/utils/submitHeadless.ts
3937
+ var throwIfAborted = (signal, fnName) => {
3938
+ if (signal?.aborted) throw signal.reason ?? /* @__PURE__ */ new Error(`${fnName} aborted`);
3939
+ };
3940
+ var throwIfDialog = (dialog, fnName) => {
3941
+ if (dialog) throw new Error(`[MForm] ${fnName}({ dialog: true }) is not available from @tmagic/form/headless. Import from @tmagic/form instead.`);
3942
+ };
3943
+ /**
3944
+ * `submitForm` 与 `validateForm` 共用的无渲染校验流程:中断检查 → `validateValues`。
3945
+ */
3946
+ var validateWithoutRender = async (fnName, options) => {
3947
+ const { signal, config, initValues, parentValues, keyProp, typeMatchValid, useFieldTextInError, context } = options;
3948
+ throwIfAborted(signal, fnName);
3949
+ const result = await validateValues({
3950
+ config,
3951
+ initValues,
3952
+ parentValues,
3953
+ keyProp,
3954
+ popperClass: options.popperClass,
3955
+ typeMatchValid,
3956
+ useFieldTextInError,
3957
+ context
3958
+ });
3959
+ throwIfAborted(signal, fnName);
3960
+ return result;
3961
+ };
3962
+ /**
3963
+ * 以命令式方式对一份「表单配置 + 值」做一次校验并取回表单值(无渲染)。
3964
+ *
3965
+ * `@tmagic/form/headless` 不支持 `dialog: true`。
3966
+ */
3967
+ var submitForm = async (options) => {
3968
+ throwIfDialog(options.dialog, "submitForm");
3969
+ const validated = await validateWithoutRender("submitForm", options);
3970
+ if (validated.error) throw new Error(validated.error);
3971
+ const values = options.native ? validated.values : cloneDeep(validated.values);
3972
+ return options.returnChangeRecords ? {
3973
+ values,
3974
+ changeRecords: []
3975
+ } : values;
3976
+ };
3977
+ /**
3978
+ * 以命令式方式对一份「表单配置 + 值」做一次静默校验(无渲染)。
3979
+ *
3980
+ * `@tmagic/form/headless` 不支持 `dialog: true`。
3981
+ */
3982
+ var validateForm = async (options) => {
3983
+ throwIfDialog(options.dialog, "validateForm");
3984
+ return (await validateWithoutRender("validateForm", options)).error;
3985
+ };
3986
+ //#endregion
3987
+ exports.FORM_CONTEXT_KEY = FORM_CONTEXT_KEY;
3988
+ exports.FORM_DIFF_CONFIG_KEY = FORM_DIFF_CONFIG_KEY;
3989
+ exports.FORM_TYPE_MATCH_VALID_KEY = FORM_TYPE_MATCH_VALID_KEY;
3990
+ exports.FieldInnerConfigError = FieldInnerConfigError;
3991
+ exports.MAX_SUGGESTION_OPTIONS = MAX_SUGGESTION_OPTIONS;
3992
+ exports.adaptFormValidator = adaptFormValidator;
3993
+ exports.appendProp = appendProp;
3994
+ exports.applyMountValueEffects = applyMountValueEffects;
3995
+ exports.builtInFields = builtInFields;
3996
+ exports.clearFields = clearFields;
3997
+ exports.clearTypeMatchRules = clearTypeMatchRules;
3998
+ exports.collectValidatableFields = collectValidatableFields;
3999
+ exports.createFormStateBase = createFormStateBase;
4000
+ exports.createFormStateProxy = createFormStateProxy;
4001
+ exports.createHeadlessFormState = createHeadlessFormState;
4002
+ exports.createObjectProp = createObjectProp;
4003
+ exports.createValues = createValues;
4004
+ exports.datetimeFormatter = datetimeFormatter;
4005
+ exports.deleteTypeMatchRule = deleteTypeMatchRule;
4006
+ exports.display = display;
4007
+ exports.filterFunction = filterFunction;
4008
+ exports.formatValidateError = formatValidateError;
4009
+ exports.getDataByPage = getDataByPage;
4010
+ exports.getFormField = getField;
4011
+ exports.getItemProp = getItemProp;
4012
+ exports.getNativeRules = getNativeRules;
4013
+ exports.getRules = getRules;
4014
+ exports.getTextByName = getTextByName;
4015
+ exports.getTypeMatchRule = getTypeMatchRule;
4016
+ exports.initValue = initValue;
4017
+ exports.isFieldInnerConfigError = isFieldInnerConfigError;
4018
+ exports.isLeafFieldType = isLeafFieldType;
4019
+ exports.isValidName = isValidName;
4020
+ exports.mergeFieldOptions = mergeFieldOptions;
4021
+ exports.mergeFormContexts = mergeFormContexts;
4022
+ exports.optionSuggestion = optionSuggestion;
4023
+ exports.registerBuiltInFields = registerBuiltInFields;
4024
+ exports.registerField = registerField;
4025
+ exports.registerFields = registerFields;
4026
+ exports.resolveItemType = resolveItemType;
4027
+ exports.sortArray = sortArray;
4028
+ exports.sortChange = sortChange;
4029
+ exports.stringifyExampleValue = stringifyExampleValue;
4030
+ exports.submitForm = submitForm;
4031
+ exports.unregisterField = unregisterField;
4032
+ exports.validateForm = validateForm;
4033
+ exports.validateTypeMatch = validateTypeMatch;
4034
+ exports.validateValues = validateValues;
4035
+ var _tmagic_form_schema = require("@tmagic/form-schema");
4036
+ Object.keys(_tmagic_form_schema).forEach(function(k) {
4037
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
4038
+ enumerable: true,
4039
+ get: function() {
4040
+ return _tmagic_form_schema[k];
4041
+ }
4042
+ });
4043
+ });
4044
+ });