@tager/admin-blog 0.3.21 → 0.3.25

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 (86) hide show
  1. package/dist/index.esm.js +3452 -612
  2. package/dist/index.umd.js +3454 -619
  3. package/package.json +13 -7
  4. package/src/constants/menu.ts +0 -2
  5. package/src/constants/paths.ts +0 -5
  6. package/src/constants/routes.ts +5 -18
  7. package/src/constants/scopes.ts +11 -0
  8. package/src/dev.ts +11 -44
  9. package/src/hooks/index.ts +6 -0
  10. package/src/hooks/useBlogCategoryList.ts +3 -5
  11. package/src/hooks/useBlogPostList.ts +2 -4
  12. package/src/hooks/useModuleConfig.ts +4 -8
  13. package/src/hooks/useStore.ts +8 -0
  14. package/src/hooks/useUserPermission.ts +16 -0
  15. package/src/hooks/useUserProfile.ts +13 -0
  16. package/src/locales/en.ts +17 -5
  17. package/src/locales/ru.ts +17 -4
  18. package/src/router/index.ts +39 -0
  19. package/src/services/requests.ts +33 -43
  20. package/src/store/index.ts +21 -0
  21. package/src/store/user.ts +109 -0
  22. package/src/typings/common.ts +1 -0
  23. package/src/typings/model.ts +62 -38
  24. package/src/utils/common.ts +23 -0
  25. package/src/views/App.vue +10 -4
  26. package/src/views/{BlogCategoryForm/BlogCategoryForm.helpers.ts → Categories/CategoryForm/CategoryForm.helpers.ts} +22 -7
  27. package/src/views/{BlogCategoryForm/BlogCategoryForm.vue → Categories/CategoryForm/CategoryForm.vue} +140 -63
  28. package/src/views/Categories/CategoryForm/index.ts +1 -0
  29. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +91 -0
  30. package/src/views/Categories/CategoryList/CategoryList.vue +269 -0
  31. package/src/views/Categories/CategoryList/hooks/index.ts +1 -0
  32. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +95 -0
  33. package/src/views/Categories/CategoryList/index.ts +1 -0
  34. package/src/views/Home.vue +2 -9
  35. package/src/views/Posts/PostForm/PostForm.helpers.ts +150 -0
  36. package/src/views/Posts/PostForm/PostForm.vue +550 -0
  37. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.types.ts +0 -0
  38. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/TabList.vue +1 -1
  39. package/src/views/{BlogPostForm → Posts/PostForm}/components/TabList/index.ts +0 -0
  40. package/src/views/Posts/PostForm/index.ts +1 -0
  41. package/src/views/{BlogPostList/BlogPostList.helpers.ts → Posts/PostList/PostList.helpers.ts} +10 -18
  42. package/src/views/Posts/PostList/PostList.vue +361 -0
  43. package/src/views/Posts/PostList/hooks/index.ts +1 -0
  44. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +250 -0
  45. package/src/views/Posts/PostList/index.ts +1 -0
  46. package/dist/constants/menu.d.ts +0 -5
  47. package/dist/constants/paths.d.ts +0 -16
  48. package/dist/constants/routes.d.ts +0 -6
  49. package/dist/dev.d.ts +0 -3
  50. package/dist/hooks/useBlogCategoryList.d.ts +0 -7
  51. package/dist/hooks/useBlogPostList.d.ts +0 -7
  52. package/dist/hooks/useModuleConfig.d.ts +0 -7
  53. package/dist/locales/en.d.ts +0 -63
  54. package/dist/locales/ru.d.ts +0 -3
  55. package/dist/main.d.ts +0 -4
  56. package/dist/services/requests.d.ts +0 -68
  57. package/dist/typings/model.d.ts +0 -74
  58. package/dist/views/BlogCategoryForm/BlogCategoryForm.helpers.d.ts +0 -16
  59. package/dist/views/BlogCategoryForm/BlogCategoryForm.vue.d.ts +0 -86
  60. package/dist/views/BlogCategoryForm/index.d.ts +0 -1
  61. package/dist/views/BlogCategoryList/BlogCategoryList.helpers.d.ts +0 -6
  62. package/dist/views/BlogCategoryList/BlogCategoryList.vue.d.ts +0 -3
  63. package/dist/views/BlogCategoryList/index.d.ts +0 -1
  64. package/dist/views/BlogPostForm/BlogPostForm.helpers.d.ts +0 -27
  65. package/dist/views/BlogPostForm/BlogPostForm.vue.d.ts +0 -9320
  66. package/dist/views/BlogPostForm/components/TabList/TabList.types.d.ts +0 -5
  67. package/dist/views/BlogPostForm/components/TabList/index.d.ts +0 -2
  68. package/dist/views/BlogPostForm/index.d.ts +0 -1
  69. package/dist/views/BlogPostList/BlogPostList.helpers.d.ts +0 -6
  70. package/dist/views/BlogPostList/BlogPostList.vue.d.ts +0 -45
  71. package/dist/views/BlogPostList/index.d.ts +0 -1
  72. package/dist/views/BlogSettings/BlogSettings.helpers.d.ts +0 -6
  73. package/dist/views/BlogSettings/BlogSettings.vue.d.ts +0 -9132
  74. package/dist/views/BlogSettings/index.d.ts +0 -1
  75. package/src/views/BlogCategoryForm/index.ts +0 -1
  76. package/src/views/BlogCategoryList/BlogCategoryList.helpers.ts +0 -82
  77. package/src/views/BlogCategoryList/BlogCategoryList.vue +0 -196
  78. package/src/views/BlogCategoryList/index.ts +0 -1
  79. package/src/views/BlogPostForm/BlogPostForm.helpers.ts +0 -152
  80. package/src/views/BlogPostForm/BlogPostForm.vue +0 -534
  81. package/src/views/BlogPostForm/index.ts +0 -1
  82. package/src/views/BlogPostList/BlogPostList.vue +0 -174
  83. package/src/views/BlogPostList/index.ts +0 -1
  84. package/src/views/BlogSettings/BlogSettings.helpers.ts +0 -25
  85. package/src/views/BlogSettings/BlogSettings.vue +0 -110
  86. package/src/views/BlogSettings/index.ts +0 -1
package/dist/index.esm.js CHANGED
@@ -1,9 +1,8 @@
1
- import { request, useResource, notEmpty, useResourceDelete, createId, isNotNullish, convertRequestErrorToMap, urlTranslit, i18n } from '@tager/admin-services';
2
- import { onMounted, defineComponent, computed, ref, watch } from '@vue/composition-api';
3
- import { useDataTable, ShortCodeConstructor, FormFooter, createTabErrorFinder } from '@tager/admin-ui';
1
+ import { request, useResource, FETCH_STATUSES, notEmpty, isNotNullish, useResourceDelete, useResourceClone, createId, convertRequestErrorToMap, urlTranslit, getWebsiteOrigin, i18n } from '@tager/admin-services';
2
+ import { onMounted, computed, ref, watch, defineComponent } from '@vue/composition-api';
3
+ import { getFilterParamAsStringArray, getFilterParamAsString, getFilterParams, useTranslation, useDataTable, ShortCodeConstructor, FormFooter, createTabErrorFinder } from '@tager/admin-ui';
4
4
  import { compile } from 'path-to-regexp';
5
5
  import { universalFieldUtils, DynamicField } from '@tager/admin-dynamic-field';
6
- import Vue from 'vue';
7
6
 
