@zengenti/contensis-react-base 3.0.0-beta.6 → 3.0.0-beta.62

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 (164) hide show
  1. package/README.md +4 -4
  2. package/cjs/{App-3324f784.js → App-6e2518eb.js} +204 -174
  3. package/cjs/App-6e2518eb.js.map +1 -0
  4. package/cjs/{RouteLoader-c7957b14.js → RouteLoader-2675e1c9.js} +31 -23
  5. package/cjs/RouteLoader-2675e1c9.js.map +1 -0
  6. package/cjs/ToJs-a9a8522b.js +129 -0
  7. package/cjs/ToJs-a9a8522b.js.map +1 -0
  8. package/cjs/VersionInfo-4c9dfa6a.js +181 -0
  9. package/cjs/VersionInfo-4c9dfa6a.js.map +1 -0
  10. package/cjs/{actions-a24bf46e.js → actions-8dc9e8de.js} +5 -4
  11. package/cjs/actions-8dc9e8de.js.map +1 -0
  12. package/cjs/client.js +16 -21
  13. package/cjs/client.js.map +1 -1
  14. package/cjs/contensis-react-base.js +3583 -38
  15. package/cjs/contensis-react-base.js.map +1 -1
  16. package/cjs/forms.js +4114 -195
  17. package/cjs/forms.js.map +1 -1
  18. package/cjs/{fromJSLeaveImmer-c00d597f.js → fromJSLeaveImmer-e74c673c.js} +2 -16
  19. package/cjs/fromJSLeaveImmer-e74c673c.js.map +1 -0
  20. package/cjs/{login-c810cc4c.js → login-6b9de6a1.js} +92 -55
  21. package/cjs/login-6b9de6a1.js.map +1 -0
  22. package/cjs/{reducers-fde41d6b.js → reducers-3a4f8971.js} +26 -25
  23. package/cjs/reducers-3a4f8971.js.map +1 -0
  24. package/cjs/redux.js +6 -5
  25. package/cjs/redux.js.map +1 -1
  26. package/cjs/routing.js +5 -4
  27. package/cjs/routing.js.map +1 -1
  28. package/cjs/sagas-8cf21563.js +2038 -0
  29. package/cjs/sagas-8cf21563.js.map +1 -0
  30. package/cjs/search.js +280 -1907
  31. package/cjs/search.js.map +1 -1
  32. package/cjs/{selectors-0ec95076.js → selectors-656da4b7.js} +8 -3
  33. package/cjs/selectors-656da4b7.js.map +1 -0
  34. package/cjs/user.js +21 -12
  35. package/cjs/user.js.map +1 -1
  36. package/cjs/util.js +55 -212
  37. package/cjs/util.js.map +1 -1
  38. package/cjs/{version-4f0f5fa6.js → version-b3e55cdf.js} +28 -20
  39. package/cjs/version-b3e55cdf.js.map +1 -0
  40. package/cjs/{version-085d203d.js → version-eba6d09b.js} +5 -5
  41. package/cjs/version-eba6d09b.js.map +1 -0
  42. package/esm/{App-1b05ab11.js → App-5efba16c.js} +204 -175
  43. package/esm/App-5efba16c.js.map +1 -0
  44. package/esm/{RouteLoader-e5f0e8cb.js → RouteLoader-f96a61c1.js} +31 -23
  45. package/esm/RouteLoader-f96a61c1.js.map +1 -0
  46. package/esm/ToJs-affd73f1.js +99 -0
  47. package/esm/ToJs-affd73f1.js.map +1 -0
  48. package/esm/VersionInfo-f5403b09.js +172 -0
  49. package/esm/VersionInfo-f5403b09.js.map +1 -0
  50. package/esm/{actions-927d9698.js → actions-fcfc8704.js} +5 -4
  51. package/esm/actions-fcfc8704.js.map +1 -0
  52. package/esm/client.js +17 -22
  53. package/esm/client.js.map +1 -1
  54. package/esm/contensis-react-base.js +3581 -37
  55. package/esm/contensis-react-base.js.map +1 -1
  56. package/esm/forms.js +4114 -198
  57. package/esm/forms.js.map +1 -1
  58. package/esm/{fromJSLeaveImmer-392af4e3.js → fromJSLeaveImmer-0114ffcf.js} +2 -16
  59. package/esm/fromJSLeaveImmer-0114ffcf.js.map +1 -0
  60. package/esm/{login-f8ba3aeb.js → login-ca2dc2f7.js} +92 -55
  61. package/esm/login-ca2dc2f7.js.map +1 -0
  62. package/esm/{reducers-d6c0edb1.js → reducers-8e5d6232.js} +26 -25
  63. package/esm/reducers-8e5d6232.js.map +1 -0
  64. package/esm/redux.js +8 -7
  65. package/esm/redux.js.map +1 -1
  66. package/esm/routing.js +5 -4
  67. package/esm/routing.js.map +1 -1
  68. package/esm/sagas-a22fc54a.js +1952 -0
  69. package/esm/sagas-a22fc54a.js.map +1 -0
  70. package/esm/search.js +240 -1848
  71. package/esm/search.js.map +1 -1
  72. package/esm/{selectors-b98d5c76.js → selectors-337be432.js} +7 -4
  73. package/esm/selectors-337be432.js.map +1 -0
  74. package/esm/user.js +23 -14
  75. package/esm/user.js.map +1 -1
  76. package/esm/util.js +54 -209
  77. package/esm/util.js.map +1 -1
  78. package/esm/{version-16aa83eb.js → version-470f0b15.js} +27 -20
  79. package/esm/version-470f0b15.js.map +1 -0
  80. package/esm/version-6dd7b2cd.js +15 -0
  81. package/esm/version-6dd7b2cd.js.map +1 -0
  82. package/models/app/pages/VersionInfo/components/VersionInfo.d.ts +1 -1
  83. package/models/forms/index.d.ts +2 -0
  84. package/models/index.d.ts +1 -0
  85. package/models/redux/appstate.d.ts +5 -10
  86. package/models/redux/selectors/navigation.d.ts +2 -1
  87. package/models/routing/components/RouteLoader.d.ts +2 -19
  88. package/models/routing/redux/actions.d.ts +1 -1
  89. package/models/routing/redux/selectors.d.ts +1 -1
  90. package/models/routing/routes.d.ts +9 -3
  91. package/models/routing/util/expressions.d.ts +3 -2
  92. package/models/routing/util/queries.d.ts +1 -1
  93. package/models/search/containers/withListing.d.ts +1 -1
  94. package/models/search/containers/withSearch.d.ts +1 -1
  95. package/models/search/hooks/useFacets.hook.d.ts +3 -0
  96. package/models/search/hooks/useListing.hook.d.ts +3 -0
  97. package/models/search/hooks/useMinilist.hook.d.ts +2 -9
  98. package/models/search/index.d.ts +4 -1
  99. package/models/search/models/Queries.d.ts +8 -5
  100. package/models/search/models/Search.d.ts +60 -28
  101. package/models/search/models/SearchActions.d.ts +4 -3
  102. package/models/search/models/SearchProps.d.ts +52 -7
  103. package/models/search/models/SearchState.d.ts +5 -1
  104. package/models/search/models/index.d.ts +3 -1
  105. package/models/search/redux/actions.d.ts +2 -1
  106. package/models/search/redux/reducers.d.ts +230 -314
  107. package/models/search/redux/sagas.d.ts +5 -5
  108. package/models/search/redux/selectors.d.ts +19 -22
  109. package/models/search/search/ContensisDeliveryApi.d.ts +1 -0
  110. package/models/search/search/expressions.d.ts +3 -6
  111. package/models/search/{redux → search}/queries.d.ts +0 -0
  112. package/models/search/transformations/entry-to-filteritem.mapper.d.ts +2 -1
  113. package/models/search/transformations/filter-to-filterexpression.mapper.d.ts +6 -0
  114. package/models/search/transformations/filters-to-filterexpressions.mapper.d.ts +3 -0
  115. package/models/search/transformations/index.d.ts +3 -0
  116. package/models/search/transformations/queryParams-to-customapi.mapper.d.ts +3 -0
  117. package/models/search/transformations/state-to-searchuri.d.ts +2 -13
  118. package/models/server/features/linkdepth-api/api.d.ts +12 -0
  119. package/models/server/features/linkdepth-api/events-api.config.d.ts +37 -0
  120. package/models/server/middleware/bundleManipulation.d.ts +2 -1
  121. package/models/server/util/headers.d.ts +3 -2
  122. package/models/user/components/Login.d.ts +1 -2
  123. package/models/user/components/LoginForm.d.ts +1 -2
  124. package/models/user/hocs/withLogin.d.ts +4 -2
  125. package/models/user/hocs/withRegistration.d.ts +4 -2
  126. package/models/user/hooks/useChangePassword.d.ts +5 -5
  127. package/models/user/hooks/useForgotPassword.d.ts +6 -6
  128. package/models/user/hooks/useLogin.d.ts +9 -45
  129. package/models/user/hooks/useRegistration.d.ts +4 -4
  130. package/models/user/redux/reducers.d.ts +4 -5
  131. package/models/user/redux/sagas/login.d.ts +11 -8
  132. package/models/user/redux/selectors.d.ts +33 -71
  133. package/models/user/util/LoginHelper.class.d.ts +4 -3
  134. package/models/util/ContensisDeliveryApi.d.ts +1 -3
  135. package/models/util/json-mapper.d.ts +9 -3
  136. package/models/util/merge.d.ts +1 -0
  137. package/package-lock.json +2690 -3400
  138. package/package.json +60 -55
  139. package/cjs/App-3324f784.js.map +0 -1
  140. package/cjs/RouteLoader-c7957b14.js.map +0 -1
  141. package/cjs/ToJs-a38fa20e.js +0 -230
  142. package/cjs/ToJs-a38fa20e.js.map +0 -1
  143. package/cjs/actions-a24bf46e.js.map +0 -1
  144. package/cjs/fromJSLeaveImmer-c00d597f.js.map +0 -1
  145. package/cjs/login-c810cc4c.js.map +0 -1
  146. package/cjs/reducers-fde41d6b.js.map +0 -1
  147. package/cjs/selectors-0ec95076.js.map +0 -1
  148. package/cjs/version-085d203d.js.map +0 -1
  149. package/cjs/version-4f0f5fa6.js.map +0 -1
  150. package/esm/App-1b05ab11.js.map +0 -1
  151. package/esm/RouteLoader-e5f0e8cb.js.map +0 -1
  152. package/esm/ToJs-879a5a85.js +0 -199
  153. package/esm/ToJs-879a5a85.js.map +0 -1
  154. package/esm/actions-927d9698.js.map +0 -1
  155. package/esm/fromJSLeaveImmer-392af4e3.js.map +0 -1
  156. package/esm/login-f8ba3aeb.js.map +0 -1
  157. package/esm/reducers-d6c0edb1.js.map +0 -1
  158. package/esm/selectors-b98d5c76.js.map +0 -1
  159. package/esm/version-16aa83eb.js.map +0 -1
  160. package/esm/version-3833e8b5.js +0 -15
  161. package/esm/version-3833e8b5.js.map +0 -1
  162. package/models/search/transformations/filters-to-filterexpression.d.ts +0 -1
  163. package/models/search/transformations/filters-to-filterexpression.mapper.d.ts +0 -2
  164. package/models/server/features/caching/cacheHashing.d.ts +0 -1
@@ -2,56 +2,469 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var contensisCoreApi = require('contensis-core-api');
6
+ var React = require('react');
7
+ var reactRedux = require('react-redux');
8
+ var sagas = require('./sagas-8cf21563.js');
9
+ var mapJson = require('jsonpath-mapper');
10
+ require('reselect');
11
+ require('deepmerge');
12
+ require('query-string');
13
+ require('immer');
14
+ require('deep-equal');
15
+ var VersionInfo = require('./VersionInfo-4c9dfa6a.js');
16
+ var App = require('./App-6e2518eb.js');
5
17
  require('isomorphic-fetch');
6
18
  var express = require('express');
7
19
  var httpProxy = require('http-proxy');
8
20
  var fs = require('fs');
9
21
  var path = require('path');
10
22
  var appRootPath = require('app-root-path');
11
- var React = require('react');
12
23
  var server$1 = require('react-dom/server');
13
24
  var reactRouterDom = require('react-router-dom');
14
- var reactRedux = require('react-redux');
15
25
  var reactRouterConfig = require('react-router-config');
16
26
  var reactHelmet = require('react-helmet');
17
27
  var styled = require('styled-components');
18
- var serialize = require('serialize-javascript');
28
+ var serialize$1 = require('serialize-javascript');
19
29
  var minifyCssString = require('minify-css-string');
20
- var mapJson = require('jsonpath-mapper');
21
30
  var server = require('@loadable/server');
22
- var version = require('./version-4f0f5fa6.js');
23
- var App = require('./App-3324f784.js');
24
- var actions = require('./actions-a24bf46e.js');
25
- var selectors = require('./selectors-0ec95076.js');
31
+ var lodash = require('lodash');
32
+ var lodashClean = require('lodash-clean');
33
+ var reactCookie = require('react-cookie');
34
+ var version = require('./version-b3e55cdf.js');
35
+ var actions = require('./actions-8dc9e8de.js');
36
+ var selectors = require('./selectors-656da4b7.js');
37
+ require('loglevel');
26
38
  require('@redux-saga/core/effects');
27
- require('redux');
28
- require('redux-thunk');
29
- require('redux-saga');
30
- require('redux-injectors');
31
- require('immer');
32
- require('./reducers-fde41d6b.js');
33
- require('history');
34
39
  require('contensis-delivery-api');
35
- require('./version-085d203d.js');
36
- require('loglevel');
37
- require('./login-c810cc4c.js');
38
- require('./ToJs-a38fa20e.js');
40
+ require('./version-eba6d09b.js');
41
+ require('history');
42
+ require('./login-6b9de6a1.js');
43
+ require('./reducers-3a4f8971.js');
44
+ require('./ToJs-a9a8522b.js');
39
45
  require('await-to-js');
40
46
  require('js-cookie');
41
47
  require('react-hot-loader');
42
- require('query-string');
43
- require('./RouteLoader-c7957b14.js');
48
+ require('./RouteLoader-2675e1c9.js');
49
+ require('redux');
50
+ require('redux-thunk');
51
+ require('redux-saga');
52
+ require('redux-injectors');
44
53
 
45
54
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
46
55
 
56
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
57
+ var mapJson__default = /*#__PURE__*/_interopDefaultLegacy(mapJson);
47
58
  var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
48
59
  var httpProxy__default = /*#__PURE__*/_interopDefaultLegacy(httpProxy);
49
60
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
50
61
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
51
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
52
- var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
62
+ var serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize$1);
53
63
  var minifyCssString__default = /*#__PURE__*/_interopDefaultLegacy(minifyCssString);
