@vunk/plus 0.1.0 → 1.1.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 (59) hide show
  1. package/components/routes-menu-content/index.d.ts +4 -0
  2. package/components/routes-menu-content/index.mjs +305 -0
  3. package/components/routes-menu-content/src/ctx.d.ts +17 -0
  4. package/components/routes-menu-content/src/index.vue.d.ts +350 -0
  5. package/components/routes-menu-content/src/item/core/ctx.d.ts +18 -0
  6. package/components/routes-menu-content/src/item/core/index.vue.d.ts +185 -0
  7. package/components/routes-menu-content/src/item/ctx.d.ts +14 -0
  8. package/components/routes-menu-content/src/item/index.vue.d.ts +316 -0
  9. package/components/routes-menu-content/src/types.d.ts +1 -0
  10. package/components/table-columns/src/el-ctx.d.ts +1 -1
  11. package/components/table-columns/src/index.vue.d.ts +3 -3
  12. package/components/tables-v1/index.css +7 -0
  13. package/components/tables-v1/index.d.ts +5 -0
  14. package/components/tables-v1/index.mjs +431 -0
  15. package/components/tables-v1/src/ctx.d.ts +283 -0
  16. package/components/tables-v1/src/el-ctx.d.ts +272 -0
  17. package/components/tables-v1/src/index.vue.d.ts +2997 -0
  18. package/components/tables-v1/src/types.d.ts +4 -0
  19. package/components/tables-v1-checkbox/index.d.ts +4 -0
  20. package/components/tables-v1-checkbox/index.mjs +4092 -0
  21. package/components/tables-v1-checkbox/src/ctx.d.ts +274 -0
  22. package/components/tables-v1-checkbox/src/index.vue.d.ts +3723 -0
  23. package/components/tables-v1-checkbox/src/types.d.ts +1 -0
  24. package/components/typing-markdown/index.mjs +12 -1
  25. package/components/typing-markdown/src/ctx.d.ts +9 -0
  26. package/components/typing-markdown/src/index.vue.d.ts +10 -1
  27. package/composables/index.d.ts +18 -0
  28. package/composables/index.mjs +18 -0
  29. package/fetch/PlusFetch/index.d.ts +14 -0
  30. package/fetch/PlusFetch/index.mjs +638 -0
  31. package/fetch/PlusFetch/types.d.ts +54 -0
  32. package/fetch/index.d.ts +1 -0
  33. package/fetch/index.mjs +5 -0
  34. package/index.css +8 -0
  35. package/package.json +25 -42
  36. package/api/index.d.ts +0 -0
  37. package/api/index.mjs +0 -1
  38. package/api/user/index.d.ts +0 -3
  39. package/api/user/index.mjs +0 -18
  40. package/api/user/types.d.ts +0 -5
  41. package/shared/chatgpt/index.d.ts +0 -1
  42. package/shared/chatgpt/index.mjs +0 -3
  43. package/shared/chatgpt/response/enum.d.ts +0 -6
  44. package/shared/chatgpt/response/index.d.ts +0 -6
  45. package/shared/chatgpt/response/index.mjs +0 -16
  46. package/shared/chatgpt/response/sse/index.d.ts +0 -2
  47. package/shared/chatgpt/response/sse/index.mjs +0 -1
  48. package/shared/chatgpt/response/sse/message/index.d.ts +0 -4
  49. package/shared/chatgpt/response/sse/message/index.mjs +0 -8
  50. package/shared/chatgpt/response/sse/message/types.d.ts +0 -15
  51. package/shared/chatgpt/response/sse/types.d.ts +0 -6
  52. package/shared/fetch/base/index.d.ts +0 -9
  53. package/shared/fetch/base/index.mjs +0 -17
  54. package/shared/fetch/ssr/index.d.ts +0 -3
  55. package/shared/fetch/ssr/index.mjs +0 -11
  56. package/stores/index.d.ts +0 -0
  57. package/stores/index.mjs +0 -1
  58. package/theme/index.d.ts +0 -0
  59. package/theme/index.mjs +0 -1
