You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7278 lines
206 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. /******/ (() => { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ "./resources/js/components/buckets.riot":
  4. /*!**********************************************!*\
  5. !*** ./resources/js/components/buckets.riot ***!
  6. \**********************************************/
  7. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  8. "use strict";
  9. __webpack_require__.r(__webpack_exports__);
  10. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  11. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  12. /* harmony export */ });
  13. /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  14. /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__);
  15. /* harmony import */ var lodash_remove__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash.remove */ "./node_modules/lodash.remove/index.js");
  16. /* harmony import */ var lodash_remove__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_remove__WEBPACK_IMPORTED_MODULE_1__);
  17. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
  18. 'css': null,
  19. 'exports': {
  20. state: {
  21. buckets: []
  22. },
  23. onBeforeMount() {
  24. this.fetch()
  25. },
  26. handleClick() {
  27. },
  28. handleDelete(event, bucket) {
  29. event.preventDefault()
  30. axios__WEBPACK_IMPORTED_MODULE_0___default().delete('/api/bucket/' + bucket._id)
  31. .then((response) => {
  32. // removing from buckets
  33. lodash_remove__WEBPACK_IMPORTED_MODULE_1___default()(this.state.buckets, function(b) {
  34. return b._id === bucket._id
  35. })
  36. this.update()
  37. })
  38. },
  39. /**
  40. * getting all buckets
  41. *
  42. *
  43. */
  44. fetch() {
  45. axios__WEBPACK_IMPORTED_MODULE_0___default().get('/api/bucket/', {
  46. params: {
  47. visiblity: this.props.visiblity
  48. }
  49. }).then((response) => {
  50. this.state.buckets = response.data.data
  51. this.update()
  52. })
  53. }
  54. },
  55. 'template': function(
  56. template,
  57. expressionTypes,
  58. bindingTypes,
  59. getComponent
  60. ) {
  61. return template(
  62. '<div class="buckets"><div class="grid"><div expr16="expr16" class="col-12 col-md-4 col-xlg-3"></div></div><div class="grid"><div class="col-12"><div class="buckets__more"><button expr21="expr21" type="button" class="button">\n More\n <svg class="icon" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-arrow-down"/></svg></button></div></div></div></div>',
  63. [
  64. {
  65. 'type': bindingTypes.EACH,
  66. 'getKey': null,
  67. 'condition': null,
  68. 'template': template(
  69. '<article class="panel buckets__item"><div class="bar"><div class="bar__end w-100"><button expr17="expr17" class="button button--transparent"><svg class="icon fill-text-contrast" aria-hidden="true"><use xlink:href="/symbol-defs.svg#icon-delete"/></svg></button></div></div><div class="panel__body"><a expr18="expr18"><h3 expr19="expr19" class="buckets__title"> </h3><div class="content"><p expr20="expr20"> </p></div></a></div></article>',
  70. [
  71. {
  72. 'redundantAttribute': 'expr17',
  73. 'selector': '[expr17]',
  74. 'expressions': [
  75. {
  76. 'type': expressionTypes.EVENT,
  77. 'name': 'onclick',
  78. 'evaluate': function(
  79. _scope
  80. ) {
  81. return (event) => { _scope.handleDelete(event, _scope.bucket) };
  82. }
  83. }
  84. ]
  85. },
  86. {
  87. 'redundantAttribute': 'expr18',
  88. 'selector': '[expr18]',
  89. 'expressions': [
  90. {
  91. 'type': expressionTypes.ATTRIBUTE,
  92. 'name': 'href',
  93. 'evaluate': function(
  94. _scope
  95. ) {
  96. return [
  97. '/bucket/',
  98. _scope.bucket._id
  99. ].join(
  100. ''
  101. );
  102. }
  103. }
  104. ]
  105. },
  106. {
  107. 'redundantAttribute': 'expr19',
  108. 'selector': '[expr19]',
  109. 'expressions': [
  110. {
  111. 'type': expressionTypes.TEXT,
  112. 'childNodeIndex': 0,
  113. 'evaluate': function(
  114. _scope
  115. ) {
  116. return [
  117. _scope.bucket.title
  118. ].join(
  119. ''
  120. );
  121. }
  122. }
  123. ]
  124. },
  125. {
  126. 'redundantAttribute': 'expr20',
  127. 'selector': '[expr20]',
  128. 'expressions': [
  129. {
  130. 'type': expressionTypes.TEXT,
  131. 'childNodeIndex': 0,
  132. 'evaluate': function(
  133. _scope
  134. ) {
  135. return [
  136. _scope.bucket.description
  137. ].join(
  138. ''
  139. );
  140. }
  141. }
  142. ]
  143. }
  144. ]
  145. ),
  146. 'redundantAttribute': 'expr16',
  147. 'selector': '[expr16]',
  148. 'itemName': 'bucket',
  149. 'indexName': null,
  150. 'evaluate': function(
  151. _scope
  152. ) {
  153. return _scope.state.buckets;
  154. }
  155. },
  156. {
  157. 'redundantAttribute': 'expr21',
  158. 'selector': '[expr21]',
  159. 'expressions': [
  160. {
  161. 'type': expressionTypes.EVENT,
  162. 'name': 'onclick',
  163. 'evaluate': function(
  164. _scope
  165. ) {
  166. return _scope.handleClick;
  167. }
  168. }
  169. ]
  170. }
  171. ]
  172. );
  173. },
  174. 'name': 'app-buckets'
  175. });
  176. /***/ }),
  177. /***/ "./node_modules/axios/index.js":
  178. /*!*************************************!*\
  179. !*** ./node_modules/axios/index.js ***!
  180. \*************************************/
  181. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  182. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  183. /***/ }),
  184. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  185. /*!************************************************!*\
  186. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  187. \************************************************/
  188. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  189. "use strict";
  190. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  191. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  192. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  193. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  194. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  195. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  196. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  197. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  198. module.exports = function xhrAdapter(config) {
  199. return new Promise(function dispatchXhrRequest(resolve, reject) {
  200. var requestData = config.data;
  201. var requestHeaders = config.headers;
  202. if (utils.isFormData(requestData)) {
  203. delete requestHeaders['Content-Type']; // Let the browser set it
  204. }
  205. var request = new XMLHttpRequest();
  206. // HTTP basic authentication
  207. if (config.auth) {
  208. var username = config.auth.username || '';
  209. var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
  210. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  211. }
  212. var fullPath = buildFullPath(config.baseURL, config.url);
  213. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  214. // Set the request timeout in MS
  215. request.timeout = config.timeout;
  216. // Listen for ready state
  217. request.onreadystatechange = function handleLoad() {
  218. if (!request || request.readyState !== 4) {
  219. return;
  220. }
  221. // The request errored out and we didn't get a response, this will be
  222. // handled by onerror instead
  223. // With one exception: request that using file: protocol, most browsers
  224. // will return status as 0 even though it's a successful request
  225. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  226. return;
  227. }
  228. // Prepare the response
  229. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  230. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  231. var response = {
  232. data: responseData,
  233. status: request.status,
  234. statusText: request.statusText,
  235. headers: responseHeaders,
  236. config: config,
  237. request: request
  238. };
  239. settle(resolve, reject, response);
  240. // Clean up request
  241. request = null;
  242. };
  243. // Handle browser request cancellation (as opposed to a manual cancellation)
  244. request.onabort = function handleAbort() {
  245. if (!request) {
  246. return;
  247. }
  248. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  249. // Clean up request
  250. request = null;
  251. };
  252. // Handle low level network errors
  253. request.onerror = function handleError() {
  254. // Real errors are hidden from us by the browser
  255. // onerror should only fire if it's a network error
  256. reject(createError('Network Error', config, null, request));
  257. // Clean up request
  258. request = null;
  259. };
  260. // Handle timeout
  261. request.ontimeout = function handleTimeout() {
  262. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  263. if (config.timeoutErrorMessage) {
  264. timeoutErrorMessage = config.timeoutErrorMessage;
  265. }
  266. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  267. request));
  268. // Clean up request
  269. request = null;
  270. };
  271. // Add xsrf header
  272. // This is only done if running in a standard browser environment.
  273. // Specifically not if we're in a web worker, or react-native.
  274. if (utils.isStandardBrowserEnv()) {
  275. // Add xsrf header
  276. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  277. cookies.read(config.xsrfCookieName) :
  278. undefined;
  279. if (xsrfValue) {
  280. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  281. }
  282. }
  283. // Add headers to the request
  284. if ('setRequestHeader' in request) {
  285. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  286. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  287. // Remove Content-Type if data is undefined
  288. delete requestHeaders[key];
  289. } else {
  290. // Otherwise add header to the request
  291. request.setRequestHeader(key, val);
  292. }
  293. });
  294. }
  295. // Add withCredentials to request if needed
  296. if (!utils.isUndefined(config.withCredentials)) {
  297. request.withCredentials = !!config.withCredentials;
  298. }
  299. // Add responseType to request if needed
  300. if (config.responseType) {
  301. try {
  302. request.responseType = config.responseType;
  303. } catch (e) {
  304. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  305. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  306. if (config.responseType !== 'json') {
  307. throw e;
  308. }
  309. }
  310. }
  311. // Handle progress if needed
  312. if (typeof config.onDownloadProgress === 'function') {
  313. request.addEventListener('progress', config.onDownloadProgress);
  314. }
  315. // Not all browsers support upload events
  316. if (typeof config.onUploadProgress === 'function' && request.upload) {
  317. request.upload.addEventListener('progress', config.onUploadProgress);
  318. }
  319. if (config.cancelToken) {
  320. // Handle cancellation
  321. config.cancelToken.promise.then(function onCanceled(cancel) {
  322. if (!request) {
  323. return;
  324. }
  325. request.abort();
  326. reject(cancel);
  327. // Clean up request
  328. request = null;
  329. });
  330. }
  331. if (!requestData) {
  332. requestData = null;
  333. }
  334. // Send the request
  335. request.send(requestData);
  336. });
  337. };
  338. /***/ }),
  339. /***/ "./node_modules/axios/lib/axios.js":
  340. /*!*****************************************!*\
  341. !*** ./node_modules/axios/lib/axios.js ***!
  342. \*****************************************/
  343. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  344. "use strict";
  345. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  346. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  347. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  348. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  349. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  350. /**
  351. * Create an instance of Axios
  352. *
  353. * @param {Object} defaultConfig The default config for the instance
  354. * @return {Axios} A new instance of Axios
  355. */
  356. function createInstance(defaultConfig) {
  357. var context = new Axios(defaultConfig);
  358. var instance = bind(Axios.prototype.request, context);
  359. // Copy axios.prototype to instance
  360. utils.extend(instance, Axios.prototype, context);
  361. // Copy context to instance
  362. utils.extend(instance, context);
  363. return instance;
  364. }
  365. // Create the default instance to be exported
  366. var axios = createInstance(defaults);
  367. // Expose Axios class to allow class inheritance
  368. axios.Axios = Axios;
  369. // Factory for creating new instances
  370. axios.create = function create(instanceConfig) {
  371. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  372. };
  373. // Expose Cancel & CancelToken
  374. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  375. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  376. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  377. // Expose all/spread
  378. axios.all = function all(promises) {
  379. return Promise.all(promises);
  380. };
  381. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  382. // Expose isAxiosError
  383. axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js");
  384. module.exports = axios;
  385. // Allow use of default import syntax in TypeScript
  386. module.exports.default = axios;
  387. /***/ }),
  388. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  389. /*!*************************************************!*\
  390. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  391. \*************************************************/
  392. /***/ ((module) => {
  393. "use strict";
  394. /**
  395. * A `Cancel` is an object that is thrown when an operation is canceled.
  396. *
  397. * @class
  398. * @param {string=} message The message.
  399. */
  400. function Cancel(message) {
  401. this.message = message;
  402. }
  403. Cancel.prototype.toString = function toString() {
  404. return 'Cancel' + (this.message ? ': ' + this.message : '');
  405. };
  406. Cancel.prototype.__CANCEL__ = true;
  407. module.exports = Cancel;
  408. /***/ }),
  409. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  410. /*!******************************************************!*\
  411. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  412. \******************************************************/
  413. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  414. "use strict";
  415. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  416. /**
  417. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  418. *
  419. * @class
  420. * @param {Function} executor The executor function.
  421. */
  422. function CancelToken(executor) {
  423. if (typeof executor !== 'function') {
  424. throw new TypeError('executor must be a function.');
  425. }
  426. var resolvePromise;
  427. this.promise = new Promise(function promiseExecutor(resolve) {
  428. resolvePromise = resolve;
  429. });
  430. var token = this;
  431. executor(function cancel(message) {
  432. if (token.reason) {
  433. // Cancellation has already been requested
  434. return;
  435. }
  436. token.reason = new Cancel(message);
  437. resolvePromise(token.reason);
  438. });
  439. }
  440. /**
  441. * Throws a `Cancel` if cancellation has been requested.
  442. */
  443. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  444. if (this.reason) {
  445. throw this.reason;
  446. }
  447. };
  448. /**
  449. * Returns an object that contains a new `CancelToken` and a function that, when called,
  450. * cancels the `CancelToken`.
  451. */
  452. CancelToken.source = function source() {
  453. var cancel;
  454. var token = new CancelToken(function executor(c) {
  455. cancel = c;
  456. });
  457. return {
  458. token: token,
  459. cancel: cancel
  460. };
  461. };
  462. module.exports = CancelToken;
  463. /***/ }),
  464. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  465. /*!***************************************************!*\
  466. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  467. \***************************************************/
  468. /***/ ((module) => {
  469. "use strict";
  470. module.exports = function isCancel(value) {
  471. return !!(value && value.__CANCEL__);
  472. };
  473. /***/ }),
  474. /***/ "./node_modules/axios/lib/core/Axios.js":
  475. /*!**********************************************!*\
  476. !*** ./node_modules/axios/lib/core/Axios.js ***!
  477. \**********************************************/
  478. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  479. "use strict";
  480. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  481. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  482. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  483. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  484. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  485. /**
  486. * Create a new instance of Axios
  487. *
  488. * @param {Object} instanceConfig The default config for the instance
  489. */
  490. function Axios(instanceConfig) {
  491. this.defaults = instanceConfig;
  492. this.interceptors = {
  493. request: new InterceptorManager(),
  494. response: new InterceptorManager()
  495. };
  496. }
  497. /**
  498. * Dispatch a request
  499. *
  500. * @param {Object} config The config specific for this request (merged with this.defaults)
  501. */
  502. Axios.prototype.request = function request(config) {
  503. /*eslint no-param-reassign:0*/
  504. // Allow for axios('example/url'[, config]) a la fetch API
  505. if (typeof config === 'string') {
  506. config = arguments[1] || {};
  507. config.url = arguments[0];
  508. } else {
  509. config = config || {};
  510. }
  511. config = mergeConfig(this.defaults, config);
  512. // Set config.method
  513. if (config.method) {
  514. config.method = config.method.toLowerCase();
  515. } else if (this.defaults.method) {
  516. config.method = this.defaults.method.toLowerCase();
  517. } else {
  518. config.method = 'get';
  519. }
  520. // Hook up interceptors middleware
  521. var chain = [dispatchRequest, undefined];
  522. var promise = Promise.resolve(config);
  523. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  524. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  525. });
  526. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  527. chain.push(interceptor.fulfilled, interceptor.rejected);
  528. });
  529. while (chain.length) {
  530. promise = promise.then(chain.shift(), chain.shift());
  531. }
  532. return promise;
  533. };
  534. Axios.prototype.getUri = function getUri(config) {
  535. config = mergeConfig(this.defaults, config);
  536. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  537. };
  538. // Provide aliases for supported request methods
  539. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  540. /*eslint func-names:0*/
  541. Axios.prototype[method] = function(url, config) {
  542. return this.request(mergeConfig(config || {}, {
  543. method: method,
  544. url: url,
  545. data: (config || {}).data
  546. }));
  547. };
  548. });
  549. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  550. /*eslint func-names:0*/
  551. Axios.prototype[method] = function(url, data, config) {
  552. return this.request(mergeConfig(config || {}, {
  553. method: method,
  554. url: url,
  555. data: data
  556. }));
  557. };
  558. });
  559. module.exports = Axios;
  560. /***/ }),
  561. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  562. /*!***********************************************************!*\
  563. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  564. \***********************************************************/
  565. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  566. "use strict";
  567. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  568. function InterceptorManager() {
  569. this.handlers = [];
  570. }
  571. /**
  572. * Add a new interceptor to the stack
  573. *
  574. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  575. * @param {Function} rejected The function to handle `reject` for a `Promise`
  576. *
  577. * @return {Number} An ID used to remove interceptor later
  578. */
  579. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  580. this.handlers.push({
  581. fulfilled: fulfilled,
  582. rejected: rejected
  583. });
  584. return this.handlers.length - 1;
  585. };
  586. /**
  587. * Remove an interceptor from the stack
  588. *
  589. * @param {Number} id The ID that was returned by `use`
  590. */
  591. InterceptorManager.prototype.eject = function eject(id) {
  592. if (this.handlers[id]) {
  593. this.handlers[id] = null;
  594. }
  595. };
  596. /**
  597. * Iterate over all the registered interceptors
  598. *
  599. * This method is particularly useful for skipping over any
  600. * interceptors that may have become `null` calling `eject`.
  601. *
  602. * @param {Function} fn The function to call for each interceptor
  603. */
  604. InterceptorManager.prototype.forEach = function forEach(fn) {
  605. utils.forEach(this.handlers, function forEachHandler(h) {
  606. if (h !== null) {
  607. fn(h);
  608. }
  609. });
  610. };
  611. module.exports = InterceptorManager;
  612. /***/ }),
  613. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  614. /*!******************************************************!*\
  615. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  616. \******************************************************/
  617. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  618. "use strict";
  619. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  620. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  621. /**
  622. * Creates a new URL by combining the baseURL with the requestedURL,
  623. * only when the requestedURL is not already an absolute URL.
  624. * If the requestURL is absolute, this function returns the requestedURL untouched.
  625. *
  626. * @param {string} baseURL The base URL
  627. * @param {string} requestedURL Absolute or relative URL to combine
  628. * @returns {string} The combined full path
  629. */
  630. module.exports = function buildFullPath(baseURL, requestedURL) {
  631. if (baseURL && !isAbsoluteURL(requestedURL)) {
  632. return combineURLs(baseURL, requestedURL);
  633. }
  634. return requestedURL;
  635. };
  636. /***/ }),
  637. /***/ "./node_modules/axios/lib/core/createError.js":
  638. /*!****************************************************!*\
  639. !*** ./node_modules/axios/lib/core/createError.js ***!
  640. \****************************************************/
  641. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  642. "use strict";
  643. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  644. /**
  645. * Create an Error with the specified message, config, error code, request and response.
  646. *
  647. * @param {string} message The error message.
  648. * @param {Object} config The config.
  649. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  650. * @param {Object} [request] The request.
  651. * @param {Object} [response] The response.
  652. * @returns {Error} The created error.
  653. */
  654. module.exports = function createError(message, config, code, request, response) {
  655. var error = new Error(message);
  656. return enhanceError(error, config, code, request, response);
  657. };
  658. /***/ }),
  659. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  660. /*!********************************************************!*\
  661. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  662. \********************************************************/
  663. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  664. "use strict";
  665. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  666. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  667. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  668. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  669. /**
  670. * Throws a `Cancel` if cancellation has been requested.
  671. */
  672. function throwIfCancellationRequested(config) {
  673. if (config.cancelToken) {
  674. config.cancelToken.throwIfRequested();
  675. }
  676. }
  677. /**
  678. * Dispatch a request to the server using the configured adapter.
  679. *
  680. * @param {object} config The config that is to be used for the request
  681. * @returns {Promise} The Promise to be fulfilled
  682. */
  683. module.exports = function dispatchRequest(config) {
  684. throwIfCancellationRequested(config);
  685. // Ensure headers exist
  686. config.headers = config.headers || {};
  687. // Transform request data
  688. config.data = transformData(
  689. config.data,
  690. config.headers,
  691. config.transformRequest
  692. );
  693. // Flatten headers
  694. config.headers = utils.merge(
  695. config.headers.common || {},
  696. config.headers[config.method] || {},
  697. config.headers
  698. );
  699. utils.forEach(
  700. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  701. function cleanHeaderConfig(method) {
  702. delete config.headers[method];
  703. }
  704. );
  705. var adapter = config.adapter || defaults.adapter;
  706. return adapter(config).then(function onAdapterResolution(response) {
  707. throwIfCancellationRequested(config);
  708. // Transform response data
  709. response.data = transformData(
  710. response.data,
  711. response.headers,
  712. config.transformResponse
  713. );
  714. return response;
  715. }, function onAdapterRejection(reason) {
  716. if (!isCancel(reason)) {
  717. throwIfCancellationRequested(config);
  718. // Transform response data
  719. if (reason && reason.response) {
  720. reason.response.data = transformData(
  721. reason.response.data,
  722. reason.response.headers,
  723. config.transformResponse
  724. );
  725. }
  726. }
  727. return Promise.reject(reason);
  728. });
  729. };
  730. /***/ }),
  731. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  732. /*!*****************************************************!*\
  733. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  734. \*****************************************************/
  735. /***/ ((module) => {
  736. "use strict";
  737. /**
  738. * Update an Error with the specified config, error code, and response.
  739. *
  740. * @param {Error} error The error to update.
  741. * @param {Object} config The config.
  742. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  743. * @param {Object} [request] The request.
  744. * @param {Object} [response] The response.
  745. * @returns {Error} The error.
  746. */
  747. module.exports = function enhanceError(error, config, code, request, response) {
  748. error.config = config;
  749. if (code) {
  750. error.code = code;
  751. }
  752. error.request = request;
  753. error.response = response;
  754. error.isAxiosError = true;
  755. error.toJSON = function toJSON() {
  756. return {
  757. // Standard
  758. message: this.message,
  759. name: this.name,
  760. // Microsoft
  761. description: this.description,
  762. number: this.number,
  763. // Mozilla
  764. fileName: this.fileName,
  765. lineNumber: this.lineNumber,
  766. columnNumber: this.columnNumber,
  767. stack: this.stack,
  768. // Axios
  769. config: this.config,
  770. code: this.code
  771. };
  772. };
  773. return error;
  774. };
  775. /***/ }),
  776. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  777. /*!****************************************************!*\
  778. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  779. \****************************************************/
  780. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  781. "use strict";
  782. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  783. /**
  784. * Config-specific merge-function which creates a new config-object
  785. * by merging two configuration objects together.
  786. *
  787. * @param {Object} config1
  788. * @param {Object} config2
  789. * @returns {Object} New object resulting from merging config2 to config1
  790. */
  791. module.exports = function mergeConfig(config1, config2) {
  792. // eslint-disable-next-line no-param-reassign
  793. config2 = config2 || {};
  794. var config = {};
  795. var valueFromConfig2Keys = ['url', 'method', 'data'];
  796. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
  797. var defaultToConfig2Keys = [
  798. 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
  799. 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  800. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
  801. 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
  802. 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
  803. ];
  804. var directMergeKeys = ['validateStatus'];
  805. function getMergedValue(target, source) {
  806. if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
  807. return utils.merge(target, source);
  808. } else if (utils.isPlainObject(source)) {
  809. return utils.merge({}, source);
  810. } else if (utils.isArray(source)) {
  811. return source.slice();
  812. }
  813. return source;
  814. }
  815. function mergeDeepProperties(prop) {
  816. if (!utils.isUndefined(config2[prop])) {
  817. config[prop] = getMergedValue(config1[prop], config2[prop]);
  818. } else if (!utils.isUndefined(config1[prop])) {
  819. config[prop] = getMergedValue(undefined, config1[prop]);
  820. }
  821. }
  822. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  823. if (!utils.isUndefined(config2[prop])) {
  824. config[prop] = getMergedValue(undefined, config2[prop]);
  825. }
  826. });
  827. utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
  828. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  829. if (!utils.isUndefined(config2[prop])) {
  830. config[prop] = getMergedValue(undefined, config2[prop]);
  831. } else if (!utils.isUndefined(config1[prop])) {
  832. config[prop] = getMergedValue(undefined, config1[prop]);
  833. }
  834. });
  835. utils.forEach(directMergeKeys, function merge(prop) {
  836. if (prop in config2) {
  837. config[prop] = getMergedValue(config1[prop], config2[prop]);
  838. } else if (prop in config1) {
  839. config[prop] = getMergedValue(undefined, config1[prop]);
  840. }
  841. });
  842. var axiosKeys = valueFromConfig2Keys
  843. .concat(mergeDeepPropertiesKeys)
  844. .concat(defaultToConfig2Keys)
  845. .concat(directMergeKeys);
  846. var otherKeys = Object
  847. .keys(config1)
  848. .concat(Object.keys(config2))
  849. .filter(function filterAxiosKeys(key) {
  850. return axiosKeys.indexOf(key) === -1;
  851. });
  852. utils.forEach(otherKeys, mergeDeepProperties);
  853. return config;
  854. };
  855. /***/ }),
  856. /***/ "./node_modules/axios/lib/core/settle.js":
  857. /*!***********************************************!*\
  858. !*** ./node_modules/axios/lib/core/settle.js ***!
  859. \***********************************************/
  860. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  861. "use strict";
  862. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  863. /**
  864. * Resolve or reject a Promise based on response status.
  865. *
  866. * @param {Function} resolve A function that resolves the promise.
  867. * @param {Function} reject A function that rejects the promise.
  868. * @param {object} response The response.
  869. */
  870. module.exports = function settle(resolve, reject, response) {
  871. var validateStatus = response.config.validateStatus;
  872. if (!response.status || !validateStatus || validateStatus(response.status)) {
  873. resolve(response);
  874. } else {
  875. reject(createError(
  876. 'Request failed with status code ' + response.status,
  877. response.config,
  878. null,
  879. response.request,
  880. response
  881. ));
  882. }
  883. };
  884. /***/ }),
  885. /***/ "./node_modules/axios/lib/core/transformData.js":
  886. /*!******************************************************!*\
  887. !*** ./node_modules/axios/lib/core/transformData.js ***!
  888. \******************************************************/
  889. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  890. "use strict";
  891. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  892. /**
  893. * Transform the data for a request or a response
  894. *
  895. * @param {Object|String} data The data to be transformed
  896. * @param {Array} headers The headers for the request or response
  897. * @param {Array|Function} fns A single function or Array of functions
  898. * @returns {*} The resulting transformed data
  899. */
  900. module.exports = function transformData(data, headers, fns) {
  901. /*eslint no-param-reassign:0*/
  902. utils.forEach(fns, function transform(fn) {
  903. data = fn(data, headers);
  904. });
  905. return data;
  906. };
  907. /***/ }),
  908. /***/ "./node_modules/axios/lib/defaults.js":
  909. /*!********************************************!*\
  910. !*** ./node_modules/axios/lib/defaults.js ***!
  911. \********************************************/
  912. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  913. "use strict";
  914. /* provided dependency */ var process = __webpack_require__(/*! process/browser */ "./node_modules/process/browser.js");
  915. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  916. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  917. var DEFAULT_CONTENT_TYPE = {
  918. 'Content-Type': 'application/x-www-form-urlencoded'
  919. };
  920. function setContentTypeIfUnset(headers, value) {
  921. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  922. headers['Content-Type'] = value;
  923. }
  924. }
  925. function getDefaultAdapter() {
  926. var adapter;
  927. if (typeof XMLHttpRequest !== 'undefined') {
  928. // For browsers use XHR adapter
  929. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  930. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  931. // For node use HTTP adapter
  932. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  933. }
  934. return adapter;
  935. }
  936. var defaults = {
  937. adapter: getDefaultAdapter(),
  938. transformRequest: [function transformRequest(data, headers) {
  939. normalizeHeaderName(headers, 'Accept');
  940. normalizeHeaderName(headers, 'Content-Type');
  941. if (utils.isFormData(data) ||
  942. utils.isArrayBuffer(data) ||
  943. utils.isBuffer(data) ||
  944. utils.isStream(data) ||
  945. utils.isFile(data) ||
  946. utils.isBlob(data)
  947. ) {
  948. return data;
  949. }
  950. if (utils.isArrayBufferView(data)) {
  951. return data.buffer;
  952. }
  953. if (utils.isURLSearchParams(data)) {
  954. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  955. return data.toString();
  956. }
  957. if (utils.isObject(data)) {
  958. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  959. return JSON.stringify(data);
  960. }
  961. return data;
  962. }],
  963. transformResponse: [function transformResponse(data) {
  964. /*eslint no-param-reassign:0*/
  965. if (typeof data === 'string') {
  966. try {
  967. data = JSON.parse(data);
  968. } catch (e) { /* Ignore */ }
  969. }
  970. return data;
  971. }],
  972. /**
  973. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  974. * timeout is not created.
  975. */
  976. timeout: 0,
  977. xsrfCookieName: 'XSRF-TOKEN',
  978. xsrfHeaderName: 'X-XSRF-TOKEN',
  979. maxContentLength: -1,
  980. maxBodyLength: -1,
  981. validateStatus: function validateStatus(status) {
  982. return status >= 200 && status < 300;
  983. }
  984. };
  985. defaults.headers = {
  986. common: {
  987. 'Accept': 'application/json, text/plain, */*'
  988. }
  989. };
  990. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  991. defaults.headers[method] = {};
  992. });
  993. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  994. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  995. });
  996. module.exports = defaults;
  997. /***/ }),
  998. /***/ "./node_modules/axios/lib/helpers/bind.js":
  999. /*!************************************************!*\
  1000. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  1001. \************************************************/
  1002. /***/ ((module) => {
  1003. "use strict";
  1004. module.exports = function bind(fn, thisArg) {
  1005. return function wrap() {
  1006. var args = new Array(arguments.length);
  1007. for (var i = 0; i < args.length; i++) {
  1008. args[i] = arguments[i];
  1009. }
  1010. return fn.apply(thisArg, args);
  1011. };
  1012. };
  1013. /***/ }),
  1014. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  1015. /*!****************************************************!*\
  1016. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  1017. \****************************************************/
  1018. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1019. "use strict";
  1020. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1021. function encode(val) {
  1022. return encodeURIComponent(val).
  1023. replace(/%3A/gi, ':').
  1024. replace(/%24/g, '$').
  1025. replace(/%2C/gi, ',').
  1026. replace(/%20/g, '+').
  1027. replace(/%5B/gi, '[').
  1028. replace(/%5D/gi, ']');
  1029. }
  1030. /**
  1031. * Build a URL by appending params to the end
  1032. *
  1033. * @param {string} url The base of the url (e.g., http://www.google.com)
  1034. * @param {object} [params] The params to be appended
  1035. * @returns {string} The formatted url
  1036. */
  1037. module.exports = function buildURL(url, params, paramsSerializer) {
  1038. /*eslint no-param-reassign:0*/
  1039. if (!params) {
  1040. return url;
  1041. }
  1042. var serializedParams;
  1043. if (paramsSerializer) {
  1044. serializedParams = paramsSerializer(params);
  1045. } else if (utils.isURLSearchParams(params)) {
  1046. serializedParams = params.toString();
  1047. } else {
  1048. var parts = [];
  1049. utils.forEach(params, function serialize(val, key) {
  1050. if (val === null || typeof val === 'undefined') {
  1051. return;
  1052. }
  1053. if (utils.isArray(val)) {
  1054. key = key + '[]';
  1055. } else {
  1056. val = [val];
  1057. }
  1058. utils.forEach(val, function parseValue(v) {
  1059. if (utils.isDate(v)) {
  1060. v = v.toISOString();
  1061. } else if (utils.isObject(v)) {
  1062. v = JSON.stringify(v);
  1063. }
  1064. parts.push(encode(key) + '=' + encode(v));
  1065. });
  1066. });
  1067. serializedParams = parts.join('&');
  1068. }
  1069. if (serializedParams) {
  1070. var hashmarkIndex = url.indexOf('#');
  1071. if (hashmarkIndex !== -1) {
  1072. url = url.slice(0, hashmarkIndex);
  1073. }
  1074. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  1075. }
  1076. return url;
  1077. };
  1078. /***/ }),
  1079. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  1080. /*!*******************************************************!*\
  1081. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  1082. \*******************************************************/
  1083. /***/ ((module) => {
  1084. "use strict";
  1085. /**
  1086. * Creates a new URL by combining the specified URLs
  1087. *
  1088. * @param {string} baseURL The base URL
  1089. * @param {string} relativeURL The relative URL
  1090. * @returns {string} The combined URL
  1091. */
  1092. module.exports = function combineURLs(baseURL, relativeURL) {
  1093. return relativeURL
  1094. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1095. : baseURL;
  1096. };
  1097. /***/ }),
  1098. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1099. /*!***************************************************!*\
  1100. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1101. \***************************************************/
  1102. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1103. "use strict";
  1104. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1105. module.exports = (
  1106. utils.isStandardBrowserEnv() ?
  1107. // Standard browser envs support document.cookie
  1108. (function standardBrowserEnv() {
  1109. return {
  1110. write: function write(name, value, expires, path, domain, secure) {
  1111. var cookie = [];
  1112. cookie.push(name + '=' + encodeURIComponent(value));
  1113. if (utils.isNumber(expires)) {
  1114. cookie.push('expires=' + new Date(expires).toGMTString());
  1115. }
  1116. if (utils.isString(path)) {
  1117. cookie.push('path=' + path);
  1118. }
  1119. if (utils.isString(domain)) {
  1120. cookie.push('domain=' + domain);
  1121. }
  1122. if (secure === true) {
  1123. cookie.push('secure');
  1124. }
  1125. document.cookie = cookie.join('; ');
  1126. },
  1127. read: function read(name) {
  1128. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1129. return (match ? decodeURIComponent(match[3]) : null);
  1130. },
  1131. remove: function remove(name) {
  1132. this.write(name, '', Date.now() - 86400000);
  1133. }
  1134. };
  1135. })() :
  1136. // Non standard browser env (web workers, react-native) lack needed support.
  1137. (function nonStandardBrowserEnv() {
  1138. return {
  1139. write: function write() {},
  1140. read: function read() { return null; },
  1141. remove: function remove() {}
  1142. };
  1143. })()
  1144. );
  1145. /***/ }),
  1146. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1147. /*!*********************************************************!*\
  1148. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1149. \*********************************************************/
  1150. /***/ ((module) => {
  1151. "use strict";
  1152. /**
  1153. * Determines whether the specified URL is absolute
  1154. *
  1155. * @param {string} url The URL to test
  1156. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1157. */
  1158. module.exports = function isAbsoluteURL(url) {
  1159. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1160. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1161. // by any combination of letters, digits, plus, period, or hyphen.
  1162. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1163. };
  1164. /***/ }),
  1165. /***/ "./node_modules/axios/lib/helpers/isAxiosError.js":
  1166. /*!********************************************************!*\
  1167. !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***!
  1168. \********************************************************/
  1169. /***/ ((module) => {
  1170. "use strict";
  1171. /**
  1172. * Determines whether the payload is an error thrown by Axios
  1173. *
  1174. * @param {*} payload The value to test
  1175. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  1176. */
  1177. module.exports = function isAxiosError(payload) {
  1178. return (typeof payload === 'object') && (payload.isAxiosError === true);
  1179. };
  1180. /***/ }),
  1181. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1182. /*!***********************************************************!*\
  1183. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1184. \***********************************************************/
  1185. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1186. "use strict";
  1187. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1188. module.exports = (
  1189. utils.isStandardBrowserEnv() ?
  1190. // Standard browser envs have full support of the APIs needed to test
  1191. // whether the request URL is of the same origin as current location.
  1192. (function standardBrowserEnv() {
  1193. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1194. var urlParsingNode = document.createElement('a');
  1195. var originURL;
  1196. /**
  1197. * Parse a URL to discover it's components
  1198. *
  1199. * @param {String} url The URL to be parsed
  1200. * @returns {Object}
  1201. */
  1202. function resolveURL(url) {
  1203. var href = url;
  1204. if (msie) {
  1205. // IE needs attribute set twice to normalize properties
  1206. urlParsingNode.setAttribute('href', href);
  1207. href = urlParsingNode.href;
  1208. }
  1209. urlParsingNode.setAttribute('href', href);
  1210. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1211. return {
  1212. href: urlParsingNode.href,
  1213. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1214. host: urlParsingNode.host,
  1215. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1216. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1217. hostname: urlParsingNode.hostname,
  1218. port: urlParsingNode.port,
  1219. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1220. urlParsingNode.pathname :
  1221. '/' + urlParsingNode.pathname
  1222. };
  1223. }
  1224. originURL = resolveURL(window.location.href);
  1225. /**
  1226. * Determine if a URL shares the same origin as the current location
  1227. *
  1228. * @param {String} requestURL The URL to test
  1229. * @returns {boolean} True if URL shares the same origin, otherwise false
  1230. */
  1231. return function isURLSameOrigin(requestURL) {
  1232. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1233. return (parsed.protocol === originURL.protocol &&
  1234. parsed.host === originURL.host);
  1235. };
  1236. })() :
  1237. // Non standard browser envs (web workers, react-native) lack needed support.
  1238. (function nonStandardBrowserEnv() {
  1239. return function isURLSameOrigin() {
  1240. return true;
  1241. };
  1242. })()
  1243. );
  1244. /***/ }),
  1245. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1246. /*!***************************************************************!*\
  1247. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1248. \***************************************************************/
  1249. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1250. "use strict";
  1251. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1252. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1253. utils.forEach(headers, function processHeader(value, name) {
  1254. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1255. headers[normalizedName] = value;
  1256. delete headers[name];
  1257. }
  1258. });
  1259. };
  1260. /***/ }),
  1261. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1262. /*!********************************************************!*\
  1263. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1264. \********************************************************/
  1265. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1266. "use strict";
  1267. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1268. // Headers whose duplicates are ignored by node
  1269. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1270. var ignoreDuplicateOf = [
  1271. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1272. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1273. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1274. 'referer', 'retry-after', 'user-agent'
  1275. ];
  1276. /**
  1277. * Parse headers into an object
  1278. *
  1279. * ```
  1280. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1281. * Content-Type: application/json
  1282. * Connection: keep-alive
  1283. * Transfer-Encoding: chunked
  1284. * ```
  1285. *
  1286. * @param {String} headers Headers needing to be parsed
  1287. * @returns {Object} Headers parsed into an object
  1288. */
  1289. module.exports = function parseHeaders(headers) {
  1290. var parsed = {};
  1291. var key;
  1292. var val;
  1293. var i;
  1294. if (!headers) { return parsed; }
  1295. utils.forEach(headers.split('\n'), function parser(line) {
  1296. i = line.indexOf(':');
  1297. key = utils.trim(line.substr(0, i)).toLowerCase();
  1298. val = utils.trim(line.substr(i + 1));
  1299. if (key) {
  1300. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1301. return;
  1302. }
  1303. if (key === 'set-cookie') {
  1304. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1305. } else {
  1306. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1307. }
  1308. }
  1309. });
  1310. return parsed;
  1311. };
  1312. /***/ }),
  1313. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1314. /*!**************************************************!*\
  1315. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1316. \**************************************************/
  1317. /***/ ((module) => {
  1318. "use strict";
  1319. /**
  1320. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1321. *
  1322. * Common use case would be to use `Function.prototype.apply`.
  1323. *
  1324. * ```js
  1325. * function f(x, y, z) {}
  1326. * var args = [1, 2, 3];
  1327. * f.apply(null, args);
  1328. * ```
  1329. *
  1330. * With `spread` this example can be re-written.
  1331. *
  1332. * ```js
  1333. * spread(function(x, y, z) {})([1, 2, 3]);
  1334. * ```
  1335. *
  1336. * @param {Function} callback
  1337. * @returns {Function}
  1338. */
  1339. module.exports = function spread(callback) {
  1340. return function wrap(arr) {
  1341. return callback.apply(null, arr);
  1342. };
  1343. };
  1344. /***/ }),
  1345. /***/ "./node_modules/axios/lib/utils.js":
  1346. /*!*****************************************!*\
  1347. !*** ./node_modules/axios/lib/utils.js ***!
  1348. \*****************************************/
  1349. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1350. "use strict";
  1351. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1352. /*global toString:true*/
  1353. // utils is a library of generic helper functions non-specific to axios
  1354. var toString = Object.prototype.toString;
  1355. /**
  1356. * Determine if a value is an Array
  1357. *
  1358. * @param {Object} val The value to test
  1359. * @returns {boolean} True if value is an Array, otherwise false
  1360. */
  1361. function isArray(val) {
  1362. return toString.call(val) === '[object Array]';
  1363. }
  1364. /**
  1365. * Determine if a value is undefined
  1366. *
  1367. * @param {Object} val The value to test
  1368. * @returns {boolean} True if the value is undefined, otherwise false
  1369. */
  1370. function isUndefined(val) {
  1371. return typeof val === 'undefined';
  1372. }
  1373. /**
  1374. * Determine if a value is a Buffer
  1375. *
  1376. * @param {Object} val The value to test
  1377. * @returns {boolean} True if value is a Buffer, otherwise false
  1378. */
  1379. function isBuffer(val) {
  1380. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1381. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1382. }
  1383. /**
  1384. * Determine if a value is an ArrayBuffer
  1385. *
  1386. * @param {Object} val The value to test
  1387. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1388. */
  1389. function isArrayBuffer(val) {
  1390. return toString.call(val) === '[object ArrayBuffer]';
  1391. }
  1392. /**
  1393. * Determine if a value is a FormData
  1394. *
  1395. * @param {Object} val The value to test
  1396. * @returns {boolean} True if value is an FormData, otherwise false
  1397. */
  1398. function isFormData(val) {
  1399. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1400. }
  1401. /**
  1402. * Determine if a value is a view on an ArrayBuffer
  1403. *
  1404. * @param {Object} val The value to test
  1405. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1406. */
  1407. function isArrayBufferView(val) {
  1408. var result;
  1409. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1410. result = ArrayBuffer.isView(val);
  1411. } else {
  1412. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1413. }
  1414. return result;
  1415. }
  1416. /**
  1417. * Determine if a value is a String
  1418. *
  1419. * @param {Object} val The value to test
  1420. * @returns {boolean} True if value is a String, otherwise false
  1421. */
  1422. function isString(val) {
  1423. return typeof val === 'string';
  1424. }
  1425. /**
  1426. * Determine if a value is a Number
  1427. *
  1428. * @param {Object} val The value to test
  1429. * @returns {boolean} True if value is a Number, otherwise false
  1430. */
  1431. function isNumber(val) {
  1432. return typeof val === 'number';
  1433. }
  1434. /**
  1435. * Determine if a value is an Object
  1436. *
  1437. * @param {Object} val The value to test
  1438. * @returns {boolean} True if value is an Object, otherwise false
  1439. */
  1440. function isObject(val) {
  1441. return val !== null && typeof val === 'object';
  1442. }
  1443. /**
  1444. * Determine if a value is a plain Object
  1445. *
  1446. * @param {Object} val The value to test
  1447. * @return {boolean} True if value is a plain Object, otherwise false
  1448. */
  1449. function isPlainObject(val) {
  1450. if (toString.call(val) !== '[object Object]') {
  1451. return false;
  1452. }
  1453. var prototype = Object.getPrototypeOf(val);
  1454. return prototype === null || prototype === Object.prototype;
  1455. }
  1456. /**
  1457. * Determine if a value is a Date
  1458. *
  1459. * @param {Object} val The value to test
  1460. * @returns {boolean} True if value is a Date, otherwise false
  1461. */
  1462. function isDate(val) {
  1463. return toString.call(val) === '[object Date]';
  1464. }
  1465. /**
  1466. * Determine if a value is a File
  1467. *
  1468. * @param {Object} val The value to test
  1469. * @returns {boolean} True if value is a File, otherwise false
  1470. */
  1471. function isFile(val) {
  1472. return toString.call(val) === '[object File]';
  1473. }
  1474. /**
  1475. * Determine if a value is a Blob
  1476. *
  1477. * @param {Object} val The value to test
  1478. * @returns {boolean} True if value is a Blob, otherwise false
  1479. */
  1480. function isBlob(val) {
  1481. return toString.call(val) === '[object Blob]';
  1482. }
  1483. /**
  1484. * Determine if a value is a Function
  1485. *
  1486. * @param {Object} val The value to test
  1487. * @returns {boolean} True if value is a Function, otherwise false
  1488. */
  1489. function isFunction(val) {
  1490. return toString.call(val) === '[object Function]';
  1491. }
  1492. /**
  1493. * Determine if a value is a Stream
  1494. *
  1495. * @param {Object} val The value to test
  1496. * @returns {boolean} True if value is a Stream, otherwise false
  1497. */
  1498. function isStream(val) {
  1499. return isObject(val) && isFunction(val.pipe);
  1500. }
  1501. /**
  1502. * Determine if a value is a URLSearchParams object
  1503. *
  1504. * @param {Object} val The value to test
  1505. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1506. */
  1507. function isURLSearchParams(val) {
  1508. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1509. }
  1510. /**
  1511. * Trim excess whitespace off the beginning and end of a string
  1512. *
  1513. * @param {String} str The String to trim
  1514. * @returns {String} The String freed of excess whitespace
  1515. */
  1516. function trim(str) {
  1517. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1518. }
  1519. /**
  1520. * Determine if we're running in a standard browser environment
  1521. *
  1522. * This allows axios to run in a web worker, and react-native.
  1523. * Both environments support XMLHttpRequest, but not fully standard globals.
  1524. *
  1525. * web workers:
  1526. * typeof window -> undefined
  1527. * typeof document -> undefined
  1528. *
  1529. * react-native:
  1530. * navigator.product -> 'ReactNative'
  1531. * nativescript
  1532. * navigator.product -> 'NativeScript' or 'NS'
  1533. */
  1534. function isStandardBrowserEnv() {
  1535. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1536. navigator.product === 'NativeScript' ||
  1537. navigator.product === 'NS')) {
  1538. return false;
  1539. }
  1540. return (
  1541. typeof window !== 'undefined' &&
  1542. typeof document !== 'undefined'
  1543. );
  1544. }
  1545. /**
  1546. * Iterate over an Array or an Object invoking a function for each item.
  1547. *
  1548. * If `obj` is an Array callback will be called passing
  1549. * the value, index, and complete array for each item.
  1550. *
  1551. * If 'obj' is an Object callback will be called passing
  1552. * the value, key, and complete object for each property.
  1553. *
  1554. * @param {Object|Array} obj The object to iterate
  1555. * @param {Function} fn The callback to invoke for each item
  1556. */
  1557. function forEach(obj, fn) {
  1558. // Don't bother if no value provided
  1559. if (obj === null || typeof obj === 'undefined') {
  1560. return;
  1561. }
  1562. // Force an array if not already something iterable
  1563. if (typeof obj !== 'object') {
  1564. /*eslint no-param-reassign:0*/
  1565. obj = [obj];
  1566. }
  1567. if (isArray(obj)) {
  1568. // Iterate over array values
  1569. for (var i = 0, l = obj.length; i < l; i++) {
  1570. fn.call(null, obj[i], i, obj);
  1571. }
  1572. } else {
  1573. // Iterate over object keys
  1574. for (var key in obj) {
  1575. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1576. fn.call(null, obj[key], key, obj);
  1577. }
  1578. }
  1579. }
  1580. }
  1581. /**
  1582. * Accepts varargs expecting each argument to be an object, then
  1583. * immutably merges the properties of each object and returns result.
  1584. *
  1585. * When multiple objects contain the same key the later object in
  1586. * the arguments list will take precedence.
  1587. *
  1588. * Example:
  1589. *
  1590. * ```js
  1591. * var result = merge({foo: 123}, {foo: 456});
  1592. * console.log(result.foo); // outputs 456
  1593. * ```
  1594. *
  1595. * @param {Object} obj1 Object to merge
  1596. * @returns {Object} Result of all merge properties
  1597. */
  1598. function merge(/* obj1, obj2, obj3, ... */) {
  1599. var result = {};
  1600. function assignValue(val, key) {
  1601. if (isPlainObject(result[key]) && isPlainObject(val)) {
  1602. result[key] = merge(result[key], val);
  1603. } else if (isPlainObject(val)) {
  1604. result[key] = merge({}, val);
  1605. } else if (isArray(val)) {
  1606. result[key] = val.slice();
  1607. } else {
  1608. result[key] = val;
  1609. }
  1610. }
  1611. for (var i = 0, l = arguments.length; i < l; i++) {
  1612. forEach(arguments[i], assignValue);
  1613. }
  1614. return result;
  1615. }
  1616. /**
  1617. * Extends object a by mutably adding to it the properties of object b.
  1618. *
  1619. * @param {Object} a The object to be extended
  1620. * @param {Object} b The object to copy properties from
  1621. * @param {Object} thisArg The object to bind function to
  1622. * @return {Object} The resulting value of object a
  1623. */
  1624. function extend(a, b, thisArg) {
  1625. forEach(b, function assignValue(val, key) {
  1626. if (thisArg && typeof val === 'function') {
  1627. a[key] = bind(val, thisArg);
  1628. } else {
  1629. a[key] = val;
  1630. }
  1631. });
  1632. return a;
  1633. }
  1634. /**
  1635. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  1636. *
  1637. * @param {string} content with BOM
  1638. * @return {string} content value without BOM
  1639. */
  1640. function stripBOM(content) {
  1641. if (content.charCodeAt(0) === 0xFEFF) {
  1642. content = content.slice(1);
  1643. }
  1644. return content;
  1645. }
  1646. module.exports = {
  1647. isArray: isArray,
  1648. isArrayBuffer: isArrayBuffer,
  1649. isBuffer: isBuffer,
  1650. isFormData: isFormData,
  1651. isArrayBufferView: isArrayBufferView,
  1652. isString: isString,
  1653. isNumber: isNumber,
  1654. isObject: isObject,
  1655. isPlainObject: isPlainObject,
  1656. isUndefined: isUndefined,
  1657. isDate: isDate,
  1658. isFile: isFile,
  1659. isBlob: isBlob,
  1660. isFunction: isFunction,
  1661. isStream: isStream,
  1662. isURLSearchParams: isURLSearchParams,
  1663. isStandardBrowserEnv: isStandardBrowserEnv,
  1664. forEach: forEach,
  1665. merge: merge,
  1666. extend: extend,
  1667. trim: trim,
  1668. stripBOM: stripBOM
  1669. };
  1670. /***/ }),
  1671. /***/ "./node_modules/lodash.remove/index.js":
  1672. /*!*********************************************!*\
  1673. !*** ./node_modules/lodash.remove/index.js ***!
  1674. \*********************************************/
  1675. /***/ ((module, exports, __webpack_require__) => {
  1676. /* module decorator */ module = __webpack_require__.nmd(module);
  1677. /**
  1678. * lodash (Custom Build) <https://lodash.com/>
  1679. * Build: `lodash modularize exports="npm" -o ./`
  1680. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1681. * Released under MIT license <https://lodash.com/license>
  1682. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1683. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1684. */
  1685. /** Used as the size to enable large array optimizations. */
  1686. var LARGE_ARRAY_SIZE = 200;
  1687. /** Used as the `TypeError` message for "Functions" methods. */
  1688. var FUNC_ERROR_TEXT = 'Expected a function';
  1689. /** Used to stand-in for `undefined` hash values. */
  1690. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  1691. /** Used to compose bitmasks for comparison styles. */
  1692. var UNORDERED_COMPARE_FLAG = 1,
  1693. PARTIAL_COMPARE_FLAG = 2;
  1694. /** Used as references for various `Number` constants. */
  1695. var INFINITY = 1 / 0,
  1696. MAX_SAFE_INTEGER = 9007199254740991;
  1697. /** `Object#toString` result references. */
  1698. var argsTag = '[object Arguments]',
  1699. arrayTag = '[object Array]',
  1700. boolTag = '[object Boolean]',
  1701. dateTag = '[object Date]',
  1702. errorTag = '[object Error]',
  1703. funcTag = '[object Function]',
  1704. genTag = '[object GeneratorFunction]',
  1705. mapTag = '[object Map]',
  1706. numberTag = '[object Number]',
  1707. objectTag = '[object Object]',
  1708. promiseTag = '[object Promise]',
  1709. regexpTag = '[object RegExp]',
  1710. setTag = '[object Set]',
  1711. stringTag = '[object String]',
  1712. symbolTag = '[object Symbol]',
  1713. weakMapTag = '[object WeakMap]';
  1714. var arrayBufferTag = '[object ArrayBuffer]',
  1715. dataViewTag = '[object DataView]',
  1716. float32Tag = '[object Float32Array]',
  1717. float64Tag = '[object Float64Array]',
  1718. int8Tag = '[object Int8Array]',
  1719. int16Tag = '[object Int16Array]',
  1720. int32Tag = '[object Int32Array]',
  1721. uint8Tag = '[object Uint8Array]',
  1722. uint8ClampedTag = '[object Uint8ClampedArray]',
  1723. uint16Tag = '[object Uint16Array]',
  1724. uint32Tag = '[object Uint32Array]';
  1725. /** Used to match property names within property paths. */
  1726. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  1727. reIsPlainProp = /^\w*$/,
  1728. reLeadingDot = /^\./,
  1729. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1730. /**
  1731. * Used to match `RegExp`
  1732. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1733. */
  1734. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1735. /** Used to match backslashes in property paths. */
  1736. var reEscapeChar = /\\(\\)?/g;
  1737. /** Used to detect host constructors (Safari). */
  1738. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1739. /** Used to detect unsigned integer values. */
  1740. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1741. /** Used to identify `toStringTag` values of typed arrays. */
  1742. var typedArrayTags = {};
  1743. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  1744. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  1745. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  1746. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  1747. typedArrayTags[uint32Tag] = true;
  1748. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  1749. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  1750. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  1751. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  1752. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  1753. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  1754. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  1755. typedArrayTags[weakMapTag] = false;
  1756. /** Detect free variable `global` from Node.js. */
  1757. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1758. /** Detect free variable `self`. */
  1759. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1760. /** Used as a reference to the global object. */
  1761. var root = freeGlobal || freeSelf || Function('return this')();
  1762. /** Detect free variable `exports`. */
  1763. var freeExports = true && exports && !exports.nodeType && exports;
  1764. /** Detect free variable `module`. */
  1765. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  1766. /** Detect the popular CommonJS extension `module.exports`. */
  1767. var moduleExports = freeModule && freeModule.exports === freeExports;
  1768. /** Detect free variable `process` from Node.js. */
  1769. var freeProcess = moduleExports && freeGlobal.process;
  1770. /** Used to access faster Node.js helpers. */
  1771. var nodeUtil = (function() {
  1772. try {
  1773. return freeProcess && freeProcess.binding('util');
  1774. } catch (e) {}
  1775. }());
  1776. /* Node.js helper references. */
  1777. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1778. /**
  1779. * A specialized version of `_.some` for arrays without support for iteratee
  1780. * shorthands.
  1781. *
  1782. * @private
  1783. * @param {Array} [array] The array to iterate over.
  1784. * @param {Function} predicate The function invoked per iteration.
  1785. * @returns {boolean} Returns `true` if any element passes the predicate check,
  1786. * else `false`.
  1787. */
  1788. function arraySome(array, predicate) {
  1789. var index = -1,
  1790. length = array ? array.length : 0;
  1791. while (++index < length) {
  1792. if (predicate(array[index], index, array)) {
  1793. return true;
  1794. }
  1795. }
  1796. return false;
  1797. }
  1798. /**
  1799. * The base implementation of `_.property` without support for deep paths.
  1800. *
  1801. * @private
  1802. * @param {string} key The key of the property to get.
  1803. * @returns {Function} Returns the new accessor function.
  1804. */
  1805. function baseProperty(key) {
  1806. return function(object) {
  1807. return object == null ? undefined : object[key];
  1808. };
  1809. }
  1810. /**
  1811. * The base implementation of `_.times` without support for iteratee shorthands
  1812. * or max array length checks.
  1813. *
  1814. * @private
  1815. * @param {number} n The number of times to invoke `iteratee`.
  1816. * @param {Function} iteratee The function invoked per iteration.
  1817. * @returns {Array} Returns the array of results.
  1818. */
  1819. function baseTimes(n, iteratee) {
  1820. var index = -1,
  1821. result = Array(n);
  1822. while (++index < n) {
  1823. result[index] = iteratee(index);
  1824. }
  1825. return result;
  1826. }
  1827. /**
  1828. * The base implementation of `_.unary` without support for storing metadata.
  1829. *
  1830. * @private
  1831. * @param {Function} func The function to cap arguments for.
  1832. * @returns {Function} Returns the new capped function.
  1833. */
  1834. function baseUnary(func) {
  1835. return function(value) {
  1836. return func(value);
  1837. };
  1838. }
  1839. /**
  1840. * Gets the value at `key` of `object`.
  1841. *
  1842. * @private
  1843. * @param {Object} [object] The object to query.
  1844. * @param {string} key The key of the property to get.
  1845. * @returns {*} Returns the property value.
  1846. */
  1847. function getValue(object, key) {
  1848. return object == null ? undefined : object[key];
  1849. }
  1850. /**
  1851. * Checks if `value` is a host object in IE < 9.
  1852. *
  1853. * @private
  1854. * @param {*} value The value to check.
  1855. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1856. */
  1857. function isHostObject(value) {
  1858. // Many host objects are `Object` objects that can coerce to strings
  1859. // despite having improperly defined `toString` methods.
  1860. var result = false;
  1861. if (value != null && typeof value.toString != 'function') {
  1862. try {
  1863. result = !!(value + '');
  1864. } catch (e) {}
  1865. }
  1866. return result;
  1867. }
  1868. /**
  1869. * Converts `map` to its key-value pairs.
  1870. *
  1871. * @private
  1872. * @param {Object} map The map to convert.
  1873. * @returns {Array} Returns the key-value pairs.
  1874. */
  1875. function mapToArray(map) {
  1876. var index = -1,
  1877. result = Array(map.size);
  1878. map.forEach(function(value, key) {
  1879. result[++index] = [key, value];
  1880. });
  1881. return result;
  1882. }
  1883. /**
  1884. * Creates a unary function that invokes `func` with its argument transformed.
  1885. *
  1886. * @private
  1887. * @param {Function} func The function to wrap.
  1888. * @param {Function} transform The argument transform.
  1889. * @returns {Function} Returns the new function.
  1890. */
  1891. function overArg(func, transform) {
  1892. return function(arg) {
  1893. return func(transform(arg));
  1894. };
  1895. }
  1896. /**
  1897. * Converts `set` to an array of its values.
  1898. *
  1899. * @private
  1900. * @param {Object} set The set to convert.
  1901. * @returns {Array} Returns the values.
  1902. */
  1903. function setToArray(set) {
  1904. var index = -1,
  1905. result = Array(set.size);
  1906. set.forEach(function(value) {
  1907. result[++index] = value;
  1908. });
  1909. return result;
  1910. }
  1911. /** Used for built-in method references. */
  1912. var arrayProto = Array.prototype,
  1913. funcProto = Function.prototype,
  1914. objectProto = Object.prototype;
  1915. /** Used to detect overreaching core-js shims. */
  1916. var coreJsData = root['__core-js_shared__'];
  1917. /** Used to detect methods masquerading as native. */
  1918. var maskSrcKey = (function() {
  1919. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1920. return uid ? ('Symbol(src)_1.' + uid) : '';
  1921. }());
  1922. /** Used to resolve the decompiled source of functions. */
  1923. var funcToString = funcProto.toString;
  1924. /** Used to check objects for own properties. */
  1925. var hasOwnProperty = objectProto.hasOwnProperty;
  1926. /**
  1927. * Used to resolve the
  1928. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1929. * of values.
  1930. */
  1931. var objectToString = objectProto.toString;
  1932. /** Used to detect if a method is native. */
  1933. var reIsNative = RegExp('^' +
  1934. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1935. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1936. );
  1937. /** Built-in value references. */
  1938. var Symbol = root.Symbol,
  1939. Uint8Array = root.Uint8Array,
  1940. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  1941. splice = arrayProto.splice;
  1942. /* Built-in method references for those with the same name as other `lodash` methods. */
  1943. var nativeKeys = overArg(Object.keys, Object);
  1944. /* Built-in method references that are verified to be native. */
  1945. var DataView = getNative(root, 'DataView'),
  1946. Map = getNative(root, 'Map'),
  1947. Promise = getNative(root, 'Promise'),
  1948. Set = getNative(root, 'Set'),
  1949. WeakMap = getNative(root, 'WeakMap'),
  1950. nativeCreate = getNative(Object, 'create');
  1951. /** Used to detect maps, sets, and weakmaps. */
  1952. var dataViewCtorString = toSource(DataView),
  1953. mapCtorString = toSource(Map),
  1954. promiseCtorString = toSource(Promise),
  1955. setCtorString = toSource(Set),
  1956. weakMapCtorString = toSource(WeakMap);
  1957. /** Used to convert symbols to primitives and strings. */
  1958. var symbolProto = Symbol ? Symbol.prototype : undefined,
  1959. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  1960. symbolToString = symbolProto ? symbolProto.toString : undefined;
  1961. /**
  1962. * Creates a hash object.
  1963. *
  1964. * @private
  1965. * @constructor
  1966. * @param {Array} [entries] The key-value pairs to cache.
  1967. */
  1968. function Hash(entries) {
  1969. var index = -1,
  1970. length = entries ? entries.length : 0;
  1971. this.clear();
  1972. while (++index < length) {
  1973. var entry = entries[index];
  1974. this.set(entry[0], entry[1]);
  1975. }
  1976. }
  1977. /**
  1978. * Removes all key-value entries from the hash.
  1979. *
  1980. * @private
  1981. * @name clear
  1982. * @memberOf Hash
  1983. */
  1984. function hashClear() {
  1985. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1986. }
  1987. /**
  1988. * Removes `key` and its value from the hash.
  1989. *
  1990. * @private
  1991. * @name delete
  1992. * @memberOf Hash
  1993. * @param {Object} hash The hash to modify.
  1994. * @param {string} key The key of the value to remove.
  1995. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1996. */
  1997. function hashDelete(key) {
  1998. return this.has(key) && delete this.__data__[key];
  1999. }
  2000. /**
  2001. * Gets the hash value for `key`.
  2002. *
  2003. * @private
  2004. * @name get
  2005. * @memberOf Hash
  2006. * @param {string} key The key of the value to get.
  2007. * @returns {*} Returns the entry value.
  2008. */
  2009. function hashGet(key) {
  2010. var data = this.__data__;
  2011. if (nativeCreate) {
  2012. var result = data[key];
  2013. return result === HASH_UNDEFINED ? undefined : result;
  2014. }
  2015. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  2016. }
  2017. /**
  2018. * Checks if a hash value for `key` exists.
  2019. *
  2020. * @private
  2021. * @name has
  2022. * @memberOf Hash
  2023. * @param {string} key The key of the entry to check.
  2024. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2025. */
  2026. function hashHas(key) {
  2027. var data = this.__data__;
  2028. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  2029. }
  2030. /**
  2031. * Sets the hash `key` to `value`.
  2032. *
  2033. * @private
  2034. * @name set
  2035. * @memberOf Hash
  2036. * @param {string} key The key of the value to set.
  2037. * @param {*} value The value to set.
  2038. * @returns {Object} Returns the hash instance.
  2039. */
  2040. function hashSet(key, value) {
  2041. var data = this.__data__;
  2042. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  2043. return this;
  2044. }
  2045. // Add methods to `Hash`.
  2046. Hash.prototype.clear = hashClear;
  2047. Hash.prototype['delete'] = hashDelete;
  2048. Hash.prototype.get = hashGet;
  2049. Hash.prototype.has = hashHas;
  2050. Hash.prototype.set = hashSet;
  2051. /**
  2052. * Creates an list cache object.
  2053. *
  2054. * @private
  2055. * @constructor
  2056. * @param {Array} [entries] The key-value pairs to cache.
  2057. */
  2058. function ListCache(entries) {
  2059. var index = -1,
  2060. length = entries ? entries.length : 0;
  2061. this.clear();
  2062. while (++index < length) {
  2063. var entry = entries[index];
  2064. this.set(entry[0], entry[1]);
  2065. }
  2066. }
  2067. /**
  2068. * Removes all key-value entries from the list cache.
  2069. *
  2070. * @private
  2071. * @name clear
  2072. * @memberOf ListCache
  2073. */
  2074. function listCacheClear() {
  2075. this.__data__ = [];
  2076. }
  2077. /**
  2078. * Removes `key` and its value from the list cache.
  2079. *
  2080. * @private
  2081. * @name delete
  2082. * @memberOf ListCache
  2083. * @param {string} key The key of the value to remove.
  2084. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2085. */
  2086. function listCacheDelete(key) {
  2087. var data = this.__data__,
  2088. index = assocIndexOf(data, key);
  2089. if (index < 0) {
  2090. return false;
  2091. }
  2092. var lastIndex = data.length - 1;
  2093. if (index == lastIndex) {
  2094. data.pop();
  2095. } else {
  2096. splice.call(data, index, 1);
  2097. }
  2098. return true;
  2099. }
  2100. /**
  2101. * Gets the list cache value for `key`.
  2102. *
  2103. * @private
  2104. * @name get
  2105. * @memberOf ListCache
  2106. * @param {string} key The key of the value to get.
  2107. * @returns {*} Returns the entry value.
  2108. */
  2109. function listCacheGet(key) {
  2110. var data = this.__data__,
  2111. index = assocIndexOf(data, key);
  2112. return index < 0 ? undefined : data[index][1];
  2113. }
  2114. /**
  2115. * Checks if a list cache value for `key` exists.
  2116. *
  2117. * @private
  2118. * @name has
  2119. * @memberOf ListCache
  2120. * @param {string} key The key of the entry to check.
  2121. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2122. */
  2123. function listCacheHas(key) {
  2124. return assocIndexOf(this.__data__, key) > -1;
  2125. }
  2126. /**
  2127. * Sets the list cache `key` to `value`.
  2128. *
  2129. * @private
  2130. * @name set
  2131. * @memberOf ListCache
  2132. * @param {string} key The key of the value to set.
  2133. * @param {*} value The value to set.
  2134. * @returns {Object} Returns the list cache instance.
  2135. */
  2136. function listCacheSet(key, value) {
  2137. var data = this.__data__,
  2138. index = assocIndexOf(data, key);
  2139. if (index < 0) {
  2140. data.push([key, value]);
  2141. } else {
  2142. data[index][1] = value;
  2143. }
  2144. return this;
  2145. }
  2146. // Add methods to `ListCache`.
  2147. ListCache.prototype.clear = listCacheClear;
  2148. ListCache.prototype['delete'] = listCacheDelete;
  2149. ListCache.prototype.get = listCacheGet;
  2150. ListCache.prototype.has = listCacheHas;
  2151. ListCache.prototype.set = listCacheSet;
  2152. /**
  2153. * Creates a map cache object to store key-value pairs.
  2154. *
  2155. * @private
  2156. * @constructor
  2157. * @param {Array} [entries] The key-value pairs to cache.
  2158. */
  2159. function MapCache(entries) {
  2160. var index = -1,
  2161. length = entries ? entries.length : 0;
  2162. this.clear();
  2163. while (++index < length) {
  2164. var entry = entries[index];
  2165. this.set(entry[0], entry[1]);
  2166. }
  2167. }
  2168. /**
  2169. * Removes all key-value entries from the map.
  2170. *
  2171. * @private
  2172. * @name clear
  2173. * @memberOf MapCache
  2174. */
  2175. function mapCacheClear() {
  2176. this.__data__ = {
  2177. 'hash': new Hash,
  2178. 'map': new (Map || ListCache),
  2179. 'string': new Hash
  2180. };
  2181. }
  2182. /**
  2183. * Removes `key` and its value from the map.
  2184. *
  2185. * @private
  2186. * @name delete
  2187. * @memberOf MapCache
  2188. * @param {string} key The key of the value to remove.
  2189. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2190. */
  2191. function mapCacheDelete(key) {
  2192. return getMapData(this, key)['delete'](key);
  2193. }
  2194. /**
  2195. * Gets the map value for `key`.
  2196. *
  2197. * @private
  2198. * @name get
  2199. * @memberOf MapCache
  2200. * @param {string} key The key of the value to get.
  2201. * @returns {*} Returns the entry value.
  2202. */
  2203. function mapCacheGet(key) {
  2204. return getMapData(this, key).get(key);
  2205. }
  2206. /**
  2207. * Checks if a map value for `key` exists.
  2208. *
  2209. * @private
  2210. * @name has
  2211. * @memberOf MapCache
  2212. * @param {string} key The key of the entry to check.
  2213. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2214. */
  2215. function mapCacheHas(key) {
  2216. return getMapData(this, key).has(key);
  2217. }
  2218. /**
  2219. * Sets the map `key` to `value`.
  2220. *
  2221. * @private
  2222. * @name set
  2223. * @memberOf MapCache
  2224. * @param {string} key The key of the value to set.
  2225. * @param {*} value The value to set.
  2226. * @returns {Object} Returns the map cache instance.
  2227. */
  2228. function mapCacheSet(key, value) {
  2229. getMapData(this, key).set(key, value);
  2230. return this;
  2231. }
  2232. // Add methods to `MapCache`.
  2233. MapCache.prototype.clear = mapCacheClear;
  2234. MapCache.prototype['delete'] = mapCacheDelete;
  2235. MapCache.prototype.get = mapCacheGet;
  2236. MapCache.prototype.has = mapCacheHas;
  2237. MapCache.prototype.set = mapCacheSet;
  2238. /**
  2239. *
  2240. * Creates an array cache object to store unique values.
  2241. *
  2242. * @private
  2243. * @constructor
  2244. * @param {Array} [values] The values to cache.
  2245. */
  2246. function SetCache(values) {
  2247. var index = -1,
  2248. length = values ? values.length : 0;
  2249. this.__data__ = new MapCache;
  2250. while (++index < length) {
  2251. this.add(values[index]);
  2252. }
  2253. }
  2254. /**
  2255. * Adds `value` to the array cache.
  2256. *
  2257. * @private
  2258. * @name add
  2259. * @memberOf SetCache
  2260. * @alias push
  2261. * @param {*} value The value to cache.
  2262. * @returns {Object} Returns the cache instance.
  2263. */
  2264. function setCacheAdd(value) {
  2265. this.__data__.set(value, HASH_UNDEFINED);
  2266. return this;
  2267. }
  2268. /**
  2269. * Checks if `value` is in the array cache.
  2270. *
  2271. * @private
  2272. * @name has
  2273. * @memberOf SetCache
  2274. * @param {*} value The value to search for.
  2275. * @returns {number} Returns `true` if `value` is found, else `false`.
  2276. */
  2277. function setCacheHas(value) {
  2278. return this.__data__.has(value);
  2279. }
  2280. // Add methods to `SetCache`.
  2281. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2282. SetCache.prototype.has = setCacheHas;
  2283. /**
  2284. * Creates a stack cache object to store key-value pairs.
  2285. *
  2286. * @private
  2287. * @constructor
  2288. * @param {Array} [entries] The key-value pairs to cache.
  2289. */
  2290. function Stack(entries) {
  2291. this.__data__ = new ListCache(entries);
  2292. }
  2293. /**
  2294. * Removes all key-value entries from the stack.
  2295. *
  2296. * @private
  2297. * @name clear
  2298. * @memberOf Stack
  2299. */
  2300. function stackClear() {
  2301. this.__data__ = new ListCache;
  2302. }
  2303. /**
  2304. * Removes `key` and its value from the stack.
  2305. *
  2306. * @private
  2307. * @name delete
  2308. * @memberOf Stack
  2309. * @param {string} key The key of the value to remove.
  2310. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  2311. */
  2312. function stackDelete(key) {
  2313. return this.__data__['delete'](key);
  2314. }
  2315. /**
  2316. * Gets the stack value for `key`.
  2317. *
  2318. * @private
  2319. * @name get
  2320. * @memberOf Stack
  2321. * @param {string} key The key of the value to get.
  2322. * @returns {*} Returns the entry value.
  2323. */
  2324. function stackGet(key) {
  2325. return this.__data__.get(key);
  2326. }
  2327. /**
  2328. * Checks if a stack value for `key` exists.
  2329. *
  2330. * @private
  2331. * @name has
  2332. * @memberOf Stack
  2333. * @param {string} key The key of the entry to check.
  2334. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  2335. */
  2336. function stackHas(key) {
  2337. return this.__data__.has(key);
  2338. }
  2339. /**
  2340. * Sets the stack `key` to `value`.
  2341. *
  2342. * @private
  2343. * @name set
  2344. * @memberOf Stack
  2345. * @param {string} key The key of the value to set.
  2346. * @param {*} value The value to set.
  2347. * @returns {Object} Returns the stack cache instance.
  2348. */
  2349. function stackSet(key, value) {
  2350. var cache = this.__data__;
  2351. if (cache instanceof ListCache) {
  2352. var pairs = cache.__data__;
  2353. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  2354. pairs.push([key, value]);
  2355. return this;
  2356. }
  2357. cache = this.__data__ = new MapCache(pairs);
  2358. }
  2359. cache.set(key, value);
  2360. return this;
  2361. }
  2362. // Add methods to `Stack`.
  2363. Stack.prototype.clear = stackClear;
  2364. Stack.prototype['delete'] = stackDelete;
  2365. Stack.prototype.get = stackGet;
  2366. Stack.prototype.has = stackHas;
  2367. Stack.prototype.set = stackSet;
  2368. /**
  2369. * Creates an array of the enumerable property names of the array-like `value`.
  2370. *
  2371. * @private
  2372. * @param {*} value The value to query.
  2373. * @param {boolean} inherited Specify returning inherited property names.
  2374. * @returns {Array} Returns the array of property names.
  2375. */
  2376. function arrayLikeKeys(value, inherited) {
  2377. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2378. // Safari 9 makes `arguments.length` enumerable in strict mode.
  2379. var result = (isArray(value) || isArguments(value))
  2380. ? baseTimes(value.length, String)
  2381. : [];
  2382. var length = result.length,
  2383. skipIndexes = !!length;
  2384. for (var key in value) {
  2385. if ((inherited || hasOwnProperty.call(value, key)) &&
  2386. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  2387. result.push(key);
  2388. }
  2389. }
  2390. return result;
  2391. }
  2392. /**
  2393. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2394. *
  2395. * @private
  2396. * @param {Array} array The array to inspect.
  2397. * @param {*} key The key to search for.
  2398. * @returns {number} Returns the index of the matched value, else `-1`.
  2399. */
  2400. function assocIndexOf(array, key) {
  2401. var length = array.length;
  2402. while (length--) {
  2403. if (eq(array[length][0], key)) {
  2404. return length;
  2405. }
  2406. }
  2407. return -1;
  2408. }
  2409. /**
  2410. * The base implementation of `_.get` without support for default values.
  2411. *
  2412. * @private
  2413. * @param {Object} object The object to query.
  2414. * @param {Array|string} path The path of the property to get.
  2415. * @returns {*} Returns the resolved value.
  2416. */
  2417. function baseGet(object, path) {
  2418. path = isKey(path, object) ? [path] : castPath(path);
  2419. var index = 0,
  2420. length = path.length;
  2421. while (object != null && index < length) {
  2422. object = object[toKey(path[index++])];
  2423. }
  2424. return (index && index == length) ? object : undefined;
  2425. }
  2426. /**
  2427. * The base implementation of `getTag`.
  2428. *
  2429. * @private
  2430. * @param {*} value The value to query.
  2431. * @returns {string} Returns the `toStringTag`.
  2432. */
  2433. function baseGetTag(value) {
  2434. return objectToString.call(value);
  2435. }
  2436. /**
  2437. * The base implementation of `_.hasIn` without support for deep paths.
  2438. *
  2439. * @private
  2440. * @param {Object} [object] The object to query.
  2441. * @param {Array|string} key The key to check.
  2442. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  2443. */
  2444. function baseHasIn(object, key) {
  2445. return object != null && key in Object(object);
  2446. }
  2447. /**
  2448. * The base implementation of `_.isEqual` which supports partial comparisons
  2449. * and tracks traversed objects.
  2450. *
  2451. * @private
  2452. * @param {*} value The value to compare.
  2453. * @param {*} other The other value to compare.
  2454. * @param {Function} [customizer] The function to customize comparisons.
  2455. * @param {boolean} [bitmask] The bitmask of comparison flags.
  2456. * The bitmask may be composed of the following flags:
  2457. * 1 - Unordered comparison
  2458. * 2 - Partial comparison
  2459. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  2460. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2461. */
  2462. function baseIsEqual(value, other, customizer, bitmask, stack) {
  2463. if (value === other) {
  2464. return true;
  2465. }
  2466. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  2467. return value !== value && other !== other;
  2468. }
  2469. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  2470. }
  2471. /**
  2472. * A specialized version of `baseIsEqual` for arrays and objects which performs
  2473. * deep comparisons and tracks traversed objects enabling objects with circular
  2474. * references to be compared.
  2475. *
  2476. * @private
  2477. * @param {Object} object The object to compare.
  2478. * @param {Object} other The other object to compare.
  2479. * @param {Function} equalFunc The function to determine equivalents of values.
  2480. * @param {Function} [customizer] The function to customize comparisons.
  2481. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  2482. * for more details.
  2483. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  2484. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2485. */
  2486. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  2487. var objIsArr = isArray(object),
  2488. othIsArr = isArray(other),
  2489. objTag = arrayTag,
  2490. othTag = arrayTag;
  2491. if (!objIsArr) {
  2492. objTag = getTag(object);
  2493. objTag = objTag == argsTag ? objectTag : objTag;
  2494. }
  2495. if (!othIsArr) {
  2496. othTag = getTag(other);
  2497. othTag = othTag == argsTag ? objectTag : othTag;
  2498. }
  2499. var objIsObj = objTag == objectTag && !isHostObject(object),
  2500. othIsObj = othTag == objectTag && !isHostObject(other),
  2501. isSameTag = objTag == othTag;
  2502. if (isSameTag && !objIsObj) {
  2503. stack || (stack = new Stack);
  2504. return (objIsArr || isTypedArray(object))
  2505. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  2506. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  2507. }
  2508. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  2509. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  2510. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  2511. if (objIsWrapped || othIsWrapped) {
  2512. var objUnwrapped = objIsWrapped ? object.value() : object,
  2513. othUnwrapped = othIsWrapped ? other.value() : other;
  2514. stack || (stack = new Stack);
  2515. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  2516. }
  2517. }
  2518. if (!isSameTag) {
  2519. return false;
  2520. }
  2521. stack || (stack = new Stack);
  2522. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  2523. }
  2524. /**
  2525. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  2526. *
  2527. * @private
  2528. * @param {Object} object The object to inspect.
  2529. * @param {Object} source The object of property values to match.
  2530. * @param {Array} matchData The property names, values, and compare flags to match.
  2531. * @param {Function} [customizer] The function to customize comparisons.
  2532. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  2533. */
  2534. function baseIsMatch(object, source, matchData, customizer) {
  2535. var index = matchData.length,
  2536. length = index,
  2537. noCustomizer = !customizer;
  2538. if (object == null) {
  2539. return !length;
  2540. }
  2541. object = Object(object);
  2542. while (index--) {
  2543. var data = matchData[index];
  2544. if ((noCustomizer && data[2])
  2545. ? data[1] !== object[data[0]]
  2546. : !(data[0] in object)
  2547. ) {
  2548. return false;
  2549. }
  2550. }
  2551. while (++index < length) {
  2552. data = matchData[index];
  2553. var key = data[0],
  2554. objValue = object[key],
  2555. srcValue = data[1];
  2556. if (noCustomizer && data[2]) {
  2557. if (objValue === undefined && !(key in object)) {
  2558. return false;
  2559. }
  2560. } else {
  2561. var stack = new Stack;
  2562. if (customizer) {
  2563. var result = customizer(objValue, srcValue, key, object, source, stack);
  2564. }
  2565. if (!(result === undefined
  2566. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  2567. : result
  2568. )) {
  2569. return false;
  2570. }
  2571. }
  2572. }
  2573. return true;
  2574. }
  2575. /**
  2576. * The base implementation of `_.isNative` without bad shim checks.
  2577. *
  2578. * @private
  2579. * @param {*} value The value to check.
  2580. * @returns {boolean} Returns `true` if `value` is a native function,
  2581. * else `false`.
  2582. */
  2583. function baseIsNative(value) {
  2584. if (!isObject(value) || isMasked(value)) {
  2585. return false;
  2586. }
  2587. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2588. return pattern.test(toSource(value));
  2589. }
  2590. /**
  2591. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  2592. *
  2593. * @private
  2594. * @param {*} value The value to check.
  2595. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  2596. */
  2597. function baseIsTypedArray(value) {
  2598. return isObjectLike(value) &&
  2599. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  2600. }
  2601. /**
  2602. * The base implementation of `_.iteratee`.
  2603. *
  2604. * @private
  2605. * @param {*} [value=_.identity] The value to convert to an iteratee.
  2606. * @returns {Function} Returns the iteratee.
  2607. */
  2608. function baseIteratee(value) {
  2609. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  2610. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  2611. if (typeof value == 'function') {
  2612. return value;
  2613. }
  2614. if (value == null) {
  2615. return identity;
  2616. }
  2617. if (typeof value == 'object') {
  2618. return isArray(value)
  2619. ? baseMatchesProperty(value[0], value[1])
  2620. : baseMatches(value);
  2621. }
  2622. return property(value);
  2623. }
  2624. /**
  2625. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  2626. *
  2627. * @private
  2628. * @param {Object} object The object to query.
  2629. * @returns {Array} Returns the array of property names.
  2630. */
  2631. function baseKeys(object) {
  2632. if (!isPrototype(object)) {
  2633. return nativeKeys(object);
  2634. }
  2635. var result = [];
  2636. for (var key in Object(object)) {
  2637. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  2638. result.push(key);
  2639. }
  2640. }
  2641. return result;
  2642. }
  2643. /**
  2644. * The base implementation of `_.matches` which doesn't clone `source`.
  2645. *
  2646. * @private
  2647. * @param {Object} source The object of property values to match.
  2648. * @returns {Function} Returns the new spec function.
  2649. */
  2650. function baseMatches(source) {
  2651. var matchData = getMatchData(source);
  2652. if (matchData.length == 1 && matchData[0][2]) {
  2653. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  2654. }
  2655. return function(object) {
  2656. return object === source || baseIsMatch(object, source, matchData);
  2657. };
  2658. }
  2659. /**
  2660. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  2661. *
  2662. * @private
  2663. * @param {string} path The path of the property to get.
  2664. * @param {*} srcValue The value to match.
  2665. * @returns {Function} Returns the new spec function.
  2666. */
  2667. function baseMatchesProperty(path, srcValue) {
  2668. if (isKey(path) && isStrictComparable(srcValue)) {
  2669. return matchesStrictComparable(toKey(path), srcValue);
  2670. }
  2671. return function(object) {
  2672. var objValue = get(object, path);
  2673. return (objValue === undefined && objValue === srcValue)
  2674. ? hasIn(object, path)
  2675. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  2676. };
  2677. }
  2678. /**
  2679. * A specialized version of `baseProperty` which supports deep paths.
  2680. *
  2681. * @private
  2682. * @param {Array|string} path The path of the property to get.
  2683. * @returns {Function} Returns the new accessor function.
  2684. */
  2685. function basePropertyDeep(path) {
  2686. return function(object) {
  2687. return baseGet(object, path);
  2688. };
  2689. }
  2690. /**
  2691. * The base implementation of `_.pullAt` without support for individual
  2692. * indexes or capturing the removed elements.
  2693. *
  2694. * @private
  2695. * @param {Array} array The array to modify.
  2696. * @param {number[]} indexes The indexes of elements to remove.
  2697. * @returns {Array} Returns `array`.
  2698. */
  2699. function basePullAt(array, indexes) {
  2700. var length = array ? indexes.length : 0,
  2701. lastIndex = length - 1;
  2702. while (length--) {
  2703. var index = indexes[length];
  2704. if (length == lastIndex || index !== previous) {
  2705. var previous = index;
  2706. if (isIndex(index)) {
  2707. splice.call(array, index, 1);
  2708. }
  2709. else if (!isKey(index, array)) {
  2710. var path = castPath(index),
  2711. object = parent(array, path);
  2712. if (object != null) {
  2713. delete object[toKey(last(path))];
  2714. }
  2715. }
  2716. else {
  2717. delete array[toKey(index)];
  2718. }
  2719. }
  2720. }
  2721. return array;
  2722. }
  2723. /**
  2724. * The base implementation of `_.slice` without an iteratee call guard.
  2725. *
  2726. * @private
  2727. * @param {Array} array The array to slice.
  2728. * @param {number} [start=0] The start position.
  2729. * @param {number} [end=array.length] The end position.
  2730. * @returns {Array} Returns the slice of `array`.
  2731. */
  2732. function baseSlice(array, start, end) {
  2733. var index = -1,
  2734. length = array.length;
  2735. if (start < 0) {
  2736. start = -start > length ? 0 : (length + start);
  2737. }
  2738. end = end > length ? length : end;
  2739. if (end < 0) {
  2740. end += length;
  2741. }
  2742. length = start > end ? 0 : ((end - start) >>> 0);
  2743. start >>>= 0;
  2744. var result = Array(length);
  2745. while (++index < length) {
  2746. result[index] = array[index + start];
  2747. }
  2748. return result;
  2749. }
  2750. /**
  2751. * The base implementation of `_.toString` which doesn't convert nullish
  2752. * values to empty strings.
  2753. *
  2754. * @private
  2755. * @param {*} value The value to process.
  2756. * @returns {string} Returns the string.
  2757. */
  2758. function baseToString(value) {
  2759. // Exit early for strings to avoid a performance hit in some environments.
  2760. if (typeof value == 'string') {
  2761. return value;
  2762. }
  2763. if (isSymbol(value)) {
  2764. return symbolToString ? symbolToString.call(value) : '';
  2765. }
  2766. var result = (value + '');
  2767. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2768. }
  2769. /**
  2770. * Casts `value` to a path array if it's not one.
  2771. *
  2772. * @private
  2773. * @param {*} value The value to inspect.
  2774. * @returns {Array} Returns the cast property path array.
  2775. */
  2776. function castPath(value) {
  2777. return isArray(value) ? value : stringToPath(value);
  2778. }
  2779. /**
  2780. * A specialized version of `baseIsEqualDeep` for arrays with support for
  2781. * partial deep comparisons.
  2782. *
  2783. * @private
  2784. * @param {Array} array The array to compare.
  2785. * @param {Array} other The other array to compare.
  2786. * @param {Function} equalFunc The function to determine equivalents of values.
  2787. * @param {Function} customizer The function to customize comparisons.
  2788. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  2789. * for more details.
  2790. * @param {Object} stack Tracks traversed `array` and `other` objects.
  2791. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  2792. */
  2793. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  2794. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  2795. arrLength = array.length,
  2796. othLength = other.length;
  2797. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  2798. return false;
  2799. }
  2800. // Assume cyclic values are equal.
  2801. var stacked = stack.get(array);
  2802. if (stacked && stack.get(other)) {
  2803. return stacked == other;
  2804. }
  2805. var index = -1,
  2806. result = true,
  2807. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  2808. stack.set(array, other);
  2809. stack.set(other, array);
  2810. // Ignore non-index properties.
  2811. while (++index < arrLength) {
  2812. var arrValue = array[index],
  2813. othValue = other[index];
  2814. if (customizer) {
  2815. var compared = isPartial
  2816. ? customizer(othValue, arrValue, index, other, array, stack)
  2817. : customizer(arrValue, othValue, index, array, other, stack);
  2818. }
  2819. if (compared !== undefined) {
  2820. if (compared) {
  2821. continue;
  2822. }
  2823. result = false;
  2824. break;
  2825. }
  2826. // Recursively compare arrays (susceptible to call stack limits).
  2827. if (seen) {
  2828. if (!arraySome(other, function(othValue, othIndex) {
  2829. if (!seen.has(othIndex) &&
  2830. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  2831. return seen.add(othIndex);
  2832. }
  2833. })) {
  2834. result = false;
  2835. break;
  2836. }
  2837. } else if (!(
  2838. arrValue === othValue ||
  2839. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  2840. )) {
  2841. result = false;
  2842. break;
  2843. }
  2844. }
  2845. stack['delete'](array);
  2846. stack['delete'](other);
  2847. return result;
  2848. }
  2849. /**
  2850. * A specialized version of `baseIsEqualDeep` for comparing objects of
  2851. * the same `toStringTag`.
  2852. *
  2853. * **Note:** This function only supports comparing values with tags of
  2854. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  2855. *
  2856. * @private
  2857. * @param {Object} object The object to compare.
  2858. * @param {Object} other The other object to compare.
  2859. * @param {string} tag The `toStringTag` of the objects to compare.
  2860. * @param {Function} equalFunc The function to determine equivalents of values.
  2861. * @param {Function} customizer The function to customize comparisons.
  2862. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  2863. * for more details.
  2864. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2865. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2866. */
  2867. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  2868. switch (tag) {
  2869. case dataViewTag:
  2870. if ((object.byteLength != other.byteLength) ||
  2871. (object.byteOffset != other.byteOffset)) {
  2872. return false;
  2873. }
  2874. object = object.buffer;
  2875. other = other.buffer;
  2876. case arrayBufferTag:
  2877. if ((object.byteLength != other.byteLength) ||
  2878. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  2879. return false;
  2880. }
  2881. return true;
  2882. case boolTag:
  2883. case dateTag:
  2884. case numberTag:
  2885. // Coerce booleans to `1` or `0` and dates to milliseconds.
  2886. // Invalid dates are coerced to `NaN`.
  2887. return eq(+object, +other);
  2888. case errorTag:
  2889. return object.name == other.name && object.message == other.message;
  2890. case regexpTag:
  2891. case stringTag:
  2892. // Coerce regexes to strings and treat strings, primitives and objects,
  2893. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  2894. // for more details.
  2895. return object == (other + '');
  2896. case mapTag:
  2897. var convert = mapToArray;
  2898. case setTag:
  2899. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  2900. convert || (convert = setToArray);
  2901. if (object.size != other.size && !isPartial) {
  2902. return false;
  2903. }
  2904. // Assume cyclic values are equal.
  2905. var stacked = stack.get(object);
  2906. if (stacked) {
  2907. return stacked == other;
  2908. }
  2909. bitmask |= UNORDERED_COMPARE_FLAG;
  2910. // Recursively compare objects (susceptible to call stack limits).
  2911. stack.set(object, other);
  2912. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  2913. stack['delete'](object);
  2914. return result;
  2915. case symbolTag:
  2916. if (symbolValueOf) {
  2917. return symbolValueOf.call(object) == symbolValueOf.call(other);
  2918. }
  2919. }
  2920. return false;
  2921. }
  2922. /**
  2923. * A specialized version of `baseIsEqualDeep` for objects with support for
  2924. * partial deep comparisons.
  2925. *
  2926. * @private
  2927. * @param {Object} object The object to compare.
  2928. * @param {Object} other The other object to compare.
  2929. * @param {Function} equalFunc The function to determine equivalents of values.
  2930. * @param {Function} customizer The function to customize comparisons.
  2931. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  2932. * for more details.
  2933. * @param {Object} stack Tracks traversed `object` and `other` objects.
  2934. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  2935. */
  2936. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  2937. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  2938. objProps = keys(object),
  2939. objLength = objProps.length,
  2940. othProps = keys(other),
  2941. othLength = othProps.length;
  2942. if (objLength != othLength && !isPartial) {
  2943. return false;
  2944. }
  2945. var index = objLength;
  2946. while (index--) {
  2947. var key = objProps[index];
  2948. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  2949. return false;
  2950. }
  2951. }
  2952. // Assume cyclic values are equal.
  2953. var stacked = stack.get(object);
  2954. if (stacked && stack.get(other)) {
  2955. return stacked == other;
  2956. }
  2957. var result = true;
  2958. stack.set(object, other);
  2959. stack.set(other, object);
  2960. var skipCtor = isPartial;
  2961. while (++index < objLength) {
  2962. key = objProps[index];
  2963. var objValue = object[key],
  2964. othValue = other[key];
  2965. if (customizer) {
  2966. var compared = isPartial
  2967. ? customizer(othValue, objValue, key, other, object, stack)
  2968. : customizer(objValue, othValue, key, object, other, stack);
  2969. }
  2970. // Recursively compare objects (susceptible to call stack limits).
  2971. if (!(compared === undefined
  2972. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  2973. : compared
  2974. )) {
  2975. result = false;
  2976. break;
  2977. }
  2978. skipCtor || (skipCtor = key == 'constructor');
  2979. }
  2980. if (result && !skipCtor) {
  2981. var objCtor = object.constructor,
  2982. othCtor = other.constructor;
  2983. // Non `Object` object instances with different constructors are not equal.
  2984. if (objCtor != othCtor &&
  2985. ('constructor' in object && 'constructor' in other) &&
  2986. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  2987. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  2988. result = false;
  2989. }
  2990. }
  2991. stack['delete'](object);
  2992. stack['delete'](other);
  2993. return result;
  2994. }
  2995. /**
  2996. * Gets the data for `map`.
  2997. *
  2998. * @private
  2999. * @param {Object} map The map to query.
  3000. * @param {string} key The reference key.
  3001. * @returns {*} Returns the map data.
  3002. */
  3003. function getMapData(map, key) {
  3004. var data = map.__data__;
  3005. return isKeyable(key)
  3006. ? data[typeof key == 'string' ? 'string' : 'hash']
  3007. : data.map;
  3008. }
  3009. /**
  3010. * Gets the property names, values, and compare flags of `object`.
  3011. *
  3012. * @private
  3013. * @param {Object} object The object to query.
  3014. * @returns {Array} Returns the match data of `object`.
  3015. */
  3016. function getMatchData(object) {
  3017. var result = keys(object),
  3018. length = result.length;
  3019. while (length--) {
  3020. var key = result[length],
  3021. value = object[key];
  3022. result[length] = [key, value, isStrictComparable(value)];
  3023. }
  3024. return result;
  3025. }
  3026. /**
  3027. * Gets the native function at `key` of `object`.
  3028. *
  3029. * @private
  3030. * @param {Object} object The object to query.
  3031. * @param {string} key The key of the method to get.
  3032. * @returns {*} Returns the function if it's native, else `undefined`.
  3033. */
  3034. function getNative(object, key) {
  3035. var value = getValue(object, key);
  3036. return baseIsNative(value) ? value : undefined;
  3037. }
  3038. /**
  3039. * Gets the `toStringTag` of `value`.
  3040. *
  3041. * @private
  3042. * @param {*} value The value to query.
  3043. * @returns {string} Returns the `toStringTag`.
  3044. */
  3045. var getTag = baseGetTag;
  3046. // Fallback for data views, maps, sets, and weak maps in IE 11,
  3047. // for data views in Edge < 14, and promises in Node.js.
  3048. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  3049. (Map && getTag(new Map) != mapTag) ||
  3050. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  3051. (Set && getTag(new Set) != setTag) ||
  3052. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  3053. getTag = function(value) {
  3054. var result = objectToString.call(value),
  3055. Ctor = result == objectTag ? value.constructor : undefined,
  3056. ctorString = Ctor ? toSource(Ctor) : undefined;
  3057. if (ctorString) {
  3058. switch (ctorString) {
  3059. case dataViewCtorString: return dataViewTag;
  3060. case mapCtorString: return mapTag;
  3061. case promiseCtorString: return promiseTag;
  3062. case setCtorString: return setTag;
  3063. case weakMapCtorString: return weakMapTag;
  3064. }
  3065. }
  3066. return result;
  3067. };
  3068. }
  3069. /**
  3070. * Checks if `path` exists on `object`.
  3071. *
  3072. * @private
  3073. * @param {Object} object The object to query.
  3074. * @param {Array|string} path The path to check.
  3075. * @param {Function} hasFunc The function to check properties.
  3076. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  3077. */
  3078. function hasPath(object, path, hasFunc) {
  3079. path = isKey(path, object) ? [path] : castPath(path);
  3080. var result,
  3081. index = -1,
  3082. length = path.length;
  3083. while (++index < length) {
  3084. var key = toKey(path[index]);
  3085. if (!(result = object != null && hasFunc(object, key))) {
  3086. break;
  3087. }
  3088. object = object[key];
  3089. }
  3090. if (result) {
  3091. return result;
  3092. }
  3093. var length = object ? object.length : 0;
  3094. return !!length && isLength(length) && isIndex(key, length) &&
  3095. (isArray(object) || isArguments(object));
  3096. }
  3097. /**
  3098. * Checks if `value` is a valid array-like index.
  3099. *
  3100. * @private
  3101. * @param {*} value The value to check.
  3102. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3103. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3104. */
  3105. function isIndex(value, length) {
  3106. length = length == null ? MAX_SAFE_INTEGER : length;
  3107. return !!length &&
  3108. (typeof value == 'number' || reIsUint.test(value)) &&
  3109. (value > -1 && value % 1 == 0 && value < length);
  3110. }
  3111. /**
  3112. * Checks if `value` is a property name and not a property path.
  3113. *
  3114. * @private
  3115. * @param {*} value The value to check.
  3116. * @param {Object} [object] The object to query keys on.
  3117. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  3118. */
  3119. function isKey(value, object) {
  3120. if (isArray(value)) {
  3121. return false;
  3122. }
  3123. var type = typeof value;
  3124. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  3125. value == null || isSymbol(value)) {
  3126. return true;
  3127. }
  3128. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  3129. (object != null && value in Object(object));
  3130. }
  3131. /**
  3132. * Checks if `value` is suitable for use as unique object key.
  3133. *
  3134. * @private
  3135. * @param {*} value The value to check.
  3136. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  3137. */
  3138. function isKeyable(value) {
  3139. var type = typeof value;
  3140. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  3141. ? (value !== '__proto__')
  3142. : (value === null);
  3143. }
  3144. /**
  3145. * Checks if `func` has its source masked.
  3146. *
  3147. * @private
  3148. * @param {Function} func The function to check.
  3149. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3150. */
  3151. function isMasked(func) {
  3152. return !!maskSrcKey && (maskSrcKey in func);
  3153. }
  3154. /**
  3155. * Checks if `value` is likely a prototype object.
  3156. *
  3157. * @private
  3158. * @param {*} value The value to check.
  3159. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  3160. */
  3161. function isPrototype(value) {
  3162. var Ctor = value && value.constructor,
  3163. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  3164. return value === proto;
  3165. }
  3166. /**
  3167. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  3168. *
  3169. * @private
  3170. * @param {*} value The value to check.
  3171. * @returns {boolean} Returns `true` if `value` if suitable for strict
  3172. * equality comparisons, else `false`.
  3173. */
  3174. function isStrictComparable(value) {
  3175. return value === value && !isObject(value);
  3176. }
  3177. /**
  3178. * A specialized version of `matchesProperty` for source values suitable
  3179. * for strict equality comparisons, i.e. `===`.
  3180. *
  3181. * @private
  3182. * @param {string} key The key of the property to get.
  3183. * @param {*} srcValue The value to match.
  3184. * @returns {Function} Returns the new spec function.
  3185. */
  3186. function matchesStrictComparable(key, srcValue) {
  3187. return function(object) {
  3188. if (object == null) {
  3189. return false;
  3190. }
  3191. return object[key] === srcValue &&
  3192. (srcValue !== undefined || (key in Object(object)));
  3193. };
  3194. }
  3195. /**
  3196. * Gets the parent value at `path` of `object`.
  3197. *
  3198. * @private
  3199. * @param {Object} object The object to query.
  3200. * @param {Array} path The path to get the parent value of.
  3201. * @returns {*} Returns the parent value.
  3202. */
  3203. function parent(object, path) {
  3204. return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
  3205. }
  3206. /**
  3207. * Converts `string` to a property path array.
  3208. *
  3209. * @private
  3210. * @param {string} string The string to convert.
  3211. * @returns {Array} Returns the property path array.
  3212. */
  3213. var stringToPath = memoize(function(string) {
  3214. string = toString(string);
  3215. var result = [];
  3216. if (reLeadingDot.test(string)) {
  3217. result.push('');
  3218. }
  3219. string.replace(rePropName, function(match, number, quote, string) {
  3220. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  3221. });
  3222. return result;
  3223. });
  3224. /**
  3225. * Converts `value` to a string key if it's not a string or symbol.
  3226. *
  3227. * @private
  3228. * @param {*} value The value to inspect.
  3229. * @returns {string|symbol} Returns the key.
  3230. */
  3231. function toKey(value) {
  3232. if (typeof value == 'string' || isSymbol(value)) {
  3233. return value;
  3234. }
  3235. var result = (value + '');
  3236. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  3237. }
  3238. /**
  3239. * Converts `func` to its source code.
  3240. *
  3241. * @private
  3242. * @param {Function} func The function to process.
  3243. * @returns {string} Returns the source code.
  3244. */
  3245. function toSource(func) {
  3246. if (func != null) {
  3247. try {
  3248. return funcToString.call(func);
  3249. } catch (e) {}
  3250. try {
  3251. return (func + '');
  3252. } catch (e) {}
  3253. }
  3254. return '';
  3255. }
  3256. /**
  3257. * Gets the last element of `array`.
  3258. *
  3259. * @static
  3260. * @memberOf _
  3261. * @since 0.1.0
  3262. * @category Array
  3263. * @param {Array} array The array to query.
  3264. * @returns {*} Returns the last element of `array`.
  3265. * @example
  3266. *
  3267. * _.last([1, 2, 3]);
  3268. * // => 3
  3269. */
  3270. function last(array) {
  3271. var length = array ? array.length : 0;
  3272. return length ? array[length - 1] : undefined;
  3273. }
  3274. /**
  3275. * Removes all elements from `array` that `predicate` returns truthy for
  3276. * and returns an array of the removed elements. The predicate is invoked
  3277. * with three arguments: (value, index, array).
  3278. *
  3279. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  3280. * to pull elements from an array by value.
  3281. *
  3282. * @static
  3283. * @memberOf _
  3284. * @since 2.0.0
  3285. * @category Array
  3286. * @param {Array} array The array to modify.
  3287. * @param {Function} [predicate=_.identity]
  3288. * The function invoked per iteration.
  3289. * @returns {Array} Returns the new array of removed elements.
  3290. * @example
  3291. *
  3292. * var array = [1, 2, 3, 4];
  3293. * var evens = _.remove(array, function(n) {
  3294. * return n % 2 == 0;
  3295. * });
  3296. *
  3297. * console.log(array);
  3298. * // => [1, 3]
  3299. *
  3300. * console.log(evens);
  3301. * // => [2, 4]
  3302. */
  3303. function remove(array, predicate) {
  3304. var result = [];
  3305. if (!(array && array.length)) {
  3306. return result;
  3307. }
  3308. var index = -1,
  3309. indexes = [],
  3310. length = array.length;
  3311. predicate = baseIteratee(predicate, 3);
  3312. while (++index < length) {
  3313. var value = array[index];
  3314. if (predicate(value, index, array)) {
  3315. result.push(value);
  3316. indexes.push(index);
  3317. }
  3318. }
  3319. basePullAt(array, indexes);
  3320. return result;
  3321. }
  3322. /**
  3323. * Creates a function that memoizes the result of `func`. If `resolver` is
  3324. * provided, it determines the cache key for storing the result based on the
  3325. * arguments provided to the memoized function. By default, the first argument
  3326. * provided to the memoized function is used as the map cache key. The `func`
  3327. * is invoked with the `this` binding of the memoized function.
  3328. *
  3329. * **Note:** The cache is exposed as the `cache` property on the memoized
  3330. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  3331. * constructor with one whose instances implement the
  3332. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  3333. * method interface of `delete`, `get`, `has`, and `set`.
  3334. *
  3335. * @static
  3336. * @memberOf _
  3337. * @since 0.1.0
  3338. * @category Function
  3339. * @param {Function} func The function to have its output memoized.
  3340. * @param {Function} [resolver] The function to resolve the cache key.
  3341. * @returns {Function} Returns the new memoized function.
  3342. * @example
  3343. *
  3344. * var object = { 'a': 1, 'b': 2 };
  3345. * var other = { 'c': 3, 'd': 4 };
  3346. *
  3347. * var values = _.memoize(_.values);
  3348. * values(object);
  3349. * // => [1, 2]
  3350. *
  3351. * values(other);
  3352. * // => [3, 4]
  3353. *
  3354. * object.a = 2;
  3355. * values(object);
  3356. * // => [1, 2]
  3357. *
  3358. * // Modify the result cache.
  3359. * values.cache.set(object, ['a', 'b']);
  3360. * values(object);
  3361. * // => ['a', 'b']
  3362. *
  3363. * // Replace `_.memoize.Cache`.
  3364. * _.memoize.Cache = WeakMap;
  3365. */
  3366. function memoize(func, resolver) {
  3367. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  3368. throw new TypeError(FUNC_ERROR_TEXT);
  3369. }
  3370. var memoized = function() {
  3371. var args = arguments,
  3372. key = resolver ? resolver.apply(this, args) : args[0],
  3373. cache = memoized.cache;
  3374. if (cache.has(key)) {
  3375. return cache.get(key);
  3376. }
  3377. var result = func.apply(this, args);
  3378. memoized.cache = cache.set(key, result);
  3379. return result;
  3380. };
  3381. memoized.cache = new (memoize.Cache || MapCache);
  3382. return memoized;
  3383. }
  3384. // Assign cache to `_.memoize`.
  3385. memoize.Cache = MapCache;
  3386. /**
  3387. * Performs a
  3388. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3389. * comparison between two values to determine if they are equivalent.
  3390. *
  3391. * @static
  3392. * @memberOf _
  3393. * @since 4.0.0
  3394. * @category Lang
  3395. * @param {*} value The value to compare.
  3396. * @param {*} other The other value to compare.
  3397. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3398. * @example
  3399. *
  3400. * var object = { 'a': 1 };
  3401. * var other = { 'a': 1 };
  3402. *
  3403. * _.eq(object, object);
  3404. * // => true
  3405. *
  3406. * _.eq(object, other);
  3407. * // => false
  3408. *
  3409. * _.eq('a', 'a');
  3410. * // => true
  3411. *
  3412. * _.eq('a', Object('a'));
  3413. * // => false
  3414. *
  3415. * _.eq(NaN, NaN);
  3416. * // => true
  3417. */
  3418. function eq(value, other) {
  3419. return value === other || (value !== value && other !== other);
  3420. }
  3421. /**
  3422. * Checks if `value` is likely an `arguments` object.
  3423. *
  3424. * @static
  3425. * @memberOf _
  3426. * @since 0.1.0
  3427. * @category Lang
  3428. * @param {*} value The value to check.
  3429. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3430. * else `false`.
  3431. * @example
  3432. *
  3433. * _.isArguments(function() { return arguments; }());
  3434. * // => true
  3435. *
  3436. * _.isArguments([1, 2, 3]);
  3437. * // => false
  3438. */
  3439. function isArguments(value) {
  3440. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3441. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3442. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3443. }
  3444. /**
  3445. * Checks if `value` is classified as an `Array` object.
  3446. *
  3447. * @static
  3448. * @memberOf _
  3449. * @since 0.1.0
  3450. * @category Lang
  3451. * @param {*} value The value to check.
  3452. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3453. * @example
  3454. *
  3455. * _.isArray([1, 2, 3]);
  3456. * // => true
  3457. *
  3458. * _.isArray(document.body.children);
  3459. * // => false
  3460. *
  3461. * _.isArray('abc');
  3462. * // => false
  3463. *
  3464. * _.isArray(_.noop);
  3465. * // => false
  3466. */
  3467. var isArray = Array.isArray;
  3468. /**
  3469. * Checks if `value` is array-like. A value is considered array-like if it's
  3470. * not a function and has a `value.length` that's an integer greater than or
  3471. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3472. *
  3473. * @static
  3474. * @memberOf _
  3475. * @since 4.0.0
  3476. * @category Lang
  3477. * @param {*} value The value to check.
  3478. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3479. * @example
  3480. *
  3481. * _.isArrayLike([1, 2, 3]);
  3482. * // => true
  3483. *
  3484. * _.isArrayLike(document.body.children);
  3485. * // => true
  3486. *
  3487. * _.isArrayLike('abc');
  3488. * // => true
  3489. *
  3490. * _.isArrayLike(_.noop);
  3491. * // => false
  3492. */
  3493. function isArrayLike(value) {
  3494. return value != null && isLength(value.length) && !isFunction(value);
  3495. }
  3496. /**
  3497. * This method is like `_.isArrayLike` except that it also checks if `value`
  3498. * is an object.
  3499. *
  3500. * @static
  3501. * @memberOf _
  3502. * @since 4.0.0
  3503. * @category Lang
  3504. * @param {*} value The value to check.
  3505. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3506. * else `false`.
  3507. * @example
  3508. *
  3509. * _.isArrayLikeObject([1, 2, 3]);
  3510. * // => true
  3511. *
  3512. * _.isArrayLikeObject(document.body.children);
  3513. * // => true
  3514. *
  3515. * _.isArrayLikeObject('abc');
  3516. * // => false
  3517. *
  3518. * _.isArrayLikeObject(_.noop);
  3519. * // => false
  3520. */
  3521. function isArrayLikeObject(value) {
  3522. return isObjectLike(value) && isArrayLike(value);
  3523. }
  3524. /**
  3525. * Checks if `value` is classified as a `Function` object.
  3526. *
  3527. * @static
  3528. * @memberOf _
  3529. * @since 0.1.0
  3530. * @category Lang
  3531. * @param {*} value The value to check.
  3532. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3533. * @example
  3534. *
  3535. * _.isFunction(_);
  3536. * // => true
  3537. *
  3538. * _.isFunction(/abc/);
  3539. * // => false
  3540. */
  3541. function isFunction(value) {
  3542. // The use of `Object#toString` avoids issues with the `typeof` operator
  3543. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3544. var tag = isObject(value) ? objectToString.call(value) : '';
  3545. return tag == funcTag || tag == genTag;
  3546. }
  3547. /**
  3548. * Checks if `value` is a valid array-like length.
  3549. *
  3550. * **Note:** This method is loosely based on
  3551. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  3552. *
  3553. * @static
  3554. * @memberOf _
  3555. * @since 4.0.0
  3556. * @category Lang
  3557. * @param {*} value The value to check.
  3558. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  3559. * @example
  3560. *
  3561. * _.isLength(3);
  3562. * // => true
  3563. *
  3564. * _.isLength(Number.MIN_VALUE);
  3565. * // => false
  3566. *
  3567. * _.isLength(Infinity);
  3568. * // => false
  3569. *
  3570. * _.isLength('3');
  3571. * // => false
  3572. */
  3573. function isLength(value) {
  3574. return typeof value == 'number' &&
  3575. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  3576. }
  3577. /**
  3578. * Checks if `value` is the
  3579. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3580. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3581. *
  3582. * @static
  3583. * @memberOf _
  3584. * @since 0.1.0
  3585. * @category Lang
  3586. * @param {*} value The value to check.
  3587. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3588. * @example
  3589. *
  3590. * _.isObject({});
  3591. * // => true
  3592. *
  3593. * _.isObject([1, 2, 3]);
  3594. * // => true
  3595. *
  3596. * _.isObject(_.noop);
  3597. * // => true
  3598. *
  3599. * _.isObject(null);
  3600. * // => false
  3601. */
  3602. function isObject(value) {
  3603. var type = typeof value;
  3604. return !!value && (type == 'object' || type == 'function');
  3605. }
  3606. /**
  3607. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3608. * and has a `typeof` result of "object".
  3609. *
  3610. * @static
  3611. * @memberOf _
  3612. * @since 4.0.0
  3613. * @category Lang
  3614. * @param {*} value The value to check.
  3615. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3616. * @example
  3617. *
  3618. * _.isObjectLike({});
  3619. * // => true
  3620. *
  3621. * _.isObjectLike([1, 2, 3]);
  3622. * // => true
  3623. *
  3624. * _.isObjectLike(_.noop);
  3625. * // => false
  3626. *
  3627. * _.isObjectLike(null);
  3628. * // => false
  3629. */
  3630. function isObjectLike(value) {
  3631. return !!value && typeof value == 'object';
  3632. }
  3633. /**
  3634. * Checks if `value` is classified as a `Symbol` primitive or object.
  3635. *
  3636. * @static
  3637. * @memberOf _
  3638. * @since 4.0.0
  3639. * @category Lang
  3640. * @param {*} value The value to check.
  3641. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  3642. * @example
  3643. *
  3644. * _.isSymbol(Symbol.iterator);
  3645. * // => true
  3646. *
  3647. * _.isSymbol('abc');
  3648. * // => false
  3649. */
  3650. function isSymbol(value) {
  3651. return typeof value == 'symbol' ||
  3652. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  3653. }
  3654. /**
  3655. * Checks if `value` is classified as a typed array.
  3656. *
  3657. * @static
  3658. * @memberOf _
  3659. * @since 3.0.0
  3660. * @category Lang
  3661. * @param {*} value The value to check.
  3662. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  3663. * @example
  3664. *
  3665. * _.isTypedArray(new Uint8Array);
  3666. * // => true
  3667. *
  3668. * _.isTypedArray([]);
  3669. * // => false
  3670. */
  3671. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  3672. /**
  3673. * Converts `value` to a string. An empty string is returned for `null`
  3674. * and `undefined` values. The sign of `-0` is preserved.
  3675. *
  3676. * @static
  3677. * @memberOf _
  3678. * @since 4.0.0
  3679. * @category Lang
  3680. * @param {*} value The value to process.
  3681. * @returns {string} Returns the string.
  3682. * @example
  3683. *
  3684. * _.toString(null);
  3685. * // => ''
  3686. *
  3687. * _.toString(-0);
  3688. * // => '-0'
  3689. *
  3690. * _.toString([1, 2, 3]);
  3691. * // => '1,2,3'
  3692. */
  3693. function toString(value) {
  3694. return value == null ? '' : baseToString(value);
  3695. }
  3696. /**
  3697. * Gets the value at `path` of `object`. If the resolved value is
  3698. * `undefined`, the `defaultValue` is returned in its place.
  3699. *
  3700. * @static
  3701. * @memberOf _
  3702. * @since 3.7.0
  3703. * @category Object
  3704. * @param {Object} object The object to query.
  3705. * @param {Array|string} path The path of the property to get.
  3706. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  3707. * @returns {*} Returns the resolved value.
  3708. * @example
  3709. *
  3710. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  3711. *
  3712. * _.get(object, 'a[0].b.c');
  3713. * // => 3
  3714. *
  3715. * _.get(object, ['a', '0', 'b', 'c']);
  3716. * // => 3
  3717. *
  3718. * _.get(object, 'a.b.c', 'default');
  3719. * // => 'default'
  3720. */
  3721. function get(object, path, defaultValue) {
  3722. var result = object == null ? undefined : baseGet(object, path);
  3723. return result === undefined ? defaultValue : result;
  3724. }
  3725. /**
  3726. * Checks if `path` is a direct or inherited property of `object`.
  3727. *
  3728. * @static
  3729. * @memberOf _
  3730. * @since 4.0.0
  3731. * @category Object
  3732. * @param {Object} object The object to query.
  3733. * @param {Array|string} path The path to check.
  3734. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  3735. * @example
  3736. *
  3737. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  3738. *
  3739. * _.hasIn(object, 'a');
  3740. * // => true
  3741. *
  3742. * _.hasIn(object, 'a.b');
  3743. * // => true
  3744. *
  3745. * _.hasIn(object, ['a', 'b']);
  3746. * // => true
  3747. *
  3748. * _.hasIn(object, 'b');
  3749. * // => false
  3750. */
  3751. function hasIn(object, path) {
  3752. return object != null && hasPath(object, path, baseHasIn);
  3753. }
  3754. /**
  3755. * Creates an array of the own enumerable property names of `object`.
  3756. *
  3757. * **Note:** Non-object values are coerced to objects. See the
  3758. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3759. * for more details.
  3760. *
  3761. * @static
  3762. * @since 0.1.0
  3763. * @memberOf _
  3764. * @category Object
  3765. * @param {Object} object The object to query.
  3766. * @returns {Array} Returns the array of property names.
  3767. * @example
  3768. *
  3769. * function Foo() {
  3770. * this.a = 1;
  3771. * this.b = 2;
  3772. * }
  3773. *
  3774. * Foo.prototype.c = 3;
  3775. *
  3776. * _.keys(new Foo);
  3777. * // => ['a', 'b'] (iteration order is not guaranteed)
  3778. *
  3779. * _.keys('hi');
  3780. * // => ['0', '1']
  3781. */
  3782. function keys(object) {
  3783. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  3784. }
  3785. /**
  3786. * This method returns the first argument it receives.
  3787. *
  3788. * @static
  3789. * @since 0.1.0
  3790. * @memberOf _
  3791. * @category Util
  3792. * @param {*} value Any value.
  3793. * @returns {*} Returns `value`.
  3794. * @example
  3795. *
  3796. * var object = { 'a': 1 };
  3797. *
  3798. * console.log(_.identity(object) === object);
  3799. * // => true
  3800. */
  3801. function identity(value) {
  3802. return value;
  3803. }
  3804. /**
  3805. * Creates a function that returns the value at `path` of a given object.
  3806. *
  3807. * @static
  3808. * @memberOf _
  3809. * @since 2.4.0
  3810. * @category Util
  3811. * @param {Array|string} path The path of the property to get.
  3812. * @returns {Function} Returns the new accessor function.
  3813. * @example
  3814. *
  3815. * var objects = [
  3816. * { 'a': { 'b': 2 } },
  3817. * { 'a': { 'b': 1 } }
  3818. * ];
  3819. *
  3820. * _.map(objects, _.property('a.b'));
  3821. * // => [2, 1]
  3822. *
  3823. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  3824. * // => [1, 2]
  3825. */
  3826. function property(path) {
  3827. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3828. }
  3829. module.exports = remove;
  3830. /***/ }),
  3831. /***/ "./node_modules/process/browser.js":
  3832. /*!*****************************************!*\
  3833. !*** ./node_modules/process/browser.js ***!
  3834. \*****************************************/
  3835. /***/ ((module) => {
  3836. // shim for using process in browser
  3837. var process = module.exports = {};
  3838. // cached from whatever global is present so that test runners that stub it
  3839. // don't break things. But we need to wrap it in a try catch in case it is
  3840. // wrapped in strict mode code which doesn't define any globals. It's inside a
  3841. // function because try/catches deoptimize in certain engines.
  3842. var cachedSetTimeout;
  3843. var cachedClearTimeout;
  3844. function defaultSetTimout() {
  3845. throw new Error('setTimeout has not been defined');
  3846. }
  3847. function defaultClearTimeout () {
  3848. throw new Error('clearTimeout has not been defined');
  3849. }
  3850. (function () {
  3851. try {
  3852. if (typeof setTimeout === 'function') {
  3853. cachedSetTimeout = setTimeout;
  3854. } else {
  3855. cachedSetTimeout = defaultSetTimout;
  3856. }
  3857. } catch (e) {
  3858. cachedSetTimeout = defaultSetTimout;
  3859. }
  3860. try {
  3861. if (typeof clearTimeout === 'function') {
  3862. cachedClearTimeout = clearTimeout;
  3863. } else {
  3864. cachedClearTimeout = defaultClearTimeout;
  3865. }
  3866. } catch (e) {
  3867. cachedClearTimeout = defaultClearTimeout;
  3868. }
  3869. } ())
  3870. function runTimeout(fun) {
  3871. if (cachedSetTimeout === setTimeout) {
  3872. //normal enviroments in sane situations
  3873. return setTimeout(fun, 0);
  3874. }
  3875. // if setTimeout wasn't available but was latter defined
  3876. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  3877. cachedSetTimeout = setTimeout;
  3878. return setTimeout(fun, 0);
  3879. }
  3880. try {
  3881. // when when somebody has screwed with setTimeout but no I.E. maddness
  3882. return cachedSetTimeout(fun, 0);
  3883. } catch(e){
  3884. try {
  3885. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3886. return cachedSetTimeout.call(null, fun, 0);
  3887. } catch(e){
  3888. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  3889. return cachedSetTimeout.call(this, fun, 0);
  3890. }
  3891. }
  3892. }
  3893. function runClearTimeout(marker) {
  3894. if (cachedClearTimeout === clearTimeout) {
  3895. //normal enviroments in sane situations
  3896. return clearTimeout(marker);
  3897. }
  3898. // if clearTimeout wasn't available but was latter defined
  3899. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  3900. cachedClearTimeout = clearTimeout;
  3901. return clearTimeout(marker);
  3902. }
  3903. try {
  3904. // when when somebody has screwed with setTimeout but no I.E. maddness
  3905. return cachedClearTimeout(marker);
  3906. } catch (e){
  3907. try {
  3908. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3909. return cachedClearTimeout.call(null, marker);
  3910. } catch (e){
  3911. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  3912. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  3913. return cachedClearTimeout.call(this, marker);
  3914. }
  3915. }
  3916. }
  3917. var queue = [];
  3918. var draining = false;
  3919. var currentQueue;
  3920. var queueIndex = -1;
  3921. function cleanUpNextTick() {
  3922. if (!draining || !currentQueue) {
  3923. return;
  3924. }
  3925. draining = false;
  3926. if (currentQueue.length) {
  3927. queue = currentQueue.concat(queue);
  3928. } else {
  3929. queueIndex = -1;
  3930. }
  3931. if (queue.length) {
  3932. drainQueue();
  3933. }
  3934. }
  3935. function drainQueue() {
  3936. if (draining) {
  3937. return;
  3938. }
  3939. var timeout = runTimeout(cleanUpNextTick);
  3940. draining = true;
  3941. var len = queue.length;
  3942. while(len) {
  3943. currentQueue = queue;
  3944. queue = [];
  3945. while (++queueIndex < len) {
  3946. if (currentQueue) {
  3947. currentQueue[queueIndex].run();
  3948. }
  3949. }
  3950. queueIndex = -1;
  3951. len = queue.length;
  3952. }
  3953. currentQueue = null;
  3954. draining = false;
  3955. runClearTimeout(timeout);
  3956. }
  3957. process.nextTick = function (fun) {
  3958. var args = new Array(arguments.length - 1);
  3959. if (arguments.length > 1) {
  3960. for (var i = 1; i < arguments.length; i++) {
  3961. args[i - 1] = arguments[i];
  3962. }
  3963. }
  3964. queue.push(new Item(fun, args));
  3965. if (queue.length === 1 && !draining) {
  3966. runTimeout(drainQueue);
  3967. }
  3968. };
  3969. // v8 likes predictible objects
  3970. function Item(fun, array) {
  3971. this.fun = fun;
  3972. this.array = array;
  3973. }
  3974. Item.prototype.run = function () {
  3975. this.fun.apply(null, this.array);
  3976. };
  3977. process.title = 'browser';
  3978. process.browser = true;
  3979. process.env = {};
  3980. process.argv = [];
  3981. process.version = ''; // empty string to avoid regexp issues
  3982. process.versions = {};
  3983. function noop() {}
  3984. process.on = noop;
  3985. process.addListener = noop;
  3986. process.once = noop;
  3987. process.off = noop;
  3988. process.removeListener = noop;
  3989. process.removeAllListeners = noop;
  3990. process.emit = noop;
  3991. process.prependListener = noop;
  3992. process.prependOnceListener = noop;
  3993. process.listeners = function (name) { return [] }
  3994. process.binding = function (name) {
  3995. throw new Error('process.binding is not supported');
  3996. };
  3997. process.cwd = function () { return '/' };
  3998. process.chdir = function (dir) {
  3999. throw new Error('process.chdir is not supported');
  4000. };
  4001. process.umask = function() { return 0; };
  4002. /***/ }),
  4003. /***/ "./node_modules/riot/riot.esm.js":
  4004. /*!***************************************!*\
  4005. !*** ./node_modules/riot/riot.esm.js ***!
  4006. \***************************************/
  4007. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  4008. "use strict";
  4009. __webpack_require__.r(__webpack_exports__);
  4010. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4011. /* harmony export */ "__": () => (/* binding */ __),
  4012. /* harmony export */ "component": () => (/* binding */ component),
  4013. /* harmony export */ "install": () => (/* binding */ install),
  4014. /* harmony export */ "mount": () => (/* binding */ mount),
  4015. /* harmony export */ "pure": () => (/* binding */ pure),
  4016. /* harmony export */ "register": () => (/* binding */ register),
  4017. /* harmony export */ "uninstall": () => (/* binding */ uninstall),
  4018. /* harmony export */ "unmount": () => (/* binding */ unmount),
  4019. /* harmony export */ "unregister": () => (/* binding */ unregister),
  4020. /* harmony export */ "version": () => (/* binding */ version),
  4021. /* harmony export */ "withTypes": () => (/* binding */ withTypes)
  4022. /* harmony export */ });
  4023. /* Riot v6.0.1, @license MIT */
  4024. /**
  4025. * Convert a string from camel case to dash-case
  4026. * @param {string} string - probably a component tag name
  4027. * @returns {string} component name normalized
  4028. */
  4029. function camelToDashCase(string) {
  4030. return string.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  4031. }
  4032. /**
  4033. * Convert a string containing dashes to camel case
  4034. * @param {string} string - input string
  4035. * @returns {string} my-string -> myString
  4036. */
  4037. function dashToCamelCase(string) {
  4038. return string.replace(/-(\w)/g, (_, c) => c.toUpperCase());
  4039. }
  4040. /**
  4041. * Get all the element attributes as object
  4042. * @param {HTMLElement} element - DOM node we want to parse
  4043. * @returns {Object} all the attributes found as a key value pairs
  4044. */
  4045. function DOMattributesToObject(element) {
  4046. return Array.from(element.attributes).reduce((acc, attribute) => {
  4047. acc[dashToCamelCase(attribute.name)] = attribute.value;
  4048. return acc;
  4049. }, {});
  4050. }
  4051. /**
  4052. * Move all the child nodes from a source tag to another
  4053. * @param {HTMLElement} source - source node
  4054. * @param {HTMLElement} target - target node
  4055. * @returns {undefined} it's a void method ¯\_()_/¯
  4056. */
  4057. // Ignore this helper because it's needed only for svg tags
  4058. function moveChildren(source, target) {
  4059. if (source.firstChild) {
  4060. target.appendChild(source.firstChild);
  4061. moveChildren(source, target);
  4062. }
  4063. }
  4064. /**
  4065. * Remove the child nodes from any DOM node
  4066. * @param {HTMLElement} node - target node
  4067. * @returns {undefined}
  4068. */
  4069. function cleanNode(node) {
  4070. clearChildren(node.childNodes);
  4071. }
  4072. /**
  4073. * Clear multiple children in a node
  4074. * @param {HTMLElement[]} children - direct children nodes
  4075. * @returns {undefined}
  4076. */
  4077. function clearChildren(children) {
  4078. Array.from(children).forEach(removeChild);
  4079. }
  4080. /**
  4081. * Remove a node
  4082. * @param {HTMLElement}node - node to remove
  4083. * @returns {undefined}
  4084. */
  4085. const removeChild = node => node && node.parentNode && node.parentNode.removeChild(node);
  4086. /**
  4087. * Insert before a node
  4088. * @param {HTMLElement} newNode - node to insert
  4089. * @param {HTMLElement} refNode - ref child
  4090. * @returns {undefined}
  4091. */
  4092. const insertBefore = (newNode, refNode) => refNode && refNode.parentNode && refNode.parentNode.insertBefore(newNode, refNode);
  4093. /**
  4094. * Replace a node
  4095. * @param {HTMLElement} newNode - new node to add to the DOM
  4096. * @param {HTMLElement} replaced - node to replace
  4097. * @returns {undefined}
  4098. */
  4099. const replaceChild = (newNode, replaced) => replaced && replaced.parentNode && replaced.parentNode.replaceChild(newNode, replaced);
  4100. // Riot.js constants that can be used accross more modules
  4101. const COMPONENTS_IMPLEMENTATION_MAP$1 = new Map(),
  4102. DOM_COMPONENT_INSTANCE_PROPERTY$1 = Symbol('riot-component'),
  4103. PLUGINS_SET$1 = new Set(),
  4104. IS_DIRECTIVE = 'is',
  4105. VALUE_ATTRIBUTE = 'value',
  4106. MOUNT_METHOD_KEY = 'mount',
  4107. UPDATE_METHOD_KEY = 'update',
  4108. UNMOUNT_METHOD_KEY = 'unmount',
  4109. SHOULD_UPDATE_KEY = 'shouldUpdate',
  4110. ON_BEFORE_MOUNT_KEY = 'onBeforeMount',
  4111. ON_MOUNTED_KEY = 'onMounted',
  4112. ON_BEFORE_UPDATE_KEY = 'onBeforeUpdate',
  4113. ON_UPDATED_KEY = 'onUpdated',
  4114. ON_BEFORE_UNMOUNT_KEY = 'onBeforeUnmount',
  4115. ON_UNMOUNTED_KEY = 'onUnmounted',
  4116. PROPS_KEY = 'props',
  4117. STATE_KEY = 'state',
  4118. SLOTS_KEY = 'slots',
  4119. ROOT_KEY = 'root',
  4120. IS_PURE_SYMBOL = Symbol('pure'),
  4121. IS_COMPONENT_UPDATING = Symbol('is_updating'),
  4122. PARENT_KEY_SYMBOL = Symbol('parent'),
  4123. ATTRIBUTES_KEY_SYMBOL = Symbol('attributes'),
  4124. TEMPLATE_KEY_SYMBOL = Symbol('template');
  4125. var globals = /*#__PURE__*/Object.freeze({
  4126. __proto__: null,
  4127. COMPONENTS_IMPLEMENTATION_MAP: COMPONENTS_IMPLEMENTATION_MAP$1,
  4128. DOM_COMPONENT_INSTANCE_PROPERTY: DOM_COMPONENT_INSTANCE_PROPERTY$1,
  4129. PLUGINS_SET: PLUGINS_SET$1,
  4130. IS_DIRECTIVE: IS_DIRECTIVE,
  4131. VALUE_ATTRIBUTE: VALUE_ATTRIBUTE,
  4132. MOUNT_METHOD_KEY: MOUNT_METHOD_KEY,
  4133. UPDATE_METHOD_KEY: UPDATE_METHOD_KEY,
  4134. UNMOUNT_METHOD_KEY: UNMOUNT_METHOD_KEY,
  4135. SHOULD_UPDATE_KEY: SHOULD_UPDATE_KEY,
  4136. ON_BEFORE_MOUNT_KEY: ON_BEFORE_MOUNT_KEY,
  4137. ON_MOUNTED_KEY: ON_MOUNTED_KEY,
  4138. ON_BEFORE_UPDATE_KEY: ON_BEFORE_UPDATE_KEY,
  4139. ON_UPDATED_KEY: ON_UPDATED_KEY,
  4140. ON_BEFORE_UNMOUNT_KEY: ON_BEFORE_UNMOUNT_KEY,
  4141. ON_UNMOUNTED_KEY: ON_UNMOUNTED_KEY,
  4142. PROPS_KEY: PROPS_KEY,
  4143. STATE_KEY: STATE_KEY,
  4144. SLOTS_KEY: SLOTS_KEY,
  4145. ROOT_KEY: ROOT_KEY,
  4146. IS_PURE_SYMBOL: IS_PURE_SYMBOL,
  4147. IS_COMPONENT_UPDATING: IS_COMPONENT_UPDATING,
  4148. PARENT_KEY_SYMBOL: PARENT_KEY_SYMBOL,
  4149. ATTRIBUTES_KEY_SYMBOL: ATTRIBUTES_KEY_SYMBOL,
  4150. TEMPLATE_KEY_SYMBOL: TEMPLATE_KEY_SYMBOL
  4151. });
  4152. const EACH = 0;
  4153. const IF = 1;
  4154. const SIMPLE = 2;
  4155. const TAG = 3;
  4156. const SLOT = 4;
  4157. var bindingTypes = {
  4158. EACH,
  4159. IF,
  4160. SIMPLE,
  4161. TAG,
  4162. SLOT
  4163. };
  4164. const ATTRIBUTE = 0;
  4165. const EVENT = 1;
  4166. const TEXT = 2;
  4167. const VALUE = 3;
  4168. var expressionTypes = {
  4169. ATTRIBUTE,
  4170. EVENT,
  4171. TEXT,
  4172. VALUE
  4173. };
  4174. const HEAD_SYMBOL = Symbol('head');
  4175. const TAIL_SYMBOL = Symbol('tail');
  4176. /**
  4177. * Create the <template> fragments text nodes
  4178. * @return {Object} {{head: Text, tail: Text}}
  4179. */
  4180. function createHeadTailPlaceholders() {
  4181. const head = document.createTextNode('');
  4182. const tail = document.createTextNode('');
  4183. head[HEAD_SYMBOL] = true;
  4184. tail[TAIL_SYMBOL] = true;
  4185. return {
  4186. head,
  4187. tail
  4188. };
  4189. }
  4190. /**
  4191. * Create the template meta object in case of <template> fragments
  4192. * @param {TemplateChunk} componentTemplate - template chunk object
  4193. * @returns {Object} the meta property that will be passed to the mount function of the TemplateChunk
  4194. */
  4195. function createTemplateMeta(componentTemplate) {
  4196. const fragment = componentTemplate.dom.cloneNode(true);
  4197. const {
  4198. head,
  4199. tail
  4200. } = createHeadTailPlaceholders();
  4201. return {
  4202. avoidDOMInjection: true,
  4203. fragment,
  4204. head,
  4205. tail,
  4206. children: [head, ...Array.from(fragment.childNodes), tail]
  4207. };
  4208. }
  4209. /**
  4210. * Helper function to set an immutable property
  4211. * @param {Object} source - object where the new property will be set
  4212. * @param {string} key - object key where the new property will be stored
  4213. * @param {*} value - value of the new property
  4214. * @param {Object} options - set the propery overriding the default options
  4215. * @returns {Object} - the original object modified
  4216. */
  4217. function defineProperty(source, key, value, options) {
  4218. if (options === void 0) {
  4219. options = {};
  4220. }
  4221. /* eslint-disable fp/no-mutating-methods */
  4222. Object.defineProperty(source, key, Object.assign({
  4223. value,
  4224. enumerable: false,
  4225. writable: false,
  4226. configurable: true
  4227. }, options));
  4228. /* eslint-enable fp/no-mutating-methods */
  4229. return source;
  4230. }
  4231. /**
  4232. * Define multiple properties on a target object
  4233. * @param {Object} source - object where the new properties will be set
  4234. * @param {Object} properties - object containing as key pair the key + value properties
  4235. * @param {Object} options - set the propery overriding the default options
  4236. * @returns {Object} the original object modified
  4237. */
  4238. function defineProperties(source, properties, options) {
  4239. Object.entries(properties).forEach(_ref => {
  4240. let [key, value] = _ref;
  4241. defineProperty(source, key, value, options);
  4242. });
  4243. return source;
  4244. }
  4245. /**
  4246. * Define default properties if they don't exist on the source object
  4247. * @param {Object} source - object that will receive the default properties
  4248. * @param {Object} defaults - object containing additional optional keys
  4249. * @returns {Object} the original object received enhanced
  4250. */
  4251. function defineDefaults(source, defaults) {
  4252. Object.entries(defaults).forEach(_ref2 => {
  4253. let [key, value] = _ref2;
  4254. if (!source[key]) source[key] = value;
  4255. });
  4256. return source;
  4257. }
  4258. /**
  4259. * Get the current <template> fragment children located in between the head and tail comments
  4260. * @param {Comment} head - head comment node
  4261. * @param {Comment} tail - tail comment node
  4262. * @return {Array[]} children list of the nodes found in this template fragment
  4263. */
  4264. function getFragmentChildren(_ref) {
  4265. let {
  4266. head,
  4267. tail
  4268. } = _ref;
  4269. const nodes = walkNodes([head], head.nextSibling, n => n === tail, false);
  4270. nodes.push(tail);
  4271. return nodes;
  4272. }
  4273. /**
  4274. * Recursive function to walk all the <template> children nodes
  4275. * @param {Array[]} children - children nodes collection
  4276. * @param {ChildNode} node - current node
  4277. * @param {Function} check - exit function check
  4278. * @param {boolean} isFilterActive - filter flag to skip nodes managed by other bindings
  4279. * @returns {Array[]} children list of the nodes found in this template fragment
  4280. */
  4281. function walkNodes(children, node, check, isFilterActive) {
  4282. const {
  4283. nextSibling
  4284. } = node; // filter tail and head nodes together with all the nodes in between
  4285. // this is needed only to fix a really ugly edge case https://github.com/riot/riot/issues/2892
  4286. if (!isFilterActive && !node[HEAD_SYMBOL] && !node[TAIL_SYMBOL]) {
  4287. children.push(node);
  4288. }
  4289. if (!nextSibling || check(node)) return children;
  4290. return walkNodes(children, nextSibling, check, // activate the filters to skip nodes between <template> fragments that will be managed by other bindings
  4291. isFilterActive && !node[TAIL_SYMBOL] || nextSibling[HEAD_SYMBOL]);
  4292. }
  4293. /**
  4294. * Quick type checking
  4295. * @param {*} element - anything
  4296. * @param {string} type - type definition
  4297. * @returns {boolean} true if the type corresponds
  4298. */
  4299. function checkType(element, type) {
  4300. return typeof element === type;
  4301. }
  4302. /**
  4303. * Check if an element is part of an svg
  4304. * @param {HTMLElement} el - element to check
  4305. * @returns {boolean} true if we are in an svg context
  4306. */
  4307. function isSvg(el) {
  4308. const owner = el.ownerSVGElement;
  4309. return !!owner || owner === null;
  4310. }
  4311. /**
  4312. * Check if an element is a template tag
  4313. * @param {HTMLElement} el - element to check
  4314. * @returns {boolean} true if it's a <template>
  4315. */
  4316. function isTemplate(el) {
  4317. return el.tagName.toLowerCase() === 'template';
  4318. }
  4319. /**
  4320. * Check that will be passed if its argument is a function
  4321. * @param {*} value - value to check
  4322. * @returns {boolean} - true if the value is a function
  4323. */
  4324. function isFunction(value) {
  4325. return checkType(value, 'function');
  4326. }
  4327. /**
  4328. * Check if a value is a Boolean
  4329. * @param {*} value - anything
  4330. * @returns {boolean} true only for the value is a boolean
  4331. */
  4332. function isBoolean(value) {
  4333. return checkType(value, 'boolean');
  4334. }
  4335. /**
  4336. * Check if a value is an Object
  4337. * @param {*} value - anything
  4338. * @returns {boolean} true only for the value is an object
  4339. */
  4340. function isObject(value) {
  4341. return !isNil(value) && value.constructor === Object;
  4342. }
  4343. /**
  4344. * Check if a value is null or undefined
  4345. * @param {*} value - anything
  4346. * @returns {boolean} true only for the 'undefined' and 'null' types
  4347. */
  4348. function isNil(value) {
  4349. return value === null || value === undefined;
  4350. }
  4351. /**
  4352. * ISC License
  4353. *
  4354. * Copyright (c) 2020, Andrea Giammarchi, @WebReflection
  4355. *
  4356. * Permission to use, copy, modify, and/or distribute this software for any
  4357. * purpose with or without fee is hereby granted, provided that the above
  4358. * copyright notice and this permission notice appear in all copies.
  4359. *
  4360. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  4361. * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  4362. * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  4363. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  4364. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  4365. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  4366. * PERFORMANCE OF THIS SOFTWARE.
  4367. */
  4368. // fork of https://github.com/WebReflection/udomdiff version 1.1.0
  4369. // due to https://github.com/WebReflection/udomdiff/pull/2
  4370. /* eslint-disable */
  4371. /**
  4372. * @param {Node[]} a The list of current/live children
  4373. * @param {Node[]} b The list of future children
  4374. * @param {(entry: Node, action: number) => Node} get
  4375. * The callback invoked per each entry related DOM operation.
  4376. * @param {Node} [before] The optional node used as anchor to insert before.
  4377. * @returns {Node[]} The same list of future children.
  4378. */
  4379. var udomdiff = ((a, b, get, before) => {
  4380. const bLength = b.length;
  4381. let aEnd = a.length;
  4382. let bEnd = bLength;
  4383. let aStart = 0;
  4384. let bStart = 0;
  4385. let map = null;
  4386. while (aStart < aEnd || bStart < bEnd) {
  4387. // append head, tail, or nodes in between: fast path
  4388. if (aEnd === aStart) {
  4389. // we could be in a situation where the rest of nodes that
  4390. // need to be added are not at the end, and in such case
  4391. // the node to `insertBefore`, if the index is more than 0
  4392. // must be retrieved, otherwise it's gonna be the first item.
  4393. const node = bEnd < bLength ? bStart ? get(b[bStart - 1], -0).nextSibling : get(b[bEnd - bStart], 0) : before;
  4394. while (bStart < bEnd) insertBefore(get(b[bStart++], 1), node);
  4395. } // remove head or tail: fast path
  4396. else if (bEnd === bStart) {
  4397. while (aStart < aEnd) {
  4398. // remove the node only if it's unknown or not live
  4399. if (!map || !map.has(a[aStart])) removeChild(get(a[aStart], -1));
  4400. aStart++;
  4401. }
  4402. } // same node: fast path
  4403. else if (a[aStart] === b[bStart]) {
  4404. aStart++;
  4405. bStart++;
  4406. } // same tail: fast path
  4407. else if (a[aEnd - 1] === b[bEnd - 1]) {
  4408. aEnd--;
  4409. bEnd--;
  4410. } // The once here single last swap "fast path" has been removed in v1.1.0
  4411. // https://github.com/WebReflection/udomdiff/blob/single-final-swap/esm/index.js#L69-L85
  4412. // reverse swap: also fast path
  4413. else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
  4414. // this is a "shrink" operation that could happen in these cases:
  4415. // [1, 2, 3, 4, 5]
  4416. // [1, 4, 3, 2, 5]
  4417. // or asymmetric too
  4418. // [1, 2, 3, 4, 5]
  4419. // [1, 2, 3, 5, 6, 4]
  4420. const node = get(a[--aEnd], -1).nextSibling;
  4421. insertBefore(get(b[bStart++], 1), get(a[aStart++], -1).nextSibling);
  4422. insertBefore(get(b[--bEnd], 1), node); // mark the future index as identical (yeah, it's dirty, but cheap 👍)
  4423. // The main reason to do this, is that when a[aEnd] will be reached,
  4424. // the loop will likely be on the fast path, as identical to b[bEnd].
  4425. // In the best case scenario, the next loop will skip the tail,
  4426. // but in the worst one, this node will be considered as already
  4427. // processed, bailing out pretty quickly from the map index check
  4428. a[aEnd] = b[bEnd];
  4429. } // map based fallback, "slow" path
  4430. else {
  4431. // the map requires an O(bEnd - bStart) operation once
  4432. // to store all future nodes indexes for later purposes.
  4433. // In the worst case scenario, this is a full O(N) cost,
  4434. // and such scenario happens at least when all nodes are different,
  4435. // but also if both first and last items of the lists are different
  4436. if (!map) {
  4437. map = new Map();
  4438. let i = bStart;
  4439. while (i < bEnd) map.set(b[i], i++);
  4440. } // if it's a future node, hence it needs some handling
  4441. if (map.has(a[aStart])) {
  4442. // grab the index of such node, 'cause it might have been processed
  4443. const index = map.get(a[aStart]); // if it's not already processed, look on demand for the next LCS
  4444. if (bStart < index && index < bEnd) {
  4445. let i = aStart; // counts the amount of nodes that are the same in the future
  4446. let sequence = 1;
  4447. while (++i < aEnd && i < bEnd && map.get(a[i]) === index + sequence) sequence++; // effort decision here: if the sequence is longer than replaces
  4448. // needed to reach such sequence, which would brings again this loop
  4449. // to the fast path, prepend the difference before a sequence,
  4450. // and move only the future list index forward, so that aStart
  4451. // and bStart will be aligned again, hence on the fast path.
  4452. // An example considering aStart and bStart are both 0:
  4453. // a: [1, 2, 3, 4]
  4454. // b: [7, 1, 2, 3, 6]
  4455. // this would place 7 before 1 and, from that time on, 1, 2, and 3
  4456. // will be processed at zero cost
  4457. if (sequence > index - bStart) {
  4458. const node = get(a[aStart], 0);
  4459. while (bStart < index) insertBefore(get(b[bStart++], 1), node);
  4460. } // if the effort wasn't good enough, fallback to a replace,
  4461. // moving both source and target indexes forward, hoping that some
  4462. // similar node will be found later on, to go back to the fast path
  4463. else {
  4464. replaceChild(get(b[bStart++], 1), get(a[aStart++], -1));
  4465. }
  4466. } // otherwise move the source forward, 'cause there's nothing to do
  4467. else aStart++;
  4468. } // this node has no meaning in the future list, so it's more than safe
  4469. // to remove it, and check the next live node out instead, meaning
  4470. // that only the live list index should be forwarded
  4471. else removeChild(get(a[aStart++], -1));
  4472. }
  4473. }
  4474. return b;
  4475. });
  4476. const UNMOUNT_SCOPE = Symbol('unmount');
  4477. const EachBinding = {
  4478. // dynamic binding properties
  4479. // childrenMap: null,
  4480. // node: null,
  4481. // root: null,
  4482. // condition: null,
  4483. // evaluate: null,
  4484. // template: null,
  4485. // isTemplateTag: false,
  4486. nodes: [],
  4487. // getKey: null,
  4488. // indexName: null,
  4489. // itemName: null,
  4490. // afterPlaceholder: null,
  4491. // placeholder: null,
  4492. // API methods
  4493. mount(scope, parentScope) {
  4494. return this.update(scope, parentScope);
  4495. },
  4496. update(scope, parentScope) {
  4497. const {
  4498. placeholder,
  4499. nodes,
  4500. childrenMap
  4501. } = this;
  4502. const collection = scope === UNMOUNT_SCOPE ? null : this.evaluate(scope);
  4503. const items = collection ? Array.from(collection) : []; // prepare the diffing
  4504. const {
  4505. newChildrenMap,
  4506. batches,
  4507. futureNodes
  4508. } = createPatch(items, scope, parentScope, this); // patch the DOM only if there are new nodes
  4509. udomdiff(nodes, futureNodes, patch(Array.from(childrenMap.values()), parentScope), placeholder); // trigger the mounts and the updates
  4510. batches.forEach(fn => fn()); // update the children map
  4511. this.childrenMap = newChildrenMap;
  4512. this.nodes = futureNodes; // make sure that the loop edge nodes are marked
  4513. markEdgeNodes(this.nodes);
  4514. return this;
  4515. },
  4516. unmount(scope, parentScope) {
  4517. this.update(UNMOUNT_SCOPE, parentScope);
  4518. return this;
  4519. }
  4520. };
  4521. /**
  4522. * Patch the DOM while diffing
  4523. * @param {any[]} redundant - list of all the children (template, nodes, context) added via each
  4524. * @param {*} parentScope - scope of the parent template
  4525. * @returns {Function} patch function used by domdiff
  4526. */
  4527. function patch(redundant, parentScope) {
  4528. return (item, info) => {
  4529. if (info < 0) {
  4530. // get the last element added to the childrenMap saved previously
  4531. const element = redundant[redundant.length - 1];
  4532. if (element) {
  4533. // get the nodes and the template in stored in the last child of the childrenMap
  4534. const {
  4535. template,
  4536. nodes,
  4537. context
  4538. } = element; // remove the last node (notice <template> tags might have more children nodes)
  4539. nodes.pop(); // notice that we pass null as last argument because
  4540. // the root node and its children will be removed by domdiff
  4541. if (!nodes.length) {
  4542. // we have cleared all the children nodes and we can unmount this template
  4543. redundant.pop();
  4544. template.unmount(context, parentScope, null);
  4545. }
  4546. }
  4547. }
  4548. return item;
  4549. };
  4550. }
  4551. /**
  4552. * Check whether a template must be filtered from a loop
  4553. * @param {Function} condition - filter function
  4554. * @param {Object} context - argument passed to the filter function
  4555. * @returns {boolean} true if this item should be skipped
  4556. */
  4557. function mustFilterItem(condition, context) {
  4558. return condition ? !condition(context) : false;
  4559. }
  4560. /**
  4561. * Extend the scope of the looped template
  4562. * @param {Object} scope - current template scope
  4563. * @param {Object} options - options
  4564. * @param {string} options.itemName - key to identify the looped item in the new context
  4565. * @param {string} options.indexName - key to identify the index of the looped item
  4566. * @param {number} options.index - current index
  4567. * @param {*} options.item - collection item looped
  4568. * @returns {Object} enhanced scope object
  4569. */
  4570. function extendScope(scope, _ref) {
  4571. let {
  4572. itemName,
  4573. indexName,
  4574. index,
  4575. item
  4576. } = _ref;
  4577. defineProperty(scope, itemName, item);
  4578. if (indexName) defineProperty(scope, indexName, index);
  4579. return scope;
  4580. }
  4581. /**
  4582. * Mark the first and last nodes in order to ignore them in case we need to retrieve the <template> fragment nodes
  4583. * @param {Array[]} nodes - each binding nodes list
  4584. * @returns {undefined} void function
  4585. */
  4586. function markEdgeNodes(nodes) {
  4587. const first = nodes[0];
  4588. const last = nodes[nodes.length - 1];
  4589. if (first) first[HEAD_SYMBOL] = true;
  4590. if (last) last[TAIL_SYMBOL] = true;
  4591. }
  4592. /**
  4593. * Loop the current template items
  4594. * @param {Array} items - expression collection value
  4595. * @param {*} scope - template scope
  4596. * @param {*} parentScope - scope of the parent template
  4597. * @param {EachBinding} binding - each binding object instance
  4598. * @returns {Object} data
  4599. * @returns {Map} data.newChildrenMap - a Map containing the new children template structure
  4600. * @returns {Array} data.batches - array containing the template lifecycle functions to trigger
  4601. * @returns {Array} data.futureNodes - array containing the nodes we need to diff
  4602. */
  4603. function createPatch(items, scope, parentScope, binding) {
  4604. const {
  4605. condition,
  4606. template,
  4607. childrenMap,
  4608. itemName,
  4609. getKey,
  4610. indexName,
  4611. root,
  4612. isTemplateTag
  4613. } = binding;
  4614. const newChildrenMap = new Map();
  4615. const batches = [];
  4616. const futureNodes = [];
  4617. items.forEach((item, index) => {
  4618. const context = extendScope(Object.create(scope), {
  4619. itemName,
  4620. indexName,
  4621. index,
  4622. item
  4623. });
  4624. const key = getKey ? getKey(context) : index;
  4625. const oldItem = childrenMap.get(key);
  4626. const nodes = [];
  4627. if (mustFilterItem(condition, context)) {
  4628. return;
  4629. }
  4630. const mustMount = !oldItem;
  4631. const componentTemplate = oldItem ? oldItem.template : template.clone();
  4632. const el = componentTemplate.el || root.cloneNode();
  4633. const meta = isTemplateTag && mustMount ? createTemplateMeta(componentTemplate) : componentTemplate.meta;
  4634. if (mustMount) {
  4635. batches.push(() => componentTemplate.mount(el, context, parentScope, meta));
  4636. } else {
  4637. batches.push(() => componentTemplate.update(context, parentScope));
  4638. } // create the collection of nodes to update or to add
  4639. // in case of template tags we need to add all its children nodes
  4640. if (isTemplateTag) {
  4641. nodes.push(...(mustMount ? meta.children : getFragmentChildren(meta)));
  4642. } else {
  4643. nodes.push(el);
  4644. } // delete the old item from the children map
  4645. childrenMap.delete(key);
  4646. futureNodes.push(...nodes); // update the children map
  4647. newChildrenMap.set(key, {
  4648. nodes,
  4649. template: componentTemplate,
  4650. context,
  4651. index
  4652. });
  4653. });
  4654. return {
  4655. newChildrenMap,
  4656. batches,
  4657. futureNodes
  4658. };
  4659. }
  4660. function create$6(node, _ref2) {
  4661. let {
  4662. evaluate,
  4663. condition,
  4664. itemName,
  4665. indexName,
  4666. getKey,
  4667. template
  4668. } = _ref2;
  4669. const placeholder = document.createTextNode('');
  4670. const root = node.cloneNode();
  4671. insertBefore(placeholder, node);
  4672. removeChild(node);
  4673. return Object.assign({}, EachBinding, {
  4674. childrenMap: new Map(),
  4675. node,
  4676. root,
  4677. condition,
  4678. evaluate,
  4679. isTemplateTag: isTemplate(root),
  4680. template: template.createDOM(node),
  4681. getKey,
  4682. indexName,
  4683. itemName,
  4684. placeholder
  4685. });
  4686. }
  4687. /**
  4688. * Binding responsible for the `if` directive
  4689. */
  4690. const IfBinding = {
  4691. // dynamic binding properties
  4692. // node: null,
  4693. // evaluate: null,
  4694. // isTemplateTag: false,
  4695. // placeholder: null,
  4696. // template: null,
  4697. // API methods
  4698. mount(scope, parentScope) {
  4699. return this.update(scope, parentScope);
  4700. },
  4701. update(scope, parentScope) {
  4702. const value = !!this.evaluate(scope);
  4703. const mustMount = !this.value && value;
  4704. const mustUnmount = this.value && !value;
  4705. const mount = () => {
  4706. const pristine = this.node.cloneNode();
  4707. insertBefore(pristine, this.placeholder);
  4708. this.template = this.template.clone();
  4709. this.template.mount(pristine, scope, parentScope);
  4710. };
  4711. switch (true) {
  4712. case mustMount:
  4713. mount();
  4714. break;
  4715. case mustUnmount:
  4716. this.unmount(scope);
  4717. break;
  4718. default:
  4719. if (value) this.template.update(scope, parentScope);
  4720. }
  4721. this.value = value;
  4722. return this;
  4723. },
  4724. unmount(scope, parentScope) {
  4725. this.template.unmount(scope, parentScope, true);
  4726. return this;
  4727. }
  4728. };
  4729. function create$5(node, _ref) {
  4730. let {
  4731. evaluate,
  4732. template
  4733. } = _ref;
  4734. const placeholder = document.createTextNode('');
  4735. insertBefore(placeholder, node);
  4736. removeChild(node);
  4737. return Object.assign({}, IfBinding, {
  4738. node,
  4739. evaluate,
  4740. placeholder,
  4741. template: template.createDOM(node)
  4742. });
  4743. }
  4744. /**
  4745. * Throw an error with a descriptive message
  4746. * @param { string } message - error message
  4747. * @returns { undefined } hoppla.. at this point the program should stop working
  4748. */
  4749. function panic(message) {
  4750. throw new Error(message);
  4751. }
  4752. /**
  4753. * Returns the memoized (cached) function.
  4754. * // borrowed from https://www.30secondsofcode.org/js/s/memoize
  4755. * @param {Function} fn - function to memoize
  4756. * @returns {Function} memoize function
  4757. */
  4758. function memoize(fn) {
  4759. const cache = new Map();
  4760. const cached = val => {
  4761. return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val);
  4762. };
  4763. cached.cache = cache;
  4764. return cached;
  4765. }
  4766. /**
  4767. * Evaluate a list of attribute expressions
  4768. * @param {Array} attributes - attribute expressions generated by the riot compiler
  4769. * @returns {Object} key value pairs with the result of the computation
  4770. */
  4771. function evaluateAttributeExpressions(attributes) {
  4772. return attributes.reduce((acc, attribute) => {
  4773. const {
  4774. value,
  4775. type
  4776. } = attribute;
  4777. switch (true) {
  4778. // spread attribute
  4779. case !attribute.name && type === ATTRIBUTE:
  4780. return Object.assign({}, acc, value);
  4781. // value attribute
  4782. case type === VALUE:
  4783. acc.value = attribute.value;
  4784. break;
  4785. // normal attributes
  4786. default:
  4787. acc[dashToCamelCase(attribute.name)] = attribute.value;
  4788. }
  4789. return acc;
  4790. }, {});
  4791. }
  4792. const ElementProto = typeof Element === 'undefined' ? {} : Element.prototype;
  4793. const isNativeHtmlProperty = memoize(name => ElementProto.hasOwnProperty(name)); // eslint-disable-line
  4794. /**
  4795. * Add all the attributes provided
  4796. * @param {HTMLElement} node - target node
  4797. * @param {Object} attributes - object containing the attributes names and values
  4798. * @returns {undefined} sorry it's a void function :(
  4799. */
  4800. function setAllAttributes(node, attributes) {
  4801. Object.entries(attributes).forEach(_ref => {
  4802. let [name, value] = _ref;
  4803. return attributeExpression(node, {
  4804. name
  4805. }, value);
  4806. });
  4807. }
  4808. /**
  4809. * Remove all the attributes provided
  4810. * @param {HTMLElement} node - target node
  4811. * @param {Object} newAttributes - object containing all the new attribute names
  4812. * @param {Object} oldAttributes - object containing all the old attribute names
  4813. * @returns {undefined} sorry it's a void function :(
  4814. */
  4815. function removeAllAttributes(node, newAttributes, oldAttributes) {
  4816. const newKeys = newAttributes ? Object.keys(newAttributes) : [];
  4817. Object.keys(oldAttributes).filter(name => !newKeys.includes(name)).forEach(attribute => node.removeAttribute(attribute));
  4818. }
  4819. /**
  4820. * Check whether the attribute value can be rendered
  4821. * @param {*} value - expression value
  4822. * @returns {boolean} true if we can render this attribute value
  4823. */
  4824. function canRenderAttribute(value) {
  4825. return value === true || ['string', 'number'].includes(typeof value);
  4826. }
  4827. /**
  4828. * Check whether the attribute should be removed
  4829. * @param {*} value - expression value
  4830. * @returns {boolean} boolean - true if the attribute can be removed}
  4831. */
  4832. function shouldRemoveAttribute(value) {
  4833. return !value && value !== 0;
  4834. }
  4835. /**
  4836. * This methods handles the DOM attributes updates
  4837. * @param {HTMLElement} node - target node
  4838. * @param {Object} expression - expression object
  4839. * @param {string} expression.name - attribute name
  4840. * @param {*} value - new expression value
  4841. * @param {*} oldValue - the old expression cached value
  4842. * @returns {undefined}
  4843. */
  4844. function attributeExpression(node, _ref2, value, oldValue) {
  4845. let {
  4846. name
  4847. } = _ref2;
  4848. // is it a spread operator? {...attributes}
  4849. if (!name) {
  4850. if (oldValue) {
  4851. // remove all the old attributes
  4852. removeAllAttributes(node, value, oldValue);
  4853. } // is the value still truthy?
  4854. if (value) {
  4855. setAllAttributes(node, value);
  4856. }
  4857. return;
  4858. } // handle boolean attributes
  4859. if (!isNativeHtmlProperty(name) && (isBoolean(value) || isObject(value) || isFunction(value))) {
  4860. node[name] = value;
  4861. }
  4862. if (shouldRemoveAttribute(value)) {
  4863. node.removeAttribute(name);
  4864. } else if (canRenderAttribute(value)) {
  4865. node.setAttribute(name, normalizeValue(name, value));
  4866. }
  4867. }
  4868. /**
  4869. * Get the value as string
  4870. * @param {string} name - attribute name
  4871. * @param {*} value - user input value
  4872. * @returns {string} input value as string
  4873. */
  4874. function normalizeValue(name, value) {
  4875. // be sure that expressions like selected={ true } will be always rendered as selected='selected'
  4876. return value === true ? name : value;
  4877. }
  4878. const RE_EVENTS_PREFIX = /^on/;
  4879. const getCallbackAndOptions = value => Array.isArray(value) ? value : [value, false]; // see also https://medium.com/@WebReflection/dom-handleevent-a-cross-platform-standard-since-year-2000-5bf17287fd38
  4880. const EventListener = {
  4881. handleEvent(event) {
  4882. this[event.type](event);
  4883. }
  4884. };
  4885. const ListenersWeakMap = new WeakMap();
  4886. const createListener = node => {
  4887. const listener = Object.create(EventListener);
  4888. ListenersWeakMap.set(node, listener);
  4889. return listener;
  4890. };
  4891. /**
  4892. * Set a new event listener
  4893. * @param {HTMLElement} node - target node
  4894. * @param {Object} expression - expression object
  4895. * @param {string} expression.name - event name
  4896. * @param {*} value - new expression value
  4897. * @returns {value} the callback just received
  4898. */
  4899. function eventExpression(node, _ref, value) {
  4900. let {
  4901. name
  4902. } = _ref;
  4903. const normalizedEventName = name.replace(RE_EVENTS_PREFIX, '');
  4904. const eventListener = ListenersWeakMap.get(node) || createListener(node);
  4905. const [callback, options] = getCallbackAndOptions(value);
  4906. const handler = eventListener[normalizedEventName];
  4907. const mustRemoveEvent = handler && !callback;
  4908. const mustAddEvent = callback && !handler;
  4909. if (mustRemoveEvent) {
  4910. node.removeEventListener(normalizedEventName, eventListener);
  4911. }
  4912. if (mustAddEvent) {
  4913. node.addEventListener(normalizedEventName, eventListener, options);
  4914. }
  4915. eventListener[normalizedEventName] = callback;
  4916. }
  4917. /**
  4918. * Normalize the user value in order to render a empty string in case of falsy values
  4919. * @param {*} value - user input value
  4920. * @returns {string} hopefully a string
  4921. */
  4922. function normalizeStringValue(value) {
  4923. return isNil(value) ? '' : value;
  4924. }
  4925. /**
  4926. * Get the the target text node to update or create one from of a comment node
  4927. * @param {HTMLElement} node - any html element containing childNodes
  4928. * @param {number} childNodeIndex - index of the text node in the childNodes list
  4929. * @returns {Text} the text node to update
  4930. */
  4931. const getTextNode = (node, childNodeIndex) => {
  4932. const target = node.childNodes[childNodeIndex];
  4933. if (target.nodeType === Node.COMMENT_NODE) {
  4934. const textNode = document.createTextNode('');
  4935. node.replaceChild(textNode, target);
  4936. return textNode;
  4937. }
  4938. return target;
  4939. };
  4940. /**
  4941. * This methods handles a simple text expression update
  4942. * @param {HTMLElement} node - target node
  4943. * @param {Object} data - expression object
  4944. * @param {*} value - new expression value
  4945. * @returns {undefined}
  4946. */
  4947. function textExpression(node, data, value) {
  4948. node.data = normalizeStringValue(value);
  4949. }
  4950. /**
  4951. * This methods handles the input fileds value updates
  4952. * @param {HTMLElement} node - target node
  4953. * @param {Object} expression - expression object
  4954. * @param {*} value - new expression value
  4955. * @returns {undefined}
  4956. */
  4957. function valueExpression(node, expression, value) {
  4958. node.value = normalizeStringValue(value);
  4959. }
  4960. var expressions = {
  4961. [ATTRIBUTE]: attributeExpression,
  4962. [EVENT]: eventExpression,
  4963. [TEXT]: textExpression,
  4964. [VALUE]: valueExpression
  4965. };
  4966. const Expression = {
  4967. // Static props
  4968. // node: null,
  4969. // value: null,
  4970. // API methods
  4971. /**
  4972. * Mount the expression evaluating its initial value
  4973. * @param {*} scope - argument passed to the expression to evaluate its current values
  4974. * @returns {Expression} self
  4975. */
  4976. mount(scope) {
  4977. // hopefully a pure function
  4978. this.value = this.evaluate(scope); // IO() DOM updates
  4979. apply(this, this.value);
  4980. return this;
  4981. },
  4982. /**
  4983. * Update the expression if its value changed
  4984. * @param {*} scope - argument passed to the expression to evaluate its current values
  4985. * @returns {Expression} self
  4986. */
  4987. update(scope) {
  4988. // pure function
  4989. const value = this.evaluate(scope);
  4990. if (this.value !== value) {
  4991. // IO() DOM updates
  4992. apply(this, value);
  4993. this.value = value;
  4994. }
  4995. return this;
  4996. },
  4997. /**
  4998. * Expression teardown method
  4999. * @returns {Expression} self
  5000. */
  5001. unmount() {
  5002. // unmount only the event handling expressions
  5003. if (this.type === EVENT) apply(this, null);
  5004. return this;
  5005. }
  5006. };
  5007. /**
  5008. * IO() function to handle the DOM updates
  5009. * @param {Expression} expression - expression object
  5010. * @param {*} value - current expression value
  5011. * @returns {undefined}
  5012. */
  5013. function apply(expression, value) {
  5014. return expressions[expression.type](expression.node, expression, value, expression.value);
  5015. }
  5016. function create$4(node, data) {
  5017. return Object.assign({}, Expression, data, {
  5018. node: data.type === TEXT ? getTextNode(node, data.childNodeIndex) : node
  5019. });
  5020. }
  5021. /**
  5022. * Create a flat object having as keys a list of methods that if dispatched will propagate
  5023. * on the whole collection
  5024. * @param {Array} collection - collection to iterate
  5025. * @param {Array<string>} methods - methods to execute on each item of the collection
  5026. * @param {*} context - context returned by the new methods created
  5027. * @returns {Object} a new object to simplify the the nested methods dispatching
  5028. */
  5029. function flattenCollectionMethods(collection, methods, context) {
  5030. return methods.reduce((acc, method) => {
  5031. return Object.assign({}, acc, {
  5032. [method]: scope => {
  5033. return collection.map(item => item[method](scope)) && context;
  5034. }
  5035. });
  5036. }, {});
  5037. }
  5038. function create$3(node, _ref) {
  5039. let {
  5040. expressions
  5041. } = _ref;
  5042. return Object.assign({}, flattenCollectionMethods(expressions.map(expression => create$4(node, expression)), ['mount', 'update', 'unmount']));
  5043. }
  5044. function extendParentScope(attributes, scope, parentScope) {
  5045. if (!attributes || !attributes.length) return parentScope;
  5046. const expressions = attributes.map(attr => Object.assign({}, attr, {
  5047. value: attr.evaluate(scope)
  5048. }));
  5049. return Object.assign(Object.create(parentScope || null), evaluateAttributeExpressions(expressions));
  5050. } // this function is only meant to fix an edge case
  5051. // https://github.com/riot/riot/issues/2842
  5052. const getRealParent = (scope, parentScope) => scope[PARENT_KEY_SYMBOL] || parentScope;
  5053. const SlotBinding = {
  5054. // dynamic binding properties
  5055. // node: null,
  5056. // name: null,
  5057. attributes: [],
  5058. // template: null,
  5059. getTemplateScope(scope, parentScope) {
  5060. return extendParentScope(this.attributes, scope, parentScope);
  5061. },
  5062. // API methods
  5063. mount(scope, parentScope) {
  5064. const templateData = scope.slots ? scope.slots.find(_ref => {
  5065. let {
  5066. id
  5067. } = _ref;
  5068. return id === this.name;
  5069. }) : false;
  5070. const {
  5071. parentNode
  5072. } = this.node;
  5073. const realParent = getRealParent(scope, parentScope);
  5074. this.template = templateData && create(templateData.html, templateData.bindings).createDOM(parentNode);
  5075. if (this.template) {
  5076. cleanNode(this.node);
  5077. this.template.mount(this.node, this.getTemplateScope(scope, realParent), realParent);
  5078. this.template.children = Array.from(this.node.childNodes);
  5079. }
  5080. moveSlotInnerContent(this.node);
  5081. removeChild(this.node);
  5082. return this;
  5083. },
  5084. update(scope, parentScope) {
  5085. if (this.template) {
  5086. const realParent = getRealParent(scope, parentScope);
  5087. this.template.update(this.getTemplateScope(scope, realParent), realParent);
  5088. }
  5089. return this;
  5090. },
  5091. unmount(scope, parentScope, mustRemoveRoot) {
  5092. if (this.template) {
  5093. this.template.unmount(this.getTemplateScope(scope, parentScope), null, mustRemoveRoot);
  5094. }
  5095. return this;
  5096. }
  5097. };
  5098. /**
  5099. * Move the inner content of the slots outside of them
  5100. * @param {HTMLElement} slot - slot node
  5101. * @returns {undefined} it's a void method ¯\_()_/¯
  5102. */
  5103. function moveSlotInnerContent(slot) {
  5104. const child = slot && slot.firstChild;
  5105. if (!child) return;
  5106. insertBefore(child, slot);
  5107. moveSlotInnerContent(slot);
  5108. }
  5109. /**
  5110. * Create a single slot binding
  5111. * @param {HTMLElement} node - slot node
  5112. * @param {string} name - slot id
  5113. * @param {AttributeExpressionData[]} attributes - slot attributes
  5114. * @returns {Object} Slot binding object
  5115. */
  5116. function createSlot(node, _ref2) {
  5117. let {
  5118. name,
  5119. attributes
  5120. } = _ref2;
  5121. return Object.assign({}, SlotBinding, {
  5122. attributes,
  5123. node,
  5124. name
  5125. });
  5126. }
  5127. /**
  5128. * Create a new tag object if it was registered before, otherwise fallback to the simple
  5129. * template chunk
  5130. * @param {Function} component - component factory function
  5131. * @param {Array<Object>} slots - array containing the slots markup
  5132. * @param {Array} attributes - dynamic attributes that will be received by the tag element
  5133. * @returns {TagImplementation|TemplateChunk} a tag implementation or a template chunk as fallback
  5134. */
  5135. function getTag(component, slots, attributes) {
  5136. if (slots === void 0) {
  5137. slots = [];
  5138. }
  5139. if (attributes === void 0) {
  5140. attributes = [];
  5141. }
  5142. // if this tag was registered before we will return its implementation
  5143. if (component) {
  5144. return component({
  5145. slots,
  5146. attributes
  5147. });
  5148. } // otherwise we return a template chunk
  5149. return create(slotsToMarkup(slots), [...slotBindings(slots), {
  5150. // the attributes should be registered as binding
  5151. // if we fallback to a normal template chunk
  5152. expressions: attributes.map(attr => {
  5153. return Object.assign({
  5154. type: ATTRIBUTE
  5155. }, attr);
  5156. })
  5157. }]);
  5158. }
  5159. /**
  5160. * Merge all the slots bindings into a single array
  5161. * @param {Array<Object>} slots - slots collection
  5162. * @returns {Array<Bindings>} flatten bindings array
  5163. */
  5164. function slotBindings(slots) {
  5165. return slots.reduce((acc, _ref) => {
  5166. let {
  5167. bindings
  5168. } = _ref;
  5169. return acc.concat(bindings);
  5170. }, []);
  5171. }
  5172. /**
  5173. * Merge all the slots together in a single markup string
  5174. * @param {Array<Object>} slots - slots collection
  5175. * @returns {string} markup of all the slots in a single string
  5176. */
  5177. function slotsToMarkup(slots) {
  5178. return slots.reduce((acc, slot) => {
  5179. return acc + slot.html;
  5180. }, '');
  5181. }
  5182. const TagBinding = {
  5183. // dynamic binding properties
  5184. // node: null,
  5185. // evaluate: null,
  5186. // name: null,
  5187. // slots: null,
  5188. // tag: null,
  5189. // attributes: null,
  5190. // getComponent: null,
  5191. mount(scope) {
  5192. return this.update(scope);
  5193. },
  5194. update(scope, parentScope) {
  5195. const name = this.evaluate(scope); // simple update
  5196. if (name && name === this.name) {
  5197. this.tag.update(scope);
  5198. } else {
  5199. // unmount the old tag if it exists
  5200. this.unmount(scope, parentScope, true); // mount the new tag
  5201. this.name = name;
  5202. this.tag = getTag(this.getComponent(name), this.slots, this.attributes);
  5203. this.tag.mount(this.node, scope);
  5204. }
  5205. return this;
  5206. },
  5207. unmount(scope, parentScope, keepRootTag) {
  5208. if (this.tag) {
  5209. // keep the root tag
  5210. this.tag.unmount(keepRootTag);
  5211. }
  5212. return this;
  5213. }
  5214. };
  5215. function create$2(node, _ref2) {
  5216. let {
  5217. evaluate,
  5218. getComponent,
  5219. slots,
  5220. attributes
  5221. } = _ref2;
  5222. return Object.assign({}, TagBinding, {
  5223. node,
  5224. evaluate,
  5225. slots,
  5226. attributes,
  5227. getComponent
  5228. });
  5229. }
  5230. var bindings = {
  5231. [IF]: create$5,
  5232. [SIMPLE]: create$3,
  5233. [EACH]: create$6,
  5234. [TAG]: create$2,
  5235. [SLOT]: createSlot
  5236. };
  5237. /**
  5238. * Text expressions in a template tag will get childNodeIndex value normalized
  5239. * depending on the position of the <template> tag offset
  5240. * @param {Expression[]} expressions - riot expressions array
  5241. * @param {number} textExpressionsOffset - offset of the <template> tag
  5242. * @returns {Expression[]} expressions containing the text expressions normalized
  5243. */
  5244. function fixTextExpressionsOffset(expressions, textExpressionsOffset) {
  5245. return expressions.map(e => e.type === TEXT ? Object.assign({}, e, {
  5246. childNodeIndex: e.childNodeIndex + textExpressionsOffset
  5247. }) : e);
  5248. }
  5249. /**
  5250. * Bind a new expression object to a DOM node
  5251. * @param {HTMLElement} root - DOM node where to bind the expression
  5252. * @param {TagBindingData} binding - binding data
  5253. * @param {number|null} templateTagOffset - if it's defined we need to fix the text expressions childNodeIndex offset
  5254. * @returns {Binding} Binding object
  5255. */
  5256. function create$1(root, binding, templateTagOffset) {
  5257. const {
  5258. selector,
  5259. type,
  5260. redundantAttribute,
  5261. expressions
  5262. } = binding; // find the node to apply the bindings
  5263. const node = selector ? root.querySelector(selector) : root; // remove eventually additional attributes created only to select this node
  5264. if (redundantAttribute) node.removeAttribute(redundantAttribute);
  5265. const bindingExpressions = expressions || []; // init the binding
  5266. return (bindings[type] || bindings[SIMPLE])(node, Object.assign({}, binding, {
  5267. expressions: templateTagOffset && !selector ? fixTextExpressionsOffset(bindingExpressions, templateTagOffset) : bindingExpressions
  5268. }));
  5269. }
  5270. function createHTMLTree(html, root) {
  5271. const template = isTemplate(root) ? root : document.createElement('template');
  5272. template.innerHTML = html;
  5273. return template.content;
  5274. } // for svg nodes we need a bit more work
  5275. function createSVGTree(html, container) {
  5276. // create the SVGNode
  5277. const svgNode = container.ownerDocument.importNode(new window.DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${html}</svg>`, 'application/xml').documentElement, true);
  5278. return svgNode;
  5279. }
  5280. /**
  5281. * Create the DOM that will be injected
  5282. * @param {Object} root - DOM node to find out the context where the fragment will be created
  5283. * @param {string} html - DOM to create as string
  5284. * @returns {HTMLDocumentFragment|HTMLElement} a new html fragment
  5285. */
  5286. function createDOMTree(root, html) {
  5287. if (isSvg(root)) return createSVGTree(html, root);
  5288. return createHTMLTree(html, root);
  5289. }
  5290. /**
  5291. * Inject the DOM tree into a target node
  5292. * @param {HTMLElement} el - target element
  5293. * @param {DocumentFragment|SVGElement} dom - dom tree to inject
  5294. * @returns {undefined}
  5295. */
  5296. function injectDOM(el, dom) {
  5297. switch (true) {
  5298. case isSvg(el):
  5299. moveChildren(dom, el);
  5300. break;
  5301. case isTemplate(el):
  5302. el.parentNode.replaceChild(dom, el);
  5303. break;
  5304. default:
  5305. el.appendChild(dom);
  5306. }
  5307. }
  5308. /**
  5309. * Create the Template DOM skeleton
  5310. * @param {HTMLElement} el - root node where the DOM will be injected
  5311. * @param {string|HTMLElement} html - HTML markup or HTMLElement that will be injected into the root node
  5312. * @returns {?DocumentFragment} fragment that will be injected into the root node
  5313. */
  5314. function createTemplateDOM(el, html) {
  5315. return html && (typeof html === 'string' ? createDOMTree(el, html) : html);
  5316. }
  5317. /**
  5318. * Get the offset of the <template> tag
  5319. * @param {HTMLElement} parentNode - template tag parent node
  5320. * @param {HTMLElement} el - the template tag we want to render
  5321. * @param {Object} meta - meta properties needed to handle the <template> tags in loops
  5322. * @returns {number} offset of the <template> tag calculated from its siblings DOM nodes
  5323. */
  5324. function getTemplateTagOffset(parentNode, el, meta) {
  5325. const siblings = Array.from(parentNode.childNodes);
  5326. return Math.max(siblings.indexOf(el), siblings.indexOf(meta.head) + 1, 0);
  5327. }
  5328. /**
  5329. * Template Chunk model
  5330. * @type {Object}
  5331. */
  5332. const TemplateChunk = Object.freeze({
  5333. // Static props
  5334. // bindings: null,
  5335. // bindingsData: null,
  5336. // html: null,
  5337. // isTemplateTag: false,
  5338. // fragment: null,
  5339. // children: null,
  5340. // dom: null,
  5341. // el: null,
  5342. /**
  5343. * Create the template DOM structure that will be cloned on each mount
  5344. * @param {HTMLElement} el - the root node
  5345. * @returns {TemplateChunk} self
  5346. */
  5347. createDOM(el) {
  5348. // make sure that the DOM gets created before cloning the template
  5349. this.dom = this.dom || createTemplateDOM(el, this.html) || document.createDocumentFragment();
  5350. return this;
  5351. },
  5352. // API methods
  5353. /**
  5354. * Attach the template to a DOM node
  5355. * @param {HTMLElement} el - target DOM node
  5356. * @param {*} scope - template data
  5357. * @param {*} parentScope - scope of the parent template tag
  5358. * @param {Object} meta - meta properties needed to handle the <template> tags in loops
  5359. * @returns {TemplateChunk} self
  5360. */
  5361. mount(el, scope, parentScope, meta) {
  5362. if (meta === void 0) {
  5363. meta = {};
  5364. }
  5365. if (!el) throw new Error('Please provide DOM node to mount properly your template');
  5366. if (this.el) this.unmount(scope); // <template> tags require a bit more work
  5367. // the template fragment might be already created via meta outside of this call
  5368. const {
  5369. fragment,
  5370. children,
  5371. avoidDOMInjection
  5372. } = meta; // <template> bindings of course can not have a root element
  5373. // so we check the parent node to set the query selector bindings
  5374. const {
  5375. parentNode
  5376. } = children ? children[0] : el;
  5377. const isTemplateTag = isTemplate(el);
  5378. const templateTagOffset = isTemplateTag ? getTemplateTagOffset(parentNode, el, meta) : null; // create the DOM if it wasn't created before
  5379. this.createDOM(el); // create the DOM of this template cloning the original DOM structure stored in this instance
  5380. // notice that if a documentFragment was passed (via meta) we will use it instead
  5381. const cloneNode = fragment || this.dom.cloneNode(true); // store root node
  5382. // notice that for template tags the root note will be the parent tag
  5383. this.el = isTemplateTag ? parentNode : el; // create the children array only for the <template> fragments
  5384. this.children = isTemplateTag ? children || Array.from(cloneNode.childNodes) : null; // inject the DOM into the el only if a fragment is available
  5385. if (!avoidDOMInjection && cloneNode) injectDOM(el, cloneNode); // create the bindings
  5386. this.bindings = this.bindingsData.map(binding => create$1(this.el, binding, templateTagOffset));
  5387. this.bindings.forEach(b => b.mount(scope, parentScope)); // store the template meta properties
  5388. this.meta = meta;
  5389. return this;
  5390. },
  5391. /**
  5392. * Update the template with fresh data
  5393. * @param {*} scope - template data
  5394. * @param {*} parentScope - scope of the parent template tag
  5395. * @returns {TemplateChunk} self
  5396. */
  5397. update(scope, parentScope) {
  5398. this.bindings.forEach(b => b.update(scope, parentScope));
  5399. return this;
  5400. },
  5401. /**
  5402. * Remove the template from the node where it was initially mounted
  5403. * @param {*} scope - template data
  5404. * @param {*} parentScope - scope of the parent template tag
  5405. * @param {boolean|null} mustRemoveRoot - if true remove the root element,
  5406. * if false or undefined clean the root tag content, if null don't touch the DOM
  5407. * @returns {TemplateChunk} self
  5408. */
  5409. unmount(scope, parentScope, mustRemoveRoot) {
  5410. if (mustRemoveRoot === void 0) {
  5411. mustRemoveRoot = false;
  5412. }
  5413. const el = this.el;
  5414. if (!el) {
  5415. return this;
  5416. }
  5417. this.bindings.forEach(b => b.unmount(scope, parentScope, mustRemoveRoot));
  5418. switch (true) {
  5419. // pure components should handle the DOM unmount updates by themselves
  5420. // for mustRemoveRoot === null don't touch the DOM
  5421. case el[IS_PURE_SYMBOL] || mustRemoveRoot === null:
  5422. break;
  5423. // if children are declared, clear them
  5424. // applicable for <template> and <slot/> bindings
  5425. case Array.isArray(this.children):
  5426. clearChildren(this.children);
  5427. break;
  5428. // clean the node children only
  5429. case !mustRemoveRoot:
  5430. cleanNode(el);
  5431. break;
  5432. // remove the root node only if the mustRemoveRoot is truly
  5433. case !!mustRemoveRoot:
  5434. removeChild(el);
  5435. break;
  5436. }
  5437. this.el = null;
  5438. return this;
  5439. },
  5440. /**
  5441. * Clone the template chunk
  5442. * @returns {TemplateChunk} a clone of this object resetting the this.el property
  5443. */
  5444. clone() {
  5445. return Object.assign({}, this, {
  5446. meta: {},
  5447. el: null
  5448. });
  5449. }
  5450. });
  5451. /**
  5452. * Create a template chunk wiring also the bindings
  5453. * @param {string|HTMLElement} html - template string
  5454. * @param {BindingData[]} bindings - bindings collection
  5455. * @returns {TemplateChunk} a new TemplateChunk copy
  5456. */
  5457. function create(html, bindings) {
  5458. if (bindings === void 0) {
  5459. bindings = [];
  5460. }
  5461. return Object.assign({}, TemplateChunk, {
  5462. html,
  5463. bindingsData: bindings
  5464. });
  5465. }
  5466. /**
  5467. * Method used to bind expressions to a DOM node
  5468. * @param {string|HTMLElement} html - your static template html structure
  5469. * @param {Array} bindings - list of the expressions to bind to update the markup
  5470. * @returns {TemplateChunk} a new TemplateChunk object having the `update`,`mount`, `unmount` and `clone` methods
  5471. *
  5472. * @example
  5473. *
  5474. * riotDOMBindings
  5475. * .template(
  5476. * `<div expr0><!----></div><div><p expr1><!----><section expr2></section></p>`,
  5477. * [
  5478. * {
  5479. * selector: '[expr0]',
  5480. * redundantAttribute: 'expr0',
  5481. * expressions: [
  5482. * {
  5483. * type: expressionTypes.TEXT,
  5484. * childNodeIndex: 0,
  5485. * evaluate(scope) {
  5486. * return scope.time;
  5487. * },
  5488. * },
  5489. * ],
  5490. * },
  5491. * {
  5492. * selector: '[expr1]',
  5493. * redundantAttribute: 'expr1',
  5494. * expressions: [
  5495. * {
  5496. * type: expressionTypes.TEXT,
  5497. * childNodeIndex: 0,
  5498. * evaluate(scope) {
  5499. * return scope.name;
  5500. * },
  5501. * },
  5502. * {
  5503. * type: 'attribute',
  5504. * name: 'style',
  5505. * evaluate(scope) {
  5506. * return scope.style;
  5507. * },
  5508. * },
  5509. * ],
  5510. * },
  5511. * {
  5512. * selector: '[expr2]',
  5513. * redundantAttribute: 'expr2',
  5514. * type: bindingTypes.IF,
  5515. * evaluate(scope) {
  5516. * return scope.isVisible;
  5517. * },
  5518. * template: riotDOMBindings.template('hello there'),
  5519. * },
  5520. * ]
  5521. * )
  5522. */
  5523. var DOMBindings = /*#__PURE__*/Object.freeze({
  5524. __proto__: null,
  5525. template: create,
  5526. createBinding: create$1,
  5527. createExpression: create$4,
  5528. bindingTypes: bindingTypes,
  5529. expressionTypes: expressionTypes
  5530. });
  5531. function noop() {
  5532. return this;
  5533. }
  5534. /**
  5535. * Autobind the methods of a source object to itself
  5536. * @param {Object} source - probably a riot tag instance
  5537. * @param {Array<string>} methods - list of the methods to autobind
  5538. * @returns {Object} the original object received
  5539. */
  5540. function autobindMethods(source, methods) {
  5541. methods.forEach(method => {
  5542. source[method] = source[method].bind(source);
  5543. });
  5544. return source;
  5545. }
  5546. /**
  5547. * Call the first argument received only if it's a function otherwise return it as it is
  5548. * @param {*} source - anything
  5549. * @returns {*} anything
  5550. */
  5551. function callOrAssign(source) {
  5552. return isFunction(source) ? source.prototype && source.prototype.constructor ? new source() : source() : source;
  5553. }
  5554. /**
  5555. * Converts any DOM node/s to a loopable array
  5556. * @param { HTMLElement|NodeList } els - single html element or a node list
  5557. * @returns { Array } always a loopable object
  5558. */
  5559. function domToArray(els) {
  5560. // can this object be already looped?
  5561. if (!Array.isArray(els)) {
  5562. // is it a node list?
  5563. if (/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(els)) && typeof els.length === 'number') return Array.from(els);else // if it's a single node
  5564. // it will be returned as "array" with one single entry
  5565. return [els];
  5566. } // this object could be looped out of the box
  5567. return els;
  5568. }
  5569. /**
  5570. * Simple helper to find DOM nodes returning them as array like loopable object
  5571. * @param { string|DOMNodeList } selector - either the query or the DOM nodes to arraify
  5572. * @param { HTMLElement } ctx - context defining where the query will search for the DOM nodes
  5573. * @returns { Array } DOM nodes found as array
  5574. */
  5575. function $(selector, ctx) {
  5576. return domToArray(typeof selector === 'string' ? (ctx || document).querySelectorAll(selector) : selector);
  5577. }
  5578. /**
  5579. * Normalize the return values, in case of a single value we avoid to return an array
  5580. * @param { Array } values - list of values we want to return
  5581. * @returns { Array|string|boolean } either the whole list of values or the single one found
  5582. * @private
  5583. */
  5584. const normalize = values => values.length === 1 ? values[0] : values;
  5585. /**
  5586. * Parse all the nodes received to get/remove/check their attributes
  5587. * @param { HTMLElement|NodeList|Array } els - DOM node/s to parse
  5588. * @param { string|Array } name - name or list of attributes
  5589. * @param { string } method - method that will be used to parse the attributes
  5590. * @returns { Array|string } result of the parsing in a list or a single value
  5591. * @private
  5592. */
  5593. function parseNodes(els, name, method) {
  5594. const names = typeof name === 'string' ? [name] : name;
  5595. return normalize(domToArray(els).map(el => {
  5596. return normalize(names.map(n => el[method](n)));
  5597. }));
  5598. }
  5599. /**
  5600. * Set any attribute on a single or a list of DOM nodes
  5601. * @param { HTMLElement|NodeList|Array } els - DOM node/s to parse
  5602. * @param { string|Object } name - either the name of the attribute to set
  5603. * or a list of properties as object key - value
  5604. * @param { string } value - the new value of the attribute (optional)
  5605. * @returns { HTMLElement|NodeList|Array } the original array of elements passed to this function
  5606. *
  5607. * @example
  5608. *
  5609. * import { set } from 'bianco.attr'
  5610. *
  5611. * const img = document.createElement('img')
  5612. *
  5613. * set(img, 'width', 100)
  5614. *
  5615. * // or also
  5616. * set(img, {
  5617. * width: 300,
  5618. * height: 300
  5619. * })
  5620. *
  5621. */
  5622. function set(els, name, value) {
  5623. const attrs = typeof name === 'object' ? name : {
  5624. [name]: value
  5625. };
  5626. const props = Object.keys(attrs);
  5627. domToArray(els).forEach(el => {
  5628. props.forEach(prop => el.setAttribute(prop, attrs[prop]));
  5629. });
  5630. return els;
  5631. }
  5632. /**
  5633. * Get any attribute from a single or a list of DOM nodes
  5634. * @param { HTMLElement|NodeList|Array } els - DOM node/s to parse
  5635. * @param { string|Array } name - name or list of attributes to get
  5636. * @returns { Array|string } list of the attributes found
  5637. *
  5638. * @example
  5639. *
  5640. * import { get } from 'bianco.attr'
  5641. *
  5642. * const img = document.createElement('img')
  5643. *
  5644. * get(img, 'width') // => '200'
  5645. *
  5646. * // or also
  5647. * get(img, ['width', 'height']) // => ['200', '300']
  5648. *
  5649. * // or also
  5650. * get([img1, img2], ['width', 'height']) // => [['200', '300'], ['500', '200']]
  5651. */
  5652. function get(els, name) {
  5653. return parseNodes(els, name, 'getAttribute');
  5654. }
  5655. const CSS_BY_NAME = new Map();
  5656. const STYLE_NODE_SELECTOR = 'style[riot]'; // memoized curried function
  5657. const getStyleNode = (style => {
  5658. return () => {
  5659. // lazy evaluation:
  5660. // if this function was already called before
  5661. // we return its cached result
  5662. if (style) return style; // create a new style element or use an existing one
  5663. // and cache it internally
  5664. style = $(STYLE_NODE_SELECTOR)[0] || document.createElement('style');
  5665. set(style, 'type', 'text/css');
  5666. /* istanbul ignore next */
  5667. if (!style.parentNode) document.head.appendChild(style);
  5668. return style;
  5669. };
  5670. })();
  5671. /**
  5672. * Object that will be used to inject and manage the css of every tag instance
  5673. */
  5674. var cssManager = {
  5675. CSS_BY_NAME,
  5676. /**
  5677. * Save a tag style to be later injected into DOM
  5678. * @param { string } name - if it's passed we will map the css to a tagname
  5679. * @param { string } css - css string
  5680. * @returns {Object} self
  5681. */
  5682. add(name, css) {
  5683. if (!CSS_BY_NAME.has(name)) {
  5684. CSS_BY_NAME.set(name, css);
  5685. this.inject();
  5686. }
  5687. return this;
  5688. },
  5689. /**
  5690. * Inject all previously saved tag styles into DOM
  5691. * innerHTML seems slow: http://jsperf.com/riot-insert-style
  5692. * @returns {Object} self
  5693. */
  5694. inject() {
  5695. getStyleNode().innerHTML = [...CSS_BY_NAME.values()].join('\n');
  5696. return this;
  5697. },
  5698. /**
  5699. * Remove a tag style from the DOM
  5700. * @param {string} name a registered tagname
  5701. * @returns {Object} self
  5702. */
  5703. remove(name) {
  5704. if (CSS_BY_NAME.has(name)) {
  5705. CSS_BY_NAME.delete(name);
  5706. this.inject();
  5707. }
  5708. return this;
  5709. }
  5710. };
  5711. /**
  5712. * Function to curry any javascript method
  5713. * @param {Function} fn - the target function we want to curry
  5714. * @param {...[args]} acc - initial arguments
  5715. * @returns {Function|*} it will return a function until the target function
  5716. * will receive all of its arguments
  5717. */
  5718. function curry(fn) {
  5719. for (var _len = arguments.length, acc = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5720. acc[_key - 1] = arguments[_key];
  5721. }
  5722. return function () {
  5723. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  5724. args[_key2] = arguments[_key2];
  5725. }
  5726. args = [...acc, ...args];
  5727. return args.length < fn.length ? curry(fn, ...args) : fn(...args);
  5728. };
  5729. }
  5730. /**
  5731. * Get the tag name of any DOM node
  5732. * @param {HTMLElement} element - DOM node we want to inspect
  5733. * @returns {string} name to identify this dom node in riot
  5734. */
  5735. function getName(element) {
  5736. return get(element, IS_DIRECTIVE) || element.tagName.toLowerCase();
  5737. }
  5738. const COMPONENT_CORE_HELPERS = Object.freeze({
  5739. // component helpers
  5740. $(selector) {
  5741. return $(selector, this.root)[0];
  5742. },
  5743. $$(selector) {
  5744. return $(selector, this.root);
  5745. }
  5746. });
  5747. const PURE_COMPONENT_API = Object.freeze({
  5748. [MOUNT_METHOD_KEY]: noop,
  5749. [UPDATE_METHOD_KEY]: noop,
  5750. [UNMOUNT_METHOD_KEY]: noop
  5751. });
  5752. const COMPONENT_LIFECYCLE_METHODS = Object.freeze({
  5753. [SHOULD_UPDATE_KEY]: noop,
  5754. [ON_BEFORE_MOUNT_KEY]: noop,
  5755. [ON_MOUNTED_KEY]: noop,
  5756. [ON_BEFORE_UPDATE_KEY]: noop,
  5757. [ON_UPDATED_KEY]: noop,
  5758. [ON_BEFORE_UNMOUNT_KEY]: noop,
  5759. [ON_UNMOUNTED_KEY]: noop
  5760. });
  5761. const MOCKED_TEMPLATE_INTERFACE = Object.assign({}, PURE_COMPONENT_API, {
  5762. clone: noop,
  5763. createDOM: noop
  5764. });
  5765. /**
  5766. * Performance optimization for the recursive components
  5767. * @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
  5768. * @returns {Object} component like interface
  5769. */
  5770. const memoizedCreateComponent = memoize(createComponent);
  5771. /**
  5772. * Evaluate the component properties either from its real attributes or from its initial user properties
  5773. * @param {HTMLElement} element - component root
  5774. * @param {Object} initialProps - initial props
  5775. * @returns {Object} component props key value pairs
  5776. */
  5777. function evaluateInitialProps(element, initialProps) {
  5778. if (initialProps === void 0) {
  5779. initialProps = {};
  5780. }
  5781. return Object.assign({}, DOMattributesToObject(element), callOrAssign(initialProps));
  5782. }
  5783. /**
  5784. * Bind a DOM node to its component object
  5785. * @param {HTMLElement} node - html node mounted
  5786. * @param {Object} component - Riot.js component object
  5787. * @returns {Object} the component object received as second argument
  5788. */
  5789. const bindDOMNodeToComponentObject = (node, component) => node[DOM_COMPONENT_INSTANCE_PROPERTY$1] = component;
  5790. /**
  5791. * Wrap the Riot.js core API methods using a mapping function
  5792. * @param {Function} mapFunction - lifting function
  5793. * @returns {Object} an object having the { mount, update, unmount } functions
  5794. */
  5795. function createCoreAPIMethods(mapFunction) {
  5796. return [MOUNT_METHOD_KEY, UPDATE_METHOD_KEY, UNMOUNT_METHOD_KEY].reduce((acc, method) => {
  5797. acc[method] = mapFunction(method);
  5798. return acc;
  5799. }, {});
  5800. }
  5801. /**
  5802. * Factory function to create the component templates only once
  5803. * @param {Function} template - component template creation function
  5804. * @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
  5805. * @returns {TemplateChunk} template chunk object
  5806. */
  5807. function componentTemplateFactory(template, componentWrapper) {
  5808. const components = createSubcomponents(componentWrapper.exports ? componentWrapper.exports.components : {});
  5809. return template(create, expressionTypes, bindingTypes, name => {
  5810. // improve support for recursive components
  5811. if (name === componentWrapper.name) return memoizedCreateComponent(componentWrapper); // return the registered components
  5812. return components[name] || COMPONENTS_IMPLEMENTATION_MAP$1.get(name);
  5813. });
  5814. }
  5815. /**
  5816. * Create a pure component
  5817. * @param {Function} pureFactoryFunction - pure component factory function
  5818. * @param {Array} options.slots - component slots
  5819. * @param {Array} options.attributes - component attributes
  5820. * @param {Array} options.template - template factory function
  5821. * @param {Array} options.template - template factory function
  5822. * @param {any} options.props - initial component properties
  5823. * @returns {Object} pure component object
  5824. */
  5825. function createPureComponent(pureFactoryFunction, _ref) {
  5826. let {
  5827. slots,
  5828. attributes,
  5829. props,
  5830. css,
  5831. template
  5832. } = _ref;
  5833. if (template) panic('Pure components can not have html');
  5834. if (css) panic('Pure components do not have css');
  5835. const component = defineDefaults(pureFactoryFunction({
  5836. slots,
  5837. attributes,
  5838. props
  5839. }), PURE_COMPONENT_API);
  5840. return createCoreAPIMethods(method => function () {
  5841. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5842. args[_key] = arguments[_key];
  5843. }
  5844. // intercept the mount calls to bind the DOM node to the pure object created
  5845. // see also https://github.com/riot/riot/issues/2806
  5846. if (method === MOUNT_METHOD_KEY) {
  5847. const [el] = args; // mark this node as pure element
  5848. el[IS_PURE_SYMBOL] = true;
  5849. bindDOMNodeToComponentObject(el, component);
  5850. }
  5851. component[method](...args);
  5852. return component;
  5853. });
  5854. }
  5855. /**
  5856. * Create the component interface needed for the @riotjs/dom-bindings tag bindings
  5857. * @param {RiotComponentWrapper} componentWrapper - riot compiler generated object
  5858. * @param {string} componentWrapper.css - component css
  5859. * @param {Function} componentWrapper.template - function that will return the dom-bindings template function
  5860. * @param {Object} componentWrapper.exports - component interface
  5861. * @param {string} componentWrapper.name - component name
  5862. * @returns {Object} component like interface
  5863. */
  5864. function createComponent(componentWrapper) {
  5865. const {
  5866. css,
  5867. template,
  5868. exports,
  5869. name
  5870. } = componentWrapper;
  5871. const templateFn = template ? componentTemplateFactory(template, componentWrapper) : MOCKED_TEMPLATE_INTERFACE;
  5872. return _ref2 => {
  5873. let {
  5874. slots,
  5875. attributes,
  5876. props
  5877. } = _ref2;
  5878. // pure components rendering will be managed by the end user
  5879. if (exports && exports[IS_PURE_SYMBOL]) return createPureComponent(exports, {
  5880. slots,
  5881. attributes,
  5882. props,
  5883. css,
  5884. template
  5885. });
  5886. const componentAPI = callOrAssign(exports) || {};
  5887. const component = defineComponent({
  5888. css,
  5889. template: templateFn,
  5890. componentAPI,
  5891. name
  5892. })({
  5893. slots,
  5894. attributes,
  5895. props
  5896. }); // notice that for the components create via tag binding
  5897. // we need to invert the mount (state/parentScope) arguments
  5898. // the template bindings will only forward the parentScope updates
  5899. // and never deal with the component state
  5900. return {
  5901. mount(element, parentScope, state) {
  5902. return component.mount(element, state, parentScope);
  5903. },
  5904. update(parentScope, state) {
  5905. return component.update(state, parentScope);
  5906. },
  5907. unmount(preserveRoot) {
  5908. return component.unmount(preserveRoot);
  5909. }
  5910. };
  5911. };
  5912. }
  5913. /**
  5914. * Component definition function
  5915. * @param {Object} implementation - the componen implementation will be generated via compiler
  5916. * @param {Object} component - the component initial properties
  5917. * @returns {Object} a new component implementation object
  5918. */
  5919. function defineComponent(_ref3) {
  5920. let {
  5921. css,
  5922. template,
  5923. componentAPI,
  5924. name
  5925. } = _ref3;
  5926. // add the component css into the DOM
  5927. if (css && name) cssManager.add(name, css);
  5928. return curry(enhanceComponentAPI)(defineProperties( // set the component defaults without overriding the original component API
  5929. defineDefaults(componentAPI, Object.assign({}, COMPONENT_LIFECYCLE_METHODS, {
  5930. [PROPS_KEY]: {},
  5931. [STATE_KEY]: {}
  5932. })), Object.assign({
  5933. // defined during the component creation
  5934. [SLOTS_KEY]: null,
  5935. [ROOT_KEY]: null
  5936. }, COMPONENT_CORE_HELPERS, {
  5937. name,
  5938. css,
  5939. template
  5940. })));
  5941. }
  5942. /**
  5943. * Create the bindings to update the component attributes
  5944. * @param {HTMLElement} node - node where we will bind the expressions
  5945. * @param {Array} attributes - list of attribute bindings
  5946. * @returns {TemplateChunk} - template bindings object
  5947. */
  5948. function createAttributeBindings(node, attributes) {
  5949. if (attributes === void 0) {
  5950. attributes = [];
  5951. }
  5952. const expressions = attributes.map(a => create$4(node, a));
  5953. const binding = {};
  5954. return Object.assign(binding, Object.assign({
  5955. expressions
  5956. }, createCoreAPIMethods(method => scope => {
  5957. expressions.forEach(e => e[method](scope));
  5958. return binding;
  5959. })));
  5960. }
  5961. /**
  5962. * Create the subcomponents that can be included inside a tag in runtime
  5963. * @param {Object} components - components imported in runtime
  5964. * @returns {Object} all the components transformed into Riot.Component factory functions
  5965. */
  5966. function createSubcomponents(components) {
  5967. if (components === void 0) {
  5968. components = {};
  5969. }
  5970. return Object.entries(callOrAssign(components)).reduce((acc, _ref4) => {
  5971. let [key, value] = _ref4;
  5972. acc[camelToDashCase(key)] = createComponent(value);
  5973. return acc;
  5974. }, {});
  5975. }
  5976. /**
  5977. * Run the component instance through all the plugins set by the user
  5978. * @param {Object} component - component instance
  5979. * @returns {Object} the component enhanced by the plugins
  5980. */
  5981. function runPlugins(component) {
  5982. return [...PLUGINS_SET$1].reduce((c, fn) => fn(c) || c, component);
  5983. }
  5984. /**
  5985. * Compute the component current state merging it with its previous state
  5986. * @param {Object} oldState - previous state object
  5987. * @param {Object} newState - new state givent to the `update` call
  5988. * @returns {Object} new object state
  5989. */
  5990. function computeState(oldState, newState) {
  5991. return Object.assign({}, oldState, callOrAssign(newState));
  5992. }
  5993. /**
  5994. * Add eventually the "is" attribute to link this DOM node to its css
  5995. * @param {HTMLElement} element - target root node
  5996. * @param {string} name - name of the component mounted
  5997. * @returns {undefined} it's a void function
  5998. */
  5999. function addCssHook(element, name) {
  6000. if (getName(element) !== name) {
  6001. set(element, IS_DIRECTIVE, name);
  6002. }
  6003. }
  6004. /**
  6005. * Component creation factory function that will enhance the user provided API
  6006. * @param {Object} component - a component implementation previously defined
  6007. * @param {Array} options.slots - component slots generated via riot compiler
  6008. * @param {Array} options.attributes - attribute expressions generated via riot compiler
  6009. * @returns {Riot.Component} a riot component instance
  6010. */
  6011. function enhanceComponentAPI(component, _ref5) {
  6012. let {
  6013. slots,
  6014. attributes,
  6015. props
  6016. } = _ref5;
  6017. return autobindMethods(runPlugins(defineProperties(isObject(component) ? Object.create(component) : component, {
  6018. mount(element, state, parentScope) {
  6019. if (state === void 0) {
  6020. state = {};
  6021. }
  6022. this[PARENT_KEY_SYMBOL] = parentScope;
  6023. this[ATTRIBUTES_KEY_SYMBOL] = createAttributeBindings(element, attributes).mount(parentScope);
  6024. defineProperty(this, PROPS_KEY, Object.freeze(Object.assign({}, evaluateInitialProps(element, props), evaluateAttributeExpressions(this[ATTRIBUTES_KEY_SYMBOL].expressions))));
  6025. this[STATE_KEY] = computeState(this[STATE_KEY], state);
  6026. this[TEMPLATE_KEY_SYMBOL] = this.template.createDOM(element).clone(); // link this object to the DOM node
  6027. bindDOMNodeToComponentObject(element, this); // add eventually the 'is' attribute
  6028. component.name && addCssHook(element, component.name); // define the root element
  6029. defineProperty(this, ROOT_KEY, element); // define the slots array
  6030. defineProperty(this, SLOTS_KEY, slots); // before mount lifecycle event
  6031. this[ON_BEFORE_MOUNT_KEY](this[PROPS_KEY], this[STATE_KEY]); // mount the template
  6032. this[TEMPLATE_KEY_SYMBOL].mount(element, this, parentScope);
  6033. this[ON_MOUNTED_KEY](this[PROPS_KEY], this[STATE_KEY]);
  6034. return this;
  6035. },
  6036. update(state, parentScope) {
  6037. if (state === void 0) {
  6038. state = {};
  6039. }
  6040. if (parentScope) {
  6041. this[PARENT_KEY_SYMBOL] = parentScope;
  6042. this[ATTRIBUTES_KEY_SYMBOL].update(parentScope);
  6043. }
  6044. const newProps = evaluateAttributeExpressions(this[ATTRIBUTES_KEY_SYMBOL].expressions);
  6045. if (this[SHOULD_UPDATE_KEY](newProps, this[PROPS_KEY]) === false) return;
  6046. defineProperty(this, PROPS_KEY, Object.freeze(Object.assign({}, this[PROPS_KEY], newProps)));
  6047. this[STATE_KEY] = computeState(this[STATE_KEY], state);
  6048. this[ON_BEFORE_UPDATE_KEY](this[PROPS_KEY], this[STATE_KEY]); // avoiding recursive updates
  6049. // see also https://github.com/riot/riot/issues/2895
  6050. if (!this[IS_COMPONENT_UPDATING]) {
  6051. this[IS_COMPONENT_UPDATING] = true;
  6052. this[TEMPLATE_KEY_SYMBOL].update(this, this[PARENT_KEY_SYMBOL]);
  6053. }
  6054. this[ON_UPDATED_KEY](this[PROPS_KEY], this[STATE_KEY]);
  6055. this[IS_COMPONENT_UPDATING] = false;
  6056. return this;
  6057. },
  6058. unmount(preserveRoot) {
  6059. this[ON_BEFORE_UNMOUNT_KEY](this[PROPS_KEY], this[STATE_KEY]);
  6060. this[ATTRIBUTES_KEY_SYMBOL].unmount(); // if the preserveRoot is null the template html will be left untouched
  6061. // in that case the DOM cleanup will happen differently from a parent node
  6062. this[TEMPLATE_KEY_SYMBOL].unmount(this, this[PARENT_KEY_SYMBOL], preserveRoot === null ? null : !preserveRoot);
  6063. this[ON_UNMOUNTED_KEY](this[PROPS_KEY], this[STATE_KEY]);
  6064. return this;
  6065. }
  6066. })), Object.keys(component).filter(prop => isFunction(component[prop])));
  6067. }
  6068. /**
  6069. * Component initialization function starting from a DOM node
  6070. * @param {HTMLElement} element - element to upgrade
  6071. * @param {Object} initialProps - initial component properties
  6072. * @param {string} componentName - component id
  6073. * @returns {Object} a new component instance bound to a DOM node
  6074. */
  6075. function mountComponent(element, initialProps, componentName) {
  6076. const name = componentName || getName(element);
  6077. if (!COMPONENTS_IMPLEMENTATION_MAP$1.has(name)) panic(`The component named "${name}" was never registered`);
  6078. const component = COMPONENTS_IMPLEMENTATION_MAP$1.get(name)({
  6079. props: initialProps
  6080. });
  6081. return component.mount(element);
  6082. }
  6083. /**
  6084. * Similar to compose but performs from left-to-right function composition.<br/>
  6085. * {@link https://30secondsofcode.org/function#composeright see also}
  6086. * @param {...[function]} fns) - list of unary function
  6087. * @returns {*} result of the computation
  6088. */
  6089. /**
  6090. * Performs right-to-left function composition.<br/>
  6091. * Use Array.prototype.reduce() to perform right-to-left function composition.<br/>
  6092. * The last (rightmost) function can accept one or more arguments; the remaining functions must be unary.<br/>
  6093. * {@link https://30secondsofcode.org/function#compose original source code}
  6094. * @param {...[function]} fns) - list of unary function
  6095. * @returns {*} result of the computation
  6096. */
  6097. function compose() {
  6098. for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  6099. fns[_key2] = arguments[_key2];
  6100. }
  6101. return fns.reduce((f, g) => function () {
  6102. return f(g(...arguments));
  6103. });
  6104. }
  6105. const {
  6106. DOM_COMPONENT_INSTANCE_PROPERTY,
  6107. COMPONENTS_IMPLEMENTATION_MAP,
  6108. PLUGINS_SET
  6109. } = globals;
  6110. /**
  6111. * Riot public api
  6112. */
  6113. /**
  6114. * Register a custom tag by name
  6115. * @param {string} name - component name
  6116. * @param {Object} implementation - tag implementation
  6117. * @returns {Map} map containing all the components implementations
  6118. */
  6119. function register(name, _ref) {
  6120. let {
  6121. css,
  6122. template,
  6123. exports
  6124. } = _ref;
  6125. if (COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component "${name}" was already registered`);
  6126. COMPONENTS_IMPLEMENTATION_MAP.set(name, createComponent({
  6127. name,
  6128. css,
  6129. template,
  6130. exports
  6131. }));
  6132. return COMPONENTS_IMPLEMENTATION_MAP;
  6133. }
  6134. /**
  6135. * Unregister a riot web component
  6136. * @param {string} name - component name
  6137. * @returns {Map} map containing all the components implementations
  6138. */
  6139. function unregister(name) {
  6140. if (!COMPONENTS_IMPLEMENTATION_MAP.has(name)) panic(`The component "${name}" was never registered`);
  6141. COMPONENTS_IMPLEMENTATION_MAP.delete(name);
  6142. cssManager.remove(name);
  6143. return COMPONENTS_IMPLEMENTATION_MAP;
  6144. }
  6145. /**
  6146. * Mounting function that will work only for the components that were globally registered
  6147. * @param {string|HTMLElement} selector - query for the selection or a DOM element
  6148. * @param {Object} initialProps - the initial component properties
  6149. * @param {string} name - optional component name
  6150. * @returns {Array} list of riot components
  6151. */
  6152. function mount(selector, initialProps, name) {
  6153. return $(selector).map(element => mountComponent(element, initialProps, name));
  6154. }
  6155. /**
  6156. * Sweet unmounting helper function for the DOM node mounted manually by the user
  6157. * @param {string|HTMLElement} selector - query for the selection or a DOM element
  6158. * @param {boolean|null} keepRootElement - if true keep the root element
  6159. * @returns {Array} list of nodes unmounted
  6160. */
  6161. function unmount(selector, keepRootElement) {
  6162. return $(selector).map(element => {
  6163. if (element[DOM_COMPONENT_INSTANCE_PROPERTY]) {
  6164. element[DOM_COMPONENT_INSTANCE_PROPERTY].unmount(keepRootElement);
  6165. }
  6166. return element;
  6167. });
  6168. }
  6169. /**
  6170. * Define a riot plugin
  6171. * @param {Function} plugin - function that will receive all the components created
  6172. * @returns {Set} the set containing all the plugins installed
  6173. */
  6174. function install(plugin) {
  6175. if (!isFunction(plugin)) panic('Plugins must be of type function');
  6176. if (PLUGINS_SET.has(plugin)) panic('This plugin was already installed');
  6177. PLUGINS_SET.add(plugin);
  6178. return PLUGINS_SET;
  6179. }
  6180. /**
  6181. * Uninstall a riot plugin
  6182. * @param {Function} plugin - plugin previously installed
  6183. * @returns {Set} the set containing all the plugins installed
  6184. */
  6185. function uninstall(plugin) {
  6186. if (!PLUGINS_SET.has(plugin)) panic('This plugin was never installed');
  6187. PLUGINS_SET.delete(plugin);
  6188. return PLUGINS_SET;
  6189. }
  6190. /**
  6191. * Helper method to create component without relying on the registered ones
  6192. * @param {Object} implementation - component implementation
  6193. * @returns {Function} function that will allow you to mount a riot component on a DOM node
  6194. */
  6195. function component(implementation) {
  6196. return function (el, props, _temp) {
  6197. let {
  6198. slots,
  6199. attributes,
  6200. parentScope
  6201. } = _temp === void 0 ? {} : _temp;
  6202. return compose(c => c.mount(el, parentScope), c => c({
  6203. props,
  6204. slots,
  6205. attributes
  6206. }), createComponent)(implementation);
  6207. };
  6208. }
  6209. /**
  6210. * Lift a riot component Interface into a pure riot object
  6211. * @param {Function} func - RiotPureComponent factory function
  6212. * @returns {Function} the lifted original function received as argument
  6213. */
  6214. function pure(func) {
  6215. if (!isFunction(func)) panic('riot.pure accepts only arguments of type "function"');
  6216. func[IS_PURE_SYMBOL] = true;
  6217. return func;
  6218. }
  6219. /**
  6220. * no-op function needed to add the proper types to your component via typescript
  6221. * @param {Function|Object} component - component default export
  6222. * @returns {Function|Object} returns exactly what it has received
  6223. */
  6224. const withTypes = component => component;
  6225. /** @type {string} current riot version */
  6226. const version = 'v6.0.1'; // expose some internal stuff that might be used from external tools
  6227. const __ = {
  6228. cssManager,
  6229. DOMBindings,
  6230. createComponent,
  6231. defineComponent,
  6232. globals
  6233. };
  6234. /***/ })
  6235. /******/ });
  6236. /************************************************************************/
  6237. /******/ // The module cache
  6238. /******/ var __webpack_module_cache__ = {};
  6239. /******/
  6240. /******/ // The require function
  6241. /******/ function __webpack_require__(moduleId) {
  6242. /******/ // Check if module is in cache
  6243. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  6244. /******/ if (cachedModule !== undefined) {
  6245. /******/ return cachedModule.exports;
  6246. /******/ }
  6247. /******/ // Create a new module (and put it into the cache)
  6248. /******/ var module = __webpack_module_cache__[moduleId] = {
  6249. /******/ id: moduleId,
  6250. /******/ loaded: false,
  6251. /******/ exports: {}
  6252. /******/ };
  6253. /******/
  6254. /******/ // Execute the module function
  6255. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  6256. /******/
  6257. /******/ // Flag the module as loaded
  6258. /******/ module.loaded = true;
  6259. /******/
  6260. /******/ // Return the exports of the module
  6261. /******/ return module.exports;
  6262. /******/ }
  6263. /******/
  6264. /************************************************************************/
  6265. /******/ /* webpack/runtime/compat get default export */
  6266. /******/ (() => {
  6267. /******/ // getDefaultExport function for compatibility with non-harmony modules
  6268. /******/ __webpack_require__.n = (module) => {
  6269. /******/ var getter = module && module.__esModule ?
  6270. /******/ () => (module['default']) :
  6271. /******/ () => (module);
  6272. /******/ __webpack_require__.d(getter, { a: getter });
  6273. /******/ return getter;
  6274. /******/ };
  6275. /******/ })();
  6276. /******/
  6277. /******/ /* webpack/runtime/define property getters */
  6278. /******/ (() => {
  6279. /******/ // define getter functions for harmony exports
  6280. /******/ __webpack_require__.d = (exports, definition) => {
  6281. /******/ for(var key in definition) {
  6282. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  6283. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  6284. /******/ }
  6285. /******/ }
  6286. /******/ };
  6287. /******/ })();
  6288. /******/
  6289. /******/ /* webpack/runtime/global */
  6290. /******/ (() => {
  6291. /******/ __webpack_require__.g = (function() {
  6292. /******/ if (typeof globalThis === 'object') return globalThis;
  6293. /******/ try {
  6294. /******/ return this || new Function('return this')();
  6295. /******/ } catch (e) {
  6296. /******/ if (typeof window === 'object') return window;
  6297. /******/ }
  6298. /******/ })();
  6299. /******/ })();
  6300. /******/
  6301. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  6302. /******/ (() => {
  6303. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  6304. /******/ })();
  6305. /******/
  6306. /******/ /* webpack/runtime/make namespace object */
  6307. /******/ (() => {
  6308. /******/ // define __esModule on exports
  6309. /******/ __webpack_require__.r = (exports) => {
  6310. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  6311. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  6312. /******/ }
  6313. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  6314. /******/ };
  6315. /******/ })();
  6316. /******/
  6317. /******/ /* webpack/runtime/node module decorator */
  6318. /******/ (() => {
  6319. /******/ __webpack_require__.nmd = (module) => {
  6320. /******/ module.paths = [];
  6321. /******/ if (!module.children) module.children = [];
  6322. /******/ return module;
  6323. /******/ };
  6324. /******/ })();
  6325. /******/
  6326. /************************************************************************/
  6327. var __webpack_exports__ = {};
  6328. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  6329. (() => {
  6330. "use strict";
  6331. /*!***********************************!*\
  6332. !*** ./resources/js/dashboard.js ***!
  6333. \***********************************/
  6334. __webpack_require__.r(__webpack_exports__);
  6335. /* harmony import */ var riot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! riot */ "./node_modules/riot/riot.esm.js");
  6336. /* harmony import */ var _components_buckets_riot__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/buckets.riot */ "./resources/js/components/buckets.riot");
  6337. // register components for buckets
  6338. riot__WEBPACK_IMPORTED_MODULE_1__.register('app-buckets', _components_buckets_riot__WEBPACK_IMPORTED_MODULE_0__.default);
  6339. riot__WEBPACK_IMPORTED_MODULE_1__.mount('app-buckets');
  6340. })();
  6341. /******/ })()
  6342. ;