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