54
- var mapJson__default = /*#__PURE__*/_interopDefaultLegacy(mapJson);
64
+
65
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
66
+
67
+ /**
68
+ * Make a LinkDepth api at the uri specified in middlewareConfig.
69
+ * The api supports a GET request and specified filters are supplied as query-string parameters.
70
+ * The response should be a normal Delivery API response.
71
+ * @param app Express app instance
72
+ * @param middlewareConfig Middleware configuration that represents the content types we want to search within, any filters that are required and any linkFields we wish to search within to derive a set of search results from the entries that contain the linkFields. Each key inside of linkFields represents another "linkDepth" of entries and we can specify all the same contentTypeId, filters, and linkFields of their own. There is no currently no limit on how deep these linkFields can go
73
+ * @returns Returns nothing if uri, contentTypeId or linkFields is not set in middlewareConfig
74
+ */
75
+ const makeLinkDepthApi = (app, middlewareConfig) => {
76
+ const {
77
+ uri,
78
+ contentTypeId,
79
+ linkFields
80
+ } = middlewareConfig;
81
+ if (!contentTypeId || !linkFields || !uri) return;
82
+ app.get(uri, makeLinkDepthMiddleware(middlewareConfig));
83
+ };
84
+ /** Create a content type hierarchy from supplied config and produces
85
+ * a RequestHandler function to serve our Express middleware */
86
+
87
+
88
+ const makeLinkDepthMiddleware = ({
89
+ contentTypeId,
90
+ filters,
91
+ sharedFilters,
92
+ linkFields
93
+ }) => {
94
+ try {
95
+ // Recursive function to flatten and index a provided nested config
96
+ const returnFieldIdKeys = (obj, level = 1) => {
97
+ var _Object$entries$map;
98
+
99
+ if (!obj) return {};
100
+ const mappedConfig = Object.entries(obj).map(([k, v]) => ({
101
+ contentTypeIds: Array.isArray(v.contentTypeId) ? v.contentTypeId : [v.contentTypeId || k],
102
+ fieldId: k,
103
+ filters: v.filters,
104
+ sharedFilters: v.sharedFilters
105
+ }));
106
+ const inner = (_Object$entries$map = Object.entries(obj).map(([k, v]) => returnFieldIdKeys(v.linkFields, level + 1))) === null || _Object$entries$map === void 0 ? void 0 : _Object$entries$map[0];
107
+ return {
108
+ [level]: mappedConfig,
109
+ ...inner
110
+ };
111
+ };
112
+
113
+ const others = returnFieldIdKeys(linkFields); // Level 0 is read from the top-level of config
114
+
115
+ const contentTypeHierarchy = {
116
+ 0: [{
117
+ contentTypeIds: Array.isArray(contentTypeId) ? contentTypeId : [contentTypeId],
118
+ filters,
119
+ sharedFilters
120
+ }],
121
+ ...others
122
+ }; // The runtime express request handler
123
+
124
+ const linkDepthMiddleware = async (req, res) => {
125
+ try {
126
+ // Short cache duration copied from canterbury project
127
+ VersionInfo.setCachingHeaders(res, {
128
+ cacheControl: 'private',
129
+ surrogateControl: '10'
130
+ }); // Run our queries and provide a final result
131
+ // our params are sourced from the query-string
132
+
133
+ const result = await searchEventsTopDown(contentTypeHierarchy, req.query); // const result = await searchLinkDepthEntries(
134
+ // contentTypeHierarchy,
135
+ // req.query
136
+ // );
137
+
138
+ res.json(result);
139
+ } catch (error) {
140
+ // This is a runtime error encountered when processing a given request
141
+ console.error(error);
142
+ res.statusCode = 500;
143
+ res.json(error);
144
+ }
145
+ };
146
+
147
+ return linkDepthMiddleware;
148
+ } catch (error) {
149
+ // This will be an error building the middleware
150
+ // we can only serve what the error was as the request handler instead
151
+ console.error(error);
152
+
153
+ const errorMiddleware = async (req, res) => {
154
+ res.statusCode = 500;
155
+ res.json(JSON.stringify(error));
156
+ };
157
+
158
+ return errorMiddleware;
159
+ }
160
+ };
161
+
162
+ const getVarsFromConfig = (config, params) => {
163
+ // Build variables from query config to use in our Delivery API Query
164
+ const contentTypeIds = config.map(c => c.contentTypeIds).flat(); // Filters are the filters we are looking to include with the Query at this level
165
+
166
+ let filters = {}; // Shared filters are filters that share the same querystring key and are valid in multiple levels
167
+
168
+ let sharedFilters = {};
169
+ config.forEach(c => {
170
+ filters = { ...filters,
171
+ ...c.filters
172
+ };
173
+ sharedFilters = { ...sharedFilters,
174
+ ...c.sharedFilters
175
+ };
176
+ }); // FieldIds are the field name(s) in the parent/current entry that the
177
+ // entries are linked to, used to surface the next level based on id
178
+ // retrieved at the previous level
179
+
180
+ const fieldIds = config.map(c => c.fieldId).flat();
181
+ const queryFilters = makeFilterExpressions(filters, params);
182
+ const sharedQueryFilters = makeFilterExpressions(sharedFilters, params);
183
+ return {
184
+ contentTypeIds,
185
+ fieldIds,
186
+ filters,
187
+ queryFilters,
188
+ sharedFilters,
189
+ sharedQueryFilters
190
+ };
191
+ };
192
+
193
+ const makeDerivedIdsFilterExpression = (level, resultsAtLevel, ownIds = false, useFieldIds = false) => {
194
+ const previouslyDerivedIdsFilter = [];
195
+ const [prevFieldId, entries] = resultsAtLevel[level];
196
+ const prevKey = prevFieldId;
197
+ const prevResultIds = Util.GetIds(entries, useFieldIds ? prevFieldId : undefined);
198
+ if (prevKey && (prevResultIds === null || prevResultIds === void 0 ? void 0 : prevResultIds.length) > 0) previouslyDerivedIdsFilter.push({
199
+ key: ownIds ? 'sys.id' : `${prevFieldId}.sys.id`,
200
+ values: prevResultIds,
201
+ fieldOperator: 'in'
202
+ });else previouslyDerivedIdsFilter.push({
203
+ key: 'dud',
204
+ values: ['1'],
205
+ fieldOperator: 'in'
206
+ });
207
+ return previouslyDerivedIdsFilter;
208
+ };
209
+
210
+ const searchEventsTopDown = async (contentTypeHierarchy, params) => {
211
+ // Determine linkDepth for the final query by how many levels are in
212
+ // the contentTypeHierarchy object
213
+ const linkDepth = Object.keys(contentTypeHierarchy).length - 1 || 0; // Pre-size our results array to the size of our hierarchy
214
+
215
+ const resultsAtLevel = Object.values(contentTypeHierarchy).map((v, i, a) => {
216
+ const fieldId = i === 0 ? a[i + 1][0] : v[0];
217
+ return [fieldId.fieldId, []];
218
+ }); // [fieldId, results][]
219
+
220
+ for (const [level, levelConfig] of Object.entries(contentTypeHierarchy)) {
221
+ // LinkDepth level / current index
222
+ const currentLevel = Number(level); // Build variables from query config to use in our Delivery API Query
223
+
224
+ const {
225
+ contentTypeIds,
226
+ fieldIds,
227
+ queryFilters,
228
+ sharedQueryFilters
229
+ } = getVarsFromConfig(levelConfig, params); // We won't have fetched any derived results to
230
+ // include as a field filter with the very first query
231
+
232
+ let previouslyDerivedIdsFilter = [];
233
+
234
+ if (currentLevel !== 0) {
235
+ previouslyDerivedIdsFilter = makeDerivedIdsFilterExpression(currentLevel - 1, resultsAtLevel, true, true);
236
+ }
237
+
238
+ const query = searchQuery({
239
+ contentTypeIds,
240
+ filters: queryFilters,
241
+ idFilters: previouslyDerivedIdsFilter,
242
+ sharedFilters: sharedQueryFilters,
243
+ versionStatus: params.versionStatus || 'published'
244
+ }); // These are all sub-queries, we only want ids returned in these to include
245
+ // them to filter by in our next level(s) queries, along with any other filters
246
+ // configured and found at this level
247
+
248
+ query.fields = currentLevel === 0 ? [] : ['sys.id']; // Scalability limitation for today
249
+
250
+ query.pageSize = 2000;
251
+ const levelQueryResult = await App.cachedSearch.searchUsingPost(query, 0);
252
+ resultsAtLevel[currentLevel][1] = Util.GetItems(levelQueryResult);
253
+ } // Build and run our final query containing all results
254
+
255
+
256
+ const {
257
+ contentTypeIds,
258
+ queryFilters,
259
+ sharedQueryFilters
260
+ } = getVarsFromConfig(Object.values(contentTypeHierarchy)[0], params);
261
+ const previouslyDerivedIdsFilter = makeDerivedIdsFilterExpression(1, resultsAtLevel);
262
+ const query = finalQuery({
263
+ contentTypeIds,
264
+ filters: queryFilters,
265
+ idFilters: previouslyDerivedIdsFilter,
266
+ sharedFilters: sharedQueryFilters,
267
+ versionStatus: params.versionStatus || 'published'
268
+ }, Object.entries(contentTypeHierarchy).filter(([k]) => k !== '0').map(([level, levelConfig]) => {
269
+ // LinkDepth level / current index
270
+ const currentLevel = Number(level); // Build variables from query config to use in our Delivery API Query
271
+
272
+ const {
273
+ contentTypeIds,
274
+ queryFilters,
275
+ sharedQueryFilters
276
+ } = getVarsFromConfig(levelConfig, params);
277
+ const previousIdsFilter = makeDerivedIdsFilterExpression(currentLevel, resultsAtLevel, true);
278
+ return {
279
+ contentTypeIds,
280
+ filters: queryFilters,
281
+ idFilters: previousIdsFilter,
282
+ sharedFilters: sharedQueryFilters,
283
+ versionStatus: params.versionStatus || 'published'
284
+ };
285
+ })); // This is the final query to be run and response returned to the caller
286
+ // Only this bit cares about linkDepth, fields and pagination parameters
287
+
288
+ query.fields = JSON.parse(params.fields || '[]');
289
+ query.pageSize = params.pageSize;
290
+ query.pageIndex = params.pageIndex;
291
+ query.orderBy = params.orderBy; // console.log(JSON.stringify(query.toJSON()));
292
+
293
+ const finalQueryResult = await App.cachedSearch.searchUsingPost(query, linkDepth);
294
+ const entriesWithResolvedParents = await resolveParentEntries(contentTypeIds, Array.from(new Set(resultsAtLevel[1][1].map(e => e.sys.contentTypeId || ''))), resultsAtLevel[0][0], Util.GetItems(finalQueryResult), params);
295
+ return { ...finalQueryResult,
296
+ items: entriesWithResolvedParents
297
+ };
298
+ };
299
+
300
+ const resolveParentEntries = async (parentContentTypeIds, replaceContentTypeIds, parentFieldId, results, params) => {
301
+ // Build variables from query config to use in our Delivery API Query
302
+ const previousIdsFilter = makeDerivedIdsFilterExpression(0, [[parentFieldId, results]]);
303
+ const query = searchQuery({
304
+ contentTypeIds: parentContentTypeIds,
305
+ idFilters: previousIdsFilter
306
+ });
307
+ query.fields = JSON.parse(params.fields || '[]');
308
+ console.log(JSON.stringify(query.toJSON()));
309
+ const parentResults = await App.cachedSearch.search(query, 0);
310
+ return mergeResults(results, Util.GetItems(parentResults), replaceContentTypeIds, parentFieldId);
311
+ };
312
+
313
+ const mergeResults = (results, parentResults, replaceContentTypeIds, linkFieldId) => results.map(r => {
314
+ if (replaceContentTypeIds.some(c => c === r.sys.contentTypeId)) {
315
+ const resolvedParent = parentResults === null || parentResults === void 0 ? void 0 : parentResults.find(e => {
316
+ var _e$linkFieldId;
317
+
318
+ return (_e$linkFieldId = e[linkFieldId]) === null || _e$linkFieldId === void 0 ? void 0 : _e$linkFieldId.some(l => {
319
+ var _l$sys;
320
+
321
+ return ((_l$sys = l.sys) === null || _l$sys === void 0 ? void 0 : _l$sys.id) === r.sys.id;
322
+ });
323
+ });
324
+ if (resolvedParent) return { ...resolvedParent,
325
+ ...r,
326
+ entryTitle: resolvedParent.entryTitle,
327
+ entryDescription: resolvedParent.entryDescription,
328
+ sys: resolvedParent.sys,
329
+ originalSys: r.sys
330
+ };else return r;
331
+ }
332
+
333
+ return r;
334
+ }).filter(r => r);
335
+
336
+ const finalQuery = ({
337
+ assetTypes,
338
+ contentTypeIds,
339
+ fields,
340
+ filters,
341
+ idFilters,
342
+ sharedFilters,
343
+ pageSize,
344
+ pageIndex,
345
+ orderBy,
346
+ searchTerm,
347
+ versionStatus = 'published',
348
+ webpageTemplates,
349
+ weightedSearchFields
350
+ }, children) => {
351
+ const expressions$1 = [...sagas.defaultExpressions(versionStatus), contensisCoreApi.Op.or(contensisCoreApi.Op.and(...sagas.contentTypeIdExpression(contentTypeIds, webpageTemplates, assetTypes), ...sagas.filterExpressions(filters), contensisCoreApi.Op.or(...sagas.filterExpressions(sharedFilters) // Op.and(
352
+ // ...sharedFilters.map(sf =>
353
+ // Op.not(exp.fieldExpression(sf.key, true, 'exists')[0])
354
+ // ),
355
+ // ...exp.filterExpressions(idFilters)
356
+ // )
357
+ )), ...children.map(child => contensisCoreApi.Op.and(...sagas.contentTypeIdExpression(child.contentTypeIds, child.webpageTemplates, child.assetTypes), ...sagas.filterExpressions(child.sharedFilters), ...sagas.filterExpressions(child.idFilters)))), ...sagas.termExpressions(searchTerm, weightedSearchFields)];
358
+ const query = new contensisCoreApi.Query(...expressions$1);
359
+ query.orderBy = sagas.orderByExpression(orderBy);
360
+
361
+ if (fields && fields.length > 0) {
362
+ query.fields = fields;
363
+ } // (query as any).includeArchived = true;
364
+ // (query as any).includeDeleted = true;
365
+
366
+
367
+ query.pageIndex = pageIndex;
368
+ query.pageSize = pageSize;
369
+ return query;
370
+ };
371
+ /**
372
+ * Create a filter expression from a provided filters configuration object
373
+ * and populate them based on the presence of that key in params, filter
374
+ * out any filter keys that do not have a value set in params
375
+ * @param f filters configuration from any level
376
+ * @param params request.query object from Express middleware
377
+ * @returns FilterExpression[] we can use to use with searchQuery function
378
+ */
379
+
380
+
381
+ const makeFilterExpressions = (f, params) => Object.entries(f).map(([paramKey, filterConfig]) => {
382
+ var _params$paramKey;
383
+
384
+ const filterValues = (_params$paramKey = params[paramKey]) === null || _params$paramKey === void 0 ? void 0 : _params$paramKey.split(',');
385
+ return typeof filterValues !== 'undefined' ? {
386
+ key: typeof filterConfig === 'object' ? filterConfig.fieldId : filterConfig,
387
+ values: filterValues,
388
+ fieldOperator: typeof filterConfig === 'object' ? filterConfig.fieldOperator : 'equalTo',
389
+ logicOperator: typeof filterConfig === 'object' ? filterConfig.logicOperator : 'or'
390
+ } : null;
391
+ }).filter(o => o);
392
+ /**
393
+ * Builds our complete Delivery API Query object from a set of provided arguments
394
+ * @param queryParams
395
+ * @returns Delivery API Query
396
+ */
397
+
398
+
399
+ const searchQuery = ({
400
+ assetTypes,
401
+ contentTypeIds,
402
+ customWhere,
403
+ fields,
404
+ filters,
405
+ idFilters,
406
+ sharedFilters,
407
+ pageSize,
408
+ pageIndex,
409
+ orderBy,
410
+ searchTerm,
411
+ versionStatus = 'published',
412
+ webpageTemplates,
413
+ weightedSearchFields
414
+ }) => {
415
+ const expressions$1 = [...sagas.defaultExpressions(versionStatus), ...sagas.contentTypeIdExpression(contentTypeIds, webpageTemplates, assetTypes), ...sagas.customWhereExpressions(customWhere), ...sagas.filterExpressions(filters), ...sagas.filterExpressions(idFilters), ...((sharedFilters === null || sharedFilters === void 0 ? void 0 : sharedFilters.length) > 0 ? [contensisCoreApi.Op.or(...sagas.filterExpressions(sharedFilters, true))] : []), ...sagas.termExpressions(searchTerm, weightedSearchFields)];
416
+ const query = new contensisCoreApi.Query(...expressions$1);
417
+ query.orderBy = sagas.orderByExpression(orderBy);
418
+
419
+ if (fields && fields.length > 0) {
420
+ query.fields = fields;
421
+ } // (query as any).includeArchived = true;
422
+ // (query as any).includeDeleted = true;
423
+
424
+
425
+ query.pageIndex = pageIndex;
426
+ query.pageSize = pageSize;
427
+ return query;
428
+ };
429
+ /**
430
+ * Util class holds our search results helper boilerplate methods
431
+ */
432
+
433
+
434
+ class Util {
435
+ static GetIds(entries, fieldId) {
436
+ if (fieldId) {
437
+ return entries.map(e => {
438
+ var _e$fieldId, _e$fieldId2, _e$fieldId2$sys;
439
+
440
+ return Array.isArray(e === null || e === void 0 ? void 0 : e[fieldId]) ? e === null || e === void 0 ? void 0 : (_e$fieldId = e[fieldId]) === null || _e$fieldId === void 0 ? void 0 : _e$fieldId.map(f => {
441
+ var _f$sys;
442
+
443
+ return f === null || f === void 0 ? void 0 : (_f$sys = f.sys) === null || _f$sys === void 0 ? void 0 : _f$sys.id;
444
+ }) : (e === null || e === void 0 ? void 0 : (_e$fieldId2 = e[fieldId]) === null || _e$fieldId2 === void 0 ? void 0 : (_e$fieldId2$sys = _e$fieldId2.sys) === null || _e$fieldId2$sys === void 0 ? void 0 : _e$fieldId2$sys.id) || '';
445
+ }).flat();
446
+ }
447
+
448
+ return entries.map(e => {
449
+ var _e$sys;
450
+
451
+ return (e === null || e === void 0 ? void 0 : (_e$sys = e.sys) === null || _e$sys === void 0 ? void 0 : _e$sys.id) || '';
452
+ });
453
+ }
454
+
455
+ static GetItems(result) {
456
+ return this.GetResults(result) ? result.items : [];
457
+ }
458
+
459
+ static GetResults(result) {
460
+ if (result !== null && result !== void 0 && result.items) {
461
+ return result;
462
+ } else {
463
+ return null;
464
+ }
465
+ }
466
+
467
+ }
55
468
 
56
469
  const servers$1 = SERVERS;
57
470
  /* global SERVERS */
@@ -70,6 +483,7 @@ const DisplayStartupConfiguration = config => {
70
483
  console.log();
71
484
  console.log('Reverse proxy paths: ', JSON.stringify(config.reverseProxyPaths, null, 2));
72
485
  console.log();
486
+ if (config.staticFolderPath) console.log(`Serving static assets from: "/dist/${config.staticFolderPath}/"`);
73
487
  /* eslint-enable no-console */
74
488
  };
75
489
 
