@nanoporetech-digital/components 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/{_commonjsHelpers-9f2314fc.js → _commonjsHelpers-29614748.js} +1 -17
  3. package/dist/cjs/_commonjsHelpers-29614748.js.map +1 -0
  4. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js +922 -0
  5. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js.map +1 -0
  6. package/dist/cjs/component-store-21cb4901.js +328 -0
  7. package/dist/cjs/component-store-21cb4901.js.map +1 -0
  8. package/dist/cjs/events-db0a42ee.js +39 -0
  9. package/dist/cjs/events-db0a42ee.js.map +1 -0
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/nano-alert.cjs.entry.js +9 -2
  12. package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nano-algolia-filter.cjs.entry.js +1 -2
  14. package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-algolia-input.cjs.entry.js +8 -4
  16. package/dist/cjs/nano-algolia-input.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-algolia.cjs.entry.js +4 -4
  18. package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-components.cjs.js +1 -1
  20. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  21. package/dist/cjs/nano-dialog.cjs.entry.js +23 -22
  22. package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-drawer.cjs.entry.js +169 -111
  24. package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
  25. package/dist/cjs/nano-dropdown.cjs.entry.js +16 -2
  26. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  27. package/dist/cjs/nano-global-nav.cjs.entry.js +5 -6
  28. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nano-global-search-results.cjs.entry.js +2 -1
  30. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  31. package/dist/cjs/nano-slides.cjs.entry.js +1 -1
  32. package/dist/cjs/nano-sortable.cjs.entry.js +3 -15
  33. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nano-sticker.cjs.entry.js +16 -9
  35. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nano-tab-group.cjs.entry.js +1 -2
  37. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  38. package/dist/cjs/{nano-table-04993bb4.js → nano-table-e15cc6b0.js} +16 -15
  39. package/dist/cjs/nano-table-e15cc6b0.js.map +1 -0
  40. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  41. package/dist/cjs/{slot-a448c1a7.js → slot-2dd6ed1d.js} +20 -15
  42. package/dist/cjs/slot-2dd6ed1d.js.map +1 -0
  43. package/dist/cjs/{table.worker-85877b23.js → table.worker-8759e6ea.js} +2 -2
  44. package/dist/cjs/table.worker-8759e6ea.js.map +1 -0
  45. package/dist/collection/components/alert/alert.css +15 -0
  46. package/dist/collection/components/alert/alert.js +10 -2
  47. package/dist/collection/components/alert/alert.js.map +1 -1
  48. package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
  49. package/dist/collection/components/algolia/algolia.js +1 -1
  50. package/dist/collection/components/algolia/algolia.js.map +1 -1
  51. package/dist/collection/components/dialog/dialog.css +1 -17
  52. package/dist/collection/components/dialog/dialog.js +31 -20
  53. package/dist/collection/components/dialog/dialog.js.map +1 -1
  54. package/dist/collection/components/drawer/drawer.css +136 -67
  55. package/dist/collection/components/drawer/drawer.js +282 -154
  56. package/dist/collection/components/drawer/drawer.js.map +1 -1
  57. package/dist/collection/components/dropdown/dropdown.css +10 -0
  58. package/dist/collection/components/dropdown/dropdown.js +15 -1
  59. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  60. package/dist/collection/components/global-nav/global-nav.js +2 -2
  61. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  62. package/dist/collection/components/global-nav/style/global-nav.css +5 -1
  63. package/dist/collection/components/global-search-results/global-search-results.js +2 -1
  64. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  65. package/dist/collection/components/sticker/sticker.js +16 -9
  66. package/dist/collection/components/sticker/sticker.js.map +1 -1
  67. package/dist/collection/components/table/table.js +10 -9
  68. package/dist/collection/components/table/table.js.map +1 -1
  69. package/dist/collection/components/table/table.pin-service.js +4 -4
  70. package/dist/collection/components/table/table.pin-service.js.map +1 -1
  71. package/dist/collection/utils/events.js +17 -0
  72. package/dist/collection/utils/events.js.map +1 -1
  73. package/dist/collection/utils/slot.js +19 -14
  74. package/dist/collection/utils/slot.js.map +1 -1
  75. package/dist/collection/utils/store/get-set.js +6 -12
  76. package/dist/collection/utils/store/get-set.js.map +1 -1
  77. package/dist/components/_commonjsHelpers.js +1 -16
  78. package/dist/components/_commonjsHelpers.js.map +1 -1
  79. package/dist/components/algolia.js +2 -2
  80. package/dist/components/algolia.js.map +1 -1
  81. package/dist/components/algoliasearch-lite.esm.browser.js +920 -0
  82. package/dist/components/algoliasearch-lite.esm.browser.js.map +1 -0
  83. package/dist/components/component-store.js +68 -2001
  84. package/dist/components/component-store.js.map +1 -1
  85. package/dist/components/dropdown.js +16 -2
  86. package/dist/components/dropdown.js.map +1 -1
  87. package/dist/components/events.js +36 -0
  88. package/dist/components/events.js.map +1 -0
  89. package/dist/components/nano-alert.js +10 -2
  90. package/dist/components/nano-alert.js.map +1 -1
  91. package/dist/components/nano-algolia-input.js +6 -1
  92. package/dist/components/nano-algolia-input.js.map +1 -1
  93. package/dist/components/nano-dialog.js +21 -20
  94. package/dist/components/nano-dialog.js.map +1 -1
  95. package/dist/components/nano-drawer.js +205 -122
  96. package/dist/components/nano-drawer.js.map +1 -1
  97. package/dist/components/nano-global-nav.js +4 -4
  98. package/dist/components/nano-global-nav.js.map +1 -1
  99. package/dist/components/nano-global-search-results.js +2 -1
  100. package/dist/components/nano-global-search-results.js.map +1 -1
  101. package/dist/components/nano-sortable.js +1 -13
  102. package/dist/components/nano-sortable.js.map +1 -1
  103. package/dist/components/slot.js +19 -14
  104. package/dist/components/slot.js.map +1 -1
  105. package/dist/components/sticker.js +16 -9
  106. package/dist/components/sticker.js.map +1 -1
  107. package/dist/components/table.js +14 -13
  108. package/dist/components/table.js.map +1 -1
  109. package/dist/esm/{_commonjsHelpers-e401b2a2.js → _commonjsHelpers-04a0e019.js} +2 -17
  110. package/dist/esm/_commonjsHelpers-04a0e019.js.map +1 -0
  111. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js +920 -0
  112. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js.map +1 -0
  113. package/dist/esm/component-store-65d7e36a.js +326 -0
  114. package/dist/esm/component-store-65d7e36a.js.map +1 -0
  115. package/dist/esm/events-6a805b42.js +36 -0
  116. package/dist/esm/events-6a805b42.js.map +1 -0
  117. package/dist/esm/loader.js +1 -1
  118. package/dist/esm/nano-alert.entry.js +9 -2
  119. package/dist/esm/nano-alert.entry.js.map +1 -1
  120. package/dist/esm/nano-algolia-filter.entry.js +1 -2
  121. package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
  122. package/dist/esm/nano-algolia-input.entry.js +7 -3
  123. package/dist/esm/nano-algolia-input.entry.js.map +1 -1
  124. package/dist/esm/nano-algolia.entry.js +4 -4
  125. package/dist/esm/nano-algolia.entry.js.map +1 -1
  126. package/dist/esm/nano-components.js +1 -1
  127. package/dist/esm/nano-datalist_3.entry.js +1 -1
  128. package/dist/esm/nano-dialog.entry.js +23 -22
  129. package/dist/esm/nano-dialog.entry.js.map +1 -1
  130. package/dist/esm/nano-drawer.entry.js +171 -113
  131. package/dist/esm/nano-drawer.entry.js.map +1 -1
  132. package/dist/esm/nano-dropdown.entry.js +16 -2
  133. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  134. package/dist/esm/nano-global-nav.entry.js +5 -6
  135. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  136. package/dist/esm/nano-global-search-results.entry.js +2 -1
  137. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  138. package/dist/esm/nano-slides.entry.js +1 -1
  139. package/dist/esm/nano-sortable.entry.js +1 -13
  140. package/dist/esm/nano-sortable.entry.js.map +1 -1
  141. package/dist/esm/nano-sticker.entry.js +16 -9
  142. package/dist/esm/nano-sticker.entry.js.map +1 -1
  143. package/dist/esm/nano-tab-group.entry.js +1 -2
  144. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  145. package/dist/esm/{nano-table-91f09583.js → nano-table-5c5bd3f2.js} +16 -15
  146. package/dist/esm/nano-table-5c5bd3f2.js.map +1 -0
  147. package/dist/esm/nano-table.entry.js +1 -1
  148. package/dist/esm/{slot-a4f6e2af.js → slot-8126e238.js} +20 -15
  149. package/dist/esm/slot-8126e238.js.map +1 -0
  150. package/dist/esm/{table.worker-625475ba.js → table.worker-e7f4f50c.js} +2 -2
  151. package/dist/esm/table.worker-e7f4f50c.js.map +1 -0
  152. package/dist/nano-components/nano-components.css +1 -1
  153. package/dist/nano-components/nano-components.esm.js +1 -1
  154. package/dist/nano-components/nano-components.esm.js.map +1 -1
  155. package/dist/nano-components/p-0301e8f7.entry.js +5 -0
  156. package/dist/nano-components/p-0301e8f7.entry.js.map +1 -0
  157. package/dist/nano-components/p-27422aa9.entry.js +5 -0
  158. package/dist/nano-components/{p-6920ad69.entry.js.map → p-27422aa9.entry.js.map} +1 -1
  159. package/dist/nano-components/p-2d79f5b3.js +5 -0
  160. package/dist/nano-components/{p-0697795a.entry.js → p-31c23d6e.entry.js} +2 -2
  161. package/dist/nano-components/p-31c23d6e.entry.js.map +1 -0
  162. package/dist/nano-components/p-487de04d.entry.js.map +1 -1
  163. package/dist/nano-components/p-570d2e50.entry.js +5 -0
  164. package/dist/nano-components/p-570d2e50.entry.js.map +1 -0
  165. package/dist/nano-components/{p-3eb6d833.entry.js → p-5a4b3fa9.entry.js} +2 -2
  166. package/dist/nano-components/p-653ae985.js +5 -0
  167. package/dist/nano-components/p-653ae985.js.map +1 -0
  168. package/dist/nano-components/p-676a4744.entry.js +5 -0
  169. package/dist/nano-components/{p-d0eefd52.entry.js.map → p-676a4744.entry.js.map} +1 -1
  170. package/dist/nano-components/p-8fe51abf.js +5 -0
  171. package/dist/nano-components/{p-4884b65a.entry.js → p-90cd4f56.entry.js} +2 -2
  172. package/dist/nano-components/p-90cd4f56.entry.js.map +1 -0
  173. package/dist/nano-components/p-9ba81ed2.js +5 -0
  174. package/dist/nano-components/p-9ba81ed2.js.map +1 -0
  175. package/dist/nano-components/p-9bfdee71.js +5 -0
  176. package/dist/nano-components/p-9bfdee71.js.map +1 -0
  177. package/dist/nano-components/p-a8d6ca38.entry.js +5 -0
  178. package/dist/nano-components/p-a8d6ca38.entry.js.map +1 -0
  179. package/dist/nano-components/p-ace7743c.entry.js +5 -0
  180. package/dist/nano-components/p-ace7743c.entry.js.map +1 -0
  181. package/dist/nano-components/{p-17ee0c07.entry.js → p-bab2888b.entry.js} +2 -2
  182. package/dist/nano-components/p-bdb5b6fc.entry.js +5 -0
  183. package/dist/nano-components/p-bdb5b6fc.entry.js.map +1 -0
  184. package/dist/nano-components/p-cad86fb8.js +5 -0
  185. package/dist/nano-components/p-cad86fb8.js.map +1 -0
  186. package/dist/nano-components/p-dc565459.js +5 -0
  187. package/dist/nano-components/p-dc565459.js.map +1 -0
  188. package/dist/nano-components/p-ede12d35.entry.js +5 -0
  189. package/dist/nano-components/p-ede12d35.entry.js.map +1 -0
  190. package/dist/nano-components/p-f504b1df.entry.js +7 -0
  191. package/dist/nano-components/p-f504b1df.entry.js.map +1 -0
  192. package/dist/nano-components/{p-db370094.entry.js → p-f7a4c62b.entry.js} +2 -2
  193. package/dist/themes/london-calling.css.map +1 -1
  194. package/dist/themes/nanopore.cn.css.map +1 -1
  195. package/dist/themes/nanopore.css.map +1 -1
  196. package/dist/types/components/alert/alert.d.ts +1 -0
  197. package/dist/types/components/algolia/algolia-interface.d.ts +1 -1
  198. package/dist/types/components/algolia/algolia.d.ts +1 -1
  199. package/dist/types/components/dialog/dialog.d.ts +15 -4
  200. package/dist/types/components/drawer/drawer.d.ts +69 -50
  201. package/dist/types/components/sticker/sticker.d.ts +4 -4
  202. package/dist/types/components/table/table.d.ts +0 -1
  203. package/dist/types/components.d.ts +50 -28
  204. package/dist/types/types/algolia.d.ts +4 -0
  205. package/dist/types/types/scss.vars.d.ts +4 -0
  206. package/dist/types/utils/events.d.ts +7 -0
  207. package/dist/types/utils/slot.d.ts +3 -3
  208. package/docs-json.json +268 -61
  209. package/docs-vscode.json +28 -11
  210. package/hydrate/index.js +1345 -2245
  211. package/package.json +4 -4
  212. package/dist/cjs/_commonjsHelpers-9f2314fc.js.map +0 -1
  213. package/dist/cjs/algoliasearch.umd-689c1560.js +0 -15
  214. package/dist/cjs/algoliasearch.umd-689c1560.js.map +0 -1
  215. package/dist/cjs/component-store-f1dc1276.js +0 -2261
  216. package/dist/cjs/component-store-f1dc1276.js.map +0 -1
  217. package/dist/cjs/nano-table-04993bb4.js.map +0 -1
  218. package/dist/cjs/slot-a448c1a7.js.map +0 -1
  219. package/dist/cjs/table.worker-85877b23.js.map +0 -1
  220. package/dist/components/algoliasearch.umd.js +0 -13
  221. package/dist/components/algoliasearch.umd.js.map +0 -1
  222. package/dist/esm/_commonjsHelpers-e401b2a2.js.map +0 -1
  223. package/dist/esm/algoliasearch.umd-4f7efa84.js +0 -13
  224. package/dist/esm/algoliasearch.umd-4f7efa84.js.map +0 -1
  225. package/dist/esm/component-store-c23ebc9c.js +0 -2259
  226. package/dist/esm/component-store-c23ebc9c.js.map +0 -1
  227. package/dist/esm/nano-table-91f09583.js.map +0 -1
  228. package/dist/esm/slot-a4f6e2af.js.map +0 -1
  229. package/dist/esm/table.worker-625475ba.js.map +0 -1
  230. package/dist/nano-components/p-0697795a.entry.js.map +0 -1
  231. package/dist/nano-components/p-17b099cc.entry.js +0 -5
  232. package/dist/nano-components/p-17b099cc.entry.js.map +0 -1
  233. package/dist/nano-components/p-1a0b5bc3.js +0 -5
  234. package/dist/nano-components/p-1a0b5bc3.js.map +0 -1
  235. package/dist/nano-components/p-3de3449e.js +0 -5
  236. package/dist/nano-components/p-3de3449e.js.map +0 -1
  237. package/dist/nano-components/p-4884b65a.entry.js.map +0 -1
  238. package/dist/nano-components/p-58cf5446.js +0 -5
  239. package/dist/nano-components/p-58cf5446.js.map +0 -1
  240. package/dist/nano-components/p-6920ad69.entry.js +0 -5
  241. package/dist/nano-components/p-69a3e911.js +0 -5
  242. package/dist/nano-components/p-7baa9e14.entry.js +0 -5
  243. package/dist/nano-components/p-7baa9e14.entry.js.map +0 -1
  244. package/dist/nano-components/p-a362bd23.entry.js +0 -5
  245. package/dist/nano-components/p-a362bd23.entry.js.map +0 -1
  246. package/dist/nano-components/p-b04fd7ca.entry.js +0 -5
  247. package/dist/nano-components/p-b04fd7ca.entry.js.map +0 -1
  248. package/dist/nano-components/p-b72df1aa.entry.js +0 -5
  249. package/dist/nano-components/p-b72df1aa.entry.js.map +0 -1
  250. package/dist/nano-components/p-ce5efc3f.entry.js +0 -5
  251. package/dist/nano-components/p-ce5efc3f.entry.js.map +0 -1
  252. package/dist/nano-components/p-d0eefd52.entry.js +0 -5
  253. package/dist/nano-components/p-dfbf0d56.js +0 -5
  254. package/dist/nano-components/p-e2b2b015.entry.js +0 -5
  255. package/dist/nano-components/p-e2b2b015.entry.js.map +0 -1
  256. package/dist/nano-components/p-ed6adde2.js +0 -7
  257. package/dist/nano-components/p-ed6adde2.js.map +0 -1
  258. package/dist/types/dom.ie.d.ts +0 -3
  259. /package/dist/nano-components/{p-17ee0c07.entry.js.map → p-2d79f5b3.js.map} +0 -0
  260. /package/dist/nano-components/{p-3eb6d833.entry.js.map → p-5a4b3fa9.entry.js.map} +0 -0
  261. /package/dist/nano-components/{p-69a3e911.js.map → p-8fe51abf.js.map} +0 -0
  262. /package/dist/nano-components/{p-dfbf0d56.js.map → p-bab2888b.entry.js.map} +0 -0
  263. /package/dist/nano-components/{p-db370094.entry.js.map → p-f7a4c62b.entry.js.map} +0 -0
