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.

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