@@ -0,0 +1,4092 @@
1
+ import { computed, ref, watch, inject, isVNode, Comment, Fragment, shallowRef, watchEffect, provide, onBeforeUnmount, onBeforeMount, toRef, defineComponent, h, createVNode, resolveComponent, openBlock, createBlock, withCtx, mergeProps, toHandlers } from 'vue';
2
+ import { _VkTabelsV1Ctx, VkTablesV1 } from '@vunk/plus/components/tables-v1';
3
+ import { VkCheckRecordLogicProvider, VkCheckRecordLogic } from '@vunk/core';
4
+ import { ElCheckbox } from 'element-plus';
5
+ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
6
+
7
+ /* eslint-disable @typescript-eslint/restrict-template-expressions */
8
+ /* eslint-disable @typescript-eslint/strict-boolean-expressions */
9
+ function plugin$1(options) {
10
+ let _bPrefix = '.';
11
+ let _ePrefix = '__';
12
+ let _mPrefix = '--';
13
+ let c;
14
+ if (options) {
15
+ let t = options.blockPrefix;
16
+ if (t) {
17
+ _bPrefix = t;
18
+ }
19
+ t = options.elementPrefix;
20
+ if (t) {
21
+ _ePrefix = t;
22
+ }
23
+ t = options.modifierPrefix;
24
+ if (t) {
25
+ _mPrefix = t;
26
+ }
27
+ }
28
+ const _plugin = {
29
+ install(instance) {
30
+ c = instance.c;
31
+ const ctx = instance.context;
32
+ ctx.bem = {};
33
+ ctx.bem.b = null;
34
+ ctx.bem.els = null;
35
+ }
36
+ };
37
+ function b(arg) {
38
+ let memorizedB;
39
+ let memorizedE;
40
+ return {
41
+ before(ctx) {
42
+ memorizedB = ctx.bem.b;
43
+ memorizedE = ctx.bem.els;
44
+ ctx.bem.els = null;
45
+ },
46
+ after(ctx) {
47
+ ctx.bem.b = memorizedB;
48
+ ctx.bem.els = memorizedE;
49
+ },
50
+ $({ context, props }) {
51
+ arg = typeof arg === 'string' ? arg : arg({ context, props });
52
+ context.bem.b = arg;
53
+ return `${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}`;
54
+ }
55
+ };
56
+ }
57
+ function e(arg) {
58
+ let memorizedE;
59
+ return {
60
+ before(ctx) {
61
+ memorizedE = ctx.bem.els;
62
+ },
63
+ after(ctx) {
64
+ ctx.bem.els = memorizedE;
65
+ },
66
+ $({ context, props }) {
67
+ arg = typeof arg === 'string' ? arg : arg({ context, props });
68
+ context.bem.els = arg.split(',').map(v => v.trim());
69
+ return context.bem.els
70
+ .map(el => `${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${_ePrefix}${el}`).join(', ');
71
+ }
72
+ };
73
+ }
74
+ function m(arg) {
75
+ return {
76
+ $({ context, props }) {
77
+ arg = typeof arg === 'string' ? arg : arg({ context, props });
78
+ const modifiers = arg.split(',').map(v => v.trim());
79
+ function elementToSelector(el) {
80
+ return modifiers.map(modifier => `&${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${el !== undefined ? `${_ePrefix}${el}` : ''}${_mPrefix}${modifier}`).join(', ');
81
+ }
82
+ const els = context.bem.els;
83
+ if (els !== null) {
84
+ if (process.env.NODE_ENV !== 'production' && els.length >= 2) {
85
+ throw Error(`[css-render/plugin-bem]: m(${arg}) is invalid, using modifier inside multiple elements is not allowed`);
86
+ }
87
+ return elementToSelector(els[0]);
88
+ }
89
+ else {
90
+ return elementToSelector();
91
+ }
92
+ }
93
+ };
94
+ }
95
+ function notM(arg) {
96
+ return {
97
+ $({ context, props }) {
98
+ arg = typeof arg === 'string' ? arg : arg({ context, props });
99
+ const els = context.bem.els;
100
+ if (process.env.NODE_ENV !== 'production' && els !== null && els.length >= 2) {
101
+ throw Error(`[css-render/plugin-bem]: notM(${arg}) is invalid, using modifier inside multiple elements is not allowed`);
102
+ }
103
+ return `&:not(${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${(els !== null && els.length > 0) ? `${_ePrefix}${els[0]}` : ''}${_mPrefix}${arg})`;
104
+ }
105
+ };
106
+ }
107
+ const cB = ((...args) => c(b(args[0]), args[1], args[2]));
108
+ const cE = ((...args) => c(e(args[0]), args[1], args[2]));
109
+ const cM = ((...args) => c(m(args[0]), args[1], args[2]));
110
+ const cNotM = ((...args) => c(notM(args[0]), args[1], args[2]));
111
+ Object.assign(_plugin, {
112
+ cB, cE, cM, cNotM
113
+ });
114
+ return _plugin;
115
+ }
116
+
117
+ function ampCount(selector) {
118
+ let cnt = 0;
119
+ for (let i = 0; i < selector.length; ++i) {
120
+ if (selector[i] === '&')
121
+ ++cnt;
122
+ }
123
+ return cnt;
124
+ }
125
+ /**
126
+ * Don't just use ',' to separate css selector. For example:
127
+ * x:(a, b) {} will be split into 'x:(a' and 'b)', which is not expected.
128
+ * Make sure comma doesn't exist inside parentheses.
129
+ */
130
+ const separatorRegex = /\s*,(?![^(]*\))\s*/g;
131
+ const extraSpaceRegex = /\s+/g;
132
+ /**
133
+ * selector must includes '&'
134
+ * selector is trimmed
135
+ * every part of amp is trimmed
136
+ */
137
+ function resolveSelectorWithAmp(amp, selector) {
138
+ const nextAmp = [];
139
+ selector.split(separatorRegex).forEach(partialSelector => {
140
+ let round = ampCount(partialSelector);
141
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
142
+ if (!round) {
143
+ amp.forEach(partialAmp => {
144
+ nextAmp.push(
145
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
146
+ (partialAmp && partialAmp + ' ') + partialSelector);
147
+ });
148
+ return;
149
+ }
150
+ else if (round === 1) {
151
+ amp.forEach(partialAmp => {
152
+ nextAmp.push(partialSelector.replace('&', partialAmp));
153
+ });
154
+ return;
155
+ }
156
+ let partialNextAmp = [
157
+ partialSelector
158
+ ];
159
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
160
+ while (round--) {
161
+ const nextPartialNextAmp = [];
162
+ partialNextAmp.forEach(selectorItr => {
163
+ amp.forEach(partialAmp => {
164
+ nextPartialNextAmp.push(selectorItr.replace('&', partialAmp));
165
+ });
166
+ });
167
+ partialNextAmp = nextPartialNextAmp;
168
+ }
169
+ partialNextAmp.forEach(part => nextAmp.push(part));
170
+ });
171
+ return nextAmp;
172
+ }
173
+ /**
174
+ * selector mustn't includes '&'
175
+ * selector is trimmed
176
+ */
177
+ function resolveSelector(amp, selector) {
178
+ const nextAmp = [];
179
+ selector.split(separatorRegex).forEach(partialSelector => {
180
+ amp.forEach(partialAmp => {
181
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
182
+ nextAmp.push(((partialAmp && partialAmp + ' ') + partialSelector));
183
+ });
184
+ });
185
+ return nextAmp;
186
+ }
187
+ function parseSelectorPath(selectorPaths) {
188
+ let amp = [''];
189
+ selectorPaths.forEach(selector => {
190
+ // eslint-disable-next-line
191
+ selector = selector && selector.trim();
192
+ if (
193
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
194
+ !selector) {
195
+ /**
196
+ * if it's a empty selector, do nothing
197
+ */
198
+ return;
199
+ }
200
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
201
+ if (selector.includes('&')) {
202
+ amp = resolveSelectorWithAmp(amp, selector);
203
+ }
204
+ else {
205
+ amp = resolveSelector(amp, selector);
206
+ }
207
+ });
208
+ return amp.join(', ').replace(extraSpaceRegex, ' ');
209
+ }
210
+
211
+ function removeElement(el) {
212
+ /* istanbul ignore if */
213
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
214
+ if (!el)
215
+ return;
216
+ const parentElement = el.parentElement;
217
+ /* istanbul ignore else */
218
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
219
+ if (parentElement)
220
+ parentElement.removeChild(el);
221
+ }
222
+ function queryElement(id, parent) {
223
+ return (parent !== null && parent !== void 0 ? parent : document.head).querySelector(`style[cssr-id="${id}"]`);
224
+ }
225
+ function createElement(id) {
226
+ const el = document.createElement('style');
227
+ el.setAttribute('cssr-id', id);
228
+ return el;
229
+ }
230
+ function isMediaOrSupports(selector) {
231
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
232
+ if (!selector)
233
+ return false;
234
+ return /^\s*@(s|m)/.test(selector);
235
+ }
236
+
237
+ const kebabRegex = /[A-Z]/g;
238
+ function kebabCase(pattern) {
239
+ return pattern.replace(kebabRegex, match => '-' + match.toLowerCase());
240
+ }
241
+ /** TODO: refine it to solve nested object */
242
+ function unwrapProperty(prop, indent = ' ') {
243
+ if (typeof prop === 'object' && prop !== null) {
244
+ return (' {\n' +
245
+ Object.entries(prop).map(v => {
246
+ return indent + ` ${kebabCase(v[0])}: ${v[1]};`;
247
+ }).join('\n') +
248
+ '\n' + indent + '}');
249
+ }
250
+ return `: ${prop};`;
251
+ }
252
+ /** unwrap properties */
253
+ function unwrapProperties(props, instance, params) {
254
+ if (typeof props === 'function') {
255
+ return props({
256
+ context: instance.context,
257
+ props: params
258
+ });
259
+ }
260
+ return props;
261
+ }
262
+ function createStyle(selector, props, instance, params) {
263
+ if (!props)
264
+ return '';
265
+ // eslint-disable-next-line
266
+ const unwrappedProps = unwrapProperties(props, instance, params);
267
+ if (!unwrappedProps)
268
+ return '';
269
+ if (typeof unwrappedProps === 'string') {
270
+ return `${selector} {\n${unwrappedProps}\n}`;
271
+ }
272
+ const propertyNames = Object.keys(unwrappedProps);
273
+ if (propertyNames.length === 0) {
274
+ if (instance.config.keepEmptyBlock)
275
+ return selector + ' {\n}';
276
+ return '';
277
+ }
278
+ const statements = selector
279
+ ? [
280
+ selector + ' {'
281
+ ]
282
+ : [];
283
+ propertyNames.forEach(propertyName => {
284
+ const property = unwrappedProps[propertyName];
285
+ if (propertyName === 'raw') {
286
+ statements.push('\n' + property + '\n');
287
+ return;
288
+ }
289
+ propertyName = kebabCase(propertyName);
290
+ if (property !== null && property !== undefined) {
291
+ statements.push(` ${propertyName}${unwrapProperty(property)}`);
292
+ }
293
+ });
294
+ if (selector) {
295
+ statements.push('}');
296
+ }
297
+ return statements.join('\n');
298
+ }
299
+ function loopCNodeListWithCallback(children, options, callback) {
300
+ /* istanbul ignore if */
301
+ if (!children)
302
+ return;
303
+ children.forEach(child => {
304
+ if (Array.isArray(child)) {
305
+ loopCNodeListWithCallback(child, options, callback);
306
+ }
307
+ else if (typeof child === 'function') {
308
+ const grandChildren = child(options);
309
+ if (Array.isArray(grandChildren)) {
310
+ loopCNodeListWithCallback(grandChildren, options, callback);
311
+ }
312
+ else if (grandChildren) {
313
+ callback(grandChildren);
314
+ }
315
+ }
316
+ else if (child) {
317
+ callback(child);
318
+ }
319
+ });
320
+ }
321
+ function traverseCNode(node, selectorPaths, styles, instance, params) {
322
+ const $ = node.$;
323
+ let blockSelector = '';
324
+ if (!$ || typeof $ === 'string') {
325
+ if (isMediaOrSupports($)) {
326
+ blockSelector = $;
327
+ }
328
+ else {
329
+ // as a string selector
330
+ selectorPaths.push($);
331
+ }
332
+ }
333
+ else if (typeof $ === 'function') {
334
+ const selector = $({
335
+ context: instance.context,
336
+ props: params
337
+ });
338
+ if (isMediaOrSupports(selector)) {
339
+ blockSelector = selector;
340
+ }
341
+ else {
342
+ // as a lazy selector
343
+ selectorPaths.push(selector);
344
+ }
345
+ }
346
+ else { // as a option selector
347
+ if ($.before)
348
+ $.before(instance.context);
349
+ if (!$.$ || typeof $.$ === 'string') {
350
+ if (isMediaOrSupports($.$)) {
351
+ blockSelector = $.$;
352
+ }
353
+ else {
354
+ // as a string selector
355
+ selectorPaths.push($.$);
356
+ }
357
+ }
358
+ else /* istanbul ignore else */ if ($.$) {
359
+ const selector = $.$({
360
+ context: instance.context,
361
+ props: params
362
+ });
363
+ if (isMediaOrSupports(selector)) {
364
+ blockSelector = selector;
365
+ }
366
+ else {
367
+ // as a lazy selector
368
+ selectorPaths.push(selector);
369
+ }
370
+ }
371
+ }
372
+ const selector = parseSelectorPath(selectorPaths);
373
+ const style = createStyle(selector, node.props, instance, params);
374
+ if (blockSelector) {
375
+ styles.push(`${blockSelector} {`);
376
+ }
377
+ else if (style.length) {
378
+ styles.push(style);
379
+ }
380
+ if (node.children) {
381
+ loopCNodeListWithCallback(node.children, {
382
+ context: instance.context,
383
+ props: params
384
+ }, childNode => {
385
+ if (typeof childNode === 'string') {
386
+ const style = createStyle(selector, { raw: childNode }, instance, params);
387
+ styles.push(style);
388
+ }
389
+ else {
390
+ traverseCNode(childNode, selectorPaths, styles, instance, params);
391
+ }
392
+ });
393
+ }
394
+ selectorPaths.pop();
395
+ if (blockSelector) {
396
+ styles.push('}');
397
+ }
398
+ if ($ && $.after)
399
+ $.after(instance.context);
400
+ }
401
+ function render(node, instance, props) {
402
+ const styles = [];
403
+ traverseCNode(node, [], styles, instance, props);
404
+ return styles.join('\n\n');
405
+ }
406
+
407
+ /* eslint-disable */
408
+ // Inspired by https://github.com/garycourt/murmurhash-js
409
+ // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
410
+ function murmur2(str) {
411
+ // 'm' and 'r' are mixing constants generated offline.
412
+ // They're not really 'magic', they just happen to work well.
413
+ // const m = 0x5bd1e995;
414
+ // const r = 24;
415
+ // Initialize the hash
416
+ var h = 0; // Mix 4 bytes at a time into the hash
417
+
418
+ var k,
419
+ i = 0,
420
+ len = str.length;
421
+
422
+ for (; len >= 4; ++i, len -= 4) {
423
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
424
+ k =
425
+ /* Math.imul(k, m): */
426
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
427
+ k ^=
428
+ /* k >>> r: */
429
+ k >>> 24;
430
+ h =
431
+ /* Math.imul(k, m): */
432
+ (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
433
+ /* Math.imul(h, m): */
434
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
435
+ } // Handle the last few bytes of the input array
436
+
437
+
438
+ switch (len) {
439
+ case 3:
440
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
441
+
442
+ case 2:
443
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
444
+
445
+ case 1:
446
+ h ^= str.charCodeAt(i) & 0xff;
447
+ h =
448
+ /* Math.imul(h, m): */
449
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
450
+ } // Do a few final mixes of the hash to ensure the last few
451
+ // bytes are well-incorporated.
452
+
453
+
454
+ h ^= h >>> 13;
455
+ h =
456
+ /* Math.imul(h, m): */
457
+ (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
458
+ return ((h ^ h >>> 15) >>> 0).toString(36);
459
+ }
460
+
461
+ /* eslint-disable @typescript-eslint/prefer-ts-expect-error */
462
+ /* eslint-disable @typescript-eslint/strict-boolean-expressions */
463
+ if (typeof window !== 'undefined') {
464
+ window.__cssrContext = {};
465
+ }
466
+ function unmount(instance, node, id, parent) {
467
+ const { els } = node;
468
+ // If id is undefined, unmount all styles
469
+ if (id === undefined) {
470
+ els.forEach(removeElement);
471
+ node.els = [];
472
+ }
473
+ else {
474
+ const target = queryElement(id, parent);
475
+ // eslint-disable-next-line
476
+ if (target && els.includes(target)) {
477
+ removeElement(target);
478
+ node.els = els.filter((el) => el !== target);
479
+ }
480
+ }
481
+ }
482
+ function addElementToList(els, target) {
483
+ els.push(target);
484
+ }
485
+ function mount(instance, node, id, props, head, force, anchorMetaName, parent, ssrAdapter
486
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
487
+ ) {
488
+ let style;
489
+ if (id === undefined) {
490
+ style = node.render(props);
491
+ id = murmur2(style);
492
+ }
493
+ if (ssrAdapter) {
494
+ ssrAdapter.adapter(id, style !== null && style !== void 0 ? style : node.render(props));
495
+ return;
496
+ }
497
+ if (parent === undefined) {
498
+ parent = document.head;
499
+ }
500
+ const queriedTarget = queryElement(id, parent);
501
+ if (queriedTarget !== null && !force) {
502
+ return queriedTarget;
503
+ }
504
+ const target = queriedTarget !== null && queriedTarget !== void 0 ? queriedTarget : createElement(id);
505
+ if (style === undefined)
506
+ style = node.render(props);
507
+ target.textContent = style;
508
+ if (queriedTarget !== null)
509
+ return queriedTarget;
510
+ if (anchorMetaName) {
511
+ const anchorMetaEl = parent.querySelector(`meta[name="${anchorMetaName}"]`);
512
+ if (anchorMetaEl) {
513
+ parent.insertBefore(target, anchorMetaEl);
514
+ addElementToList(node.els, target);
515
+ return target;
516
+ }
517
+ }
518
+ if (head) {
519
+ parent.insertBefore(target, parent.querySelector('style, link'));
520
+ }
521
+ else {
522
+ parent.appendChild(target);
523
+ }
524
+ addElementToList(node.els, target);
525
+ return target;
526
+ }
527
+
528
+ function wrappedRender(props) {
529
+ return render(this, this.instance, props);
530
+ }
531
+ // do not guard node calling, it should throw an error.
532
+ function wrappedMount(options = {}
533
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
534
+ ) {
535
+ const { id, ssr, props, head = false, force = false, anchorMetaName, parent } = options;
536
+ const targetElement = mount(this.instance, this, id, props, head, force, anchorMetaName, parent, ssr);
537
+ return targetElement;
538
+ }
539
+ function wrappedUnmount(options = {}) {
540
+ /* istanbul ignore next */
541
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
542
+ const { id, parent } = options;
543
+ unmount(this.instance, this, id, parent);
544
+ }
545
+ const createCNode = function (instance, $, props, children) {
546
+ return {
547
+ instance,
548
+ $,
549
+ props,
550
+ children,
551
+ els: [],
552
+ render: wrappedRender,
553
+ mount: wrappedMount,
554
+ unmount: wrappedUnmount
555
+ };
556
+ };
557
+ const c$1 = function (instance, $, props, children) {
558
+ if (Array.isArray($)) {
559
+ return createCNode(instance, { $: null }, null, $);
560
+ }
561
+ else if (Array.isArray(props)) {
562
+ return createCNode(instance, $, null, props);
563
+ }
564
+ else if (Array.isArray(children)) {
565
+ return createCNode(instance, $, props, children);
566
+ }
567
+ else {
568
+ return createCNode(instance, $, props, null);
569
+ }
570
+ };
571
+
572
+ function CssRender(config = {}) {
573
+ const cssr = {
574
+ c: ((...args) => c$1(cssr, ...args)),
575
+ use: (plugin, ...args) => plugin.install(cssr, ...args),
576
+ find: queryElement,
577
+ context: {},
578
+ config
579
+ };
580
+ return cssr;
581
+ }
582
+
583
+ function exists(id, ssr) {
584
+ if (id === undefined)
585
+ return false;
586
+ if (ssr) {
587
+ const { context: { ids } } = ssr;
588
+ return ids.has(id);
589
+ }
590
+ return queryElement(id) !== null;
591
+ }
592
+
593
+ const namespace = 'n';
594
+ const prefix$1 = `.${namespace}-`;
595
+ const elementPrefix = '__';
596
+ const modifierPrefix = '--';
597
+ const cssr = CssRender();
598
+ const plugin = plugin$1({
599
+ blockPrefix: prefix$1,
600
+ elementPrefix,
601
+ modifierPrefix
602
+ });
603
+ cssr.use(plugin);
604
+ const {
605
+ c,
606
+ find
607
+ } = cssr;
608
+ const {
609
+ cB,
610
+ cE,
611
+ cM,
612
+ cNotM
613
+ } = plugin;
614
+ function createKey(prefix, suffix) {
615
+ return prefix + (suffix === 'default' ? '' : suffix.replace(/^[a-z]/, startChar => startChar.toUpperCase()));
616
+ }
617
+
618
+ var colors = {
619
+ black: '#000',
620
+ silver: '#C0C0C0',
621
+ gray: '#808080',
622
+ white: '#FFF',
623
+ maroon: '#800000',
624
+ red: '#F00',
625
+ purple: '#800080',
626
+ fuchsia: '#F0F',
627
+ green: '#008000',
628
+ lime: '#0F0',
629
+ olive: '#808000',
630
+ yellow: '#FF0',
631
+ navy: '#000080',
632
+ blue: '#00F',
633
+ teal: '#008080',
634
+ aqua: '#0FF',
635
+ transparent: '#0000'
636
+ };
637
+
638
+ const prefix = '^\\s*';
639
+ const suffix = '\\s*$';
640
+ const float = '\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*'; // 4 offset
641
+ const hex = '([0-9A-Fa-f])';
642
+ const dhex = '([0-9A-Fa-f]{2})';
643
+ const rgbRegex = new RegExp(`${prefix}rgb\\s*\\(${float},${float},${float}\\)${suffix}`);
644
+ const rgbaRegex = new RegExp(`${prefix}rgba\\s*\\(${float},${float},${float},${float}\\)${suffix}`);
645
+ const sHexRegex = new RegExp(`${prefix}#${hex}${hex}${hex}${suffix}`);
646
+ const hexRegex = new RegExp(`${prefix}#${dhex}${dhex}${dhex}${suffix}`);
647
+ const sHexaRegex = new RegExp(`${prefix}#${hex}${hex}${hex}${hex}${suffix}`);
648
+ const hexaRegex = new RegExp(`${prefix}#${dhex}${dhex}${dhex}${dhex}${suffix}`);
649
+ function parseHex(value) {
650
+ return parseInt(value, 16);
651
+ }
652
+ /**
653
+ * Convert color string to rgba array.
654
+ * @param color format like #000[0], #000000[00], rgb(0, 0, 0), rgba(0, 0, 0, 0) and basic color keywords https://www.w3.org/TR/css-color-3/#html4 and transparent
655
+ * @returns
656
+ */
657
+ function rgba(color) {
658
+ try {
659
+ let i;
660
+ if ((i = hexRegex.exec(color))) {
661
+ return [parseHex(i[1]), parseHex(i[2]), parseHex(i[3]), 1];
662
+ }
663
+ else if ((i = rgbRegex.exec(color))) {
664
+ return [roundChannel(i[1]), roundChannel(i[5]), roundChannel(i[9]), 1];
665
+ }
666
+ else if ((i = rgbaRegex.exec(color))) {
667
+ return [
668
+ roundChannel(i[1]),
669
+ roundChannel(i[5]),
670
+ roundChannel(i[9]),
671
+ roundAlpha(i[13])
672
+ ];
673
+ }
674
+ else if ((i = sHexRegex.exec(color))) {
675
+ return [
676
+ parseHex(i[1] + i[1]),
677
+ parseHex(i[2] + i[2]),
678
+ parseHex(i[3] + i[3]),
679
+ 1
680
+ ];
681
+ }
682
+ else if ((i = hexaRegex.exec(color))) {
683
+ return [
684
+ parseHex(i[1]),
685
+ parseHex(i[2]),
686
+ parseHex(i[3]),
687
+ roundAlpha(parseHex(i[4]) / 255)
688
+ ];
689
+ }
690
+ else if ((i = sHexaRegex.exec(color))) {
691
+ return [
692
+ parseHex(i[1] + i[1]),
693
+ parseHex(i[2] + i[2]),
694
+ parseHex(i[3] + i[3]),
695
+ roundAlpha(parseHex(i[4] + i[4]) / 255)
696
+ ];
697
+ }
698
+ else if (color in colors) {
699
+ return rgba(colors[color]);
700
+ }
701
+ throw new Error(`[seemly/rgba]: Invalid color value ${color}.`);
702
+ }
703
+ catch (e) {
704
+ throw e;
705
+ }
706
+ }
707
+ function normalizeAlpha(alphaValue) {
708
+ return alphaValue > 1 ? 1 : alphaValue < 0 ? 0 : alphaValue;
709
+ }
710
+ function stringifyRgba(r, g, b, a) {
711
+ return `rgba(${roundChannel(r)}, ${roundChannel(g)}, ${roundChannel(b)}, ${normalizeAlpha(a)})`;
712
+ }
713
+ function compositeChannel(v1, a1, v2, a2, a) {
714
+ return roundChannel((v1 * a1 * (1 - a2) + v2 * a2) / a);
715
+ }
716
+ function composite(background, overlay) {
717
+ if (!Array.isArray(background))
718
+ background = rgba(background);
719
+ if (!Array.isArray(overlay))
720
+ overlay = rgba(overlay);
721
+ const a1 = background[3];
722
+ const a2 = overlay[3];
723
+ const alpha = roundAlpha(a1 + a2 - a1 * a2);
724
+ return stringifyRgba(compositeChannel(background[0], a1, overlay[0], a2, alpha), compositeChannel(background[1], a1, overlay[1], a2, alpha), compositeChannel(background[2], a1, overlay[2], a2, alpha), alpha);
725
+ }
726
+ function changeColor(base, options) {
727
+ const [r, g, b, a = 1] = Array.isArray(base) ? base : rgba(base);
728
+ if (options.alpha) {
729
+ return stringifyRgba(r, g, b, options.alpha);
730
+ }
731
+ return stringifyRgba(r, g, b, a);
732
+ }
733
+ function scaleColor(base, options) {
734
+ const [r, g, b, a = 1] = Array.isArray(base) ? base : rgba(base);
735
+ const { lightness = 1, alpha = 1 } = options;
736
+ return toRgbaString([r * lightness, g * lightness, b * lightness, a * alpha]);
737
+ }
738
+ function roundAlpha(value) {
739
+ const v = Math.round(Number(value) * 100) / 100;
740
+ if (v > 1)
741
+ return 1;
742
+ if (v < 0)
743
+ return 0;
744
+ return v;
745
+ }
746
+ function roundChannel(value) {
747
+ const v = Math.round(Number(value));
748
+ if (v > 255)
749
+ return 255;
750
+ if (v < 0)
751
+ return 0;
752
+ return v;
753
+ }
754
+ function toRgbaString(base) {
755
+ const [r, g, b] = base;
756
+ if (3 in base) {
757
+ return `rgba(${roundChannel(r)}, ${roundChannel(g)}, ${roundChannel(b)}, ${roundAlpha(base[3])})`;
758
+ }
759
+ return `rgba(${roundChannel(r)}, ${roundChannel(g)}, ${roundChannel(b)}, 1)`;
760
+ }
761
+
762
+ function useMemo(getterOrOptions) {
763
+ const computedValueRef = computed(getterOrOptions);
764
+ // Maybe it's not possible to lazy evaluate the value, since we can't make
765
+ // render phase capture the deps behind useMemo
766
+ const valueRef = ref(computedValueRef.value);
767
+ watch(computedValueRef, (value) => {
768
+ valueRef.value = value;
769
+ });
770
+ if (typeof getterOrOptions === 'function') {
771
+ return valueRef;
772
+ }
773
+ else {
774
+ return {
775
+ __v_isRef: true,
776
+ get value() {
777
+ return valueRef.value;
778
+ },
779
+ set value(v) {
780
+ getterOrOptions.set(v);
781
+ }
782
+ };
783
+ }
784
+ }
785
+
786
+ function useMergedState(controlledStateRef, uncontrolledStateRef) {
787
+ watch(controlledStateRef, value => {
788
+ if (value !== undefined) {
789
+ uncontrolledStateRef.value = value;
790
+ }
791
+ });
792
+ return computed(() => {
793
+ if (controlledStateRef.value === undefined) {
794
+ return uncontrolledStateRef.value;
795
+ }
796
+ return controlledStateRef.value;
797
+ });
798
+ }
799
+
800
+ function createInjectionKey(key) {
801
+ return key;
802
+ }
803
+
804
+ const ssrContextKey = '@css-render/vue3-ssr';
805
+ function createStyleString(id, style) {
806
+ return `<style cssr-id="${id}">\n${style}\n</style>`;
807
+ }
808
+ function ssrAdapter(id, style, ssrContext) {
809
+ const { styles, ids } = ssrContext;
810
+ // we need to impl other options to make it behaves the same as the client side
811
+ if (ids.has(id))
812
+ return;
813
+ if (styles !== null) {
814
+ ids.add(id);
815
+ styles.push(createStyleString(id, style));
816
+ }
817
+ }
818
+ const isBrowser = typeof document !== 'undefined';
819
+ function useSsrAdapter() {
820
+ if (isBrowser)
821
+ return undefined;
822
+ const context = inject(ssrContextKey, null);
823
+ if (context === null)
824
+ return undefined;
825
+ return {
826
+ adapter: (id, style) => ssrAdapter(id, style, context),
827
+ context
828
+ };
829
+ }
830
+
831
+ const warnedMessages = new Set();
832
+ function warnOnce(location, message) {
833
+ const mergedMessage = `[naive/${location}]: ${message}`;
834
+ if (warnedMessages.has(mergedMessage)) return;
835
+ warnedMessages.add(mergedMessage);
836
+ console.error(mergedMessage);
837
+ }
838
+ function throwError(location, message) {
839
+ throw new Error(`[naive/${location}]: ${message}`);
840
+ }
841
+
842
+ function call(funcs, ...args) {
843
+ if (Array.isArray(funcs)) {
844
+ funcs.forEach(func => call(func, ...args));
845
+ } else {
846
+ return funcs(...args);
847
+ }
848
+ }
849
+
850
+ function ensureValidVNode(vnodes) {
851
+ return vnodes.some(child => {
852
+ if (!isVNode(child)) {
853
+ return true;
854
+ }
855
+ if (child.type === Comment) {
856
+ return false;
857
+ }
858
+ if (child.type === Fragment && !ensureValidVNode(child.children)) {
859
+ return false;
860
+ }
861
+ return true;
862
+ }) ? vnodes : null;
863
+ }
864
+ /**
865
+ * Resolve slot with wrapper if content exists, no fallback
866
+ */
867
+ function resolveWrappedSlot(slot, wrapper) {
868
+ const children = slot && ensureValidVNode(slot());
869
+ return wrapper(children || null);
870
+ }
871
+
872
+ const configProviderInjectionKey = createInjectionKey('n-config-provider');
873
+
874
+ const defaultClsPrefix = 'n';
875
+ function useConfig(props = {}, options = {
876
+ defaultBordered: true
877
+ }) {
878
+ const NConfigProvider = inject(configProviderInjectionKey, null);
879
+ return {
880
+ // NConfigProvider,
881
+ inlineThemeDisabled: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.inlineThemeDisabled,
882
+ mergedRtlRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedRtlRef,
883
+ mergedComponentPropsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedComponentPropsRef,
884
+ mergedBreakpointsRef: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBreakpointsRef,
885
+ mergedBorderedRef: computed(() => {
886
+ var _a, _b;
887
+ const {
888
+ bordered
889
+ } = props;
890
+ if (bordered !== undefined) return bordered;
891
+ return (_b = (_a = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedBorderedRef.value) !== null && _a !== void 0 ? _a : options.defaultBordered) !== null && _b !== void 0 ? _b : true;
892
+ }),
893
+ mergedClsPrefixRef: NConfigProvider ? NConfigProvider.mergedClsPrefixRef : shallowRef(defaultClsPrefix),
894
+ namespaceRef: computed(() => NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedNamespaceRef.value)
895
+ };
896
+ }
897
+
898
+ function useThemeClass(componentName, hashRef, cssVarsRef, props) {
899
+ if (!cssVarsRef) throwError('useThemeClass', 'cssVarsRef is not passed');
900
+ const NConfigProvider = inject(configProviderInjectionKey, null);
901
+ const mergedThemeHashRef = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeHashRef;
902
+ const styleMountTarget = NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget;
903
+ const themeClassRef = ref('');
904
+ const ssrAdapter = useSsrAdapter();
905
+ let renderCallback;
906
+ const hashClassPrefix = `__${componentName}`;
907
+ const mountStyle = () => {
908
+ let finalThemeHash = hashClassPrefix;
909
+ const hashValue = hashRef ? hashRef.value : undefined;
910
+ const themeHash = mergedThemeHashRef === null || mergedThemeHashRef === void 0 ? void 0 : mergedThemeHashRef.value;
911
+ if (themeHash) finalThemeHash += `-${themeHash}`;
912
+ if (hashValue) finalThemeHash += `-${hashValue}`;
913
+ const {
914
+ themeOverrides,
915
+ builtinThemeOverrides
916
+ } = props;
917
+ if (themeOverrides) {
918
+ finalThemeHash += `-${murmur2(JSON.stringify(themeOverrides))}`;
919
+ }
920
+ if (builtinThemeOverrides) {
921
+ finalThemeHash += `-${murmur2(JSON.stringify(builtinThemeOverrides))}`;
922
+ }
923
+ themeClassRef.value = finalThemeHash;
924
+ renderCallback = () => {
925
+ const cssVars = cssVarsRef.value;
926
+ let style = '';
927
+ for (const key in cssVars) {
928
+ style += `${key}: ${cssVars[key]};`;
929
+ }
930
+ c(`.${finalThemeHash}`, style).mount({
931
+ id: finalThemeHash,
932
+ ssr: ssrAdapter,
933
+ parent: styleMountTarget
934
+ });
935
+ renderCallback = undefined;
936
+ };
937
+ };
938
+ watchEffect(() => {
939
+ mountStyle();
940
+ });
941
+ return {
942
+ themeClass: themeClassRef,
943
+ onRender: () => {
944
+ renderCallback === null || renderCallback === void 0 ? void 0 : renderCallback();
945
+ }
946
+ };
947
+ }
948
+
949
+ const formItemInjectionKey = createInjectionKey('n-form-item');
950
+ function useFormItem(props, {
951
+ defaultSize = 'medium',
952
+ mergedSize,
953
+ mergedDisabled
954
+ } = {}) {
955
+ const NFormItem = inject(formItemInjectionKey, null);
956
+ provide(formItemInjectionKey, null);
957
+ const mergedSizeRef = computed(mergedSize ? () => mergedSize(NFormItem) : () => {
958
+ const {
959
+ size
960
+ } = props;
961
+ if (size) return size;
962
+ if (NFormItem) {
963
+ const {
964
+ mergedSize
965
+ } = NFormItem;
966
+ if (mergedSize.value !== undefined) {
967
+ return mergedSize.value;
968
+ }
969
+ }
970
+ return defaultSize;
971
+ });
972
+ const mergedDisabledRef = computed(mergedDisabled ? () => mergedDisabled(NFormItem) : () => {
973
+ const {
974
+ disabled
975
+ } = props;
976
+ if (disabled !== undefined) {
977
+ return disabled;
978
+ }
979
+ if (NFormItem) {
980
+ return NFormItem.disabled.value;
981
+ }
982
+ return false;
983
+ });
984
+ const mergedStatusRef = computed(() => {
985
+ const {
986
+ status
987
+ } = props;
988
+ if (status) return status;
989
+ return NFormItem === null || NFormItem === void 0 ? void 0 : NFormItem.mergedValidationStatus.value;
990
+ });
991
+ onBeforeUnmount(() => {
992
+ if (NFormItem) {
993
+ NFormItem.restoreValidation();
994
+ }
995
+ });
996
+ return {
997
+ mergedSizeRef,
998
+ mergedDisabledRef,
999
+ mergedStatusRef,
1000
+ nTriggerFormBlur() {
1001
+ if (NFormItem) {
1002
+ NFormItem.handleContentBlur();
1003
+ }
1004
+ },
1005
+ nTriggerFormChange() {
1006
+ if (NFormItem) {
1007
+ NFormItem.handleContentChange();
1008
+ }
1009
+ },
1010
+ nTriggerFormFocus() {
1011
+ if (NFormItem) {
1012
+ NFormItem.handleContentFocus();
1013
+ }
1014
+ },
1015
+ nTriggerFormInput() {
1016
+ if (NFormItem) {
1017
+ NFormItem.handleContentInput();
1018
+ }
1019
+ }
1020
+ };
1021
+ }
1022
+
1023
+ /** Detect free variable `global` from Node.js. */
1024
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
1025
+
1026
+ /** Detect free variable `self`. */
1027
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1028
+
1029
+ /** Used as a reference to the global object. */
1030
+ var root = freeGlobal || freeSelf || Function('return this')();
1031
+
1032
+ /** Built-in value references. */
1033
+ var Symbol = root.Symbol;
1034
+
1035
+ /** Used for built-in method references. */
1036
+ var objectProto$9 = Object.prototype;
1037
+
1038
+ /** Used to check objects for own properties. */
1039
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1040
+
1041
+ /**
1042
+ * Used to resolve the
1043
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1044
+ * of values.
1045
+ */
1046
+ var nativeObjectToString$1 = objectProto$9.toString;
1047
+
1048
+ /** Built-in value references. */
1049
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
1050
+
1051
+ /**
1052
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1053
+ *
1054
+ * @private
1055
+ * @param {*} value The value to query.
1056
+ * @returns {string} Returns the raw `toStringTag`.
1057
+ */
1058
+ function getRawTag(value) {
1059
+ var isOwn = hasOwnProperty$7.call(value, symToStringTag$1),
1060
+ tag = value[symToStringTag$1];
1061
+
1062
+ try {
1063
+ value[symToStringTag$1] = undefined;
1064
+ var unmasked = true;
1065
+ } catch (e) {}
1066
+
1067
+ var result = nativeObjectToString$1.call(value);
1068
+ if (unmasked) {
1069
+ if (isOwn) {
1070
+ value[symToStringTag$1] = tag;
1071
+ } else {
1072
+ delete value[symToStringTag$1];
1073
+ }
1074
+ }
1075
+ return result;
1076
+ }
1077
+
1078
+ /** Used for built-in method references. */
1079
+ var objectProto$8 = Object.prototype;
1080
+
1081
+ /**
1082
+ * Used to resolve the
1083
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1084
+ * of values.
1085
+ */
1086
+ var nativeObjectToString = objectProto$8.toString;
1087
+
1088
+ /**
1089
+ * Converts `value` to a string using `Object.prototype.toString`.
1090
+ *
1091
+ * @private
1092
+ * @param {*} value The value to convert.
1093
+ * @returns {string} Returns the converted string.
1094
+ */
1095
+ function objectToString(value) {
1096
+ return nativeObjectToString.call(value);
1097
+ }
1098
+
1099
+ /** `Object#toString` result references. */
1100
+ var nullTag = '[object Null]',
1101
+ undefinedTag = '[object Undefined]';
1102
+
1103
+ /** Built-in value references. */
1104
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1105
+
1106
+ /**
1107
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1108
+ *
1109
+ * @private
1110
+ * @param {*} value The value to query.
1111
+ * @returns {string} Returns the `toStringTag`.
1112
+ */
1113
+ function baseGetTag(value) {
1114
+ if (value == null) {
1115
+ return value === undefined ? undefinedTag : nullTag;
1116
+ }
1117
+ return (symToStringTag && symToStringTag in Object(value))
1118
+ ? getRawTag(value)
1119
+ : objectToString(value);
1120
+ }
1121
+
1122
+ /**
1123
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1124
+ * and has a `typeof` result of "object".
1125
+ *
1126
+ * @static
1127
+ * @memberOf _
1128
+ * @since 4.0.0
1129
+ * @category Lang
1130
+ * @param {*} value The value to check.
1131
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1132
+ * @example
1133
+ *
1134
+ * _.isObjectLike({});
1135
+ * // => true
1136
+ *
1137
+ * _.isObjectLike([1, 2, 3]);
1138
+ * // => true
1139
+ *
1140
+ * _.isObjectLike(_.noop);
1141
+ * // => false
1142
+ *
1143
+ * _.isObjectLike(null);
1144
+ * // => false
1145
+ */
1146
+ function isObjectLike(value) {
1147
+ return value != null && typeof value == 'object';
1148
+ }
1149
+
1150
+ /**
1151
+ * Checks if `value` is classified as an `Array` object.
1152
+ *
1153
+ * @static
1154
+ * @memberOf _
1155
+ * @since 0.1.0
1156
+ * @category Lang
1157
+ * @param {*} value The value to check.
1158
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1159
+ * @example
1160
+ *
1161
+ * _.isArray([1, 2, 3]);
1162
+ * // => true
1163
+ *
1164
+ * _.isArray(document.body.children);
1165
+ * // => false
1166
+ *
1167
+ * _.isArray('abc');
1168
+ * // => false
1169
+ *
1170
+ * _.isArray(_.noop);
1171
+ * // => false
1172
+ */
1173
+ var isArray = Array.isArray;
1174
+
1175
+ /**
1176
+ * Checks if `value` is the
1177
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1178
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1179
+ *
1180
+ * @static
1181
+ * @memberOf _
1182
+ * @since 0.1.0
1183
+ * @category Lang
1184
+ * @param {*} value The value to check.
1185
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1186
+ * @example
1187
+ *
1188
+ * _.isObject({});
1189
+ * // => true
1190
+ *
1191
+ * _.isObject([1, 2, 3]);
1192
+ * // => true
1193
+ *
1194
+ * _.isObject(_.noop);
1195
+ * // => true
1196
+ *
1197
+ * _.isObject(null);
1198
+ * // => false
1199
+ */
1200
+ function isObject(value) {
1201
+ var type = typeof value;
1202
+ return value != null && (type == 'object' || type == 'function');
1203
+ }
1204
+
1205
+ /**
1206
+ * This method returns the first argument it receives.
1207
+ *
1208
+ * @static
1209
+ * @since 0.1.0
1210
+ * @memberOf _
1211
+ * @category Util
1212
+ * @param {*} value Any value.
1213
+ * @returns {*} Returns `value`.
1214
+ * @example
1215
+ *
1216
+ * var object = { 'a': 1 };
1217
+ *
1218
+ * console.log(_.identity(object) === object);
1219
+ * // => true
1220
+ */
1221
+ function identity(value) {
1222
+ return value;
1223
+ }
1224
+
1225
+ /** `Object#toString` result references. */
1226
+ var asyncTag = '[object AsyncFunction]',
1227
+ funcTag$1 = '[object Function]',
1228
+ genTag = '[object GeneratorFunction]',
1229
+ proxyTag = '[object Proxy]';
1230
+
1231
+ /**
1232
+ * Checks if `value` is classified as a `Function` object.
1233
+ *
1234
+ * @static
1235
+ * @memberOf _
1236
+ * @since 0.1.0
1237
+ * @category Lang
1238
+ * @param {*} value The value to check.
1239
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1240
+ * @example
1241
+ *
1242
+ * _.isFunction(_);
1243
+ * // => true
1244
+ *
1245
+ * _.isFunction(/abc/);
1246
+ * // => false
1247
+ */
1248
+ function isFunction(value) {
1249
+ if (!isObject(value)) {
1250
+ return false;
1251
+ }
1252
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1253
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1254
+ var tag = baseGetTag(value);
1255
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
1256
+ }
1257
+
1258
+ /** Used to detect overreaching core-js shims. */
1259
+ var coreJsData = root['__core-js_shared__'];
1260
+
1261
+ /** Used to detect methods masquerading as native. */
1262
+ var maskSrcKey = (function() {
1263
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1264
+ return uid ? ('Symbol(src)_1.' + uid) : '';
1265
+ }());
1266
+
1267
+ /**
1268
+ * Checks if `func` has its source masked.
1269
+ *
1270
+ * @private
1271
+ * @param {Function} func The function to check.
1272
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1273
+ */
1274
+ function isMasked(func) {
1275
+ return !!maskSrcKey && (maskSrcKey in func);
1276
+ }
1277
+
1278
+ /** Used for built-in method references. */
1279
+ var funcProto$2 = Function.prototype;
1280
+
1281
+ /** Used to resolve the decompiled source of functions. */
1282
+ var funcToString$2 = funcProto$2.toString;
1283
+
1284
+ /**
1285
+ * Converts `func` to its source code.
1286
+ *
1287
+ * @private
1288
+ * @param {Function} func The function to convert.
1289
+ * @returns {string} Returns the source code.
1290
+ */
1291
+ function toSource(func) {
1292
+ if (func != null) {
1293
+ try {
1294
+ return funcToString$2.call(func);
1295
+ } catch (e) {}
1296
+ try {
1297
+ return (func + '');
1298
+ } catch (e) {}
1299
+ }
1300
+ return '';
1301
+ }
1302
+
1303
+ /**
1304
+ * Used to match `RegExp`
1305
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1306
+ */
1307
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1308
+
1309
+ /** Used to detect host constructors (Safari). */
1310
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1311
+
1312
+ /** Used for built-in method references. */
1313
+ var funcProto$1 = Function.prototype,
1314
+ objectProto$7 = Object.prototype;
1315
+
1316
+ /** Used to resolve the decompiled source of functions. */
1317
+ var funcToString$1 = funcProto$1.toString;
1318
+
1319
+ /** Used to check objects for own properties. */
1320
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
1321
+
1322
+ /** Used to detect if a method is native. */
1323
+ var reIsNative = RegExp('^' +
1324
+ funcToString$1.call(hasOwnProperty$6).replace(reRegExpChar, '\\$&')
1325
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1326
+ );
1327
+
1328
+ /**
1329
+ * The base implementation of `_.isNative` without bad shim checks.
1330
+ *
1331
+ * @private
1332
+ * @param {*} value The value to check.
1333
+ * @returns {boolean} Returns `true` if `value` is a native function,
1334
+ * else `false`.
1335
+ */
1336
+ function baseIsNative(value) {
1337
+ if (!isObject(value) || isMasked(value)) {
1338
+ return false;
1339
+ }
1340
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1341
+ return pattern.test(toSource(value));
1342
+ }
1343
+
1344
+ /**
1345
+ * Gets the value at `key` of `object`.
1346
+ *
1347
+ * @private
1348
+ * @param {Object} [object] The object to query.
1349
+ * @param {string} key The key of the property to get.
1350
+ * @returns {*} Returns the property value.
1351
+ */
1352
+ function getValue(object, key) {
1353
+ return object == null ? undefined : object[key];
1354
+ }
1355
+
1356
+ /**
1357
+ * Gets the native function at `key` of `object`.
1358
+ *
1359
+ * @private
1360
+ * @param {Object} object The object to query.
1361
+ * @param {string} key The key of the method to get.
1362
+ * @returns {*} Returns the function if it's native, else `undefined`.
1363
+ */
1364
+ function getNative(object, key) {
1365
+ var value = getValue(object, key);
1366
+ return baseIsNative(value) ? value : undefined;
1367
+ }
1368
+
1369
+ /** Built-in value references. */
1370
+ var objectCreate = Object.create;
1371
+
1372
+ /**
1373
+ * The base implementation of `_.create` without support for assigning
1374
+ * properties to the created object.
1375
+ *
1376
+ * @private
1377
+ * @param {Object} proto The object to inherit from.
1378
+ * @returns {Object} Returns the new object.
1379
+ */
1380
+ var baseCreate = (function() {
1381
+ function object() {}
1382
+ return function(proto) {
1383
+ if (!isObject(proto)) {
1384
+ return {};
1385
+ }
1386
+ if (objectCreate) {
1387
+ return objectCreate(proto);
1388
+ }
1389
+ object.prototype = proto;
1390
+ var result = new object;
1391
+ object.prototype = undefined;
1392
+ return result;
1393
+ };
1394
+ }());
1395
+
1396
+ /**
1397
+ * A faster alternative to `Function#apply`, this function invokes `func`
1398
+ * with the `this` binding of `thisArg` and the arguments of `args`.
1399
+ *
1400
+ * @private
1401
+ * @param {Function} func The function to invoke.
1402
+ * @param {*} thisArg The `this` binding of `func`.
1403
+ * @param {Array} args The arguments to invoke `func` with.
1404
+ * @returns {*} Returns the result of `func`.
1405
+ */
1406
+ function apply(func, thisArg, args) {
1407
+ switch (args.length) {
1408
+ case 0: return func.call(thisArg);
1409
+ case 1: return func.call(thisArg, args[0]);
1410
+ case 2: return func.call(thisArg, args[0], args[1]);
1411
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
1412
+ }
1413
+ return func.apply(thisArg, args);
1414
+ }
1415
+
1416
+ /**
1417
+ * Copies the values of `source` to `array`.
1418
+ *
1419
+ * @private
1420
+ * @param {Array} source The array to copy values from.
1421
+ * @param {Array} [array=[]] The array to copy values to.
1422
+ * @returns {Array} Returns `array`.
1423
+ */
1424
+ function copyArray(source, array) {
1425
+ var index = -1,
1426
+ length = source.length;
1427
+
1428
+ array || (array = Array(length));
1429
+ while (++index < length) {
1430
+ array[index] = source[index];
1431
+ }
1432
+ return array;
1433
+ }
1434
+
1435
+ /** Used to detect hot functions by number of calls within a span of milliseconds. */
1436
+ var HOT_COUNT = 800,
1437
+ HOT_SPAN = 16;
1438
+
1439
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1440
+ var nativeNow = Date.now;
1441
+
1442
+ /**
1443
+ * Creates a function that'll short out and invoke `identity` instead
1444
+ * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
1445
+ * milliseconds.
1446
+ *
1447
+ * @private
1448
+ * @param {Function} func The function to restrict.
1449
+ * @returns {Function} Returns the new shortable function.
1450
+ */
1451
+ function shortOut(func) {
1452
+ var count = 0,
1453
+ lastCalled = 0;
1454
+
1455
+ return function() {
1456
+ var stamp = nativeNow(),
1457
+ remaining = HOT_SPAN - (stamp - lastCalled);
1458
+
1459
+ lastCalled = stamp;
1460
+ if (remaining > 0) {
1461
+ if (++count >= HOT_COUNT) {
1462
+ return arguments[0];
1463
+ }
1464
+ } else {
1465
+ count = 0;
1466
+ }
1467
+ return func.apply(undefined, arguments);
1468
+ };
1469
+ }
1470
+
1471
+ /**
1472
+ * Creates a function that returns `value`.
1473
+ *
1474
+ * @static
1475
+ * @memberOf _
1476
+ * @since 2.4.0
1477
+ * @category Util
1478
+ * @param {*} value The value to return from the new function.
1479
+ * @returns {Function} Returns the new constant function.
1480
+ * @example
1481
+ *
1482
+ * var objects = _.times(2, _.constant({ 'a': 1 }));
1483
+ *
1484
+ * console.log(objects);
1485
+ * // => [{ 'a': 1 }, { 'a': 1 }]
1486
+ *
1487
+ * console.log(objects[0] === objects[1]);
1488
+ * // => true
1489
+ */
1490
+ function constant(value) {
1491
+ return function() {
1492
+ return value;
1493
+ };
1494
+ }
1495
+
1496
+ var defineProperty = (function() {
1497
+ try {
1498
+ var func = getNative(Object, 'defineProperty');
1499
+ func({}, '', {});
1500
+ return func;
1501
+ } catch (e) {}
1502
+ }());
1503
+
1504
+ /**
1505
+ * The base implementation of `setToString` without support for hot loop shorting.
1506
+ *
1507
+ * @private
1508
+ * @param {Function} func The function to modify.
1509
+ * @param {Function} string The `toString` result.
1510
+ * @returns {Function} Returns `func`.
1511
+ */
1512
+ var baseSetToString = !defineProperty ? identity : function(func, string) {
1513
+ return defineProperty(func, 'toString', {
1514
+ 'configurable': true,
1515
+ 'enumerable': false,
1516
+ 'value': constant(string),
1517
+ 'writable': true
1518
+ });
1519
+ };
1520
+
1521
+ /**
1522
+ * Sets the `toString` method of `func` to return `string`.
1523
+ *
1524
+ * @private
1525
+ * @param {Function} func The function to modify.
1526
+ * @param {Function} string The `toString` result.
1527
+ * @returns {Function} Returns `func`.
1528
+ */
1529
+ var setToString = shortOut(baseSetToString);
1530
+
1531
+ /** Used as references for various `Number` constants. */
1532
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1533
+
1534
+ /** Used to detect unsigned integer values. */
1535
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1536
+
1537
+ /**
1538
+ * Checks if `value` is a valid array-like index.
1539
+ *
1540
+ * @private
1541
+ * @param {*} value The value to check.
1542
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1543
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1544
+ */
1545
+ function isIndex(value, length) {
1546
+ var type = typeof value;
1547
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
1548
+
1549
+ return !!length &&
1550
+ (type == 'number' ||
1551
+ (type != 'symbol' && reIsUint.test(value))) &&
1552
+ (value > -1 && value % 1 == 0 && value < length);
1553
+ }
1554
+
1555
+ /**
1556
+ * The base implementation of `assignValue` and `assignMergeValue` without
1557
+ * value checks.
1558
+ *
1559
+ * @private
1560
+ * @param {Object} object The object to modify.
1561
+ * @param {string} key The key of the property to assign.
1562
+ * @param {*} value The value to assign.
1563
+ */
1564
+ function baseAssignValue(object, key, value) {
1565
+ if (key == '__proto__' && defineProperty) {
1566
+ defineProperty(object, key, {
1567
+ 'configurable': true,
1568
+ 'enumerable': true,
1569
+ 'value': value,
1570
+ 'writable': true
1571
+ });
1572
+ } else {
1573
+ object[key] = value;
1574
+ }
1575
+ }
1576
+
1577
+ /**
1578
+ * Performs a
1579
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1580
+ * comparison between two values to determine if they are equivalent.
1581
+ *
1582
+ * @static
1583
+ * @memberOf _
1584
+ * @since 4.0.0
1585
+ * @category Lang
1586
+ * @param {*} value The value to compare.
1587
+ * @param {*} other The other value to compare.
1588
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1589
+ * @example
1590
+ *
1591
+ * var object = { 'a': 1 };
1592
+ * var other = { 'a': 1 };
1593
+ *
1594
+ * _.eq(object, object);
1595
+ * // => true
1596
+ *
1597
+ * _.eq(object, other);
1598
+ * // => false
1599
+ *
1600
+ * _.eq('a', 'a');
1601
+ * // => true
1602
+ *
1603
+ * _.eq('a', Object('a'));
1604
+ * // => false
1605
+ *
1606
+ * _.eq(NaN, NaN);
1607
+ * // => true
1608
+ */
1609
+ function eq(value, other) {
1610
+ return value === other || (value !== value && other !== other);
1611
+ }
1612
+
1613
+ /** Used for built-in method references. */
1614
+ var objectProto$6 = Object.prototype;
1615
+
1616
+ /** Used to check objects for own properties. */
1617
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
1618
+
1619
+ /**
1620
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
1621
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1622
+ * for equality comparisons.
1623
+ *
1624
+ * @private
1625
+ * @param {Object} object The object to modify.
1626
+ * @param {string} key The key of the property to assign.
1627
+ * @param {*} value The value to assign.
1628
+ */
1629
+ function assignValue(object, key, value) {
1630
+ var objValue = object[key];
1631
+ if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
1632
+ (value === undefined && !(key in object))) {
1633
+ baseAssignValue(object, key, value);
1634
+ }
1635
+ }
1636
+
1637
+ /**
1638
+ * Copies properties of `source` to `object`.
1639
+ *
1640
+ * @private
1641
+ * @param {Object} source The object to copy properties from.
1642
+ * @param {Array} props The property identifiers to copy.
1643
+ * @param {Object} [object={}] The object to copy properties to.
1644
+ * @param {Function} [customizer] The function to customize copied values.
1645
+ * @returns {Object} Returns `object`.
1646
+ */
1647
+ function copyObject(source, props, object, customizer) {
1648
+ var isNew = !object;
1649
+ object || (object = {});
1650
+
1651
+ var index = -1,
1652
+ length = props.length;
1653
+
1654
+ while (++index < length) {
1655
+ var key = props[index];
1656
+
1657
+ var newValue = undefined;
1658
+
1659
+ if (newValue === undefined) {
1660
+ newValue = source[key];
1661
+ }
1662
+ if (isNew) {
1663
+ baseAssignValue(object, key, newValue);
1664
+ } else {
1665
+ assignValue(object, key, newValue);
1666
+ }
1667
+ }
1668
+ return object;
1669
+ }
1670
+
1671
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1672
+ var nativeMax = Math.max;
1673
+
1674
+ /**
1675
+ * A specialized version of `baseRest` which transforms the rest array.
1676
+ *
1677
+ * @private
1678
+ * @param {Function} func The function to apply a rest parameter to.
1679
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
1680
+ * @param {Function} transform The rest array transform.
1681
+ * @returns {Function} Returns the new function.
1682
+ */
1683
+ function overRest(func, start, transform) {
1684
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
1685
+ return function() {
1686
+ var args = arguments,
1687
+ index = -1,
1688
+ length = nativeMax(args.length - start, 0),
1689
+ array = Array(length);
1690
+
1691
+ while (++index < length) {
1692
+ array[index] = args[start + index];
1693
+ }
1694
+ index = -1;
1695
+ var otherArgs = Array(start + 1);
1696
+ while (++index < start) {
1697
+ otherArgs[index] = args[index];
1698
+ }
1699
+ otherArgs[start] = transform(array);
1700
+ return apply(func, this, otherArgs);
1701
+ };
1702
+ }
1703
+
1704
+ /**
1705
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
1706
+ *
1707
+ * @private
1708
+ * @param {Function} func The function to apply a rest parameter to.
1709
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
1710
+ * @returns {Function} Returns the new function.
1711
+ */
1712
+ function baseRest(func, start) {
1713
+ return setToString(overRest(func, start, identity), func + '');
1714
+ }
1715
+
1716
+ /** Used as references for various `Number` constants. */
1717
+ var MAX_SAFE_INTEGER = 9007199254740991;
1718
+
1719
+ /**
1720
+ * Checks if `value` is a valid array-like length.
1721
+ *
1722
+ * **Note:** This method is loosely based on
1723
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1724
+ *
1725
+ * @static
1726
+ * @memberOf _
1727
+ * @since 4.0.0
1728
+ * @category Lang
1729
+ * @param {*} value The value to check.
1730
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1731
+ * @example
1732
+ *
1733
+ * _.isLength(3);
1734
+ * // => true
1735
+ *
1736
+ * _.isLength(Number.MIN_VALUE);
1737
+ * // => false
1738
+ *
1739
+ * _.isLength(Infinity);
1740
+ * // => false
1741
+ *
1742
+ * _.isLength('3');
1743
+ * // => false
1744
+ */
1745
+ function isLength(value) {
1746
+ return typeof value == 'number' &&
1747
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1748
+ }
1749
+
1750
+ /**
1751
+ * Checks if `value` is array-like. A value is considered array-like if it's
1752
+ * not a function and has a `value.length` that's an integer greater than or
1753
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1754
+ *
1755
+ * @static
1756
+ * @memberOf _
1757
+ * @since 4.0.0
1758
+ * @category Lang
1759
+ * @param {*} value The value to check.
1760
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1761
+ * @example
1762
+ *
1763
+ * _.isArrayLike([1, 2, 3]);
1764
+ * // => true
1765
+ *
1766
+ * _.isArrayLike(document.body.children);
1767
+ * // => true
1768
+ *
1769
+ * _.isArrayLike('abc');
1770
+ * // => true
1771
+ *
1772
+ * _.isArrayLike(_.noop);
1773
+ * // => false
1774
+ */
1775
+ function isArrayLike(value) {
1776
+ return value != null && isLength(value.length) && !isFunction(value);
1777
+ }
1778
+
1779
+ /**
1780
+ * Checks if the given arguments are from an iteratee call.
1781
+ *
1782
+ * @private
1783
+ * @param {*} value The potential iteratee value argument.
1784
+ * @param {*} index The potential iteratee index or key argument.
1785
+ * @param {*} object The potential iteratee object argument.
1786
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
1787
+ * else `false`.
1788
+ */
1789
+ function isIterateeCall(value, index, object) {
1790
+ if (!isObject(object)) {
1791
+ return false;
1792
+ }
1793
+ var type = typeof index;
1794
+ if (type == 'number'
1795
+ ? (isArrayLike(object) && isIndex(index, object.length))
1796
+ : (type == 'string' && index in object)
1797
+ ) {
1798
+ return eq(object[index], value);
1799
+ }
1800
+ return false;
1801
+ }
1802
+
1803
+ /**
1804
+ * Creates a function like `_.assign`.
1805
+ *
1806
+ * @private
1807
+ * @param {Function} assigner The function to assign values.
1808
+ * @returns {Function} Returns the new assigner function.
1809
+ */
1810
+ function createAssigner(assigner) {
1811
+ return baseRest(function(object, sources) {
1812
+ var index = -1,
1813
+ length = sources.length,
1814
+ customizer = length > 1 ? sources[length - 1] : undefined,
1815
+ guard = length > 2 ? sources[2] : undefined;
1816
+
1817
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
1818
+ ? (length--, customizer)
1819
+ : undefined;
1820
+
1821
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
1822
+ customizer = length < 3 ? undefined : customizer;
1823
+ length = 1;
1824
+ }
1825
+ object = Object(object);
1826
+ while (++index < length) {
1827
+ var source = sources[index];
1828
+ if (source) {
1829
+ assigner(object, source, index, customizer);
1830
+ }
1831
+ }
1832
+ return object;
1833
+ });
1834
+ }
1835
+
1836
+ /** Used for built-in method references. */
1837
+ var objectProto$5 = Object.prototype;
1838
+
1839
+ /**
1840
+ * Checks if `value` is likely a prototype object.
1841
+ *
1842
+ * @private
1843
+ * @param {*} value The value to check.
1844
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1845
+ */
1846
+ function isPrototype(value) {
1847
+ var Ctor = value && value.constructor,
1848
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
1849
+
1850
+ return value === proto;
1851
+ }
1852
+
1853
+ /**
1854
+ * The base implementation of `_.times` without support for iteratee shorthands
1855
+ * or max array length checks.
1856
+ *
1857
+ * @private
1858
+ * @param {number} n The number of times to invoke `iteratee`.
1859
+ * @param {Function} iteratee The function invoked per iteration.
1860
+ * @returns {Array} Returns the array of results.
1861
+ */
1862
+ function baseTimes(n, iteratee) {
1863
+ var index = -1,
1864
+ result = Array(n);
1865
+
1866
+ while (++index < n) {
1867
+ result[index] = iteratee(index);
1868
+ }
1869
+ return result;
1870
+ }
1871
+
1872
+ /** `Object#toString` result references. */
1873
+ var argsTag$1 = '[object Arguments]';
1874
+
1875
+ /**
1876
+ * The base implementation of `_.isArguments`.
1877
+ *
1878
+ * @private
1879
+ * @param {*} value The value to check.
1880
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1881
+ */
1882
+ function baseIsArguments(value) {
1883
+ return isObjectLike(value) && baseGetTag(value) == argsTag$1;
1884
+ }
1885
+
1886
+ /** Used for built-in method references. */
1887
+ var objectProto$4 = Object.prototype;
1888
+
1889
+ /** Used to check objects for own properties. */
1890
+ var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
1891
+
1892
+ /** Built-in value references. */
1893
+ var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
1894
+
1895
+ /**
1896
+ * Checks if `value` is likely an `arguments` object.
1897
+ *
1898
+ * @static
1899
+ * @memberOf _
1900
+ * @since 0.1.0
1901
+ * @category Lang
1902
+ * @param {*} value The value to check.
1903
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1904
+ * else `false`.
1905
+ * @example
1906
+ *
1907
+ * _.isArguments(function() { return arguments; }());
1908
+ * // => true
1909
+ *
1910
+ * _.isArguments([1, 2, 3]);
1911
+ * // => false
1912
+ */
1913
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1914
+ return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
1915
+ !propertyIsEnumerable.call(value, 'callee');
1916
+ };
1917
+
1918
+ /**
1919
+ * This method returns `false`.
1920
+ *
1921
+ * @static
1922
+ * @memberOf _
1923
+ * @since 4.13.0
1924
+ * @category Util
1925
+ * @returns {boolean} Returns `false`.
1926
+ * @example
1927
+ *
1928
+ * _.times(2, _.stubFalse);
1929
+ * // => [false, false]
1930
+ */
1931
+ function stubFalse() {
1932
+ return false;
1933
+ }
1934
+
1935
+ /** Detect free variable `exports`. */
1936
+ var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1937
+
1938
+ /** Detect free variable `module`. */
1939
+ var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
1940
+
1941
+ /** Detect the popular CommonJS extension `module.exports`. */
1942
+ var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
1943
+
1944
+ /** Built-in value references. */
1945
+ var Buffer$1 = moduleExports$2 ? root.Buffer : undefined;
1946
+
1947
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1948
+ var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
1949
+
1950
+ /**
1951
+ * Checks if `value` is a buffer.
1952
+ *
1953
+ * @static
1954
+ * @memberOf _
1955
+ * @since 4.3.0
1956
+ * @category Lang
1957
+ * @param {*} value The value to check.
1958
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1959
+ * @example
1960
+ *
1961
+ * _.isBuffer(new Buffer(2));
1962
+ * // => true
1963
+ *
1964
+ * _.isBuffer(new Uint8Array(2));
1965
+ * // => false
1966
+ */
1967
+ var isBuffer = nativeIsBuffer || stubFalse;
1968
+
1969
+ /** `Object#toString` result references. */
1970
+ var argsTag = '[object Arguments]',
1971
+ arrayTag = '[object Array]',
1972
+ boolTag = '[object Boolean]',
1973
+ dateTag = '[object Date]',
1974
+ errorTag = '[object Error]',
1975
+ funcTag = '[object Function]',
1976
+ mapTag = '[object Map]',
1977
+ numberTag = '[object Number]',
1978
+ objectTag$1 = '[object Object]',
1979
+ regexpTag = '[object RegExp]',
1980
+ setTag = '[object Set]',
1981
+ stringTag = '[object String]',
1982
+ weakMapTag = '[object WeakMap]';
1983
+
1984
+ var arrayBufferTag = '[object ArrayBuffer]',
1985
+ dataViewTag = '[object DataView]',
1986
+ float32Tag = '[object Float32Array]',
1987
+ float64Tag = '[object Float64Array]',
1988
+ int8Tag = '[object Int8Array]',
1989
+ int16Tag = '[object Int16Array]',
1990
+ int32Tag = '[object Int32Array]',
1991
+ uint8Tag = '[object Uint8Array]',
1992
+ uint8ClampedTag = '[object Uint8ClampedArray]',
1993
+ uint16Tag = '[object Uint16Array]',
1994
+ uint32Tag = '[object Uint32Array]';
1995
+
1996
+ /** Used to identify `toStringTag` values of typed arrays. */
1997
+ var typedArrayTags = {};
1998
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1999
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
2000
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
2001
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
2002
+ typedArrayTags[uint32Tag] = true;
2003
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
2004
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
2005
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
2006
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
2007
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
2008
+ typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
2009
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
2010
+ typedArrayTags[weakMapTag] = false;
2011
+
2012
+ /**
2013
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
2014
+ *
2015
+ * @private
2016
+ * @param {*} value The value to check.
2017
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2018
+ */
2019
+ function baseIsTypedArray(value) {
2020
+ return isObjectLike(value) &&
2021
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
2022
+ }
2023
+
2024
+ /**
2025
+ * The base implementation of `_.unary` without support for storing metadata.
2026
+ *
2027
+ * @private
2028
+ * @param {Function} func The function to cap arguments for.
2029
+ * @returns {Function} Returns the new capped function.
2030
+ */
2031
+ function baseUnary(func) {
2032
+ return function(value) {
2033
+ return func(value);
2034
+ };
2035
+ }
2036
+
2037
+ /** Detect free variable `exports`. */
2038
+ var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
2039
+
2040
+ /** Detect free variable `module`. */
2041
+ var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
2042
+
2043
+ /** Detect the popular CommonJS extension `module.exports`. */
2044
+ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
2045
+
2046
+ /** Detect free variable `process` from Node.js. */
2047
+ var freeProcess = moduleExports$1 && freeGlobal.process;
2048
+
2049
+ /** Used to access faster Node.js helpers. */
2050
+ var nodeUtil = (function() {
2051
+ try {
2052
+ // Use `util.types` for Node.js 10+.
2053
+ var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
2054
+
2055
+ if (types) {
2056
+ return types;
2057
+ }
2058
+
2059
+ // Legacy `process.binding('util')` for Node.js < 10.
2060
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
2061
+ } catch (e) {}
2062
+ }());
2063
+
2064
+ /* Node.js helper references. */
2065
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
2066
+
2067
+ /**
2068
+ * Checks if `value` is classified as a typed array.
2069
+ *
2070
+ * @static
2071
+ * @memberOf _
2072
+ * @since 3.0.0
2073
+ * @category Lang
2074
+ * @param {*} value The value to check.
2075
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2076
+ * @example
2077
+ *
2078
+ * _.isTypedArray(new Uint8Array);
2079
+ * // => true
2080
+ *
2081
+ * _.isTypedArray([]);
2082
+ * // => false
2083
+ */
2084
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
2085
+
2086
+ /**
2087
+ * Creates an array of the enumerable property names of the array-like `value`.
2088
+ *
2089
+ * @private
2090
+ * @param {*} value The value to query.
2091
+ * @param {boolean} inherited Specify returning inherited property names.
2092
+ * @returns {Array} Returns the array of property names.
2093
+ */
2094
+ function arrayLikeKeys(value, inherited) {
2095
+ var isArr = isArray(value),
2096
+ isArg = !isArr && isArguments(value),
2097
+ isBuff = !isArr && !isArg && isBuffer(value),
2098
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2099
+ skipIndexes = isArr || isArg || isBuff || isType,
2100
+ result = skipIndexes ? baseTimes(value.length, String) : [],
2101
+ length = result.length;
2102
+
2103
+ for (var key in value) {
2104
+ if (!(skipIndexes && (
2105
+ // Safari 9 has enumerable `arguments.length` in strict mode.
2106
+ key == 'length' ||
2107
+ // Node.js 0.10 has enumerable non-index properties on buffers.
2108
+ (isBuff && (key == 'offset' || key == 'parent')) ||
2109
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
2110
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2111
+ // Skip index properties.
2112
+ isIndex(key, length)
2113
+ ))) {
2114
+ result.push(key);
2115
+ }
2116
+ }
2117
+ return result;
2118
+ }
2119
+
2120
+ /**
2121
+ * Creates a unary function that invokes `func` with its argument transformed.
2122
+ *
2123
+ * @private
2124
+ * @param {Function} func The function to wrap.
2125
+ * @param {Function} transform The argument transform.
2126
+ * @returns {Function} Returns the new function.
2127
+ */
2128
+ function overArg(func, transform) {
2129
+ return function(arg) {
2130
+ return func(transform(arg));
2131
+ };
2132
+ }
2133
+
2134
+ /**
2135
+ * This function is like
2136
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2137
+ * except that it includes inherited enumerable properties.
2138
+ *
2139
+ * @private
2140
+ * @param {Object} object The object to query.
2141
+ * @returns {Array} Returns the array of property names.
2142
+ */
2143
+ function nativeKeysIn(object) {
2144
+ var result = [];
2145
+ if (object != null) {
2146
+ for (var key in Object(object)) {
2147
+ result.push(key);
2148
+ }
2149
+ }
2150
+ return result;
2151
+ }
2152
+
2153
+ /** Used for built-in method references. */
2154
+ var objectProto$3 = Object.prototype;
2155
+
2156
+ /** Used to check objects for own properties. */
2157
+ var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
2158
+
2159
+ /**
2160
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
2161
+ *
2162
+ * @private
2163
+ * @param {Object} object The object to query.
2164
+ * @returns {Array} Returns the array of property names.
2165
+ */
2166
+ function baseKeysIn(object) {
2167
+ if (!isObject(object)) {
2168
+ return nativeKeysIn(object);
2169
+ }
2170
+ var isProto = isPrototype(object),
2171
+ result = [];
2172
+
2173
+ for (var key in object) {
2174
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$3.call(object, key)))) {
2175
+ result.push(key);
2176
+ }
2177
+ }
2178
+ return result;
2179
+ }
2180
+
2181
+ /**
2182
+ * Creates an array of the own and inherited enumerable property names of `object`.
2183
+ *
2184
+ * **Note:** Non-object values are coerced to objects.
2185
+ *
2186
+ * @static
2187
+ * @memberOf _
2188
+ * @since 3.0.0
2189
+ * @category Object
2190
+ * @param {Object} object The object to query.
2191
+ * @returns {Array} Returns the array of property names.
2192
+ * @example
2193
+ *
2194
+ * function Foo() {
2195
+ * this.a = 1;
2196
+ * this.b = 2;
2197
+ * }
2198
+ *
2199
+ * Foo.prototype.c = 3;
2200
+ *
2201
+ * _.keysIn(new Foo);
2202
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
2203
+ */
2204
+ function keysIn(object) {
2205
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeysIn(object);
2206
+ }
2207
+
2208
+ /* Built-in method references that are verified to be native. */
2209
+ var nativeCreate = getNative(Object, 'create');
2210
+
2211
+ /**
2212
+ * Removes all key-value entries from the hash.
2213
+ *
2214
+ * @private
2215
+ * @name clear
2216
+ * @memberOf Hash
2217
+ */
2218
+ function hashClear() {
2219
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
2220
+ this.size = 0;
2221
+ }
2222
+
2223
+ /**
2224
+ * Removes `key` and its value from the hash.
2225
+ *
2226
+ * @private
2227
+ * @name delete
2228
+ * @memberOf Hash
2229
+ * @param {Object} hash The hash to modify.
2230
+ * @param {string} key The key of the value to remove.
2231
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2232
+ */
2233
+ function hashDelete(key) {
2234
+ var result = this.has(key) && delete this.__data__[key];
2235
+ this.size -= result ? 1 : 0;
2236
+ return result;
2237
+ }
2238
+
2239
+ /** Used to stand-in for `undefined` hash values. */
2240
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
2241
+
2242
+ /** Used for built-in method references. */
2243
+ var objectProto$2 = Object.prototype;
2244
+
2245
+ /** Used to check objects for own properties. */
2246
+ var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
2247
+
2248
+ /**
2249
+ * Gets the hash value for `key`.
2250
+ *
2251
+ * @private
2252
+ * @name get
2253
+ * @memberOf Hash
2254
+ * @param {string} key The key of the value to get.
2255
+ * @returns {*} Returns the entry value.
2256
+ */
2257
+ function hashGet(key) {
2258
+ var data = this.__data__;
2259
+ if (nativeCreate) {
2260
+ var result = data[key];
2261
+ return result === HASH_UNDEFINED$1 ? undefined : result;
2262
+ }
2263
+ return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
2264
+ }
2265
+
2266
+ /** Used for built-in method references. */
2267
+ var objectProto$1 = Object.prototype;
2268
+
2269
+ /** Used to check objects for own properties. */
2270
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2271
+
2272
+ /**
2273
+ * Checks if a hash value for `key` exists.
2274
+ *
2275
+ * @private
2276
+ * @name has
2277
+ * @memberOf Hash
2278
+ * @param {string} key The key of the entry to check.
2279
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2280
+ */
2281
+ function hashHas(key) {
2282
+ var data = this.__data__;
2283
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$1.call(data, key);
2284
+ }
2285
+
2286
+ /** Used to stand-in for `undefined` hash values. */
2287
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
2288
+
2289
+ /**
2290
+ * Sets the hash `key` to `value`.
2291
+ *
2292
+ * @private
2293
+ * @name set
2294
+ * @memberOf Hash
2295
+ * @param {string} key The key of the value to set.
2296
+ * @param {*} value The value to set.
2297
+ * @returns {Object} Returns the hash instance.
2298
+ */
2299
+ function hashSet(key, value) {
2300
+ var data = this.__data__;
2301
+ this.size += this.has(key) ? 0 : 1;
2302
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
2303
+ return this;
2304
+ }
2305
+
2306
+ /**
2307
+ * Creates a hash object.
2308
+ *
2309
+ * @private
2310
+ * @constructor
2311
+ * @param {Array} [entries] The key-value pairs to cache.
2312
+ */
2313
+ function Hash(entries) {
2314
+ var index = -1,
2315
+ length = entries == null ? 0 : entries.length;
2316
+
2317
+ this.clear();
2318
+ while (++index < length) {
2319
+ var entry = entries[index];
2320
+ this.set(entry[0], entry[1]);
2321
+ }
2322
+ }
2323
+
2324
+ // Add methods to `Hash`.
2325
+ Hash.prototype.clear = hashClear;
2326
+ Hash.prototype['delete'] = hashDelete;
2327
+ Hash.prototype.get = hashGet;
2328
+ Hash.prototype.has = hashHas;
2329
+ Hash.prototype.set = hashSet;
2330
+
2331
+ /**
2332
+ * Removes all key-value entries from the list cache.
2333
+ *
2334
+ * @private
2335
+ * @name clear
2336
+ * @memberOf ListCache
2337
+ */
2338
+ function listCacheClear() {
2339
+ this.__data__ = [];
2340
+ this.size = 0;
2341
+ }
2342
+
2343
+ /**
2344
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
2345
+ *
2346
+ * @private
2347
+ * @param {Array} array The array to inspect.
2348
+ * @param {*} key The key to search for.
2349
+ * @returns {number} Returns the index of the matched value, else `-1`.
2350
+ */
2351
+ function assocIndexOf(array, key) {
2352
+ var length = array.length;
2353
+ while (length--) {
2354
+ if (eq(array[length][0], key)) {
2355
+ return length;
2356
+ }
2357
+ }
2358
+ return -1;
2359
+ }
2360
+
2361
+ /** Used for built-in method references. */
2362
+ var arrayProto = Array.prototype;
2363
+
2364
+ /** Built-in value references. */
2365
+ var splice = arrayProto.splice;
2366
+
2367
+ /**
2368
+ * Removes `key` and its value from the list cache.
2369
+ *
2370
+ * @private
2371
+ * @name delete
2372
+ * @memberOf ListCache
2373
+ * @param {string} key The key of the value to remove.
2374
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2375
+ */
2376
+ function listCacheDelete(key) {
2377
+ var data = this.__data__,
2378
+ index = assocIndexOf(data, key);
2379
+
2380
+ if (index < 0) {
2381
+ return false;
2382
+ }
2383
+ var lastIndex = data.length - 1;
2384
+ if (index == lastIndex) {
2385
+ data.pop();
2386
+ } else {
2387
+ splice.call(data, index, 1);
2388
+ }
2389
+ --this.size;
2390
+ return true;
2391
+ }
2392
+
2393
+ /**
2394
+ * Gets the list cache value for `key`.
2395
+ *
2396
+ * @private
2397
+ * @name get
2398
+ * @memberOf ListCache
2399
+ * @param {string} key The key of the value to get.
2400
+ * @returns {*} Returns the entry value.
2401
+ */
2402
+ function listCacheGet(key) {
2403
+ var data = this.__data__,
2404
+ index = assocIndexOf(data, key);
2405
+
2406
+ return index < 0 ? undefined : data[index][1];
2407
+ }
2408
+
2409
+ /**
2410
+ * Checks if a list cache value for `key` exists.
2411
+ *
2412
+ * @private
2413
+ * @name has
2414
+ * @memberOf ListCache
2415
+ * @param {string} key The key of the entry to check.
2416
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2417
+ */
2418
+ function listCacheHas(key) {
2419
+ return assocIndexOf(this.__data__, key) > -1;
2420
+ }
2421
+
2422
+ /**
2423
+ * Sets the list cache `key` to `value`.
2424
+ *
2425
+ * @private
2426
+ * @name set
2427
+ * @memberOf ListCache
2428
+ * @param {string} key The key of the value to set.
2429
+ * @param {*} value The value to set.
2430
+ * @returns {Object} Returns the list cache instance.
2431
+ */
2432
+ function listCacheSet(key, value) {
2433
+ var data = this.__data__,
2434
+ index = assocIndexOf(data, key);
2435
+
2436
+ if (index < 0) {
2437
+ ++this.size;
2438
+ data.push([key, value]);
2439
+ } else {
2440
+ data[index][1] = value;
2441
+ }
2442
+ return this;
2443
+ }
2444
+
2445
+ /**
2446
+ * Creates an list cache object.
2447
+ *
2448
+ * @private
2449
+ * @constructor
2450
+ * @param {Array} [entries] The key-value pairs to cache.
2451
+ */
2452
+ function ListCache(entries) {
2453
+ var index = -1,
2454
+ length = entries == null ? 0 : entries.length;
2455
+
2456
+ this.clear();
2457
+ while (++index < length) {
2458
+ var entry = entries[index];
2459
+ this.set(entry[0], entry[1]);
2460
+ }
2461
+ }
2462
+
2463
+ // Add methods to `ListCache`.
2464
+ ListCache.prototype.clear = listCacheClear;
2465
+ ListCache.prototype['delete'] = listCacheDelete;
2466
+ ListCache.prototype.get = listCacheGet;
2467
+ ListCache.prototype.has = listCacheHas;
2468
+ ListCache.prototype.set = listCacheSet;
2469
+
2470
+ /* Built-in method references that are verified to be native. */
2471
+ var Map = getNative(root, 'Map');
2472
+
2473
+ /**
2474
+ * Removes all key-value entries from the map.
2475
+ *
2476
+ * @private
2477
+ * @name clear
2478
+ * @memberOf MapCache
2479
+ */
2480
+ function mapCacheClear() {
2481
+ this.size = 0;
2482
+ this.__data__ = {
2483
+ 'hash': new Hash,
2484
+ 'map': new (Map || ListCache),
2485
+ 'string': new Hash
2486
+ };
2487
+ }
2488
+
2489
+ /**
2490
+ * Checks if `value` is suitable for use as unique object key.
2491
+ *
2492
+ * @private
2493
+ * @param {*} value The value to check.
2494
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2495
+ */
2496
+ function isKeyable(value) {
2497
+ var type = typeof value;
2498
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
2499
+ ? (value !== '__proto__')
2500
+ : (value === null);
2501
+ }
2502
+
2503
+ /**
2504
+ * Gets the data for `map`.
2505
+ *
2506
+ * @private
2507
+ * @param {Object} map The map to query.
2508
+ * @param {string} key The reference key.
2509
+ * @returns {*} Returns the map data.
2510
+ */
2511
+ function getMapData(map, key) {
2512
+ var data = map.__data__;
2513
+ return isKeyable(key)
2514
+ ? data[typeof key == 'string' ? 'string' : 'hash']
2515
+ : data.map;
2516
+ }
2517
+
2518
+ /**
2519
+ * Removes `key` and its value from the map.
2520
+ *
2521
+ * @private
2522
+ * @name delete
2523
+ * @memberOf MapCache
2524
+ * @param {string} key The key of the value to remove.
2525
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2526
+ */
2527
+ function mapCacheDelete(key) {
2528
+ var result = getMapData(this, key)['delete'](key);
2529
+ this.size -= result ? 1 : 0;
2530
+ return result;
2531
+ }
2532
+
2533
+ /**
2534
+ * Gets the map value for `key`.
2535
+ *
2536
+ * @private
2537
+ * @name get
2538
+ * @memberOf MapCache
2539
+ * @param {string} key The key of the value to get.
2540
+ * @returns {*} Returns the entry value.
2541
+ */
2542
+ function mapCacheGet(key) {
2543
+ return getMapData(this, key).get(key);
2544
+ }
2545
+
2546
+ /**
2547
+ * Checks if a map value for `key` exists.
2548
+ *
2549
+ * @private
2550
+ * @name has
2551
+ * @memberOf MapCache
2552
+ * @param {string} key The key of the entry to check.
2553
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2554
+ */
2555
+ function mapCacheHas(key) {
2556
+ return getMapData(this, key).has(key);
2557
+ }
2558
+
2559
+ /**
2560
+ * Sets the map `key` to `value`.
2561
+ *
2562
+ * @private
2563
+ * @name set
2564
+ * @memberOf MapCache
2565
+ * @param {string} key The key of the value to set.
2566
+ * @param {*} value The value to set.
2567
+ * @returns {Object} Returns the map cache instance.
2568
+ */
2569
+ function mapCacheSet(key, value) {
2570
+ var data = getMapData(this, key),
2571
+ size = data.size;
2572
+
2573
+ data.set(key, value);
2574
+ this.size += data.size == size ? 0 : 1;
2575
+ return this;
2576
+ }
2577
+
2578
+ /**
2579
+ * Creates a map cache object to store key-value pairs.
2580
+ *
2581
+ * @private
2582
+ * @constructor
2583
+ * @param {Array} [entries] The key-value pairs to cache.
2584
+ */
2585
+ function MapCache(entries) {
2586
+ var index = -1,
2587
+ length = entries == null ? 0 : entries.length;
2588
+
2589
+ this.clear();
2590
+ while (++index < length) {
2591
+ var entry = entries[index];
2592
+ this.set(entry[0], entry[1]);
2593
+ }
2594
+ }
2595
+
2596
+ // Add methods to `MapCache`.
2597
+ MapCache.prototype.clear = mapCacheClear;
2598
+ MapCache.prototype['delete'] = mapCacheDelete;
2599
+ MapCache.prototype.get = mapCacheGet;
2600
+ MapCache.prototype.has = mapCacheHas;
2601
+ MapCache.prototype.set = mapCacheSet;
2602
+
2603
+ /** Built-in value references. */
2604
+ var getPrototype = overArg(Object.getPrototypeOf, Object);
2605
+
2606
+ /** `Object#toString` result references. */
2607
+ var objectTag = '[object Object]';
2608
+
2609
+ /** Used for built-in method references. */
2610
+ var funcProto = Function.prototype,
2611
+ objectProto = Object.prototype;
2612
+
2613
+ /** Used to resolve the decompiled source of functions. */
2614
+ var funcToString = funcProto.toString;
2615
+
2616
+ /** Used to check objects for own properties. */
2617
+ var hasOwnProperty = objectProto.hasOwnProperty;
2618
+
2619
+ /** Used to infer the `Object` constructor. */
2620
+ var objectCtorString = funcToString.call(Object);
2621
+
2622
+ /**
2623
+ * Checks if `value` is a plain object, that is, an object created by the
2624
+ * `Object` constructor or one with a `[[Prototype]]` of `null`.
2625
+ *
2626
+ * @static
2627
+ * @memberOf _
2628
+ * @since 0.8.0
2629
+ * @category Lang
2630
+ * @param {*} value The value to check.
2631
+ * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
2632
+ * @example
2633
+ *
2634
+ * function Foo() {
2635
+ * this.a = 1;
2636
+ * }
2637
+ *
2638
+ * _.isPlainObject(new Foo);
2639
+ * // => false
2640
+ *
2641
+ * _.isPlainObject([1, 2, 3]);
2642
+ * // => false
2643
+ *
2644
+ * _.isPlainObject({ 'x': 0, 'y': 0 });
2645
+ * // => true
2646
+ *
2647
+ * _.isPlainObject(Object.create(null));
2648
+ * // => true
2649
+ */
2650
+ function isPlainObject(value) {
2651
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
2652
+ return false;
2653
+ }
2654
+ var proto = getPrototype(value);
2655
+ if (proto === null) {
2656
+ return true;
2657
+ }
2658
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
2659
+ return typeof Ctor == 'function' && Ctor instanceof Ctor &&
2660
+ funcToString.call(Ctor) == objectCtorString;
2661
+ }
2662
+
2663
+ /**
2664
+ * Removes all key-value entries from the stack.
2665
+ *
2666
+ * @private
2667
+ * @name clear
2668
+ * @memberOf Stack
2669
+ */
2670
+ function stackClear() {
2671
+ this.__data__ = new ListCache;
2672
+ this.size = 0;
2673
+ }
2674
+
2675
+ /**
2676
+ * Removes `key` and its value from the stack.
2677
+ *
2678
+ * @private
2679
+ * @name delete
2680
+ * @memberOf Stack
2681
+ * @param {string} key The key of the value to remove.
2682
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2683
+ */
2684
+ function stackDelete(key) {
2685
+ var data = this.__data__,
2686
+ result = data['delete'](key);
2687
+
2688
+ this.size = data.size;
2689
+ return result;
2690
+ }
2691
+
2692
+ /**
2693
+ * Gets the stack value for `key`.
2694
+ *
2695
+ * @private
2696
+ * @name get
2697
+ * @memberOf Stack
2698
+ * @param {string} key The key of the value to get.
2699
+ * @returns {*} Returns the entry value.
2700
+ */
2701
+ function stackGet(key) {
2702
+ return this.__data__.get(key);
2703
+ }
2704
+
2705
+ /**
2706
+ * Checks if a stack value for `key` exists.
2707
+ *
2708
+ * @private
2709
+ * @name has
2710
+ * @memberOf Stack
2711
+ * @param {string} key The key of the entry to check.
2712
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2713
+ */
2714
+ function stackHas(key) {
2715
+ return this.__data__.has(key);
2716
+ }
2717
+
2718
+ /** Used as the size to enable large array optimizations. */
2719
+ var LARGE_ARRAY_SIZE = 200;
2720
+
2721
+ /**
2722
+ * Sets the stack `key` to `value`.
2723
+ *
2724
+ * @private
2725
+ * @name set
2726
+ * @memberOf Stack
2727
+ * @param {string} key The key of the value to set.
2728
+ * @param {*} value The value to set.
2729
+ * @returns {Object} Returns the stack cache instance.
2730
+ */
2731
+ function stackSet(key, value) {
2732
+ var data = this.__data__;
2733
+ if (data instanceof ListCache) {
2734
+ var pairs = data.__data__;
2735
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2736
+ pairs.push([key, value]);
2737
+ this.size = ++data.size;
2738
+ return this;
2739
+ }
2740
+ data = this.__data__ = new MapCache(pairs);
2741
+ }
2742
+ data.set(key, value);
2743
+ this.size = data.size;
2744
+ return this;
2745
+ }
2746
+
2747
+ /**
2748
+ * Creates a stack cache object to store key-value pairs.
2749
+ *
2750
+ * @private
2751
+ * @constructor
2752
+ * @param {Array} [entries] The key-value pairs to cache.
2753
+ */
2754
+ function Stack(entries) {
2755
+ var data = this.__data__ = new ListCache(entries);
2756
+ this.size = data.size;
2757
+ }
2758
+
2759
+ // Add methods to `Stack`.
2760
+ Stack.prototype.clear = stackClear;
2761
+ Stack.prototype['delete'] = stackDelete;
2762
+ Stack.prototype.get = stackGet;
2763
+ Stack.prototype.has = stackHas;
2764
+ Stack.prototype.set = stackSet;
2765
+
2766
+ /** Detect free variable `exports`. */
2767
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
2768
+
2769
+ /** Detect free variable `module`. */
2770
+ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
2771
+
2772
+ /** Detect the popular CommonJS extension `module.exports`. */
2773
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2774
+
2775
+ /** Built-in value references. */
2776
+ var Buffer = moduleExports ? root.Buffer : undefined;
2777
+ Buffer ? Buffer.allocUnsafe : undefined;
2778
+
2779
+ /**
2780
+ * Creates a clone of `buffer`.
2781
+ *
2782
+ * @private
2783
+ * @param {Buffer} buffer The buffer to clone.
2784
+ * @param {boolean} [isDeep] Specify a deep clone.
2785
+ * @returns {Buffer} Returns the cloned buffer.
2786
+ */
2787
+ function cloneBuffer(buffer, isDeep) {
2788
+ {
2789
+ return buffer.slice();
2790
+ }
2791
+ }
2792
+
2793
+ /** Built-in value references. */
2794
+ var Uint8Array = root.Uint8Array;
2795
+
2796
+ /**
2797
+ * Creates a clone of `arrayBuffer`.
2798
+ *
2799
+ * @private
2800
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2801
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
2802
+ */
2803
+ function cloneArrayBuffer(arrayBuffer) {
2804
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2805
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2806
+ return result;
2807
+ }
2808
+
2809
+ /**
2810
+ * Creates a clone of `typedArray`.
2811
+ *
2812
+ * @private
2813
+ * @param {Object} typedArray The typed array to clone.
2814
+ * @param {boolean} [isDeep] Specify a deep clone.
2815
+ * @returns {Object} Returns the cloned typed array.
2816
+ */
2817
+ function cloneTypedArray(typedArray, isDeep) {
2818
+ var buffer = cloneArrayBuffer(typedArray.buffer) ;
2819
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2820
+ }
2821
+
2822
+ /**
2823
+ * Initializes an object clone.
2824
+ *
2825
+ * @private
2826
+ * @param {Object} object The object to clone.
2827
+ * @returns {Object} Returns the initialized clone.
2828
+ */
2829
+ function initCloneObject(object) {
2830
+ return (typeof object.constructor == 'function' && !isPrototype(object))
2831
+ ? baseCreate(getPrototype(object))
2832
+ : {};
2833
+ }
2834
+
2835
+ /**
2836
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
2837
+ *
2838
+ * @private
2839
+ * @param {boolean} [fromRight] Specify iterating from right to left.
2840
+ * @returns {Function} Returns the new base function.
2841
+ */
2842
+ function createBaseFor(fromRight) {
2843
+ return function(object, iteratee, keysFunc) {
2844
+ var index = -1,
2845
+ iterable = Object(object),
2846
+ props = keysFunc(object),
2847
+ length = props.length;
2848
+
2849
+ while (length--) {
2850
+ var key = props[++index];
2851
+ if (iteratee(iterable[key], key, iterable) === false) {
2852
+ break;
2853
+ }
2854
+ }
2855
+ return object;
2856
+ };
2857
+ }
2858
+
2859
+ /**
2860
+ * The base implementation of `baseForOwn` which iterates over `object`
2861
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
2862
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
2863
+ *
2864
+ * @private
2865
+ * @param {Object} object The object to iterate over.
2866
+ * @param {Function} iteratee The function invoked per iteration.
2867
+ * @param {Function} keysFunc The function to get the keys of `object`.
2868
+ * @returns {Object} Returns `object`.
2869
+ */
2870
+ var baseFor = createBaseFor();
2871
+
2872
+ /**
2873
+ * This function is like `assignValue` except that it doesn't assign
2874
+ * `undefined` values.
2875
+ *
2876
+ * @private
2877
+ * @param {Object} object The object to modify.
2878
+ * @param {string} key The key of the property to assign.
2879
+ * @param {*} value The value to assign.
2880
+ */
2881
+ function assignMergeValue(object, key, value) {
2882
+ if ((value !== undefined && !eq(object[key], value)) ||
2883
+ (value === undefined && !(key in object))) {
2884
+ baseAssignValue(object, key, value);
2885
+ }
2886
+ }
2887
+
2888
+ /**
2889
+ * This method is like `_.isArrayLike` except that it also checks if `value`
2890
+ * is an object.
2891
+ *
2892
+ * @static
2893
+ * @memberOf _
2894
+ * @since 4.0.0
2895
+ * @category Lang
2896
+ * @param {*} value The value to check.
2897
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
2898
+ * else `false`.
2899
+ * @example
2900
+ *
2901
+ * _.isArrayLikeObject([1, 2, 3]);
2902
+ * // => true
2903
+ *
2904
+ * _.isArrayLikeObject(document.body.children);
2905
+ * // => true
2906
+ *
2907
+ * _.isArrayLikeObject('abc');
2908
+ * // => false
2909
+ *
2910
+ * _.isArrayLikeObject(_.noop);
2911
+ * // => false
2912
+ */
2913
+ function isArrayLikeObject(value) {
2914
+ return isObjectLike(value) && isArrayLike(value);
2915
+ }
2916
+
2917
+ /**
2918
+ * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
2919
+ *
2920
+ * @private
2921
+ * @param {Object} object The object to query.
2922
+ * @param {string} key The key of the property to get.
2923
+ * @returns {*} Returns the property value.
2924
+ */
2925
+ function safeGet(object, key) {
2926
+ if (key === 'constructor' && typeof object[key] === 'function') {
2927
+ return;
2928
+ }
2929
+
2930
+ if (key == '__proto__') {
2931
+ return;
2932
+ }
2933
+
2934
+ return object[key];
2935
+ }
2936
+
2937
+ /**
2938
+ * Converts `value` to a plain object flattening inherited enumerable string
2939
+ * keyed properties of `value` to own properties of the plain object.
2940
+ *
2941
+ * @static
2942
+ * @memberOf _
2943
+ * @since 3.0.0
2944
+ * @category Lang
2945
+ * @param {*} value The value to convert.
2946
+ * @returns {Object} Returns the converted plain object.
2947
+ * @example
2948
+ *
2949
+ * function Foo() {
2950
+ * this.b = 2;
2951
+ * }
2952
+ *
2953
+ * Foo.prototype.c = 3;
2954
+ *
2955
+ * _.assign({ 'a': 1 }, new Foo);
2956
+ * // => { 'a': 1, 'b': 2 }
2957
+ *
2958
+ * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
2959
+ * // => { 'a': 1, 'b': 2, 'c': 3 }
2960
+ */
2961
+ function toPlainObject(value) {
2962
+ return copyObject(value, keysIn(value));
2963
+ }
2964
+
2965
+ /**
2966
+ * A specialized version of `baseMerge` for arrays and objects which performs
2967
+ * deep merges and tracks traversed objects enabling objects with circular
2968
+ * references to be merged.
2969
+ *
2970
+ * @private
2971
+ * @param {Object} object The destination object.
2972
+ * @param {Object} source The source object.
2973
+ * @param {string} key The key of the value to merge.
2974
+ * @param {number} srcIndex The index of `source`.
2975
+ * @param {Function} mergeFunc The function to merge values.
2976
+ * @param {Function} [customizer] The function to customize assigned values.
2977
+ * @param {Object} [stack] Tracks traversed source values and their merged
2978
+ * counterparts.
2979
+ */
2980
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
2981
+ var objValue = safeGet(object, key),
2982
+ srcValue = safeGet(source, key),
2983
+ stacked = stack.get(srcValue);
2984
+
2985
+ if (stacked) {
2986
+ assignMergeValue(object, key, stacked);
2987
+ return;
2988
+ }
2989
+ var newValue = customizer
2990
+ ? customizer(objValue, srcValue, (key + ''), object, source, stack)
2991
+ : undefined;
2992
+
2993
+ var isCommon = newValue === undefined;
2994
+
2995
+ if (isCommon) {
2996
+ var isArr = isArray(srcValue),
2997
+ isBuff = !isArr && isBuffer(srcValue),
2998
+ isTyped = !isArr && !isBuff && isTypedArray(srcValue);
2999
+
3000
+ newValue = srcValue;
3001
+ if (isArr || isBuff || isTyped) {
3002
+ if (isArray(objValue)) {
3003
+ newValue = objValue;
3004
+ }
3005
+ else if (isArrayLikeObject(objValue)) {
3006
+ newValue = copyArray(objValue);
3007
+ }
3008
+ else if (isBuff) {
3009
+ isCommon = false;
3010
+ newValue = cloneBuffer(srcValue);
3011
+ }
3012
+ else if (isTyped) {
3013
+ isCommon = false;
3014
+ newValue = cloneTypedArray(srcValue);
3015
+ }
3016
+ else {
3017
+ newValue = [];
3018
+ }
3019
+ }
3020
+ else if (isPlainObject(srcValue) || isArguments(srcValue)) {
3021
+ newValue = objValue;
3022
+ if (isArguments(objValue)) {
3023
+ newValue = toPlainObject(objValue);
3024
+ }
3025
+ else if (!isObject(objValue) || isFunction(objValue)) {
3026
+ newValue = initCloneObject(srcValue);
3027
+ }
3028
+ }
3029
+ else {
3030
+ isCommon = false;
3031
+ }
3032
+ }
3033
+ if (isCommon) {
3034
+ // Recursively merge objects and arrays (susceptible to call stack limits).
3035
+ stack.set(srcValue, newValue);
3036
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
3037
+ stack['delete'](srcValue);
3038
+ }
3039
+ assignMergeValue(object, key, newValue);
3040
+ }
3041
+
3042
+ /**
3043
+ * The base implementation of `_.merge` without support for multiple sources.
3044
+ *
3045
+ * @private
3046
+ * @param {Object} object The destination object.
3047
+ * @param {Object} source The source object.
3048
+ * @param {number} srcIndex The index of `source`.
3049
+ * @param {Function} [customizer] The function to customize merged values.
3050
+ * @param {Object} [stack] Tracks traversed source values and their merged
3051
+ * counterparts.
3052
+ */
3053
+ function baseMerge(object, source, srcIndex, customizer, stack) {
3054
+ if (object === source) {
3055
+ return;
3056
+ }
3057
+ baseFor(source, function(srcValue, key) {
3058
+ stack || (stack = new Stack);
3059
+ if (isObject(srcValue)) {
3060
+ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
3061
+ }
3062
+ else {
3063
+ var newValue = customizer
3064
+ ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
3065
+ : undefined;
3066
+
3067
+ if (newValue === undefined) {
3068
+ newValue = srcValue;
3069
+ }
3070
+ assignMergeValue(object, key, newValue);
3071
+ }
3072
+ }, keysIn);
3073
+ }
3074
+
3075
+ /**
3076
+ * This method is like `_.assign` except that it recursively merges own and
3077
+ * inherited enumerable string keyed properties of source objects into the
3078
+ * destination object. Source properties that resolve to `undefined` are
3079
+ * skipped if a destination value exists. Array and plain object properties
3080
+ * are merged recursively. Other objects and value types are overridden by
3081
+ * assignment. Source objects are applied from left to right. Subsequent
3082
+ * sources overwrite property assignments of previous sources.
3083
+ *
3084
+ * **Note:** This method mutates `object`.
3085
+ *
3086
+ * @static
3087
+ * @memberOf _
3088
+ * @since 0.5.0
3089
+ * @category Object
3090
+ * @param {Object} object The destination object.
3091
+ * @param {...Object} [sources] The source objects.
3092
+ * @returns {Object} Returns `object`.
3093
+ * @example
3094
+ *
3095
+ * var object = {
3096
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
3097
+ * };
3098
+ *
3099
+ * var other = {
3100
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
3101
+ * };
3102
+ *
3103
+ * _.merge(object, other);
3104
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
3105
+ */
3106
+ var merge = createAssigner(function(object, source, srcIndex) {
3107
+ baseMerge(object, source, srcIndex);
3108
+ });
3109
+
3110
+ const cssrAnchorMetaName = 'naive-ui-style';
3111
+
3112
+ function useRtl(mountId, rtlStateRef, clsPrefixRef) {
3113
+ if (!rtlStateRef) return undefined;
3114
+ const ssrAdapter = useSsrAdapter();
3115
+ const componentRtlStateRef = computed(() => {
3116
+ const {
3117
+ value: rtlState
3118
+ } = rtlStateRef;
3119
+ if (!rtlState) {
3120
+ return undefined;
3121
+ }
3122
+ const componentRtlState = rtlState[mountId];
3123
+ if (!componentRtlState) {
3124
+ return undefined;
3125
+ }
3126
+ return componentRtlState;
3127
+ });
3128
+ const NConfigProvider = inject(configProviderInjectionKey, null);
3129
+ const mountStyle = () => {
3130
+ watchEffect(() => {
3131
+ const {
3132
+ value: clsPrefix
3133
+ } = clsPrefixRef;
3134
+ const id = `${clsPrefix}${mountId}Rtl`;
3135
+ // if it already exists, we only need to watch clsPrefix, although in most
3136
+ // of time it's unnecessary... However we can at least listen less
3137
+ // handlers, which is great.
3138
+ if (exists(id, ssrAdapter)) return;
3139
+ const {
3140
+ value: componentRtlState
3141
+ } = componentRtlStateRef;
3142
+ if (!componentRtlState) return;
3143
+ componentRtlState.style.mount({
3144
+ id,
3145
+ head: true,
3146
+ anchorMetaName: cssrAnchorMetaName,
3147
+ props: {
3148
+ bPrefix: clsPrefix ? `.${clsPrefix}-` : undefined
3149
+ },
3150
+ ssr: ssrAdapter,
3151
+ parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
3152
+ });
3153
+ });
3154
+ };
3155
+ if (ssrAdapter) {
3156
+ mountStyle();
3157
+ } else {
3158
+ onBeforeMount(mountStyle);
3159
+ }
3160
+ return componentRtlStateRef;
3161
+ }
3162
+
3163
+ var commonVariables$1 = {
3164
+ fontFamily: 'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
3165
+ fontFamilyMono: 'v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace',
3166
+ fontWeight: '400',
3167
+ fontWeightStrong: '500',
3168
+ cubicBezierEaseInOut: 'cubic-bezier(.4, 0, .2, 1)',
3169
+ cubicBezierEaseOut: 'cubic-bezier(0, 0, .2, 1)',
3170
+ cubicBezierEaseIn: 'cubic-bezier(.4, 0, 1, 1)',
3171
+ borderRadius: '3px',
3172
+ borderRadiusSmall: '2px',
3173
+ fontSize: '14px',
3174
+ fontSizeMini: '12px',
3175
+ fontSizeTiny: '12px',
3176
+ fontSizeSmall: '14px',
3177
+ fontSizeMedium: '14px',
3178
+ fontSizeLarge: '15px',
3179
+ fontSizeHuge: '16px',
3180
+ lineHeight: '1.6',
3181
+ heightMini: '16px',
3182
+ // private now, it's too small
3183
+ heightTiny: '22px',
3184
+ heightSmall: '28px',
3185
+ heightMedium: '34px',
3186
+ heightLarge: '40px',
3187
+ heightHuge: '46px'
3188
+ };
3189
+
3190
+ const {
3191
+ fontSize,
3192
+ fontFamily,
3193
+ lineHeight
3194
+ } = commonVariables$1;
3195
+ // All the components need the style
3196
+ // It is static and won't be changed in the app's lifetime
3197
+ // If user want to overrides it they need to use `n-global-style` is provided
3198
+ //
3199
+ // Technically we can remove font-size & font-family & line-height to make
3200
+ // it pure. However the coding cost doesn't worth it.
3201
+ //
3202
+ // -webkit-tap-hilight-color:
3203
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-tap-highlight-color
3204
+ // In some android devices, there will be the style.
3205
+ var globalStyle = c('body', `
3206
+ margin: 0;
3207
+ font-size: ${fontSize};
3208
+ font-family: ${fontFamily};
3209
+ line-height: ${lineHeight};
3210
+ -webkit-text-size-adjust: 100%;
3211
+ -webkit-tap-highlight-color: transparent;
3212
+ `, [c('input', `
3213
+ font-family: inherit;
3214
+ font-size: inherit;
3215
+ `)]);
3216
+
3217
+ function useTheme(resolveId, mountId, style, defaultTheme, props, clsPrefixRef) {
3218
+ const ssrAdapter = useSsrAdapter();
3219
+ const NConfigProvider = inject(configProviderInjectionKey, null);
3220
+ if (style) {
3221
+ const mountStyle = () => {
3222
+ const clsPrefix = clsPrefixRef === null || clsPrefixRef === void 0 ? void 0 : clsPrefixRef.value;
3223
+ style.mount({
3224
+ id: clsPrefix === undefined ? mountId : clsPrefix + mountId,
3225
+ head: true,
3226
+ props: {
3227
+ bPrefix: clsPrefix ? `.${clsPrefix}-` : undefined
3228
+ },
3229
+ anchorMetaName: cssrAnchorMetaName,
3230
+ ssr: ssrAdapter,
3231
+ parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
3232
+ });
3233
+ if (!(NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.preflightStyleDisabled)) {
3234
+ globalStyle.mount({
3235
+ id: 'n-global',
3236
+ head: true,
3237
+ anchorMetaName: cssrAnchorMetaName,
3238
+ ssr: ssrAdapter,
3239
+ parent: NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.styleMountTarget
3240
+ });
3241
+ }
3242
+ };
3243
+ if (ssrAdapter) {
3244
+ mountStyle();
3245
+ } else {
3246
+ onBeforeMount(mountStyle);
3247
+ }
3248
+ }
3249
+ const mergedThemeRef = computed(() => {
3250
+ var _a;
3251
+ // keep props to make theme overrideable
3252
+ const {
3253
+ theme: {
3254
+ common: selfCommon,
3255
+ self,
3256
+ peers = {}
3257
+ } = {},
3258
+ themeOverrides: selfOverrides = {},
3259
+ builtinThemeOverrides: builtinOverrides = {}
3260
+ } = props;
3261
+ const {
3262
+ common: selfCommonOverrides,
3263
+ peers: peersOverrides
3264
+ } = selfOverrides;
3265
+ const {
3266
+ common: globalCommon = undefined,
3267
+ [resolveId]: {
3268
+ common: globalSelfCommon = undefined,
3269
+ self: globalSelf = undefined,
3270
+ peers: globalPeers = {}
3271
+ } = {}
3272
+ } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeRef.value) || {};
3273
+ const {
3274
+ common: globalCommonOverrides = undefined,
3275
+ [resolveId]: globalSelfOverrides = {}
3276
+ } = (NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedThemeOverridesRef.value) || {};
3277
+ const {
3278
+ common: globalSelfCommonOverrides,
3279
+ peers: globalPeersOverrides = {}
3280
+ } = globalSelfOverrides;
3281
+ const mergedCommon = merge({}, selfCommon || globalSelfCommon || globalCommon || defaultTheme.common, globalCommonOverrides, globalSelfCommonOverrides, selfCommonOverrides);
3282
+ const mergedSelf = merge(
3283
+ // {}, executed every time, no need for empty obj
3284
+ (_a = self || globalSelf || defaultTheme.self) === null || _a === void 0 ? void 0 : _a(mergedCommon), builtinOverrides, globalSelfOverrides, selfOverrides);
3285
+ return {
3286
+ common: mergedCommon,
3287
+ self: mergedSelf,
3288
+ peers: merge({}, defaultTheme.peers, globalPeers, peers),
3289
+ peerOverrides: merge({}, builtinOverrides.peers, globalPeersOverrides, peersOverrides)
3290
+ };
3291
+ });
3292
+ return mergedThemeRef;
3293
+ }
3294
+ useTheme.props = {
3295
+ theme: Object,
3296
+ themeOverrides: Object,
3297
+ builtinThemeOverrides: Object
3298
+ };
3299
+
3300
+ const base = {
3301
+ neutralBase: '#FFF',
3302
+ neutralInvertBase: '#000',
3303
+ neutralTextBase: '#000',
3304
+ neutralPopover: '#fff',
3305
+ neutralCard: '#fff',
3306
+ neutralModal: '#fff',
3307
+ neutralBody: '#fff',
3308
+ alpha1: '0.82',
3309
+ alpha2: '0.72',
3310
+ alpha3: '0.38',
3311
+ alpha4: '0.24',
3312
+ // disabled text, placeholder, icon
3313
+ alpha5: '0.18',
3314
+ // disabled placeholder
3315
+ alphaClose: '0.6',
3316
+ alphaDisabled: '0.5',
3317
+ alphaDisabledInput: '0.02',
3318
+ alphaPending: '0.05',
3319
+ alphaTablePending: '0.02',
3320
+ alphaPressed: '0.07',
3321
+ alphaAvatar: '0.2',
3322
+ alphaRail: '0.14',
3323
+ alphaProgressRail: '.08',
3324
+ alphaBorder: '0.12',
3325
+ alphaDivider: '0.06',
3326
+ alphaInput: '0',
3327
+ alphaAction: '0.02',
3328
+ alphaTab: '0.04',
3329
+ alphaScrollbar: '0.25',
3330
+ alphaScrollbarHover: '0.4',
3331
+ alphaCode: '0.05',
3332
+ alphaTag: '0.02',
3333
+ // primary
3334
+ primaryHover: '#36ad6a',
3335
+ primaryDefault: '#18a058',
3336
+ primaryActive: '#0c7a43',
3337
+ primarySuppl: '#36ad6a',
3338
+ // info
3339
+ infoHover: '#4098fc',
3340
+ infoDefault: '#2080f0',
3341
+ infoActive: '#1060c9',
3342
+ infoSuppl: '#4098fc',
3343
+ // error
3344
+ errorHover: '#de576d',
3345
+ errorDefault: '#d03050',
3346
+ errorActive: '#ab1f3f',
3347
+ errorSuppl: '#de576d',
3348
+ // warning
3349
+ warningHover: '#fcb040',
3350
+ warningDefault: '#f0a020',
3351
+ warningActive: '#c97c10',
3352
+ warningSuppl: '#fcb040',
3353
+ // success
3354
+ successHover: '#36ad6a',
3355
+ successDefault: '#18a058',
3356
+ successActive: '#0c7a43',
3357
+ successSuppl: '#36ad6a'
3358
+ };
3359
+ const baseBackgroundRgb = rgba(base.neutralBase);
3360
+ const baseInvertBackgroundRgb = rgba(base.neutralInvertBase);
3361
+ const overlayPrefix = `rgba(${baseInvertBackgroundRgb.slice(0, 3).join(', ')}, `;
3362
+ function overlay(alpha) {
3363
+ return `${overlayPrefix + String(alpha)})`;
3364
+ }
3365
+ function neutral(alpha) {
3366
+ const overlayRgba = Array.from(baseInvertBackgroundRgb);
3367
+ overlayRgba[3] = Number(alpha);
3368
+ return composite(baseBackgroundRgb, overlayRgba);
3369
+ }
3370
+ const derived = Object.assign(Object.assign({
3371
+ name: 'common'
3372
+ }, commonVariables$1), {
3373
+ baseColor: base.neutralBase,
3374
+ // primary color
3375
+ primaryColor: base.primaryDefault,
3376
+ primaryColorHover: base.primaryHover,
3377
+ primaryColorPressed: base.primaryActive,
3378
+ primaryColorSuppl: base.primarySuppl,
3379
+ // info color
3380
+ infoColor: base.infoDefault,
3381
+ infoColorHover: base.infoHover,
3382
+ infoColorPressed: base.infoActive,
3383
+ infoColorSuppl: base.infoSuppl,
3384
+ // success color
3385
+ successColor: base.successDefault,
3386
+ successColorHover: base.successHover,
3387
+ successColorPressed: base.successActive,
3388
+ successColorSuppl: base.successSuppl,
3389
+ // warning color
3390
+ warningColor: base.warningDefault,
3391
+ warningColorHover: base.warningHover,
3392
+ warningColorPressed: base.warningActive,
3393
+ warningColorSuppl: base.warningSuppl,
3394
+ // error color
3395
+ errorColor: base.errorDefault,
3396
+ errorColorHover: base.errorHover,
3397
+ errorColorPressed: base.errorActive,
3398
+ errorColorSuppl: base.errorSuppl,
3399
+ // text color
3400
+ textColorBase: base.neutralTextBase,
3401
+ textColor1: 'rgb(31, 34, 37)',
3402
+ textColor2: 'rgb(51, 54, 57)',
3403
+ textColor3: 'rgb(118, 124, 130)',
3404
+ // textColor4: neutral(base.alpha4), // disabled, placeholder, icon
3405
+ // textColor5: neutral(base.alpha5),
3406
+ textColorDisabled: neutral(base.alpha4),
3407
+ placeholderColor: neutral(base.alpha4),
3408
+ placeholderColorDisabled: neutral(base.alpha5),
3409
+ iconColor: neutral(base.alpha4),
3410
+ iconColorHover: scaleColor(neutral(base.alpha4), {
3411
+ lightness: 0.75
3412
+ }),
3413
+ iconColorPressed: scaleColor(neutral(base.alpha4), {
3414
+ lightness: 0.9
3415
+ }),
3416
+ iconColorDisabled: neutral(base.alpha5),
3417
+ opacity1: base.alpha1,
3418
+ opacity2: base.alpha2,
3419
+ opacity3: base.alpha3,
3420
+ opacity4: base.alpha4,
3421
+ opacity5: base.alpha5,
3422
+ dividerColor: 'rgb(239, 239, 245)',
3423
+ borderColor: 'rgb(224, 224, 230)',
3424
+ // close
3425
+ closeIconColor: neutral(Number(base.alphaClose)),
3426
+ closeIconColorHover: neutral(Number(base.alphaClose)),
3427
+ closeIconColorPressed: neutral(Number(base.alphaClose)),
3428
+ closeColorHover: 'rgba(0, 0, 0, .09)',
3429
+ closeColorPressed: 'rgba(0, 0, 0, .13)',
3430
+ // clear
3431
+ clearColor: neutral(base.alpha4),
3432
+ clearColorHover: scaleColor(neutral(base.alpha4), {
3433
+ lightness: 0.75
3434
+ }),
3435
+ clearColorPressed: scaleColor(neutral(base.alpha4), {
3436
+ lightness: 0.9
3437
+ }),
3438
+ scrollbarColor: overlay(base.alphaScrollbar),
3439
+ scrollbarColorHover: overlay(base.alphaScrollbarHover),
3440
+ scrollbarWidth: '5px',
3441
+ scrollbarHeight: '5px',
3442
+ scrollbarBorderRadius: '5px',
3443
+ progressRailColor: neutral(base.alphaProgressRail),
3444
+ railColor: 'rgb(219, 219, 223)',
3445
+ popoverColor: base.neutralPopover,
3446
+ tableColor: base.neutralCard,
3447
+ cardColor: base.neutralCard,
3448
+ modalColor: base.neutralModal,
3449
+ bodyColor: base.neutralBody,
3450
+ tagColor: '#eee',
3451
+ avatarColor: neutral(base.alphaAvatar),
3452
+ invertedColor: 'rgb(0, 20, 40)',
3453
+ inputColor: neutral(base.alphaInput),
3454
+ codeColor: 'rgb(244, 244, 248)',
3455
+ tabColor: 'rgb(247, 247, 250)',
3456
+ actionColor: 'rgb(250, 250, 252)',
3457
+ tableHeaderColor: 'rgb(250, 250, 252)',
3458
+ hoverColor: 'rgb(243, 243, 245)',
3459
+ // use color with alpha since it can be nested with header filter & sorter effect
3460
+ tableColorHover: 'rgba(0, 0, 100, 0.03)',
3461
+ tableColorStriped: 'rgba(0, 0, 100, 0.02)',
3462
+ pressedColor: 'rgb(237, 237, 239)',
3463
+ opacityDisabled: base.alphaDisabled,
3464
+ inputColorDisabled: 'rgb(250, 250, 252)',
3465
+ // secondary button color
3466
+ // can also be used in tertiary button & quaternary button
3467
+ buttonColor2: 'rgba(46, 51, 56, .05)',
3468
+ buttonColor2Hover: 'rgba(46, 51, 56, .09)',
3469
+ buttonColor2Pressed: 'rgba(46, 51, 56, .13)',
3470
+ boxShadow1: '0 1px 2px -2px rgba(0, 0, 0, .08), 0 3px 6px 0 rgba(0, 0, 0, .06), 0 5px 12px 4px rgba(0, 0, 0, .04)',
3471
+ boxShadow2: '0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05)',
3472
+ boxShadow3: '0 6px 16px -9px rgba(0, 0, 0, .08), 0 9px 28px 0 rgba(0, 0, 0, .05), 0 12px 48px 16px rgba(0, 0, 0, .03)'
3473
+ });
3474
+
3475
+ var commonVariables = {
3476
+ radioSizeSmall: '14px',
3477
+ radioSizeMedium: '16px',
3478
+ radioSizeLarge: '18px',
3479
+ labelPadding: '0 8px',
3480
+ labelFontWeight: '400'
3481
+ };
3482
+
3483
+ function self$1(vars) {
3484
+ const {
3485
+ borderColor,
3486
+ primaryColor,
3487
+ baseColor,
3488
+ textColorDisabled,
3489
+ inputColorDisabled,
3490
+ textColor2,
3491
+ opacityDisabled,
3492
+ borderRadius,
3493
+ fontSizeSmall,
3494
+ fontSizeMedium,
3495
+ fontSizeLarge,
3496
+ heightSmall,
3497
+ heightMedium,
3498
+ heightLarge,
3499
+ lineHeight
3500
+ } = vars;
3501
+ return Object.assign(Object.assign({}, commonVariables), {
3502
+ labelLineHeight: lineHeight,
3503
+ buttonHeightSmall: heightSmall,
3504
+ buttonHeightMedium: heightMedium,
3505
+ buttonHeightLarge: heightLarge,
3506
+ fontSizeSmall,
3507
+ fontSizeMedium,
3508
+ fontSizeLarge,
3509
+ boxShadow: `inset 0 0 0 1px ${borderColor}`,
3510
+ boxShadowActive: `inset 0 0 0 1px ${primaryColor}`,
3511
+ boxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, {
3512
+ alpha: 0.2
3513
+ })}`,
3514
+ boxShadowHover: `inset 0 0 0 1px ${primaryColor}`,
3515
+ boxShadowDisabled: `inset 0 0 0 1px ${borderColor}`,
3516
+ color: baseColor,
3517
+ colorDisabled: inputColorDisabled,
3518
+ colorActive: '#0000',
3519
+ textColor: textColor2,
3520
+ textColorDisabled,
3521
+ dotColorActive: primaryColor,
3522
+ dotColorDisabled: borderColor,
3523
+ buttonBorderColor: borderColor,
3524
+ buttonBorderColorActive: primaryColor,
3525
+ buttonBorderColorHover: borderColor,
3526
+ buttonColor: baseColor,
3527
+ buttonColorActive: baseColor,
3528
+ buttonTextColor: textColor2,
3529
+ buttonTextColorActive: primaryColor,
3530
+ buttonTextColorHover: primaryColor,
3531
+ opacityDisabled,
3532
+ buttonBoxShadowFocus: `inset 0 0 0 1px ${primaryColor}, 0 0 0 2px ${changeColor(primaryColor, {
3533
+ alpha: 0.3
3534
+ })}`,
3535
+ buttonBoxShadowHover: 'inset 0 0 0 1px #0000',
3536
+ buttonBoxShadow: 'inset 0 0 0 1px #0000',
3537
+ buttonBorderRadius: borderRadius
3538
+ });
3539
+ }
3540
+ const radioLight = {
3541
+ name: 'Radio',
3542
+ common: derived,
3543
+ self: self$1
3544
+ };
3545
+
3546
+ // vars:
3547
+ // --n-bezier
3548
+ // --n-box-shadow
3549
+ // --n-box-shadow-active
3550
+ // --n-box-shadow-disabled
3551
+ // --n-box-shadow-focus
3552
+ // --n-box-shadow-hover
3553
+ // --n-color
3554
+ // --n-color-disabled
3555
+ // --n-dot-color-active
3556
+ // --n-dot-color-disabled
3557
+ // --n-font-size
3558
+ // --n-radio-size
3559
+ // --n-text-color
3560
+ // --n-text-color-disabled
3561
+ // --n-label-padding
3562
+ // --n-label-line-height
3563
+ // --n-color-active
3564
+ var style = cB('radio', `
3565
+ line-height: var(--n-label-line-height);
3566
+ outline: none;
3567
+ position: relative;
3568
+ user-select: none;
3569
+ -webkit-user-select: none;
3570
+ display: inline-flex;
3571
+ align-items: flex-start;
3572
+ flex-wrap: nowrap;
3573
+ font-size: var(--n-font-size);
3574
+ word-break: break-word;
3575
+ `, [cM('checked', [cE('dot', `
3576
+ background-color: var(--n-color-active);
3577
+ `)]), cE('dot-wrapper', `
3578
+ position: relative;
3579
+ flex-shrink: 0;
3580
+ flex-grow: 0;
3581
+ width: var(--n-radio-size);
3582
+ `), cB('radio-input', `
3583
+ position: absolute;
3584
+ border: 0;
3585
+ border-radius: inherit;
3586
+ left: 0;
3587
+ right: 0;
3588
+ top: 0;
3589
+ bottom: 0;
3590
+ opacity: 0;
3591
+ z-index: 1;
3592
+ cursor: pointer;
3593
+ `), cE('dot', `
3594
+ position: absolute;
3595
+ top: 50%;
3596
+ left: 0;
3597
+ transform: translateY(-50%);
3598
+ height: var(--n-radio-size);
3599
+ width: var(--n-radio-size);
3600
+ background: var(--n-color);
3601
+ box-shadow: var(--n-box-shadow);
3602
+ border-radius: 50%;
3603
+ transition:
3604
+ background-color .3s var(--n-bezier),
3605
+ box-shadow .3s var(--n-bezier);
3606
+ `, [c('&::before', `
3607
+ content: "";
3608
+ opacity: 0;
3609
+ position: absolute;
3610
+ left: 4px;
3611
+ top: 4px;
3612
+ height: calc(100% - 8px);
3613
+ width: calc(100% - 8px);
3614
+ border-radius: 50%;
3615
+ transform: scale(.8);
3616
+ background: var(--n-dot-color-active);
3617
+ transition:
3618
+ opacity .3s var(--n-bezier),
3619
+ background-color .3s var(--n-bezier),
3620
+ transform .3s var(--n-bezier);
3621
+ `), cM('checked', {
3622
+ boxShadow: 'var(--n-box-shadow-active)'
3623
+ }, [c('&::before', `
3624
+ opacity: 1;
3625
+ transform: scale(1);
3626
+ `)])]), cE('label', `
3627
+ color: var(--n-text-color);
3628
+ padding: var(--n-label-padding);
3629
+ font-weight: var(--n-label-font-weight);
3630
+ display: inline-block;
3631
+ transition: color .3s var(--n-bezier);
3632
+ `), cNotM('disabled', `
3633
+ cursor: pointer;
3634
+ `, [c('&:hover', [cE('dot', {
3635
+ boxShadow: 'var(--n-box-shadow-hover)'
3636
+ })]), cM('focus', [c('&:not(:active)', [cE('dot', {
3637
+ boxShadow: 'var(--n-box-shadow-focus)'
3638
+ })])])]), cM('disabled', `
3639
+ cursor: not-allowed;
3640
+ `, [cE('dot', {
3641
+ boxShadow: 'var(--n-box-shadow-disabled)',
3642
+ backgroundColor: 'var(--n-color-disabled)'
3643
+ }, [c('&::before', {
3644
+ backgroundColor: 'var(--n-dot-color-disabled)'
3645
+ }), cM('checked', `
3646
+ opacity: 1;
3647
+ `)]), cE('label', {
3648
+ color: 'var(--n-text-color-disabled)'
3649
+ }), cB('radio-input', `
3650
+ cursor: not-allowed;
3651
+ `)])]);
3652
+
3653
+ const radioBaseProps = {
3654
+ name: String,
3655
+ value: {
3656
+ type: [String, Number, Boolean],
3657
+ default: 'on'
3658
+ },
3659
+ checked: {
3660
+ type: Boolean,
3661
+ default: undefined
3662
+ },
3663
+ defaultChecked: Boolean,
3664
+ disabled: {
3665
+ type: Boolean,
3666
+ default: undefined
3667
+ },
3668
+ label: String,
3669
+ size: String,
3670
+ onUpdateChecked: [Function, Array],
3671
+ 'onUpdate:checked': [Function, Array],
3672
+ // deprecated
3673
+ checkedValue: {
3674
+ type: Boolean,
3675
+ default: undefined
3676
+ }
3677
+ };
3678
+ const radioGroupInjectionKey = createInjectionKey('n-radio-group');
3679
+ function setup(props) {
3680
+ if (process.env.NODE_ENV !== 'production') {
3681
+ watchEffect(() => {
3682
+ if (props.checkedValue !== undefined) {
3683
+ warnOnce('radio', '`checked-value` is deprecated, please use `checked` instead.');
3684
+ }
3685
+ });
3686
+ }
3687
+ const NRadioGroup = inject(radioGroupInjectionKey, null);
3688
+ const formItem = useFormItem(props, {
3689
+ mergedSize(NFormItem) {
3690
+ const {
3691
+ size
3692
+ } = props;
3693
+ if (size !== undefined) return size;
3694
+ if (NRadioGroup) {
3695
+ const {
3696
+ mergedSizeRef: {
3697
+ value: mergedSize
3698
+ }
3699
+ } = NRadioGroup;
3700
+ if (mergedSize !== undefined) {
3701
+ return mergedSize;
3702
+ }
3703
+ }
3704
+ if (NFormItem) {
3705
+ return NFormItem.mergedSize.value;
3706
+ }
3707
+ return 'medium';
3708
+ },
3709
+ mergedDisabled(NFormItem) {
3710
+ if (props.disabled) return true;
3711
+ if (NRadioGroup === null || NRadioGroup === void 0 ? void 0 : NRadioGroup.disabledRef.value) return true;
3712
+ if (NFormItem === null || NFormItem === void 0 ? void 0 : NFormItem.disabled.value) return true;
3713
+ return false;
3714
+ }
3715
+ });
3716
+ const {
3717
+ mergedSizeRef,
3718
+ mergedDisabledRef
3719
+ } = formItem;
3720
+ const inputRef = ref(null);
3721
+ const labelRef = ref(null);
3722
+ const uncontrolledCheckedRef = ref(props.defaultChecked);
3723
+ const controlledCheckedRef = toRef(props, 'checked');
3724
+ const mergedCheckedRef = useMergedState(controlledCheckedRef, uncontrolledCheckedRef);
3725
+ const renderSafeCheckedRef = useMemo(() => {
3726
+ if (NRadioGroup) return NRadioGroup.valueRef.value === props.value;
3727
+ return mergedCheckedRef.value;
3728
+ });
3729
+ const mergedNameRef = useMemo(() => {
3730
+ const {
3731
+ name
3732
+ } = props;
3733
+ if (name !== undefined) return name;
3734
+ if (NRadioGroup) return NRadioGroup.nameRef.value;
3735
+ });
3736
+ const focusRef = ref(false);
3737
+ function doUpdateChecked() {
3738
+ if (NRadioGroup) {
3739
+ const {
3740
+ doUpdateValue
3741
+ } = NRadioGroup;
3742
+ const {
3743
+ value
3744
+ } = props;
3745
+ call(doUpdateValue, value);
3746
+ } else {
3747
+ const {
3748
+ onUpdateChecked,
3749
+ 'onUpdate:checked': _onUpdateChecked
3750
+ } = props;
3751
+ const {
3752
+ nTriggerFormInput,
3753
+ nTriggerFormChange
3754
+ } = formItem;
3755
+ if (onUpdateChecked) call(onUpdateChecked, true);
3756
+ if (_onUpdateChecked) call(_onUpdateChecked, true);
3757
+ nTriggerFormInput();
3758
+ nTriggerFormChange();
3759
+ uncontrolledCheckedRef.value = true;
3760
+ }
3761
+ }
3762
+ function toggle() {
3763
+ if (mergedDisabledRef.value) return;
3764
+ if (!renderSafeCheckedRef.value) {
3765
+ doUpdateChecked();
3766
+ }
3767
+ }
3768
+ function handleRadioInputChange() {
3769
+ toggle();
3770
+ // Restore element check prop's value to current state, since if doesn't
3771
+ // reflect current VNode. If not, bug will happens in component with element
3772
+ // that has internal state such as <input />.
3773
+ if (inputRef.value) {
3774
+ inputRef.value.checked = renderSafeCheckedRef.value;
3775
+ }
3776
+ }
3777
+ function handleRadioInputBlur() {
3778
+ focusRef.value = false;
3779
+ }
3780
+ function handleRadioInputFocus() {
3781
+ focusRef.value = true;
3782
+ }
3783
+ return {
3784
+ mergedClsPrefix: NRadioGroup ? NRadioGroup.mergedClsPrefixRef : useConfig(props).mergedClsPrefixRef,
3785
+ inputRef,
3786
+ labelRef,
3787
+ mergedName: mergedNameRef,
3788
+ mergedDisabled: mergedDisabledRef,
3789
+ renderSafeChecked: renderSafeCheckedRef,
3790
+ focus: focusRef,
3791
+ mergedSize: mergedSizeRef,
3792
+ handleRadioInputChange,
3793
+ handleRadioInputBlur,
3794
+ handleRadioInputFocus
3795
+ };
3796
+ }
3797
+
3798
+ const radioProps = Object.assign(Object.assign({}, useTheme.props), radioBaseProps);
3799
+ var NRadio = defineComponent({
3800
+ name: 'Radio',
3801
+ props: radioProps,
3802
+ setup(props) {
3803
+ const radio = setup(props);
3804
+ const themeRef = useTheme('Radio', '-radio', style, radioLight, props, radio.mergedClsPrefix);
3805
+ const cssVarsRef = computed(() => {
3806
+ const {
3807
+ mergedSize: {
3808
+ value: size
3809
+ }
3810
+ } = radio;
3811
+ const {
3812
+ common: {
3813
+ cubicBezierEaseInOut
3814
+ },
3815
+ self: {
3816
+ boxShadow,
3817
+ boxShadowActive,
3818
+ boxShadowDisabled,
3819
+ boxShadowFocus,
3820
+ boxShadowHover,
3821
+ color,
3822
+ colorDisabled,
3823
+ colorActive,
3824
+ textColor,
3825
+ textColorDisabled,
3826
+ dotColorActive,
3827
+ dotColorDisabled,
3828
+ labelPadding,
3829
+ labelLineHeight,
3830
+ labelFontWeight,
3831
+ [createKey('fontSize', size)]: fontSize,
3832
+ [createKey('radioSize', size)]: radioSize
3833
+ }
3834
+ } = themeRef.value;
3835
+ return {
3836
+ '--n-bezier': cubicBezierEaseInOut,
3837
+ '--n-label-line-height': labelLineHeight,
3838
+ '--n-label-font-weight': labelFontWeight,
3839
+ '--n-box-shadow': boxShadow,
3840
+ '--n-box-shadow-active': boxShadowActive,
3841
+ '--n-box-shadow-disabled': boxShadowDisabled,
3842
+ '--n-box-shadow-focus': boxShadowFocus,
3843
+ '--n-box-shadow-hover': boxShadowHover,
3844
+ '--n-color': color,
3845
+ '--n-color-active': colorActive,
3846
+ '--n-color-disabled': colorDisabled,
3847
+ '--n-dot-color-active': dotColorActive,
3848
+ '--n-dot-color-disabled': dotColorDisabled,
3849
+ '--n-font-size': fontSize,
3850
+ '--n-radio-size': radioSize,
3851
+ '--n-text-color': textColor,
3852
+ '--n-text-color-disabled': textColorDisabled,
3853
+ '--n-label-padding': labelPadding
3854
+ };
3855
+ });
3856
+ const {
3857
+ inlineThemeDisabled,
3858
+ mergedClsPrefixRef,
3859
+ mergedRtlRef
3860
+ } = useConfig(props);
3861
+ const rtlEnabledRef = useRtl('Radio', mergedRtlRef, mergedClsPrefixRef);
3862
+ const themeClassHandle = inlineThemeDisabled ? useThemeClass('radio', computed(() => radio.mergedSize.value[0]), cssVarsRef, props) : undefined;
3863
+ return Object.assign(radio, {
3864
+ rtlEnabled: rtlEnabledRef,
3865
+ cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
3866
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
3867
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
3868
+ });
3869
+ },
3870
+ render() {
3871
+ const {
3872
+ $slots,
3873
+ mergedClsPrefix,
3874
+ onRender,
3875
+ label
3876
+ } = this;
3877
+ onRender === null || onRender === void 0 ? void 0 : onRender();
3878
+ return h("label", {
3879
+ class: [`${mergedClsPrefix}-radio`, this.themeClass, this.rtlEnabled && `${mergedClsPrefix}-radio--rtl`, this.mergedDisabled && `${mergedClsPrefix}-radio--disabled`, this.renderSafeChecked && `${mergedClsPrefix}-radio--checked`, this.focus && `${mergedClsPrefix}-radio--focus`],
3880
+ style: this.cssVars
3881
+ }, h("input", {
3882
+ ref: "inputRef",
3883
+ type: "radio",
3884
+ class: `${mergedClsPrefix}-radio-input`,
3885
+ value: this.value,
3886
+ name: this.mergedName,
3887
+ checked: this.renderSafeChecked,
3888
+ disabled: this.mergedDisabled,
3889
+ onChange: this.handleRadioInputChange,
3890
+ onFocus: this.handleRadioInputFocus,
3891
+ onBlur: this.handleRadioInputBlur
3892
+ }), h("div", {
3893
+ class: `${mergedClsPrefix}-radio__dot-wrapper`
3894
+ }, "\u00A0", h("div", {
3895
+ class: [`${mergedClsPrefix}-radio__dot`, this.renderSafeChecked && `${mergedClsPrefix}-radio__dot--checked`]
3896
+ })), resolveWrappedSlot($slots.default, children => {
3897
+ if (!children && !label) return null;
3898
+ return h("div", {
3899
+ ref: "labelRef",
3900
+ class: `${mergedClsPrefix}-radio__label`
3901
+ }, children || label);
3902
+ }));
3903
+ }
3904
+ });
3905
+
3906
+ const props = {
3907
+ ..._VkTabelsV1Ctx.props,
3908
+ /**
3909
+ * @description v-model 绑定值
3910
+ * @property {Array} modelValue
3911
+ */
3912
+ modelValue: {
3913
+ type: Array,
3914
+ default: () => []
3915
+ },
3916
+ /**
3917
+ * 必须保证主键唯一且生效,选择逻辑才生效
3918
+ *
3919
+ */
3920
+ oidField: {
3921
+ type: String,
3922
+ default: "id"
3923
+ },
3924
+ /**
3925
+ * 是否禁用
3926
+ * @property
3927
+ */
3928
+ disabled: {
3929
+ type: Boolean,
3930
+ default: void 0
3931
+ },
3932
+ /**
3933
+ * 允许多个
3934
+ */
3935
+ multiple: {
3936
+ type: Boolean,
3937
+ default: true
3938
+ },
3939
+ /**
3940
+ * 隐藏选择列
3941
+ */
3942
+ selectionHidden: {
3943
+ type: Boolean,
3944
+ default: false
3945
+ }
3946
+ };
3947
+ const emits = {
3948
+ ..._VkTabelsV1Ctx.emits,
3949
+ "update:modelValue": (val) => Array.isArray(val)
3950
+ };
3951
+
3952
+ const radioThemeOverrides = {
3953
+ dotColorActive: "var(--el-color-primary)",
3954
+ boxShadowActive: "inset 0 0 0 1px var(--el-color-primary)",
3955
+ boxShadowHover: "inset 0 0 0 1px var(--el-color-primary)",
3956
+ boxShadowFocus: "inset 0 0 0 1px var(--el-color-primary), 0 0 0 2px rgba(24, 160, 88, 0.2)"
3957
+ };
3958
+ var _sfc_main = /* @__PURE__ */ defineComponent({
3959
+ name: "VkTablesV1Checkbox",
3960
+ components: {
3961
+ VkCheckRecordLogicProvider,
3962
+ VkTablesV1
3963
+ },
3964
+ inheritAttrs: false,
3965
+ props,
3966
+ emits,
3967
+ setup(props2, {
3968
+ emit
3969
+ }) {
3970
+ const coreProps = _VkTabelsV1Ctx.createBindProps(props2, ["columns"]);
3971
+ const coreEmits = _VkTabelsV1Ctx.createOnEmits(emit);
3972
+ const getCurrentPageCheckInfo = () => {
3973
+ const oidField = props2.oidField;
3974
+ const allCheckedId = props2.modelValue.map(d => d[oidField]);
3975
+ const checkedNodes = [];
3976
+ const uncheckedNodes = [];
3977
+ props2.data.forEach(d => {
3978
+ if (allCheckedId.includes(d[oidField])) {
3979
+ checkedNodes.push(d);
3980
+ } else {
3981
+ uncheckedNodes.push(d);
3982
+ }
3983
+ });
3984
+ return {
3985
+ checkedNodes,
3986
+ uncheckedNodes
3987
+ };
3988
+ };
3989
+ function singleChange(row) {
3990
+ const current = props2.modelValue[0];
3991
+ if (current && current[props2.oidField] === row[props2.oidField]) {
3992
+ emit("update:modelValue", []);
3993
+ return;
3994
+ }
3995
+ emit("update:modelValue", [row]);
3996
+ }
3997
+ function headerCheckboxChange(checked, uncheckedNodes) {
3998
+ if (checked) {
3999
+ emit("update:modelValue", [...props2.modelValue, ...uncheckedNodes]);
4000
+ } else {
4001
+ emit("update:modelValue", props2.modelValue.filter(d => {
4002
+ const id = d[props2.oidField];
4003
+ return !props2.data.some(d2 => d2[props2.oidField] === id);
4004
+ }));
4005
+ }
4006
+ }
4007
+ const checkboxCol = {
4008
+ prop: void 0,
4009
+ label: "",
4010
+ width: "50",
4011
+ align: "center",
4012
+ headerAlign: "center",
4013
+ slots: {
4014
+ default: e => createVNode(VkCheckRecordLogic, {
4015
+ "custom": true,
4016
+ "name": e.row
4017
+ }, {
4018
+ default: ({
4019
+ toggle,
4020
+ isActive
4021
+ }) => {
4022
+ const onChange = props2.multiple ? toggle : () => singleChange(e.row);
4023
+ return props2.multiple ? createVNode(ElCheckbox, {
4024
+ "disabled": props2.disabled,
4025
+ "modelValue": isActive,
4026
+ "onChange": onChange
4027
+ }, null) : createVNode(NRadio, {
4028
+ "disabled": props2.disabled,
4029
+ "checked": isActive,
4030
+ "onUpdate:checked": onChange,
4031
+ "theme-overrides": radioThemeOverrides
4032
+ }, null);
4033
+ }
4034
+ }),
4035
+ header: () => {
4036
+ if (!props2.multiple) return "";
4037
+ const {
4038
+ checkedNodes,
4039
+ uncheckedNodes
4040
+ } = getCurrentPageCheckInfo();
4041
+ return createVNode(ElCheckbox, {
4042
+ "disabled": props2.disabled,
4043
+ "indeterminate": checkedNodes.length > 0 && checkedNodes.length < props2.data.length,
4044
+ "modelValue": checkedNodes.length && checkedNodes.length === props2.data.length,
4045
+ "onUpdate:modelValue": checked => headerCheckboxChange(checked, uncheckedNodes)
4046
+ }, null);
4047
+ }
4048
+ }
4049
+ };
4050
+ return {
4051
+ coreProps,
4052
+ coreEmits,
4053
+ checkboxCol
4054
+ };
4055
+ }
4056
+ });
4057
+
4058
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4059
+ const _component_VkTablesV1 = resolveComponent("VkTablesV1");
4060
+ const _component_VkCheckRecordLogicProvider = resolveComponent("VkCheckRecordLogicProvider");
4061
+ return openBlock(), createBlock(_component_VkCheckRecordLogicProvider, {
4062
+ "allow-extra": true,
4063
+ "model-value": _ctx.modelValue,
4064
+ "oid-field": _ctx.oidField,
4065
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
4066
+ }, {
4067
+ default: withCtx(() => [
4068
+ createVNode(_component_VkTablesV1, mergeProps({
4069
+ ..._ctx.coreProps,
4070
+ ..._ctx.$attrs
4071
+ }, {
4072
+ columns: [
4073
+ _ctx.selectionHidden ? { hidden: true } : _ctx.checkboxCol,
4074
+ ..._ctx.columns
4075
+ ]
4076
+ }, toHandlers(_ctx.coreEmits)), null, 16, ["columns"])
4077
+ ]),
4078
+ _: 1
4079
+ /* STABLE */
4080
+ }, 8, ["model-value", "oid-field"]);
4081
+ }
4082
+ var VkTablesV1Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/vunk-plus/vunk-plus/packages/components/tables-v1-checkbox/src/index.vue"]]);
4083
+
4084
+ var types = /*#__PURE__*/Object.freeze({
4085
+ __proto__: null
4086
+ });
4087
+
4088
+ VkTablesV1Checkbox.install = (app) => {
4089
+ app.component(VkTablesV1Checkbox.name || "VkTablesV1Checkbox", VkTablesV1Checkbox);
4090
+ };
4091
+
4092
+ export { VkTablesV1Checkbox, types as __VkTablesV1Checkbox, VkTablesV1Checkbox as default };