@@ -1,2261 +0,0 @@
1
- /*!
2
- * Web Components for Nanopore digital Web Apps
3
- */
4
- 'use strict';
5
-
6
- const index = require('./index-71f899a7.js');
7
- const throttle = require('./throttle-dfa64b9e.js');
8
- const _commonjsHelpers = require('./_commonjsHelpers-9f2314fc.js');
9
-
10
- /* eslint complexity: [2, 18], max-statements: [2, 33] */
11
- var shams = function hasSymbols() {
12
- if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
13
- if (typeof Symbol.iterator === 'symbol') { return true; }
14
-
15
- var obj = {};
16
- var sym = Symbol('test');
17
- var symObj = Object(sym);
18
- if (typeof sym === 'string') { return false; }
19
-
20
- if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
21
- if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
22
-
23
- // temp disabled per https://github.com/ljharb/object.assign/issues/17
24
- // if (sym instanceof Symbol) { return false; }
25
- // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
26
- // if (!(symObj instanceof Symbol)) { return false; }
27
-
28
- // if (typeof Symbol.prototype.toString !== 'function') { return false; }
29
- // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
30
-
31
- var symVal = 42;
32
- obj[sym] = symVal;
33
- for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
34
- if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
35
-
36
- if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
37
-
38
- var syms = Object.getOwnPropertySymbols(obj);
39
- if (syms.length !== 1 || syms[0] !== sym) { return false; }
40
-
41
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
42
-
43
- if (typeof Object.getOwnPropertyDescriptor === 'function') {
44
- var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
45
- if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
46
- }
47
-
48
- return true;
49
- };
50
-
51
- var origSymbol = typeof Symbol !== 'undefined' && Symbol;
52
-
53
-
54
- var hasSymbols$1 = function hasNativeSymbols() {
55
- if (typeof origSymbol !== 'function') { return false; }
56
- if (typeof Symbol !== 'function') { return false; }
57
- if (typeof origSymbol('foo') !== 'symbol') { return false; }
58
- if (typeof Symbol('bar') !== 'symbol') { return false; }
59
-
60
- return shams();
61
- };
62
-
63
- /* eslint no-invalid-this: 1 */
64
-
65
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
66
- var slice = Array.prototype.slice;
67
- var toStr$1 = Object.prototype.toString;
68
- var funcType = '[object Function]';
69
-
70
- var implementation = function bind(that) {
71
- var target = this;
72
- if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
73
- throw new TypeError(ERROR_MESSAGE + target);
74
- }
75
- var args = slice.call(arguments, 1);
76
-
77
- var bound;
78
- var binder = function () {
79
- if (this instanceof bound) {
80
- var result = target.apply(
81
- this,
82
- args.concat(slice.call(arguments))
83
- );
84
- if (Object(result) === result) {
85
- return result;
86
- }
87
- return this;
88
- } else {
89
- return target.apply(
90
- that,
91
- args.concat(slice.call(arguments))
92
- );
93
- }
94
- };
95
-
96
- var boundLength = Math.max(0, target.length - args.length);
97
- var boundArgs = [];
98
- for (var i = 0; i < boundLength; i++) {
99
- boundArgs.push('$' + i);
100
- }
101
-
102
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
103
-
104
- if (target.prototype) {
105
- var Empty = function Empty() {};
106
- Empty.prototype = target.prototype;
107
- bound.prototype = new Empty();
108
- Empty.prototype = null;
109
- }
110
-
111
- return bound;
112
- };
113
-
114
- var functionBind = Function.prototype.bind || implementation;
115
-
116
- var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
117
-
118
- var undefined$1;
119
-
120
- var $SyntaxError = SyntaxError;
121
- var $Function = Function;
122
- var $TypeError$1 = TypeError;
123
-
124
- // eslint-disable-next-line consistent-return
125
- var getEvalledConstructor = function (expressionSyntax) {
126
- try {
127
- return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
128
- } catch (e) {}
129
- };
130
-
131
- var $gOPD = Object.getOwnPropertyDescriptor;
132
-
133
- var throwTypeError = function () {
134
- throw new $TypeError$1();
135
- };
136
- var ThrowTypeError = $gOPD
137
- ? (function () {
138
- try {
139
- return throwTypeError;
140
- } catch (calleeThrows) {
141
- try {
142
- // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
143
- return $gOPD(arguments, 'callee').get;
144
- } catch (gOPDthrows) {
145
- return throwTypeError;
146
- }
147
- }
148
- }())
149
- : throwTypeError;
150
-
151
- var hasSymbols = hasSymbols$1();
152
-
153
- var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
154
-
155
- var needsEval = {};
156
-
157
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
158
-
159
- var INTRINSICS = {
160
- '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
161
- '%Array%': Array,
162
- '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
163
- '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
164
- '%AsyncFromSyncIteratorPrototype%': undefined$1,
165
- '%AsyncFunction%': needsEval,
166
- '%AsyncGenerator%': needsEval,
167
- '%AsyncGeneratorFunction%': needsEval,
168
- '%AsyncIteratorPrototype%': needsEval,
169
- '%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
170
- '%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
171
- '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
172
- '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
173
- '%Boolean%': Boolean,
174
- '%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
175
- '%Date%': Date,
176
- '%decodeURI%': decodeURI,
177
- '%decodeURIComponent%': decodeURIComponent,
178
- '%encodeURI%': encodeURI,
179
- '%encodeURIComponent%': encodeURIComponent,
180
- '%Error%': Error,
181
- '%eval%': eval, // eslint-disable-line no-eval
182
- '%EvalError%': EvalError,
183
- '%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
184
- '%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
185
- '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
186
- '%Function%': $Function,
187
- '%GeneratorFunction%': needsEval,
188
- '%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
189
- '%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
190
- '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
191
- '%isFinite%': isFinite,
192
- '%isNaN%': isNaN,
193
- '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
194
- '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
195
- '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
196
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
197
- '%Math%': Math,
198
- '%Number%': Number,
199
- '%Object%': Object,
200
- '%parseFloat%': parseFloat,
201
- '%parseInt%': parseInt,
202
- '%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
203
- '%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
204
- '%RangeError%': RangeError,
205
- '%ReferenceError%': ReferenceError,
206
- '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
207
- '%RegExp%': RegExp,
208
- '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
209
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
210
- '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
211
- '%String%': String,
212
- '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
213
- '%Symbol%': hasSymbols ? Symbol : undefined$1,
214
- '%SyntaxError%': $SyntaxError,
215
- '%ThrowTypeError%': ThrowTypeError,
216
- '%TypedArray%': TypedArray,
217
- '%TypeError%': $TypeError$1,
218
- '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
219
- '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
220
- '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
221
- '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
222
- '%URIError%': URIError,
223
- '%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
224
- '%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
225
- '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
226
- };
227
-
228
- var doEval = function doEval(name) {
229
- var value;
230
- if (name === '%AsyncFunction%') {
231
- value = getEvalledConstructor('async function () {}');
232
- } else if (name === '%GeneratorFunction%') {
233
- value = getEvalledConstructor('function* () {}');
234
- } else if (name === '%AsyncGeneratorFunction%') {
235
- value = getEvalledConstructor('async function* () {}');
236
- } else if (name === '%AsyncGenerator%') {
237
- var fn = doEval('%AsyncGeneratorFunction%');
238
- if (fn) {
239
- value = fn.prototype;
240
- }
241
- } else if (name === '%AsyncIteratorPrototype%') {
242
- var gen = doEval('%AsyncGenerator%');
243
- if (gen) {
244
- value = getProto(gen.prototype);
245
- }
246
- }
247
-
248
- INTRINSICS[name] = value;
249
-
250
- return value;
251
- };
252
-
253
- var LEGACY_ALIASES = {
254
- '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
255
- '%ArrayPrototype%': ['Array', 'prototype'],
256
- '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
257
- '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
258
- '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
259
- '%ArrayProto_values%': ['Array', 'prototype', 'values'],
260
- '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
261
- '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
262
- '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
263
- '%BooleanPrototype%': ['Boolean', 'prototype'],
264
- '%DataViewPrototype%': ['DataView', 'prototype'],
265
- '%DatePrototype%': ['Date', 'prototype'],
266
- '%ErrorPrototype%': ['Error', 'prototype'],
267
- '%EvalErrorPrototype%': ['EvalError', 'prototype'],
268
- '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
269
- '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
270
- '%FunctionPrototype%': ['Function', 'prototype'],
271
- '%Generator%': ['GeneratorFunction', 'prototype'],
272
- '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
273
- '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
274
- '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
275
- '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
276
- '%JSONParse%': ['JSON', 'parse'],
277
- '%JSONStringify%': ['JSON', 'stringify'],
278
- '%MapPrototype%': ['Map', 'prototype'],
279
- '%NumberPrototype%': ['Number', 'prototype'],
280
- '%ObjectPrototype%': ['Object', 'prototype'],
281
- '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
282
- '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
283
- '%PromisePrototype%': ['Promise', 'prototype'],
284
- '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
285
- '%Promise_all%': ['Promise', 'all'],
286
- '%Promise_reject%': ['Promise', 'reject'],
287
- '%Promise_resolve%': ['Promise', 'resolve'],
288
- '%RangeErrorPrototype%': ['RangeError', 'prototype'],
289
- '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
290
- '%RegExpPrototype%': ['RegExp', 'prototype'],
291
- '%SetPrototype%': ['Set', 'prototype'],
292
- '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
293
- '%StringPrototype%': ['String', 'prototype'],
294
- '%SymbolPrototype%': ['Symbol', 'prototype'],
295
- '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
296
- '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
297
- '%TypeErrorPrototype%': ['TypeError', 'prototype'],
298
- '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
299
- '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
300
- '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
301
- '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
302
- '%URIErrorPrototype%': ['URIError', 'prototype'],
303
- '%WeakMapPrototype%': ['WeakMap', 'prototype'],
304
- '%WeakSetPrototype%': ['WeakSet', 'prototype']
305
- };
306
-
307
-
308
-
309
- var $concat$1 = functionBind.call(Function.call, Array.prototype.concat);
310
- var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
311
- var $replace$1 = functionBind.call(Function.call, String.prototype.replace);
312
- var $strSlice = functionBind.call(Function.call, String.prototype.slice);
313
- var $exec = functionBind.call(Function.call, RegExp.prototype.exec);
314
-
315
- /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
316
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
317
- var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
318
- var stringToPath = function stringToPath(string) {
319
- var first = $strSlice(string, 0, 1);
320
- var last = $strSlice(string, -1);
321
- if (first === '%' && last !== '%') {
322
- throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
323
- } else if (last === '%' && first !== '%') {
324
- throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
325
- }
326
- var result = [];
327
- $replace$1(string, rePropName, function (match, number, quote, subString) {
328
- result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
329
- });
330
- return result;
331
- };
332
- /* end adaptation */
333
-
334
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
335
- var intrinsicName = name;
336
- var alias;
337
- if (src(LEGACY_ALIASES, intrinsicName)) {
338
- alias = LEGACY_ALIASES[intrinsicName];
339
- intrinsicName = '%' + alias[0] + '%';
340
- }
341
-
342
- if (src(INTRINSICS, intrinsicName)) {
343
- var value = INTRINSICS[intrinsicName];
344
- if (value === needsEval) {
345
- value = doEval(intrinsicName);
346
- }
347
- if (typeof value === 'undefined' && !allowMissing) {
348
- throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
349
- }
350
-
351
- return {
352
- alias: alias,
353
- name: intrinsicName,
354
- value: value
355
- };
356
- }
357
-
358
- throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
359
- };
360
-
361
- var getIntrinsic = function GetIntrinsic(name, allowMissing) {
362
- if (typeof name !== 'string' || name.length === 0) {
363
- throw new $TypeError$1('intrinsic name must be a non-empty string');
364
- }
365
- if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
366
- throw new $TypeError$1('"allowMissing" argument must be a boolean');
367
- }
368
-
369
- if ($exec(/^%?[^%]*%?$/, name) === null) {
370
- throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
371
- }
372
- var parts = stringToPath(name);
373
- var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
374
-
375
- var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
376
- var intrinsicRealName = intrinsic.name;
377
- var value = intrinsic.value;
378
- var skipFurtherCaching = false;
379
-
380
- var alias = intrinsic.alias;
381
- if (alias) {
382
- intrinsicBaseName = alias[0];
383
- $spliceApply(parts, $concat$1([0, 1], alias));
384
- }
385
-
386
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
387
- var part = parts[i];
388
- var first = $strSlice(part, 0, 1);
389
- var last = $strSlice(part, -1);
390
- if (
391
- (
392
- (first === '"' || first === "'" || first === '`')
393
- || (last === '"' || last === "'" || last === '`')
394
- )
395
- && first !== last
396
- ) {
397
- throw new $SyntaxError('property names with quotes must have matching quotes');
398
- }
399
- if (part === 'constructor' || !isOwn) {
400
- skipFurtherCaching = true;
401
- }
402
-
403
- intrinsicBaseName += '.' + part;
404
- intrinsicRealName = '%' + intrinsicBaseName + '%';
405
-
406
- if (src(INTRINSICS, intrinsicRealName)) {
407
- value = INTRINSICS[intrinsicRealName];
408
- } else if (value != null) {
409
- if (!(part in value)) {
410
- if (!allowMissing) {
411
- throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
412
- }
413
- return void undefined$1;
414
- }
415
- if ($gOPD && (i + 1) >= parts.length) {
416
- var desc = $gOPD(value, part);
417
- isOwn = !!desc;
418
-
419
- // By convention, when a data property is converted to an accessor
420
- // property to emulate a data property that does not suffer from
421
- // the override mistake, that accessor's getter is marked with
422
- // an `originalValue` property. Here, when we detect this, we
423
- // uphold the illusion by pretending to see that original data
424
- // property, i.e., returning the value rather than the getter
425
- // itself.
426
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
427
- value = desc.get;
428
- } else {
429
- value = value[part];
430
- }
431
- } else {
432
- isOwn = src(value, part);
433
- value = value[part];
434
- }
435
-
436
- if (isOwn && !skipFurtherCaching) {
437
- INTRINSICS[intrinsicRealName] = value;
438
- }
439
- }
440
- }
441
- return value;
442
- };
443
-
444
- var callBind = _commonjsHelpers.createCommonjsModule(function (module) {
445
-
446
-
447
-
448
-
449
- var $apply = getIntrinsic('%Function.prototype.apply%');
450
- var $call = getIntrinsic('%Function.prototype.call%');
451
- var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
452
-
453
- var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
454
- var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
455
- var $max = getIntrinsic('%Math.max%');
456
-
457
- if ($defineProperty) {
458
- try {
459
- $defineProperty({}, 'a', { value: 1 });
460
- } catch (e) {
461
- // IE 8 has a broken defineProperty
462
- $defineProperty = null;
463
- }
464
- }
465
-
466
- module.exports = function callBind(originalFunction) {
467
- var func = $reflectApply(functionBind, $call, arguments);
468
- if ($gOPD && $defineProperty) {
469
- var desc = $gOPD(func, 'length');
470
- if (desc.configurable) {
471
- // original length, plus the receiver, minus any additional arguments (after the receiver)
472
- $defineProperty(
473
- func,
474
- 'length',
475
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
476
- );
477
- }
478
- }
479
- return func;
480
- };
481
-
482
- var applyBind = function applyBind() {
483
- return $reflectApply(functionBind, $apply, arguments);
484
- };
485
-
486
- if ($defineProperty) {
487
- $defineProperty(module.exports, 'apply', { value: applyBind });
488
- } else {
489
- module.exports.apply = applyBind;
490
- }
491
- });
492
-
493
- var $indexOf = callBind(getIntrinsic('String.prototype.indexOf'));
494
-
495
- var callBound = function callBoundIntrinsic(name, allowMissing) {
496
- var intrinsic = getIntrinsic(name, !!allowMissing);
497
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
498
- return callBind(intrinsic);
499
- }
500
- return intrinsic;
501
- };
502
-
503
- const _nodeResolve_empty = {};
504
-
505
- const _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
506
- __proto__: null,
507
- 'default': _nodeResolve_empty
508
- });
509
-
510
- const utilInspect = /*@__PURE__*/_commonjsHelpers.getAugmentedNamespace(_nodeResolve_empty$1);
511
-
512
- var hasMap = typeof Map === 'function' && Map.prototype;
513
- var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
514
- var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
515
- var mapForEach = hasMap && Map.prototype.forEach;
516
- var hasSet = typeof Set === 'function' && Set.prototype;
517
- var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
518
- var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
519
- var setForEach = hasSet && Set.prototype.forEach;
520
- var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
521
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
522
- var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
523
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
524
- var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
525
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
526
- var booleanValueOf = Boolean.prototype.valueOf;
527
- var objectToString = Object.prototype.toString;
528
- var functionToString = Function.prototype.toString;
529
- var $match = String.prototype.match;
530
- var $slice = String.prototype.slice;
531
- var $replace = String.prototype.replace;
532
- var $toUpperCase = String.prototype.toUpperCase;
533
- var $toLowerCase = String.prototype.toLowerCase;
534
- var $test = RegExp.prototype.test;
535
- var $concat = Array.prototype.concat;
536
- var $join = Array.prototype.join;
537
- var $arrSlice = Array.prototype.slice;
538
- var $floor = Math.floor;
539
- var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
540
- var gOPS = Object.getOwnPropertySymbols;
541
- var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
542
- var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
543
- // ie, `has-tostringtag/shams
544
- var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
545
- ? Symbol.toStringTag
546
- : null;
547
- var isEnumerable = Object.prototype.propertyIsEnumerable;
548
-
549
- var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
550
- [].__proto__ === Array.prototype // eslint-disable-line no-proto
551
- ? function (O) {
552
- return O.__proto__; // eslint-disable-line no-proto
553
- }
554
- : null
555
- );
556
-
557
- function addNumericSeparator(num, str) {
558
- if (
559
- num === Infinity
560
- || num === -Infinity
561
- || num !== num
562
- || (num && num > -1000 && num < 1000)
563
- || $test.call(/e/, str)
564
- ) {
565
- return str;
566
- }
567
- var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
568
- if (typeof num === 'number') {
569
- var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
570
- if (int !== num) {
571
- var intStr = String(int);
572
- var dec = $slice.call(str, intStr.length + 1);
573
- return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
574
- }
575
- }
576
- return $replace.call(str, sepRegex, '$&_');
577
- }
578
-
579
-
580
- var inspectCustom = utilInspect.custom;
581
- var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
582
-
583
- var objectInspect = function inspect_(obj, options, depth, seen) {
584
- var opts = options || {};
585
-
586
- if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
587
- throw new TypeError('option "quoteStyle" must be "single" or "double"');
588
- }
589
- if (
590
- has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
591
- ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
592
- : opts.maxStringLength !== null
593
- )
594
- ) {
595
- throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
596
- }
597
- var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
598
- if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
599
- throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
600
- }
601
-
602
- if (
603
- has$3(opts, 'indent')
604
- && opts.indent !== null
605
- && opts.indent !== '\t'
606
- && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
607
- ) {
608
- throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
609
- }
610
- if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
611
- throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
612
- }
613
- var numericSeparator = opts.numericSeparator;
614
-
615
- if (typeof obj === 'undefined') {
616
- return 'undefined';
617
- }
618
- if (obj === null) {
619
- return 'null';
620
- }
621
- if (typeof obj === 'boolean') {
622
- return obj ? 'true' : 'false';
623
- }
624
-
625
- if (typeof obj === 'string') {
626
- return inspectString(obj, opts);
627
- }
628
- if (typeof obj === 'number') {
629
- if (obj === 0) {
630
- return Infinity / obj > 0 ? '0' : '-0';
631
- }
632
- var str = String(obj);
633
- return numericSeparator ? addNumericSeparator(obj, str) : str;
634
- }
635
- if (typeof obj === 'bigint') {
636
- var bigIntStr = String(obj) + 'n';
637
- return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
638
- }
639
-
640
- var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
641
- if (typeof depth === 'undefined') { depth = 0; }
642
- if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
643
- return isArray$3(obj) ? '[Array]' : '[Object]';
644
- }
645
-
646
- var indent = getIndent(opts, depth);
647
-
648
- if (typeof seen === 'undefined') {
649
- seen = [];
650
- } else if (indexOf(seen, obj) >= 0) {
651
- return '[Circular]';
652
- }
653
-
654
- function inspect(value, from, noIndent) {
655
- if (from) {
656
- seen = $arrSlice.call(seen);
657
- seen.push(from);
658
- }
659
- if (noIndent) {
660
- var newOpts = {
661
- depth: opts.depth
662
- };
663
- if (has$3(opts, 'quoteStyle')) {
664
- newOpts.quoteStyle = opts.quoteStyle;
665
- }
666
- return inspect_(value, newOpts, depth + 1, seen);
667
- }
668
- return inspect_(value, opts, depth + 1, seen);
669
- }
670
-
671
- if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
672
- var name = nameOf(obj);
673
- var keys = arrObjKeys(obj, inspect);
674
- return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
675
- }
676
- if (isSymbol(obj)) {
677
- var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
678
- return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
679
- }
680
- if (isElement(obj)) {
681
- var s = '<' + $toLowerCase.call(String(obj.nodeName));
682
- var attrs = obj.attributes || [];
683
- for (var i = 0; i < attrs.length; i++) {
684
- s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
685
- }
686
- s += '>';
687
- if (obj.childNodes && obj.childNodes.length) { s += '...'; }
688
- s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
689
- return s;
690
- }
691
- if (isArray$3(obj)) {
692
- if (obj.length === 0) { return '[]'; }
693
- var xs = arrObjKeys(obj, inspect);
694
- if (indent && !singleLineValues(xs)) {
695
- return '[' + indentedJoin(xs, indent) + ']';
696
- }
697
- return '[ ' + $join.call(xs, ', ') + ' ]';
698
- }
699
- if (isError(obj)) {
700
- var parts = arrObjKeys(obj, inspect);
701
- if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
702
- return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
703
- }
704
- if (parts.length === 0) { return '[' + String(obj) + ']'; }
705
- return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
706
- }
707
- if (typeof obj === 'object' && customInspect) {
708
- if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
709
- return utilInspect(obj, { depth: maxDepth - depth });
710
- } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
711
- return obj.inspect();
712
- }
713
- }
714
- if (isMap(obj)) {
715
- var mapParts = [];
716
- if (mapForEach) {
717
- mapForEach.call(obj, function (value, key) {
718
- mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
719
- });
720
- }
721
- return collectionOf('Map', mapSize.call(obj), mapParts, indent);
722
- }
723
- if (isSet(obj)) {
724
- var setParts = [];
725
- if (setForEach) {
726
- setForEach.call(obj, function (value) {
727
- setParts.push(inspect(value, obj));
728
- });
729
- }
730
- return collectionOf('Set', setSize.call(obj), setParts, indent);
731
- }
732
- if (isWeakMap(obj)) {
733
- return weakCollectionOf('WeakMap');
734
- }
735
- if (isWeakSet(obj)) {
736
- return weakCollectionOf('WeakSet');
737
- }
738
- if (isWeakRef(obj)) {
739
- return weakCollectionOf('WeakRef');
740
- }
741
- if (isNumber(obj)) {
742
- return markBoxed(inspect(Number(obj)));
743
- }
744
- if (isBigInt(obj)) {
745
- return markBoxed(inspect(bigIntValueOf.call(obj)));
746
- }
747
- if (isBoolean(obj)) {
748
- return markBoxed(booleanValueOf.call(obj));
749
- }
750
- if (isString(obj)) {
751
- return markBoxed(inspect(String(obj)));
752
- }
753
- if (!isDate(obj) && !isRegExp$1(obj)) {
754
- var ys = arrObjKeys(obj, inspect);
755
- var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
756
- var protoTag = obj instanceof Object ? '' : 'null prototype';
757
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
758
- var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
759
- var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
760
- if (ys.length === 0) { return tag + '{}'; }
761
- if (indent) {
762
- return tag + '{' + indentedJoin(ys, indent) + '}';
763
- }
764
- return tag + '{ ' + $join.call(ys, ', ') + ' }';
765
- }
766
- return String(obj);
767
- };
768
-
769
- function wrapQuotes(s, defaultStyle, opts) {
770
- var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
771
- return quoteChar + s + quoteChar;
772
- }
773
-
774
- function quote(s) {
775
- return $replace.call(String(s), /"/g, '&quot;');
776
- }
777
-
778
- function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
779
- function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
780
- function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
781
- function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
782
- function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
783
- function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
784
- function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
785
-
786
- // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
787
- function isSymbol(obj) {
788
- if (hasShammedSymbols) {
789
- return obj && typeof obj === 'object' && obj instanceof Symbol;
790
- }
791
- if (typeof obj === 'symbol') {
792
- return true;
793
- }
794
- if (!obj || typeof obj !== 'object' || !symToString) {
795
- return false;
796
- }
797
- try {
798
- symToString.call(obj);
799
- return true;
800
- } catch (e) {}
801
- return false;
802
- }
803
-
804
- function isBigInt(obj) {
805
- if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
806
- return false;
807
- }
808
- try {
809
- bigIntValueOf.call(obj);
810
- return true;
811
- } catch (e) {}
812
- return false;
813
- }
814
-
815
- var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
816
- function has$3(obj, key) {
817
- return hasOwn.call(obj, key);
818
- }
819
-
820
- function toStr(obj) {
821
- return objectToString.call(obj);
822
- }
823
-
824
- function nameOf(f) {
825
- if (f.name) { return f.name; }
826
- var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
827
- if (m) { return m[1]; }
828
- return null;
829
- }
830
-
831
- function indexOf(xs, x) {
832
- if (xs.indexOf) { return xs.indexOf(x); }
833
- for (var i = 0, l = xs.length; i < l; i++) {
834
- if (xs[i] === x) { return i; }
835
- }
836
- return -1;
837
- }
838
-
839
- function isMap(x) {
840
- if (!mapSize || !x || typeof x !== 'object') {
841
- return false;
842
- }
843
- try {
844
- mapSize.call(x);
845
- try {
846
- setSize.call(x);
847
- } catch (s) {
848
- return true;
849
- }
850
- return x instanceof Map; // core-js workaround, pre-v2.5.0
851
- } catch (e) {}
852
- return false;
853
- }
854
-
855
- function isWeakMap(x) {
856
- if (!weakMapHas || !x || typeof x !== 'object') {
857
- return false;
858
- }
859
- try {
860
- weakMapHas.call(x, weakMapHas);
861
- try {
862
- weakSetHas.call(x, weakSetHas);
863
- } catch (s) {
864
- return true;
865
- }
866
- return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
867
- } catch (e) {}
868
- return false;
869
- }
870
-
871
- function isWeakRef(x) {
872
- if (!weakRefDeref || !x || typeof x !== 'object') {
873
- return false;
874
- }
875
- try {
876
- weakRefDeref.call(x);
877
- return true;
878
- } catch (e) {}
879
- return false;
880
- }
881
-
882
- function isSet(x) {
883
- if (!setSize || !x || typeof x !== 'object') {
884
- return false;
885
- }
886
- try {
887
- setSize.call(x);
888
- try {
889
- mapSize.call(x);
890
- } catch (m) {
891
- return true;
892
- }
893
- return x instanceof Set; // core-js workaround, pre-v2.5.0
894
- } catch (e) {}
895
- return false;
896
- }
897
-
898
- function isWeakSet(x) {
899
- if (!weakSetHas || !x || typeof x !== 'object') {
900
- return false;
901
- }
902
- try {
903
- weakSetHas.call(x, weakSetHas);
904
- try {
905
- weakMapHas.call(x, weakMapHas);
906
- } catch (s) {
907
- return true;
908
- }
909
- return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
910
- } catch (e) {}
911
- return false;
912
- }
913
-
914
- function isElement(x) {
915
- if (!x || typeof x !== 'object') { return false; }
916
- if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
917
- return true;
918
- }
919
- return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
920
- }
921
-
922
- function inspectString(str, opts) {
923
- if (str.length > opts.maxStringLength) {
924
- var remaining = str.length - opts.maxStringLength;
925
- var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
926
- return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
927
- }
928
- // eslint-disable-next-line no-control-regex
929
- var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
930
- return wrapQuotes(s, 'single', opts);
931
- }
932
-
933
- function lowbyte(c) {
934
- var n = c.charCodeAt(0);
935
- var x = {
936
- 8: 'b',
937
- 9: 't',
938
- 10: 'n',
939
- 12: 'f',
940
- 13: 'r'
941
- }[n];
942
- if (x) { return '\\' + x; }
943
- return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
944
- }
945
-
946
- function markBoxed(str) {
947
- return 'Object(' + str + ')';
948
- }
949
-
950
- function weakCollectionOf(type) {
951
- return type + ' { ? }';
952
- }
953
-
954
- function collectionOf(type, size, entries, indent) {
955
- var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
956
- return type + ' (' + size + ') {' + joinedEntries + '}';
957
- }
958
-
959
- function singleLineValues(xs) {
960
- for (var i = 0; i < xs.length; i++) {
961
- if (indexOf(xs[i], '\n') >= 0) {
962
- return false;
963
- }
964
- }
965
- return true;
966
- }
967
-
968
- function getIndent(opts, depth) {
969
- var baseIndent;
970
- if (opts.indent === '\t') {
971
- baseIndent = '\t';
972
- } else if (typeof opts.indent === 'number' && opts.indent > 0) {
973
- baseIndent = $join.call(Array(opts.indent + 1), ' ');
974
- } else {
975
- return null;
976
- }
977
- return {
978
- base: baseIndent,
979
- prev: $join.call(Array(depth + 1), baseIndent)
980
- };
981
- }
982
-
983
- function indentedJoin(xs, indent) {
984
- if (xs.length === 0) { return ''; }
985
- var lineJoiner = '\n' + indent.prev + indent.base;
986
- return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
987
- }
988
-
989
- function arrObjKeys(obj, inspect) {
990
- var isArr = isArray$3(obj);
991
- var xs = [];
992
- if (isArr) {
993
- xs.length = obj.length;
994
- for (var i = 0; i < obj.length; i++) {
995
- xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
996
- }
997
- }
998
- var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
999
- var symMap;
1000
- if (hasShammedSymbols) {
1001
- symMap = {};
1002
- for (var k = 0; k < syms.length; k++) {
1003
- symMap['$' + syms[k]] = syms[k];
1004
- }
1005
- }
1006
-
1007
- for (var key in obj) { // eslint-disable-line no-restricted-syntax
1008
- if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1009
- if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1010
- if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1011
- // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
1012
- continue; // eslint-disable-line no-restricted-syntax, no-continue
1013
- } else if ($test.call(/[^\w$]/, key)) {
1014
- xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
1015
- } else {
1016
- xs.push(key + ': ' + inspect(obj[key], obj));
1017
- }
1018
- }
1019
- if (typeof gOPS === 'function') {
1020
- for (var j = 0; j < syms.length; j++) {
1021
- if (isEnumerable.call(obj, syms[j])) {
1022
- xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
1023
- }
1024
- }
1025
- }
1026
- return xs;
1027
- }
1028
-
1029
- var $TypeError = getIntrinsic('%TypeError%');
1030
- var $WeakMap = getIntrinsic('%WeakMap%', true);
1031
- var $Map = getIntrinsic('%Map%', true);
1032
-
1033
- var $weakMapGet = callBound('WeakMap.prototype.get', true);
1034
- var $weakMapSet = callBound('WeakMap.prototype.set', true);
1035
- var $weakMapHas = callBound('WeakMap.prototype.has', true);
1036
- var $mapGet = callBound('Map.prototype.get', true);
1037
- var $mapSet = callBound('Map.prototype.set', true);
1038
- var $mapHas = callBound('Map.prototype.has', true);
1039
-
1040
- /*
1041
- * This function traverses the list returning the node corresponding to the
1042
- * given key.
1043
- *
1044
- * That node is also moved to the head of the list, so that if it's accessed
1045
- * again we don't need to traverse the whole list. By doing so, all the recently
1046
- * used nodes can be accessed relatively quickly.
1047
- */
1048
- var listGetNode = function (list, key) { // eslint-disable-line consistent-return
1049
- for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
1050
- if (curr.key === key) {
1051
- prev.next = curr.next;
1052
- curr.next = list.next;
1053
- list.next = curr; // eslint-disable-line no-param-reassign
1054
- return curr;
1055
- }
1056
- }
1057
- };
1058
-
1059
- var listGet = function (objects, key) {
1060
- var node = listGetNode(objects, key);
1061
- return node && node.value;
1062
- };
1063
- var listSet = function (objects, key, value) {
1064
- var node = listGetNode(objects, key);
1065
- if (node) {
1066
- node.value = value;
1067
- } else {
1068
- // Prepend the new node to the beginning of the list
1069
- objects.next = { // eslint-disable-line no-param-reassign
1070
- key: key,
1071
- next: objects.next,
1072
- value: value
1073
- };
1074
- }
1075
- };
1076
- var listHas = function (objects, key) {
1077
- return !!listGetNode(objects, key);
1078
- };
1079
-
1080
- var sideChannel = function getSideChannel() {
1081
- var $wm;
1082
- var $m;
1083
- var $o;
1084
- var channel = {
1085
- assert: function (key) {
1086
- if (!channel.has(key)) {
1087
- throw new $TypeError('Side channel does not contain ' + objectInspect(key));
1088
- }
1089
- },
1090
- get: function (key) { // eslint-disable-line consistent-return
1091
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1092
- if ($wm) {
1093
- return $weakMapGet($wm, key);
1094
- }
1095
- } else if ($Map) {
1096
- if ($m) {
1097
- return $mapGet($m, key);
1098
- }
1099
- } else {
1100
- if ($o) { // eslint-disable-line no-lonely-if
1101
- return listGet($o, key);
1102
- }
1103
- }
1104
- },
1105
- has: function (key) {
1106
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1107
- if ($wm) {
1108
- return $weakMapHas($wm, key);
1109
- }
1110
- } else if ($Map) {
1111
- if ($m) {
1112
- return $mapHas($m, key);
1113
- }
1114
- } else {
1115
- if ($o) { // eslint-disable-line no-lonely-if
1116
- return listHas($o, key);
1117
- }
1118
- }
1119
- return false;
1120
- },
1121
- set: function (key, value) {
1122
- if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
1123
- if (!$wm) {
1124
- $wm = new $WeakMap();
1125
- }
1126
- $weakMapSet($wm, key, value);
1127
- } else if ($Map) {
1128
- if (!$m) {
1129
- $m = new $Map();
1130
- }
1131
- $mapSet($m, key, value);
1132
- } else {
1133
- if (!$o) {
1134
- /*
1135
- * Initialize the linked list as an empty node, so that we don't have
1136
- * to special-case handling of the first node: we can always refer to
1137
- * it as (previous node).next, instead of something like (list).head
1138
- */
1139
- $o = { key: {}, next: null };
1140
- }
1141
- listSet($o, key, value);
1142
- }
1143
- }
1144
- };
1145
- return channel;
1146
- };
1147
-
1148
- var replace = String.prototype.replace;
1149
- var percentTwenties = /%20/g;
1150
-
1151
- var Format = {
1152
- RFC1738: 'RFC1738',
1153
- RFC3986: 'RFC3986'
1154
- };
1155
-
1156
- var formats = {
1157
- 'default': Format.RFC3986,
1158
- formatters: {
1159
- RFC1738: function (value) {
1160
- return replace.call(value, percentTwenties, '+');
1161
- },
1162
- RFC3986: function (value) {
1163
- return String(value);
1164
- }
1165
- },
1166
- RFC1738: Format.RFC1738,
1167
- RFC3986: Format.RFC3986
1168
- };
1169
-
1170
- var has$2 = Object.prototype.hasOwnProperty;
1171
- var isArray$2 = Array.isArray;
1172
-
1173
- var hexTable = (function () {
1174
- var array = [];
1175
- for (var i = 0; i < 256; ++i) {
1176
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
1177
- }
1178
-
1179
- return array;
1180
- }());
1181
-
1182
- var compactQueue = function compactQueue(queue) {
1183
- while (queue.length > 1) {
1184
- var item = queue.pop();
1185
- var obj = item.obj[item.prop];
1186
-
1187
- if (isArray$2(obj)) {
1188
- var compacted = [];
1189
-
1190
- for (var j = 0; j < obj.length; ++j) {
1191
- if (typeof obj[j] !== 'undefined') {
1192
- compacted.push(obj[j]);
1193
- }
1194
- }
1195
-
1196
- item.obj[item.prop] = compacted;
1197
- }
1198
- }
1199
- };
1200
-
1201
- var arrayToObject = function arrayToObject(source, options) {
1202
- var obj = options && options.plainObjects ? Object.create(null) : {};
1203
- for (var i = 0; i < source.length; ++i) {
1204
- if (typeof source[i] !== 'undefined') {
1205
- obj[i] = source[i];
1206
- }
1207
- }
1208
-
1209
- return obj;
1210
- };
1211
-
1212
- var merge = function merge(target, source, options) {
1213
- /* eslint no-param-reassign: 0 */
1214
- if (!source) {
1215
- return target;
1216
- }
1217
-
1218
- if (typeof source !== 'object') {
1219
- if (isArray$2(target)) {
1220
- target.push(source);
1221
- } else if (target && typeof target === 'object') {
1222
- if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
1223
- target[source] = true;
1224
- }
1225
- } else {
1226
- return [target, source];
1227
- }
1228
-
1229
- return target;
1230
- }
1231
-
1232
- if (!target || typeof target !== 'object') {
1233
- return [target].concat(source);
1234
- }
1235
-
1236
- var mergeTarget = target;
1237
- if (isArray$2(target) && !isArray$2(source)) {
1238
- mergeTarget = arrayToObject(target, options);
1239
- }
1240
-
1241
- if (isArray$2(target) && isArray$2(source)) {
1242
- source.forEach(function (item, i) {
1243
- if (has$2.call(target, i)) {
1244
- var targetItem = target[i];
1245
- if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1246
- target[i] = merge(targetItem, item, options);
1247
- } else {
1248
- target.push(item);
1249
- }
1250
- } else {
1251
- target[i] = item;
1252
- }
1253
- });
1254
- return target;
1255
- }
1256
-
1257
- return Object.keys(source).reduce(function (acc, key) {
1258
- var value = source[key];
1259
-
1260
- if (has$2.call(acc, key)) {
1261
- acc[key] = merge(acc[key], value, options);
1262
- } else {
1263
- acc[key] = value;
1264
- }
1265
- return acc;
1266
- }, mergeTarget);
1267
- };
1268
-
1269
- var assign = function assignSingleSource(target, source) {
1270
- return Object.keys(source).reduce(function (acc, key) {
1271
- acc[key] = source[key];
1272
- return acc;
1273
- }, target);
1274
- };
1275
-
1276
- var decode = function (str, decoder, charset) {
1277
- var strWithoutPlus = str.replace(/\+/g, ' ');
1278
- if (charset === 'iso-8859-1') {
1279
- // unescape never throws, no try...catch needed:
1280
- return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
1281
- }
1282
- // utf-8
1283
- try {
1284
- return decodeURIComponent(strWithoutPlus);
1285
- } catch (e) {
1286
- return strWithoutPlus;
1287
- }
1288
- };
1289
-
1290
- var encode = function encode(str, defaultEncoder, charset, kind, format) {
1291
- // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
1292
- // It has been adapted here for stricter adherence to RFC 3986
1293
- if (str.length === 0) {
1294
- return str;
1295
- }
1296
-
1297
- var string = str;
1298
- if (typeof str === 'symbol') {
1299
- string = Symbol.prototype.toString.call(str);
1300
- } else if (typeof str !== 'string') {
1301
- string = String(str);
1302
- }
1303
-
1304
- if (charset === 'iso-8859-1') {
1305
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
1306
- return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
1307
- });
1308
- }
1309
-
1310
- var out = '';
1311
- for (var i = 0; i < string.length; ++i) {
1312
- var c = string.charCodeAt(i);
1313
-
1314
- if (
1315
- c === 0x2D // -
1316
- || c === 0x2E // .
1317
- || c === 0x5F // _
1318
- || c === 0x7E // ~
1319
- || (c >= 0x30 && c <= 0x39) // 0-9
1320
- || (c >= 0x41 && c <= 0x5A) // a-z
1321
- || (c >= 0x61 && c <= 0x7A) // A-Z
1322
- || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1323
- ) {
1324
- out += string.charAt(i);
1325
- continue;
1326
- }
1327
-
1328
- if (c < 0x80) {
1329
- out = out + hexTable[c];
1330
- continue;
1331
- }
1332
-
1333
- if (c < 0x800) {
1334
- out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
1335
- continue;
1336
- }
1337
-
1338
- if (c < 0xD800 || c >= 0xE000) {
1339
- out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
1340
- continue;
1341
- }
1342
-
1343
- i += 1;
1344
- c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
1345
- /* eslint operator-linebreak: [2, "before"] */
1346
- out += hexTable[0xF0 | (c >> 18)]
1347
- + hexTable[0x80 | ((c >> 12) & 0x3F)]
1348
- + hexTable[0x80 | ((c >> 6) & 0x3F)]
1349
- + hexTable[0x80 | (c & 0x3F)];
1350
- }
1351
-
1352
- return out;
1353
- };
1354
-
1355
- var compact = function compact(value) {
1356
- var queue = [{ obj: { o: value }, prop: 'o' }];
1357
- var refs = [];
1358
-
1359
- for (var i = 0; i < queue.length; ++i) {
1360
- var item = queue[i];
1361
- var obj = item.obj[item.prop];
1362
-
1363
- var keys = Object.keys(obj);
1364
- for (var j = 0; j < keys.length; ++j) {
1365
- var key = keys[j];
1366
- var val = obj[key];
1367
- if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
1368
- queue.push({ obj: obj, prop: key });
1369
- refs.push(val);
1370
- }
1371
- }
1372
- }
1373
-
1374
- compactQueue(queue);
1375
-
1376
- return value;
1377
- };
1378
-
1379
- var isRegExp = function isRegExp(obj) {
1380
- return Object.prototype.toString.call(obj) === '[object RegExp]';
1381
- };
1382
-
1383
- var isBuffer = function isBuffer(obj) {
1384
- if (!obj || typeof obj !== 'object') {
1385
- return false;
1386
- }
1387
-
1388
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
1389
- };
1390
-
1391
- var combine = function combine(a, b) {
1392
- return [].concat(a, b);
1393
- };
1394
-
1395
- var maybeMap = function maybeMap(val, fn) {
1396
- if (isArray$2(val)) {
1397
- var mapped = [];
1398
- for (var i = 0; i < val.length; i += 1) {
1399
- mapped.push(fn(val[i]));
1400
- }
1401
- return mapped;
1402
- }
1403
- return fn(val);
1404
- };
1405
-
1406
- var utils = {
1407
- arrayToObject: arrayToObject,
1408
- assign: assign,
1409
- combine: combine,
1410
- compact: compact,
1411
- decode: decode,
1412
- encode: encode,
1413
- isBuffer: isBuffer,
1414
- isRegExp: isRegExp,
1415
- maybeMap: maybeMap,
1416
- merge: merge
1417
- };
1418
-
1419
- var has$1 = Object.prototype.hasOwnProperty;
1420
-
1421
- var arrayPrefixGenerators = {
1422
- brackets: function brackets(prefix) {
1423
- return prefix + '[]';
1424
- },
1425
- comma: 'comma',
1426
- indices: function indices(prefix, key) {
1427
- return prefix + '[' + key + ']';
1428
- },
1429
- repeat: function repeat(prefix) {
1430
- return prefix;
1431
- }
1432
- };
1433
-
1434
- var isArray$1 = Array.isArray;
1435
- var split = String.prototype.split;
1436
- var push = Array.prototype.push;
1437
- var pushToArray = function (arr, valueOrArray) {
1438
- push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
1439
- };
1440
-
1441
- var toISO = Date.prototype.toISOString;
1442
-
1443
- var defaultFormat = formats['default'];
1444
- var defaults$1 = {
1445
- addQueryPrefix: false,
1446
- allowDots: false,
1447
- charset: 'utf-8',
1448
- charsetSentinel: false,
1449
- delimiter: '&',
1450
- encode: true,
1451
- encoder: utils.encode,
1452
- encodeValuesOnly: false,
1453
- format: defaultFormat,
1454
- formatter: formats.formatters[defaultFormat],
1455
- // deprecated
1456
- indices: false,
1457
- serializeDate: function serializeDate(date) {
1458
- return toISO.call(date);
1459
- },
1460
- skipNulls: false,
1461
- strictNullHandling: false
1462
- };
1463
-
1464
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
1465
- return typeof v === 'string'
1466
- || typeof v === 'number'
1467
- || typeof v === 'boolean'
1468
- || typeof v === 'symbol'
1469
- || typeof v === 'bigint';
1470
- };
1471
-
1472
- var sentinel = {};
1473
-
1474
- var stringify = function stringify(
1475
- object,
1476
- prefix,
1477
- generateArrayPrefix,
1478
- commaRoundTrip,
1479
- strictNullHandling,
1480
- skipNulls,
1481
- encoder,
1482
- filter,
1483
- sort,
1484
- allowDots,
1485
- serializeDate,
1486
- format,
1487
- formatter,
1488
- encodeValuesOnly,
1489
- charset,
1490
- sideChannel$1
1491
- ) {
1492
- var obj = object;
1493
-
1494
- var tmpSc = sideChannel$1;
1495
- var step = 0;
1496
- var findFlag = false;
1497
- while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
1498
- // Where object last appeared in the ref tree
1499
- var pos = tmpSc.get(object);
1500
- step += 1;
1501
- if (typeof pos !== 'undefined') {
1502
- if (pos === step) {
1503
- throw new RangeError('Cyclic object value');
1504
- } else {
1505
- findFlag = true; // Break while
1506
- }
1507
- }
1508
- if (typeof tmpSc.get(sentinel) === 'undefined') {
1509
- step = 0;
1510
- }
1511
- }
1512
-
1513
- if (typeof filter === 'function') {
1514
- obj = filter(prefix, obj);
1515
- } else if (obj instanceof Date) {
1516
- obj = serializeDate(obj);
1517
- } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
1518
- obj = utils.maybeMap(obj, function (value) {
1519
- if (value instanceof Date) {
1520
- return serializeDate(value);
1521
- }
1522
- return value;
1523
- });
1524
- }
1525
-
1526
- if (obj === null) {
1527
- if (strictNullHandling) {
1528
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
1529
- }
1530
-
1531
- obj = '';
1532
- }
1533
-
1534
- if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1535
- if (encoder) {
1536
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
1537
- if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
1538
- var valuesArray = split.call(String(obj), ',');
1539
- var valuesJoined = '';
1540
- for (var i = 0; i < valuesArray.length; ++i) {
1541
- valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults$1.encoder, charset, 'value', format));
1542
- }
1543
- return [formatter(keyValue) + (commaRoundTrip && isArray$1(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
1544
- }
1545
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
1546
- }
1547
- return [formatter(prefix) + '=' + formatter(String(obj))];
1548
- }
1549
-
1550
- var values = [];
1551
-
1552
- if (typeof obj === 'undefined') {
1553
- return values;
1554
- }
1555
-
1556
- var objKeys;
1557
- if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
1558
- // we need to join elements in
1559
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
1560
- } else if (isArray$1(filter)) {
1561
- objKeys = filter;
1562
- } else {
1563
- var keys = Object.keys(obj);
1564
- objKeys = sort ? keys.sort(sort) : keys;
1565
- }
1566
-
1567
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
1568
-
1569
- for (var j = 0; j < objKeys.length; ++j) {
1570
- var key = objKeys[j];
1571
- var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
1572
-
1573
- if (skipNulls && value === null) {
1574
- continue;
1575
- }
1576
-
1577
- var keyPrefix = isArray$1(obj)
1578
- ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
1579
- : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
1580
-
1581
- sideChannel$1.set(object, step);
1582
- var valueSideChannel = sideChannel();
1583
- valueSideChannel.set(sentinel, sideChannel$1);
1584
- pushToArray(values, stringify(
1585
- value,
1586
- keyPrefix,
1587
- generateArrayPrefix,
1588
- commaRoundTrip,
1589
- strictNullHandling,
1590
- skipNulls,
1591
- encoder,
1592
- filter,
1593
- sort,
1594
- allowDots,
1595
- serializeDate,
1596
- format,
1597
- formatter,
1598
- encodeValuesOnly,
1599
- charset,
1600
- valueSideChannel
1601
- ));
1602
- }
1603
-
1604
- return values;
1605
- };
1606
-
1607
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1608
- if (!opts) {
1609
- return defaults$1;
1610
- }
1611
-
1612
- if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
1613
- throw new TypeError('Encoder has to be a function.');
1614
- }
1615
-
1616
- var charset = opts.charset || defaults$1.charset;
1617
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1618
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1619
- }
1620
-
1621
- var format = formats['default'];
1622
- if (typeof opts.format !== 'undefined') {
1623
- if (!has$1.call(formats.formatters, opts.format)) {
1624
- throw new TypeError('Unknown format option provided.');
1625
- }
1626
- format = opts.format;
1627
- }
1628
- var formatter = formats.formatters[format];
1629
-
1630
- var filter = defaults$1.filter;
1631
- if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
1632
- filter = opts.filter;
1633
- }
1634
-
1635
- return {
1636
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
1637
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
1638
- charset: charset,
1639
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
1640
- delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
1641
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
1642
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
1643
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
1644
- filter: filter,
1645
- format: format,
1646
- formatter: formatter,
1647
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
1648
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
1649
- sort: typeof opts.sort === 'function' ? opts.sort : null,
1650
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
1651
- };
1652
- };
1653
-
1654
- var stringify_1 = function (object, opts) {
1655
- var obj = object;
1656
- var options = normalizeStringifyOptions(opts);
1657
-
1658
- var objKeys;
1659
- var filter;
1660
-
1661
- if (typeof options.filter === 'function') {
1662
- filter = options.filter;
1663
- obj = filter('', obj);
1664
- } else if (isArray$1(options.filter)) {
1665
- filter = options.filter;
1666
- objKeys = filter;
1667
- }
1668
-
1669
- var keys = [];
1670
-
1671
- if (typeof obj !== 'object' || obj === null) {
1672
- return '';
1673
- }
1674
-
1675
- var arrayFormat;
1676
- if (opts && opts.arrayFormat in arrayPrefixGenerators) {
1677
- arrayFormat = opts.arrayFormat;
1678
- } else if (opts && 'indices' in opts) {
1679
- arrayFormat = opts.indices ? 'indices' : 'repeat';
1680
- } else {
1681
- arrayFormat = 'indices';
1682
- }
1683
-
1684
- var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
1685
- if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
1686
- throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
1687
- }
1688
- var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
1689
-
1690
- if (!objKeys) {
1691
- objKeys = Object.keys(obj);
1692
- }
1693
-
1694
- if (options.sort) {
1695
- objKeys.sort(options.sort);
1696
- }
1697
-
1698
- var sideChannel$1 = sideChannel();
1699
- for (var i = 0; i < objKeys.length; ++i) {
1700
- var key = objKeys[i];
1701
-
1702
- if (options.skipNulls && obj[key] === null) {
1703
- continue;
1704
- }
1705
- pushToArray(keys, stringify(
1706
- obj[key],
1707
- key,
1708
- generateArrayPrefix,
1709
- commaRoundTrip,
1710
- options.strictNullHandling,
1711
- options.skipNulls,
1712
- options.encode ? options.encoder : null,
1713
- options.filter,
1714
- options.sort,
1715
- options.allowDots,
1716
- options.serializeDate,
1717
- options.format,
1718
- options.formatter,
1719
- options.encodeValuesOnly,
1720
- options.charset,
1721
- sideChannel$1
1722
- ));
1723
- }
1724
-
1725
- var joined = keys.join(options.delimiter);
1726
- var prefix = options.addQueryPrefix === true ? '?' : '';
1727
-
1728
- if (options.charsetSentinel) {
1729
- if (options.charset === 'iso-8859-1') {
1730
- // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
1731
- prefix += 'utf8=%26%2310003%3B&';
1732
- } else {
1733
- // encodeURIComponent('✓')
1734
- prefix += 'utf8=%E2%9C%93&';
1735
- }
1736
- }
1737
-
1738
- return joined.length > 0 ? prefix + joined : '';
1739
- };
1740
-
1741
- var has = Object.prototype.hasOwnProperty;
1742
- var isArray = Array.isArray;
1743
-
1744
- var defaults = {
1745
- allowDots: false,
1746
- allowPrototypes: false,
1747
- allowSparse: false,
1748
- arrayLimit: 20,
1749
- charset: 'utf-8',
1750
- charsetSentinel: false,
1751
- comma: false,
1752
- decoder: utils.decode,
1753
- delimiter: '&',
1754
- depth: 5,
1755
- ignoreQueryPrefix: false,
1756
- interpretNumericEntities: false,
1757
- parameterLimit: 1000,
1758
- parseArrays: true,
1759
- plainObjects: false,
1760
- strictNullHandling: false
1761
- };
1762
-
1763
- var interpretNumericEntities = function (str) {
1764
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1765
- return String.fromCharCode(parseInt(numberStr, 10));
1766
- });
1767
- };
1768
-
1769
- var parseArrayValue = function (val, options) {
1770
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
1771
- return val.split(',');
1772
- }
1773
-
1774
- return val;
1775
- };
1776
-
1777
- // This is what browsers will submit when the ✓ character occurs in an
1778
- // application/x-www-form-urlencoded body and the encoding of the page containing
1779
- // the form is iso-8859-1, or when the submitted form has an accept-charset
1780
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
1781
- // the ✓ character, such as us-ascii.
1782
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
1783
-
1784
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1785
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
1786
-
1787
- var parseValues = function parseQueryStringValues(str, options) {
1788
- var obj = {};
1789
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
1790
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1791
- var parts = cleanStr.split(options.delimiter, limit);
1792
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
1793
- var i;
1794
-
1795
- var charset = options.charset;
1796
- if (options.charsetSentinel) {
1797
- for (i = 0; i < parts.length; ++i) {
1798
- if (parts[i].indexOf('utf8=') === 0) {
1799
- if (parts[i] === charsetSentinel) {
1800
- charset = 'utf-8';
1801
- } else if (parts[i] === isoSentinel) {
1802
- charset = 'iso-8859-1';
1803
- }
1804
- skipIndex = i;
1805
- i = parts.length; // The eslint settings do not allow break;
1806
- }
1807
- }
1808
- }
1809
-
1810
- for (i = 0; i < parts.length; ++i) {
1811
- if (i === skipIndex) {
1812
- continue;
1813
- }
1814
- var part = parts[i];
1815
-
1816
- var bracketEqualsPos = part.indexOf(']=');
1817
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
1818
-
1819
- var key, val;
1820
- if (pos === -1) {
1821
- key = options.decoder(part, defaults.decoder, charset, 'key');
1822
- val = options.strictNullHandling ? null : '';
1823
- } else {
1824
- key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
1825
- val = utils.maybeMap(
1826
- parseArrayValue(part.slice(pos + 1), options),
1827
- function (encodedVal) {
1828
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
1829
- }
1830
- );
1831
- }
1832
-
1833
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
1834
- val = interpretNumericEntities(val);
1835
- }
1836
-
1837
- if (part.indexOf('[]=') > -1) {
1838
- val = isArray(val) ? [val] : val;
1839
- }
1840
-
1841
- if (has.call(obj, key)) {
1842
- obj[key] = utils.combine(obj[key], val);
1843
- } else {
1844
- obj[key] = val;
1845
- }
1846
- }
1847
-
1848
- return obj;
1849
- };
1850
-
1851
- var parseObject = function (chain, val, options, valuesParsed) {
1852
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
1853
-
1854
- for (var i = chain.length - 1; i >= 0; --i) {
1855
- var obj;
1856
- var root = chain[i];
1857
-
1858
- if (root === '[]' && options.parseArrays) {
1859
- obj = [].concat(leaf);
1860
- } else {
1861
- obj = options.plainObjects ? Object.create(null) : {};
1862
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
1863
- var index = parseInt(cleanRoot, 10);
1864
- if (!options.parseArrays && cleanRoot === '') {
1865
- obj = { 0: leaf };
1866
- } else if (
1867
- !isNaN(index)
1868
- && root !== cleanRoot
1869
- && String(index) === cleanRoot
1870
- && index >= 0
1871
- && (options.parseArrays && index <= options.arrayLimit)
1872
- ) {
1873
- obj = [];
1874
- obj[index] = leaf;
1875
- } else if (cleanRoot !== '__proto__') {
1876
- obj[cleanRoot] = leaf;
1877
- }
1878
- }
1879
-
1880
- leaf = obj;
1881
- }
1882
-
1883
- return leaf;
1884
- };
1885
-
1886
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1887
- if (!givenKey) {
1888
- return;
1889
- }
1890
-
1891
- // Transform dot notation to bracket notation
1892
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
1893
-
1894
- // The regex chunks
1895
-
1896
- var brackets = /(\[[^[\]]*])/;
1897
- var child = /(\[[^[\]]*])/g;
1898
-
1899
- // Get the parent
1900
-
1901
- var segment = options.depth > 0 && brackets.exec(key);
1902
- var parent = segment ? key.slice(0, segment.index) : key;
1903
-
1904
- // Stash the parent if it exists
1905
-
1906
- var keys = [];
1907
- if (parent) {
1908
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
1909
- if (!options.plainObjects && has.call(Object.prototype, parent)) {
1910
- if (!options.allowPrototypes) {
1911
- return;
1912
- }
1913
- }
1914
-
1915
- keys.push(parent);
1916
- }
1917
-
1918
- // Loop through children appending to the array until we hit depth
1919
-
1920
- var i = 0;
1921
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
1922
- i += 1;
1923
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
1924
- if (!options.allowPrototypes) {
1925
- return;
1926
- }
1927
- }
1928
- keys.push(segment[1]);
1929
- }
1930
-
1931
- // If there's a remainder, just add whatever is left
1932
-
1933
- if (segment) {
1934
- keys.push('[' + key.slice(segment.index) + ']');
1935
- }
1936
-
1937
- return parseObject(keys, val, options, valuesParsed);
1938
- };
1939
-
1940
- var normalizeParseOptions = function normalizeParseOptions(opts) {
1941
- if (!opts) {
1942
- return defaults;
1943
- }
1944
-
1945
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
1946
- throw new TypeError('Decoder has to be a function.');
1947
- }
1948
-
1949
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
1950
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
1951
- }
1952
- var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
1953
-
1954
- return {
1955
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
1956
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
1957
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
1958
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
1959
- charset: charset,
1960
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
1961
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
1962
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
1963
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
1964
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
1965
- depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
1966
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
1967
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
1968
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
1969
- parseArrays: opts.parseArrays !== false,
1970
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
1971
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
1972
- };
1973
- };
1974
-
1975
- var parse = function (str, opts) {
1976
- var options = normalizeParseOptions(opts);
1977
-
1978
- if (str === '' || str === null || typeof str === 'undefined') {
1979
- return options.plainObjects ? Object.create(null) : {};
1980
- }
1981
-
1982
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
1983
- var obj = options.plainObjects ? Object.create(null) : {};
1984
-
1985
- // Iterate over the keys and setup the new object
1986
-
1987
- var keys = Object.keys(tempObj);
1988
- for (var i = 0; i < keys.length; ++i) {
1989
- var key = keys[i];
1990
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
1991
- obj = utils.merge(obj, newObj, options);
1992
- }
1993
-
1994
- if (options.allowSparse === true) {
1995
- return obj;
1996
- }
1997
-
1998
- return utils.compact(obj);
1999
- };
2000
-
2001
- var lib = {
2002
- formats: formats,
2003
- parse: parse,
2004
- stringify: stringify_1
2005
- };
2006
-
2007
- const STORAGE_NAME_SPACE = 'nano-component-store:';
2008
- const urlRead = (from = 'hash', win = window) => {
2009
- if (!win || !win.location)
2010
- return {};
2011
- if (from === 'hash' && win.location.hash)
2012
- return lib.parse(win.location.hash.replace(/^\#/, ''), {
2013
- strictNullHandling: true,
2014
- });
2015
- else if (from === 'query' && win.location.search)
2016
- return lib.parse(win.location.search, { ignoreQueryPrefix: true });
2017
- return {};
2018
- };
2019
- const urlSave = (object, to = 'hash', win = window, method = 'replace') => {
2020
- if (!win || !win.history)
2021
- return;
2022
- const oldQuery = to === 'query' ? win.location.search : win.location.hash;
2023
- const basePath = to === 'query'
2024
- ? win.location.pathname
2025
- : win.location.pathname + win.location.search;
2026
- let queryStr = lib.stringify(object, {
2027
- strictNullHandling: true,
2028
- addQueryPrefix: false,
2029
- encodeValuesOnly: true,
2030
- });
2031
- if (!queryStr || !queryStr.length) {
2032
- if (!oldQuery || !oldQuery.length)
2033
- return;
2034
- if (method === 'replace')
2035
- win.history.replaceState(null, null, basePath);
2036
- else
2037
- win.history.pushState(null, null, basePath);
2038
- return;
2039
- }
2040
- if (to === 'hash' && win.location.hash === '#' + queryStr) {
2041
- try {
2042
- document.querySelector('#' + queryStr).focus();
2043
- }
2044
- catch (e) { }
2045
- return;
2046
- }
2047
- queryStr = (to === 'hash' ? '#' : '?') + queryStr;
2048
- if (queryStr === oldQuery)
2049
- return;
2050
- if (method === 'replace')
2051
- win.history.replaceState(null, null, basePath + queryStr);
2052
- else
2053
- win.history.pushState(null, null, basePath + queryStr);
2054
- };
2055
- const urlSet = (id, data, to = 'hash', win = window, method = 'replace') => {
2056
- // sanitize the incoming key
2057
- id = Object.keys(lib.parse(id))[0];
2058
- const object = {};
2059
- object[id] = data;
2060
- let currentData = urlRead(to, win);
2061
- currentData = Object.assign(Object.assign({}, currentData), object);
2062
- urlSave(currentData, to, win, method);
2063
- };
2064
- const urlGet = (key, to = 'hash', win = window) => {
2065
- // sanitize the incoming key
2066
- key = Object.keys(lib.parse(key))[0];
2067
- const currentData = urlRead(to, win);
2068
- return currentData[key] || null;
2069
- };
2070
- const sessionSet = (key, object, win = window) => {
2071
- try {
2072
- if (!object) {
2073
- win.sessionStorage.removeItem(STORAGE_NAME_SPACE + key);
2074
- return;
2075
- }
2076
- win.sessionStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));
2077
- }
2078
- catch (e) {
2079
- throw e;
2080
- }
2081
- };
2082
- const sessionGet = (key, win = window) => {
2083
- try {
2084
- const configStr = win.sessionStorage.getItem(STORAGE_NAME_SPACE + key);
2085
- return configStr !== null ? JSON.parse(configStr) : null;
2086
- }
2087
- catch (e) {
2088
- throw e;
2089
- }
2090
- };
2091
- const storageSet = (key, object, win = window) => {
2092
- try {
2093
- if (!object) {
2094
- win.localStorage.removeItem(STORAGE_NAME_SPACE + key);
2095
- return;
2096
- }
2097
- win.localStorage.setItem(STORAGE_NAME_SPACE + key, JSON.stringify(object));
2098
- }
2099
- catch (e) {
2100
- throw e;
2101
- }
2102
- };
2103
- const storageGet = (key, win = window) => {
2104
- try {
2105
- const configStr = win.localStorage.getItem(STORAGE_NAME_SPACE + key);
2106
- return configStr !== null ? JSON.parse(configStr) : null;
2107
- }
2108
- catch (e) {
2109
- throw e;
2110
- }
2111
- };
2112
-
2113
- const store = new Map();
2114
- const ComponentStore = {
2115
- init(component, keys, method, id) {
2116
- const getId = id || component.storeId || index.getElement(component).id;
2117
- if (!getId) {
2118
- console.error('No id set. You can only instantiate a new component store with an id. ');
2119
- return;
2120
- }
2121
- if (store.get(getId)) {
2122
- console.error('Duplicate store id usage. A store ID must be unique!', getId);
2123
- return;
2124
- }
2125
- const initialState = keys.reduce((acc, key) => {
2126
- if (typeof component[key] !== undefined)
2127
- acc[key] = component[key];
2128
- return acc;
2129
- }, {});
2130
- store.set(getId, new Store(getId, component, keys, initialState, method));
2131
- const componentstore = store.get(getId);
2132
- componentstore.dispatchToProps();
2133
- const connectedCallback = component.connectedCallback;
2134
- component.connectedCallback = function () {
2135
- store.set(getId, new Store(getId, component, keys, initialState, method));
2136
- const componentstore = store.get(getId);
2137
- if (connectedCallback) {
2138
- connectedCallback.call(component);
2139
- }
2140
- if (componentstore)
2141
- componentstore.dispatchToProps();
2142
- };
2143
- const componentDidRender = component.componentDidRender;
2144
- component.componentDidRender = function () {
2145
- const componentstore = store.get(getId);
2146
- if (componentDidRender) {
2147
- componentDidRender.call(component);
2148
- }
2149
- if (componentstore)
2150
- componentstore.savePropsToStore();
2151
- };
2152
- const disconnectedCallback = component.disconnectedCallback;
2153
- component.disconnectedCallback = function () {
2154
- const componentstore = store.get(getId);
2155
- if (componentstore)
2156
- componentstore.delete();
2157
- store.delete(getId);
2158
- if (disconnectedCallback) {
2159
- disconnectedCallback.call(component);
2160
- }
2161
- };
2162
- },
2163
- };
2164
- class Store {
2165
- constructor(id, component, keys, initialState, method) {
2166
- this.method = 'session';
2167
- this.initialState = {};
2168
- this.updateStore = true;
2169
- this.onUrlChange = () => {
2170
- this.dispatchToProps(false);
2171
- };
2172
- this.savePropsToStore = () => {
2173
- if (this.updateStore) {
2174
- this.save(this.getData);
2175
- }
2176
- else if (!this.updateStore)
2177
- this.updateStore = true;
2178
- };
2179
- this.dispatchToProps = (updateStore = true) => {
2180
- const savedData = this.retrieve();
2181
- if (!savedData && updateStore)
2182
- return;
2183
- // console.log('dispatching', savedData, this.id, this.initialState);
2184
- this.updateStore = updateStore;
2185
- this.keys.forEach((key) => {
2186
- this.component[key] = savedData ? savedData[key] : undefined;
2187
- });
2188
- };
2189
- this.delete = () => {
2190
- if (this.method === 'url-hash-push' || this.method === 'url-query-push') {
2191
- window.removeEventListener('popstate', this.onUrlChange);
2192
- }
2193
- };
2194
- if (!id)
2195
- throw new Error('No id set. You can only instantiate a new component store with an id');
2196
- this.id = id;
2197
- this.keys = keys;
2198
- this.component = component;
2199
- if (initialState)
2200
- this.initialState = initialState;
2201
- if (method)
2202
- this.method = method;
2203
- this.savePropsToStore = throttle.debounce(this.savePropsToStore, 500);
2204
- if (this.method === 'url-hash-push' || this.method === 'url-query-push') {
2205
- window.addEventListener('popstate', this.onUrlChange);
2206
- }
2207
- }
2208
- equality(val1, val2) {
2209
- if (typeof val1 !== typeof val2)
2210
- return false;
2211
- if (typeof val1 !== 'object')
2212
- return val1 === val2;
2213
- return JSON.stringify(val1) === JSON.stringify(val2);
2214
- }
2215
- get getData() {
2216
- const data = this.keys.reduce((acc, key) => {
2217
- const isEqual = this.equality(this.component[key], this.initialState[key]);
2218
- if (typeof this.component[key] !== 'undefined' && !isEqual) {
2219
- acc[key] = this.component[key];
2220
- }
2221
- else if (isEqual)
2222
- delete acc[key];
2223
- return acc;
2224
- }, {});
2225
- return Object.keys(data).length ? data : undefined;
2226
- }
2227
- retrieve() {
2228
- switch (this.method) {
2229
- case 'url-hash':
2230
- case 'url-hash-push':
2231
- return urlGet(this.id, 'hash');
2232
- case 'url-query':
2233
- case 'url-query-push':
2234
- return urlGet(this.id, 'query');
2235
- case 'local':
2236
- return storageGet(this.id);
2237
- default:
2238
- return sessionGet(this.id);
2239
- }
2240
- }
2241
- save(data) {
2242
- switch (this.method) {
2243
- case 'url-hash':
2244
- return urlSet(this.id, data, 'hash');
2245
- case 'url-query':
2246
- return urlSet(this.id, data, 'query');
2247
- case 'url-hash-push':
2248
- return urlSet(this.id, data, 'hash', window, 'push');
2249
- case 'url-query-push':
2250
- return urlSet(this.id, data, 'query', window, 'push');
2251
- case 'local':
2252
- return storageSet(this.id, data);
2253
- default:
2254
- return sessionSet(this.id, data);
2255
- }
2256
- }
2257
- }
2258
-
2259
- exports.ComponentStore = ComponentStore;
2260
-
2261
- //# sourceMappingURL=component-store-f1dc1276.js.map