8
7
  const EN = {
9
8
  yes: 'Yes',
@@ -13,17 +12,13 @@ const EN = {
13
12
  categories: 'Categories',
14
13
  createPost: 'Create post',
15
14
  createCategory: 'Create category',
16
- settings: 'Settings',
17
15
  home: 'Home',
18
16
  allPosts: 'All posts',
19
17
  postForm: 'Post Form',
20
18
  allCategories: 'All categories',
21
19
  categoryForm: 'Category Form',
22
- blogSettings: 'Blog settings',
23
20
  success: 'Success',
24
- blogSettingsHaveBeenSuccessfullyUpdated: 'Blog settings have been successfully updated',
25
21
  error: 'Error',
26
- blogSettingsUpdateHasBeenFailed: 'Blog settings update has been failed',
27
22
  newPost: 'New Post',
28
23
  edit: 'Edit',
29
24
  remove: 'Remove',
@@ -31,7 +26,14 @@ const EN = {
31
26
  name: 'Name',
32
27
  image: 'Image',
33
28
  language: 'Language',
29
+ languages: 'Languages',
34
30
  date: 'Date',
31
+ dateOfPublication: 'Date of publication',
32
+ from: 'from',
33
+ to: 'to',
34
+ From: 'From',
35
+ To: 'To',
36
+ category: 'Category',
35
37
  actions: 'Actions',
36
38
  updatePost: 'Update post',
37
39
  title: 'Title',
@@ -66,6 +68,14 @@ const EN = {
66
68
  blogCategoryWasSuccessfullyUpdated: 'Blog category was successfully updated',
67
69
  blogCategoryCreationWasFailed: 'Blog category creation was failed',
68
70
  blogCategoryUpdateWasFailed: 'Blog category update was failed',
71
+ clone: 'Clone',
72
+ cloneConfirm: 'Are you sure you want to clone the page?',
73
+ cloneSuccess: 'Page have copied successfully',
74
+ cloneFailure: 'Page copy failure',
75
+ tabs: {
76
+ common: 'Common',
77
+ seo: 'SEO',
78
+ },
69
79
  };
70
80
 
71
81
  const RU = {
@@ -76,17 +86,13 @@ const RU = {
76
86
  categories: 'Категории',
77
87
  createPost: 'Создать пост',
78
88
  createCategory: 'Создать категорию',
79
- settings: 'Настройки',
80
89
  home: 'Главная',
81
90
  allPosts: 'Все посты',
82
91
  postForm: 'Форма поста',
83
92
  allCategories: 'Все категории',
84
93
  categoryForm: 'Форма категории',
85
- blogSettings: 'Настройки блога',
86
94
  success: 'Успех',
87
- blogSettingsHaveBeenSuccessfullyUpdated: 'Настройки блога успешно обновлены',
88
95
  error: 'Ошибка',
89
- blogSettingsUpdateHasBeenFailed: 'Не удалось обновить настройки блога',
90
96
  newPost: 'Новый пост',
91
97
  edit: 'Редактировать',
92
98
  remove: 'Удалить',
@@ -94,7 +100,14 @@ const RU = {
94
100
  name: 'Имя',
95
101
  image: 'Изображение',
96
102
  language: 'Язык',
103
+ languages: 'Языки',
97
104
  date: 'Дата',
105
+ dateOfPublication: 'Дата публикации',
106
+ from: 'от',
107
+ to: 'до',
108
+ From: 'От',
109
+ To: 'До',
110
+ category: 'Категория',
98
111
  actions: 'Действия',
99
112
  updatePost: 'Обновить пост',
100
113
  title: 'Заголовок',
@@ -129,8 +142,2390 @@ const RU = {
129
142
  blogCategoryWasSuccessfullyUpdated: 'Категория блога успешно обновлена',
130
143
  blogCategoryCreationWasFailed: 'Не удалось создать категорию блога',
131
144
  blogCategoryUpdateWasFailed: 'Не удалось обновить категорию блога',
145
+ clone: 'Клонировать',
146
+ cloneConfirm: 'Вы уверены, что хотите создать копию страницы?',
147
+ cloneSuccess: 'Копия страницы успешно создана',
148
+ cloneFailure: 'Ошибка копирования страницы',
149
+ tabs: {
150
+ common: 'Общие',
151
+ seo: 'SEO',
152
+ },
132
153
  };
133
154
 
155
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
156
+
157
+ function createCommonjsModule(fn, basedir, module) {
158
+ return module = {
159
+ path: basedir,
160
+ exports: {},
161
+ require: function (path, base) {
162
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
163
+ }
164
+ }, fn(module, module.exports), module.exports;
165
+ }
166
+
167
+ function commonjsRequire () {
168
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
169
+ }
170
+
171
+ var lodash_isequal = createCommonjsModule(function (module, exports) {
172
+ /**
173
+ * Lodash (Custom Build) <https://lodash.com/>
174
+ * Build: `lodash modularize exports="npm" -o ./`
175
+ * Copyright JS Foundation and other contributors <https://js.foundation/>
176
+ * Released under MIT license <https://lodash.com/license>
177
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
178
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
179
+ */
180
+
181
+ /** Used as the size to enable large array optimizations. */
182
+ var LARGE_ARRAY_SIZE = 200;
183
+
184
+ /** Used to stand-in for `undefined` hash values. */
185
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
186
+
187
+ /** Used to compose bitmasks for value comparisons. */
188
+ var COMPARE_PARTIAL_FLAG = 1,
189
+ COMPARE_UNORDERED_FLAG = 2;
190
+
191
+ /** Used as references for various `Number` constants. */
192
+ var MAX_SAFE_INTEGER = 9007199254740991;
193
+
194
+ /** `Object#toString` result references. */
195
+ var argsTag = '[object Arguments]',
196
+ arrayTag = '[object Array]',
197
+ asyncTag = '[object AsyncFunction]',
198
+ boolTag = '[object Boolean]',
199
+ dateTag = '[object Date]',
200
+ errorTag = '[object Error]',
201
+ funcTag = '[object Function]',
202
+ genTag = '[object GeneratorFunction]',
203
+ mapTag = '[object Map]',
204
+ numberTag = '[object Number]',
205
+ nullTag = '[object Null]',
206
+ objectTag = '[object Object]',
207
+ promiseTag = '[object Promise]',
208
+ proxyTag = '[object Proxy]',
209
+ regexpTag = '[object RegExp]',
210
+ setTag = '[object Set]',
211
+ stringTag = '[object String]',
212
+ symbolTag = '[object Symbol]',
213
+ undefinedTag = '[object Undefined]',
214
+ weakMapTag = '[object WeakMap]';
215
+
216
+ var arrayBufferTag = '[object ArrayBuffer]',
217
+ dataViewTag = '[object DataView]',
218
+ float32Tag = '[object Float32Array]',
219
+ float64Tag = '[object Float64Array]',
220
+ int8Tag = '[object Int8Array]',
221
+ int16Tag = '[object Int16Array]',
222
+ int32Tag = '[object Int32Array]',
223
+ uint8Tag = '[object Uint8Array]',
224
+ uint8ClampedTag = '[object Uint8ClampedArray]',
225
+ uint16Tag = '[object Uint16Array]',
226
+ uint32Tag = '[object Uint32Array]';
227
+
228
+ /**
229
+ * Used to match `RegExp`
230
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
231
+ */
232
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
233
+
234
+ /** Used to detect host constructors (Safari). */
235
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
236
+
237
+ /** Used to detect unsigned integer values. */
238
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
239
+
240
+ /** Used to identify `toStringTag` values of typed arrays. */
241
+ var typedArrayTags = {};
242
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
243
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
244
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
245
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
246
+ typedArrayTags[uint32Tag] = true;
247
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
248
+ typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
249
+ typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
250
+ typedArrayTags[errorTag] = typedArrayTags[funcTag] =
251
+ typedArrayTags[mapTag] = typedArrayTags[numberTag] =
252
+ typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
253
+ typedArrayTags[setTag] = typedArrayTags[stringTag] =
254
+ typedArrayTags[weakMapTag] = false;
255
+
256
+ /** Detect free variable `global` from Node.js. */
257
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
258
+
259
+ /** Detect free variable `self`. */
260
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
261
+
262
+ /** Used as a reference to the global object. */
263
+ var root = freeGlobal || freeSelf || Function('return this')();
264
+
265
+ /** Detect free variable `exports`. */
266
+ var freeExports = exports && !exports.nodeType && exports;
267
+
268
+ /** Detect free variable `module`. */
269
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
270
+
271
+ /** Detect the popular CommonJS extension `module.exports`. */
272
+ var moduleExports = freeModule && freeModule.exports === freeExports;
273
+
274
+ /** Detect free variable `process` from Node.js. */
275
+ var freeProcess = moduleExports && freeGlobal.process;
276
+
277
+ /** Used to access faster Node.js helpers. */
278
+ var nodeUtil = (function() {
279
+ try {
280
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
281
+ } catch (e) {}
282
+ }());
283
+
284
+ /* Node.js helper references. */
285
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
286
+
287
+ /**
288
+ * A specialized version of `_.filter` for arrays without support for
289
+ * iteratee shorthands.
290
+ *
291
+ * @private
292
+ * @param {Array} [array] The array to iterate over.
293
+ * @param {Function} predicate The function invoked per iteration.
294
+ * @returns {Array} Returns the new filtered array.
295
+ */
296
+ function arrayFilter(array, predicate) {
297
+ var index = -1,
298
+ length = array == null ? 0 : array.length,
299
+ resIndex = 0,
300
+ result = [];
301
+
302
+ while (++index < length) {
303
+ var value = array[index];
304
+ if (predicate(value, index, array)) {
305
+ result[resIndex++] = value;
306
+ }
307
+ }
308
+ return result;
309
+ }
310
+
311
+ /**
312
+ * Appends the elements of `values` to `array`.
313
+ *
314
+ * @private
315
+ * @param {Array} array The array to modify.
316
+ * @param {Array} values The values to append.
317
+ * @returns {Array} Returns `array`.
318
+ */
319
+ function arrayPush(array, values) {
320
+ var index = -1,
321
+ length = values.length,
322
+ offset = array.length;
323
+
324
+ while (++index < length) {
325
+ array[offset + index] = values[index];
326
+ }
327
+ return array;
328
+ }
329
+
330
+ /**
331
+ * A specialized version of `_.some` for arrays without support for iteratee
332
+ * shorthands.
333
+ *
334
+ * @private
335
+ * @param {Array} [array] The array to iterate over.
336
+ * @param {Function} predicate The function invoked per iteration.
337
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
338
+ * else `false`.
339
+ */
340
+ function arraySome(array, predicate) {
341
+ var index = -1,
342
+ length = array == null ? 0 : array.length;
343
+
344
+ while (++index < length) {
345
+ if (predicate(array[index], index, array)) {
346
+ return true;
347
+ }
348
+ }
349
+ return false;
350
+ }
351
+
352
+ /**
353
+ * The base implementation of `_.times` without support for iteratee shorthands
354
+ * or max array length checks.
355
+ *
356
+ * @private
357
+ * @param {number} n The number of times to invoke `iteratee`.
358
+ * @param {Function} iteratee The function invoked per iteration.
359
+ * @returns {Array} Returns the array of results.
360
+ */
361
+ function baseTimes(n, iteratee) {
362
+ var index = -1,
363
+ result = Array(n);
364
+
365
+ while (++index < n) {
366
+ result[index] = iteratee(index);
367
+ }
368
+ return result;
369
+ }
370
+
371
+ /**
372
+ * The base implementation of `_.unary` without support for storing metadata.
373
+ *
374
+ * @private
375
+ * @param {Function} func The function to cap arguments for.
376
+ * @returns {Function} Returns the new capped function.
377
+ */
378
+ function baseUnary(func) {
379
+ return function(value) {
380
+ return func(value);
381
+ };
382
+ }
383
+
384
+ /**
385
+ * Checks if a `cache` value for `key` exists.
386
+ *
387
+ * @private
388
+ * @param {Object} cache The cache to query.
389
+ * @param {string} key The key of the entry to check.
390
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
391
+ */
392
+ function cacheHas(cache, key) {
393
+ return cache.has(key);
394
+ }
395
+
396
+ /**
397
+ * Gets the value at `key` of `object`.
398
+ *
399
+ * @private
400
+ * @param {Object} [object] The object to query.
401
+ * @param {string} key The key of the property to get.
402
+ * @returns {*} Returns the property value.
403
+ */
404
+ function getValue(object, key) {
405
+ return object == null ? undefined : object[key];
406
+ }
407
+
408
+ /**
409
+ * Converts `map` to its key-value pairs.
410
+ *
411
+ * @private
412
+ * @param {Object} map The map to convert.
413
+ * @returns {Array} Returns the key-value pairs.
414
+ */
415
+ function mapToArray(map) {
416
+ var index = -1,
417
+ result = Array(map.size);
418
+
419
+ map.forEach(function(value, key) {
420
+ result[++index] = [key, value];
421
+ });
422
+ return result;
423
+ }
424
+
425
+ /**
426
+ * Creates a unary function that invokes `func` with its argument transformed.
427
+ *
428
+ * @private
429
+ * @param {Function} func The function to wrap.
430
+ * @param {Function} transform The argument transform.
431
+ * @returns {Function} Returns the new function.
432
+ */
433
+ function overArg(func, transform) {
434
+ return function(arg) {
435
+ return func(transform(arg));
436
+ };
437
+ }
438
+
439
+ /**
440
+ * Converts `set` to an array of its values.
441
+ *
442
+ * @private
443
+ * @param {Object} set The set to convert.
444
+ * @returns {Array} Returns the values.
445
+ */
446
+ function setToArray(set) {
447
+ var index = -1,
448
+ result = Array(set.size);
449
+
450
+ set.forEach(function(value) {
451
+ result[++index] = value;
452
+ });
453
+ return result;
454
+ }
455
+
456
+ /** Used for built-in method references. */
457
+ var arrayProto = Array.prototype,
458
+ funcProto = Function.prototype,
459
+ objectProto = Object.prototype;
460
+
461
+ /** Used to detect overreaching core-js shims. */
462
+ var coreJsData = root['__core-js_shared__'];
463
+
464
+ /** Used to resolve the decompiled source of functions. */
465
+ var funcToString = funcProto.toString;
466
+
467
+ /** Used to check objects for own properties. */
468
+ var hasOwnProperty = objectProto.hasOwnProperty;
469
+
470
+ /** Used to detect methods masquerading as native. */
471
+ var maskSrcKey = (function() {
472
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
473
+ return uid ? ('Symbol(src)_1.' + uid) : '';
474
+ }());
475
+
476
+ /**
477
+ * Used to resolve the
478
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
479
+ * of values.
480
+ */
481
+ var nativeObjectToString = objectProto.toString;
482
+
483
+ /** Used to detect if a method is native. */
484
+ var reIsNative = RegExp('^' +
485
+ funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
486
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
487
+ );
488
+
489
+ /** Built-in value references. */
490
+ var Buffer = moduleExports ? root.Buffer : undefined,
491
+ Symbol = root.Symbol,
492
+ Uint8Array = root.Uint8Array,
493
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
494
+ splice = arrayProto.splice,
495
+ symToStringTag = Symbol ? Symbol.toStringTag : undefined;
496
+
497
+ /* Built-in method references for those with the same name as other `lodash` methods. */
498
+ var nativeGetSymbols = Object.getOwnPropertySymbols,
499
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
500
+ nativeKeys = overArg(Object.keys, Object);
501
+
502
+ /* Built-in method references that are verified to be native. */
503
+ var DataView = getNative(root, 'DataView'),
504
+ Map = getNative(root, 'Map'),
505
+ Promise = getNative(root, 'Promise'),
506
+ Set = getNative(root, 'Set'),
507
+ WeakMap = getNative(root, 'WeakMap'),
508
+ nativeCreate = getNative(Object, 'create');
509
+
510
+ /** Used to detect maps, sets, and weakmaps. */
511
+ var dataViewCtorString = toSource(DataView),
512
+ mapCtorString = toSource(Map),
513
+ promiseCtorString = toSource(Promise),
514
+ setCtorString = toSource(Set),
515
+ weakMapCtorString = toSource(WeakMap);
516
+
517
+ /** Used to convert symbols to primitives and strings. */
518
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
519
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
520
+
521
+ /**
522
+ * Creates a hash object.
523
+ *
524
+ * @private
525
+ * @constructor
526
+ * @param {Array} [entries] The key-value pairs to cache.
527
+ */
528
+ function Hash(entries) {
529
+ var index = -1,
530
+ length = entries == null ? 0 : entries.length;
531
+
532
+ this.clear();
533
+ while (++index < length) {
534
+ var entry = entries[index];
535
+ this.set(entry[0], entry[1]);
536
+ }
537
+ }
538
+
539
+ /**
540
+ * Removes all key-value entries from the hash.
541
+ *
542
+ * @private
543
+ * @name clear
544
+ * @memberOf Hash
545
+ */
546
+ function hashClear() {
547
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
548
+ this.size = 0;
549
+ }
550
+
551
+ /**
552
+ * Removes `key` and its value from the hash.
553
+ *
554
+ * @private
555
+ * @name delete
556
+ * @memberOf Hash
557
+ * @param {Object} hash The hash to modify.
558
+ * @param {string} key The key of the value to remove.
559
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
560
+ */
561
+ function hashDelete(key) {
562
+ var result = this.has(key) && delete this.__data__[key];
563
+ this.size -= result ? 1 : 0;
564
+ return result;
565
+ }
566
+
567
+ /**
568
+ * Gets the hash value for `key`.
569
+ *
570
+ * @private
571
+ * @name get
572
+ * @memberOf Hash
573
+ * @param {string} key The key of the value to get.
574
+ * @returns {*} Returns the entry value.
575
+ */
576
+ function hashGet(key) {
577
+ var data = this.__data__;
578
+ if (nativeCreate) {
579
+ var result = data[key];
580
+ return result === HASH_UNDEFINED ? undefined : result;
581
+ }
582
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
583
+ }
584
+
585
+ /**
586
+ * Checks if a hash value for `key` exists.
587
+ *
588
+ * @private
589
+ * @name has
590
+ * @memberOf Hash
591
+ * @param {string} key The key of the entry to check.
592
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
593
+ */
594
+ function hashHas(key) {
595
+ var data = this.__data__;
596
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
597
+ }
598
+
599
+ /**
600
+ * Sets the hash `key` to `value`.
601
+ *
602
+ * @private
603
+ * @name set
604
+ * @memberOf Hash
605
+ * @param {string} key The key of the value to set.
606
+ * @param {*} value The value to set.
607
+ * @returns {Object} Returns the hash instance.
608
+ */
609
+ function hashSet(key, value) {
610
+ var data = this.__data__;
611
+ this.size += this.has(key) ? 0 : 1;
612
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
613
+ return this;
614
+ }
615
+
616
+ // Add methods to `Hash`.
617
+ Hash.prototype.clear = hashClear;
618
+ Hash.prototype['delete'] = hashDelete;
619
+ Hash.prototype.get = hashGet;
620
+ Hash.prototype.has = hashHas;
621
+ Hash.prototype.set = hashSet;
622
+
623
+ /**
624
+ * Creates an list cache object.
625
+ *
626
+ * @private
627
+ * @constructor
628
+ * @param {Array} [entries] The key-value pairs to cache.
629
+ */
630
+ function ListCache(entries) {
631
+ var index = -1,
632
+ length = entries == null ? 0 : entries.length;
633
+
634
+ this.clear();
635
+ while (++index < length) {
636
+ var entry = entries[index];
637
+ this.set(entry[0], entry[1]);
638
+ }
639
+ }
640
+
641
+ /**
642
+ * Removes all key-value entries from the list cache.
643
+ *
644
+ * @private
645
+ * @name clear
646
+ * @memberOf ListCache
647
+ */
648
+ function listCacheClear() {
649
+ this.__data__ = [];
650
+ this.size = 0;
651
+ }
652
+
653
+ /**
654
+ * Removes `key` and its value from the list cache.
655
+ *
656
+ * @private
657
+ * @name delete
658
+ * @memberOf ListCache
659
+ * @param {string} key The key of the value to remove.
660
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
661
+ */
662
+ function listCacheDelete(key) {
663
+ var data = this.__data__,
664
+ index = assocIndexOf(data, key);
665
+
666
+ if (index < 0) {
667
+ return false;
668
+ }
669
+ var lastIndex = data.length - 1;
670
+ if (index == lastIndex) {
671
+ data.pop();
672
+ } else {
673
+ splice.call(data, index, 1);
674
+ }
675
+ --this.size;
676
+ return true;
677
+ }
678
+
679
+ /**
680
+ * Gets the list cache value for `key`.
681
+ *
682
+ * @private
683
+ * @name get
684
+ * @memberOf ListCache
685
+ * @param {string} key The key of the value to get.
686
+ * @returns {*} Returns the entry value.
687
+ */
688
+ function listCacheGet(key) {
689
+ var data = this.__data__,
690
+ index = assocIndexOf(data, key);
691
+
692
+ return index < 0 ? undefined : data[index][1];
693
+ }
694
+
695
+ /**
696
+ * Checks if a list cache value for `key` exists.
697
+ *
698
+ * @private
699
+ * @name has
700
+ * @memberOf ListCache
701
+ * @param {string} key The key of the entry to check.
702
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
703
+ */
704
+ function listCacheHas(key) {
705
+ return assocIndexOf(this.__data__, key) > -1;
706
+ }
707
+
708
+ /**
709
+ * Sets the list cache `key` to `value`.
710
+ *
711
+ * @private
712
+ * @name set
713
+ * @memberOf ListCache
714
+ * @param {string} key The key of the value to set.
715
+ * @param {*} value The value to set.
716
+ * @returns {Object} Returns the list cache instance.
717
+ */
718
+ function listCacheSet(key, value) {
719
+ var data = this.__data__,
720
+ index = assocIndexOf(data, key);
721
+
722
+ if (index < 0) {
723
+ ++this.size;
724
+ data.push([key, value]);
725
+ } else {
726
+ data[index][1] = value;
727
+ }
728
+ return this;
729
+ }
730
+
731
+ // Add methods to `ListCache`.
732
+ ListCache.prototype.clear = listCacheClear;
733
+ ListCache.prototype['delete'] = listCacheDelete;
734
+ ListCache.prototype.get = listCacheGet;
735
+ ListCache.prototype.has = listCacheHas;
736
+ ListCache.prototype.set = listCacheSet;
737
+
738
+ /**
739
+ * Creates a map cache object to store key-value pairs.
740
+ *
741
+ * @private
742
+ * @constructor
743
+ * @param {Array} [entries] The key-value pairs to cache.
744
+ */
745
+ function MapCache(entries) {
746
+ var index = -1,
747
+ length = entries == null ? 0 : entries.length;
748
+
749
+ this.clear();
750
+ while (++index < length) {
751
+ var entry = entries[index];
752
+ this.set(entry[0], entry[1]);
753
+ }
754
+ }
755
+
756
+ /**
757
+ * Removes all key-value entries from the map.
758
+ *
759
+ * @private
760
+ * @name clear
761
+ * @memberOf MapCache
762
+ */
763
+ function mapCacheClear() {
764
+ this.size = 0;
765
+ this.__data__ = {
766
+ 'hash': new Hash,
767
+ 'map': new (Map || ListCache),
768
+ 'string': new Hash
769
+ };
770
+ }
771
+
772
+ /**
773
+ * Removes `key` and its value from the map.
774
+ *
775
+ * @private
776
+ * @name delete
777
+ * @memberOf MapCache
778
+ * @param {string} key The key of the value to remove.
779
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
780
+ */
781
+ function mapCacheDelete(key) {
782
+ var result = getMapData(this, key)['delete'](key);
783
+ this.size -= result ? 1 : 0;
784
+ return result;
785
+ }
786
+
787
+ /**
788
+ * Gets the map value for `key`.
789
+ *
790
+ * @private
791
+ * @name get
792
+ * @memberOf MapCache
793
+ * @param {string} key The key of the value to get.
794
+ * @returns {*} Returns the entry value.
795
+ */
796
+ function mapCacheGet(key) {
797
+ return getMapData(this, key).get(key);
798
+ }
799
+
800
+ /**
801
+ * Checks if a map value for `key` exists.
802
+ *
803
+ * @private
804
+ * @name has
805
+ * @memberOf MapCache
806
+ * @param {string} key The key of the entry to check.
807
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
808
+ */
809
+ function mapCacheHas(key) {
810
+ return getMapData(this, key).has(key);
811
+ }
812
+
813
+ /**
814
+ * Sets the map `key` to `value`.
815
+ *
816
+ * @private
817
+ * @name set
818
+ * @memberOf MapCache
819
+ * @param {string} key The key of the value to set.
820
+ * @param {*} value The value to set.
821
+ * @returns {Object} Returns the map cache instance.
822
+ */
823
+ function mapCacheSet(key, value) {
824
+ var data = getMapData(this, key),
825
+ size = data.size;
826
+
827
+ data.set(key, value);
828
+ this.size += data.size == size ? 0 : 1;
829
+ return this;
830
+ }
831
+
832
+ // Add methods to `MapCache`.
833
+ MapCache.prototype.clear = mapCacheClear;
834
+ MapCache.prototype['delete'] = mapCacheDelete;
835
+ MapCache.prototype.get = mapCacheGet;
836
+ MapCache.prototype.has = mapCacheHas;
837
+ MapCache.prototype.set = mapCacheSet;
838
+
839
+ /**
840
+ *
841
+ * Creates an array cache object to store unique values.
842
+ *
843
+ * @private
844
+ * @constructor
845
+ * @param {Array} [values] The values to cache.
846
+ */
847
+ function SetCache(values) {
848
+ var index = -1,
849
+ length = values == null ? 0 : values.length;
850
+
851
+ this.__data__ = new MapCache;
852
+ while (++index < length) {
853
+ this.add(values[index]);
854
+ }
855
+ }
856
+
857
+ /**
858
+ * Adds `value` to the array cache.
859
+ *
860
+ * @private
861
+ * @name add
862
+ * @memberOf SetCache
863
+ * @alias push
864
+ * @param {*} value The value to cache.
865
+ * @returns {Object} Returns the cache instance.
866
+ */
867
+ function setCacheAdd(value) {
868
+ this.__data__.set(value, HASH_UNDEFINED);
869
+ return this;
870
+ }
871
+
872
+ /**
873
+ * Checks if `value` is in the array cache.
874
+ *
875
+ * @private
876
+ * @name has
877
+ * @memberOf SetCache
878
+ * @param {*} value The value to search for.
879
+ * @returns {number} Returns `true` if `value` is found, else `false`.
880
+ */
881
+ function setCacheHas(value) {
882
+ return this.__data__.has(value);
883
+ }
884
+
885
+ // Add methods to `SetCache`.
886
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
887
+ SetCache.prototype.has = setCacheHas;
888
+
889
+ /**
890
+ * Creates a stack cache object to store key-value pairs.
891
+ *
892
+ * @private
893
+ * @constructor
894
+ * @param {Array} [entries] The key-value pairs to cache.
895
+ */
896
+ function Stack(entries) {
897
+ var data = this.__data__ = new ListCache(entries);
898
+ this.size = data.size;
899
+ }
900
+
901
+ /**
902
+ * Removes all key-value entries from the stack.
903
+ *
904
+ * @private
905
+ * @name clear
906
+ * @memberOf Stack
907
+ */
908
+ function stackClear() {
909
+ this.__data__ = new ListCache;
910
+ this.size = 0;
911
+ }
912
+
913
+ /**
914
+ * Removes `key` and its value from the stack.
915
+ *
916
+ * @private
917
+ * @name delete
918
+ * @memberOf Stack
919
+ * @param {string} key The key of the value to remove.
920
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
921
+ */
922
+ function stackDelete(key) {
923
+ var data = this.__data__,
924
+ result = data['delete'](key);
925
+
926
+ this.size = data.size;
927
+ return result;
928
+ }
929
+
930
+ /**
931
+ * Gets the stack value for `key`.
932
+ *
933
+ * @private
934
+ * @name get
935
+ * @memberOf Stack
936
+ * @param {string} key The key of the value to get.
937
+ * @returns {*} Returns the entry value.
938
+ */
939
+ function stackGet(key) {
940
+ return this.__data__.get(key);
941
+ }
942
+
943
+ /**
944
+ * Checks if a stack value for `key` exists.
945
+ *
946
+ * @private
947
+ * @name has
948
+ * @memberOf Stack
949
+ * @param {string} key The key of the entry to check.
950
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
951
+ */
952
+ function stackHas(key) {
953
+ return this.__data__.has(key);
954
+ }
955
+
956
+ /**
957
+ * Sets the stack `key` to `value`.
958
+ *
959
+ * @private
960
+ * @name set
961
+ * @memberOf Stack
962
+ * @param {string} key The key of the value to set.
963
+ * @param {*} value The value to set.
964
+ * @returns {Object} Returns the stack cache instance.
965
+ */
966
+ function stackSet(key, value) {
967
+ var data = this.__data__;
968
+ if (data instanceof ListCache) {
969
+ var pairs = data.__data__;
970
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
971
+ pairs.push([key, value]);
972
+ this.size = ++data.size;
973
+ return this;
974
+ }
975
+ data = this.__data__ = new MapCache(pairs);
976
+ }
977
+ data.set(key, value);
978
+ this.size = data.size;
979
+ return this;
980
+ }
981
+
982
+ // Add methods to `Stack`.
983
+ Stack.prototype.clear = stackClear;
984
+ Stack.prototype['delete'] = stackDelete;
985
+ Stack.prototype.get = stackGet;
986
+ Stack.prototype.has = stackHas;
987
+ Stack.prototype.set = stackSet;
988
+
989
+ /**
990
+ * Creates an array of the enumerable property names of the array-like `value`.
991
+ *
992
+ * @private
993
+ * @param {*} value The value to query.
994
+ * @param {boolean} inherited Specify returning inherited property names.
995
+ * @returns {Array} Returns the array of property names.
996
+ */
997
+ function arrayLikeKeys(value, inherited) {
998
+ var isArr = isArray(value),
999
+ isArg = !isArr && isArguments(value),
1000
+ isBuff = !isArr && !isArg && isBuffer(value),
1001
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1002
+ skipIndexes = isArr || isArg || isBuff || isType,
1003
+ result = skipIndexes ? baseTimes(value.length, String) : [],
1004
+ length = result.length;
1005
+
1006
+ for (var key in value) {
1007
+ if ((inherited || hasOwnProperty.call(value, key)) &&
1008
+ !(skipIndexes && (
1009
+ // Safari 9 has enumerable `arguments.length` in strict mode.
1010
+ key == 'length' ||
1011
+ // Node.js 0.10 has enumerable non-index properties on buffers.
1012
+ (isBuff && (key == 'offset' || key == 'parent')) ||
1013
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
1014
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1015
+ // Skip index properties.
1016
+ isIndex(key, length)
1017
+ ))) {
1018
+ result.push(key);
1019
+ }
1020
+ }
1021
+ return result;
1022
+ }
1023
+
1024
+ /**
1025
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
1026
+ *
1027
+ * @private
1028
+ * @param {Array} array The array to inspect.
1029
+ * @param {*} key The key to search for.
1030
+ * @returns {number} Returns the index of the matched value, else `-1`.
1031
+ */
1032
+ function assocIndexOf(array, key) {
1033
+ var length = array.length;
1034
+ while (length--) {
1035
+ if (eq(array[length][0], key)) {
1036
+ return length;
1037
+ }
1038
+ }
1039
+ return -1;
1040
+ }
1041
+
1042
+ /**
1043
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1044
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1045
+ * symbols of `object`.
1046
+ *
1047
+ * @private
1048
+ * @param {Object} object The object to query.
1049
+ * @param {Function} keysFunc The function to get the keys of `object`.
1050
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
1051
+ * @returns {Array} Returns the array of property names and symbols.
1052
+ */
1053
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1054
+ var result = keysFunc(object);
1055
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1056
+ }
1057
+
1058
+ /**
1059
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1060
+ *
1061
+ * @private
1062
+ * @param {*} value The value to query.
1063
+ * @returns {string} Returns the `toStringTag`.
1064
+ */
1065
+ function baseGetTag(value) {
1066
+ if (value == null) {
1067
+ return value === undefined ? undefinedTag : nullTag;
1068
+ }
1069
+ return (symToStringTag && symToStringTag in Object(value))
1070
+ ? getRawTag(value)
1071
+ : objectToString(value);
1072
+ }
1073
+
1074
+ /**
1075
+ * The base implementation of `_.isArguments`.
1076
+ *
1077
+ * @private
1078
+ * @param {*} value The value to check.
1079
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1080
+ */
1081
+ function baseIsArguments(value) {
1082
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
1083
+ }
1084
+
1085
+ /**
1086
+ * The base implementation of `_.isEqual` which supports partial comparisons
1087
+ * and tracks traversed objects.
1088
+ *
1089
+ * @private
1090
+ * @param {*} value The value to compare.
1091
+ * @param {*} other The other value to compare.
1092
+ * @param {boolean} bitmask The bitmask flags.
1093
+ * 1 - Unordered comparison
1094
+ * 2 - Partial comparison
1095
+ * @param {Function} [customizer] The function to customize comparisons.
1096
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1097
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1098
+ */
1099
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
1100
+ if (value === other) {
1101
+ return true;
1102
+ }
1103
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1104
+ return value !== value && other !== other;
1105
+ }
1106
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1107
+ }
1108
+
1109
+ /**
1110
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
1111
+ * deep comparisons and tracks traversed objects enabling objects with circular
1112
+ * references to be compared.
1113
+ *
1114
+ * @private
1115
+ * @param {Object} object The object to compare.
1116
+ * @param {Object} other The other object to compare.
1117
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1118
+ * @param {Function} customizer The function to customize comparisons.
1119
+ * @param {Function} equalFunc The function to determine equivalents of values.
1120
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1121
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1122
+ */
1123
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1124
+ var objIsArr = isArray(object),
1125
+ othIsArr = isArray(other),
1126
+ objTag = objIsArr ? arrayTag : getTag(object),
1127
+ othTag = othIsArr ? arrayTag : getTag(other);
1128
+
1129
+ objTag = objTag == argsTag ? objectTag : objTag;
1130
+ othTag = othTag == argsTag ? objectTag : othTag;
1131
+
1132
+ var objIsObj = objTag == objectTag,
1133
+ othIsObj = othTag == objectTag,
1134
+ isSameTag = objTag == othTag;
1135
+
1136
+ if (isSameTag && isBuffer(object)) {
1137
+ if (!isBuffer(other)) {
1138
+ return false;
1139
+ }
1140
+ objIsArr = true;
1141
+ objIsObj = false;
1142
+ }
1143
+ if (isSameTag && !objIsObj) {
1144
+ stack || (stack = new Stack);
1145
+ return (objIsArr || isTypedArray(object))
1146
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1147
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1148
+ }
1149
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1150
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1151
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1152
+
1153
+ if (objIsWrapped || othIsWrapped) {
1154
+ var objUnwrapped = objIsWrapped ? object.value() : object,
1155
+ othUnwrapped = othIsWrapped ? other.value() : other;
1156
+
1157
+ stack || (stack = new Stack);
1158
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1159
+ }
1160
+ }
1161
+ if (!isSameTag) {
1162
+ return false;
1163
+ }
1164
+ stack || (stack = new Stack);
1165
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1166
+ }
1167
+
1168
+ /**
1169
+ * The base implementation of `_.isNative` without bad shim checks.
1170
+ *
1171
+ * @private
1172
+ * @param {*} value The value to check.
1173
+ * @returns {boolean} Returns `true` if `value` is a native function,
1174
+ * else `false`.
1175
+ */
1176
+ function baseIsNative(value) {
1177
+ if (!isObject(value) || isMasked(value)) {
1178
+ return false;
1179
+ }
1180
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1181
+ return pattern.test(toSource(value));
1182
+ }
1183
+
1184
+ /**
1185
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
1186
+ *
1187
+ * @private
1188
+ * @param {*} value The value to check.
1189
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1190
+ */
1191
+ function baseIsTypedArray(value) {
1192
+ return isObjectLike(value) &&
1193
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1194
+ }
1195
+
1196
+ /**
1197
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1198
+ *
1199
+ * @private
1200
+ * @param {Object} object The object to query.
1201
+ * @returns {Array} Returns the array of property names.
1202
+ */
1203
+ function baseKeys(object) {
1204
+ if (!isPrototype(object)) {
1205
+ return nativeKeys(object);
1206
+ }
1207
+ var result = [];
1208
+ for (var key in Object(object)) {
1209
+ if (hasOwnProperty.call(object, key) && key != 'constructor') {
1210
+ result.push(key);
1211
+ }
1212
+ }
1213
+ return result;
1214
+ }
1215
+
1216
+ /**
1217
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
1218
+ * partial deep comparisons.
1219
+ *
1220
+ * @private
1221
+ * @param {Array} array The array to compare.
1222
+ * @param {Array} other The other array to compare.
1223
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1224
+ * @param {Function} customizer The function to customize comparisons.
1225
+ * @param {Function} equalFunc The function to determine equivalents of values.
1226
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
1227
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1228
+ */
1229
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1230
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1231
+ arrLength = array.length,
1232
+ othLength = other.length;
1233
+
1234
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1235
+ return false;
1236
+ }
1237
+ // Assume cyclic values are equal.
1238
+ var stacked = stack.get(array);
1239
+ if (stacked && stack.get(other)) {
1240
+ return stacked == other;
1241
+ }
1242
+ var index = -1,
1243
+ result = true,
1244
+ seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1245
+
1246
+ stack.set(array, other);
1247
+ stack.set(other, array);
1248
+
1249
+ // Ignore non-index properties.
1250
+ while (++index < arrLength) {
1251
+ var arrValue = array[index],
1252
+ othValue = other[index];
1253
+
1254
+ if (customizer) {
1255
+ var compared = isPartial
1256
+ ? customizer(othValue, arrValue, index, other, array, stack)
1257
+ : customizer(arrValue, othValue, index, array, other, stack);
1258
+ }
1259
+ if (compared !== undefined) {
1260
+ if (compared) {
1261
+ continue;
1262
+ }
1263
+ result = false;
1264
+ break;
1265
+ }
1266
+ // Recursively compare arrays (susceptible to call stack limits).
1267
+ if (seen) {
1268
+ if (!arraySome(other, function(othValue, othIndex) {
1269
+ if (!cacheHas(seen, othIndex) &&
1270
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1271
+ return seen.push(othIndex);
1272
+ }
1273
+ })) {
1274
+ result = false;
1275
+ break;
1276
+ }
1277
+ } else if (!(
1278
+ arrValue === othValue ||
1279
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
1280
+ )) {
1281
+ result = false;
1282
+ break;
1283
+ }
1284
+ }
1285
+ stack['delete'](array);
1286
+ stack['delete'](other);
1287
+ return result;
1288
+ }
1289
+
1290
+ /**
1291
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
1292
+ * the same `toStringTag`.
1293
+ *
1294
+ * **Note:** This function only supports comparing values with tags of
1295
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1296
+ *
1297
+ * @private
1298
+ * @param {Object} object The object to compare.
1299
+ * @param {Object} other The other object to compare.
1300
+ * @param {string} tag The `toStringTag` of the objects to compare.
1301
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1302
+ * @param {Function} customizer The function to customize comparisons.
1303
+ * @param {Function} equalFunc The function to determine equivalents of values.
1304
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1305
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1306
+ */
1307
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1308
+ switch (tag) {
1309
+ case dataViewTag:
1310
+ if ((object.byteLength != other.byteLength) ||
1311
+ (object.byteOffset != other.byteOffset)) {
1312
+ return false;
1313
+ }
1314
+ object = object.buffer;
1315
+ other = other.buffer;
1316
+
1317
+ case arrayBufferTag:
1318
+ if ((object.byteLength != other.byteLength) ||
1319
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1320
+ return false;
1321
+ }
1322
+ return true;
1323
+
1324
+ case boolTag:
1325
+ case dateTag:
1326
+ case numberTag:
1327
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
1328
+ // Invalid dates are coerced to `NaN`.
1329
+ return eq(+object, +other);
1330
+
1331
+ case errorTag:
1332
+ return object.name == other.name && object.message == other.message;
1333
+
1334
+ case regexpTag:
1335
+ case stringTag:
1336
+ // Coerce regexes to strings and treat strings, primitives and objects,
1337
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1338
+ // for more details.
1339
+ return object == (other + '');
1340
+
1341
+ case mapTag:
1342
+ var convert = mapToArray;
1343
+
1344
+ case setTag:
1345
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1346
+ convert || (convert = setToArray);
1347
+
1348
+ if (object.size != other.size && !isPartial) {
1349
+ return false;
1350
+ }
1351
+ // Assume cyclic values are equal.
1352
+ var stacked = stack.get(object);
1353
+ if (stacked) {
1354
+ return stacked == other;
1355
+ }
1356
+ bitmask |= COMPARE_UNORDERED_FLAG;
1357
+
1358
+ // Recursively compare objects (susceptible to call stack limits).
1359
+ stack.set(object, other);
1360
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1361
+ stack['delete'](object);
1362
+ return result;
1363
+
1364
+ case symbolTag:
1365
+ if (symbolValueOf) {
1366
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
1367
+ }
1368
+ }
1369
+ return false;
1370
+ }
1371
+
1372
+ /**
1373
+ * A specialized version of `baseIsEqualDeep` for objects with support for
1374
+ * partial deep comparisons.
1375
+ *
1376
+ * @private
1377
+ * @param {Object} object The object to compare.
1378
+ * @param {Object} other The other object to compare.
1379
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1380
+ * @param {Function} customizer The function to customize comparisons.
1381
+ * @param {Function} equalFunc The function to determine equivalents of values.
1382
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
1383
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1384
+ */
1385
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1386
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1387
+ objProps = getAllKeys(object),
1388
+ objLength = objProps.length,
1389
+ othProps = getAllKeys(other),
1390
+ othLength = othProps.length;
1391
+
1392
+ if (objLength != othLength && !isPartial) {
1393
+ return false;
1394
+ }
1395
+ var index = objLength;
1396
+ while (index--) {
1397
+ var key = objProps[index];
1398
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1399
+ return false;
1400
+ }
1401
+ }
1402
+ // Assume cyclic values are equal.
1403
+ var stacked = stack.get(object);
1404
+ if (stacked && stack.get(other)) {
1405
+ return stacked == other;
1406
+ }
1407
+ var result = true;
1408
+ stack.set(object, other);
1409
+ stack.set(other, object);
1410
+
1411
+ var skipCtor = isPartial;
1412
+ while (++index < objLength) {
1413
+ key = objProps[index];
1414
+ var objValue = object[key],
1415
+ othValue = other[key];
1416
+
1417
+ if (customizer) {
1418
+ var compared = isPartial
1419
+ ? customizer(othValue, objValue, key, other, object, stack)
1420
+ : customizer(objValue, othValue, key, object, other, stack);
1421
+ }
1422
+ // Recursively compare objects (susceptible to call stack limits).
1423
+ if (!(compared === undefined
1424
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1425
+ : compared
1426
+ )) {
1427
+ result = false;
1428
+ break;
1429
+ }
1430
+ skipCtor || (skipCtor = key == 'constructor');
1431
+ }
1432
+ if (result && !skipCtor) {
1433
+ var objCtor = object.constructor,
1434
+ othCtor = other.constructor;
1435
+
1436
+ // Non `Object` object instances with different constructors are not equal.
1437
+ if (objCtor != othCtor &&
1438
+ ('constructor' in object && 'constructor' in other) &&
1439
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1440
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1441
+ result = false;
1442
+ }
1443
+ }
1444
+ stack['delete'](object);
1445
+ stack['delete'](other);
1446
+ return result;
1447
+ }
1448
+
1449
+ /**
1450
+ * Creates an array of own enumerable property names and symbols of `object`.
1451
+ *
1452
+ * @private
1453
+ * @param {Object} object The object to query.
1454
+ * @returns {Array} Returns the array of property names and symbols.
1455
+ */
1456
+ function getAllKeys(object) {
1457
+ return baseGetAllKeys(object, keys, getSymbols);
1458
+ }
1459
+
1460
+ /**
1461
+ * Gets the data for `map`.
1462
+ *
1463
+ * @private
1464
+ * @param {Object} map The map to query.
1465
+ * @param {string} key The reference key.
1466
+ * @returns {*} Returns the map data.
1467
+ */
1468
+ function getMapData(map, key) {
1469
+ var data = map.__data__;
1470
+ return isKeyable(key)
1471
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1472
+ : data.map;
1473
+ }
1474
+
1475
+ /**
1476
+ * Gets the native function at `key` of `object`.
1477
+ *
1478
+ * @private
1479
+ * @param {Object} object The object to query.
1480
+ * @param {string} key The key of the method to get.
1481
+ * @returns {*} Returns the function if it's native, else `undefined`.
1482
+ */
1483
+ function getNative(object, key) {
1484
+ var value = getValue(object, key);
1485
+ return baseIsNative(value) ? value : undefined;
1486
+ }
1487
+
1488
+ /**
1489
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1490
+ *
1491
+ * @private
1492
+ * @param {*} value The value to query.
1493
+ * @returns {string} Returns the raw `toStringTag`.
1494
+ */
1495
+ function getRawTag(value) {
1496
+ var isOwn = hasOwnProperty.call(value, symToStringTag),
1497
+ tag = value[symToStringTag];
1498
+
1499
+ try {
1500
+ value[symToStringTag] = undefined;
1501
+ var unmasked = true;
1502
+ } catch (e) {}
1503
+
1504
+ var result = nativeObjectToString.call(value);
1505
+ if (unmasked) {
1506
+ if (isOwn) {
1507
+ value[symToStringTag] = tag;
1508
+ } else {
1509
+ delete value[symToStringTag];
1510
+ }
1511
+ }
1512
+ return result;
1513
+ }
1514
+
1515
+ /**
1516
+ * Creates an array of the own enumerable symbols of `object`.
1517
+ *
1518
+ * @private
1519
+ * @param {Object} object The object to query.
1520
+ * @returns {Array} Returns the array of symbols.
1521
+ */
1522
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1523
+ if (object == null) {
1524
+ return [];
1525
+ }
1526
+ object = Object(object);
1527
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
1528
+ return propertyIsEnumerable.call(object, symbol);
1529
+ });
1530
+ };
1531
+
1532
+ /**
1533
+ * Gets the `toStringTag` of `value`.
1534
+ *
1535
+ * @private
1536
+ * @param {*} value The value to query.
1537
+ * @returns {string} Returns the `toStringTag`.
1538
+ */
1539
+ var getTag = baseGetTag;
1540
+
1541
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1542
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1543
+ (Map && getTag(new Map) != mapTag) ||
1544
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
1545
+ (Set && getTag(new Set) != setTag) ||
1546
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1547
+ getTag = function(value) {
1548
+ var result = baseGetTag(value),
1549
+ Ctor = result == objectTag ? value.constructor : undefined,
1550
+ ctorString = Ctor ? toSource(Ctor) : '';
1551
+
1552
+ if (ctorString) {
1553
+ switch (ctorString) {
1554
+ case dataViewCtorString: return dataViewTag;
1555
+ case mapCtorString: return mapTag;
1556
+ case promiseCtorString: return promiseTag;
1557
+ case setCtorString: return setTag;
1558
+ case weakMapCtorString: return weakMapTag;
1559
+ }
1560
+ }
1561
+ return result;
1562
+ };
1563
+ }
1564
+
1565
+ /**
1566
+ * Checks if `value` is a valid array-like index.
1567
+ *
1568
+ * @private
1569
+ * @param {*} value The value to check.
1570
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1571
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1572
+ */
1573
+ function isIndex(value, length) {
1574
+ length = length == null ? MAX_SAFE_INTEGER : length;
1575
+ return !!length &&
1576
+ (typeof value == 'number' || reIsUint.test(value)) &&
1577
+ (value > -1 && value % 1 == 0 && value < length);
1578
+ }
1579
+
1580
+ /**
1581
+ * Checks if `value` is suitable for use as unique object key.
1582
+ *
1583
+ * @private
1584
+ * @param {*} value The value to check.
1585
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1586
+ */
1587
+ function isKeyable(value) {
1588
+ var type = typeof value;
1589
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1590
+ ? (value !== '__proto__')
1591
+ : (value === null);
1592
+ }
1593
+
1594
+ /**
1595
+ * Checks if `func` has its source masked.
1596
+ *
1597
+ * @private
1598
+ * @param {Function} func The function to check.
1599
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1600
+ */
1601
+ function isMasked(func) {
1602
+ return !!maskSrcKey && (maskSrcKey in func);
1603
+ }
1604
+
1605
+ /**
1606
+ * Checks if `value` is likely a prototype object.
1607
+ *
1608
+ * @private
1609
+ * @param {*} value The value to check.
1610
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1611
+ */
1612
+ function isPrototype(value) {
1613
+ var Ctor = value && value.constructor,
1614
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1615
+
1616
+ return value === proto;
1617
+ }
1618
+
1619
+ /**
1620
+ * Converts `value` to a string using `Object.prototype.toString`.
1621
+ *
1622
+ * @private
1623
+ * @param {*} value The value to convert.
1624
+ * @returns {string} Returns the converted string.
1625
+ */
1626
+ function objectToString(value) {
1627
+ return nativeObjectToString.call(value);
1628
+ }
1629
+
1630
+ /**
1631
+ * Converts `func` to its source code.
1632
+ *
1633
+ * @private
1634
+ * @param {Function} func The function to convert.
1635
+ * @returns {string} Returns the source code.
1636
+ */
1637
+ function toSource(func) {
1638
+ if (func != null) {
1639
+ try {
1640
+ return funcToString.call(func);
1641
+ } catch (e) {}
1642
+ try {
1643
+ return (func + '');
1644
+ } catch (e) {}
1645
+ }
1646
+ return '';
1647
+ }
1648
+
1649
+ /**
1650
+ * Performs a
1651
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1652
+ * comparison between two values to determine if they are equivalent.
1653
+ *
1654
+ * @static
1655
+ * @memberOf _
1656
+ * @since 4.0.0
1657
+ * @category Lang
1658
+ * @param {*} value The value to compare.
1659
+ * @param {*} other The other value to compare.
1660
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1661
+ * @example
1662
+ *
1663
+ * var object = { 'a': 1 };
1664
+ * var other = { 'a': 1 };
1665
+ *
1666
+ * _.eq(object, object);
1667
+ * // => true
1668
+ *
1669
+ * _.eq(object, other);
1670
+ * // => false
1671
+ *
1672
+ * _.eq('a', 'a');
1673
+ * // => true
1674
+ *
1675
+ * _.eq('a', Object('a'));
1676
+ * // => false
1677
+ *
1678
+ * _.eq(NaN, NaN);
1679
+ * // => true
1680
+ */
1681
+ function eq(value, other) {
1682
+ return value === other || (value !== value && other !== other);
1683
+ }
1684
+
1685
+ /**
1686
+ * Checks if `value` is likely an `arguments` object.
1687
+ *
1688
+ * @static
1689
+ * @memberOf _
1690
+ * @since 0.1.0
1691
+ * @category Lang
1692
+ * @param {*} value The value to check.
1693
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1694
+ * else `false`.
1695
+ * @example
1696
+ *
1697
+ * _.isArguments(function() { return arguments; }());
1698
+ * // => true
1699
+ *
1700
+ * _.isArguments([1, 2, 3]);
1701
+ * // => false
1702
+ */
1703
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1704
+ return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1705
+ !propertyIsEnumerable.call(value, 'callee');
1706
+ };
1707
+
1708
+ /**
1709
+ * Checks if `value` is classified as an `Array` object.
1710
+ *
1711
+ * @static
1712
+ * @memberOf _
1713
+ * @since 0.1.0
1714
+ * @category Lang
1715
+ * @param {*} value The value to check.
1716
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1717
+ * @example
1718
+ *
1719
+ * _.isArray([1, 2, 3]);
1720
+ * // => true
1721
+ *
1722
+ * _.isArray(document.body.children);
1723
+ * // => false
1724
+ *
1725
+ * _.isArray('abc');
1726
+ * // => false
1727
+ *
1728
+ * _.isArray(_.noop);
1729
+ * // => false
1730
+ */
1731
+ var isArray = Array.isArray;
1732
+
1733
+ /**
1734
+ * Checks if `value` is array-like. A value is considered array-like if it's
1735
+ * not a function and has a `value.length` that's an integer greater than or
1736
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1737
+ *
1738
+ * @static
1739
+ * @memberOf _
1740
+ * @since 4.0.0
1741
+ * @category Lang
1742
+ * @param {*} value The value to check.
1743
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1744
+ * @example
1745
+ *
1746
+ * _.isArrayLike([1, 2, 3]);
1747
+ * // => true
1748
+ *
1749
+ * _.isArrayLike(document.body.children);
1750
+ * // => true
1751
+ *
1752
+ * _.isArrayLike('abc');
1753
+ * // => true
1754
+ *
1755
+ * _.isArrayLike(_.noop);
1756
+ * // => false
1757
+ */
1758
+ function isArrayLike(value) {
1759
+ return value != null && isLength(value.length) && !isFunction(value);
1760
+ }
1761
+
1762
+ /**
1763
+ * Checks if `value` is a buffer.
1764
+ *
1765
+ * @static
1766
+ * @memberOf _
1767
+ * @since 4.3.0
1768
+ * @category Lang
1769
+ * @param {*} value The value to check.
1770
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1771
+ * @example
1772
+ *
1773
+ * _.isBuffer(new Buffer(2));
1774
+ * // => true
1775
+ *
1776
+ * _.isBuffer(new Uint8Array(2));
1777
+ * // => false
1778
+ */
1779
+ var isBuffer = nativeIsBuffer || stubFalse;
1780
+
1781
+ /**
1782
+ * Performs a deep comparison between two values to determine if they are
1783
+ * equivalent.
1784
+ *
1785
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
1786
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
1787
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
1788
+ * by their own, not inherited, enumerable properties. Functions and DOM
1789
+ * nodes are compared by strict equality, i.e. `===`.
1790
+ *
1791
+ * @static
1792
+ * @memberOf _
1793
+ * @since 0.1.0
1794
+ * @category Lang
1795
+ * @param {*} value The value to compare.
1796
+ * @param {*} other The other value to compare.
1797
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1798
+ * @example
1799
+ *
1800
+ * var object = { 'a': 1 };
1801
+ * var other = { 'a': 1 };
1802
+ *
1803
+ * _.isEqual(object, other);
1804
+ * // => true
1805
+ *
1806
+ * object === other;
1807
+ * // => false
1808
+ */
1809
+ function isEqual(value, other) {
1810
+ return baseIsEqual(value, other);
1811
+ }
1812
+
1813
+ /**
1814
+ * Checks if `value` is classified as a `Function` object.
1815
+ *
1816
+ * @static
1817
+ * @memberOf _
1818
+ * @since 0.1.0
1819
+ * @category Lang
1820
+ * @param {*} value The value to check.
1821
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1822
+ * @example
1823
+ *
1824
+ * _.isFunction(_);
1825
+ * // => true
1826
+ *
1827
+ * _.isFunction(/abc/);
1828
+ * // => false
1829
+ */
1830
+ function isFunction(value) {
1831
+ if (!isObject(value)) {
1832
+ return false;
1833
+ }
1834
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1835
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1836
+ var tag = baseGetTag(value);
1837
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1838
+ }
1839
+
1840
+ /**
1841
+ * Checks if `value` is a valid array-like length.
1842
+ *
1843
+ * **Note:** This method is loosely based on
1844
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1845
+ *
1846
+ * @static
1847
+ * @memberOf _
1848
+ * @since 4.0.0
1849
+ * @category Lang
1850
+ * @param {*} value The value to check.
1851
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1852
+ * @example
1853
+ *
1854
+ * _.isLength(3);
1855
+ * // => true
1856
+ *
1857
+ * _.isLength(Number.MIN_VALUE);
1858
+ * // => false
1859
+ *
1860
+ * _.isLength(Infinity);
1861
+ * // => false
1862
+ *
1863
+ * _.isLength('3');
1864
+ * // => false
1865
+ */
1866
+ function isLength(value) {
1867
+ return typeof value == 'number' &&
1868
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1869
+ }
1870
+
1871
+ /**
1872
+ * Checks if `value` is the
1873
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1874
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1875
+ *
1876
+ * @static
1877
+ * @memberOf _
1878
+ * @since 0.1.0
1879
+ * @category Lang
1880
+ * @param {*} value The value to check.
1881
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1882
+ * @example
1883
+ *
1884
+ * _.isObject({});
1885
+ * // => true
1886
+ *
1887
+ * _.isObject([1, 2, 3]);
1888
+ * // => true
1889
+ *
1890
+ * _.isObject(_.noop);
1891
+ * // => true
1892
+ *
1893
+ * _.isObject(null);
1894
+ * // => false
1895
+ */
1896
+ function isObject(value) {
1897
+ var type = typeof value;
1898
+ return value != null && (type == 'object' || type == 'function');
1899
+ }
1900
+
1901
+ /**
1902
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1903
+ * and has a `typeof` result of "object".
1904
+ *
1905
+ * @static
1906
+ * @memberOf _
1907
+ * @since 4.0.0
1908
+ * @category Lang
1909
+ * @param {*} value The value to check.
1910
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1911
+ * @example
1912
+ *
1913
+ * _.isObjectLike({});
1914
+ * // => true
1915
+ *
1916
+ * _.isObjectLike([1, 2, 3]);
1917
+ * // => true
1918
+ *
1919
+ * _.isObjectLike(_.noop);
1920
+ * // => false
1921
+ *
1922
+ * _.isObjectLike(null);
1923
+ * // => false
1924
+ */
1925
+ function isObjectLike(value) {
1926
+ return value != null && typeof value == 'object';
1927
+ }
1928
+
1929
+ /**
1930
+ * Checks if `value` is classified as a typed array.
1931
+ *
1932
+ * @static
1933
+ * @memberOf _
1934
+ * @since 3.0.0
1935
+ * @category Lang
1936
+ * @param {*} value The value to check.
1937
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1938
+ * @example
1939
+ *
1940
+ * _.isTypedArray(new Uint8Array);
1941
+ * // => true
1942
+ *
1943
+ * _.isTypedArray([]);
1944
+ * // => false
1945
+ */
1946
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1947
+
1948
+ /**
1949
+ * Creates an array of the own enumerable property names of `object`.
1950
+ *
1951
+ * **Note:** Non-object values are coerced to objects. See the
1952
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1953
+ * for more details.
1954
+ *
1955
+ * @static
1956
+ * @since 0.1.0
1957
+ * @memberOf _
1958
+ * @category Object
1959
+ * @param {Object} object The object to query.
1960
+ * @returns {Array} Returns the array of property names.
1961
+ * @example
1962
+ *
1963
+ * function Foo() {
1964
+ * this.a = 1;
1965
+ * this.b = 2;
1966
+ * }
1967
+ *
1968
+ * Foo.prototype.c = 3;
1969
+ *
1970
+ * _.keys(new Foo);
1971
+ * // => ['a', 'b'] (iteration order is not guaranteed)
1972
+ *
1973
+ * _.keys('hi');
1974
+ * // => ['0', '1']
1975
+ */
1976
+ function keys(object) {
1977
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1978
+ }
1979
+
1980
+ /**
1981
+ * This method returns a new empty array.
1982
+ *
1983
+ * @static
1984
+ * @memberOf _
1985
+ * @since 4.13.0
1986
+ * @category Util
1987
+ * @returns {Array} Returns the new empty array.
1988
+ * @example
1989
+ *
1990
+ * var arrays = _.times(2, _.stubArray);
1991
+ *
1992
+ * console.log(arrays);
1993
+ * // => [[], []]
1994
+ *
1995
+ * console.log(arrays[0] === arrays[1]);
1996
+ * // => false
1997
+ */
1998
+ function stubArray() {
1999
+ return [];
2000
+ }
2001
+
2002
+ /**
2003
+ * This method returns `false`.
2004
+ *
2005
+ * @static
2006
+ * @memberOf _
2007
+ * @since 4.13.0
2008
+ * @category Util
2009
+ * @returns {boolean} Returns `false`.
2010
+ * @example
2011
+ *
2012
+ * _.times(2, _.stubFalse);
2013
+ * // => [false, false]
2014
+ */
2015
+ function stubFalse() {
2016
+ return false;
2017
+ }
2018
+
2019
+ module.exports = isEqual;
2020
+ });
2021
+
2022
+ /**
2023
+ * lodash (Custom Build) <https://lodash.com/>
2024
+ * Build: `lodash modularize exports="npm" -o ./`
2025
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
2026
+ * Released under MIT license <https://lodash.com/license>
2027
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
2028
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2029
+ */
2030
+
2031
+ /** Used as references for various `Number` constants. */
2032
+ var INFINITY = 1 / 0,
2033
+ MAX_SAFE_INTEGER = 9007199254740991;
2034
+
2035
+ /** `Object#toString` result references. */
2036
+ var argsTag = '[object Arguments]',
2037
+ funcTag = '[object Function]',
2038
+ genTag = '[object GeneratorFunction]',
2039
+ symbolTag = '[object Symbol]';
2040
+
2041
+ /** Detect free variable `global` from Node.js. */
2042
+ var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2043
+
2044
+ /** Detect free variable `self`. */
2045
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
2046
+
2047
+ /** Used as a reference to the global object. */
2048
+ var root = freeGlobal || freeSelf || Function('return this')();
2049
+
2050
+ /**
2051
+ * A faster alternative to `Function#apply`, this function invokes `func`
2052
+ * with the `this` binding of `thisArg` and the arguments of `args`.
2053
+ *
2054
+ * @private
2055
+ * @param {Function} func The function to invoke.
2056
+ * @param {*} thisArg The `this` binding of `func`.
2057
+ * @param {Array} args The arguments to invoke `func` with.
2058
+ * @returns {*} Returns the result of `func`.
2059
+ */
2060
+ function apply(func, thisArg, args) {
2061
+ switch (args.length) {
2062
+ case 0: return func.call(thisArg);
2063
+ case 1: return func.call(thisArg, args[0]);
2064
+ case 2: return func.call(thisArg, args[0], args[1]);
2065
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
2066
+ }
2067
+ return func.apply(thisArg, args);
2068
+ }
2069
+
2070
+ /**
2071
+ * A specialized version of `_.map` for arrays without support for iteratee
2072
+ * shorthands.
2073
+ *
2074
+ * @private
2075
+ * @param {Array} [array] The array to iterate over.
2076
+ * @param {Function} iteratee The function invoked per iteration.
2077
+ * @returns {Array} Returns the new mapped array.
2078
+ */
2079
+ function arrayMap(array, iteratee) {
2080
+ var index = -1,
2081
+ length = array ? array.length : 0,
2082
+ result = Array(length);
2083
+
2084
+ while (++index < length) {
2085
+ result[index] = iteratee(array[index], index, array);
2086
+ }
2087
+ return result;
2088
+ }
2089
+
2090
+ /**
2091
+ * Appends the elements of `values` to `array`.
2092
+ *
2093
+ * @private
2094
+ * @param {Array} array The array to modify.
2095
+ * @param {Array} values The values to append.
2096
+ * @returns {Array} Returns `array`.
2097
+ */
2098
+ function arrayPush(array, values) {
2099
+ var index = -1,
2100
+ length = values.length,
2101
+ offset = array.length;
2102
+
2103
+ while (++index < length) {
2104
+ array[offset + index] = values[index];
2105
+ }
2106
+ return array;
2107
+ }
2108
+
2109
+ /** Used for built-in method references. */
2110
+ var objectProto = Object.prototype;
2111
+
2112
+ /** Used to check objects for own properties. */
2113
+ var hasOwnProperty = objectProto.hasOwnProperty;
2114
+
2115
+ /**
2116
+ * Used to resolve the
2117
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2118
+ * of values.
2119
+ */
2120
+ var objectToString = objectProto.toString;
2121
+
2122
+ /** Built-in value references. */
2123
+ var Symbol = root.Symbol,
2124
+ propertyIsEnumerable = objectProto.propertyIsEnumerable,
2125
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
2126
+
2127
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2128
+ var nativeMax = Math.max;
2129
+
2130
+ /**
2131
+ * The base implementation of `_.flatten` with support for restricting flattening.
2132
+ *
2133
+ * @private
2134
+ * @param {Array} array The array to flatten.
2135
+ * @param {number} depth The maximum recursion depth.
2136
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2137
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2138
+ * @param {Array} [result=[]] The initial result value.
2139
+ * @returns {Array} Returns the new flattened array.
2140
+ */
2141
+ function baseFlatten(array, depth, predicate, isStrict, result) {
2142
+ var index = -1,
2143
+ length = array.length;
2144
+
2145
+ predicate || (predicate = isFlattenable);
2146
+ result || (result = []);
2147
+
2148
+ while (++index < length) {
2149
+ var value = array[index];
2150
+ if (depth > 0 && predicate(value)) {
2151
+ if (depth > 1) {
2152
+ // Recursively flatten arrays (susceptible to call stack limits).
2153
+ baseFlatten(value, depth - 1, predicate, isStrict, result);
2154
+ } else {
2155
+ arrayPush(result, value);
2156
+ }
2157
+ } else if (!isStrict) {
2158
+ result[result.length] = value;
2159
+ }
2160
+ }
2161
+ return result;
2162
+ }
2163
+
2164
+ /**
2165
+ * The base implementation of `_.pick` without support for individual
2166
+ * property identifiers.
2167
+ *
2168
+ * @private
2169
+ * @param {Object} object The source object.
2170
+ * @param {string[]} props The property identifiers to pick.
2171
+ * @returns {Object} Returns the new object.
2172
+ */
2173
+ function basePick(object, props) {
2174
+ object = Object(object);
2175
+ return basePickBy(object, props, function(value, key) {
2176
+ return key in object;
2177
+ });
2178
+ }
2179
+
2180
+ /**
2181
+ * The base implementation of `_.pickBy` without support for iteratee shorthands.
2182
+ *
2183
+ * @private
2184
+ * @param {Object} object The source object.
2185
+ * @param {string[]} props The property identifiers to pick from.
2186
+ * @param {Function} predicate The function invoked per property.
2187
+ * @returns {Object} Returns the new object.
2188
+ */
2189
+ function basePickBy(object, props, predicate) {
2190
+ var index = -1,
2191
+ length = props.length,
2192
+ result = {};
2193
+
2194
+ while (++index < length) {
2195
+ var key = props[index],
2196
+ value = object[key];
2197
+
2198
+ if (predicate(value, key)) {
2199
+ result[key] = value;
2200
+ }
2201
+ }
2202
+ return result;
2203
+ }
2204
+
2205
+ /**
2206
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
2207
+ *
2208
+ * @private
2209
+ * @param {Function} func The function to apply a rest parameter to.
2210
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
2211
+ * @returns {Function} Returns the new function.
2212
+ */
2213
+ function baseRest(func, start) {
2214
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
2215
+ return function() {
2216
+ var args = arguments,
2217
+ index = -1,
2218
+ length = nativeMax(args.length - start, 0),
2219
+ array = Array(length);
2220
+
2221
+ while (++index < length) {
2222
+ array[index] = args[start + index];
2223
+ }
2224
+ index = -1;
2225
+ var otherArgs = Array(start + 1);
2226
+ while (++index < start) {
2227
+ otherArgs[index] = args[index];
2228
+ }
2229
+ otherArgs[start] = array;
2230
+ return apply(func, this, otherArgs);
2231
+ };
2232
+ }
2233
+
2234
+ /**
2235
+ * Checks if `value` is a flattenable `arguments` object or array.
2236
+ *
2237
+ * @private
2238
+ * @param {*} value The value to check.
2239
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
2240
+ */
2241
+ function isFlattenable(value) {
2242
+ return isArray(value) || isArguments(value) ||
2243
+ !!(spreadableSymbol && value && value[spreadableSymbol]);
2244
+ }
2245
+
2246
+ /**
2247
+ * Converts `value` to a string key if it's not a string or symbol.
2248
+ *
2249
+ * @private
2250
+ * @param {*} value The value to inspect.
2251
+ * @returns {string|symbol} Returns the key.
2252
+ */
2253
+ function toKey(value) {
2254
+ if (typeof value == 'string' || isSymbol(value)) {
2255
+ return value;
2256
+ }
2257
+ var result = (value + '');
2258
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
2259
+ }
2260
+
2261
+ /**
2262
+ * Checks if `value` is likely an `arguments` object.
2263
+ *
2264
+ * @static
2265
+ * @memberOf _
2266
+ * @since 0.1.0
2267
+ * @category Lang
2268
+ * @param {*} value The value to check.
2269
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2270
+ * else `false`.
2271
+ * @example
2272
+ *
2273
+ * _.isArguments(function() { return arguments; }());
2274
+ * // => true
2275
+ *
2276
+ * _.isArguments([1, 2, 3]);
2277
+ * // => false
2278
+ */
2279
+ function isArguments(value) {
2280
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
2281
+ return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
2282
+ (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
2283
+ }
2284
+
2285
+ /**
2286
+ * Checks if `value` is classified as an `Array` object.
2287
+ *
2288
+ * @static
2289
+ * @memberOf _
2290
+ * @since 0.1.0
2291
+ * @category Lang
2292
+ * @param {*} value The value to check.
2293
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
2294
+ * @example
2295
+ *
2296
+ * _.isArray([1, 2, 3]);
2297
+ * // => true
2298
+ *
2299
+ * _.isArray(document.body.children);
2300
+ * // => false
2301
+ *
2302
+ * _.isArray('abc');
2303
+ * // => false
2304
+ *
2305
+ * _.isArray(_.noop);
2306
+ * // => false
2307
+ */
2308
+ var isArray = Array.isArray;
2309
+
2310
+ /**
2311
+ * Checks if `value` is array-like. A value is considered array-like if it's
2312
+ * not a function and has a `value.length` that's an integer greater than or
2313
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2314
+ *
2315
+ * @static
2316
+ * @memberOf _
2317
+ * @since 4.0.0
2318
+ * @category Lang
2319
+ * @param {*} value The value to check.
2320
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2321
+ * @example
2322
+ *
2323
+ * _.isArrayLike([1, 2, 3]);
2324
+ * // => true
2325
+ *
2326
+ * _.isArrayLike(document.body.children);
2327
+ * // => true
2328
+ *
2329
+ * _.isArrayLike('abc');
2330
+ * // => true
2331
+ *
2332
+ * _.isArrayLike(_.noop);
2333
+ * // => false
2334
+ */
2335
+ function isArrayLike(value) {
2336
+ return value != null && isLength(value.length) && !isFunction(value);
2337
+ }
2338
+
2339
+ /**
2340
+ * This method is like `_.isArrayLike` except that it also checks if `value`
2341
+ * is an object.
2342
+ *
2343
+ * @static
2344
+ * @memberOf _
2345
+ * @since 4.0.0
2346
+ * @category Lang
2347
+ * @param {*} value The value to check.
2348
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
2349
+ * else `false`.
2350
+ * @example
2351
+ *
2352
+ * _.isArrayLikeObject([1, 2, 3]);
2353
+ * // => true
2354
+ *
2355
+ * _.isArrayLikeObject(document.body.children);
2356
+ * // => true
2357
+ *
2358
+ * _.isArrayLikeObject('abc');
2359
+ * // => false
2360
+ *
2361
+ * _.isArrayLikeObject(_.noop);
2362
+ * // => false
2363
+ */
2364
+ function isArrayLikeObject(value) {
2365
+ return isObjectLike(value) && isArrayLike(value);
2366
+ }
2367
+
2368
+ /**
2369
+ * Checks if `value` is classified as a `Function` object.
2370
+ *
2371
+ * @static
2372
+ * @memberOf _
2373
+ * @since 0.1.0
2374
+ * @category Lang
2375
+ * @param {*} value The value to check.
2376
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
2377
+ * @example
2378
+ *
2379
+ * _.isFunction(_);
2380
+ * // => true
2381
+ *
2382
+ * _.isFunction(/abc/);
2383
+ * // => false
2384
+ */
2385
+ function isFunction(value) {
2386
+ // The use of `Object#toString` avoids issues with the `typeof` operator
2387
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
2388
+ var tag = isObject(value) ? objectToString.call(value) : '';
2389
+ return tag == funcTag || tag == genTag;
2390
+ }
2391
+
2392
+ /**
2393
+ * Checks if `value` is a valid array-like length.
2394
+ *
2395
+ * **Note:** This method is loosely based on
2396
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2397
+ *
2398
+ * @static
2399
+ * @memberOf _
2400
+ * @since 4.0.0
2401
+ * @category Lang
2402
+ * @param {*} value The value to check.
2403
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2404
+ * @example
2405
+ *
2406
+ * _.isLength(3);
2407
+ * // => true
2408
+ *
2409
+ * _.isLength(Number.MIN_VALUE);
2410
+ * // => false
2411
+ *
2412
+ * _.isLength(Infinity);
2413
+ * // => false
2414
+ *
2415
+ * _.isLength('3');
2416
+ * // => false
2417
+ */
2418
+ function isLength(value) {
2419
+ return typeof value == 'number' &&
2420
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2421
+ }
2422
+
2423
+ /**
2424
+ * Checks if `value` is the
2425
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
2426
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
2427
+ *
2428
+ * @static
2429
+ * @memberOf _
2430
+ * @since 0.1.0
2431
+ * @category Lang
2432
+ * @param {*} value The value to check.
2433
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
2434
+ * @example
2435
+ *
2436
+ * _.isObject({});
2437
+ * // => true
2438
+ *
2439
+ * _.isObject([1, 2, 3]);
2440
+ * // => true
2441
+ *
2442
+ * _.isObject(_.noop);
2443
+ * // => true
2444
+ *
2445
+ * _.isObject(null);
2446
+ * // => false
2447
+ */
2448
+ function isObject(value) {
2449
+ var type = typeof value;
2450
+ return !!value && (type == 'object' || type == 'function');
2451
+ }
2452
+
2453
+ /**
2454
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
2455
+ * and has a `typeof` result of "object".
2456
+ *
2457
+ * @static
2458
+ * @memberOf _
2459
+ * @since 4.0.0
2460
+ * @category Lang
2461
+ * @param {*} value The value to check.
2462
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2463
+ * @example
2464
+ *
2465
+ * _.isObjectLike({});
2466
+ * // => true
2467
+ *
2468
+ * _.isObjectLike([1, 2, 3]);
2469
+ * // => true
2470
+ *
2471
+ * _.isObjectLike(_.noop);
2472
+ * // => false
2473
+ *
2474
+ * _.isObjectLike(null);
2475
+ * // => false
2476
+ */
2477
+ function isObjectLike(value) {
2478
+ return !!value && typeof value == 'object';
2479
+ }
2480
+
2481
+ /**
2482
+ * Checks if `value` is classified as a `Symbol` primitive or object.
2483
+ *
2484
+ * @static
2485
+ * @memberOf _
2486
+ * @since 4.0.0
2487
+ * @category Lang
2488
+ * @param {*} value The value to check.
2489
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
2490
+ * @example
2491
+ *
2492
+ * _.isSymbol(Symbol.iterator);
2493
+ * // => true
2494
+ *
2495
+ * _.isSymbol('abc');
2496
+ * // => false
2497
+ */
2498
+ function isSymbol(value) {
2499
+ return typeof value == 'symbol' ||
2500
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
2501
+ }
2502
+
2503
+ /**
2504
+ * Creates an object composed of the picked `object` properties.
2505
+ *
2506
+ * @static
2507
+ * @since 0.1.0
2508
+ * @memberOf _
2509
+ * @category Object
2510
+ * @param {Object} object The source object.
2511
+ * @param {...(string|string[])} [props] The property identifiers to pick.
2512
+ * @returns {Object} Returns the new object.
2513
+ * @example
2514
+ *
2515
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
2516
+ *
2517
+ * _.pick(object, ['a', 'c']);
2518
+ * // => { 'a': 1, 'c': 3 }
2519
+ */
2520
+ var pick = baseRest(function(object, props) {
2521
+ return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
2522
+ });
2523
+
2524
+ var lodash_pick = pick;
2525
+
2526
+ function getUserProfile() {
2527
+ return request.get({ path: '/admin/self' });
2528
+ }
134
2529
  /** Blog Posts */
135
2530
  function getBlogPostList(params) {
136
2531
  return request.get({ path: '/admin/blog/posts', params });
@@ -141,6 +2536,9 @@ function getBlogPostCount() {
141
2536
  function getBlogPost(postId) {
142
2537
  return request.get({ path: `/admin/blog/posts/${postId}` });
143
2538
  }
2539
+ function clonePost(postId) {
2540
+ return request.post({ path: `/admin/blog/posts/${postId}/clone` });
2541
+ }
144
2542
  function createBlogPost(payload) {
145
2543
  return request.post({ path: '/admin/blog/posts', body: payload });
146
2544
  }
@@ -151,8 +2549,8 @@ function deleteBlogPost(postId) {
151
2549
  return request.delete({ path: `/admin/blog/posts/${postId}` });
152
2550
  }
153
2551
  /** Blog Categories */
154
- function getBlogCategoryList() {
155
- return request.get({ path: '/admin/blog/categories' });
2552
+ function getBlogCategoryList(params) {
2553
+ return request.get({ path: '/admin/blog/categories', params });
156
2554
  }
157
2555
  function getBlogCategory(categoryId) {
158
2556
  return request.get({ path: `/admin/blog/categories/${categoryId}` });
@@ -180,17 +2578,6 @@ function getBlogModuleConfig() {
180
2578
  return request.get({
181
2579
  path: `/admin/blog/module-info`,
182
2580
  });
183
- }
184
- function getBlogSettingList() {
185
- return request.get({
186
- path: `/admin/blog/settings`,
187
- });
188
- }
189
- function updateBlogSettingList(payload) {
190
- return request.post({
191
- path: `/admin/blog/settings`,
192
- body: payload,
193
- });
194
2581
  }
195
2582
 
196
2583
  const BLOG_ROUTE_PATHS = {
@@ -198,7 +2585,6 @@ const BLOG_ROUTE_PATHS = {
198
2585
  POST_FORM: '/blog/posts/:postId',
199
2586
  CATEGORY_LIST: '/blog/categories',
200
2587
  CATEGORY_FORM: '/blog/categories/:categoryId',
201
- SETTINGS: '/blog/settings',
202
2588
  };
203
2589
  function getBlogPostListUrl() {
204
2590
  return BLOG_ROUTE_PATHS.POST_LIST;
@@ -213,46 +2599,170 @@ function getBlogCategoryFormUrl(params) {
213
2599
  return compile(BLOG_ROUTE_PATHS.CATEGORY_FORM)({
214
2600
  categoryId: params.categoryId,
215
2601
  });
216
- }
217
- function getBlogSettingsUrl() {
218
- return BLOG_ROUTE_PATHS.SETTINGS;
219
2602
  }
220
2603
 
221
- function useModuleConfig(params) {
222
- const [fetchModuleConfig, resource] = useResource({
223
- fetchResource: getBlogModuleConfig,
224
- initialValue: null,
225
- context: params.context,
226
- resourceName: 'Module configuration',
227
- });
228
- onMounted(() => {
229
- fetchModuleConfig();
230
- });
231
- return resource;
2604
+ function useModuleConfig(params) {
2605
+ const [fetchModuleConfig, resource] = useResource({
2606
+ fetchResource: getBlogModuleConfig,
2607
+ initialValue: null,
2608
+ context: params.context,
2609
+ resourceName: 'Module configuration',
2610
+ });
2611
+ onMounted(() => {
2612
+ fetchModuleConfig();
2613
+ });
2614
+ return resource;
2615
+ }
2616
+
2617
+ function useBlogPostList(params) {
2618
+ const [fetchBlogPostList, resource] = useResource({
2619
+ fetchResource: () => getBlogPostList({ pageNumber: 1, pageSize: 99999 }),
2620
+ initialValue: [],
2621
+ context: params.context,
2622
+ resourceName: 'Blog post list',
2623
+ });
2624
+ onMounted(() => {
2625
+ fetchBlogPostList();
2626
+ });
2627
+ return resource;
2628
+ }
2629
+
2630
+ function useBlogCategoryList(params) {
2631
+ const [fetchBlogCategoryList, resource] = useResource({
2632
+ fetchResource: getBlogCategoryList,
2633
+ initialValue: [],
2634
+ context: params.context,
2635
+ resourceName: 'Blog category list',
2636
+ });
2637
+ onMounted(() => {
2638
+ fetchBlogCategoryList();
2639
+ });
2640
+ return resource;
2641
+ }
2642
+
2643
+ function useStore(context) {
2644
+ return context.root.$store;
2645
+ }
2646
+
2647
+ const Scope = {
2648
+ All: '*',
2649
+ OrdersCreate: 'orders.create',
2650
+ OrdersView: 'orders.view',
2651
+ OrdersDelete: 'orders.delete',
2652
+ RbacViewRoles: 'rbac.view-roles',
2653
+ RbacEditRoles: 'rbac.edit-roles',
2654
+ AdministratorsView: 'administrators.view',
2655
+ AdministratorsEdit: 'administrators.edit',
2656
+ AdministratorsDelete: 'administrators.delete',
2657
+ };
2658
+
2659
+ const USER_MODULE_NAMESPACE = 'user';
2660
+ const USER_MUTATION_TYPES = {
2661
+ PROFILE_REQUEST_STARTED: 'profileRequestStarted',
2662
+ PROFILE_REQUEST_FULFILLED: 'profileRequestFulfilled',
2663
+ PROFILE_REQUEST_REJECTED: 'profileRequestRejected',
2664
+ };
2665
+ const USER_ACTION_TYPES = {
2666
+ FETCH_USER_PROFILE: 'fetchUserProfile',
2667
+ };
2668
+ const userGetters = {
2669
+ userProfile(state) {
2670
+ return state.profile;
2671
+ },
2672
+ userScopes(state) {
2673
+ const roles = state.profile ? state.profile.roles : [];
2674
+ const scopes = [];
2675
+ roles.forEach((role) => {
2676
+ scopes.push(...role.scopes);
2677
+ });
2678
+ return scopes;
2679
+ },
2680
+ userHasPermission: (state, getters) => (scope) => {
2681
+ const scopes = getters.userScopes;
2682
+ if (scopes.includes(Scope.All))
2683
+ return true;
2684
+ return scopes.includes(scope);
2685
+ },
2686
+ };
2687
+ const userModule = {
2688
+ namespaced: true,
2689
+ state: {
2690
+ profile: null,
2691
+ status: FETCH_STATUSES.IDLE,
2692
+ },
2693
+ mutations: {
2694
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED](state) {
2695
+ if (state.status === FETCH_STATUSES.IDLE) {
2696
+ state.status = FETCH_STATUSES.LOADING;
2697
+ }
2698
+ },
2699
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED](state, user) {
2700
+ if (state.status === FETCH_STATUSES.LOADING) {
2701
+ state.status = FETCH_STATUSES.SUCCESS;
2702
+ state.profile = user;
2703
+ }
2704
+ },
2705
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED](state) {
2706
+ if (state.status === FETCH_STATUSES.LOADING) {
2707
+ state.status = FETCH_STATUSES.FAILURE;
2708
+ state.profile = null;
2709
+ }
2710
+ },
2711
+ },
2712
+ actions: {
2713
+ [USER_ACTION_TYPES.FETCH_USER_PROFILE](store) {
2714
+ if (store.state.status !== FETCH_STATUSES.IDLE)
2715
+ return;
2716
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED);
2717
+ getUserProfile()
2718
+ .then((response) => {
2719
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED, response.data);
2720
+ })
2721
+ .catch((error) => {
2722
+ console.error(error);
2723
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED);
2724
+ });
2725
+ },
2726
+ },
2727
+ getters: userGetters,
2728
+ };
2729
+
2730
+ function namespace(namespace, name) {
2731
+ return `${namespace}/${name}`;
2732
+ }
2733
+ function userNamespace(name) {
2734
+ return namespace(USER_MODULE_NAMESPACE, name);
2735
+ }
2736
+ function generateNumberArray(length) {
2737
+ return Array.from({ length }, (_, index) => index);
2738
+ }
2739
+ function getNameWithDepth(name, depth) {
2740
+ return (generateNumberArray(depth)
2741
+ .map(() => '—')
2742
+ .join(' ') +
2743
+ ' ' +
2744
+ name);
232
2745
  }
233
2746
 
234
- function useBlogCategoryList(params) {
235
- const [fetchBlogCategoryList, resource] = useResource({
236
- fetchResource: getBlogCategoryList,
237
- initialValue: [],
238
- context: params.context,
239
- resourceName: 'Blog category list',
240
- });
241
- onMounted(() => {
242
- fetchBlogCategoryList();
2747
+ function useUserPermission(context, scope) {
2748
+ const store = useStore(context);
2749
+ return computed(() => {
2750
+ return store.getters[userNamespace('userHasPermission')](scope);
243
2751
  });
244
- return resource;
245
2752
  }
246
2753
 
247
2754
  function convertPostList(postList, selectedCategory, languages) {
248
2755
  return postList
249
2756
  .filter((post) => selectedCategory
250
- ? post.categories.some((category) => category.id === selectedCategory.id)
2757
+ ? post.categories.some(({ id }) => id === selectedCategory.id)
251
2758
  : true)
252
2759
  .map((post) => {
253
2760
  if (languages.length > 0) {
254
- const foundLanguage = languages.find((lang) => post.language === lang.id);
255
- return Object.assign(Object.assign({}, post), { language: foundLanguage ? foundLanguage.name : post.language });
2761
+ const foundLanguage = languages.find(({ id }) => id === post.language);
2762
+ return {
2763
+ ...post,
2764
+ language: foundLanguage ? foundLanguage.name : post.language,
2765
+ };
256
2766
  }
257
2767
  return post;
258
2768
  });
@@ -317,53 +2827,217 @@ function getPostTableColumnDefs(moduleConfig, t) {
317
2827
  return COLUMN_DEFS.filter(notEmpty);
318
2828
  }
319
2829
 
2830
+ var FilterTypes;
2831
+ (function (FilterTypes) {
2832
+ FilterTypes["CATEGORY"] = "category";
2833
+ FilterTypes["LANGUAGE"] = "language";
2834
+ FilterTypes["FROM_DATE"] = "from-date";
2835
+ FilterTypes["TO_DATE"] = "to-date";
2836
+ })(FilterTypes || (FilterTypes = {}));
2837
+ const dateFormat = (date) => date.split('-').reverse().join('.');
2838
+ function useAdvancedSearch({ context, categoryList, languageList, }) {
2839
+ /** Category **/
2840
+ const categoryOptionList = computed(() => categoryList.value.map(({ id, name, depth }) => ({
2841
+ value: String(id),
2842
+ label: getNameWithDepth(name, depth),
2843
+ })));
2844
+ const initialCategoryFilter = computed(() => {
2845
+ const queryValue = getFilterParamAsStringArray(context.root.$route.query, FilterTypes.CATEGORY);
2846
+ return categoryOptionList.value.filter(({ value }) => queryValue.some((selected) => selected === value));
2847
+ });
2848
+ const categoryFilter = ref(initialCategoryFilter.value);
2849
+ watch(initialCategoryFilter, () => {
2850
+ categoryFilter.value = initialCategoryFilter.value;
2851
+ });
2852
+ /** Language **/
2853
+ const languageOptionList = computed(() => languageList.value.map(({ id, name }) => ({ value: id, label: name })));
2854
+ const initialLanguageFilter = computed(() => {
2855
+ const queryValue = getFilterParamAsStringArray(context.root.$route.query, FilterTypes.LANGUAGE);
2856
+ return languageOptionList.value.filter(({ value }) => queryValue.some((selected) => selected === value));
2857
+ });
2858
+ const languageFilter = ref(initialLanguageFilter.value);
2859
+ watch(initialLanguageFilter, () => {
2860
+ languageFilter.value = initialLanguageFilter.value;
2861
+ });
2862
+ /** From date **/
2863
+ const initialFromDateFilter = computed(() => getFilterParamAsString(context.root.$route.query, FilterTypes.FROM_DATE) ?? '');
2864
+ const fromDateFilter = ref(initialFromDateFilter.value);
2865
+ watch(initialFromDateFilter, () => {
2866
+ fromDateFilter.value = initialFromDateFilter.value;
2867
+ });
2868
+ /** To date **/
2869
+ const initialToDateFilter = computed(() => getFilterParamAsString(context.root.$route.query, FilterTypes.TO_DATE) ??
2870
+ '');
2871
+ const toDateFilter = ref(initialToDateFilter.value);
2872
+ watch(initialToDateFilter, () => {
2873
+ toDateFilter.value = initialToDateFilter.value;
2874
+ });
2875
+ /** Date **/
2876
+ const date = computed(() => {
2877
+ if (!fromDateFilter.value && !toDateFilter.value) {
2878
+ return null;
2879
+ }
2880
+ let label = '';
2881
+ if (fromDateFilter.value && toDateFilter.value) {
2882
+ label = `${dateFormat(fromDateFilter.value)} - ${dateFormat(toDateFilter.value)}`;
2883
+ }
2884
+ if (fromDateFilter.value && !toDateFilter.value) {
2885
+ label = `${context.root.$t('blog:from')} ${dateFormat(fromDateFilter.value)}`;
2886
+ }
2887
+ if (!fromDateFilter.value && toDateFilter.value) {
2888
+ label = `${context.root.$t('blog:to')} ${dateFormat(toDateFilter.value)}`;
2889
+ }
2890
+ return {
2891
+ value: '',
2892
+ label,
2893
+ name: FilterTypes.FROM_DATE,
2894
+ title: context.root.$t('blog:dateOfPublication'),
2895
+ };
2896
+ });
2897
+ /** Params **/
2898
+ const filterParams = computed(() => {
2899
+ const filters = {
2900
+ [FilterTypes.CATEGORY]: categoryFilter.value.map(({ value }) => value),
2901
+ [FilterTypes.LANGUAGE]: languageFilter.value.map(({ value }) => value),
2902
+ };
2903
+ if (fromDateFilter.value) {
2904
+ filters[FilterTypes.FROM_DATE] = fromDateFilter.value;
2905
+ }
2906
+ if (toDateFilter.value) {
2907
+ filters[FilterTypes.TO_DATE] = toDateFilter.value;
2908
+ }
2909
+ return getFilterParams(filters);
2910
+ });
2911
+ /** Tag removal handler **/
2912
+ function tagRemovalHandler(event) {
2913
+ if (event.name === FilterTypes.CATEGORY) {
2914
+ categoryFilter.value = categoryFilter.value.filter(({ value }) => value !== event.value);
2915
+ }
2916
+ if (event.name === FilterTypes.LANGUAGE) {
2917
+ languageFilter.value = languageFilter.value.filter(({ value }) => value !== event.value);
2918
+ }
2919
+ if (event.name === FilterTypes.FROM_DATE) {
2920
+ fromDateFilter.value = '';
2921
+ toDateFilter.value = '';
2922
+ }
2923
+ }
2924
+ /** Tags **/
2925
+ const tags = computed(() => [
2926
+ ...categoryFilter.value.map(({ value, label }) => ({
2927
+ value,
2928
+ label,
2929
+ name: FilterTypes.CATEGORY,
2930
+ title: context.root.$t('blog:category'),
2931
+ })),
2932
+ ...languageFilter.value.map(({ value, label }) => ({
2933
+ value,
2934
+ label,
2935
+ name: FilterTypes.LANGUAGE,
2936
+ title: context.root.$t('blog:language'),
2937
+ })),
2938
+ date.value,
2939
+ ].filter(isNotNullish));
2940
+ /** Helpers **/
2941
+ const selectedCategoryOptionList = computed(() => {
2942
+ if (languageFilter.value.length === 0) {
2943
+ return categoryOptionList.value;
2944
+ }
2945
+ const selectedList = categoryList.value.filter(({ language }) => languageFilter.value.some(({ value }) => value === language));
2946
+ return selectedList.map(({ id, name, depth }) => ({
2947
+ value: String(id),
2948
+ label: getNameWithDepth(name, depth),
2949
+ }));
2950
+ });
2951
+ return {
2952
+ categoryFilter,
2953
+ categoryOptionList: selectedCategoryOptionList,
2954
+ languageFilter,
2955
+ languageOptionList,
2956
+ fromDateFilter,
2957
+ toDateFilter,
2958
+ tagRemovalHandler,
2959
+ tags: tags,
2960
+ filterParams,
2961
+ };
2962
+ }
2963
+
320
2964
  var script = defineComponent({
321
2965
  name: 'BlogPostList',
322
2966
  setup(props, context) {
2967
+ const { t } = useTranslation(context);
2968
+ const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
323
2969
  const categoryId = computed(() => {
324
- var _a;
325
2970
  return Array.isArray(context.root.$route.query.category)
326
- ? (_a = context.root.$route.query.category[0]) !== null && _a !== void 0 ? _a : '' : context.root.$route.query.category;
2971
+ ? context.root.$route.query.category[0] ?? ''
2972
+ : context.root.$route.query.category;
327
2973
  });
328
2974
  /** Fetch module config */
329
2975
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
2976
+ const languageList = computed(() => moduleConfig.value?.languages ?? []);
330
2977
  /** Fetch category list */
331
2978
  const { data: categoryList, loading: isCategoryListLoading, } = useBlogCategoryList({ context });
332
- const selectedCategory = computed(() => {
333
- var _a;
334
- return categoryId.value
335
- ? (_a = categoryList.value.find((category) => String(category.id) === String(categoryId.value))) !== null && _a !== void 0 ? _a : null : null;
336
- });
2979
+ const selectedCategory = computed(() => categoryId.value
2980
+ ? categoryList.value.find(({ id }) => String(id) === String(categoryId.value)) ?? null
2981
+ : null);
337
2982
  const pageTitle = computed(() => {
338
2983
  return selectedCategory.value
339
2984
  ? `${context.root.$t('blog:postsByCategory')} "${selectedCategory.value.name}"`
340
2985
  : context.root.$t('blog:posts');
341
2986
  });
2987
+ /** Advanced search **/
2988
+ const { categoryFilter, categoryOptionList, languageFilter, languageOptionList, fromDateFilter, toDateFilter, filterParams, tags, tagRemovalHandler, } = useAdvancedSearch({
2989
+ context,
2990
+ categoryList,
2991
+ languageList,
2992
+ });
2993
+ const isLangSpecific = computed(() => languageOptionList.value.length > 1);
342
2994
  /** Fetch Post list */
343
2995
  const { fetchEntityList: fetchPostList, isLoading: isPostLoading, rowData: postList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = useDataTable({
344
2996
  fetchEntityList: (params) => getBlogPostList({
345
2997
  query: params.searchQuery,
346
2998
  pageNumber: params.pageNumber,
347
2999
  pageSize: params.pageSize,
3000
+ ...filterParams.value,
348
3001
  }),
349
3002
  initialValue: [],
350
3003
  context,
351
3004
  resourceName: 'Blog post list',
352
3005
  pageSize: 100,
353
3006
  });
354
- const displayedPostList = computed(() => {
355
- var _a, _b;
356
- return convertPostList(postList.value, selectedCategory.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []);
3007
+ watch(filterParams, () => {
3008
+ if (isModuleConfigLoading.value || isCategoryListLoading.value) {
3009
+ return;
3010
+ }
3011
+ const newQuery = {
3012
+ ...lodash_pick(context.root.$route.query, ['query', 'pageNumber']),
3013
+ ...filterParams.value,
3014
+ };
3015
+ if (!lodash_isequal(context.root.$route.query, newQuery)) {
3016
+ context.root.$router.replace({ query: newQuery });
3017
+ fetchPostList();
3018
+ }
357
3019
  });
358
- const { handleResourceDelete, isDeleting } = useResourceDelete({
3020
+ const displayedPostList = computed(() => convertPostList(postList.value, selectedCategory.value, moduleConfig.value?.languages ?? []));
3021
+ const isRowDataLoading = computed(() => isCategoryListLoading.value ||
3022
+ isPostLoading.value ||
3023
+ isModuleConfigLoading.value);
3024
+ const { isDeleting, handleResourceDelete } = useResourceDelete({
359
3025
  deleteResource: deleteBlogPost,
360
3026
  resourceName: 'Post',
361
3027
  onSuccess: fetchPostList,
362
3028
  context,
363
3029
  });
364
- const isRowDataLoading = computed(() => isCategoryListLoading.value ||
365
- isPostLoading.value ||
366
- isModuleConfigLoading.value);
3030
+ const { isCloning, handleResourceClone } = useResourceClone({
3031
+ cloneResource: clonePost,
3032
+ confirmMessage: t('blog:cloneConfirm'),
3033
+ successMessage: t('blog:cloneSuccess'),
3034
+ failureMessage: t('blog:cloneFailure'),
3035
+ onSuccessRedirectTo: (data) => `/posts/${data.id}`,
3036
+ context,
3037
+ });
3038
+ function isBusy(postId) {
3039
+ return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;
3040
+ }
367
3041
  const columnDefs = computed(() => getPostTableColumnDefs(moduleConfig.value, context.root.$t));
368
3042
  return {
369
3043
  columnDefs,
@@ -380,6 +3054,21 @@ var script = defineComponent({
380
3054
  pageNumber,
381
3055
  pageCount,
382
3056
  pageSize,
3057
+ // Advanced search
3058
+ categoryFilter,
3059
+ categoryOptionList,
3060
+ isLangSpecific,
3061
+ languageFilter,
3062
+ languageOptionList,
3063
+ fromDateFilter,
3064
+ toDateFilter,
3065
+ tags,
3066
+ tagRemovalHandler,
3067
+ // Permissions
3068
+ canViewAdministrators,
3069
+ // Clone
3070
+ handleResourceClone,
3071
+ isBusy,
383
3072
  };
384
3073
  },
385
3074
  });
@@ -524,11 +3213,13 @@ var __vue_render__ = function () {
524
3213
  attrs: {
525
3214
  title: _vm.pageTitle,
526
3215
  "header-buttons": [
527
- {
528
- text: _vm.$t("blog:newPost"),
529
- href: _vm.getBlogPostFormUrl({ postId: "create" }),
530
- },
531
- ],
3216
+ _vm.canViewAdministrators
3217
+ ? {
3218
+ text: _vm.$t("blog:newPost"),
3219
+ href: _vm.getBlogPostFormUrl({ postId: "create" }),
3220
+ }
3221
+ : null,
3222
+ ].filter(Boolean),
532
3223
  },
533
3224
  scopedSlots: _vm._u([
534
3225
  {
@@ -553,41 +3244,173 @@ var __vue_render__ = function () {
553
3244
  on: { change: _vm.handleChange },
554
3245
  scopedSlots: _vm._u([
555
3246
  {
556
- key: "cell(actions)",
557
- fn: function (ref) {
558
- var row = ref.row;
3247
+ key: "filters",
3248
+ fn: function () {
559
3249
  return [
560
3250
  _c(
561
- "base-button",
3251
+ "advanced-search",
562
3252
  {
563
- attrs: {
564
- variant: "icon",
565
- title: _vm.$t("blog:edit"),
566
- disabled: _vm.isDeleting(row.id),
567
- href: _vm.getBlogPostFormUrl({ postId: row.id }),
568
- },
3253
+ attrs: { tags: _vm.tags },
3254
+ on: { "click:tag": _vm.tagRemovalHandler },
569
3255
  },
570
- [_c("svg-icon", { attrs: { name: "edit" } })],
571
- 1
3256
+ [
3257
+ _c(
3258
+ "div",
3259
+ { staticClass: "filters" },
3260
+ [
3261
+ _c("form-field-multi-select", {
3262
+ staticClass: "filter",
3263
+ attrs: {
3264
+ options: _vm.categoryOptionList,
3265
+ name: "categoryFilter",
3266
+ searchable: true,
3267
+ label: _vm.$t("blog:category"),
3268
+ },
3269
+ model: {
3270
+ value: _vm.categoryFilter,
3271
+ callback: function ($$v) {
3272
+ _vm.categoryFilter = $$v;
3273
+ },
3274
+ expression: "categoryFilter",
3275
+ },
3276
+ }),
3277
+ _vm._v(" "),
3278
+ _vm.isLangSpecific
3279
+ ? _c("form-field-multi-select", {
3280
+ staticClass: "filter",
3281
+ attrs: {
3282
+ options: _vm.languageOptionList,
3283
+ name: "languageFilter",
3284
+ searchable: true,
3285
+ label: _vm.$t("blog:language"),
3286
+ },
3287
+ model: {
3288
+ value: _vm.languageFilter,
3289
+ callback: function ($$v) {
3290
+ _vm.languageFilter = $$v;
3291
+ },
3292
+ expression: "languageFilter",
3293
+ },
3294
+ })
3295
+ : _vm._e(),
3296
+ _vm._v(" "),
3297
+ _c("div", { staticClass: "filter" }, [
3298
+ _c("div", { staticClass: "date-label" }, [
3299
+ _vm._v(
3300
+ "\n " +
3301
+ _vm._s(_vm.$t("blog:dateOfPublication")) +
3302
+ "\n "
3303
+ ),
3304
+ ]),
3305
+ _vm._v(" "),
3306
+ _c(
3307
+ "div",
3308
+ { staticClass: "date-content" },
3309
+ [
3310
+ _c("form-field", {
3311
+ attrs: {
3312
+ label: _vm.$t("blog:From"),
3313
+ name: "fromDateFilter",
3314
+ type: "date",
3315
+ max: _vm.toDateFilter,
3316
+ },
3317
+ model: {
3318
+ value: _vm.fromDateFilter,
3319
+ callback: function ($$v) {
3320
+ _vm.fromDateFilter = $$v;
3321
+ },
3322
+ expression: "fromDateFilter",
3323
+ },
3324
+ }),
3325
+ _vm._v(" "),
3326
+ _c("form-field", {
3327
+ attrs: {
3328
+ label: _vm.$t("blog:To"),
3329
+ name: "toDateFilter",
3330
+ type: "date",
3331
+ min: _vm.fromDateFilter,
3332
+ },
3333
+ model: {
3334
+ value: _vm.toDateFilter,
3335
+ callback: function ($$v) {
3336
+ _vm.toDateFilter = $$v;
3337
+ },
3338
+ expression: "toDateFilter",
3339
+ },
3340
+ }),
3341
+ ],
3342
+ 1
3343
+ ),
3344
+ ]),
3345
+ ],
3346
+ 1
3347
+ ),
3348
+ ]
572
3349
  ),
3350
+ ]
3351
+ },
3352
+ proxy: true,
3353
+ },
3354
+ {
3355
+ key: "cell(actions)",
3356
+ fn: function (ref) {
3357
+ var row = ref.row;
3358
+ return [
3359
+ _vm.canViewAdministrators
3360
+ ? _c(
3361
+ "base-button",
3362
+ {
3363
+ attrs: {
3364
+ variant: "icon",
3365
+ title: _vm.$t("blog:edit"),
3366
+ disabled: _vm.isBusy(row.id),
3367
+ href: _vm.getBlogPostFormUrl({
3368
+ postId: row.id,
3369
+ }),
3370
+ },
3371
+ },
3372
+ [_c("svg-icon", { attrs: { name: "edit" } })],
3373
+ 1
3374
+ )
3375
+ : _vm._e(),
573
3376
  _vm._v(" "),
574
3377
  _c(
575
3378
  "base-button",
576
3379
  {
577
3380
  attrs: {
578
3381
  variant: "icon",
579
- title: _vm.$t("blog:remove"),
580
- disabled: _vm.isDeleting(row.id),
3382
+ title: _vm.$t("blog:clone"),
3383
+ disabled: _vm.isBusy(row.id),
581
3384
  },
582
3385
  on: {
583
3386
  click: function ($event) {
584
- return _vm.handleResourceDelete(row.id)
3387
+ return _vm.handleResourceClone(row.id)
585
3388
  },
586
3389
  },
587
3390
  },
588
- [_c("svg-icon", { attrs: { name: "delete" } })],
3391
+ [_c("svg-icon", { attrs: { name: "contentCopy" } })],
589
3392
  1
590
3393
  ),
3394
+ _vm._v(" "),
3395
+ _vm.canViewAdministrators
3396
+ ? _c(
3397
+ "base-button",
3398
+ {
3399
+ attrs: {
3400
+ variant: "icon",
3401
+ title: _vm.$t("blog:remove"),
3402
+ disabled: _vm.isBusy(row.id),
3403
+ },
3404
+ on: {
3405
+ click: function ($event) {
3406
+ return _vm.handleResourceDelete(row.id)
3407
+ },
3408
+ },
3409
+ },
3410
+ [_c("svg-icon", { attrs: { name: "delete" } })],
3411
+ 1
3412
+ )
3413
+ : _vm._e(),
591
3414
  ]
592
3415
  },
593
3416
  },
@@ -606,11 +3429,11 @@ __vue_render__._withStripped = true;
606
3429
  /* style */
607
3430
  const __vue_inject_styles__ = function (inject) {
608
3431
  if (!inject) return
609
- inject("data-v-f119918c_0", { source: "\n\n/*# sourceMappingURL=BlogPostList.vue.map */", map: {"version":3,"sources":["BlogPostList.vue"],"names":[],"mappings":";;AAEA,2CAA2C","file":"BlogPostList.vue"}, media: undefined });
3432
+ inject("data-v-7a3e00a4_0", { source: ".filters[data-v-7a3e00a4] {\n display: flex;\n margin: 0 -10px;\n}\n.filters[data-v-7a3e00a4]:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter[data-v-7a3e00a4] {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n.date-label[data-v-7a3e00a4] {\n margin-bottom: 0.5rem;\n}\n.date-content[data-v-7a3e00a4] {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-blog/tager-admin-blog/src/views/Posts/PostList/PostList.vue","PostList.vue"],"names":[],"mappings":"AAgVA;EACA,aAAA;EACA,eAAA;AC/UA;ADiVA;EACA,gBAAA;AC/UA;ADkVA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;AChVA;ADoVA;EACA,qBAAA;ACjVA;ADoVA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;ACjVA;;AAEA,uCAAuC","file":"PostList.vue","sourcesContent":["<template>\n <page\n :title=\"pageTitle\"\n :header-buttons=\"\n [\n canViewAdministrators\n ? {\n text: $t('blog:newPost'),\n href: getBlogPostFormUrl({ postId: 'create' }),\n }\n : null,\n ].filter(Boolean)\n \"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n data-table=\"blog-post\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"categoryFilter\"\n :options=\"categoryOptionList\"\n name=\"categoryFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:category')\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-if=\"isLangSpecific\"\n v-model=\"languageFilter\"\n :options=\"languageOptionList\"\n name=\"languageFilter\"\n :searchable=\"true\"\n :label=\"$t('blog:language')\"\n class=\"filter\"\n />\n\n <div class=\"filter\">\n <div class=\"date-label\">\n {{ $t('blog:dateOfPublication') }}\n </div>\n\n <div class=\"date-content\">\n <form-field\n v-model=\"fromDateFilter\"\n :label=\"$t('blog:From')\"\n name=\"fromDateFilter\"\n type=\"date\"\n :max=\"toDateFilter\"\n />\n\n <form-field\n v-model=\"toDateFilter\"\n :label=\"$t('blog:To')\"\n name=\"toDateFilter\"\n type=\"date\"\n :min=\"fromDateFilter\"\n />\n </div>\n </div>\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n v-if=\"canViewAdministrators\"\n variant=\"icon\"\n :title=\"$t('blog:edit')\"\n :disabled=\"isBusy(row.id)\"\n :href=\"getBlogPostFormUrl({ postId: row.id })\"\n >\n <svg-icon name=\"edit\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('blog:clone')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceClone(row.id)\"\n >\n <svg-icon name=\"contentCopy\" />\n </base-button>\n\n <base-button\n v-if=\"canViewAdministrators\"\n variant=\"icon\"\n :title=\"$t('blog:remove')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\" />\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, watch } from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport {\n ColumnDefinition,\n useDataTable,\n useTranslation,\n} from '@tager/admin-ui';\nimport {\n Nullable,\n useResourceClone,\n useResourceDelete,\n} from '@tager/admin-services';\n\nimport { Category, Language, PostFull, PostShort } from '@/typings/model';\nimport {\n clonePost,\n deleteBlogPost,\n getBlogPostList,\n} from '@/services/requests';\nimport { getBlogPostFormUrl } from '@/constants/paths';\nimport {\n useModuleConfig,\n useBlogCategoryList,\n useUserPermission,\n} from '@/hooks';\nimport { Scope } from '@/constants/scopes';\n\nimport { convertPostList, getPostTableColumnDefs } from './PostList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'BlogPostList',\n setup(props, context) {\n const { t } = useTranslation(context);\n\n const canViewAdministrators = useUserPermission(\n context,\n Scope.AdministratorsView\n );\n\n const categoryId = computed<string>(() => {\n return Array.isArray(context.root.$route.query.category)\n ? context.root.$route.query.category[0] ?? ''\n : context.root.$route.query.category;\n });\n\n /** Fetch module config */\n const {\n data: moduleConfig,\n loading: isModuleConfigLoading,\n } = useModuleConfig({ context });\n\n const languageList = computed<Language[]>(\n () => moduleConfig.value?.languages ?? []\n );\n\n /** Fetch category list */\n const {\n data: categoryList,\n loading: isCategoryListLoading,\n } = useBlogCategoryList({ context });\n\n const selectedCategory = computed<Nullable<Category>>(() =>\n categoryId.value\n ? categoryList.value.find(\n ({ id }) => String(id) === String(categoryId.value)\n ) ?? null\n : null\n );\n\n const pageTitle = computed<string>(() => {\n return selectedCategory.value\n ? `${context.root.$t('blog:postsByCategory')} \"${\n selectedCategory.value.name\n }\"`\n : context.root.$t('blog:posts');\n });\n\n /** Advanced search **/\n\n const {\n categoryFilter,\n categoryOptionList,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n categoryList,\n languageList,\n });\n\n const isLangSpecific = computed<boolean>(\n () => languageOptionList.value.length > 1\n );\n\n /** Fetch Post list */\n const {\n fetchEntityList: fetchPostList,\n isLoading: isPostLoading,\n rowData: postList,\n errorMessage,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<PostShort>({\n fetchEntityList: (params) =>\n getBlogPostList({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Blog post list',\n pageSize: 100,\n });\n\n watch(filterParams, () => {\n if (isModuleConfigLoading.value || isCategoryListLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchPostList();\n }\n });\n\n const displayedPostList = computed<PostShort[]>(() =>\n convertPostList(\n postList.value,\n selectedCategory.value,\n moduleConfig.value?.languages ?? []\n )\n );\n\n const isRowDataLoading = computed<boolean>(\n () =>\n isCategoryListLoading.value ||\n isPostLoading.value ||\n isModuleConfigLoading.value\n );\n\n const { isDeleting, handleResourceDelete } = useResourceDelete({\n deleteResource: deleteBlogPost,\n resourceName: 'Post',\n onSuccess: fetchPostList,\n context,\n });\n\n const { isCloning, handleResourceClone } = useResourceClone({\n cloneResource: clonePost,\n confirmMessage: t('blog:cloneConfirm'),\n successMessage: t('blog:cloneSuccess'),\n failureMessage: t('blog:cloneFailure'),\n onSuccessRedirectTo: (data: PostFull) => `/posts/${data.id}`,\n context,\n });\n\n function isBusy(postId: number): boolean {\n return isDeleting(postId) || isCloning(postId) || isRowDataLoading.value;\n }\n\n const columnDefs = computed<ColumnDefinition<PostShort>[]>(() =>\n getPostTableColumnDefs(moduleConfig.value, context.root.$t)\n );\n\n return {\n columnDefs,\n rowData: displayedPostList,\n handleResourceDelete,\n isDeleting,\n categoryList,\n isRowDataLoading,\n errorMessage,\n getBlogPostFormUrl,\n pageTitle,\n searchQuery,\n handleChange,\n pageNumber,\n pageCount,\n pageSize,\n\n // Advanced search\n categoryFilter,\n categoryOptionList,\n isLangSpecific,\n languageFilter,\n languageOptionList,\n fromDateFilter,\n toDateFilter,\n tags,\n tagRemovalHandler,\n\n // Permissions\n canViewAdministrators,\n\n // Clone\n handleResourceClone,\n isBusy,\n };\n },\n});\n</script>\n\n<style scoped lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n.date-label {\n margin-bottom: 0.5rem;\n}\n\n.date-content {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n/*# sourceMappingURL=PostList.vue.map */"]}, media: undefined });
610
3433
 
611
3434
  };
612
3435
  /* scoped */
613
- const __vue_scope_id__ = "data-v-f119918c";
3436
+ const __vue_scope_id__ = "data-v-7a3e00a4";
614
3437
  /* module identifier */
615
3438
  const __vue_module_identifier__ = undefined;
616
3439
  /* functional template */
@@ -634,21 +3457,7 @@ __vue_render__._withStripped = true;
634
3457
  undefined
635
3458
  );
636
3459
 
637
- function useBlogPostList(params) {
638
- const [fetchBlogPostList, resource] = useResource({
639
- fetchResource: () => getBlogPostList({ pageNumber: 1, pageSize: 99999 }),
640
- initialValue: [],
641
- context: params.context,
642
- resourceName: 'Blog post list',
643
- });
644
- onMounted(() => {
645
- fetchBlogPostList();
646
- });
647
- return resource;
648
- }
649
-
650
3460
  function convertPostToFormValues(post, languageOptionList, postOptionList, additionalFieldList) {
651
- var _a, _b;
652
3461
  if (!post) {
653
3462
  return {
654
3463
  title: '',
@@ -676,11 +3485,15 @@ function convertPostToFormValues(post, languageOptionList, postOptionList, addit
676
3485
  excerpt: post.excerpt,
677
3486
  body: post.body,
678
3487
  date: post.date,
679
- coverImage: post.coverImage ? { id: createId(), file: post.coverImage } : null,
3488
+ coverImage: post.coverImage
3489
+ ? { id: createId(), file: post.coverImage }
3490
+ : null,
680
3491
  image: post.image ? { id: createId(), file: post.image } : null,
681
- imageMobile: post.imageMobile ? { id: createId(), file: post.imageMobile } : null,
682
- pageTitle: (_a = post.pageTitle) !== null && _a !== void 0 ? _a : '',
683
- pageDescription: (_b = post.pageDescription) !== null && _b !== void 0 ? _b : '',
3492
+ imageMobile: post.imageMobile
3493
+ ? { id: createId(), file: post.imageMobile }
3494
+ : null,
3495
+ pageTitle: post.pageTitle ?? '',
3496
+ pageDescription: post.pageDescription ?? '',
684
3497
  openGraphImage: post.openGraphImage
685
3498
  ? { id: createId(), file: post.openGraphImage }
686
3499
  : null,
@@ -689,32 +3502,31 @@ function convertPostToFormValues(post, languageOptionList, postOptionList, addit
689
3502
  value: category.id,
690
3503
  label: category.name,
691
3504
  })),
692
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
3505
+ language: currentLangOption ?? null,
693
3506
  relatedPosts: selectedPostOptionList,
694
3507
  tags: post.tags.join(','),
695
3508
  additionalFields: additionalFieldList.map((fieldConfig, index) => {
696
- const postAdditionalField = post.additionalFields.find(item => item.name === fieldConfig.name);
697
- return universalFieldUtils.createFormField(fieldConfig, postAdditionalField === null || postAdditionalField === void 0 ? void 0 : postAdditionalField.value);
3509
+ const postAdditionalField = post.additionalFields.find((item) => item.name === fieldConfig.name);
3510
+ return universalFieldUtils.createFormField(fieldConfig, postAdditionalField?.value);
698
3511
  }),
699
3512
  };
700
3513
  }
701
3514
  function convertFormValuesToCreationPayload(values) {
702
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
703
3515
  return {
704
3516
  title: values.title,
705
3517
  excerpt: values.excerpt,
706
3518
  urlAlias: values.urlAlias,
707
3519
  body: values.body,
708
3520
  date: values.date,
709
- coverImage: (_b = (_a = values.coverImage) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null,
710
- image: (_d = (_c = values.image) === null || _c === void 0 ? void 0 : _c.file.id) !== null && _d !== void 0 ? _d : null,
711
- imageMobile: (_f = (_e = values.imageMobile) === null || _e === void 0 ? void 0 : _e.file.id) !== null && _f !== void 0 ? _f : null,
3521
+ coverImage: values.coverImage?.file.id ?? null,
3522
+ image: values.image?.file.id ?? null,
3523
+ imageMobile: values.imageMobile?.file.id ?? null,
712
3524
  pageTitle: values.pageTitle,
713
3525
  pageDescription: values.pageDescription,
714
- openGraphImage: (_h = (_g = values.openGraphImage) === null || _g === void 0 ? void 0 : _g.file.id) !== null && _h !== void 0 ? _h : null,
3526
+ openGraphImage: values.openGraphImage?.file.id ?? null,
715
3527
  status: 'PUBLISHED',
716
3528
  categories: values.categories.map((option) => option.value),
717
- language: (_k = (_j = values.language) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : null,
3529
+ language: values.language?.value ?? null,
718
3530
  relatedPosts: values.relatedPosts.map((relatedPostOption) => relatedPostOption.value),
719
3531
  tags: values.tags.split(',').filter((tag) => tag.trim().length > 0),
720
3532
  additionalFields: values.additionalFields.map((field) => ({
@@ -724,31 +3536,31 @@ function convertFormValuesToCreationPayload(values) {
724
3536
  };
725
3537
  }
726
3538
  function convertFormValuesToUpdatePayload(values) {
727
- return Object.assign(Object.assign({}, convertFormValuesToCreationPayload(values)), { urlAlias: values.urlAlias });
3539
+ return {
3540
+ ...convertFormValuesToCreationPayload(values),
3541
+ urlAlias: values.urlAlias,
3542
+ };
728
3543
  }
729
3544
  function convertCategoryListToOptions(categoryList, languageId) {
730
3545
  return categoryList
731
- .filter((category) => languageId ? category.language === languageId : true)
732
- .map((category) => ({
733
- value: category.id,
734
- label: category.name,
735
- }));
3546
+ .filter(({ language }) => (languageId ? language === languageId : true))
3547
+ .map(({ id, name }) => ({ value: id, label: name }));
736
3548
  }
737
3549
 
738
3550
  var script$1 = defineComponent({
739
3551
  name: 'BlogPostForm',
740
3552
  components: { DynamicField, ShortCodeConstructor, FormFooter },
741
3553
  setup(props, context) {
742
- var _a, _b;
743
3554
  const postId = computed(() => context.root.$route.params.postId);
744
3555
  const isCreation = computed(() => postId.value === 'create');
745
3556
  const urlAliasChanged = ref(false);
746
3557
  /** Fetch module config */
747
3558
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
748
- const languageOptionList = computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages.map((lang) => ({
749
- value: lang.id,
750
- label: lang.name,
751
- }))) !== null && _b !== void 0 ? _b : []; });
3559
+ const languageList = computed(() => moduleConfig.value?.languages ?? []);
3560
+ const languageOptionList = computed(() => languageList.value.map(({ id, name }) => ({
3561
+ value: id,
3562
+ label: name,
3563
+ })));
752
3564
  const isLangSpecific = computed(() => languageOptionList.value.length > 0);
753
3565
  /** Fetch category list */
754
3566
  const { data: categoryList, loading: isCategoryListLoading, } = useBlogCategoryList({ context });
@@ -774,18 +3586,17 @@ var script$1 = defineComponent({
774
3586
  context,
775
3587
  });
776
3588
  const postOptionList = computed(() => postList.value
777
- .filter((relatedPost) => { var _a; return relatedPost.id !== ((_a = post.value) === null || _a === void 0 ? void 0 : _a.id); })
3589
+ .filter((relatedPost) => relatedPost.id !== post.value?.id)
778
3590
  .map((post) => ({
779
3591
  value: post.id,
780
3592
  label: post.title,
781
3593
  })));
782
3594
  /** Form State */
783
- const values = ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []));
3595
+ const values = ref(convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []));
784
3596
  const errors = ref({});
785
3597
  const isSubmitting = ref(false);
786
3598
  watch([post, languageOptionList, postOptionList, moduleConfig], () => {
787
- var _a, _b;
788
- values.value = convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
3599
+ values.value = convertPostToFormValues(post.value, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []);
789
3600
  });
790
3601
  function submitForm(event) {
791
3602
  isSubmitting.value = true;
@@ -796,7 +3607,6 @@ var script$1 = defineComponent({
796
3607
  : updateBlogPost(postId.value, updateBody);
797
3608
  requestPromise
798
3609
  .then(({ data }) => {
799
- var _a, _b;
800
3610
  errors.value = {};
801
3611
  if (event.type === 'create') {
802
3612
  context.root.$router.push(getBlogPostFormUrl({ postId: String(data.id) }));
@@ -810,7 +3620,7 @@ var script$1 = defineComponent({
810
3620
  }
811
3621
  }
812
3622
  if (event.type === 'create_create-another') {
813
- values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : []);
3623
+ values.value = convertPostToFormValues(null, languageOptionList.value, postOptionList.value, moduleConfig.value?.fields ?? []);
814
3624
  }
815
3625
  context.root.$toast({
816
3626
  variant: 'success',
@@ -836,17 +3646,13 @@ var script$1 = defineComponent({
836
3646
  });
837
3647
  }
838
3648
  /** Category Options */
839
- const categoryOptionList = computed(() => {
840
- var _a, _b;
841
- return convertCategoryListToOptions(categoryList.value, (_b = (_a = values.value.language) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null);
842
- });
3649
+ const categoryOptionList = computed(() => convertCategoryListToOptions(categoryList.value, values.value.language?.value ?? null));
843
3650
  watch([categoryOptionList, moduleConfig], () => {
844
- var _a;
845
3651
  function isOptionExist(selectedCategoryOption) {
846
3652
  return categoryOptionList.value.some((option) => option.value === selectedCategoryOption.value);
847
3653
  }
848
3654
  if (isCreation.value) {
849
- if ((_a = moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.value) === null || _a === void 0 ? void 0 : _a.defaultCategories) {
3655
+ if (moduleConfig?.value?.defaultCategories) {
850
3656
  const defaultIds = moduleConfig.value.defaultCategories.map((item) => item.id);
851
3657
  values.value.categories = categoryOptionList.value.filter((item) => {
852
3658
  return defaultIds.indexOf(item.value) !== -1;
@@ -861,13 +3667,11 @@ var script$1 = defineComponent({
861
3667
  isPostListLoading.value ||
862
3668
  isModuleConfigLoading.value);
863
3669
  function getUploadAdapterOptions() {
864
- var _a;
865
- return { uploadScenario: (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.fileScenarios.content };
3670
+ return { uploadScenario: moduleConfig.value?.fileScenarios.content };
866
3671
  }
867
3672
  const blogPagePath = computed(() => {
868
- var _a, _b;
869
3673
  const origin = process.env.VUE_APP_WEBSITE_URL || window.location.origin;
870
- return origin + ((_b = (_a = post.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : '');
3674
+ return origin + (post.value?.urlTemplate ?? '');
871
3675
  });
872
3676
  const tabList = computed(() => {
873
3677
  const hasErrors = createTabErrorFinder(errors.value);
@@ -970,7 +3774,7 @@ var script$1 = defineComponent({
970
3774
  handleSeoFieldGroupChange,
971
3775
  handleTitleChange,
972
3776
  handleAliasChange,
973
- urlAliasTemplate
3777
+ urlAliasTemplate,
974
3778
  };
975
3779
  },
976
3780
  });
@@ -1310,17 +4114,15 @@ var __vue_staticRenderFns__$1 = [];
1310
4114
  __vue_render__$1._withStripped = true;
1311
4115
 
1312
4116
  /* style */
1313
- const __vue_inject_styles__$1 = function (inject) {
1314
- if (!inject) return
1315
- inject("data-v-6c25151d_0", { source: "\n\n/*# sourceMappingURL=BlogPostForm.vue.map */", map: {"version":3,"sources":["BlogPostForm.vue"],"names":[],"mappings":";;AAEA,2CAA2C","file":"BlogPostForm.vue"}, media: undefined });
1316
-
1317
- };
4117
+ const __vue_inject_styles__$1 = undefined;
1318
4118
  /* scoped */
1319
- const __vue_scope_id__$1 = "data-v-6c25151d";
4119
+ const __vue_scope_id__$1 = undefined;
1320
4120
  /* module identifier */
1321
4121
  const __vue_module_identifier__$1 = undefined;
1322
4122
  /* functional template */
1323
4123
  const __vue_is_functional_template__$1 = false;
4124
+ /* style inject */
4125
+
1324
4126
  /* style inject SSR */
1325
4127
 
1326
4128
  /* style inject shadow dom */
@@ -1335,7 +4137,7 @@ __vue_render__$1._withStripped = true;
1335
4137
  __vue_is_functional_template__$1,
1336
4138
  __vue_module_identifier__$1,
1337
4139
  false,
1338
- createInjector,
4140
+ undefined,
1339
4141
  undefined,
1340
4142
  undefined
1341
4143
  );
@@ -1343,8 +4145,11 @@ __vue_render__$1._withStripped = true;
1343
4145
  function convertCategoryList(categoryList, languages) {
1344
4146
  return categoryList.map((category) => {
1345
4147
  if (languages.length > 0) {
1346
- const foundLanguage = languages.find((lang) => category.language === lang.id);
1347
- return Object.assign(Object.assign({}, category), { language: foundLanguage ? foundLanguage.name : category.language });
4148
+ const foundLanguage = languages.find(({ id }) => category.language === id);
4149
+ return {
4150
+ ...category,
4151
+ language: foundLanguage ? foundLanguage.name : category.language,
4152
+ };
1348
4153
  }
1349
4154
  return category;
1350
4155
  });
@@ -1355,40 +4160,44 @@ function getCategoryTableColumnDefs(moduleConfig, t) {
1355
4160
  : false;
1356
4161
  const COLUMN_DEFS = [
1357
4162
  {
1358
- id: 2,
4163
+ id: 1,
1359
4164
  name: t('blog:name'),
1360
4165
  field: 'name',
1361
4166
  type: 'name',
1362
- format: ({ row }) => {
1363
- return {
1364
- adminLink: {
1365
- url: getBlogCategoryFormUrl({ categoryId: row.id }),
1366
- text: row.name,
1367
- },
1368
- websiteLink: {
1369
- url: [
1370
- process.env.VUE_APP_WEBSITE_URL || window.location.origin,
1371
- row.url,
1372
- ].join(''),
1373
- text: row.url,
1374
- },
1375
- paramList: row.isDefault ? [
1376
- { name: t('blog:defaultCategory'), 'value': t('blog:yes') }
1377
- ] : []
1378
- };
4167
+ format: ({ row }) => ({
4168
+ adminLink: {
4169
+ url: getBlogCategoryFormUrl({ categoryId: row.id }),
4170
+ text: getNameWithDepth(row.name, row.depth),
4171
+ },
4172
+ paramList: row.isDefault
4173
+ ? [{ name: t('blog:defaultCategory'), value: t('blog:yes') }]
4174
+ : [],
4175
+ }),
4176
+ },
4177
+ {
4178
+ id: 2,
4179
+ name: t('pages:path'),
4180
+ field: 'path',
4181
+ type: 'link',
4182
+ format: ({ row }) => ({
4183
+ url: `${getWebsiteOrigin()}${row.url}`,
4184
+ text: row.url,
4185
+ }),
4186
+ options: {
4187
+ shouldOpenNewTab: true,
1379
4188
  },
1380
4189
  },
1381
4190
  isLangSpecific
1382
- ? { id: 4, name: t('blog:language'), field: 'language' }
4191
+ ? { id: 3, name: t('blog:language'), field: 'language' }
1383
4192
  : null,
1384
4193
  {
1385
- id: 3,
4194
+ id: 4,
1386
4195
  name: t('blog:posts'),
1387
4196
  field: 'linkToPosts',
1388
4197
  style: { whiteSpace: 'nowrap', width: '130px' },
1389
4198
  },
1390
4199
  {
1391
- id: 4,
4200
+ id: 5,
1392
4201
  name: t('blog:actions'),
1393
4202
  field: 'actions',
1394
4203
  style: { whiteSpace: 'nowrap', width: '205px' },
@@ -1397,32 +4206,94 @@ function getCategoryTableColumnDefs(moduleConfig, t) {
1397
4206
  },
1398
4207
  ];
1399
4208
  return COLUMN_DEFS.filter(notEmpty);
4209
+ }
4210
+ function getLinkToPostsByCategory(categoryId) {
4211
+ return `${getBlogPostListUrl()}?filter[category]=${categoryId}`;
4212
+ }
4213
+
4214
+ var FilterTypes$1;
4215
+ (function (FilterTypes) {
4216
+ FilterTypes["LANGUAGE"] = "language";
4217
+ })(FilterTypes$1 || (FilterTypes$1 = {}));
4218
+ function useAdvancedSearch$1({ context, languageList }) {
4219
+ /** Language **/
4220
+ const languageOptionList = computed(() => languageList.value.map(({ id, name }) => ({ value: id, label: name })));
4221
+ const initialLanguageFilter = computed(() => {
4222
+ const queryValue = getFilterParamAsStringArray(context.root.$route.query, FilterTypes$1.LANGUAGE);
4223
+ return languageOptionList.value.filter(({ value }) => queryValue.some((selected) => selected === value));
4224
+ });
4225
+ const languageFilter = ref(initialLanguageFilter.value);
4226
+ watch(initialLanguageFilter, () => {
4227
+ languageFilter.value = initialLanguageFilter.value;
4228
+ });
4229
+ /** Params **/
4230
+ const filterParams = computed(() => getFilterParams({
4231
+ [FilterTypes$1.LANGUAGE]: languageFilter.value.map(({ value }) => value),
4232
+ }));
4233
+ /** Tag removal handler **/
4234
+ function tagRemovalHandler(event) {
4235
+ if (event.name === FilterTypes$1.LANGUAGE) {
4236
+ languageFilter.value = languageFilter.value.filter(({ value }) => value !== event.value);
4237
+ }
4238
+ }
4239
+ /** Tags **/
4240
+ const tags = computed(() => [
4241
+ ...languageFilter.value.map(({ value, label }) => ({
4242
+ value,
4243
+ label,
4244
+ name: FilterTypes$1.LANGUAGE,
4245
+ title: context.root.$t('blog:language'),
4246
+ })),
4247
+ ]);
4248
+ return {
4249
+ languageFilter,
4250
+ languageOptionList,
4251
+ tagRemovalHandler,
4252
+ tags: tags,
4253
+ filterParams,
4254
+ };
1400
4255
  }
1401
4256
 
1402
- var script$2 = Vue.extend({
4257
+ var script$2 = defineComponent({
1403
4258
  name: 'BlogCategoryList',
1404
4259
  setup(props, context) {
4260
+ const canViewAdministrators = useUserPermission(context, Scope.AdministratorsView);
1405
4261
  /** Fetch module config */
1406
4262
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
1407
- const languageOptionList = computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages.map((lang) => ({
1408
- value: lang.id,
1409
- label: lang.name,
1410
- }))) !== null && _b !== void 0 ? _b : []; });
1411
- const isLangSpecific = computed(() => languageOptionList.value.length > 0);
4263
+ const languageList = computed(() => moduleConfig.value?.languages ?? []);
4264
+ /** Advanced search **/
4265
+ const { languageFilter, languageOptionList, filterParams, tags, tagRemovalHandler, } = useAdvancedSearch$1({ context, languageList });
4266
+ const isLangSpecific = computed(() => languageOptionList.value.length > 1);
1412
4267
  /** Fetch category list */
1413
- const [fetchBlogCategoryList, { data: categoryList, loading: isCategoryListLoading, error },] = useResource({
1414
- fetchResource: getBlogCategoryList,
4268
+ const { fetchEntityList: fetchCategoryList, isLoading: isCategoryListLoading, rowData: categoryList, errorMessage, searchQuery, handleChange, pageNumber, pageCount, pageSize, } = useDataTable({
4269
+ fetchEntityList: (params) => getBlogCategoryList({
4270
+ query: params.searchQuery,
4271
+ pageNumber: params.pageNumber,
4272
+ pageSize: params.pageSize,
4273
+ ...filterParams.value,
4274
+ }),
1415
4275
  initialValue: [],
1416
4276
  context,
1417
4277
  resourceName: 'Blog category list',
4278
+ pageSize: 100,
1418
4279
  });
1419
- onMounted(() => {
1420
- fetchBlogCategoryList();
4280
+ watch(filterParams, () => {
4281
+ if (isModuleConfigLoading.value || isCategoryListLoading.value) {
4282
+ return;
4283
+ }
4284
+ const newQuery = {
4285
+ ...filterParams.value,
4286
+ query: (context.root.$route.query.query ?? ''),
4287
+ };
4288
+ if (!lodash_isequal(context.root.$route.query, newQuery)) {
4289
+ context.root.$router.replace({ query: newQuery });
4290
+ fetchCategoryList();
4291
+ }
1421
4292
  });
1422
- const { handleResourceDelete: handleCategoryDelete, isDeleting, } = useResourceDelete({
4293
+ const { isDeleting, handleResourceDelete: handleCategoryDelete, } = useResourceDelete({
1423
4294
  deleteResource: deleteBlogCategory,
1424
4295
  resourceName: 'Post',
1425
- onSuccess: fetchBlogCategoryList,
4296
+ onSuccess: fetchCategoryList,
1426
4297
  context,
1427
4298
  });
1428
4299
  const isCategoryMoving = ref(false);
@@ -1431,7 +4302,7 @@ var script$2 = Vue.extend({
1431
4302
  moveBlogCategory(categoryId, direction)
1432
4303
  .then((response) => {
1433
4304
  if (response.success) {
1434
- return fetchBlogCategoryList();
4305
+ return fetchCategoryList();
1435
4306
  }
1436
4307
  })
1437
4308
  .catch(console.error)
@@ -1441,27 +4312,31 @@ var script$2 = Vue.extend({
1441
4312
  }
1442
4313
  /** Misc */
1443
4314
  const isRowDataLoading = computed(() => isCategoryListLoading.value || isModuleConfigLoading.value);
1444
- function getLinkToPostsByCategory(categoryId) {
1445
- return `${getBlogPostListUrl()}?category=${categoryId}`;
1446
- }
1447
- const displayedCategoryList = computed(() => {
1448
- var _a, _b;
1449
- return convertCategoryList(categoryList.value, (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages) !== null && _b !== void 0 ? _b : []);
1450
- });
4315
+ const displayedCategoryList = computed(() => convertCategoryList(categoryList.value, languageList.value));
1451
4316
  const columnDefs = computed(() => getCategoryTableColumnDefs(moduleConfig.value, context.root.$t));
1452
4317
  return {
1453
4318
  columnDefs,
1454
4319
  rowData: displayedCategoryList,
1455
4320
  isRowDataLoading,
1456
- errorMessage: error,
4321
+ errorMessage,
1457
4322
  isLangSpecific,
1458
- languageOptionList,
1459
4323
  handleCategoryDelete,
1460
4324
  isDeleting,
1461
4325
  getBlogCategoryFormUrl,
1462
4326
  getLinkToPostsByCategory,
1463
4327
  moveCategory,
1464
4328
  isCategoryMoving,
4329
+ searchQuery,
4330
+ handleChange,
4331
+ pageNumber,
4332
+ pageCount,
4333
+ pageSize,
4334
+ languageFilter,
4335
+ languageOptionList,
4336
+ tags,
4337
+ tagRemovalHandler,
4338
+ // Permissions
4339
+ canViewAdministrators,
1465
4340
  };
1466
4341
  },
1467
4342
  });
@@ -1478,133 +4353,194 @@ var __vue_render__$2 = function () {
1478
4353
  attrs: {
1479
4354
  title: _vm.$t("blog:blogCategories"),
1480
4355
  "header-buttons": [
1481
- {
1482
- text: _vm.$t("blog:newCategory"),
1483
- href: _vm.getBlogCategoryFormUrl({ categoryId: "create" }),
1484
- },
1485
- ],
4356
+ _vm.canViewAdministrators
4357
+ ? {
4358
+ text: _vm.$t("blog:newCategory"),
4359
+ href: _vm.getBlogCategoryFormUrl({ categoryId: "create" }),
4360
+ }
4361
+ : null,
4362
+ ].filter(Boolean),
1486
4363
  },
1487
4364
  scopedSlots: _vm._u([
1488
4365
  {
1489
4366
  key: "content",
1490
4367
  fn: function () {
1491
4368
  return [
1492
- _c("base-table", {
4369
+ _c("data-table", {
1493
4370
  attrs: {
1494
4371
  "column-defs": _vm.columnDefs,
1495
4372
  "row-data": _vm.rowData,
1496
4373
  loading: _vm.isRowDataLoading,
1497
4374
  "error-message": _vm.errorMessage,
4375
+ "search-query": _vm.searchQuery,
4376
+ pagination: {
4377
+ pageNumber: _vm.pageNumber,
4378
+ pageCount: _vm.pageCount,
4379
+ pageSize: _vm.pageSize,
4380
+ disabled: _vm.isRowDataLoading,
4381
+ },
1498
4382
  "data-table": "blog-category",
1499
4383
  },
1500
- scopedSlots: _vm._u([
1501
- {
1502
- key: "cell(link-to-posts)",
1503
- fn: function (ref) {
1504
- var row = ref.row;
1505
- return [
1506
- _c(
1507
- "count-button",
1508
- {
1509
- attrs: {
1510
- href: _vm.getLinkToPostsByCategory(row.id),
1511
- variant: "outline-secondary",
1512
- count: row.postsCount,
1513
- },
1514
- },
1515
- [
1516
- _vm._v(
1517
- "\n " +
1518
- _vm._s(_vm.$t("blog:posts")) +
1519
- "\n "
1520
- ),
1521
- ]
1522
- ),
1523
- ]
1524
- },
1525
- },
1526
- {
1527
- key: "cell(actions)",
1528
- fn: function (ref) {
1529
- var row = ref.row;
1530
- var rowIndex = ref.rowIndex;
1531
- return [
1532
- _c(
1533
- "base-button",
1534
- {
1535
- attrs: {
1536
- variant: "icon",
1537
- title: _vm.$t("blog:edit"),
1538
- disabled: _vm.isDeleting(row.id),
1539
- href: _vm.getBlogCategoryFormUrl({
1540
- categoryId: row.id,
1541
- }),
1542
- },
1543
- },
1544
- [_c("svg-icon", { attrs: { name: "edit" } })],
1545
- 1
1546
- ),
1547
- _vm._v(" "),
1548
- _c(
1549
- "base-button",
1550
- {
1551
- attrs: {
1552
- variant: "icon",
1553
- title: _vm.$t("blog:moveUp"),
1554
- disabled: rowIndex === 0 || _vm.isCategoryMoving,
1555
- },
1556
- on: {
1557
- click: function ($event) {
1558
- return _vm.moveCategory(row.id, "up")
1559
- },
1560
- },
4384
+ on: { change: _vm.handleChange },
4385
+ scopedSlots: _vm._u(
4386
+ [
4387
+ _vm.isLangSpecific
4388
+ ? {
4389
+ key: "filters",
4390
+ fn: function () {
4391
+ return [
4392
+ _c(
4393
+ "advanced-search",
4394
+ {
4395
+ attrs: { tags: _vm.tags },
4396
+ on: { "click:tag": _vm.tagRemovalHandler },
4397
+ },
4398
+ [
4399
+ _c(
4400
+ "div",
4401
+ { staticClass: "filters" },
4402
+ [
4403
+ _c("form-field-multi-select", {
4404
+ staticClass: "filter",
4405
+ attrs: {
4406
+ options: _vm.languageOptionList,
4407
+ name: "languageFilter",
4408
+ searchable: true,
4409
+ label: _vm.$t("blog:language"),
4410
+ },
4411
+ model: {
4412
+ value: _vm.languageFilter,
4413
+ callback: function ($$v) {
4414
+ _vm.languageFilter = $$v;
4415
+ },
4416
+ expression: "languageFilter",
4417
+ },
4418
+ }),
4419
+ ],
4420
+ 1
4421
+ ),
4422
+ ]
4423
+ ),
4424
+ ]
1561
4425
  },
1562
- [_c("svg-icon", { attrs: { name: "north" } })],
1563
- 1
1564
- ),
1565
- _vm._v(" "),
1566
- _c(
1567
- "base-button",
1568
- {
1569
- attrs: {
1570
- variant: "icon",
1571
- title: _vm.$t("blog:moveDown"),
1572
- disabled:
1573
- rowIndex === _vm.rowData.length - 1 ||
1574
- _vm.isCategoryMoving,
1575
- },
1576
- on: {
1577
- click: function ($event) {
1578
- return _vm.moveCategory(row.id, "down")
4426
+ proxy: true,
4427
+ }
4428
+ : null,
4429
+ {
4430
+ key: "cell(link-to-posts)",
4431
+ fn: function (ref) {
4432
+ var row = ref.row;
4433
+ return [
4434
+ _c(
4435
+ "count-button",
4436
+ {
4437
+ attrs: {
4438
+ href: _vm.getLinkToPostsByCategory(row.id),
4439
+ variant: "outline-secondary",
4440
+ count: row.postsCount,
1579
4441
  },
1580
4442
  },
1581
- },
1582
- [_c("svg-icon", { attrs: { name: "south" } })],
1583
- 1
1584
- ),
1585
- _vm._v(" "),
1586
- _c(
1587
- "base-button",
1588
- {
1589
- attrs: {
1590
- variant: "icon",
1591
- title: _vm.$t("blog:remove"),
1592
- disabled:
1593
- _vm.isDeleting(row.id) || row.postsCount > 0,
4443
+ [
4444
+ _vm._v(
4445
+ "\n " +
4446
+ _vm._s(_vm.$t("blog:posts")) +
4447
+ "\n "
4448
+ ),
4449
+ ]
4450
+ ),
4451
+ ]
4452
+ },
4453
+ },
4454
+ {
4455
+ key: "cell(actions)",
4456
+ fn: function (ref) {
4457
+ var row = ref.row;
4458
+ var rowIndex = ref.rowIndex;
4459
+ return [
4460
+ _vm.canViewAdministrators
4461
+ ? _c(
4462
+ "base-button",
4463
+ {
4464
+ attrs: {
4465
+ variant: "icon",
4466
+ title: _vm.$t("blog:edit"),
4467
+ disabled: _vm.isDeleting(row.id),
4468
+ href: _vm.getBlogCategoryFormUrl({
4469
+ categoryId: row.id,
4470
+ }),
4471
+ },
4472
+ },
4473
+ [_c("svg-icon", { attrs: { name: "edit" } })],
4474
+ 1
4475
+ )
4476
+ : _vm._e(),
4477
+ _vm._v(" "),
4478
+ _c(
4479
+ "base-button",
4480
+ {
4481
+ attrs: {
4482
+ variant: "icon",
4483
+ title: _vm.$t("blog:moveUp"),
4484
+ disabled: rowIndex === 0 || _vm.isCategoryMoving,
4485
+ },
4486
+ on: {
4487
+ click: function ($event) {
4488
+ return _vm.moveCategory(row.id, "up")
4489
+ },
4490
+ },
1594
4491
  },
1595
- on: {
1596
- click: function ($event) {
1597
- return _vm.handleCategoryDelete(row.id)
4492
+ [_c("svg-icon", { attrs: { name: "north" } })],
4493
+ 1
4494
+ ),
4495
+ _vm._v(" "),
4496
+ _c(
4497
+ "base-button",
4498
+ {
4499
+ attrs: {
4500
+ variant: "icon",
4501
+ title: _vm.$t("blog:moveDown"),
4502
+ disabled:
4503
+ rowIndex === _vm.rowData.length - 1 ||
4504
+ _vm.isCategoryMoving,
4505
+ },
4506
+ on: {
4507
+ click: function ($event) {
4508
+ return _vm.moveCategory(row.id, "down")
4509
+ },
1598
4510
  },
1599
4511
  },
1600
- },
1601
- [_c("svg-icon", { attrs: { name: "delete" } })],
1602
- 1
1603
- ),
1604
- ]
4512
+ [_c("svg-icon", { attrs: { name: "south" } })],
4513
+ 1
4514
+ ),
4515
+ _vm._v(" "),
4516
+ _vm.canViewAdministrators
4517
+ ? _c(
4518
+ "base-button",
4519
+ {
4520
+ attrs: {
4521
+ variant: "icon",
4522
+ title: _vm.$t("blog:remove"),
4523
+ disabled:
4524
+ _vm.isDeleting(row.id) ||
4525
+ row.postsCount > 0,
4526
+ },
4527
+ on: {
4528
+ click: function ($event) {
4529
+ return _vm.handleCategoryDelete(row.id)
4530
+ },
4531
+ },
4532
+ },
4533
+ [_c("svg-icon", { attrs: { name: "delete" } })],
4534
+ 1
4535
+ )
4536
+ : _vm._e(),
4537
+ ]
4538
+ },
1605
4539
  },
1606
- },
1607
- ]),
4540
+ ],
4541
+ null,
4542
+ true
4543
+ ),
1608
4544
  }),
1609
4545
  ]
1610
4546
  },
@@ -1617,17 +4553,15 @@ var __vue_staticRenderFns__$2 = [];
1617
4553
  __vue_render__$2._withStripped = true;
1618
4554
 
1619
4555
  /* style */
1620
- const __vue_inject_styles__$2 = function (inject) {
1621
- if (!inject) return
1622
- inject("data-v-3d18b3da_0", { source: "\n\n/*# sourceMappingURL=BlogCategoryList.vue.map */", map: {"version":3,"sources":["BlogCategoryList.vue"],"names":[],"mappings":";;AAEA,+CAA+C","file":"BlogCategoryList.vue"}, media: undefined });
1623
-
1624
- };
4556
+ const __vue_inject_styles__$2 = undefined;
1625
4557
  /* scoped */
1626
- const __vue_scope_id__$2 = "data-v-3d18b3da";
4558
+ const __vue_scope_id__$2 = undefined;
1627
4559
  /* module identifier */
1628
4560
  const __vue_module_identifier__$2 = undefined;
1629
4561
  /* functional template */
1630
4562
  const __vue_is_functional_template__$2 = false;
4563
+ /* style inject */
4564
+
1631
4565
  /* style inject SSR */
1632
4566
 
1633
4567
  /* style inject shadow dom */
@@ -1642,65 +4576,72 @@ __vue_render__$2._withStripped = true;
1642
4576
  __vue_is_functional_template__$2,
1643
4577
  __vue_module_identifier__$2,
1644
4578
  false,
1645
- createInjector,
4579
+ undefined,
1646
4580
  undefined,
1647
4581
  undefined
1648
4582
  );
1649
4583
 
1650
4584
  function convertCategoryToFormValues(category, languageOptionList) {
1651
- var _a, _b;
1652
- const currentLangOption = languageOptionList.find((option) => option.value === (category === null || category === void 0 ? void 0 : category.language));
4585
+ const currentLangOption = languageOptionList.find(({ value }) => value === category?.language);
1653
4586
  if (!category) {
1654
4587
  return {
1655
4588
  name: '',
1656
4589
  isDefault: false,
1657
4590
  pageTitle: '',
1658
4591
  pageDescription: '',
4592
+ openGraphTitle: '',
4593
+ openGraphDescription: '',
4594
+ pageKeywords: '',
1659
4595
  openGraphImage: null,
1660
4596
  urlAlias: '',
1661
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
4597
+ language: currentLangOption ?? null,
1662
4598
  };
1663
4599
  }
1664
4600
  return {
1665
4601
  name: category.name,
1666
4602
  isDefault: category.isDefault,
1667
- pageTitle: (_a = category.pageTitle) !== null && _a !== void 0 ? _a : '',
1668
- pageDescription: (_b = category.pageDescription) !== null && _b !== void 0 ? _b : '',
4603
+ pageTitle: category.pageTitle ?? '',
4604
+ pageDescription: category.pageDescription ?? '',
4605
+ pageKeywords: category.pageKeywords ?? '',
4606
+ openGraphTitle: category.openGraphTitle ?? '',
4607
+ openGraphDescription: category.openGraphDescription ?? '',
1669
4608
  openGraphImage: category.openGraphImage
1670
4609
  ? { id: createId(), file: category.openGraphImage }
1671
4610
  : null,
1672
4611
  urlAlias: category.urlAlias,
1673
- language: currentLangOption !== null && currentLangOption !== void 0 ? currentLangOption : null,
4612
+ language: currentLangOption ?? null,
1674
4613
  };
1675
4614
  }
1676
4615
  function convertCategoryFormValuesToCreationPayload(values) {
1677
- var _a, _b, _c, _d;
1678
4616
  return {
1679
4617
  name: values.name,
1680
4618
  isDefault: values.isDefault,
1681
4619
  pageTitle: values.pageTitle,
1682
4620
  pageDescription: values.pageDescription,
1683
- openGraphImage: (_b = (_a = values.openGraphImage) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null,
1684
- language: (_d = (_c = values.language) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : null,
4621
+ openGraphImage: values.openGraphImage?.file.id ?? null,
4622
+ language: values.language?.value ?? null,
1685
4623
  };
1686
4624
  }
1687
4625
  function convertCategoryFormValuesToUpdatePayload(values) {
1688
- return Object.assign(Object.assign({}, convertCategoryFormValuesToCreationPayload(values)), { urlAlias: values.urlAlias });
4626
+ return {
4627
+ ...convertCategoryFormValuesToCreationPayload(values),
4628
+ urlAlias: values.urlAlias,
4629
+ };
1689
4630
  }
1690
4631
 
1691
4632
  var script$3 = defineComponent({
1692
4633
  name: 'BlogCategoryForm',
1693
4634
  components: { FormFooter },
1694
4635
  setup(props, context) {
4636
+ const { t } = useTranslation(context);
1695
4637
  const categoryId = computed(() => context.root.$route.params.categoryId);
1696
4638
  const isCreation = computed(() => categoryId.value === 'create');
1697
4639
  /** Fetch module config */
1698
4640
  const { data: moduleConfig, loading: isModuleConfigLoading, } = useModuleConfig({ context });
1699
- const languageOptionList = computed(() => { var _a, _b; return (_b = (_a = moduleConfig.value) === null || _a === void 0 ? void 0 : _a.languages.map((lang) => ({
1700
- value: lang.id,
1701
- label: lang.name,
1702
- }))) !== null && _b !== void 0 ? _b : []; });
4641
+ const languageList = computed(() => moduleConfig.value?.languages ?? []);
4642
+ const languageOptionList = computed(() => languageList.value.map(({ id, name }) => ({ value: id, label: name })));
1703
4643
  const isLangSpecific = computed(() => languageOptionList.value.length > 0);
4644
+ const imageScenario = computed(() => moduleConfig.value?.fileScenarios?.openGraph ?? null);
1704
4645
  /** Fetch Category */
1705
4646
  const [fetchCategory, { data: category, loading: isCategoryLoading },] = useResource({
1706
4647
  fetchResource: () => getBlogCategory(categoryId.value),
@@ -1709,13 +4650,15 @@ var script$3 = defineComponent({
1709
4650
  resourceName: 'Category',
1710
4651
  });
1711
4652
  onMounted(() => {
1712
- if (isCreation.value)
4653
+ if (isCreation.value) {
1713
4654
  return;
4655
+ }
1714
4656
  fetchCategory();
1715
4657
  });
1716
4658
  watch(categoryId, () => {
1717
- if (isCreation.value)
4659
+ if (isCreation.value) {
1718
4660
  return;
4661
+ }
1719
4662
  fetchCategory();
1720
4663
  });
1721
4664
  /** Form State */
@@ -1726,12 +4669,13 @@ var script$3 = defineComponent({
1726
4669
  values.value = convertCategoryToFormValues(category.value, languageOptionList.value);
1727
4670
  });
1728
4671
  function submitForm(event) {
1729
- var _a, _b;
1730
4672
  isSubmitting.value = true;
1731
4673
  const creationBody = convertCategoryFormValuesToCreationPayload(values.value);
1732
4674
  const updateBody = convertCategoryFormValuesToUpdatePayload(values.value);
1733
4675
  if (!isCreation.value) {
1734
- updateBody.language = ((_a = category.value) === null || _a === void 0 ? void 0 : _a.language) ? (_b = category.value) === null || _b === void 0 ? void 0 : _b.language : null;
4676
+ updateBody.language = category.value?.language
4677
+ ? category.value?.language
4678
+ : null;
1735
4679
  }
1736
4680
  const requestPromise = isCreation.value
1737
4681
  ? createBlogCategory(creationBody)
@@ -1774,10 +4718,21 @@ var script$3 = defineComponent({
1774
4718
  /** Misc */
1775
4719
  const isContentLoading = computed(() => isCategoryLoading.value || isModuleConfigLoading.value);
1776
4720
  const categoryPagePath = computed(() => {
1777
- var _a, _b;
1778
- const origin = process.env.VUE_APP_WEBSITE_URL || window.location.origin;
1779
- return origin + ((_b = (_a = category.value) === null || _a === void 0 ? void 0 : _a.urlTemplate) !== null && _b !== void 0 ? _b : '');
4721
+ return `${getWebsiteOrigin()}${category.value?.urlTemplate ?? ''}`;
1780
4722
  });
4723
+ // SEO
4724
+ function handleSeoFieldGroupChange({ title, description, keywords, image, }) {
4725
+ values.value.pageTitle = title;
4726
+ values.value.pageDescription = description;
4727
+ values.value.pageKeywords = keywords;
4728
+ values.value.openGraphImage = image;
4729
+ }
4730
+ /** Tabs */
4731
+ const tabList = computed(() => [
4732
+ { id: 'common', label: t('blog:tabs.common') },
4733
+ { id: 'seo', label: t('blog:tabs.seo') },
4734
+ ]);
4735
+ const selectedTabId = ref(tabList.value[0].id);
1781
4736
  return {
1782
4737
  isCreation,
1783
4738
  isContentLoading: isContentLoading,
@@ -1789,7 +4744,13 @@ var script$3 = defineComponent({
1789
4744
  categoryListUrl: getBlogCategoryListUrl(),
1790
4745
  submitForm,
1791
4746
  isSubmitting,
1792
- moduleConfig
4747
+ moduleConfig,
4748
+ // SEO
4749
+ imageScenario,
4750
+ handleSeoFieldGroupChange,
4751
+ // Tabs
4752
+ tabList,
4753
+ selectedTabId,
1793
4754
  };
1794
4755
  },
1795
4756
  });
@@ -1826,123 +4787,162 @@ var __vue_render__$3 = function () {
1826
4787
  },
1827
4788
  },
1828
4789
  [
1829
- _vm.isCreation && _vm.isLangSpecific
1830
- ? _c("form-field-select", {
1831
- attrs: {
1832
- name: "language",
1833
- label: _vm.$t("blog:language"),
1834
- options: _vm.languageOptionList,
1835
- error: _vm.errors.language,
1836
- },
1837
- model: {
1838
- value: _vm.values.language,
1839
- callback: function ($$v) {
1840
- _vm.$set(_vm.values, "language", $$v);
4790
+ _vm.isCreation
4791
+ ? [
4792
+ _vm.isLangSpecific
4793
+ ? _c("form-field-select", {
4794
+ attrs: {
4795
+ name: "language",
4796
+ label: _vm.$t("blog:language"),
4797
+ options: _vm.languageOptionList,
4798
+ error: _vm.errors.language,
4799
+ },
4800
+ model: {
4801
+ value: _vm.values.language,
4802
+ callback: function ($$v) {
4803
+ _vm.$set(_vm.values, "language", $$v);
4804
+ },
4805
+ expression: "values.language",
4806
+ },
4807
+ })
4808
+ : _vm._e(),
4809
+ _vm._v(" "),
4810
+ _c("form-field", {
4811
+ attrs: {
4812
+ name: "name",
4813
+ label: _vm.$t("blog:name"),
4814
+ error: _vm.errors.name,
1841
4815
  },
1842
- expression: "values.language",
1843
- },
1844
- })
1845
- : _vm._e(),
1846
- _vm._v(" "),
1847
- _c("form-field", {
1848
- attrs: {
1849
- name: "name",
1850
- label: _vm.$t("blog:name"),
1851
- error: _vm.errors.name,
1852
- },
1853
- model: {
1854
- value: _vm.values.name,
1855
- callback: function ($$v) {
1856
- _vm.$set(_vm.values, "name", $$v);
1857
- },
1858
- expression: "values.name",
1859
- },
1860
- }),
1861
- _vm._v(" "),
1862
- _c("form-field-checkbox", {
1863
- attrs: {
1864
- name: "isDefault",
1865
- label: _vm.$t("blog:defaultCategory"),
1866
- error: _vm.errors.isDefault,
1867
- },
1868
- model: {
1869
- value: _vm.values.isDefault,
1870
- callback: function ($$v) {
1871
- _vm.$set(_vm.values, "isDefault", $$v);
1872
- },
1873
- expression: "values.isDefault",
1874
- },
1875
- }),
1876
- _vm._v(" "),
1877
- !_vm.isCreation
1878
- ? _c("form-field-url-alias-input", {
1879
- attrs: {
1880
- id: "urlAlias",
1881
- name: "urlAlias",
1882
- label: _vm.$t("blog:URLAlias"),
1883
- "url-template": _vm.pagePath,
1884
- error: _vm.errors.urlAlias,
1885
- },
1886
- model: {
1887
- value: _vm.values.urlAlias,
1888
- callback: function ($$v) {
1889
- _vm.$set(_vm.values, "urlAlias", $$v);
4816
+ model: {
4817
+ value: _vm.values.name,
4818
+ callback: function ($$v) {
4819
+ _vm.$set(_vm.values, "name", $$v);
4820
+ },
4821
+ expression: "values.name",
1890
4822
  },
1891
- expression: "values.urlAlias",
1892
- },
1893
- })
1894
- : _vm._e(),
1895
- _vm._v(" "),
1896
- _c("form-field", {
1897
- attrs: {
1898
- name: "pageTitle",
1899
- label: _vm.$t("blog:pageTitle"),
1900
- error: _vm.errors.pageTitle,
1901
- },
1902
- model: {
1903
- value: _vm.values.pageTitle,
1904
- callback: function ($$v) {
1905
- _vm.$set(_vm.values, "pageTitle", $$v);
1906
- },
1907
- expression: "values.pageTitle",
1908
- },
1909
- }),
1910
- _vm._v(" "),
1911
- _c("form-field", {
1912
- attrs: {
1913
- name: "pageDescription",
1914
- label: _vm.$t("blog:pageDescription"),
1915
- type: "textarea",
1916
- error: _vm.errors.pageDescription,
1917
- },
1918
- model: {
1919
- value: _vm.values.pageDescription,
1920
- callback: function ($$v) {
1921
- _vm.$set(_vm.values, "pageDescription", $$v);
1922
- },
1923
- expression: "values.pageDescription",
1924
- },
1925
- }),
1926
- _vm._v(" "),
1927
- _c("form-field-file-input", {
1928
- attrs: {
1929
- label: _vm.$t("blog:openGraphImage"),
1930
- name: "openGraphImage",
1931
- "file-type": "image",
1932
- "image-scenario": _vm.moduleConfig
1933
- ? _vm.moduleConfig.fileScenarios.openGraph
1934
- : null,
1935
- },
1936
- model: {
1937
- value: _vm.values.openGraphImage,
1938
- callback: function ($$v) {
1939
- _vm.$set(_vm.values, "openGraphImage", $$v);
1940
- },
1941
- expression: "values.openGraphImage",
1942
- },
1943
- }),
4823
+ }),
4824
+ _vm._v(" "),
4825
+ _c("form-field-checkbox", {
4826
+ attrs: {
4827
+ name: "isDefault",
4828
+ label: _vm.$t("blog:defaultCategory"),
4829
+ error: _vm.errors.isDefault,
4830
+ },
4831
+ model: {
4832
+ value: _vm.values.isDefault,
4833
+ callback: function ($$v) {
4834
+ _vm.$set(_vm.values, "isDefault", $$v);
4835
+ },
4836
+ expression: "values.isDefault",
4837
+ },
4838
+ }),
4839
+ _vm._v(" "),
4840
+ _c("form-field-url-alias-input", {
4841
+ attrs: {
4842
+ id: "urlAlias",
4843
+ name: "urlAlias",
4844
+ label: _vm.$t("blog:URLAlias"),
4845
+ "url-template": _vm.pagePath,
4846
+ error: _vm.errors.urlAlias,
4847
+ },
4848
+ model: {
4849
+ value: _vm.values.urlAlias,
4850
+ callback: function ($$v) {
4851
+ _vm.$set(_vm.values, "urlAlias", $$v);
4852
+ },
4853
+ expression: "values.urlAlias",
4854
+ },
4855
+ }),
4856
+ ]
4857
+ : [
4858
+ _c("tab-list", {
4859
+ attrs: {
4860
+ "tab-list": _vm.tabList,
4861
+ "selected-tab-id": _vm.selectedTabId,
4862
+ },
4863
+ on: {
4864
+ "tab:update": function ($event) {
4865
+ _vm.selectedTabId = $event.tabId;
4866
+ },
4867
+ },
4868
+ }),
4869
+ _vm._v(" "),
4870
+ _vm.selectedTabId === "common"
4871
+ ? [
4872
+ _c("form-field", {
4873
+ attrs: {
4874
+ name: "name",
4875
+ label: _vm.$t("blog:name"),
4876
+ error: _vm.errors.name,
4877
+ },
4878
+ model: {
4879
+ value: _vm.values.name,
4880
+ callback: function ($$v) {
4881
+ _vm.$set(_vm.values, "name", $$v);
4882
+ },
4883
+ expression: "values.name",
4884
+ },
4885
+ }),
4886
+ _vm._v(" "),
4887
+ _c("form-field-checkbox", {
4888
+ attrs: {
4889
+ name: "isDefault",
4890
+ label: _vm.$t("blog:defaultCategory"),
4891
+ error: _vm.errors.isDefault,
4892
+ },
4893
+ model: {
4894
+ value: _vm.values.isDefault,
4895
+ callback: function ($$v) {
4896
+ _vm.$set(_vm.values, "isDefault", $$v);
4897
+ },
4898
+ expression: "values.isDefault",
4899
+ },
4900
+ }),
4901
+ _vm._v(" "),
4902
+ _c("form-field-url-alias-input", {
4903
+ attrs: {
4904
+ id: "urlAlias",
4905
+ name: "urlAlias",
4906
+ label: _vm.$t("blog:URLAlias"),
4907
+ "url-template": _vm.pagePath,
4908
+ error: _vm.errors.urlAlias,
4909
+ },
4910
+ model: {
4911
+ value: _vm.values.urlAlias,
4912
+ callback: function ($$v) {
4913
+ _vm.$set(_vm.values, "urlAlias", $$v);
4914
+ },
4915
+ expression: "values.urlAlias",
4916
+ },
4917
+ }),
4918
+ ]
4919
+ : _vm._e(),
4920
+ _vm._v(" "),
4921
+ _vm.selectedTabId === "seo"
4922
+ ? [
4923
+ _c("seo-field-group", {
4924
+ attrs: {
4925
+ title: _vm.values.pageTitle,
4926
+ "title-error-message": _vm.errors.pageTitle,
4927
+ description: _vm.values.pageDescription,
4928
+ "description-error-message":
4929
+ _vm.errors.pageDescription,
4930
+ "should-display-keywords": false,
4931
+ keywords: _vm.values.pageKeywords,
4932
+ "keywords-error-message":
4933
+ _vm.errors.pageKeywords,
4934
+ image: _vm.values.openGraphImage,
4935
+ "image-scenario": _vm.imageScenario,
4936
+ "image-error-message":
4937
+ _vm.errors.openGraphImage,
4938
+ },
4939
+ on: { change: _vm.handleSeoFieldGroupChange },
4940
+ }),
4941
+ ]
4942
+ : _vm._e(),
4943
+ ],
1944
4944
  ],
1945
- 1
4945
+ 2
1946
4946
  ),
1947
4947
  ]
1948
4948
  },
@@ -1972,17 +4972,15 @@ var __vue_staticRenderFns__$3 = [];
1972
4972
  __vue_render__$3._withStripped = true;
1973
4973
 
1974
4974
  /* style */
1975
- const __vue_inject_styles__$3 = function (inject) {
1976
- if (!inject) return
1977
- inject("data-v-a60477f6_0", { source: "\n\n/*# sourceMappingURL=BlogCategoryForm.vue.map */", map: {"version":3,"sources":["BlogCategoryForm.vue"],"names":[],"mappings":";;AAEA,+CAA+C","file":"BlogCategoryForm.vue"}, media: undefined });
1978
-
1979
- };
4975
+ const __vue_inject_styles__$3 = undefined;
1980
4976
  /* scoped */
1981
- const __vue_scope_id__$3 = "data-v-a60477f6";
4977
+ const __vue_scope_id__$3 = undefined;
1982
4978
  /* module identifier */
1983
4979
  const __vue_module_identifier__$3 = undefined;
1984
4980
  /* functional template */
1985
4981
  const __vue_is_functional_template__$3 = false;
4982
+ /* style inject */
4983
+
1986
4984
  /* style inject SSR */
1987
4985
 
1988
4986
  /* style inject shadow dom */
@@ -1997,153 +4995,7 @@ __vue_render__$3._withStripped = true;
1997
4995
  __vue_is_functional_template__$3,
1998
4996
  __vue_module_identifier__$3,
1999
4997
  false,
2000
- createInjector,
2001
4998
  undefined,
2002
- undefined
2003
- );
2004
-
2005
- function convertBlogSettingsToFormValues(settingItemList) {
2006
- return settingItemList.map((settingItem) => universalFieldUtils.createFormField(settingItem.field, settingItem.value));
2007
- }
2008
- function convertSettingValuesToRequestPayload(values) {
2009
- return {
2010
- values: values.map((field) => ({
2011
- name: field.config.name,
2012
- value: universalFieldUtils.getOutgoingValue(field),
2013
- })),
2014
- };
2015
- }
2016
-
2017
- var script$4 = defineComponent({
2018
- name: 'BlogSettings',
2019
- components: { DynamicField },
2020
- setup(props, context) {
2021
- const [fetchSettingList, { data: settingList, loading }] = useResource({
2022
- fetchResource: getBlogSettingList,
2023
- initialValue: [],
2024
- context,
2025
- resourceName: 'Settings',
2026
- });
2027
- onMounted(() => {
2028
- fetchSettingList();
2029
- });
2030
- const isSubmitting = ref(false);
2031
- const values = ref(convertBlogSettingsToFormValues(settingList.value));
2032
- watch(settingList, () => {
2033
- values.value = convertBlogSettingsToFormValues(settingList.value);
2034
- });
2035
- const errors = ref({});
2036
- function submitForm({ shouldExit }) {
2037
- isSubmitting.value = true;
2038
- const body = convertSettingValuesToRequestPayload(values.value);
2039
- updateBlogSettingList(body)
2040
- .then(() => {
2041
- errors.value = {};
2042
- if (shouldExit) {
2043
- context.root.$router.push(getBlogPostListUrl());
2044
- }
2045
- context.root.$toast({
2046
- variant: 'success',
2047
- title: context.root.$t('blog:success'),
2048
- body: context.root.$t('blog:blogSettingsHaveBeenSuccessfullyUpdated'),
2049
- });
2050
- })
2051
- .catch((error) => {
2052
- console.error(error);
2053
- errors.value = convertRequestErrorToMap(error);
2054
- context.root.$toast({
2055
- variant: 'danger',
2056
- title: context.root.$t('blog:error'),
2057
- body: context.root.$t('blog:blogSettingsUpdateHasBeenFailed'),
2058
- });
2059
- })
2060
- .finally(() => {
2061
- isSubmitting.value = false;
2062
- });
2063
- }
2064
- return { isContentLoading: loading, submitForm, isSubmitting, values };
2065
- },
2066
- });
2067
-
2068
- /* script */
2069
- const __vue_script__$4 = script$4;
2070
-
2071
- /* template */
2072
- var __vue_render__$4 = function () {
2073
- var _vm = this;
2074
- var _h = _vm.$createElement;
2075
- var _c = _vm._self._c || _h;
2076
- return _c("page", {
2077
- attrs: {
2078
- title: _vm.$t("blog:blogSettings"),
2079
- "is-content-loading": _vm.isContentLoading,
2080
- footer: {
2081
- backHref: "/",
2082
- onSubmit: _vm.submitForm,
2083
- isSubmitting: _vm.isSubmitting,
2084
- },
2085
- },
2086
- scopedSlots: _vm._u([
2087
- {
2088
- key: "content",
2089
- fn: function () {
2090
- return [
2091
- _c(
2092
- "form",
2093
- {
2094
- attrs: { novalidate: "" },
2095
- on: {
2096
- submit: function ($event) {
2097
- $event.preventDefault();
2098
- return _vm.submitForm($event)
2099
- },
2100
- },
2101
- },
2102
- _vm._l(_vm.values, function (field) {
2103
- return _c("DynamicField", {
2104
- key: field.config.name,
2105
- attrs: { field: field },
2106
- })
2107
- }),
2108
- 1
2109
- ),
2110
- ]
2111
- },
2112
- proxy: true,
2113
- },
2114
- ]),
2115
- })
2116
- };
2117
- var __vue_staticRenderFns__$4 = [];
2118
- __vue_render__$4._withStripped = true;
2119
-
2120
- /* style */
2121
- const __vue_inject_styles__$4 = function (inject) {
2122
- if (!inject) return
2123
- inject("data-v-dc003c44_0", { source: "\n\n/*# sourceMappingURL=BlogSettings.vue.map */", map: {"version":3,"sources":["BlogSettings.vue"],"names":[],"mappings":";;AAEA,2CAA2C","file":"BlogSettings.vue"}, media: undefined });
2124
-
2125
- };
2126
- /* scoped */
2127
- const __vue_scope_id__$4 = "data-v-dc003c44";
2128
- /* module identifier */
2129
- const __vue_module_identifier__$4 = undefined;
2130
- /* functional template */
2131
- const __vue_is_functional_template__$4 = false;
2132
- /* style inject SSR */
2133
-
2134
- /* style inject shadow dom */
2135
-
2136
-
2137
-
2138
- const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
2139
- { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
2140
- __vue_inject_styles__$4,
2141
- __vue_script__$4,
2142
- __vue_scope_id__$4,
2143
- __vue_is_functional_template__$4,
2144
- __vue_module_identifier__$4,
2145
- false,
2146
- createInjector,
2147
4999
  undefined,
2148
5000
  undefined
2149
5001
  );
@@ -2193,17 +5045,6 @@ const BLOG_CATEGORY_FORM_ROUTE = {
2193
5045
  { url: route.path, text: t('blog:categoryForm') },
2194
5046
  ],
2195
5047
  },
2196
- };
2197
- const BLOG_SETTINGS_ROUTE = {
2198
- path: BLOG_ROUTE_PATHS.SETTINGS,
2199
- component: __vue_component__$4,
2200
- name: 'Settings',
2201
- meta: {
2202
- getBreadcrumbs: (route, t) => [
2203
- { url: '/', text: t('blog:home') },
2204
- { url: getBlogSettingsUrl(), text: t('blog:blogSettings') },
2205
- ],
2206
- },
2207
5048
  };
2208
5049
 
2209
5050
  function getBlogMenuItem(params) {
@@ -2222,7 +5063,6 @@ function getBlogMenuItem(params) {
2222
5063
  url: getBlogCategoryFormUrl({ categoryId: 'create' }),
2223
5064
  },
2224
5065
  { text: params.t('blog:categories'), url: getBlogCategoryListUrl() },
2225
- { text: params.t('blog:settings'), url: getBlogSettingsUrl() },
2226
5066
  ],
2227
5067
  };
2228
5068
  }
@@ -2230,4 +5070,4 @@ function getBlogMenuItem(params) {
2230
5070
  i18n.addTranslations('en', 'blog', EN);
2231
5071
  i18n.addTranslations('ru', 'blog', RU);
2232
5072
 
2233
- export { BLOG_CATEGORY_FORM_ROUTE, BLOG_CATEGORY_LIST_ROUTE, BLOG_POST_FORM_ROUTE, BLOG_POST_LIST_ROUTE, BLOG_ROUTE_PATHS, BLOG_SETTINGS_ROUTE, createBlogCategory, createBlogPost, deleteBlogCategory, deleteBlogPost, getBlogCategory, getBlogCategoryFormUrl, getBlogCategoryList, getBlogCategoryListUrl, getBlogMenuItem, getBlogModuleConfig, getBlogPost, getBlogPostCount, getBlogPostFormUrl, getBlogPostList, getBlogPostListUrl, getBlogSettingList, getBlogSettingsUrl, moveBlogCategory, updateBlogCategory, updateBlogPost, updateBlogSettingList };
5073
+ export { BLOG_CATEGORY_FORM_ROUTE, BLOG_CATEGORY_LIST_ROUTE, BLOG_POST_FORM_ROUTE, BLOG_POST_LIST_ROUTE, BLOG_ROUTE_PATHS, clonePost, createBlogCategory, createBlogPost, deleteBlogCategory, deleteBlogPost, getBlogCategory, getBlogCategoryFormUrl, getBlogCategoryList, getBlogCategoryListUrl, getBlogMenuItem, getBlogModuleConfig, getBlogPost, getBlogPostCount, getBlogPostFormUrl, getBlogPostList, getBlogPostListUrl, getUserProfile, moveBlogCategory, updateBlogCategory, updateBlogPost };