@zengenti/contensis-react-base 4.0.0-beta.2 → 4.0.0-beta.3

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