@@ -130,6 +544,7 @@ const replaceStaticPath = (str, staticFolderPath = 'static') => str.replace(/sta
130
544
  const bundleManipulationMiddleware = ({
131
545
  appRootPath,
132
546
  maxage,
547
+ staticFolderPath,
133
548
  staticRoutePath
134
549
  }) => (req, res, next) => {
135
550
  const filename = path__default["default"].basename(req.path);
@@ -137,7 +552,7 @@ const bundleManipulationMiddleware = ({
137
552
  const legacyBundle = filename.endsWith('.js');
138
553
 
139
554
  if ((legacyBundle || modernBundle) && filename.startsWith('runtime.')) {
140
- const jsRuntimeLocation = path__default["default"].resolve(appRootPath, `dist/static/${modernBundle ? 'modern/js' : 'legacy/js'}/${filename}`);
555
+ const jsRuntimeLocation = path__default["default"].resolve(appRootPath, `dist/${staticFolderPath}/${modernBundle ? 'modern/js' : 'legacy/js'}/${filename}`);
141
556
 
142
557
  try {
143
558
  const jsRuntimeBundle = fs__default["default"].readFileSync(jsRuntimeLocation, 'utf8');
@@ -167,13 +582,22 @@ const resolveStartupMiddleware = ({
167
582
  maxage,
168
583
  staticFolderPath,
169
584
  startupScriptFilename
170
- }) => (req, res, next) => {
585
+ }) => async (req, res, next) => {
171
586
  if (startupScriptFilename !== 'startup.js' && req.path === `/${startupScriptFilename}`) {
172
- const startupFilePath = `dist/${staticFolderPath}/startup.js`;
173
- const startupFileLocation = path__default["default"].resolve(appRootPath, startupFilePath);
174
- if (maxage) res.set('Cache-Control', `public, max-age=${maxage}`);
587
+ let startupFileLocation = '';
175
588
 
176
589
  try {
590
+ const startupFilePaths = [`dist/static/startup.js`, `dist/${staticFolderPath}/startup.js`];
591
+ let startupFilePath = '';
592
+ startupFilePaths.forEach(async testPath => {
593
+ try {
594
+ fs__default["default"].accessSync(testPath);
595
+ startupFilePath = testPath;
596
+ } catch (ex) {// Do nothing
597
+ }
598
+ });
599
+ startupFileLocation = path__default["default"].resolve(appRootPath, startupFilePath);
600
+ if (maxage) res.set('Cache-Control', `public, max-age=${maxage}`);
177
601
  res.sendFile(startupFileLocation);
178
602
  } catch (sendFileError) {
179
603
  // eslint-disable-next-line no-console
@@ -199,6 +623,7 @@ const staticAssets = (app, {
199
623
  // these maxage values are different in config but the same in runtime,
200
624
  // this one is the true value in seconds
201
625
  maxage: CacheDuration.static,
626
+ staticFolderPath,
202
627
  staticRoutePath
203
628
  }), resolveStartupMiddleware({
204
629
  appRootPath: appRootPath$1,
@@ -213,6 +638,3114 @@ const staticAssets = (app, {
213
638
  }));
214
639
  };
215
640
 
641
+ /**
642
+ * Removes all key-value entries from the list cache.
643
+ *
644
+ * @private
645
+ * @name clear
646
+ * @memberOf ListCache
647
+ */
648
+
649
+ function listCacheClear$1() {
650
+ this.__data__ = [];
651
+ this.size = 0;
652
+ }
653
+
654
+ var _listCacheClear = listCacheClear$1;
655
+
656
+ /**
657
+ * Performs a
658
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
659
+ * comparison between two values to determine if they are equivalent.
660
+ *
661
+ * @static
662
+ * @memberOf _
663
+ * @since 4.0.0
664
+ * @category Lang
665
+ * @param {*} value The value to compare.
666
+ * @param {*} other The other value to compare.
667
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
668
+ * @example
669
+ *
670
+ * var object = { 'a': 1 };
671
+ * var other = { 'a': 1 };
672
+ *
673
+ * _.eq(object, object);
674
+ * // => true
675
+ *
676
+ * _.eq(object, other);
677
+ * // => false
678
+ *
679
+ * _.eq('a', 'a');
680
+ * // => true
681
+ *
682
+ * _.eq('a', Object('a'));
683
+ * // => false
684
+ *
685
+ * _.eq(NaN, NaN);
686
+ * // => true
687
+ */
688
+
689
+ function eq$2(value, other) {
690
+ return value === other || (value !== value && other !== other);
691
+ }
692
+
693
+ var eq_1 = eq$2;
694
+
695
+ var eq$1 = eq_1;
696
+
697
+ /**
698
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
699
+ *
700
+ * @private
701
+ * @param {Array} array The array to inspect.
702
+ * @param {*} key The key to search for.
703
+ * @returns {number} Returns the index of the matched value, else `-1`.
704
+ */
705
+ function assocIndexOf$4(array, key) {
706
+ var length = array.length;
707
+ while (length--) {
708
+ if (eq$1(array[length][0], key)) {
709
+ return length;
710
+ }
711
+ }
712
+ return -1;
713
+ }
714
+
715
+ var _assocIndexOf = assocIndexOf$4;
716
+
717
+ var assocIndexOf$3 = _assocIndexOf;
718
+
719
+ /** Used for built-in method references. */
720
+ var arrayProto = Array.prototype;
721
+
722
+ /** Built-in value references. */
723
+ var splice = arrayProto.splice;
724
+
725
+ /**
726
+ * Removes `key` and its value from the list cache.
727
+ *
728
+ * @private
729
+ * @name delete
730
+ * @memberOf ListCache
731
+ * @param {string} key The key of the value to remove.
732
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
733
+ */
734
+ function listCacheDelete$1(key) {
735
+ var data = this.__data__,
736
+ index = assocIndexOf$3(data, key);
737
+
738
+ if (index < 0) {
739
+ return false;
740
+ }
741
+ var lastIndex = data.length - 1;
742
+ if (index == lastIndex) {
743
+ data.pop();
744
+ } else {
745
+ splice.call(data, index, 1);
746
+ }
747
+ --this.size;
748
+ return true;
749
+ }
750
+
751
+ var _listCacheDelete = listCacheDelete$1;
752
+
753
+ var assocIndexOf$2 = _assocIndexOf;
754
+
755
+ /**
756
+ * Gets the list cache value for `key`.
757
+ *
758
+ * @private
759
+ * @name get
760
+ * @memberOf ListCache
761
+ * @param {string} key The key of the value to get.
762
+ * @returns {*} Returns the entry value.
763
+ */
764
+ function listCacheGet$1(key) {
765
+ var data = this.__data__,
766
+ index = assocIndexOf$2(data, key);
767
+
768
+ return index < 0 ? undefined : data[index][1];
769
+ }
770
+
771
+ var _listCacheGet = listCacheGet$1;
772
+
773
+ var assocIndexOf$1 = _assocIndexOf;
774
+
775
+ /**
776
+ * Checks if a list cache value for `key` exists.
777
+ *
778
+ * @private
779
+ * @name has
780
+ * @memberOf ListCache
781
+ * @param {string} key The key of the entry to check.
782
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
783
+ */
784
+ function listCacheHas$1(key) {
785
+ return assocIndexOf$1(this.__data__, key) > -1;
786
+ }
787
+
788
+ var _listCacheHas = listCacheHas$1;
789
+
790
+ var assocIndexOf = _assocIndexOf;
791
+
792
+ /**
793
+ * Sets the list cache `key` to `value`.
794
+ *
795
+ * @private
796
+ * @name set
797
+ * @memberOf ListCache
798
+ * @param {string} key The key of the value to set.
799
+ * @param {*} value The value to set.
800
+ * @returns {Object} Returns the list cache instance.
801
+ */
802
+ function listCacheSet$1(key, value) {
803
+ var data = this.__data__,
804
+ index = assocIndexOf(data, key);
805
+
806
+ if (index < 0) {
807
+ ++this.size;
808
+ data.push([key, value]);
809
+ } else {
810
+ data[index][1] = value;
811
+ }
812
+ return this;
813
+ }
814
+
815
+ var _listCacheSet = listCacheSet$1;
816
+
817
+ var listCacheClear = _listCacheClear,
818
+ listCacheDelete = _listCacheDelete,
819
+ listCacheGet = _listCacheGet,
820
+ listCacheHas = _listCacheHas,
821
+ listCacheSet = _listCacheSet;
822
+
823
+ /**
824
+ * Creates an list cache object.
825
+ *
826
+ * @private
827
+ * @constructor
828
+ * @param {Array} [entries] The key-value pairs to cache.
829
+ */
830
+ function ListCache$4(entries) {
831
+ var index = -1,
832
+ length = entries == null ? 0 : entries.length;
833
+
834
+ this.clear();
835
+ while (++index < length) {
836
+ var entry = entries[index];
837
+ this.set(entry[0], entry[1]);
838
+ }
839
+ }
840
+
841
+ // Add methods to `ListCache`.
842
+ ListCache$4.prototype.clear = listCacheClear;
843
+ ListCache$4.prototype['delete'] = listCacheDelete;
844
+ ListCache$4.prototype.get = listCacheGet;
845
+ ListCache$4.prototype.has = listCacheHas;
846
+ ListCache$4.prototype.set = listCacheSet;
847
+
848
+ var _ListCache = ListCache$4;
849
+
850
+ var ListCache$3 = _ListCache;
851
+
852
+ /**
853
+ * Removes all key-value entries from the stack.
854
+ *
855
+ * @private
856
+ * @name clear
857
+ * @memberOf Stack
858
+ */
859
+ function stackClear$1() {
860
+ this.__data__ = new ListCache$3;
861
+ this.size = 0;
862
+ }
863
+
864
+ var _stackClear = stackClear$1;
865
+
866
+ /**
867
+ * Removes `key` and its value from the stack.
868
+ *
869
+ * @private
870
+ * @name delete
871
+ * @memberOf Stack
872
+ * @param {string} key The key of the value to remove.
873
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
874
+ */
875
+
876
+ function stackDelete$1(key) {
877
+ var data = this.__data__,
878
+ result = data['delete'](key);
879
+
880
+ this.size = data.size;
881
+ return result;
882
+ }
883
+
884
+ var _stackDelete = stackDelete$1;
885
+
886
+ /**
887
+ * Gets the stack value for `key`.
888
+ *
889
+ * @private
890
+ * @name get
891
+ * @memberOf Stack
892
+ * @param {string} key The key of the value to get.
893
+ * @returns {*} Returns the entry value.
894
+ */
895
+
896
+ function stackGet$1(key) {
897
+ return this.__data__.get(key);
898
+ }
899
+
900
+ var _stackGet = stackGet$1;
901
+
902
+ /**
903
+ * Checks if a stack value for `key` exists.
904
+ *
905
+ * @private
906
+ * @name has
907
+ * @memberOf Stack
908
+ * @param {string} key The key of the entry to check.
909
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
910
+ */
911
+
912
+ function stackHas$1(key) {
913
+ return this.__data__.has(key);
914
+ }
915
+
916
+ var _stackHas = stackHas$1;
917
+
918
+ /** Detect free variable `global` from Node.js. */
919
+
920
+ var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
921
+
922
+ var _freeGlobal = freeGlobal$1;
923
+
924
+ var freeGlobal = _freeGlobal;
925
+
926
+ /** Detect free variable `self`. */
927
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
928
+
929
+ /** Used as a reference to the global object. */
930
+ var root$8 = freeGlobal || freeSelf || Function('return this')();
931
+
932
+ var _root = root$8;
933
+
934
+ var root$7 = _root;
935
+
936
+ /** Built-in value references. */
937
+ var Symbol$3 = root$7.Symbol;
938
+
939
+ var _Symbol = Symbol$3;
940
+
941
+ var Symbol$2 = _Symbol;
942
+
943
+ /** Used for built-in method references. */
944
+ var objectProto$c = Object.prototype;
945
+
946
+ /** Used to check objects for own properties. */
947
+ var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
948
+
949
+ /**
950
+ * Used to resolve the
951
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
952
+ * of values.
953
+ */
954
+ var nativeObjectToString$1 = objectProto$c.toString;
955
+
956
+ /** Built-in value references. */
957
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
958
+
959
+ /**
960
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
961
+ *
962
+ * @private
963
+ * @param {*} value The value to query.
964
+ * @returns {string} Returns the raw `toStringTag`.
965
+ */
966
+ function getRawTag$1(value) {
967
+ var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
968
+ tag = value[symToStringTag$1];
969
+
970
+ try {
971
+ value[symToStringTag$1] = undefined;
972
+ var unmasked = true;
973
+ } catch (e) {}
974
+
975
+ var result = nativeObjectToString$1.call(value);
976
+ if (unmasked) {
977
+ if (isOwn) {
978
+ value[symToStringTag$1] = tag;
979
+ } else {
980
+ delete value[symToStringTag$1];
981
+ }
982
+ }
983
+ return result;
984
+ }
985
+
986
+ var _getRawTag = getRawTag$1;
987
+
988
+ /** Used for built-in method references. */
989
+
990
+ var objectProto$b = Object.prototype;
991
+
992
+ /**
993
+ * Used to resolve the
994
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
995
+ * of values.
996
+ */
997
+ var nativeObjectToString = objectProto$b.toString;
998
+
999
+ /**
1000
+ * Converts `value` to a string using `Object.prototype.toString`.
1001
+ *
1002
+ * @private
1003
+ * @param {*} value The value to convert.
1004
+ * @returns {string} Returns the converted string.
1005
+ */
1006
+ function objectToString$1(value) {
1007
+ return nativeObjectToString.call(value);
1008
+ }
1009
+
1010
+ var _objectToString = objectToString$1;
1011
+
1012
+ var Symbol$1 = _Symbol,
1013
+ getRawTag = _getRawTag,
1014
+ objectToString = _objectToString;
1015
+
1016
+ /** `Object#toString` result references. */
1017
+ var nullTag = '[object Null]',
1018
+ undefinedTag = '[object Undefined]';
1019
+
1020
+ /** Built-in value references. */
1021
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
1022
+
1023
+ /**
1024
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1025
+ *
1026
+ * @private
1027
+ * @param {*} value The value to query.
1028
+ * @returns {string} Returns the `toStringTag`.
1029
+ */
1030
+ function baseGetTag$4(value) {
1031
+ if (value == null) {
1032
+ return value === undefined ? undefinedTag : nullTag;
1033
+ }
1034
+ return (symToStringTag && symToStringTag in Object(value))
1035
+ ? getRawTag(value)
1036
+ : objectToString(value);
1037
+ }
1038
+
1039
+ var _baseGetTag = baseGetTag$4;
1040
+
1041
+ /**
1042
+ * Checks if `value` is the
1043
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1044
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1045
+ *
1046
+ * @static
1047
+ * @memberOf _
1048
+ * @since 0.1.0
1049
+ * @category Lang
1050
+ * @param {*} value The value to check.
1051
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1052
+ * @example
1053
+ *
1054
+ * _.isObject({});
1055
+ * // => true
1056
+ *
1057
+ * _.isObject([1, 2, 3]);
1058
+ * // => true
1059
+ *
1060
+ * _.isObject(_.noop);
1061
+ * // => true
1062
+ *
1063
+ * _.isObject(null);
1064
+ * // => false
1065
+ */
1066
+
1067
+ function isObject$5(value) {
1068
+ var type = typeof value;
1069
+ return value != null && (type == 'object' || type == 'function');
1070
+ }
1071
+
1072
+ var isObject_1 = isObject$5;
1073
+
1074
+ var baseGetTag$3 = _baseGetTag,
1075
+ isObject$4 = isObject_1;
1076
+
1077
+ /** `Object#toString` result references. */
1078
+ var asyncTag = '[object AsyncFunction]',
1079
+ funcTag$2 = '[object Function]',
1080
+ genTag$1 = '[object GeneratorFunction]',
1081
+ proxyTag = '[object Proxy]';
1082
+
1083
+ /**
1084
+ * Checks if `value` is classified as a `Function` object.
1085
+ *
1086
+ * @static
1087
+ * @memberOf _
1088
+ * @since 0.1.0
1089
+ * @category Lang
1090
+ * @param {*} value The value to check.
1091
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1092
+ * @example
1093
+ *
1094
+ * _.isFunction(_);
1095
+ * // => true
1096
+ *
1097
+ * _.isFunction(/abc/);
1098
+ * // => false
1099
+ */
1100
+ function isFunction$2(value) {
1101
+ if (!isObject$4(value)) {
1102
+ return false;
1103
+ }
1104
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1105
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1106
+ var tag = baseGetTag$3(value);
1107
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
1108
+ }
1109
+
1110
+ var isFunction_1 = isFunction$2;
1111
+
1112
+ var root$6 = _root;
1113
+
1114
+ /** Used to detect overreaching core-js shims. */
1115
+ var coreJsData$1 = root$6['__core-js_shared__'];
1116
+
1117
+ var _coreJsData = coreJsData$1;
1118
+
1119
+ var coreJsData = _coreJsData;
1120
+
1121
+ /** Used to detect methods masquerading as native. */
1122
+ var maskSrcKey = (function() {
1123
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1124
+ return uid ? ('Symbol(src)_1.' + uid) : '';
1125
+ }());
1126
+
1127
+ /**
1128
+ * Checks if `func` has its source masked.
1129
+ *
1130
+ * @private
1131
+ * @param {Function} func The function to check.
1132
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1133
+ */
1134
+ function isMasked$1(func) {
1135
+ return !!maskSrcKey && (maskSrcKey in func);
1136
+ }
1137
+
1138
+ var _isMasked = isMasked$1;
1139
+
1140
+ /** Used for built-in method references. */
1141
+
1142
+ var funcProto$1 = Function.prototype;
1143
+
1144
+ /** Used to resolve the decompiled source of functions. */
1145
+ var funcToString$1 = funcProto$1.toString;
1146
+
1147
+ /**
1148
+ * Converts `func` to its source code.
1149
+ *
1150
+ * @private
1151
+ * @param {Function} func The function to convert.
1152
+ * @returns {string} Returns the source code.
1153
+ */
1154
+ function toSource$2(func) {
1155
+ if (func != null) {
1156
+ try {
1157
+ return funcToString$1.call(func);
1158
+ } catch (e) {}
1159
+ try {
1160
+ return (func + '');
1161
+ } catch (e) {}
1162
+ }
1163
+ return '';
1164
+ }
1165
+
1166
+ var _toSource = toSource$2;
1167
+
1168
+ var isFunction$1 = isFunction_1,
1169
+ isMasked = _isMasked,
1170
+ isObject$3 = isObject_1,
1171
+ toSource$1 = _toSource;
1172
+
1173
+ /**
1174
+ * Used to match `RegExp`
1175
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1176
+ */
1177
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1178
+
1179
+ /** Used to detect host constructors (Safari). */
1180
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1181
+
1182
+ /** Used for built-in method references. */
1183
+ var funcProto = Function.prototype,
1184
+ objectProto$a = Object.prototype;
1185
+
1186
+ /** Used to resolve the decompiled source of functions. */
1187
+ var funcToString = funcProto.toString;
1188
+
1189
+ /** Used to check objects for own properties. */
1190
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1191
+
1192
+ /** Used to detect if a method is native. */
1193
+ var reIsNative = RegExp('^' +
1194
+ funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
1195
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1196
+ );
1197
+
1198
+ /**
1199
+ * The base implementation of `_.isNative` without bad shim checks.
1200
+ *
1201
+ * @private
1202
+ * @param {*} value The value to check.
1203
+ * @returns {boolean} Returns `true` if `value` is a native function,
1204
+ * else `false`.
1205
+ */
1206
+ function baseIsNative$1(value) {
1207
+ if (!isObject$3(value) || isMasked(value)) {
1208
+ return false;
1209
+ }
1210
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
1211
+ return pattern.test(toSource$1(value));
1212
+ }
1213
+
1214
+ var _baseIsNative = baseIsNative$1;
1215
+
1216
+ /**
1217
+ * Gets the value at `key` of `object`.
1218
+ *
1219
+ * @private
1220
+ * @param {Object} [object] The object to query.
1221
+ * @param {string} key The key of the property to get.
1222
+ * @returns {*} Returns the property value.
1223
+ */
1224
+
1225
+ function getValue$1(object, key) {
1226
+ return object == null ? undefined : object[key];
1227
+ }
1228
+
1229
+ var _getValue = getValue$1;
1230
+
1231
+ var baseIsNative = _baseIsNative,
1232
+ getValue = _getValue;
1233
+
1234
+ /**
1235
+ * Gets the native function at `key` of `object`.
1236
+ *
1237
+ * @private
1238
+ * @param {Object} object The object to query.
1239
+ * @param {string} key The key of the method to get.
1240
+ * @returns {*} Returns the function if it's native, else `undefined`.
1241
+ */
1242
+ function getNative$7(object, key) {
1243
+ var value = getValue(object, key);
1244
+ return baseIsNative(value) ? value : undefined;
1245
+ }
1246
+
1247
+ var _getNative = getNative$7;
1248
+
1249
+ var getNative$6 = _getNative,
1250
+ root$5 = _root;
1251
+
1252
+ /* Built-in method references that are verified to be native. */
1253
+ var Map$3 = getNative$6(root$5, 'Map');
1254
+
1255
+ var _Map = Map$3;
1256
+
1257
+ var getNative$5 = _getNative;
1258
+
1259
+ /* Built-in method references that are verified to be native. */
1260
+ var nativeCreate$4 = getNative$5(Object, 'create');
1261
+
1262
+ var _nativeCreate = nativeCreate$4;
1263
+
1264
+ var nativeCreate$3 = _nativeCreate;
1265
+
1266
+ /**
1267
+ * Removes all key-value entries from the hash.
1268
+ *
1269
+ * @private
1270
+ * @name clear
1271
+ * @memberOf Hash
1272
+ */
1273
+ function hashClear$1() {
1274
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
1275
+ this.size = 0;
1276
+ }
1277
+
1278
+ var _hashClear = hashClear$1;
1279
+
1280
+ /**
1281
+ * Removes `key` and its value from the hash.
1282
+ *
1283
+ * @private
1284
+ * @name delete
1285
+ * @memberOf Hash
1286
+ * @param {Object} hash The hash to modify.
1287
+ * @param {string} key The key of the value to remove.
1288
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1289
+ */
1290
+
1291
+ function hashDelete$1(key) {
1292
+ var result = this.has(key) && delete this.__data__[key];
1293
+ this.size -= result ? 1 : 0;
1294
+ return result;
1295
+ }
1296
+
1297
+ var _hashDelete = hashDelete$1;
1298
+
1299
+ var nativeCreate$2 = _nativeCreate;
1300
+
1301
+ /** Used to stand-in for `undefined` hash values. */
1302
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1303
+
1304
+ /** Used for built-in method references. */
1305
+ var objectProto$9 = Object.prototype;
1306
+
1307
+ /** Used to check objects for own properties. */
1308
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1309
+
1310
+ /**
1311
+ * Gets the hash value for `key`.
1312
+ *
1313
+ * @private
1314
+ * @name get
1315
+ * @memberOf Hash
1316
+ * @param {string} key The key of the value to get.
1317
+ * @returns {*} Returns the entry value.
1318
+ */
1319
+ function hashGet$1(key) {
1320
+ var data = this.__data__;
1321
+ if (nativeCreate$2) {
1322
+ var result = data[key];
1323
+ return result === HASH_UNDEFINED$1 ? undefined : result;
1324
+ }
1325
+ return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
1326
+ }
1327
+
1328
+ var _hashGet = hashGet$1;
1329
+
1330
+ var nativeCreate$1 = _nativeCreate;
1331
+
1332
+ /** Used for built-in method references. */
1333
+ var objectProto$8 = Object.prototype;
1334
+
1335
+ /** Used to check objects for own properties. */
1336
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1337
+
1338
+ /**
1339
+ * Checks if a hash value for `key` exists.
1340
+ *
1341
+ * @private
1342
+ * @name has
1343
+ * @memberOf Hash
1344
+ * @param {string} key The key of the entry to check.
1345
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1346
+ */
1347
+ function hashHas$1(key) {
1348
+ var data = this.__data__;
1349
+ return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
1350
+ }
1351
+
1352
+ var _hashHas = hashHas$1;
1353
+
1354
+ var nativeCreate = _nativeCreate;
1355
+
1356
+ /** Used to stand-in for `undefined` hash values. */
1357
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
1358
+
1359
+ /**
1360
+ * Sets the hash `key` to `value`.
1361
+ *
1362
+ * @private
1363
+ * @name set
1364
+ * @memberOf Hash
1365
+ * @param {string} key The key of the value to set.
1366
+ * @param {*} value The value to set.
1367
+ * @returns {Object} Returns the hash instance.
1368
+ */
1369
+ function hashSet$1(key, value) {
1370
+ var data = this.__data__;
1371
+ this.size += this.has(key) ? 0 : 1;
1372
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
1373
+ return this;
1374
+ }
1375
+
1376
+ var _hashSet = hashSet$1;
1377
+
1378
+ var hashClear = _hashClear,
1379
+ hashDelete = _hashDelete,
1380
+ hashGet = _hashGet,
1381
+ hashHas = _hashHas,
1382
+ hashSet = _hashSet;
1383
+
1384
+ /**
1385
+ * Creates a hash object.
1386
+ *
1387
+ * @private
1388
+ * @constructor
1389
+ * @param {Array} [entries] The key-value pairs to cache.
1390
+ */
1391
+ function Hash$1(entries) {
1392
+ var index = -1,
1393
+ length = entries == null ? 0 : entries.length;
1394
+
1395
+ this.clear();
1396
+ while (++index < length) {
1397
+ var entry = entries[index];
1398
+ this.set(entry[0], entry[1]);
1399
+ }
1400
+ }
1401
+
1402
+ // Add methods to `Hash`.
1403
+ Hash$1.prototype.clear = hashClear;
1404
+ Hash$1.prototype['delete'] = hashDelete;
1405
+ Hash$1.prototype.get = hashGet;
1406
+ Hash$1.prototype.has = hashHas;
1407
+ Hash$1.prototype.set = hashSet;
1408
+
1409
+ var _Hash = Hash$1;
1410
+
1411
+ var Hash = _Hash,
1412
+ ListCache$2 = _ListCache,
1413
+ Map$2 = _Map;
1414
+
1415
+ /**
1416
+ * Removes all key-value entries from the map.
1417
+ *
1418
+ * @private
1419
+ * @name clear
1420
+ * @memberOf MapCache
1421
+ */
1422
+ function mapCacheClear$1() {
1423
+ this.size = 0;
1424
+ this.__data__ = {
1425
+ 'hash': new Hash,
1426
+ 'map': new (Map$2 || ListCache$2),
1427
+ 'string': new Hash
1428
+ };
1429
+ }
1430
+
1431
+ var _mapCacheClear = mapCacheClear$1;
1432
+
1433
+ /**
1434
+ * Checks if `value` is suitable for use as unique object key.
1435
+ *
1436
+ * @private
1437
+ * @param {*} value The value to check.
1438
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1439
+ */
1440
+
1441
+ function isKeyable$1(value) {
1442
+ var type = typeof value;
1443
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1444
+ ? (value !== '__proto__')
1445
+ : (value === null);
1446
+ }
1447
+
1448
+ var _isKeyable = isKeyable$1;
1449
+
1450
+ var isKeyable = _isKeyable;
1451
+
1452
+ /**
1453
+ * Gets the data for `map`.
1454
+ *
1455
+ * @private
1456
+ * @param {Object} map The map to query.
1457
+ * @param {string} key The reference key.
1458
+ * @returns {*} Returns the map data.
1459
+ */
1460
+ function getMapData$4(map, key) {
1461
+ var data = map.__data__;
1462
+ return isKeyable(key)
1463
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1464
+ : data.map;
1465
+ }
1466
+
1467
+ var _getMapData = getMapData$4;
1468
+
1469
+ var getMapData$3 = _getMapData;
1470
+
1471
+ /**
1472
+ * Removes `key` and its value from the map.
1473
+ *
1474
+ * @private
1475
+ * @name delete
1476
+ * @memberOf MapCache
1477
+ * @param {string} key The key of the value to remove.
1478
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1479
+ */
1480
+ function mapCacheDelete$1(key) {
1481
+ var result = getMapData$3(this, key)['delete'](key);
1482
+ this.size -= result ? 1 : 0;
1483
+ return result;
1484
+ }
1485
+
1486
+ var _mapCacheDelete = mapCacheDelete$1;
1487
+
1488
+ var getMapData$2 = _getMapData;
1489
+
1490
+ /**
1491
+ * Gets the map value for `key`.
1492
+ *
1493
+ * @private
1494
+ * @name get
1495
+ * @memberOf MapCache
1496
+ * @param {string} key The key of the value to get.
1497
+ * @returns {*} Returns the entry value.
1498
+ */
1499
+ function mapCacheGet$1(key) {
1500
+ return getMapData$2(this, key).get(key);
1501
+ }
1502
+
1503
+ var _mapCacheGet = mapCacheGet$1;
1504
+
1505
+ var getMapData$1 = _getMapData;
1506
+
1507
+ /**
1508
+ * Checks if a map value for `key` exists.
1509
+ *
1510
+ * @private
1511
+ * @name has
1512
+ * @memberOf MapCache
1513
+ * @param {string} key The key of the entry to check.
1514
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1515
+ */
1516
+ function mapCacheHas$1(key) {
1517
+ return getMapData$1(this, key).has(key);
1518
+ }
1519
+
1520
+ var _mapCacheHas = mapCacheHas$1;
1521
+
1522
+ var getMapData = _getMapData;
1523
+
1524
+ /**
1525
+ * Sets the map `key` to `value`.
1526
+ *
1527
+ * @private
1528
+ * @name set
1529
+ * @memberOf MapCache
1530
+ * @param {string} key The key of the value to set.
1531
+ * @param {*} value The value to set.
1532
+ * @returns {Object} Returns the map cache instance.
1533
+ */
1534
+ function mapCacheSet$1(key, value) {
1535
+ var data = getMapData(this, key),
1536
+ size = data.size;
1537
+
1538
+ data.set(key, value);
1539
+ this.size += data.size == size ? 0 : 1;
1540
+ return this;
1541
+ }
1542
+
1543
+ var _mapCacheSet = mapCacheSet$1;
1544
+
1545
+ var mapCacheClear = _mapCacheClear,
1546
+ mapCacheDelete = _mapCacheDelete,
1547
+ mapCacheGet = _mapCacheGet,
1548
+ mapCacheHas = _mapCacheHas,
1549
+ mapCacheSet = _mapCacheSet;
1550
+
1551
+ /**
1552
+ * Creates a map cache object to store key-value pairs.
1553
+ *
1554
+ * @private
1555
+ * @constructor
1556
+ * @param {Array} [entries] The key-value pairs to cache.
1557
+ */
1558
+ function MapCache$1(entries) {
1559
+ var index = -1,
1560
+ length = entries == null ? 0 : entries.length;
1561
+
1562
+ this.clear();
1563
+ while (++index < length) {
1564
+ var entry = entries[index];
1565
+ this.set(entry[0], entry[1]);
1566
+ }
1567
+ }
1568
+
1569
+ // Add methods to `MapCache`.
1570
+ MapCache$1.prototype.clear = mapCacheClear;
1571
+ MapCache$1.prototype['delete'] = mapCacheDelete;
1572
+ MapCache$1.prototype.get = mapCacheGet;
1573
+ MapCache$1.prototype.has = mapCacheHas;
1574
+ MapCache$1.prototype.set = mapCacheSet;
1575
+
1576
+ var _MapCache = MapCache$1;
1577
+
1578
+ var ListCache$1 = _ListCache,
1579
+ Map$1 = _Map,
1580
+ MapCache = _MapCache;
1581
+
1582
+ /** Used as the size to enable large array optimizations. */
1583
+ var LARGE_ARRAY_SIZE = 200;
1584
+
1585
+ /**
1586
+ * Sets the stack `key` to `value`.
1587
+ *
1588
+ * @private
1589
+ * @name set
1590
+ * @memberOf Stack
1591
+ * @param {string} key The key of the value to set.
1592
+ * @param {*} value The value to set.
1593
+ * @returns {Object} Returns the stack cache instance.
1594
+ */
1595
+ function stackSet$1(key, value) {
1596
+ var data = this.__data__;
1597
+ if (data instanceof ListCache$1) {
1598
+ var pairs = data.__data__;
1599
+ if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1600
+ pairs.push([key, value]);
1601
+ this.size = ++data.size;
1602
+ return this;
1603
+ }
1604
+ data = this.__data__ = new MapCache(pairs);
1605
+ }
1606
+ data.set(key, value);
1607
+ this.size = data.size;
1608
+ return this;
1609
+ }
1610
+
1611
+ var _stackSet = stackSet$1;
1612
+
1613
+ var ListCache = _ListCache,
1614
+ stackClear = _stackClear,
1615
+ stackDelete = _stackDelete,
1616
+ stackGet = _stackGet,
1617
+ stackHas = _stackHas,
1618
+ stackSet = _stackSet;
1619
+
1620
+ /**
1621
+ * Creates a stack cache object to store key-value pairs.
1622
+ *
1623
+ * @private
1624
+ * @constructor
1625
+ * @param {Array} [entries] The key-value pairs to cache.
1626
+ */
1627
+ function Stack$1(entries) {
1628
+ var data = this.__data__ = new ListCache(entries);
1629
+ this.size = data.size;
1630
+ }
1631
+
1632
+ // Add methods to `Stack`.
1633
+ Stack$1.prototype.clear = stackClear;
1634
+ Stack$1.prototype['delete'] = stackDelete;
1635
+ Stack$1.prototype.get = stackGet;
1636
+ Stack$1.prototype.has = stackHas;
1637
+ Stack$1.prototype.set = stackSet;
1638
+
1639
+ var _Stack = Stack$1;
1640
+
1641
+ /**
1642
+ * A specialized version of `_.forEach` for arrays without support for
1643
+ * iteratee shorthands.
1644
+ *
1645
+ * @private
1646
+ * @param {Array} [array] The array to iterate over.
1647
+ * @param {Function} iteratee The function invoked per iteration.
1648
+ * @returns {Array} Returns `array`.
1649
+ */
1650
+
1651
+ function arrayEach$1(array, iteratee) {
1652
+ var index = -1,
1653
+ length = array == null ? 0 : array.length;
1654
+
1655
+ while (++index < length) {
1656
+ if (iteratee(array[index], index, array) === false) {
1657
+ break;
1658
+ }
1659
+ }
1660
+ return array;
1661
+ }
1662
+
1663
+ var _arrayEach = arrayEach$1;
1664
+
1665
+ var getNative$4 = _getNative;
1666
+
1667
+ var defineProperty$1 = (function() {
1668
+ try {
1669
+ var func = getNative$4(Object, 'defineProperty');
1670
+ func({}, '', {});
1671
+ return func;
1672
+ } catch (e) {}
1673
+ }());
1674
+
1675
+ var _defineProperty = defineProperty$1;
1676
+
1677
+ var defineProperty = _defineProperty;
1678
+
1679
+ /**
1680
+ * The base implementation of `assignValue` and `assignMergeValue` without
1681
+ * value checks.
1682
+ *
1683
+ * @private
1684
+ * @param {Object} object The object to modify.
1685
+ * @param {string} key The key of the property to assign.
1686
+ * @param {*} value The value to assign.
1687
+ */
1688
+ function baseAssignValue$2(object, key, value) {
1689
+ if (key == '__proto__' && defineProperty) {
1690
+ defineProperty(object, key, {
1691
+ 'configurable': true,
1692
+ 'enumerable': true,
1693
+ 'value': value,
1694
+ 'writable': true
1695
+ });
1696
+ } else {
1697
+ object[key] = value;
1698
+ }
1699
+ }
1700
+
1701
+ var _baseAssignValue = baseAssignValue$2;
1702
+
1703
+ var baseAssignValue$1 = _baseAssignValue,
1704
+ eq = eq_1;
1705
+
1706
+ /** Used for built-in method references. */
1707
+ var objectProto$7 = Object.prototype;
1708
+
1709
+ /** Used to check objects for own properties. */
1710
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1711
+
1712
+ /**
1713
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
1714
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1715
+ * for equality comparisons.
1716
+ *
1717
+ * @private
1718
+ * @param {Object} object The object to modify.
1719
+ * @param {string} key The key of the property to assign.
1720
+ * @param {*} value The value to assign.
1721
+ */
1722
+ function assignValue$2(object, key, value) {
1723
+ var objValue = object[key];
1724
+ if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
1725
+ (value === undefined && !(key in object))) {
1726
+ baseAssignValue$1(object, key, value);
1727
+ }
1728
+ }
1729
+
1730
+ var _assignValue = assignValue$2;
1731
+
1732
+ var assignValue$1 = _assignValue,
1733
+ baseAssignValue = _baseAssignValue;
1734
+
1735
+ /**
1736
+ * Copies properties of `source` to `object`.
1737
+ *
1738
+ * @private
1739
+ * @param {Object} source The object to copy properties from.
1740
+ * @param {Array} props The property identifiers to copy.
1741
+ * @param {Object} [object={}] The object to copy properties to.
1742
+ * @param {Function} [customizer] The function to customize copied values.
1743
+ * @returns {Object} Returns `object`.
1744
+ */
1745
+ function copyObject$4(source, props, object, customizer) {
1746
+ var isNew = !object;
1747
+ object || (object = {});
1748
+
1749
+ var index = -1,
1750
+ length = props.length;
1751
+
1752
+ while (++index < length) {
1753
+ var key = props[index];
1754
+
1755
+ var newValue = customizer
1756
+ ? customizer(object[key], source[key], key, object, source)
1757
+ : undefined;
1758
+
1759
+ if (newValue === undefined) {
1760
+ newValue = source[key];
1761
+ }
1762
+ if (isNew) {
1763
+ baseAssignValue(object, key, newValue);
1764
+ } else {
1765
+ assignValue$1(object, key, newValue);
1766
+ }
1767
+ }
1768
+ return object;
1769
+ }
1770
+
1771
+ var _copyObject = copyObject$4;
1772
+
1773
+ /**
1774
+ * The base implementation of `_.times` without support for iteratee shorthands
1775
+ * or max array length checks.
1776
+ *
1777
+ * @private
1778
+ * @param {number} n The number of times to invoke `iteratee`.
1779
+ * @param {Function} iteratee The function invoked per iteration.
1780
+ * @returns {Array} Returns the array of results.
1781
+ */
1782
+
1783
+ function baseTimes$1(n, iteratee) {
1784
+ var index = -1,
1785
+ result = Array(n);
1786
+
1787
+ while (++index < n) {
1788
+ result[index] = iteratee(index);
1789
+ }
1790
+ return result;
1791
+ }
1792
+
1793
+ var _baseTimes = baseTimes$1;
1794
+
1795
+ /**
1796
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1797
+ * and has a `typeof` result of "object".
1798
+ *
1799
+ * @static
1800
+ * @memberOf _
1801
+ * @since 4.0.0
1802
+ * @category Lang
1803
+ * @param {*} value The value to check.
1804
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1805
+ * @example
1806
+ *
1807
+ * _.isObjectLike({});
1808
+ * // => true
1809
+ *
1810
+ * _.isObjectLike([1, 2, 3]);
1811
+ * // => true
1812
+ *
1813
+ * _.isObjectLike(_.noop);
1814
+ * // => false
1815
+ *
1816
+ * _.isObjectLike(null);
1817
+ * // => false
1818
+ */
1819
+
1820
+ function isObjectLike$5(value) {
1821
+ return value != null && typeof value == 'object';
1822
+ }
1823
+
1824
+ var isObjectLike_1 = isObjectLike$5;
1825
+
1826
+ var baseGetTag$2 = _baseGetTag,
1827
+ isObjectLike$4 = isObjectLike_1;
1828
+
1829
+ /** `Object#toString` result references. */
1830
+ var argsTag$2 = '[object Arguments]';
1831
+
1832
+ /**
1833
+ * The base implementation of `_.isArguments`.
1834
+ *
1835
+ * @private
1836
+ * @param {*} value The value to check.
1837
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1838
+ */
1839
+ function baseIsArguments$1(value) {
1840
+ return isObjectLike$4(value) && baseGetTag$2(value) == argsTag$2;
1841
+ }
1842
+
1843
+ var _baseIsArguments = baseIsArguments$1;
1844
+
1845
+ var baseIsArguments = _baseIsArguments,
1846
+ isObjectLike$3 = isObjectLike_1;
1847
+
1848
+ /** Used for built-in method references. */
1849
+ var objectProto$6 = Object.prototype;
1850
+
1851
+ /** Used to check objects for own properties. */
1852
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
1853
+
1854
+ /** Built-in value references. */
1855
+ var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1856
+
1857
+ /**
1858
+ * Checks if `value` is likely an `arguments` object.
1859
+ *
1860
+ * @static
1861
+ * @memberOf _
1862
+ * @since 0.1.0
1863
+ * @category Lang
1864
+ * @param {*} value The value to check.
1865
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1866
+ * else `false`.
1867
+ * @example
1868
+ *
1869
+ * _.isArguments(function() { return arguments; }());
1870
+ * // => true
1871
+ *
1872
+ * _.isArguments([1, 2, 3]);
1873
+ * // => false
1874
+ */
1875
+ var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1876
+ return isObjectLike$3(value) && hasOwnProperty$4.call(value, 'callee') &&
1877
+ !propertyIsEnumerable$1.call(value, 'callee');
1878
+ };
1879
+
1880
+ var isArguments_1 = isArguments$1;
1881
+
1882
+ /**
1883
+ * Checks if `value` is classified as an `Array` object.
1884
+ *
1885
+ * @static
1886
+ * @memberOf _
1887
+ * @since 0.1.0
1888
+ * @category Lang
1889
+ * @param {*} value The value to check.
1890
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1891
+ * @example
1892
+ *
1893
+ * _.isArray([1, 2, 3]);
1894
+ * // => true
1895
+ *
1896
+ * _.isArray(document.body.children);
1897
+ * // => false
1898
+ *
1899
+ * _.isArray('abc');
1900
+ * // => false
1901
+ *
1902
+ * _.isArray(_.noop);
1903
+ * // => false
1904
+ */
1905
+
1906
+ var isArray$3 = Array.isArray;
1907
+
1908
+ var isArray_1 = isArray$3;
1909
+
1910
+ var isBuffer$2 = {exports: {}};
1911
+
1912
+ /**
1913
+ * This method returns `false`.
1914
+ *
1915
+ * @static
1916
+ * @memberOf _
1917
+ * @since 4.13.0
1918
+ * @category Util
1919
+ * @returns {boolean} Returns `false`.
1920
+ * @example
1921
+ *
1922
+ * _.times(2, _.stubFalse);
1923
+ * // => [false, false]
1924
+ */
1925
+
1926
+ function stubFalse() {
1927
+ return false;
1928
+ }
1929
+
1930
+ var stubFalse_1 = stubFalse;
1931
+
1932
+ (function (module, exports) {
1933
+ var root = _root,
1934
+ stubFalse = stubFalse_1;
1935
+
1936
+ /** Detect free variable `exports`. */
1937
+ var freeExports = exports && !exports.nodeType && exports;
1938
+
1939
+ /** Detect free variable `module`. */
1940
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1941
+
1942
+ /** Detect the popular CommonJS extension `module.exports`. */
1943
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1944
+
1945
+ /** Built-in value references. */
1946
+ var Buffer = moduleExports ? root.Buffer : undefined;
1947
+
1948
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1949
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1950
+
1951
+ /**
1952
+ * Checks if `value` is a buffer.
1953
+ *
1954
+ * @static
1955
+ * @memberOf _
1956
+ * @since 4.3.0
1957
+ * @category Lang
1958
+ * @param {*} value The value to check.
1959
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1960
+ * @example
1961
+ *
1962
+ * _.isBuffer(new Buffer(2));
1963
+ * // => true
1964
+ *
1965
+ * _.isBuffer(new Uint8Array(2));
1966
+ * // => false
1967
+ */
1968
+ var isBuffer = nativeIsBuffer || stubFalse;
1969
+
1970
+ module.exports = isBuffer;
1971
+ }(isBuffer$2, isBuffer$2.exports));
1972
+
1973
+ /** Used as references for various `Number` constants. */
1974
+
1975
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1976
+
1977
+ /** Used to detect unsigned integer values. */
1978
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1979
+
1980
+ /**
1981
+ * Checks if `value` is a valid array-like index.
1982
+ *
1983
+ * @private
1984
+ * @param {*} value The value to check.
1985
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1986
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1987
+ */
1988
+ function isIndex$1(value, length) {
1989
+ var type = typeof value;
1990
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
1991
+
1992
+ return !!length &&
1993
+ (type == 'number' ||
1994
+ (type != 'symbol' && reIsUint.test(value))) &&
1995
+ (value > -1 && value % 1 == 0 && value < length);
1996
+ }
1997
+
1998
+ var _isIndex = isIndex$1;
1999
+
2000
+ /** Used as references for various `Number` constants. */
2001
+
2002
+ var MAX_SAFE_INTEGER = 9007199254740991;
2003
+
2004
+ /**
2005
+ * Checks if `value` is a valid array-like length.
2006
+ *
2007
+ * **Note:** This method is loosely based on
2008
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2009
+ *
2010
+ * @static
2011
+ * @memberOf _
2012
+ * @since 4.0.0
2013
+ * @category Lang
2014
+ * @param {*} value The value to check.
2015
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2016
+ * @example
2017
+ *
2018
+ * _.isLength(3);
2019
+ * // => true
2020
+ *
2021
+ * _.isLength(Number.MIN_VALUE);
2022
+ * // => false
2023
+ *
2024
+ * _.isLength(Infinity);
2025
+ * // => false
2026
+ *
2027
+ * _.isLength('3');
2028
+ * // => false
2029
+ */
2030
+ function isLength$2(value) {
2031
+ return typeof value == 'number' &&
2032
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2033
+ }
2034
+
2035
+ var isLength_1 = isLength$2;
2036
+
2037
+ var baseGetTag$1 = _baseGetTag,
2038
+ isLength$1 = isLength_1,
2039
+ isObjectLike$2 = isObjectLike_1;
2040
+
2041
+ /** `Object#toString` result references. */
2042
+ var argsTag$1 = '[object Arguments]',
2043
+ arrayTag$1 = '[object Array]',
2044
+ boolTag$2 = '[object Boolean]',
2045
+ dateTag$2 = '[object Date]',
2046
+ errorTag$1 = '[object Error]',
2047
+ funcTag$1 = '[object Function]',
2048
+ mapTag$4 = '[object Map]',
2049
+ numberTag$2 = '[object Number]',
2050
+ objectTag$2 = '[object Object]',
2051
+ regexpTag$2 = '[object RegExp]',
2052
+ setTag$4 = '[object Set]',
2053
+ stringTag$2 = '[object String]',
2054
+ weakMapTag$2 = '[object WeakMap]';
2055
+
2056
+ var arrayBufferTag$2 = '[object ArrayBuffer]',
2057
+ dataViewTag$3 = '[object DataView]',
2058
+ float32Tag$2 = '[object Float32Array]',
2059
+ float64Tag$2 = '[object Float64Array]',
2060
+ int8Tag$2 = '[object Int8Array]',
2061
+ int16Tag$2 = '[object Int16Array]',
2062
+ int32Tag$2 = '[object Int32Array]',
2063
+ uint8Tag$2 = '[object Uint8Array]',
2064
+ uint8ClampedTag$2 = '[object Uint8ClampedArray]',
2065
+ uint16Tag$2 = '[object Uint16Array]',
2066
+ uint32Tag$2 = '[object Uint32Array]';
2067
+
2068
+ /** Used to identify `toStringTag` values of typed arrays. */
2069
+ var typedArrayTags = {};
2070
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
2071
+ typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
2072
+ typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
2073
+ typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
2074
+ typedArrayTags[uint32Tag$2] = true;
2075
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
2076
+ typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
2077
+ typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
2078
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
2079
+ typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
2080
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] =
2081
+ typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
2082
+ typedArrayTags[weakMapTag$2] = false;
2083
+
2084
+ /**
2085
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
2086
+ *
2087
+ * @private
2088
+ * @param {*} value The value to check.
2089
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2090
+ */
2091
+ function baseIsTypedArray$1(value) {
2092
+ return isObjectLike$2(value) &&
2093
+ isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
2094
+ }
2095
+
2096
+ var _baseIsTypedArray = baseIsTypedArray$1;
2097
+
2098
+ /**
2099
+ * The base implementation of `_.unary` without support for storing metadata.
2100
+ *
2101
+ * @private
2102
+ * @param {Function} func The function to cap arguments for.
2103
+ * @returns {Function} Returns the new capped function.
2104
+ */
2105
+
2106
+ function baseUnary$3(func) {
2107
+ return function(value) {
2108
+ return func(value);
2109
+ };
2110
+ }
2111
+
2112
+ var _baseUnary = baseUnary$3;
2113
+
2114
+ var _nodeUtil = {exports: {}};
2115
+
2116
+ (function (module, exports) {
2117
+ var freeGlobal = _freeGlobal;
2118
+
2119
+ /** Detect free variable `exports`. */
2120
+ var freeExports = exports && !exports.nodeType && exports;
2121
+
2122
+ /** Detect free variable `module`. */
2123
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2124
+
2125
+ /** Detect the popular CommonJS extension `module.exports`. */
2126
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2127
+
2128
+ /** Detect free variable `process` from Node.js. */
2129
+ var freeProcess = moduleExports && freeGlobal.process;
2130
+
2131
+ /** Used to access faster Node.js helpers. */
2132
+ var nodeUtil = (function() {
2133
+ try {
2134
+ // Use `util.types` for Node.js 10+.
2135
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
2136
+
2137
+ if (types) {
2138
+ return types;
2139
+ }
2140
+
2141
+ // Legacy `process.binding('util')` for Node.js < 10.
2142
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
2143
+ } catch (e) {}
2144
+ }());
2145
+
2146
+ module.exports = nodeUtil;
2147
+ }(_nodeUtil, _nodeUtil.exports));
2148
+
2149
+ var baseIsTypedArray = _baseIsTypedArray,
2150
+ baseUnary$2 = _baseUnary,
2151
+ nodeUtil$2 = _nodeUtil.exports;
2152
+
2153
+ /* Node.js helper references. */
2154
+ var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
2155
+
2156
+ /**
2157
+ * Checks if `value` is classified as a typed array.
2158
+ *
2159
+ * @static
2160
+ * @memberOf _
2161
+ * @since 3.0.0
2162
+ * @category Lang
2163
+ * @param {*} value The value to check.
2164
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2165
+ * @example
2166
+ *
2167
+ * _.isTypedArray(new Uint8Array);
2168
+ * // => true
2169
+ *
2170
+ * _.isTypedArray([]);
2171
+ * // => false
2172
+ */
2173
+ var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
2174
+
2175
+ var isTypedArray_1 = isTypedArray$1;
2176
+
2177
+ var baseTimes = _baseTimes,
2178
+ isArguments = isArguments_1,
2179
+ isArray$2 = isArray_1,
2180
+ isBuffer$1 = isBuffer$2.exports,
2181
+ isIndex = _isIndex,
2182
+ isTypedArray = isTypedArray_1;
2183
+
2184
+ /** Used for built-in method references. */
2185
+ var objectProto$5 = Object.prototype;
2186
+
2187
+ /** Used to check objects for own properties. */
2188
+ var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
2189
+
2190
+ /**
2191
+ * Creates an array of the enumerable property names of the array-like `value`.
2192
+ *
2193
+ * @private
2194
+ * @param {*} value The value to query.
2195
+ * @param {boolean} inherited Specify returning inherited property names.
2196
+ * @returns {Array} Returns the array of property names.
2197
+ */
2198
+ function arrayLikeKeys$2(value, inherited) {
2199
+ var isArr = isArray$2(value),
2200
+ isArg = !isArr && isArguments(value),
2201
+ isBuff = !isArr && !isArg && isBuffer$1(value),
2202
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2203
+ skipIndexes = isArr || isArg || isBuff || isType,
2204
+ result = skipIndexes ? baseTimes(value.length, String) : [],
2205
+ length = result.length;
2206
+
2207
+ for (var key in value) {
2208
+ if ((inherited || hasOwnProperty$3.call(value, key)) &&
2209
+ !(skipIndexes && (
2210
+ // Safari 9 has enumerable `arguments.length` in strict mode.
2211
+ key == 'length' ||
2212
+ // Node.js 0.10 has enumerable non-index properties on buffers.
2213
+ (isBuff && (key == 'offset' || key == 'parent')) ||
2214
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
2215
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2216
+ // Skip index properties.
2217
+ isIndex(key, length)
2218
+ ))) {
2219
+ result.push(key);
2220
+ }
2221
+ }
2222
+ return result;
2223
+ }
2224
+
2225
+ var _arrayLikeKeys = arrayLikeKeys$2;
2226
+
2227
+ /** Used for built-in method references. */
2228
+
2229
+ var objectProto$4 = Object.prototype;
2230
+
2231
+ /**
2232
+ * Checks if `value` is likely a prototype object.
2233
+ *
2234
+ * @private
2235
+ * @param {*} value The value to check.
2236
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
2237
+ */
2238
+ function isPrototype$3(value) {
2239
+ var Ctor = value && value.constructor,
2240
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
2241
+
2242
+ return value === proto;
2243
+ }
2244
+
2245
+ var _isPrototype = isPrototype$3;
2246
+
2247
+ /**
2248
+ * Creates a unary function that invokes `func` with its argument transformed.
2249
+ *
2250
+ * @private
2251
+ * @param {Function} func The function to wrap.
2252
+ * @param {Function} transform The argument transform.
2253
+ * @returns {Function} Returns the new function.
2254
+ */
2255
+
2256
+ function overArg$2(func, transform) {
2257
+ return function(arg) {
2258
+ return func(transform(arg));
2259
+ };
2260
+ }
2261
+
2262
+ var _overArg = overArg$2;
2263
+
2264
+ var overArg$1 = _overArg;
2265
+
2266
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2267
+ var nativeKeys$1 = overArg$1(Object.keys, Object);
2268
+
2269
+ var _nativeKeys = nativeKeys$1;
2270
+
2271
+ var isPrototype$2 = _isPrototype,
2272
+ nativeKeys = _nativeKeys;
2273
+
2274
+ /** Used for built-in method references. */
2275
+ var objectProto$3 = Object.prototype;
2276
+
2277
+ /** Used to check objects for own properties. */
2278
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2279
+
2280
+ /**
2281
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2282
+ *
2283
+ * @private
2284
+ * @param {Object} object The object to query.
2285
+ * @returns {Array} Returns the array of property names.
2286
+ */
2287
+ function baseKeys$1(object) {
2288
+ if (!isPrototype$2(object)) {
2289
+ return nativeKeys(object);
2290
+ }
2291
+ var result = [];
2292
+ for (var key in Object(object)) {
2293
+ if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
2294
+ result.push(key);
2295
+ }
2296
+ }
2297
+ return result;
2298
+ }
2299
+
2300
+ var _baseKeys = baseKeys$1;
2301
+
2302
+ var isFunction = isFunction_1,
2303
+ isLength = isLength_1;
2304
+
2305
+ /**
2306
+ * Checks if `value` is array-like. A value is considered array-like if it's
2307
+ * not a function and has a `value.length` that's an integer greater than or
2308
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2309
+ *
2310
+ * @static
2311
+ * @memberOf _
2312
+ * @since 4.0.0
2313
+ * @category Lang
2314
+ * @param {*} value The value to check.
2315
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2316
+ * @example
2317
+ *
2318
+ * _.isArrayLike([1, 2, 3]);
2319
+ * // => true
2320
+ *
2321
+ * _.isArrayLike(document.body.children);
2322
+ * // => true
2323
+ *
2324
+ * _.isArrayLike('abc');
2325
+ * // => true
2326
+ *
2327
+ * _.isArrayLike(_.noop);
2328
+ * // => false
2329
+ */
2330
+ function isArrayLike$2(value) {
2331
+ return value != null && isLength(value.length) && !isFunction(value);
2332
+ }
2333
+
2334
+ var isArrayLike_1 = isArrayLike$2;
2335
+
2336
+ var arrayLikeKeys$1 = _arrayLikeKeys,
2337
+ baseKeys = _baseKeys,
2338
+ isArrayLike$1 = isArrayLike_1;
2339
+
2340
+ /**
2341
+ * Creates an array of the own enumerable property names of `object`.
2342
+ *
2343
+ * **Note:** Non-object values are coerced to objects. See the
2344
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2345
+ * for more details.
2346
+ *
2347
+ * @static
2348
+ * @since 0.1.0
2349
+ * @memberOf _
2350
+ * @category Object
2351
+ * @param {Object} object The object to query.
2352
+ * @returns {Array} Returns the array of property names.
2353
+ * @example
2354
+ *
2355
+ * function Foo() {
2356
+ * this.a = 1;
2357
+ * this.b = 2;
2358
+ * }
2359
+ *
2360
+ * Foo.prototype.c = 3;
2361
+ *
2362
+ * _.keys(new Foo);
2363
+ * // => ['a', 'b'] (iteration order is not guaranteed)
2364
+ *
2365
+ * _.keys('hi');
2366
+ * // => ['0', '1']
2367
+ */
2368
+ function keys$3(object) {
2369
+ return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
2370
+ }
2371
+
2372
+ var keys_1 = keys$3;
2373
+
2374
+ var copyObject$3 = _copyObject,
2375
+ keys$2 = keys_1;
2376
+
2377
+ /**
2378
+ * The base implementation of `_.assign` without support for multiple sources
2379
+ * or `customizer` functions.
2380
+ *
2381
+ * @private
2382
+ * @param {Object} object The destination object.
2383
+ * @param {Object} source The source object.
2384
+ * @returns {Object} Returns `object`.
2385
+ */
2386
+ function baseAssign$1(object, source) {
2387
+ return object && copyObject$3(source, keys$2(source), object);
2388
+ }
2389
+
2390
+ var _baseAssign = baseAssign$1;
2391
+
2392
+ /**
2393
+ * This function is like
2394
+ * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2395
+ * except that it includes inherited enumerable properties.
2396
+ *
2397
+ * @private
2398
+ * @param {Object} object The object to query.
2399
+ * @returns {Array} Returns the array of property names.
2400
+ */
2401
+
2402
+ function nativeKeysIn$1(object) {
2403
+ var result = [];
2404
+ if (object != null) {
2405
+ for (var key in Object(object)) {
2406
+ result.push(key);
2407
+ }
2408
+ }
2409
+ return result;
2410
+ }
2411
+
2412
+ var _nativeKeysIn = nativeKeysIn$1;
2413
+
2414
+ var isObject$2 = isObject_1,
2415
+ isPrototype$1 = _isPrototype,
2416
+ nativeKeysIn = _nativeKeysIn;
2417
+
2418
+ /** Used for built-in method references. */
2419
+ var objectProto$2 = Object.prototype;
2420
+
2421
+ /** Used to check objects for own properties. */
2422
+ var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
2423
+
2424
+ /**
2425
+ * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
2426
+ *
2427
+ * @private
2428
+ * @param {Object} object The object to query.
2429
+ * @returns {Array} Returns the array of property names.
2430
+ */
2431
+ function baseKeysIn$1(object) {
2432
+ if (!isObject$2(object)) {
2433
+ return nativeKeysIn(object);
2434
+ }
2435
+ var isProto = isPrototype$1(object),
2436
+ result = [];
2437
+
2438
+ for (var key in object) {
2439
+ if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) {
2440
+ result.push(key);
2441
+ }
2442
+ }
2443
+ return result;
2444
+ }
2445
+
2446
+ var _baseKeysIn = baseKeysIn$1;
2447
+
2448
+ var arrayLikeKeys = _arrayLikeKeys,
2449
+ baseKeysIn = _baseKeysIn,
2450
+ isArrayLike = isArrayLike_1;
2451
+
2452
+ /**
2453
+ * Creates an array of the own and inherited enumerable property names of `object`.
2454
+ *
2455
+ * **Note:** Non-object values are coerced to objects.
2456
+ *
2457
+ * @static
2458
+ * @memberOf _
2459
+ * @since 3.0.0
2460
+ * @category Object
2461
+ * @param {Object} object The object to query.
2462
+ * @returns {Array} Returns the array of property names.
2463
+ * @example
2464
+ *
2465
+ * function Foo() {
2466
+ * this.a = 1;
2467
+ * this.b = 2;
2468
+ * }
2469
+ *
2470
+ * Foo.prototype.c = 3;
2471
+ *
2472
+ * _.keysIn(new Foo);
2473
+ * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
2474
+ */
2475
+ function keysIn$3(object) {
2476
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
2477
+ }
2478
+
2479
+ var keysIn_1 = keysIn$3;
2480
+
2481
+ var copyObject$2 = _copyObject,
2482
+ keysIn$2 = keysIn_1;
2483
+
2484
+ /**
2485
+ * The base implementation of `_.assignIn` without support for multiple sources
2486
+ * or `customizer` functions.
2487
+ *
2488
+ * @private
2489
+ * @param {Object} object The destination object.
2490
+ * @param {Object} source The source object.
2491
+ * @returns {Object} Returns `object`.
2492
+ */
2493
+ function baseAssignIn$1(object, source) {
2494
+ return object && copyObject$2(source, keysIn$2(source), object);
2495
+ }
2496
+
2497
+ var _baseAssignIn = baseAssignIn$1;
2498
+
2499
+ var _cloneBuffer = {exports: {}};
2500
+
2501
+ (function (module, exports) {
2502
+ var root = _root;
2503
+
2504
+ /** Detect free variable `exports`. */
2505
+ var freeExports = exports && !exports.nodeType && exports;
2506
+
2507
+ /** Detect free variable `module`. */
2508
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
2509
+
2510
+ /** Detect the popular CommonJS extension `module.exports`. */
2511
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2512
+
2513
+ /** Built-in value references. */
2514
+ var Buffer = moduleExports ? root.Buffer : undefined,
2515
+ allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
2516
+
2517
+ /**
2518
+ * Creates a clone of `buffer`.
2519
+ *
2520
+ * @private
2521
+ * @param {Buffer} buffer The buffer to clone.
2522
+ * @param {boolean} [isDeep] Specify a deep clone.
2523
+ * @returns {Buffer} Returns the cloned buffer.
2524
+ */
2525
+ function cloneBuffer(buffer, isDeep) {
2526
+ if (isDeep) {
2527
+ return buffer.slice();
2528
+ }
2529
+ var length = buffer.length,
2530
+ result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
2531
+
2532
+ buffer.copy(result);
2533
+ return result;
2534
+ }
2535
+
2536
+ module.exports = cloneBuffer;
2537
+ }(_cloneBuffer, _cloneBuffer.exports));
2538
+
2539
+ /**
2540
+ * Copies the values of `source` to `array`.
2541
+ *
2542
+ * @private
2543
+ * @param {Array} source The array to copy values from.
2544
+ * @param {Array} [array=[]] The array to copy values to.
2545
+ * @returns {Array} Returns `array`.
2546
+ */
2547
+
2548
+ function copyArray$1(source, array) {
2549
+ var index = -1,
2550
+ length = source.length;
2551
+
2552
+ array || (array = Array(length));
2553
+ while (++index < length) {
2554
+ array[index] = source[index];
2555
+ }
2556
+ return array;
2557
+ }
2558
+
2559
+ var _copyArray = copyArray$1;
2560
+
2561
+ /**
2562
+ * A specialized version of `_.filter` for arrays without support for
2563
+ * iteratee shorthands.
2564
+ *
2565
+ * @private
2566
+ * @param {Array} [array] The array to iterate over.
2567
+ * @param {Function} predicate The function invoked per iteration.
2568
+ * @returns {Array} Returns the new filtered array.
2569
+ */
2570
+
2571
+ function arrayFilter$1(array, predicate) {
2572
+ var index = -1,
2573
+ length = array == null ? 0 : array.length,
2574
+ resIndex = 0,
2575
+ result = [];
2576
+
2577
+ while (++index < length) {
2578
+ var value = array[index];
2579
+ if (predicate(value, index, array)) {
2580
+ result[resIndex++] = value;
2581
+ }
2582
+ }
2583
+ return result;
2584
+ }
2585
+
2586
+ var _arrayFilter = arrayFilter$1;
2587
+
2588
+ /**
2589
+ * This method returns a new empty array.
2590
+ *
2591
+ * @static
2592
+ * @memberOf _
2593
+ * @since 4.13.0
2594
+ * @category Util
2595
+ * @returns {Array} Returns the new empty array.
2596
+ * @example
2597
+ *
2598
+ * var arrays = _.times(2, _.stubArray);
2599
+ *
2600
+ * console.log(arrays);
2601
+ * // => [[], []]
2602
+ *
2603
+ * console.log(arrays[0] === arrays[1]);
2604
+ * // => false
2605
+ */
2606
+
2607
+ function stubArray$2() {
2608
+ return [];
2609
+ }
2610
+
2611
+ var stubArray_1 = stubArray$2;
2612
+
2613
+ var arrayFilter = _arrayFilter,
2614
+ stubArray$1 = stubArray_1;
2615
+
2616
+ /** Used for built-in method references. */
2617
+ var objectProto$1 = Object.prototype;
2618
+
2619
+ /** Built-in value references. */
2620
+ var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
2621
+
2622
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2623
+ var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2624
+
2625
+ /**
2626
+ * Creates an array of the own enumerable symbols of `object`.
2627
+ *
2628
+ * @private
2629
+ * @param {Object} object The object to query.
2630
+ * @returns {Array} Returns the array of symbols.
2631
+ */
2632
+ var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
2633
+ if (object == null) {
2634
+ return [];
2635
+ }
2636
+ object = Object(object);
2637
+ return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2638
+ return propertyIsEnumerable.call(object, symbol);
2639
+ });
2640
+ };
2641
+
2642
+ var _getSymbols = getSymbols$3;
2643
+
2644
+ var copyObject$1 = _copyObject,
2645
+ getSymbols$2 = _getSymbols;
2646
+
2647
+ /**
2648
+ * Copies own symbols of `source` to `object`.
2649
+ *
2650
+ * @private
2651
+ * @param {Object} source The object to copy symbols from.
2652
+ * @param {Object} [object={}] The object to copy symbols to.
2653
+ * @returns {Object} Returns `object`.
2654
+ */
2655
+ function copySymbols$1(source, object) {
2656
+ return copyObject$1(source, getSymbols$2(source), object);
2657
+ }
2658
+
2659
+ var _copySymbols = copySymbols$1;
2660
+
2661
+ /**
2662
+ * Appends the elements of `values` to `array`.
2663
+ *
2664
+ * @private
2665
+ * @param {Array} array The array to modify.
2666
+ * @param {Array} values The values to append.
2667
+ * @returns {Array} Returns `array`.
2668
+ */
2669
+
2670
+ function arrayPush$2(array, values) {
2671
+ var index = -1,
2672
+ length = values.length,
2673
+ offset = array.length;
2674
+
2675
+ while (++index < length) {
2676
+ array[offset + index] = values[index];
2677
+ }
2678
+ return array;
2679
+ }
2680
+
2681
+ var _arrayPush = arrayPush$2;
2682
+
2683
+ var overArg = _overArg;
2684
+
2685
+ /** Built-in value references. */
2686
+ var getPrototype$2 = overArg(Object.getPrototypeOf, Object);
2687
+
2688
+ var _getPrototype = getPrototype$2;
2689
+
2690
+ var arrayPush$1 = _arrayPush,
2691
+ getPrototype$1 = _getPrototype,
2692
+ getSymbols$1 = _getSymbols,
2693
+ stubArray = stubArray_1;
2694
+
2695
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2696
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
2697
+
2698
+ /**
2699
+ * Creates an array of the own and inherited enumerable symbols of `object`.
2700
+ *
2701
+ * @private
2702
+ * @param {Object} object The object to query.
2703
+ * @returns {Array} Returns the array of symbols.
2704
+ */
2705
+ var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
2706
+ var result = [];
2707
+ while (object) {
2708
+ arrayPush$1(result, getSymbols$1(object));
2709
+ object = getPrototype$1(object);
2710
+ }
2711
+ return result;
2712
+ };
2713
+
2714
+ var _getSymbolsIn = getSymbolsIn$2;
2715
+
2716
+ var copyObject = _copyObject,
2717
+ getSymbolsIn$1 = _getSymbolsIn;
2718
+
2719
+ /**
2720
+ * Copies own and inherited symbols of `source` to `object`.
2721
+ *
2722
+ * @private
2723
+ * @param {Object} source The object to copy symbols from.
2724
+ * @param {Object} [object={}] The object to copy symbols to.
2725
+ * @returns {Object} Returns `object`.
2726
+ */
2727
+ function copySymbolsIn$1(source, object) {
2728
+ return copyObject(source, getSymbolsIn$1(source), object);
2729
+ }
2730
+
2731
+ var _copySymbolsIn = copySymbolsIn$1;
2732
+
2733
+ var arrayPush = _arrayPush,
2734
+ isArray$1 = isArray_1;
2735
+
2736
+ /**
2737
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2738
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2739
+ * symbols of `object`.
2740
+ *
2741
+ * @private
2742
+ * @param {Object} object The object to query.
2743
+ * @param {Function} keysFunc The function to get the keys of `object`.
2744
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
2745
+ * @returns {Array} Returns the array of property names and symbols.
2746
+ */
2747
+ function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
2748
+ var result = keysFunc(object);
2749
+ return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
2750
+ }
2751
+
2752
+ var _baseGetAllKeys = baseGetAllKeys$2;
2753
+
2754
+ var baseGetAllKeys$1 = _baseGetAllKeys,
2755
+ getSymbols = _getSymbols,
2756
+ keys$1 = keys_1;
2757
+
2758
+ /**
2759
+ * Creates an array of own enumerable property names and symbols of `object`.
2760
+ *
2761
+ * @private
2762
+ * @param {Object} object The object to query.
2763
+ * @returns {Array} Returns the array of property names and symbols.
2764
+ */
2765
+ function getAllKeys$1(object) {
2766
+ return baseGetAllKeys$1(object, keys$1, getSymbols);
2767
+ }
2768
+
2769
+ var _getAllKeys = getAllKeys$1;
2770
+
2771
+ var baseGetAllKeys = _baseGetAllKeys,
2772
+ getSymbolsIn = _getSymbolsIn,
2773
+ keysIn$1 = keysIn_1;
2774
+
2775
+ /**
2776
+ * Creates an array of own and inherited enumerable property names and
2777
+ * symbols of `object`.
2778
+ *
2779
+ * @private
2780
+ * @param {Object} object The object to query.
2781
+ * @returns {Array} Returns the array of property names and symbols.
2782
+ */
2783
+ function getAllKeysIn$1(object) {
2784
+ return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
2785
+ }
2786
+
2787
+ var _getAllKeysIn = getAllKeysIn$1;
2788
+
2789
+ var getNative$3 = _getNative,
2790
+ root$4 = _root;
2791
+
2792
+ /* Built-in method references that are verified to be native. */
2793
+ var DataView$1 = getNative$3(root$4, 'DataView');
2794
+
2795
+ var _DataView = DataView$1;
2796
+
2797
+ var getNative$2 = _getNative,
2798
+ root$3 = _root;
2799
+
2800
+ /* Built-in method references that are verified to be native. */
2801
+ var Promise$2 = getNative$2(root$3, 'Promise');
2802
+
2803
+ var _Promise = Promise$2;
2804
+
2805
+ var getNative$1 = _getNative,
2806
+ root$2 = _root;
2807
+
2808
+ /* Built-in method references that are verified to be native. */
2809
+ var Set$2 = getNative$1(root$2, 'Set');
2810
+
2811
+ var _Set = Set$2;
2812
+
2813
+ var getNative = _getNative,
2814
+ root$1 = _root;
2815
+
2816
+ /* Built-in method references that are verified to be native. */
2817
+ var WeakMap$1 = getNative(root$1, 'WeakMap');
2818
+
2819
+ var _WeakMap = WeakMap$1;
2820
+
2821
+ var DataView = _DataView,
2822
+ Map = _Map,
2823
+ Promise$1 = _Promise,
2824
+ Set$1 = _Set,
2825
+ WeakMap = _WeakMap,
2826
+ baseGetTag = _baseGetTag,
2827
+ toSource = _toSource;
2828
+
2829
+ /** `Object#toString` result references. */
2830
+ var mapTag$3 = '[object Map]',
2831
+ objectTag$1 = '[object Object]',
2832
+ promiseTag = '[object Promise]',
2833
+ setTag$3 = '[object Set]',
2834
+ weakMapTag$1 = '[object WeakMap]';
2835
+
2836
+ var dataViewTag$2 = '[object DataView]';
2837
+
2838
+ /** Used to detect maps, sets, and weakmaps. */
2839
+ var dataViewCtorString = toSource(DataView),
2840
+ mapCtorString = toSource(Map),
2841
+ promiseCtorString = toSource(Promise$1),
2842
+ setCtorString = toSource(Set$1),
2843
+ weakMapCtorString = toSource(WeakMap);
2844
+
2845
+ /**
2846
+ * Gets the `toStringTag` of `value`.
2847
+ *
2848
+ * @private
2849
+ * @param {*} value The value to query.
2850
+ * @returns {string} Returns the `toStringTag`.
2851
+ */
2852
+ var getTag$3 = baseGetTag;
2853
+
2854
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2855
+ if ((DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
2856
+ (Map && getTag$3(new Map) != mapTag$3) ||
2857
+ (Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag) ||
2858
+ (Set$1 && getTag$3(new Set$1) != setTag$3) ||
2859
+ (WeakMap && getTag$3(new WeakMap) != weakMapTag$1)) {
2860
+ getTag$3 = function(value) {
2861
+ var result = baseGetTag(value),
2862
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
2863
+ ctorString = Ctor ? toSource(Ctor) : '';
2864
+
2865
+ if (ctorString) {
2866
+ switch (ctorString) {
2867
+ case dataViewCtorString: return dataViewTag$2;
2868
+ case mapCtorString: return mapTag$3;
2869
+ case promiseCtorString: return promiseTag;
2870
+ case setCtorString: return setTag$3;
2871
+ case weakMapCtorString: return weakMapTag$1;
2872
+ }
2873
+ }
2874
+ return result;
2875
+ };
2876
+ }
2877
+
2878
+ var _getTag = getTag$3;
2879
+
2880
+ /** Used for built-in method references. */
2881
+
2882
+ var objectProto = Object.prototype;
2883
+
2884
+ /** Used to check objects for own properties. */
2885
+ var hasOwnProperty = objectProto.hasOwnProperty;
2886
+
2887
+ /**
2888
+ * Initializes an array clone.
2889
+ *
2890
+ * @private
2891
+ * @param {Array} array The array to clone.
2892
+ * @returns {Array} Returns the initialized clone.
2893
+ */
2894
+ function initCloneArray$1(array) {
2895
+ var length = array.length,
2896
+ result = new array.constructor(length);
2897
+
2898
+ // Add properties assigned by `RegExp#exec`.
2899
+ if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
2900
+ result.index = array.index;
2901
+ result.input = array.input;
2902
+ }
2903
+ return result;
2904
+ }
2905
+
2906
+ var _initCloneArray = initCloneArray$1;
2907
+
2908
+ var root = _root;
2909
+
2910
+ /** Built-in value references. */
2911
+ var Uint8Array$1 = root.Uint8Array;
2912
+
2913
+ var _Uint8Array = Uint8Array$1;
2914
+
2915
+ var Uint8Array = _Uint8Array;
2916
+
2917
+ /**
2918
+ * Creates a clone of `arrayBuffer`.
2919
+ *
2920
+ * @private
2921
+ * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2922
+ * @returns {ArrayBuffer} Returns the cloned array buffer.
2923
+ */
2924
+ function cloneArrayBuffer$3(arrayBuffer) {
2925
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2926
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2927
+ return result;
2928
+ }
2929
+
2930
+ var _cloneArrayBuffer = cloneArrayBuffer$3;
2931
+
2932
+ var cloneArrayBuffer$2 = _cloneArrayBuffer;
2933
+
2934
+ /**
2935
+ * Creates a clone of `dataView`.
2936
+ *
2937
+ * @private
2938
+ * @param {Object} dataView The data view to clone.
2939
+ * @param {boolean} [isDeep] Specify a deep clone.
2940
+ * @returns {Object} Returns the cloned data view.
2941
+ */
2942
+ function cloneDataView$1(dataView, isDeep) {
2943
+ var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
2944
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2945
+ }
2946
+
2947
+ var _cloneDataView = cloneDataView$1;
2948
+
2949
+ /** Used to match `RegExp` flags from their coerced string values. */
2950
+
2951
+ var reFlags = /\w*$/;
2952
+
2953
+ /**
2954
+ * Creates a clone of `regexp`.
2955
+ *
2956
+ * @private
2957
+ * @param {Object} regexp The regexp to clone.
2958
+ * @returns {Object} Returns the cloned regexp.
2959
+ */
2960
+ function cloneRegExp$1(regexp) {
2961
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2962
+ result.lastIndex = regexp.lastIndex;
2963
+ return result;
2964
+ }
2965
+
2966
+ var _cloneRegExp = cloneRegExp$1;
2967
+
2968
+ var Symbol = _Symbol;
2969
+
2970
+ /** Used to convert symbols to primitives and strings. */
2971
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
2972
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2973
+
2974
+ /**
2975
+ * Creates a clone of the `symbol` object.
2976
+ *
2977
+ * @private
2978
+ * @param {Object} symbol The symbol object to clone.
2979
+ * @returns {Object} Returns the cloned symbol object.
2980
+ */
2981
+ function cloneSymbol$1(symbol) {
2982
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2983
+ }
2984
+
2985
+ var _cloneSymbol = cloneSymbol$1;
2986
+
2987
+ var cloneArrayBuffer$1 = _cloneArrayBuffer;
2988
+
2989
+ /**
2990
+ * Creates a clone of `typedArray`.
2991
+ *
2992
+ * @private
2993
+ * @param {Object} typedArray The typed array to clone.
2994
+ * @param {boolean} [isDeep] Specify a deep clone.
2995
+ * @returns {Object} Returns the cloned typed array.
2996
+ */
2997
+ function cloneTypedArray$1(typedArray, isDeep) {
2998
+ var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
2999
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
3000
+ }
3001
+
3002
+ var _cloneTypedArray = cloneTypedArray$1;
3003
+
3004
+ var cloneArrayBuffer = _cloneArrayBuffer,
3005
+ cloneDataView = _cloneDataView,
3006
+ cloneRegExp = _cloneRegExp,
3007
+ cloneSymbol = _cloneSymbol,
3008
+ cloneTypedArray = _cloneTypedArray;
3009
+
3010
+ /** `Object#toString` result references. */
3011
+ var boolTag$1 = '[object Boolean]',
3012
+ dateTag$1 = '[object Date]',
3013
+ mapTag$2 = '[object Map]',
3014
+ numberTag$1 = '[object Number]',
3015
+ regexpTag$1 = '[object RegExp]',
3016
+ setTag$2 = '[object Set]',
3017
+ stringTag$1 = '[object String]',
3018
+ symbolTag$1 = '[object Symbol]';
3019
+
3020
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
3021
+ dataViewTag$1 = '[object DataView]',
3022
+ float32Tag$1 = '[object Float32Array]',
3023
+ float64Tag$1 = '[object Float64Array]',
3024
+ int8Tag$1 = '[object Int8Array]',
3025
+ int16Tag$1 = '[object Int16Array]',
3026
+ int32Tag$1 = '[object Int32Array]',
3027
+ uint8Tag$1 = '[object Uint8Array]',
3028
+ uint8ClampedTag$1 = '[object Uint8ClampedArray]',
3029
+ uint16Tag$1 = '[object Uint16Array]',
3030
+ uint32Tag$1 = '[object Uint32Array]';
3031
+
3032
+ /**
3033
+ * Initializes an object clone based on its `toStringTag`.
3034
+ *
3035
+ * **Note:** This function only supports cloning values with tags of
3036
+ * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
3037
+ *
3038
+ * @private
3039
+ * @param {Object} object The object to clone.
3040
+ * @param {string} tag The `toStringTag` of the object to clone.
3041
+ * @param {boolean} [isDeep] Specify a deep clone.
3042
+ * @returns {Object} Returns the initialized clone.
3043
+ */
3044
+ function initCloneByTag$1(object, tag, isDeep) {
3045
+ var Ctor = object.constructor;
3046
+ switch (tag) {
3047
+ case arrayBufferTag$1:
3048
+ return cloneArrayBuffer(object);
3049
+
3050
+ case boolTag$1:
3051
+ case dateTag$1:
3052
+ return new Ctor(+object);
3053
+
3054
+ case dataViewTag$1:
3055
+ return cloneDataView(object, isDeep);
3056
+
3057
+ case float32Tag$1: case float64Tag$1:
3058
+ case int8Tag$1: case int16Tag$1: case int32Tag$1:
3059
+ case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
3060
+ return cloneTypedArray(object, isDeep);
3061
+
3062
+ case mapTag$2:
3063
+ return new Ctor;
3064
+
3065
+ case numberTag$1:
3066
+ case stringTag$1:
3067
+ return new Ctor(object);
3068
+
3069
+ case regexpTag$1:
3070
+ return cloneRegExp(object);
3071
+
3072
+ case setTag$2:
3073
+ return new Ctor;
3074
+
3075
+ case symbolTag$1:
3076
+ return cloneSymbol(object);
3077
+ }
3078
+ }
3079
+
3080
+ var _initCloneByTag = initCloneByTag$1;
3081
+
3082
+ var isObject$1 = isObject_1;
3083
+
3084
+ /** Built-in value references. */
3085
+ var objectCreate = Object.create;
3086
+
3087
+ /**
3088
+ * The base implementation of `_.create` without support for assigning
3089
+ * properties to the created object.
3090
+ *
3091
+ * @private
3092
+ * @param {Object} proto The object to inherit from.
3093
+ * @returns {Object} Returns the new object.
3094
+ */
3095
+ var baseCreate$1 = (function() {
3096
+ function object() {}
3097
+ return function(proto) {
3098
+ if (!isObject$1(proto)) {
3099
+ return {};
3100
+ }
3101
+ if (objectCreate) {
3102
+ return objectCreate(proto);
3103
+ }
3104
+ object.prototype = proto;
3105
+ var result = new object;
3106
+ object.prototype = undefined;
3107
+ return result;
3108
+ };
3109
+ }());
3110
+
3111
+ var _baseCreate = baseCreate$1;
3112
+
3113
+ var baseCreate = _baseCreate,
3114
+ getPrototype = _getPrototype,
3115
+ isPrototype = _isPrototype;
3116
+
3117
+ /**
3118
+ * Initializes an object clone.
3119
+ *
3120
+ * @private
3121
+ * @param {Object} object The object to clone.
3122
+ * @returns {Object} Returns the initialized clone.
3123
+ */
3124
+ function initCloneObject$1(object) {
3125
+ return (typeof object.constructor == 'function' && !isPrototype(object))
3126
+ ? baseCreate(getPrototype(object))
3127
+ : {};
3128
+ }
3129
+
3130
+ var _initCloneObject = initCloneObject$1;
3131
+
3132
+ var getTag$2 = _getTag,
3133
+ isObjectLike$1 = isObjectLike_1;
3134
+
3135
+ /** `Object#toString` result references. */
3136
+ var mapTag$1 = '[object Map]';
3137
+
3138
+ /**
3139
+ * The base implementation of `_.isMap` without Node.js optimizations.
3140
+ *
3141
+ * @private
3142
+ * @param {*} value The value to check.
3143
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3144
+ */
3145
+ function baseIsMap$1(value) {
3146
+ return isObjectLike$1(value) && getTag$2(value) == mapTag$1;
3147
+ }
3148
+
3149
+ var _baseIsMap = baseIsMap$1;
3150
+
3151
+ var baseIsMap = _baseIsMap,
3152
+ baseUnary$1 = _baseUnary,
3153
+ nodeUtil$1 = _nodeUtil.exports;
3154
+
3155
+ /* Node.js helper references. */
3156
+ var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
3157
+
3158
+ /**
3159
+ * Checks if `value` is classified as a `Map` object.
3160
+ *
3161
+ * @static
3162
+ * @memberOf _
3163
+ * @since 4.3.0
3164
+ * @category Lang
3165
+ * @param {*} value The value to check.
3166
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
3167
+ * @example
3168
+ *
3169
+ * _.isMap(new Map);
3170
+ * // => true
3171
+ *
3172
+ * _.isMap(new WeakMap);
3173
+ * // => false
3174
+ */
3175
+ var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
3176
+
3177
+ var isMap_1 = isMap$1;
3178
+
3179
+ var getTag$1 = _getTag,
3180
+ isObjectLike = isObjectLike_1;
3181
+
3182
+ /** `Object#toString` result references. */
3183
+ var setTag$1 = '[object Set]';
3184
+
3185
+ /**
3186
+ * The base implementation of `_.isSet` without Node.js optimizations.
3187
+ *
3188
+ * @private
3189
+ * @param {*} value The value to check.
3190
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3191
+ */
3192
+ function baseIsSet$1(value) {
3193
+ return isObjectLike(value) && getTag$1(value) == setTag$1;
3194
+ }
3195
+
3196
+ var _baseIsSet = baseIsSet$1;
3197
+
3198
+ var baseIsSet = _baseIsSet,
3199
+ baseUnary = _baseUnary,
3200
+ nodeUtil = _nodeUtil.exports;
3201
+
3202
+ /* Node.js helper references. */
3203
+ var nodeIsSet = nodeUtil && nodeUtil.isSet;
3204
+
3205
+ /**
3206
+ * Checks if `value` is classified as a `Set` object.
3207
+ *
3208
+ * @static
3209
+ * @memberOf _
3210
+ * @since 4.3.0
3211
+ * @category Lang
3212
+ * @param {*} value The value to check.
3213
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
3214
+ * @example
3215
+ *
3216
+ * _.isSet(new Set);
3217
+ * // => true
3218
+ *
3219
+ * _.isSet(new WeakSet);
3220
+ * // => false
3221
+ */
3222
+ var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3223
+
3224
+ var isSet_1 = isSet$1;
3225
+
3226
+ var Stack = _Stack,
3227
+ arrayEach = _arrayEach,
3228
+ assignValue = _assignValue,
3229
+ baseAssign = _baseAssign,
3230
+ baseAssignIn = _baseAssignIn,
3231
+ cloneBuffer = _cloneBuffer.exports,
3232
+ copyArray = _copyArray,
3233
+ copySymbols = _copySymbols,
3234
+ copySymbolsIn = _copySymbolsIn,
3235
+ getAllKeys = _getAllKeys,
3236
+ getAllKeysIn = _getAllKeysIn,
3237
+ getTag = _getTag,
3238
+ initCloneArray = _initCloneArray,
3239
+ initCloneByTag = _initCloneByTag,
3240
+ initCloneObject = _initCloneObject,
3241
+ isArray = isArray_1,
3242
+ isBuffer = isBuffer$2.exports,
3243
+ isMap = isMap_1,
3244
+ isObject = isObject_1,
3245
+ isSet = isSet_1,
3246
+ keys = keys_1,
3247
+ keysIn = keysIn_1;
3248
+
3249
+ /** Used to compose bitmasks for cloning. */
3250
+ var CLONE_DEEP_FLAG$1 = 1,
3251
+ CLONE_FLAT_FLAG = 2,
3252
+ CLONE_SYMBOLS_FLAG$1 = 4;
3253
+
3254
+ /** `Object#toString` result references. */
3255
+ var argsTag = '[object Arguments]',
3256
+ arrayTag = '[object Array]',
3257
+ boolTag = '[object Boolean]',
3258
+ dateTag = '[object Date]',
3259
+ errorTag = '[object Error]',
3260
+ funcTag = '[object Function]',
3261
+ genTag = '[object GeneratorFunction]',
3262
+ mapTag = '[object Map]',
3263
+ numberTag = '[object Number]',
3264
+ objectTag = '[object Object]',
3265
+ regexpTag = '[object RegExp]',
3266
+ setTag = '[object Set]',
3267
+ stringTag = '[object String]',
3268
+ symbolTag = '[object Symbol]',
3269
+ weakMapTag = '[object WeakMap]';
3270
+
3271
+ var arrayBufferTag = '[object ArrayBuffer]',
3272
+ dataViewTag = '[object DataView]',
3273
+ float32Tag = '[object Float32Array]',
3274
+ float64Tag = '[object Float64Array]',
3275
+ int8Tag = '[object Int8Array]',
3276
+ int16Tag = '[object Int16Array]',
3277
+ int32Tag = '[object Int32Array]',
3278
+ uint8Tag = '[object Uint8Array]',
3279
+ uint8ClampedTag = '[object Uint8ClampedArray]',
3280
+ uint16Tag = '[object Uint16Array]',
3281
+ uint32Tag = '[object Uint32Array]';
3282
+
3283
+ /** Used to identify `toStringTag` values supported by `_.clone`. */
3284
+ var cloneableTags = {};
3285
+ cloneableTags[argsTag] = cloneableTags[arrayTag] =
3286
+ cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
3287
+ cloneableTags[boolTag] = cloneableTags[dateTag] =
3288
+ cloneableTags[float32Tag] = cloneableTags[float64Tag] =
3289
+ cloneableTags[int8Tag] = cloneableTags[int16Tag] =
3290
+ cloneableTags[int32Tag] = cloneableTags[mapTag] =
3291
+ cloneableTags[numberTag] = cloneableTags[objectTag] =
3292
+ cloneableTags[regexpTag] = cloneableTags[setTag] =
3293
+ cloneableTags[stringTag] = cloneableTags[symbolTag] =
3294
+ cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
3295
+ cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
3296
+ cloneableTags[errorTag] = cloneableTags[funcTag] =
3297
+ cloneableTags[weakMapTag] = false;
3298
+
3299
+ /**
3300
+ * The base implementation of `_.clone` and `_.cloneDeep` which tracks
3301
+ * traversed objects.
3302
+ *
3303
+ * @private
3304
+ * @param {*} value The value to clone.
3305
+ * @param {boolean} bitmask The bitmask flags.
3306
+ * 1 - Deep clone
3307
+ * 2 - Flatten inherited properties
3308
+ * 4 - Clone symbols
3309
+ * @param {Function} [customizer] The function to customize cloning.
3310
+ * @param {string} [key] The key of `value`.
3311
+ * @param {Object} [object] The parent object of `value`.
3312
+ * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
3313
+ * @returns {*} Returns the cloned value.
3314
+ */
3315
+ function baseClone$1(value, bitmask, customizer, key, object, stack) {
3316
+ var result,
3317
+ isDeep = bitmask & CLONE_DEEP_FLAG$1,
3318
+ isFlat = bitmask & CLONE_FLAT_FLAG,
3319
+ isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
3320
+
3321
+ if (customizer) {
3322
+ result = object ? customizer(value, key, object, stack) : customizer(value);
3323
+ }
3324
+ if (result !== undefined) {
3325
+ return result;
3326
+ }
3327
+ if (!isObject(value)) {
3328
+ return value;
3329
+ }
3330
+ var isArr = isArray(value);
3331
+ if (isArr) {
3332
+ result = initCloneArray(value);
3333
+ if (!isDeep) {
3334
+ return copyArray(value, result);
3335
+ }
3336
+ } else {
3337
+ var tag = getTag(value),
3338
+ isFunc = tag == funcTag || tag == genTag;
3339
+
3340
+ if (isBuffer(value)) {
3341
+ return cloneBuffer(value, isDeep);
3342
+ }
3343
+ if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
3344
+ result = (isFlat || isFunc) ? {} : initCloneObject(value);
3345
+ if (!isDeep) {
3346
+ return isFlat
3347
+ ? copySymbolsIn(value, baseAssignIn(result, value))
3348
+ : copySymbols(value, baseAssign(result, value));
3349
+ }
3350
+ } else {
3351
+ if (!cloneableTags[tag]) {
3352
+ return object ? value : {};
3353
+ }
3354
+ result = initCloneByTag(value, tag, isDeep);
3355
+ }
3356
+ }
3357
+ // Check for circular references and return its corresponding clone.
3358
+ stack || (stack = new Stack);
3359
+ var stacked = stack.get(value);
3360
+ if (stacked) {
3361
+ return stacked;
3362
+ }
3363
+ stack.set(value, result);
3364
+
3365
+ if (isSet(value)) {
3366
+ value.forEach(function(subValue) {
3367
+ result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
3368
+ });
3369
+ } else if (isMap(value)) {
3370
+ value.forEach(function(subValue, key) {
3371
+ result.set(key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
3372
+ });
3373
+ }
3374
+
3375
+ var keysFunc = isFull
3376
+ ? (isFlat ? getAllKeysIn : getAllKeys)
3377
+ : (isFlat ? keysIn : keys);
3378
+
3379
+ var props = isArr ? undefined : keysFunc(value);
3380
+ arrayEach(props || value, function(subValue, key) {
3381
+ if (props) {
3382
+ key = subValue;
3383
+ subValue = value[key];
3384
+ }
3385
+ // Recursively populate clone (susceptible to call stack limits).
3386
+ assignValue(result, key, baseClone$1(subValue, bitmask, customizer, key, value, stack));
3387
+ });
3388
+ return result;
3389
+ }
3390
+
3391
+ var _baseClone = baseClone$1;
3392
+
3393
+ var baseClone = _baseClone;
3394
+
3395
+ /** Used to compose bitmasks for cloning. */
3396
+ var CLONE_DEEP_FLAG = 1,
3397
+ CLONE_SYMBOLS_FLAG = 4;
3398
+
3399
+ /**
3400
+ * This method is like `_.clone` except that it recursively clones `value`.
3401
+ *
3402
+ * @static
3403
+ * @memberOf _
3404
+ * @since 1.0.0
3405
+ * @category Lang
3406
+ * @param {*} value The value to recursively clone.
3407
+ * @returns {*} Returns the deep cloned value.
3408
+ * @see _.clone
3409
+ * @example
3410
+ *
3411
+ * var objects = [{ 'a': 1 }, { 'b': 2 }];
3412
+ *
3413
+ * var deep = _.cloneDeep(objects);
3414
+ * console.log(deep[0] === objects[0]);
3415
+ * // => false
3416
+ */
3417
+ function cloneDeep(value) {
3418
+ return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
3419
+ }
3420
+
3421
+ var cloneDeep_1 = cloneDeep;
3422
+
3423
+ /*!
3424
+ * cookie
3425
+ * Copyright(c) 2012-2014 Roman Shtylman
3426
+ * Copyright(c) 2015 Douglas Christopher Wilson
3427
+ * MIT Licensed
3428
+ */
3429
+
3430
+ /**
3431
+ * Module exports.
3432
+ * @public
3433
+ */
3434
+
3435
+ var parse_1 = parse;
3436
+ var serialize_1 = serialize;
3437
+
3438
+ /**
3439
+ * Module variables.
3440
+ * @private
3441
+ */
3442
+
3443
+ var decode = decodeURIComponent;
3444
+ var encode = encodeURIComponent;
3445
+
3446
+ /**
3447
+ * RegExp to match field-content in RFC 7230 sec 3.2
3448
+ *
3449
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
3450
+ * field-vchar = VCHAR / obs-text
3451
+ * obs-text = %x80-FF
3452
+ */
3453
+
3454
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
3455
+
3456
+ /**
3457
+ * Parse a cookie header.
3458
+ *
3459
+ * Parse the given cookie header string into an object
3460
+ * The object has the various cookies as keys(names) => values
3461
+ *
3462
+ * @param {string} str
3463
+ * @param {object} [options]
3464
+ * @return {object}
3465
+ * @public
3466
+ */
3467
+
3468
+ function parse(str, options) {
3469
+ if (typeof str !== 'string') {
3470
+ throw new TypeError('argument str must be a string');
3471
+ }
3472
+
3473
+ var obj = {};
3474
+ var opt = options || {};
3475
+ var pairs = str.split(';');
3476
+ var dec = opt.decode || decode;
3477
+
3478
+ for (var i = 0; i < pairs.length; i++) {
3479
+ var pair = pairs[i];
3480
+ var index = pair.indexOf('=');
3481
+
3482
+ // skip things that don't look like key=value
3483
+ if (index < 0) {
3484
+ continue;
3485
+ }
3486
+
3487
+ var key = pair.substring(0, index).trim();
3488
+
3489
+ // only assign once
3490
+ if (undefined == obj[key]) {
3491
+ var val = pair.substring(index + 1, pair.length).trim();
3492
+
3493
+ // quoted values
3494
+ if (val[0] === '"') {
3495
+ val = val.slice(1, -1);
3496
+ }
3497
+
3498
+ obj[key] = tryDecode(val, dec);
3499
+ }
3500
+ }
3501
+
3502
+ return obj;
3503
+ }
3504
+
3505
+ /**
3506
+ * Serialize data into a cookie header.
3507
+ *
3508
+ * Serialize the a name value pair into a cookie string suitable for
3509
+ * http headers. An optional options object specified cookie parameters.
3510
+ *
3511
+ * serialize('foo', 'bar', { httpOnly: true })
3512
+ * => "foo=bar; httpOnly"
3513
+ *
3514
+ * @param {string} name
3515
+ * @param {string} val
3516
+ * @param {object} [options]
3517
+ * @return {string}
3518
+ * @public
3519
+ */
3520
+
3521
+ function serialize(name, val, options) {
3522
+ var opt = options || {};
3523
+ var enc = opt.encode || encode;
3524
+
3525
+ if (typeof enc !== 'function') {
3526
+ throw new TypeError('option encode is invalid');
3527
+ }
3528
+
3529
+ if (!fieldContentRegExp.test(name)) {
3530
+ throw new TypeError('argument name is invalid');
3531
+ }
3532
+
3533
+ var value = enc(val);
3534
+
3535
+ if (value && !fieldContentRegExp.test(value)) {
3536
+ throw new TypeError('argument val is invalid');
3537
+ }
3538
+
3539
+ var str = name + '=' + value;
3540
+
3541
+ if (null != opt.maxAge) {
3542
+ var maxAge = opt.maxAge - 0;
3543
+
3544
+ if (isNaN(maxAge) || !isFinite(maxAge)) {
3545
+ throw new TypeError('option maxAge is invalid')
3546
+ }
3547
+
3548
+ str += '; Max-Age=' + Math.floor(maxAge);
3549
+ }
3550
+
3551
+ if (opt.domain) {
3552
+ if (!fieldContentRegExp.test(opt.domain)) {
3553
+ throw new TypeError('option domain is invalid');
3554
+ }
3555
+
3556
+ str += '; Domain=' + opt.domain;
3557
+ }
3558
+
3559
+ if (opt.path) {
3560
+ if (!fieldContentRegExp.test(opt.path)) {
3561
+ throw new TypeError('option path is invalid');
3562
+ }
3563
+
3564
+ str += '; Path=' + opt.path;
3565
+ }
3566
+
3567
+ if (opt.expires) {
3568
+ if (typeof opt.expires.toUTCString !== 'function') {
3569
+ throw new TypeError('option expires is invalid');
3570
+ }
3571
+
3572
+ str += '; Expires=' + opt.expires.toUTCString();
3573
+ }
3574
+
3575
+ if (opt.httpOnly) {
3576
+ str += '; HttpOnly';
3577
+ }
3578
+
3579
+ if (opt.secure) {
3580
+ str += '; Secure';
3581
+ }
3582
+
3583
+ if (opt.sameSite) {
3584
+ var sameSite = typeof opt.sameSite === 'string'
3585
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
3586
+
3587
+ switch (sameSite) {
3588
+ case true:
3589
+ str += '; SameSite=Strict';
3590
+ break;
3591
+ case 'lax':
3592
+ str += '; SameSite=Lax';
3593
+ break;
3594
+ case 'strict':
3595
+ str += '; SameSite=Strict';
3596
+ break;
3597
+ case 'none':
3598
+ str += '; SameSite=None';
3599
+ break;
3600
+ default:
3601
+ throw new TypeError('option sameSite is invalid');
3602
+ }
3603
+ }
3604
+
3605
+ return str;
3606
+ }
3607
+
3608
+ /**
3609
+ * Try decoding a string using a decoding function.
3610
+ *
3611
+ * @param {string} str
3612
+ * @param {function} decode
3613
+ * @private
3614
+ */
3615
+
3616
+ function tryDecode(str, decode) {
3617
+ try {
3618
+ return decode(str);
3619
+ } catch (e) {
3620
+ return str;
3621
+ }
3622
+ }
3623
+
3624
+ function hasDocumentCookie() {
3625
+ // Can we get/set cookies on document.cookie?
3626
+ return typeof document === 'object' && typeof document.cookie === 'string';
3627
+ }
3628
+ function parseCookies(cookies, options) {
3629
+ if (typeof cookies === 'string') {
3630
+ return parse_1(cookies, options);
3631
+ }
3632
+ else if (typeof cookies === 'object' && cookies !== null) {
3633
+ return cookies;
3634
+ }
3635
+ else {
3636
+ return {};
3637
+ }
3638
+ }
3639
+ function isParsingCookie(value, doNotParse) {
3640
+ if (typeof doNotParse === 'undefined') {
3641
+ // We guess if the cookie start with { or [, it has been serialized
3642
+ doNotParse =
3643
+ !value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
3644
+ }
3645
+ return !doNotParse;
3646
+ }
3647
+ function readCookie(value, options) {
3648
+ if (options === void 0) { options = {}; }
3649
+ var cleanValue = cleanupCookieValue(value);
3650
+ if (isParsingCookie(cleanValue, options.doNotParse)) {
3651
+ try {
3652
+ return JSON.parse(cleanValue);
3653
+ }
3654
+ catch (e) {
3655
+ // At least we tried
3656
+ }
3657
+ }
3658
+ // Ignore clean value if we failed the deserialization
3659
+ // It is not relevant anymore to trim those values
3660
+ return value;
3661
+ }
3662
+ function cleanupCookieValue(value) {
3663
+ // express prepend j: before serializing a cookie
3664
+ if (value && value[0] === 'j' && value[1] === ':') {
3665
+ return value.substr(2);
3666
+ }
3667
+ return value;
3668
+ }
3669
+
3670
+ var __assign = (undefined && undefined.__assign) || function () {
3671
+ __assign = Object.assign || function(t) {
3672
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
3673
+ s = arguments[i];
3674
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
3675
+ t[p] = s[p];
3676
+ }
3677
+ return t;
3678
+ };
3679
+ return __assign.apply(this, arguments);
3680
+ };
3681
+ var Cookies = /** @class */ (function () {
3682
+ function Cookies(cookies, options) {
3683
+ var _this = this;
3684
+ this.changeListeners = [];
3685
+ this.HAS_DOCUMENT_COOKIE = false;
3686
+ this.cookies = parseCookies(cookies, options);
3687
+ new Promise(function () {
3688
+ _this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
3689
+ }).catch(function () { });
3690
+ }
3691
+ Cookies.prototype._updateBrowserValues = function (parseOptions) {
3692
+ if (!this.HAS_DOCUMENT_COOKIE) {
3693
+ return;
3694
+ }
3695
+ this.cookies = parse_1(document.cookie, parseOptions);
3696
+ };
3697
+ Cookies.prototype._emitChange = function (params) {
3698
+ for (var i = 0; i < this.changeListeners.length; ++i) {
3699
+ this.changeListeners[i](params);
3700
+ }
3701
+ };
3702
+ Cookies.prototype.get = function (name, options, parseOptions) {
3703
+ if (options === void 0) { options = {}; }
3704
+ this._updateBrowserValues(parseOptions);
3705
+ return readCookie(this.cookies[name], options);
3706
+ };
3707
+ Cookies.prototype.getAll = function (options, parseOptions) {
3708
+ if (options === void 0) { options = {}; }
3709
+ this._updateBrowserValues(parseOptions);
3710
+ var result = {};
3711
+ for (var name_1 in this.cookies) {
3712
+ result[name_1] = readCookie(this.cookies[name_1], options);
3713
+ }
3714
+ return result;
3715
+ };
3716
+ Cookies.prototype.set = function (name, value, options) {
3717
+ var _a;
3718
+ if (typeof value === 'object') {
3719
+ value = JSON.stringify(value);
3720
+ }
3721
+ this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
3722
+ if (this.HAS_DOCUMENT_COOKIE) {
3723
+ document.cookie = serialize_1(name, value, options);
3724
+ }
3725
+ this._emitChange({ name: name, value: value, options: options });
3726
+ };
3727
+ Cookies.prototype.remove = function (name, options) {
3728
+ var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
3729
+ this.cookies = __assign({}, this.cookies);
3730
+ delete this.cookies[name];
3731
+ if (this.HAS_DOCUMENT_COOKIE) {
3732
+ document.cookie = serialize_1(name, '', finalOptions);
3733
+ }
3734
+ this._emitChange({ name: name, value: undefined, options: options });
3735
+ };
3736
+ Cookies.prototype.addChangeListener = function (callback) {
3737
+ this.changeListeners.push(callback);
3738
+ };
3739
+ Cookies.prototype.removeChangeListener = function (callback) {
3740
+ var idx = this.changeListeners.indexOf(callback);
3741
+ if (idx >= 0) {
3742
+ this.changeListeners.splice(idx, 1);
3743
+ }
3744
+ };
3745
+ return Cookies;
3746
+ }());
3747
+ var Cookies$1 = Cookies;
3748
+
216
3749
  var stringifyAttributes = ((attributes = {}) => Object.entries(attributes).map(([key, value], idx) => `${idx !== 0 ? ' ' : ''}${key}${value ? `="${value}"` : ''}`).join(' '));
