@tmagic/form 1.8.0-manmanyu.9 → 1.8.0

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