217
3750
 
218
3751
  /* eslint-disable no-console */
@@ -307,7 +3840,8 @@ const getBundleTags = (loadableExtractor, scripts, staticRoutePath = 'static') =
307
3840
  const modernScriptTags = loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.modern.getScriptTags({
308
3841
  type: 'module'
309
3842
  });
310
- return `${startupTag}${legacyScriptTags || ''}${modernScriptTags || ''}`;
3843
+ const scriptTags = `${startupTag}${legacyScriptTags || ''}${modernScriptTags || ''}`.replace(/"\/static\//g, `"/${staticRoutePath}/`);
3844
+ return scriptTags;
311
3845
  }
312
3846
 
313
3847
  return startupTag;
@@ -317,7 +3851,7 @@ const addStandardHeaders = (state, response, packagejson, groups) => {
317
3851
  if (state) {
318
3852
  try {
319
3853
  console.info('About to add headers');
320
- const routingSurrogateKeys = selectors.getImmutableOrJS(state, ['routing', 'surrogateKeys'], '');
3854
+ const routingSurrogateKeys = selectors.selectSurrogateKeys(state);
321
3855
  const surrogateKeyHeader = ` ${packagejson.name}-app ${routingSurrogateKeys}`;
322
3856
  response.header('surrogate-key', surrogateKeyHeader);
323
3857
  addVarnishAuthenticationHeaders(state, response, groups);
@@ -376,6 +3910,7 @@ const webApp = (app, ReactApp, config) => {
376
3910
  const {
377
3911
  url
378
3912
  } = request;
3913
+ const cookies = new Cookies$1(request.headers.cookie);
379
3914
 
380
3915
  const matchedStaticRoute = () => reactRouterConfig.matchRoutes(routes.StaticRoutes, request.path);
381
3916
 
@@ -421,6 +3956,8 @@ const webApp = (app, ReactApp, config) => {
421
3956
  const loadableExtractor = loadableChunkExtractors();
422
3957
  const jsx = /*#__PURE__*/React__default["default"].createElement(server.ChunkExtractorManager, {
423
3958
  extractor: loadableExtractor === null || loadableExtractor === void 0 ? void 0 : loadableExtractor.commonLoadableExtractor
3959
+ }, /*#__PURE__*/React__default["default"].createElement(reactCookie.CookiesProvider, {
3960
+ cookies: cookies
424
3961
  }, /*#__PURE__*/React__default["default"].createElement(reactRedux.Provider, {
425
3962
  store: store
426
3963
  }, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.StaticRouter, {
@@ -429,7 +3966,7 @@ const webApp = (app, ReactApp, config) => {
429
3966
  }, /*#__PURE__*/React__default["default"].createElement(ReactApp, {
430
3967
  routes: routes,
431
3968
  withEvents: withEvents
432
- }))));
3969
+ })))));
433
3970
  const {
434
3971
  templateHTML,
435
3972
  templateHTMLFragment,
@@ -441,7 +3978,7 @@ const webApp = (app, ReactApp, config) => {
441
3978
  server$1.renderToString(jsx); // Dynamic page render has only the necessary bundles to start up the app
442
3979
  // and does not include any react-loadable code-split bundles
443
3980
 
444
- const bundleTags = getBundleTags(loadableExtractor, scripts);
3981
+ const bundleTags = getBundleTags(loadableExtractor, scripts, staticRoutePath);
445
3982
  const isDynamicHint = `<script ${attributes}>window.isDynamic = true;</script>`;
446
3983
  const responseHtmlDynamic = templateHTML.replace('{{TITLE}}', '').replace('{{SEO_CRITICAL_METADATA}}', '').replace('{{CRITICAL_CSS}}', '').replace('{{APP}}', '').replace('{{LOADABLE_CHUNKS}}', bundleTags).replace('{{REDUX_DATA}}', isDynamicHint); // Dynamic pages always return a 200 so we can run
447
3984
  // the app and serve up all errors inside the client
@@ -459,7 +3996,7 @@ const webApp = (app, ReactApp, config) => {
459
3996
  reactHelmet.Helmet.rewind();
460
3997
  const htmlAttributes = helmet.htmlAttributes.toString();
461
3998
  let title = helmet.title.toString();
462
- const metadata = helmet.meta.toString();
3999
+ const metadata = helmet.meta.toString().concat(helmet.link.toString());
463
4000
 
464
4001
  if (context.url) {
465
4002
  return response.redirect(302, context.url);
@@ -469,8 +4006,17 @@ const webApp = (app, ReactApp, config) => {
469
4006
  const styleTags = sheet.getStyleTags(); // After running rootSaga there should be an additional react-loadable
470
4007
  // code-split bundles for any page components as well as core app bundles
471
4008
 
472
- const bundleTags = getBundleTags(loadableExtractor, scripts);
473
- let serialisedReduxData = serialize__default["default"](reduxState);
4009
+ const bundleTags = getBundleTags(loadableExtractor, scripts, staticRoutePath);
4010
+ let serialisedReduxData = serialize__default["default"](lodashClean.buildCleaner({
4011
+ isArray: lodash.identity,
4012
+ isBoolean: lodash.identity,
4013
+ isDate: lodash.identity,
4014
+ isFunction: lodash.noop,
4015
+ isNull: lodash.identity,
4016
+ isPlainObject: lodash.identity,
4017
+ isString: lodash.identity,
4018
+ isUndefined: lodash.noop
4019
+ })(cloneDeep_1(reduxState)));
474
4020
 
475
4021
  if (context.statusCode !== 404) {
476
4022
  // For a request that returns a redux state object as a response
@@ -564,8 +4110,6 @@ const start = (ReactApp, config, ServerFeatures) => {
564
4110
  staticAssets(app, config);
565
4111
  webApp(app, ReactApp, config);
566
4112
  app.on('ready', async () => {
567
- // Configure DNS to make life easier
568
- // await ConfigureLocalDNS();
569
4113
  const server = app.listen(3001, () => {
570
4114
  console.info(`HTTP server is listening @ port 3001`);
571
4115
  setTimeout(function () {
@@ -588,4 +4132,5 @@ var internalServer = {
588
4132
 
589
4133
  exports.ReactApp = App.AppRoot;
590
4134
  exports["default"] = internalServer;
4135
+ exports.linkDepthApi = makeLinkDepthApi;
591
4136
  //# sourceMappingURL=contensis-react-base.js.map