@startlibs/utils 1.0.0-alpha-7o2 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,87 +1,48 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
7
- var _regeneratorRuntime = require('@babel/runtime/regenerator');
8
- var _awaitAsyncGenerator = require('@babel/runtime/helpers/awaitAsyncGenerator');
9
- var _wrapAsyncGenerator = require('@babel/runtime/helpers/wrapAsyncGenerator');
10
- var _times = require('lodash/fp/times');
11
- var _identity = require('lodash/fp/identity');
12
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
13
- var _objectSpread = require('@babel/runtime/helpers/objectSpread');
14
- var _isPlainObject = require('lodash/fp/isPlainObject');
15
- var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
16
- var _fromPairs = require('lodash/fp/fromPairs');
17
- var _isFinite = require('lodash/fp/isFinite');
18
- var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
19
- var _typeof = require('@babel/runtime/helpers/typeof');
20
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
21
- var _find = require('lodash/fp/find');
22
- var _reverse = require('lodash/fp/reverse');
23
- var _isEqual = require('lodash/fp/isEqual');
24
- var _isFunction = require('lodash/fp/isFunction');
25
- var _get = require('lodash/fp/get');
26
- var _unset = require('lodash/fp/unset');
27
- var polished = require('polished');
28
- var styled = require('styled-components');
29
- var createEmotion = require('create-emotion');
30
- var _flow = require('lodash/fp/flow');
31
- var _without = require('lodash/fp/without');
32
- var _map = require('lodash/fp/map');
33
- var _filter = require('lodash/fp/filter');
34
- var _each = require('lodash/fp/each');
35
- var _concat = require('lodash/fp/concat');
36
- var _assign = require('lodash/fp/assign');
37
- var _2 = require('lodash/fp/__');
38
- var _set = require('lodash/fp/set');
39
- var _update = require('lodash/fp/update');
40
- var _toPath = require('lodash/fp/toPath');
41
- var _pullAt = require('lodash/fp/pullAt');
42
- var _curry = require('lodash/fp/curry');
43
- var _last = require('lodash/fp/last');
44
-
45
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
46
-
47
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
48
- var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
49
- var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
50
- var _awaitAsyncGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_awaitAsyncGenerator);
51
- var _wrapAsyncGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_wrapAsyncGenerator);
52
- var _times__default = /*#__PURE__*/_interopDefaultLegacy(_times);
53
- var _identity__default = /*#__PURE__*/_interopDefaultLegacy(_identity);
54
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
55
- var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
56
- var _isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(_isPlainObject);
57
- var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
58
- var _fromPairs__default = /*#__PURE__*/_interopDefaultLegacy(_fromPairs);
59
- var _isFinite__default = /*#__PURE__*/_interopDefaultLegacy(_isFinite);
60
- var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
61
- var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
62
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
63
- var _find__default = /*#__PURE__*/_interopDefaultLegacy(_find);
64
- var _reverse__default = /*#__PURE__*/_interopDefaultLegacy(_reverse);
65
- var _isEqual__default = /*#__PURE__*/_interopDefaultLegacy(_isEqual);
66
- var _isFunction__default = /*#__PURE__*/_interopDefaultLegacy(_isFunction);
67
- var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
68
- var _unset__default = /*#__PURE__*/_interopDefaultLegacy(_unset);
69
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
70
- var createEmotion__default = /*#__PURE__*/_interopDefaultLegacy(createEmotion);
71
- var _flow__default = /*#__PURE__*/_interopDefaultLegacy(_flow);
72
- var _without__default = /*#__PURE__*/_interopDefaultLegacy(_without);
73
- var _map__default = /*#__PURE__*/_interopDefaultLegacy(_map);
74
- var _filter__default = /*#__PURE__*/_interopDefaultLegacy(_filter);
75
- var _each__default = /*#__PURE__*/_interopDefaultLegacy(_each);
76
- var _concat__default = /*#__PURE__*/_interopDefaultLegacy(_concat);
77
- var _assign__default = /*#__PURE__*/_interopDefaultLegacy(_assign);
78
- var _2__default = /*#__PURE__*/_interopDefaultLegacy(_2);
79
- var _set__default = /*#__PURE__*/_interopDefaultLegacy(_set);
80
- var _update__default = /*#__PURE__*/_interopDefaultLegacy(_update);
81
- var _toPath__default = /*#__PURE__*/_interopDefaultLegacy(_toPath);
82
- var _pullAt__default = /*#__PURE__*/_interopDefaultLegacy(_pullAt);
83
- var _curry__default = /*#__PURE__*/_interopDefaultLegacy(_curry);
84
- var _last__default = /*#__PURE__*/_interopDefaultLegacy(_last);
1
+ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
3
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
4
+ import _awaitAsyncGenerator from '@babel/runtime/helpers/awaitAsyncGenerator';
5
+ import _wrapAsyncGenerator from '@babel/runtime/helpers/wrapAsyncGenerator';
6
+ import _times from 'lodash/fp/times';
7
+ import _identity from 'lodash/fp/identity';
8
+ import React, { useMemo, useEffect } from 'react';
9
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
10
+ import _objectSpread from '@babel/runtime/helpers/objectSpread';
11
+ import _isPlainObject from 'lodash/fp/isPlainObject';
12
+ import { callIfFunction as callIfFunction$1, scrollWidth as scrollWidth$1, _s as _s$1, normalizePress as normalizePress$1 } from '@startlibs/utils';
13
+ import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
14
+ import _typeof from '@babel/runtime/helpers/typeof';
15
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
16
+ import _find from 'lodash/fp/find';
17
+ import _reverse from 'lodash/fp/reverse';
18
+ import _isEqual from 'lodash/fp/isEqual';
19
+ import _isFunction from 'lodash/fp/isFunction';
20
+ import _get from 'lodash/fp/get';
21
+ import _unset from 'lodash/fp/unset';
22
+ import { darken } from 'polished';
23
+ import styled, { css } from 'styled-components';
24
+ import createEmotion from 'create-emotion';
25
+ import _flow from 'lodash/fp/flow';
26
+ import _without from 'lodash/fp/without';
27
+ import _flatMap from 'lodash/fp/flatMap';
28
+ import _mapValues from 'lodash/fp/mapValues';
29
+ import _map from 'lodash/fp/map';
30
+ import _filter from 'lodash/fp/filter';
31
+ import _each from 'lodash/fp/each';
32
+ import _concat from 'lodash/fp/concat';
33
+ import _assign from 'lodash/fp/assign';
34
+ import _2 from 'lodash/fp/__';
35
+ import _set from 'lodash/fp/set';
36
+ import _update from 'lodash/fp/update';
37
+ import _toPath from 'lodash/fp/toPath';
38
+ import _pullAt from 'lodash/fp/pullAt';
39
+ import _curry from 'lodash/fp/curry';
40
+ import _last from 'lodash/fp/last';
41
+ import _fromPairs from 'lodash/fp/fromPairs';
42
+ import _isFinite from 'lodash/fp/isFinite';
43
+ import _isString from 'lodash/fp/isString';
44
+ import _isNumber from 'lodash/fp/isNumber';
45
+ import _padCharsEnd from 'lodash/fp/padCharsEnd';
85
46
 
86
47
  var createPromiseResolverPair = function createPromiseResolverPair() {
87
48
  var res, rej;
@@ -91,17 +52,31 @@ var createPromiseResolverPair = function createPromiseResolverPair() {
91
52
  });
92
53
  return [promise, [res, rej]];
93
54
  };
55
+ var createSimplePromiseLock = function createSimplePromiseLock() {
56
+ var promiseQueue = Promise.resolve();
57
+ return function () {
58
+ var resolve = _identity;
59
+ var nextPromise = new Promise(function (res) {
60
+ resolve = res;
61
+ });
62
+ var prevPromise = promiseQueue;
63
+ promiseQueue = nextPromise;
64
+ return prevPromise.then(function () {
65
+ return resolve;
66
+ });
67
+ };
68
+ };
94
69
 
95
70
  function createSinglePromiseQueue() {
96
71
  return _createSinglePromiseQueue.apply(this, arguments);
97
72
  }
98
73
 
99
74
  function _createSinglePromiseQueue() {
100
- _createSinglePromiseQueue = _wrapAsyncGenerator__default['default'](
75
+ _createSinglePromiseQueue = _wrapAsyncGenerator(
101
76
  /*#__PURE__*/
102
- _regeneratorRuntime__default['default'].mark(function _callee() {
77
+ _regeneratorRuntime.mark(function _callee() {
103
78
  var lastPromise, resolve;
104
- return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
79
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
105
80
  while (1) {
106
81
  switch (_context.prev = _context.next) {
107
82
  case 0:
@@ -111,10 +86,10 @@ function _createSinglePromiseQueue() {
111
86
  case 1:
112
87
 
113
88
  _context.next = 4;
114
- return _awaitAsyncGenerator__default['default'](lastPromise);
89
+ return _awaitAsyncGenerator(lastPromise);
115
90
 
116
91
  case 4:
117
- resolve = _identity__default['default'];
92
+ resolve = _identity;
118
93
  lastPromise = new Promise(function (res) {
119
94
  resolve = res;
120
95
  });
@@ -140,9 +115,9 @@ function createPromiseQueue() {
140
115
  }
141
116
 
142
117
  function _createPromiseQueue() {
143
- _createPromiseQueue = _wrapAsyncGenerator__default['default'](
118
+ _createPromiseQueue = _wrapAsyncGenerator(
144
119
  /*#__PURE__*/
145
- _regeneratorRuntime__default['default'].mark(function _callee3() {
120
+ _regeneratorRuntime.mark(function _callee3() {
146
121
  var parallel,
147
122
  queues,
148
123
  promises,
@@ -150,17 +125,17 @@ function _createPromiseQueue() {
150
125
  getNextAvailableLock,
151
126
  lock,
152
127
  _args3 = arguments;
153
- return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
128
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
154
129
  while (1) {
155
130
  switch (_context3.prev = _context3.next) {
156
131
  case 0:
157
132
  parallel = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 1;
158
- queues = _times__default['default'](createSinglePromiseQueue, parallel);
133
+ queues = _times(createSinglePromiseQueue, parallel);
159
134
  promises = queues.map(function (q) {
160
135
  return q.next();
161
136
  });
162
137
  _context3.next = 5;
163
- return _awaitAsyncGenerator__default['default'](Promise.all(promises));
138
+ return _awaitAsyncGenerator(Promise.all(promises));
164
139
 
165
140
  case 5:
166
141
  locks = _context3.sent;
@@ -168,11 +143,11 @@ function _createPromiseQueue() {
168
143
  getNextAvailableLock =
169
144
  /*#__PURE__*/
170
145
  function () {
171
- var _ref = _asyncToGenerator__default['default'](
146
+ var _ref = _asyncToGenerator(
172
147
  /*#__PURE__*/
173
- _regeneratorRuntime__default['default'].mark(function _callee2() {
148
+ _regeneratorRuntime.mark(function _callee2() {
174
149
  var index, lock;
175
- return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
150
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
176
151
  while (1) {
177
152
  switch (_context2.prev = _context2.next) {
178
153
  case 0:
@@ -213,7 +188,7 @@ function _createPromiseQueue() {
213
188
  case 7:
214
189
 
215
190
  _context3.next = 10;
216
- return _awaitAsyncGenerator__default['default'](getNextAvailableLock());
191
+ return _awaitAsyncGenerator(getNextAvailableLock());
217
192
 
218
193
  case 10:
219
194
  lock = _context3.sent;
@@ -234,6 +209,32 @@ function _createPromiseQueue() {
234
209
  return _createPromiseQueue.apply(this, arguments);
235
210
  }
236
211
 
212
+ var promiseMapReduce = function promiseMapReduce(arr, callback) {
213
+ return arr.reduce(function (acc, item) {
214
+ return acc.then(function (seq) {
215
+ return callback(item).then(function (res) {
216
+ return _toConsumableArray(seq).concat([res]);
217
+ });
218
+ });
219
+ }, Promise.resolve([]));
220
+ };
221
+ var asyncDebounce = function asyncDebounce(fn) {
222
+ var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
223
+ var timeout;
224
+ return function () {
225
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
226
+ args[_key] = arguments[_key];
227
+ }
228
+
229
+ clearTimeout(timeout);
230
+ return new Promise(function (res) {
231
+ timeout = setTimeout(function () {
232
+ return res(fn.apply(void 0, args));
233
+ }, delay);
234
+ });
235
+ };
236
+ };
237
+
237
238
  var getClosestOffsetScroll = function getClosestOffsetScroll(node) {
238
239
  if (!node) {
239
240
  return document.body;
@@ -388,718 +389,731 @@ function fixMediaQuery() {
388
389
  }
389
390
  }
390
391
 
391
- var formatPath = function formatPath() {
392
- for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
393
- paths[_key] = arguments[_key];
394
- }
392
+ var resolveFetch =
393
+ /*#__PURE__*/
394
+ function () {
395
+ var _ref = _asyncToGenerator(
396
+ /*#__PURE__*/
397
+ _regeneratorRuntime.mark(function _callee(url, fetchOptions) {
398
+ var response, text, json;
399
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
400
+ while (1) {
401
+ switch (_context.prev = _context.next) {
402
+ case 0:
403
+ _context.prev = 0;
404
+ _context.next = 3;
405
+ return fetch(url, _objectSpread({
406
+ credentials: 'same-origin'
407
+ }, fetchOptions));
395
408
 
396
- return paths.map(function (path) {
397
- return Array.isArray(path) ? path.join('.') : path ? path.toString().replace(/\[/g, '.').replace(/]/g, '') : '';
398
- }).filter(function (_) {
399
- return _;
400
- }).join('.');
401
- };
402
- var identityFn = function identityFn() {
403
- var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
404
- return function () {
405
- for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
406
- e[_key2] = arguments[_key2];
407
- }
409
+ case 3:
410
+ response = _context.sent;
411
+ _context.next = 6;
412
+ return response.text();
408
413
 
409
- return e[n];
410
- };
411
- };
412
- var will = function will(fn) {
413
- for (var _len3 = arguments.length, props = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
414
- props[_key3 - 1] = arguments[_key3];
415
- }
414
+ case 6:
415
+ text = _context.sent;
416
+ _context.prev = 7;
417
+ json = JSON.parse(text);
418
+ return _context.abrupt("return", [json, response]);
416
419
 
417
- return function () {
418
- for (var _len4 = arguments.length, more = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
419
- more[_key4] = arguments[_key4];
420
- }
420
+ case 12:
421
+ _context.prev = 12;
422
+ _context.t0 = _context["catch"](7);
423
+ return _context.abrupt("return", [text, response]);
421
424
 
422
- return fn.apply(void 0, props.concat(more));
423
- };
424
- };
425
- var unWill = function unWill(fn) {
426
- for (var _len5 = arguments.length, props = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
427
- props[_key5 - 1] = arguments[_key5];
428
- }
425
+ case 15:
426
+ _context.next = 20;
427
+ break;
429
428
 
430
- return function () {
431
- return fn.apply(void 0, props);
432
- };
433
- };
434
- var lazyValue = function lazyValue(v) {
435
- return function () {
436
- return v;
437
- };
438
- };
439
- var callIfFunction = function callIfFunction(prop) {
440
- for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
441
- args[_key6 - 1] = arguments[_key6];
442
- }
429
+ case 17:
430
+ _context.prev = 17;
431
+ _context.t1 = _context["catch"](0);
432
+ return _context.abrupt("return", [_context.t1, false]);
443
433
 
444
- return typeof prop === "function" ? prop.apply(void 0, args) : prop;
445
- };
446
- var callIfFunctions = function callIfFunctions(prop) {
447
- for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
448
- args[_key7 - 1] = arguments[_key7];
449
- }
434
+ case 20:
435
+ case "end":
436
+ return _context.stop();
437
+ }
438
+ }
439
+ }, _callee, this, [[0, 17], [7, 12]]);
440
+ }));
450
441
 
451
- return typeof prop === "function" ? prop.apply(void 0, _toConsumableArray__default['default'](args.map(function (e) {
452
- return callIfFunction(e);
453
- }))) : prop;
454
- };
455
- var callMany = function callMany() {
456
- for (var _len8 = arguments.length, many = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
457
- many[_key8] = arguments[_key8];
458
- }
442
+ return function resolveFetch(_x, _x2) {
443
+ return _ref.apply(this, arguments);
444
+ };
445
+ }();
459
446
 
460
- return function () {
461
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
462
- args[_key9] = arguments[_key9];
463
- }
447
+ var innerFetcher =
448
+ /*#__PURE__*/
449
+ function () {
450
+ var _ref2 = _asyncToGenerator(
451
+ /*#__PURE__*/
452
+ _regeneratorRuntime.mark(function _callee2(url, fetchOptions) {
453
+ var _ref3, _ref4, data, response;
464
454
 
465
- return many.map(function (_) {
466
- return callIfFunction.apply(void 0, [_].concat(args));
467
- });
468
- };
469
- };
470
- var ifUndefined = function ifUndefined(v) {
471
- for (var _len10 = arguments.length, or = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) {
472
- or[_key10 - 1] = arguments[_key10];
473
- }
455
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
456
+ while (1) {
457
+ switch (_context2.prev = _context2.next) {
458
+ case 0:
459
+ _context2.next = 2;
460
+ return resolveFetch(url, fetchOptions);
474
461
 
475
- return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined.apply(void 0, [or[0]].concat(_toConsumableArray__default['default'](or.slice(1))));
476
- };
477
- var using = function using() {
478
- for (var _len11 = arguments.length, v = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
479
- v[_key11] = arguments[_key11];
480
- }
462
+ case 2:
463
+ _ref3 = _context2.sent;
464
+ _ref4 = _slicedToArray(_ref3, 2);
465
+ data = _ref4[0];
466
+ response = _ref4[1];
481
467
 
482
- return function (fn) {
483
- return fn.apply(void 0, _toConsumableArray__default['default'](v.map(function (v) {
484
- return callIfFunction(v);
485
- })));
486
- };
487
- };
488
- var stopPropagation = function stopPropagation(cb) {
489
- return function (e) {
490
- e && e.stopPropagation && e.stopPropagation();
491
- callIfFunction(cb, e);
492
- };
493
- };
494
- var preventDefault = function preventDefault(cb) {
495
- return function (e) {
496
- e && e.preventDefault && e.preventDefault();
497
- callIfFunction(cb, e);
498
- };
499
- };
500
- var constrainEvent = function constrainEvent(cb) {
501
- return function (e) {
502
- e === null || e === void 0 ? void 0 : e.preventDefault();
503
- e.stopPropagation();
504
- callIfFunction(cb, e);
505
- };
506
- };
507
- var mapGetOrSet = function mapGetOrSet(map, key, value) {
508
- return (map.has(key) ? map : map.set(key, value)).get(key);
509
- };
510
- var intToHour = function intToHour(hour) {
511
- var autoFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
512
- if (hour === undefined || hour === null) return '';
468
+ if (!(!response || response.status >= 400)) {
469
+ _context2.next = 10;
470
+ break;
471
+ }
513
472
 
514
- if (hour === 0) {
515
- return "00:00";
516
- } //const [h,m] = ('000' + hour.toString().replace(":","")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2').split(":")
473
+ throw [data, response];
517
474
 
475
+ case 10:
476
+ return _context2.abrupt("return", [data, response]);
518
477
 
519
- var h = hour.toString().replace(":", "").slice(-4, -2);
520
- var m = hour.toString().replace(":", "").slice(-2);
478
+ case 11:
479
+ case "end":
480
+ return _context2.stop();
481
+ }
482
+ }
483
+ }, _callee2, this);
484
+ }));
521
485
 
522
- if (callIfFunction(autoFill, hour)) {
523
- return ('000' + (h ? parseInt(h, 10) % 24 : '') + m).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
524
- }
486
+ return function innerFetcher(_x3, _x4) {
487
+ return _ref2.apply(this, arguments);
488
+ };
489
+ }();
525
490
 
526
- if (h) return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
527
- return m;
491
+ var queryStringToObj = function queryStringToObj() {
492
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.search;
493
+ return Object.fromEntries(new URLSearchParams(str).entries());
528
494
  };
529
- var formatHour = function formatHour() {
530
- var hour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
495
+ var addQueryString = function addQueryString() {
496
+ var existingUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
497
+ var obj = arguments.length > 1 ? arguments[1] : undefined;
531
498
 
532
- if (!hour) {
533
- return "";
499
+ var _existingUrl$split = existingUrl.split('?'),
500
+ _existingUrl$split2 = _slicedToArray(_existingUrl$split, 2),
501
+ onlyUrl = _existingUrl$split2[0],
502
+ otherQueryString = _existingUrl$split2[1];
503
+
504
+ var params = new URLSearchParams(otherQueryString);
505
+
506
+ for (var key in obj) {
507
+ var value = obj[key];
508
+
509
+ if (value === null) {
510
+ params.delete(key);
511
+ } else {
512
+ params.set(key, obj[key]);
513
+ }
534
514
  }
535
515
 
536
- var h = hour.toString().replace(":", "").slice(-4, -2);
537
- var m = hour.toString().replace(":", "").slice(-2);
516
+ var paramsStr = params.toString();
538
517
 
539
- if (!h && parseInt(m) < 24 && !_isFinite__default['default'](hour)) {
540
- return m + ":00";
541
- } else if (h) {
542
- return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
518
+ if (!paramsStr) {
519
+ return onlyUrl;
543
520
  }
544
521
 
545
- return ('000' + hour.toString().replace(":", "")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
522
+ return onlyUrl + '?' + paramsStr;
546
523
  };
547
- var willRafThrottle = function willRafThrottle() {
548
- var ticking = false;
549
- return function (fn) {
550
- if (!ticking) {
551
- window.requestAnimationFrame(function () {
552
- fn();
553
- ticking = false;
554
- });
555
- ticking = true;
556
- }
557
- };
524
+
525
+ var cleanNulls = function cleanNulls(str) {
526
+ return str.replace(/\0/g, '');
558
527
  };
559
- var rafThrottle = function rafThrottle(fn) {
560
- var throttle = willRafThrottle();
561
- return function () {
562
- throttle(fn);
563
- };
564
- };
565
- var intsToHour = function intsToHour(_ref) {
566
- var open = _ref.open,
567
- close = _ref.close;
568
- return intToHour(open) + ' - ' + intToHour(close);
569
- };
570
- function isSmallDevice() {
571
- var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
572
- var smallDeviceQuery = window.matchMedia ? window.matchMedia("(max-width: ".concat(width + scrollWidth, "px)")) : {
573
- matches: false
574
- };
575
- return smallDeviceQuery.matches;
576
- }
577
- function isHighDensity() {
578
- return window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches) || window.devicePixelRatio && window.devicePixelRatio > 1.3;
579
- }
580
- function isRetina() {
581
- return (window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches) || window.devicePixelRatio && window.devicePixelRatio >= 2) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
582
- }
583
- function isMobile() {
584
- var check = false;
585
528
 
586
- if (typeof navigator === 'undefined') {
587
- return false;
588
- }
589
-
590
- (function (a) {
591
- if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ -/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
592
- })(navigator.userAgent || navigator.vendor || window['opera']);
529
+ var postFetcherWithResponse =
530
+ /*#__PURE__*/
531
+ function () {
532
+ var _ref5 = _asyncToGenerator(
533
+ /*#__PURE__*/
534
+ _regeneratorRuntime.mark(function _callee3(url, jsonOrForm) {
535
+ var fetchOptions,
536
+ _args3 = arguments;
537
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
538
+ while (1) {
539
+ switch (_context3.prev = _context3.next) {
540
+ case 0:
541
+ fetchOptions = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
542
+ return _context3.abrupt("return", innerFetcher(url, _objectSpread({
543
+ method: 'POST',
544
+ body: typeof jsonOrForm === 'string' ? jsonOrForm : !jsonOrForm || jsonOrForm.constructor === window.FormData || jsonOrForm.constructor === window.File ? jsonOrForm : cleanNulls(JSON.stringify(jsonOrForm))
545
+ }, fetchOptions, {
546
+ headers: _isPlainObject(fetchOptions.headers) || !fetchOptions.headers ? _objectSpread({}, jsonOrForm && (typeof jsonOrForm === 'string' || jsonOrForm.constructor === window.FormData) ? {} : {
547
+ 'Content-Type': 'application/json; charset=UTF-8'
548
+ }, {
549
+ 'X-Requested-With': 'XMLHttpRequest'
550
+ }, fetchOptions.headers) : fetchOptions.headers
551
+ })));
593
552
 
594
- return check;
595
- }
596
- var isPWA = function isPWA() {
597
- return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches;
598
- };
599
- function isTouchDevice() {
600
- return window.document && 'ontouchstart' in window.document.documentElement;
601
- }
602
- var isIOS = function isIOS() {
603
- return /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
604
- };
605
- var isIPad = function isIPad() {
606
- return navigator.userAgent.match(/iPad/i) != null;
607
- };
608
- var getNumberInputType2 = function getNumberInputType2() {
609
- var isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
610
- return isMobile() ? isIOS ? "tel" : "number" : "text";
611
- };
612
- var getNumberInputType = function getNumberInputType() {
613
- return "tel";
614
- };
615
- function addHttp(s) {
616
- s = (s || '').trim();
553
+ case 2:
554
+ case "end":
555
+ return _context3.stop();
556
+ }
557
+ }
558
+ }, _callee3, this);
559
+ }));
617
560
 
618
- if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) {
619
- return s;
620
- } else {
621
- return 'http://' + s;
622
- }
623
- }
624
- var protocols = "(^|\\s|\xA0)(https?://)?(www\\.)?";
625
- var subdomains = '([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]?\\.)*';
626
- var domain = '(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\\.[a-zA-Z]{2,3})';
627
- var resource = "[\xA1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFa-zA-Z0-9-._~:/?#%[\\]@!$&'()*+,;=]*";
628
- var linkRegex = new RegExp(protocols + subdomains + domain + resource);
629
- function isUrl(url) {
630
- return linkRegex.test(addHttp(url));
631
- }
632
- function ellipsis() {
633
- var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
634
- var length = arguments.length > 1 ? arguments[1] : undefined;
561
+ return function postFetcherWithResponse(_x5, _x6) {
562
+ return _ref5.apply(this, arguments);
563
+ };
564
+ }();
565
+ var getFetcherWithResponse =
566
+ /*#__PURE__*/
567
+ function () {
568
+ var _ref6 = _asyncToGenerator(
569
+ /*#__PURE__*/
570
+ _regeneratorRuntime.mark(function _callee4(url, jsonParams, fetchOptions) {
571
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
572
+ while (1) {
573
+ switch (_context4.prev = _context4.next) {
574
+ case 0:
575
+ return _context4.abrupt("return", innerFetcher(addQueryString(url, jsonParams), _objectSpread({
576
+ method: 'GET'
577
+ }, fetchOptions)));
635
578
 
636
- if (str.length > length) {
637
- var words = str.slice(0, length).split(' ');
638
- if (str.split(' ').indexOf(words[words.length - 1]) < 0) words = words.slice(0, words.length - 1);
639
- return words.join(' ') + '...';
640
- } else return str;
641
- }
642
- function safeNewLineToBr(str) {
643
- return (str || "").replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/\n+/g, '<br/>');
644
- }
579
+ case 1:
580
+ case "end":
581
+ return _context4.stop();
582
+ }
583
+ }
584
+ }, _callee4, this);
585
+ }));
645
586
 
646
- function padGroups(pattern, value) {
647
- return pattern.split('').reduce(function (_ref2, char, i) {
648
- var _ref3 = _slicedToArray__default['default'](_ref2, 2),
649
- acc = _ref3[0],
650
- value = _ref3[1];
587
+ return function getFetcherWithResponse(_x7, _x8, _x9) {
588
+ return _ref6.apply(this, arguments);
589
+ };
590
+ }();
591
+ var postFetcher =
592
+ /*#__PURE__*/
593
+ function () {
594
+ var _ref7 = _asyncToGenerator(
595
+ /*#__PURE__*/
596
+ _regeneratorRuntime.mark(function _callee5(url, json, options) {
597
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
598
+ while (1) {
599
+ switch (_context5.prev = _context5.next) {
600
+ case 0:
601
+ return _context5.abrupt("return", postFetcherWithResponse(url, json, options).then(function (_ref8) {
602
+ var _ref9 = _slicedToArray(_ref8, 1),
603
+ json = _ref9[0];
651
604
 
652
- if (char === '0') {
653
- var shouldHave = pattern.slice(i).search(/[^0#?*]/);
654
- var has = value.slice(i).search(/\D/);
605
+ return json;
606
+ }));
655
607
 
656
- if (has > 0 && shouldHave > has) {
657
- return [acc.concat('0'), acc.join('') + '0' + value.slice(i)];
658
- } else {
659
- return [acc.concat(value[i]), value];
608
+ case 1:
609
+ case "end":
610
+ return _context5.stop();
611
+ }
660
612
  }
661
- } else {
662
- return [acc.concat(value[i]), value];
663
- }
664
- }, [[], value])[0].join('');
665
- }
666
-
667
- var digitsToPattern = function digitsToPattern(patternWithLimit, optValue) {
668
- var value = optValue || "";
669
- if (patternWithLimit[0] === '>' && Number(patternWithLimit.replace(/^>(\d*).*/g, "$1")) > value.length) return value;
670
- var pattern = patternWithLimit.replace(/^>\d+/, '');
671
- var digits = padGroups(pattern, value).replace(/\D/g, '');
672
- var totalRequired = pattern.split(/[0#]/).length - 1;
673
- var totalOptional = pattern.split(/[?*]/).length - 1;
674
- var available = digits.length - totalRequired;
613
+ }, _callee5, this);
614
+ }));
675
615
 
676
- if (available > 0 && totalOptional > 0) {
677
- var _i = 0;
678
- return digitsToPattern(pattern.replace(/\?/g, function () {
679
- return _i++ < available ? '#' : '';
680
- }).replace('*', new Array(Math.max(0, available - _i + 1)).join("#")), value);
681
- }
616
+ return function postFetcher(_x10, _x11, _x12) {
617
+ return _ref7.apply(this, arguments);
618
+ };
619
+ }();
620
+ var getFetcher =
621
+ /*#__PURE__*/
622
+ function () {
623
+ var _ref10 = _asyncToGenerator(
624
+ /*#__PURE__*/
625
+ _regeneratorRuntime.mark(function _callee6(url, json, options) {
626
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
627
+ while (1) {
628
+ switch (_context6.prev = _context6.next) {
629
+ case 0:
630
+ return _context6.abrupt("return", getFetcherWithResponse(url, json, options).then(function (_ref11) {
631
+ var _ref12 = _slicedToArray(_ref11, 1),
632
+ json = _ref12[0];
682
633
 
683
- var i = 0;
684
- return pattern.replace(/^>\d*/, '').split('').reduce(function (acc, char) {
685
- if (!digits[Math.max(i - 1, 0)] || char === '?' || char === '*') return acc;
634
+ return json;
635
+ }));
686
636
 
687
- if (char === '#' || char === '0') {
688
- return acc + (digits[i++] || '');
689
- } else {
690
- return acc + char;
691
- }
692
- }, '');
693
- };
694
- var normalizeTouch = function normalizeTouch(fn, endFn) {
695
- return function (e) {
696
- var touch = e.touches[0];
637
+ case 1:
638
+ case "end":
639
+ return _context6.stop();
640
+ }
641
+ }
642
+ }, _callee6, this);
643
+ }));
697
644
 
698
- if (e.touches.length > 1 && e.type !== 'touchend') {
699
- callIfFunction(endFn, e, touch);
700
- } else {
701
- callIfFunction(fn, e, touch);
702
- }
645
+ return function getFetcher(_x13, _x14, _x15) {
646
+ return _ref10.apply(this, arguments);
703
647
  };
704
- };
705
- var normalizeMouse = function normalizeMouse(fn, endFn) {
706
- return function (e) {
707
- if (e.buttons > 1 && e.type !== 'mouseup') {
708
- callIfFunction(endFn, e, e);
709
- } else {
710
- callIfFunction(fn, e, e);
711
- }
648
+ }();
649
+ var formFetchWithResponse = function formFetchWithResponse(url, options) {
650
+ return function (values, meta) {
651
+ return postFetcherWithResponse(callIfFunction$1(url, meta, values), values, callIfFunction$1(options, meta, values));
712
652
  };
713
653
  };
714
- var normalizePress = function normalizePress(fn, endFn) {
715
- return function (e) {
716
- if (e.touches) {
717
- normalizeTouch(fn, endFn)(e);
718
- } else {
719
- normalizeMouse(fn, endFn)(e);
720
- }
654
+ var formFetch = function formFetch(url, options) {
655
+ return function (values, meta) {
656
+ return postFetcher(callIfFunction$1(url, meta, values), values, callIfFunction$1(options, meta, values));
721
657
  };
722
658
  };
723
- var touchClick = function touchClick(cb) {
724
- var sensibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
725
- return function (e) {
726
- var _e$touches;
727
659
 
728
- if (((_e$touches = e.touches) === null || _e$touches === void 0 ? void 0 : _e$touches.length) !== 1) {
729
- return;
730
- }
660
+ function _templateObject() {
661
+ var data = _taggedTemplateLiteral(["\n ", ""]);
731
662
 
732
- var target = e.target;
733
- var originalX = e.touches[0].screenX;
734
- var originalY = e.touches[0].screenY;
663
+ _templateObject = function _templateObject() {
664
+ return data;
665
+ };
735
666
 
736
- var isInsideBounds = function isInsideBounds(touch) {
737
- return Math.sqrt(Math.pow(originalX - touch.screenX, 2) + Math.pow(originalY - touch.screenY, 2)) < sensibility;
667
+ return data;
668
+ }
669
+ var getColor = function getColor(propsOrColor, hover) {
670
+ if (propsOrColor === undefined) {
671
+ return function (_ref) {
672
+ var theme = _ref.theme;
673
+ return theme.colors.gray150;
738
674
  };
675
+ }
739
676
 
740
- var checkBounds = function checkBounds(e) {
741
- if (e.touches.length !== 1) {
742
- return;
743
- }
744
-
745
- if (!isInsideBounds(e.changedTouches[0])) {
746
- maybeClick();
747
- }
677
+ if (typeof propsOrColor === 'string') {
678
+ return function (_ref2) {
679
+ var theme = _ref2.theme;
680
+ return theme.colors[propsOrColor] || propsOrColor;
748
681
  };
682
+ }
749
683
 
750
- var maybeClick = function maybeClick(e) {
751
- var _e$changedTouches;
684
+ var theme = propsOrColor.theme,
685
+ props = _objectWithoutProperties(propsOrColor, ["theme"]);
752
686
 
753
- target.removeEventListener('touchend', maybeClick);
754
- target.removeEventListener('touchmove', checkBounds);
687
+ if (props.dark) {
688
+ return darken(0.1, getColor(_objectSpread({
689
+ theme: theme
690
+ }, _unset('dark', props))));
691
+ } else if (hover && props.hover) {
692
+ return getColor({
693
+ theme: theme,
694
+ color: props.hover
695
+ });
696
+ } else if (props.color) {
697
+ return theme.colors[props.color] || props.color;
698
+ } else if (props.highlight) {
699
+ return theme.colors.main;
700
+ } else if (props.alert) {
701
+ return theme.colors.alert;
702
+ } else if (props.success) {
703
+ return theme.colors.success;
704
+ } else {
705
+ return theme.colors.gray150;
706
+ }
707
+ };
708
+ var getMargin = function getMargin(enumeratedMargins) {
709
+ return function (props) {
710
+ return enumeratedMargins[props.margin] || props.margin || enumeratedMargins['default'] || 0;
711
+ };
712
+ };
713
+ /**
714
+ * Returns the value of `props[path]` or `defaultValue`
715
+ * @example
716
+ * const Button = styled.button`
717
+ * color: ${prop('color', 'red')};
718
+ * `
719
+ */
755
720
 
756
- if ((e === null || e === void 0 ? void 0 : (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches.length) !== 1) {
757
- return;
721
+ var prop = function prop(path, defaultValue) {
722
+ return function () {
723
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
724
+ return _get(path.trim(), props) || defaultValue;
725
+ };
726
+ };
727
+ var customTheme = function customTheme(type) {
728
+ return function () {
729
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
730
+ return _get(["theme", "startlibs", type], props) || '';
731
+ };
732
+ };
733
+ /**
734
+ * Returns `pass` if prop is truthy. Otherwise returns `fail`
735
+ * @example
736
+ * // usage with styled-theme
737
+ * import styled from 'styled-components'
738
+ * import { ifProp } from 'styled-tools'
739
+ * import { palette } from 'styled-theme'
740
+ *
741
+ * const Button = styled.button`
742
+ * background-color: ${ifProp('transparent', 'transparent', palette(0))};
743
+ * color: ${ifProp(['transparent', 'accent'], palette('secondary', 0))};
744
+ * font-size: ${ifProp({ size: 'large' }, '20px', ifProp({ size: 'medium' }, '16px', '12px'))};
745
+ *`
746
+ */
747
+
748
+ var ifProp = function ifProp(path, pass, fail) {
749
+ if (pass && !_isFunction(pass)) {
750
+ // old version
751
+ return function () {
752
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
753
+ var result = false;
754
+
755
+ if (Array.isArray(path)) {
756
+ result = path.every(function (p) {
757
+ return testSinglePath(props, p);
758
+ });
759
+ } else if (_typeof(path) === 'object') {
760
+ result = !Object.entries(path).find(function (_ref3) {
761
+ var _ref4 = _slicedToArray(_ref3, 2),
762
+ k = _ref4[0],
763
+ v = _ref4[1];
764
+
765
+ return props[k] !== v;
766
+ });
767
+ } else {
768
+ result = testSinglePath(props, path);
758
769
  }
759
770
 
760
- if (isInsideBounds(e.changedTouches[0])) {
761
- e.preventDefault();
762
- cb(e);
763
- }
771
+ return result ? pass : fail;
764
772
  };
773
+ } else {
774
+ return function () {
775
+ for (var _len = arguments.length, argsTrue = new Array(_len), _key = 0; _key < _len; _key++) {
776
+ argsTrue[_key] = arguments[_key];
777
+ }
765
778
 
766
- target.addEventListener('touchend', maybeClick);
767
- target.addEventListener('touchmove', checkBounds);
768
- };
769
- };
770
- var isEmptyHtml = function isEmptyHtml() {
771
- var __html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
779
+ var check = pass || _identity;
772
780
 
773
- var a = document.createElement('span');
774
- a.innerHTML = __html;
775
- return a.textContent.replace(/\s/g, '').length === 0;
776
- };
777
- var getScrollParent = function getScrollParent(node) {
778
- if (!node) {
779
- return window;
780
- }
781
+ var fn = function fn(props) {
782
+ return check(_get(path, props)) ? css.apply(void 0, argsTrue) : '';
783
+ };
781
784
 
782
- var overflowY = window.getComputedStyle(node).overflowY;
783
- var isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
785
+ fn.orElse = function () {
786
+ for (var _len2 = arguments.length, argsFalse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
787
+ argsFalse[_key2] = arguments[_key2];
788
+ }
784
789
 
785
- if (isScrollable && (node.scrollHeight > node.clientHeight || overflowY === 'scroll')) {
786
- return node;
787
- } else {
788
- return getScrollParent(node.offsetParent);
790
+ return function (props) {
791
+ return check(_get(path, props)) ? css.apply(void 0, argsTrue) : css.apply(void 0, argsFalse);
792
+ };
793
+ };
794
+
795
+ return fn;
796
+ };
789
797
  }
790
798
  };
791
- var scrollIntoViewWithOffset = function scrollIntoViewWithOffset(el, offset) {
792
- var scrollOffset = getScrollParent(el);
793
- var scrollY = scrollOffset === window ? window.pageYOffset : scrollOffset.scrollTop;
794
- var elTop = el.getBoundingClientRect().top;
795
- var computedOffset = callIfFunction(offset, elTop > 0);
796
- var y = el.getBoundingClientRect().top + scrollY + computedOffset;
797
- scrollOffset.scrollTo({
798
- top: y,
799
- behavior: 'smooth'
800
- });
801
- };
802
- var isElementInView = function isElementInView(element) {
803
- if (!element) return false;
804
- if (1 !== element.nodeType) return false;
805
- var html = document.documentElement;
806
- var rect = element.getBoundingClientRect();
807
- return !!rect && rect.bottom >= 0 && rect.right >= 0 && rect.left <= html.clientWidth && rect.top <= html.clientHeight;
799
+ var ifPropEquals = function ifPropEquals(path, str) {
800
+ return ifProp(path, _isEqual(str));
808
801
  };
809
- var timerPromise = function timerPromise(time) {
810
- return new Promise(function (res) {
811
- return setTimeout(res, time);
802
+ var ifNotProp = function ifNotProp(path) {
803
+ return ifProp(path, function (v) {
804
+ return !v;
812
805
  });
813
806
  };
814
- var i = 0;
815
- var getUID = function getUID() {
816
- return Date.now().toString(36) + Math.random().toString(36).slice(2) + (i++).toString(36);
817
- };
818
- var getUrlParams = function getUrlParams() {
819
- return _fromPairs__default['default'](Array.from(new URLSearchParams(location.search).entries()));
820
- };
821
807
 
822
- var resolveFetch =
823
- /*#__PURE__*/
824
- function () {
825
- var _ref = _asyncToGenerator__default['default'](
826
- /*#__PURE__*/
827
- _regeneratorRuntime__default['default'].mark(function _callee(url, fetchOptions) {
828
- var response, text, json;
829
- return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
830
- while (1) {
831
- switch (_context.prev = _context.next) {
832
- case 0:
833
- _context.prev = 0;
834
- _context.next = 3;
835
- return fetch(url, _objectSpread__default['default']({
836
- credentials: 'same-origin'
837
- }, fetchOptions));
808
+ var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
809
+ var currentWidth = callIfFunction$1(customWidth);
810
+ return !sizeParis.find(function (_ref5) {
811
+ var _ref6 = _slicedToArray(_ref5, 2),
812
+ size = _ref6[0],
813
+ type = _ref6[1];
838
814
 
839
- case 3:
840
- response = _context.sent;
841
- _context.next = 6;
842
- return response.text();
815
+ if (type === "min-width") {
816
+ return currentWidth < size;
817
+ }
843
818
 
844
- case 6:
845
- text = _context.sent;
846
- _context.prev = 7;
847
- json = JSON.parse(text);
848
- return _context.abrupt("return", [json, response]);
819
+ if (type === "max-width") {
820
+ return currentWidth > size;
821
+ }
822
+ });
823
+ };
849
824
 
850
- case 12:
851
- _context.prev = 12;
852
- _context.t0 = _context["catch"](7);
853
- return _context.abrupt("return", [text, response]);
825
+ var media = function media() {
826
+ for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
827
+ sizePairs[_key3] = arguments[_key3];
828
+ }
854
829
 
855
- case 15:
856
- _context.next = 20;
857
- break;
830
+ return function () {
831
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
832
+ args[_key4] = arguments[_key4];
833
+ }
858
834
 
859
- case 17:
860
- _context.prev = 17;
861
- _context.t1 = _context["catch"](0);
862
- return _context.abrupt("return", [_context.t1, false]);
835
+ return css(["", ""], function (props) {
836
+ var _props$theme, _props$theme2;
863
837
 
864
- case 20:
865
- case "end":
866
- return _context.stop();
867
- }
868
- }
869
- }, _callee, this, [[0, 17], [7, 12]]);
870
- }));
838
+ return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? css.apply(void 0, args) : "" : css(["@media ", "{", "}"], sizePairs.map(function (_ref7) {
839
+ var _ref8 = _slicedToArray(_ref7, 2),
840
+ size = _ref8[0],
841
+ type = _ref8[1];
871
842
 
872
- return function resolveFetch(_x, _x2) {
873
- return _ref.apply(this, arguments);
843
+ return "(".concat(type, ": ").concat(size + scrollWidth$1, "px)");
844
+ }).join(' and '), css.apply(void 0, args));
845
+ });
874
846
  };
875
- }();
876
-
877
- var innerFetcher =
878
- /*#__PURE__*/
879
- function () {
880
- var _ref2 = _asyncToGenerator__default['default'](
881
- /*#__PURE__*/
882
- _regeneratorRuntime__default['default'].mark(function _callee2(url, fetchOptions) {
883
- var _ref3, _ref4, data, response;
884
-
885
- return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
886
- while (1) {
887
- switch (_context2.prev = _context2.next) {
888
- case 0:
889
- _context2.next = 2;
890
- return resolveFetch(url, fetchOptions);
847
+ };
848
+ media.mobile = media([600, 'max-width']);
891
849
 
892
- case 2:
893
- _ref3 = _context2.sent;
894
- _ref4 = _slicedToArray__default['default'](_ref3, 2);
895
- data = _ref4[0];
896
- response = _ref4[1];
850
+ media.between = function (min, max) {
851
+ return media([min, 'min-width'], [max, 'max-width']);
852
+ };
897
853
 
898
- if (!(!response || response.status >= 400)) {
899
- _context2.next = 10;
900
- break;
901
- }
854
+ media.max = function (n) {
855
+ return media([n, 'max-width']);
856
+ };
902
857
 
903
- throw [data, response];
858
+ media.min = function (n) {
859
+ return media([n, 'min-width']);
860
+ };
904
861
 
905
- case 10:
906
- return _context2.abrupt("return", [data, response]);
862
+ media.desktop = media([601, 'min-width']);
863
+ var vheight = function vheight(strings, size) {
864
+ var propType = strings[0];
865
+ var calc = (strings[1] || "").replace(";", "").trim();
866
+ return "\n ".concat(propType, " ").concat(calc ? "calc(".concat(size, "vh ").concat(calc, ")") : "".concat(size, "vh"), ";\n ").concat(propType, " ").concat(calc ? "calc(calc(var(--vh, 1vh) * ".concat(size, ") ").concat(calc, ")") : "calc(var(--vh, 1vh) * ".concat(size, ")"), ";\n ");
867
+ };
907
868
 
908
- case 11:
909
- case "end":
910
- return _context2.stop();
911
- }
912
- }
913
- }, _callee2, this);
914
- }));
869
+ function testSinglePath(props, path) {
870
+ if (typeof path === 'string') {
871
+ return !!_s$1.get(path, props);
872
+ } else if (typeof path === 'number') {
873
+ return !!props[path];
874
+ } else {
875
+ return false;
876
+ }
877
+ }
915
878
 
916
- return function innerFetcher(_x3, _x4) {
917
- return _ref2.apply(this, arguments);
918
- };
919
- }();
879
+ var getFrameOffset = function getFrameOffset(i, total) {
880
+ return Math.round(i * 100 / (total - 1));
881
+ };
920
882
 
921
- var addQueryString = function addQueryString() {
922
- var existingUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
923
- var obj = arguments.length > 1 ? arguments[1] : undefined;
883
+ var emotion = createEmotion({
884
+ nonce: 'animation_nonce'
885
+ });
886
+ var oneWayAnimation = function oneWayAnimation() {
887
+ for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
888
+ frames[_key5] = arguments[_key5];
889
+ }
924
890
 
925
- var _existingUrl$split = existingUrl.split('?'),
926
- _existingUrl$split2 = _slicedToArray__default['default'](_existingUrl$split, 2),
927
- onlyUrl = _existingUrl$split2[0],
928
- otherQueryString = _existingUrl$split2[1];
891
+ return emotion.keyframes(_templateObject(), frames.map(function (frame, i) {
892
+ return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
893
+ }));
894
+ };
895
+ var twoWayAnimation = function twoWayAnimation() {
896
+ for (var _len6 = arguments.length, frames = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
897
+ frames[_key6] = arguments[_key6];
898
+ }
929
899
 
930
- var params = new URLSearchParams(otherQueryString);
900
+ return [frames, _reverse(frames)].map(function (frames) {
901
+ return oneWayAnimation.apply(void 0, _toConsumableArray(frames));
902
+ });
903
+ };
904
+ var animationTiming = function animationTiming(props) {
905
+ return function () {
906
+ for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
907
+ animations[_key7] = arguments[_key7];
908
+ }
931
909
 
932
- for (var key in obj) {
933
- var value = obj[key];
910
+ return animations.filter(function (_) {
911
+ return _;
912
+ }).map(function (_) {
913
+ return _ + ' ' + props;
914
+ }).join(',');
915
+ };
916
+ };
917
+ var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
918
+ var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
919
+ var styledExtend = function styledExtend(_ref9) {
920
+ var target = _ref9.target,
921
+ componentStyle = _ref9.componentStyle;
922
+ return function () {
923
+ var wasStatic = !_find(_isFunction, componentStyle.rules);
934
924
 
935
- if (value === undefined || value === null) {
936
- params.delete(key);
937
- } else {
938
- params.set(key, obj[key]);
925
+ for (var _len8 = arguments.length, template = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
926
+ template[_key8] = arguments[_key8];
939
927
  }
940
- }
941
-
942
- var paramsStr = params.toString();
943
928
 
944
- if (!paramsStr) {
945
- return onlyUrl;
929
+ var v = styled(target).apply(void 0, template.concat(_toConsumableArray(wasStatic ? [] : [function () {
930
+ return "";
931
+ }])));
932
+ v.componentStyle.rules = _toConsumableArray(componentStyle.rules).concat(_toConsumableArray(v.componentStyle.rules));
933
+ return v;
934
+ };
935
+ };
936
+ var printerMedia = function printerMedia() {
937
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
938
+ args[_key9] = arguments[_key9];
946
939
  }
947
940
 
948
- return onlyUrl + '?' + paramsStr;
941
+ return function (props) {
942
+ return props.theme.printMode ? css.apply(void 0, args) : css(["@media print{", "}"], css.apply(void 0, args));
943
+ };
949
944
  };
945
+ var notPrinterMedia = function notPrinterMedia() {
946
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
947
+ args[_key10] = arguments[_key10];
948
+ }
950
949
 
951
- var cleanNulls = function cleanNulls(str) {
952
- return str.replace(/\0/g, '');
950
+ return function (props) {
951
+ return props.theme.printMode ? '' : css(["@media screen{", "}"], css.apply(void 0, args));
952
+ };
953
953
  };
954
954
 
955
- var postFetcherWithResponse =
956
- /*#__PURE__*/
957
- function () {
958
- var _ref5 = _asyncToGenerator__default['default'](
959
- /*#__PURE__*/
960
- _regeneratorRuntime__default['default'].mark(function _callee3(url, jsonOrForm) {
961
- var fetchOptions,
962
- _args3 = arguments;
963
- return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
964
- while (1) {
965
- switch (_context3.prev = _context3.next) {
966
- case 0:
967
- fetchOptions = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
968
- return _context3.abrupt("return", innerFetcher(url, _objectSpread__default['default']({
969
- method: 'POST',
970
- body: typeof jsonOrForm === 'string' ? jsonOrForm : !jsonOrForm || jsonOrForm.constructor === window.FormData ? jsonOrForm : cleanNulls(JSON.stringify(jsonOrForm))
971
- }, fetchOptions, {
972
- headers: _isPlainObject__default['default'](fetchOptions.headers) || !fetchOptions.headers ? _objectSpread__default['default']({}, jsonOrForm && (typeof jsonOrForm === 'string' || jsonOrForm.constructor === window.FormData) ? {} : {
973
- 'Content-Type': 'application/json; charset=UTF-8'
974
- }, fetchOptions.headers) : fetchOptions.headers
975
- })));
976
-
977
- case 2:
978
- case "end":
979
- return _context3.stop();
980
- }
981
- }
982
- }, _callee3, this);
983
- }));
955
+ var escapedValidParts = /(^|[^\\])(dd?|DD?|mm?|LL?|hh?|MM?|ss|SSS|yy(?:yy)?)/g;
956
+ var validParts = /(dd?|DD?|mm?|LL?|hh?|MM?|yy(?:yy)|yy|ss|SSS)$/;
957
+ var addZero = function addZero(v) {
958
+ return (v < 10 ? '0' : '') + v;
959
+ };
984
960
 
985
- return function postFetcherWithResponse(_x5, _x6) {
986
- return _ref5.apply(this, arguments);
961
+ var getSet = function getSet(index, ttype) {
962
+ var plus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
963
+ var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (v) {
964
+ return v;
987
965
  };
988
- }();
989
- var getFetcherWithResponse =
990
- /*#__PURE__*/
991
- function () {
992
- var _ref6 = _asyncToGenerator__default['default'](
993
- /*#__PURE__*/
994
- _regeneratorRuntime__default['default'].mark(function _callee4(url, jsonParams, fetchOptions) {
995
- return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
996
- while (1) {
997
- switch (_context4.prev = _context4.next) {
998
- case 0:
999
- return _context4.abrupt("return", innerFetcher(addQueryString(url, jsonParams), _objectSpread__default['default']({
1000
- method: 'GET'
1001
- }, fetchOptions)));
966
+ var parse = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (v, defaultDate) {
967
+ return v === '0' ? '' : v;
968
+ };
969
+ return [function (date, _, noUTC) {
970
+ return format((typeof date === 'number' ? new Date(date) : date)['get' + (noUTC ? '' : 'UTC') + ttype]() + plus);
971
+ }, function (unformatedStr, date, _, failOnFormat, noUTC) {
972
+ var str = parse(unformatedStr, date, failOnFormat);
973
+ if (str === '' || isNaN(date.getTime())) return date;
974
+ if (str === '\0') return date.setTime(NaN);
975
+ var utcSTR = noUTC ? '' : 'UTC';
976
+ var v = parseInt(str, 10) - plus;
977
+ var prevDay = date['get' + utcSTR + 'Date']();
1002
978
 
1003
- case 1:
1004
- case "end":
1005
- return _context4.stop();
1006
- }
1007
- }
1008
- }, _callee4, this);
1009
- }));
979
+ if (ttype !== 'Date') {
980
+ date['set' + utcSTR + 'Date'](1);
981
+ }
1010
982
 
1011
- return function getFetcherWithResponse(_x7, _x8, _x9) {
1012
- return _ref6.apply(this, arguments);
1013
- };
1014
- }();
1015
- var postFetcher =
1016
- /*#__PURE__*/
1017
- function () {
1018
- var _ref7 = _asyncToGenerator__default['default'](
1019
- /*#__PURE__*/
1020
- _regeneratorRuntime__default['default'].mark(function _callee5(url, json, options) {
1021
- return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
1022
- while (1) {
1023
- switch (_context5.prev = _context5.next) {
1024
- case 0:
1025
- return _context5.abrupt("return", postFetcherWithResponse(url, json, options).then(function (_ref8) {
1026
- var _ref9 = _slicedToArray__default['default'](_ref8, 1),
1027
- json = _ref9[0];
983
+ date['set' + utcSTR + ttype](v);
1028
984
 
1029
- return json;
1030
- }));
985
+ if (date['get' + utcSTR + ttype]() !== v) {
986
+ date['set' + utcSTR + ttype](NaN);
987
+ return date;
988
+ }
1031
989
 
1032
- case 1:
1033
- case "end":
1034
- return _context5.stop();
1035
- }
990
+ if (ttype !== 'Date') {
991
+ date['set' + utcSTR + 'Date'](prevDay);
992
+
993
+ if (date['get' + utcSTR + ttype]() !== v) {
994
+ date['set' + utcSTR + 'Date'](0);
995
+ return date;
1036
996
  }
1037
- }, _callee5, this);
1038
- }));
997
+ }
1039
998
 
1040
- return function postFetcher(_x10, _x11, _x12) {
1041
- return _ref7.apply(this, arguments);
1042
- };
1043
- }();
1044
- var getFetcher =
1045
- /*#__PURE__*/
1046
- function () {
1047
- var _ref10 = _asyncToGenerator__default['default'](
1048
- /*#__PURE__*/
1049
- _regeneratorRuntime__default['default'].mark(function _callee6(url, json, options) {
1050
- return _regeneratorRuntime__default['default'].wrap(function _callee6$(_context6) {
1051
- while (1) {
1052
- switch (_context6.prev = _context6.next) {
1053
- case 0:
1054
- return _context6.abrupt("return", getFetcherWithResponse(url, json, options).then(function (_ref11) {
1055
- var _ref12 = _slicedToArray__default['default'](_ref11, 1),
1056
- json = _ref12[0];
999
+ return date;
1000
+ }, index];
1001
+ };
1057
1002
 
1058
- return json;
1059
- }));
1003
+ var getText = function getText(type, total) {
1004
+ var slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 99;
1005
+ return [function (date, messages, noUTC) {
1006
+ return messages(type.toLowerCase(), date['get' + (noUTC ? '' : 'UTC') + type]()).slice(0, slice);
1007
+ }];
1008
+ };
1060
1009
 
1061
- case 1:
1062
- case "end":
1063
- return _context6.stop();
1064
- }
1065
- }
1066
- }, _callee6, this);
1067
- }));
1010
+ var yearParse = function yearParse(y, date, failOnFormat) {
1011
+ var formattedY = y.length === 2 && y !== '20' ? '20' + y : y.length === 4 ? y : '';
1068
1012
 
1069
- return function getFetcher(_x13, _x14, _x15) {
1070
- return _ref10.apply(this, arguments);
1071
- };
1072
- }();
1073
- var formFetchWithResponse = function formFetchWithResponse(url, options) {
1074
- return function (values, meta) {
1075
- return postFetcherWithResponse(callIfFunction(url, meta, values), values, callIfFunction(options, meta, values));
1076
- };
1013
+ if (formattedY === '') {
1014
+ if (failOnFormat) {
1015
+ var found = date.getUTCFullYear().toString().indexOf(y);
1016
+ return found === 0 || found === 2 ? date.getUTCFullYear() : '\0';
1017
+ } else {
1018
+ return date.getUTCFullYear();
1019
+ }
1020
+ } else {
1021
+ return formattedY;
1022
+ }
1077
1023
  };
1078
- var formFetch = function formFetch(url, options) {
1079
- return function (values, meta) {
1080
- return postFetcher(callIfFunction(url, meta, values), values, callIfFunction(options, meta, values));
1081
- };
1024
+
1025
+ var val = {
1026
+ yyyy: getSet(0, 'FullYear', 0, function (v) {
1027
+ return v;
1028
+ }, yearParse),
1029
+ yy: getSet(0, 'FullYear', 0, function (v) {
1030
+ return (v + "").slice(2, 4);
1031
+ }, yearParse),
1032
+ M: getSet(1, 'Month', 1),
1033
+ MM: getSet(1, 'Month', 1, addZero),
1034
+ L: getText('Month', 12, 3),
1035
+ LL: getText('Month', 12),
1036
+ d: getSet(2, 'Date'),
1037
+ dd: getSet(2, 'Date', 0, addZero),
1038
+ D: getText('Day', 7, 3),
1039
+ DD: getText('Day', 7),
1040
+ m: getSet(4, 'Minutes'),
1041
+ mm: getSet(4, 'Minutes', 0, addZero),
1042
+ h: getSet(5, 'Hours'),
1043
+ hh: getSet(5, 'Hours', 0, addZero),
1044
+ ss: getSet(6, 'Seconds', 0, addZero),
1045
+ SSS: getSet(7, 'Milliseconds', 0, addZero)
1046
+ };
1047
+ function formatDateToPattern(format) {
1048
+ return format.replace(escapedValidParts, function (_, _1, _2) {
1049
+ return _1 + (_2 === 'yy' ? '##' : _2 === 'yyyy' ? '####' : '0#');
1050
+ });
1051
+ }
1052
+ function formatDate(date, format, messages, noUTC) {
1053
+ if (!date) return '';
1054
+ var separators = format.replace(escapedValidParts, '\0').split('\0');
1055
+ var parts = format.match(escapedValidParts);
1056
+ var formattedDate = parts.reduce(function (acc, part) {
1057
+ return acc.concat(separators.length ? [separators.shift()] : [], part.replace(validParts, ''), val[part.match(validParts)[0]][0](date, messages, noUTC));
1058
+ }, []);
1059
+ return formattedDate.join('').replace(/\\([dDmLhMy])/g, '$1');
1060
+ }
1061
+
1062
+ var now = function now() {
1063
+ return new Date();
1082
1064
  };
1083
1065
 
1084
- var moveElement = _curry__default['default'](function (from, to, list) {
1066
+ function parseDate(str, possibleDate, format, messages, failOnFormat, noUTC) {
1067
+ if (!str) return possibleDate;
1068
+ var separators = format.replace(escapedValidParts, '\0').split('\0');
1069
+ var parts = format.match(escapedValidParts);
1070
+ var mutations = [];
1071
+ parts.reduce(function (rest, part, i) {
1072
+ var separator = (separators.length ? separators.shift() : '') + part.replace(validParts, '');
1073
+ var current = rest.slice(separator.length);
1074
+
1075
+ if (current && separator === rest.slice(0, separator.length)) {
1076
+ var setType = part.match(validParts)[0];
1077
+ var nextSeparator = separators[0];
1078
+ var nextStrIndex = current.indexOf(nextSeparator + (parts[i + 1] || '').replace(validParts, ''));
1079
+ mutations[val[setType][2]] = [val[setType][1], nextStrIndex ? current.slice(0, nextStrIndex) : current];
1080
+ return current.slice(nextStrIndex);
1081
+ } else {
1082
+ return '';
1083
+ }
1084
+ }, str);
1085
+ var date = possibleDate && possibleDate.getTime() !== -1 ? new Date(possibleDate) : now();
1086
+ mutations.forEach(function (_ref) {
1087
+ var _ref2 = _slicedToArray(_ref, 2),
1088
+ setter = _ref2[0],
1089
+ text = _ref2[1];
1090
+
1091
+ return setter(text, date, messages, failOnFormat, noUTC);
1092
+ });
1093
+ return date;
1094
+ }
1095
+
1096
+ var moveElement = _curry(function (from, to, list) {
1085
1097
  var el = list[from];
1086
1098
 
1087
- var without = _pullAt__default['default'](from, list);
1099
+ var without = _pullAt(from, list);
1088
1100
 
1089
1101
  without.splice(to, 0, el);
1090
1102
  return without;
1091
1103
  });
1092
- var unsetOrRemoveAt = _curry__default['default'](function (path, value) {
1104
+
1105
+ var unsetOrRemoveAt = _curry(function (path, value) {
1093
1106
  var pathArr = toPath(path);
1094
1107
 
1095
1108
  var _pathArr$slice = pathArr.slice(-1),
1096
- _pathArr$slice2 = _slicedToArray__default['default'](_pathArr$slice, 1),
1109
+ _pathArr$slice2 = _slicedToArray(_pathArr$slice, 1),
1097
1110
  lastKey = _pathArr$slice2[0];
1098
1111
 
1099
1112
  return update(pathArr.slice(0, -1), function (v) {
1100
1113
  return Array.isArray(v) ? removeAt(lastKey, v) : unset(lastKey, v);
1101
1114
  }, value);
1102
1115
  });
1116
+
1103
1117
  var pathToString = function pathToString(path) {
1104
1118
  return toPath(path).join(".");
1105
1119
  };
@@ -1109,83 +1123,105 @@ var sanitizePath = function sanitizePath(path) {
1109
1123
  };
1110
1124
 
1111
1125
  var toPath = function toPath(path) {
1112
- return _toPath__default['default'](sanitizePath(path));
1126
+ return _toPath(sanitizePath(path));
1113
1127
  };
1114
1128
 
1115
1129
  var isEmptyPath = function isEmptyPath(path) {
1116
1130
  return path && !path.length;
1117
1131
  };
1118
1132
 
1119
- var update = _curry__default['default'](function (path, updater, state) {
1133
+ var update = _curry(function (path, updater, state) {
1120
1134
  var sanitizedPath = sanitizePath(path);
1121
1135
 
1122
1136
  if (isEmptyPath(sanitizedPath)) {
1123
1137
  return updater(state);
1124
1138
  } else {
1125
- return _update__default['default'](sanitizedPath, updater, state);
1139
+ return _update(sanitizedPath, updater, state);
1126
1140
  }
1127
1141
  });
1128
- var get = _curry__default['default'](function (path, state) {
1142
+
1143
+ var get = _curry(function (path, state) {
1129
1144
  var sanitizedPath = sanitizePath(path);
1130
1145
 
1131
1146
  if (isEmptyPath(sanitizedPath)) {
1132
1147
  return state;
1133
1148
  } else {
1134
- return _get__default['default'](sanitizedPath, state);
1149
+ return _get(sanitizedPath, state);
1135
1150
  }
1136
1151
  });
1137
- var set = _curry__default['default'](function (path, value, state) {
1152
+
1153
+ var set = _curry(function (path, value, state) {
1138
1154
  var sanitizedPath = sanitizePath(path);
1139
1155
 
1140
1156
  if (isEmptyPath(sanitizedPath)) {
1141
1157
  return value;
1142
1158
  } else {
1143
- return _set__default['default'](sanitizedPath, value, state);
1159
+ return _set(sanitizedPath, value, state);
1144
1160
  }
1145
1161
  });
1146
- var unset = _curry__default['default'](function (path, state) {
1162
+
1163
+ var unset = _curry(function (path, state) {
1147
1164
  var sanitizedPath = sanitizePath(path);
1148
1165
 
1149
1166
  if (isEmptyPath(sanitizedPath)) {
1150
1167
  return undefined;
1151
1168
  } else {
1152
- return _unset__default['default'](sanitizedPath, state);
1169
+ return _unset(sanitizedPath, state);
1153
1170
  }
1154
1171
  });
1155
- var removeNAt = _curry__default['default'](function (pos, n, value) {
1156
- return _toConsumableArray__default['default'](value.slice(0, Number(pos))).concat(_toConsumableArray__default['default'](value.slice(Number(pos) + n)));
1172
+
1173
+ var removeNAt = _curry(function (pos, n, value) {
1174
+ return _toConsumableArray(value.slice(0, Number(pos))).concat(_toConsumableArray(value.slice(Number(pos) + n)));
1175
+ });
1176
+
1177
+ var removeAt = removeNAt(_2, 1);
1178
+
1179
+ var when = _curry(function (cond, fn, value) {
1180
+ return callIfFunction$1(cond, value) ? fn(value) : value;
1181
+ });
1182
+
1183
+ var assign = _curry(function (a, b) {
1184
+ return _assign(b, a);
1157
1185
  });
1158
- var removeAt = removeNAt(_2__default['default'], 1);
1159
- var when = _curry__default['default'](function (cond, fn, value) {
1160
- return callIfFunction(cond, value) ? fn(value) : value;
1186
+
1187
+ var concat = _curry(function (a, b) {
1188
+ return _concat(b, a);
1161
1189
  });
1162
- var assign = _curry__default['default'](function (a, b) {
1163
- return _assign__default['default'](b, a);
1190
+
1191
+ var each = _each.convert({
1192
+ cap: false
1164
1193
  });
1165
- var concat = _curry__default['default'](function (a, b) {
1166
- return _concat__default['default'](b, a);
1194
+
1195
+ var find = _find.convert({
1196
+ cap: false
1167
1197
  });
1168
- var each = _each__default['default'].convert({
1198
+
1199
+ var filter = _filter.convert({
1169
1200
  cap: false
1170
1201
  });
1171
- var find = _find__default['default'].convert({
1202
+
1203
+ var map = _map.convert({
1172
1204
  cap: false
1173
1205
  });
1174
- var filter = _filter__default['default'].convert({
1206
+
1207
+ var mapValues = _mapValues.convert({
1175
1208
  cap: false
1176
1209
  });
1177
- var map = _map__default['default'].convert({
1210
+
1211
+ var flatMap = _flatMap.convert({
1178
1212
  cap: false
1179
1213
  });
1180
- var insertAt = _curry__default['default'](function (pos, newElements, value) {
1181
- return _toConsumableArray__default['default'](value.slice(0, pos).concat(newElements)).concat(_toConsumableArray__default['default'](value.slice(pos)));
1214
+
1215
+ var insertAt = _curry(function (pos, newElements, value) {
1216
+ return _toConsumableArray(value.slice(0, pos).concat(newElements)).concat(_toConsumableArray(value.slice(pos)));
1182
1217
  });
1183
- var select = _curry__default['default'](function (selector, value) {
1184
- return (_isFunction__default['default'](selector) ? selector : selector ? _get__default['default'](selector) : _identity__default['default'])(value);
1218
+
1219
+ var select = _curry(function (selector, value) {
1220
+ return (_isFunction(selector) ? selector : selector ? _get(selector) : _identity)(value);
1185
1221
  });
1186
1222
 
1187
- var itemToggle = _curry__default['default'](function (item, list) {
1188
- return (list || []).indexOf(item) >= 0 ? _without__default['default']([item], list) : _toConsumableArray__default['default'](list || []).concat([item]);
1223
+ var itemToggle = _curry(function (item, list) {
1224
+ return (list || []).indexOf(item) >= 0 ? _without([item], list) : _toConsumableArray(list || []).concat([item]);
1189
1225
  });
1190
1226
 
1191
1227
  var _s = {
@@ -1208,639 +1244,691 @@ var _s = {
1208
1244
  find: find,
1209
1245
  filter: filter,
1210
1246
  map: map,
1247
+ flatMap: flatMap,
1248
+ mapValues: mapValues,
1211
1249
  insertAt: insertAt,
1212
1250
  flowEach: function flowEach() {
1213
1251
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1214
1252
  args[_key] = arguments[_key];
1215
1253
  }
1216
1254
 
1217
- return _flow__default['default'].apply(void 0, _toConsumableArray__default['default'](args.filter(Boolean)));
1255
+ return _flow.apply(void 0, _toConsumableArray(args.filter(Boolean)));
1218
1256
  }
1219
1257
  };
1220
1258
 
1221
- function _templateObject() {
1222
- var data = _taggedTemplateLiteral__default['default'](["\n ", ""]);
1259
+ var isNotSelector = function isNotSelector(v) {
1260
+ return typeof v !== 'function' || v.length === 0;
1261
+ };
1223
1262
 
1224
- _templateObject = function _templateObject() {
1225
- return data;
1263
+ var toSelector = function toSelector(v) {
1264
+ return isNotSelector(v) ? function (s) {
1265
+ return _s$1.get(callIfFunction$1(v), s);
1266
+ } : v;
1267
+ };
1268
+
1269
+ var mergeSelectors = function mergeSelectors(prev, next) {
1270
+ return function (v) {
1271
+ return next(prev(v));
1226
1272
  };
1273
+ };
1227
1274
 
1228
- return data;
1229
- }
1230
- var getColor = function getColor(propsOrColor, hover) {
1231
- if (propsOrColor === undefined) {
1232
- return function (_ref) {
1233
- var theme = _ref.theme;
1234
- return theme.colors.gray150;
1235
- };
1275
+ var concatSelectors = function concatSelectors() {
1276
+ for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
1277
+ paths[_key] = arguments[_key];
1236
1278
  }
1237
1279
 
1238
- if (typeof propsOrColor === 'string') {
1239
- return function (_ref2) {
1240
- var theme = _ref2.theme;
1241
- return theme.colors[propsOrColor];
1242
- };
1280
+ return paths.reduce(function (_ref, path) {
1281
+ var _ref2 = _slicedToArray(_ref, 2),
1282
+ selector = _ref2[0],
1283
+ isSelector = _ref2[1];
1284
+
1285
+ return isNotSelector(path) && !isSelector ? [selector.concat(path), false] : [mergeSelectors(toSelector(selector), path), true];
1286
+ }, [[], false]);
1287
+ };
1288
+ var COMPLETE_ACTION = {};
1289
+ var REDUCE = {};
1290
+ var FETCH = {};
1291
+ var SKIP_FETCH = {};
1292
+ var SKIP_DISPATCH = {};
1293
+ var SKIPPED_ACTION = {};
1294
+ var selectPath = function selectPath(useState) {
1295
+ for (var _len2 = arguments.length, paths = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1296
+ paths[_key2 - 1] = arguments[_key2];
1243
1297
  }
1244
1298
 
1245
- var theme = propsOrColor.theme,
1246
- props = _objectWithoutProperties__default['default'](propsOrColor, ["theme"]);
1299
+ var _useMemo = useMemo(function () {
1300
+ return concatSelectors.apply(void 0, paths);
1301
+ }, paths),
1302
+ _useMemo2 = _slicedToArray(_useMemo, 1),
1303
+ selector = _useMemo2[0];
1247
1304
 
1248
- if (props.dark) {
1249
- return polished.darken(0.1, getColor(_objectSpread__default['default']({
1250
- theme: theme
1251
- }, _unset__default['default']('dark', props))));
1252
- } else if (hover && props.hover) {
1253
- return getColor({
1254
- theme: theme,
1255
- color: props.hover
1256
- });
1257
- } else if (props.color) {
1258
- return theme.colors[props.color] || props.color;
1259
- } else if (props.highlight) {
1260
- return theme.colors.main;
1261
- } else if (props.alert) {
1262
- return theme.colors.alert;
1263
- } else if (props.success) {
1264
- return theme.colors.success;
1305
+ var _useState = useState(selector),
1306
+ _useState2 = _slicedToArray(_useState, 1),
1307
+ value = _useState2[0];
1308
+
1309
+ return value;
1310
+ };
1311
+ var Action = function Action(fnOrArray) {
1312
+ var prevArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1313
+ var isArray = Array.isArray(fnOrArray);
1314
+
1315
+ if (isArray) {
1316
+ // excessive paramaeters called on the action, used for options.
1317
+ var actionType = _last(prevArgs);
1318
+
1319
+ var _fnOrArray = _slicedToArray(fnOrArray, 3),
1320
+ fetcher = _fnOrArray[0],
1321
+ reducer = _fnOrArray[1],
1322
+ rollbacker = _fnOrArray[2];
1323
+
1324
+ if (actionType === REDUCE) {
1325
+ return reducer(null, prevArgs);
1326
+ } else if (actionType === FETCH) {
1327
+ return fetcher();
1328
+ } else {
1329
+ return _set('extra', fnOrArray.extra, [actionType === SKIP_FETCH ? function () {
1330
+ return Promise.resolve();
1331
+ } : fetcher, actionType === SKIP_DISPATCH ? undefined : reducer].concat(rollbacker || []));
1332
+ }
1265
1333
  } else {
1266
- return theme.colors.gray150;
1334
+ return prevArgs.length < fnOrArray.length ? function () {
1335
+ for (var _len3 = arguments.length, moreArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1336
+ moreArgs[_key3] = arguments[_key3];
1337
+ }
1338
+
1339
+ return Action(fnOrArray, _toConsumableArray(prevArgs).concat(moreArgs));
1340
+ } : Action(fnOrArray.apply(void 0, _toConsumableArray(prevArgs)), prevArgs);
1267
1341
  }
1268
1342
  };
1269
- var getMargin = function getMargin(enumeratedMargins) {
1270
- return function (props) {
1271
- return enumeratedMargins[props.margin] || props.margin || enumeratedMargins['default'] || 0;
1272
- };
1273
- };
1274
- /**
1275
- * Returns the value of `props[path]` or `defaultValue`
1276
- * @example
1277
- * const Button = styled.button`
1278
- * color: ${prop('color', 'red')};
1279
- * `
1280
- */
1281
1343
 
1282
- var prop = function prop(path, defaultValue) {
1283
- return function () {
1284
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1285
- return _get__default['default'](path.trim(), props) || defaultValue;
1286
- };
1287
- };
1288
- var customTheme = function customTheme(type) {
1289
- return function () {
1290
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1291
- return _get__default['default'](["theme", "startlibs", type], props) || '';
1292
- };
1293
- };
1294
- /**
1295
- * Returns `pass` if prop is truthy. Otherwise returns `fail`
1296
- * @example
1297
- * // usage with styled-theme
1298
- * import styled from 'styled-components'
1299
- * import { ifProp } from 'styled-tools'
1300
- * import { palette } from 'styled-theme'
1301
- *
1302
- * const Button = styled.button`
1303
- * background-color: ${ifProp('transparent', 'transparent', palette(0))};
1304
- * color: ${ifProp(['transparent', 'accent'], palette('secondary', 0))};
1305
- * font-size: ${ifProp({ size: 'large' }, '20px', ifProp({ size: 'medium' }, '16px', '12px'))};
1306
- *`
1307
- */
1344
+ var mapAction = function mapAction(get, dispatcher, firstRun) {
1345
+ return function (action) {
1346
+ if (Array.isArray(action)) {
1347
+ if (firstRun) {
1348
+ return function () {
1349
+ return mapAction(get, dispatcher)(action);
1350
+ };
1351
+ }
1308
1352
 
1309
- var ifProp = function ifProp(path, pass, fail) {
1310
- if (pass && !_isFunction__default['default'](pass)) {
1311
- // old version
1312
- return function () {
1313
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1314
- var result = false;
1353
+ var _action = _slicedToArray(action, 3),
1354
+ fetcher = _action[0],
1355
+ reducer = _action[1],
1356
+ rollbacker = _action[2];
1315
1357
 
1316
- if (Array.isArray(path)) {
1317
- result = path.every(function (p) {
1318
- return testSinglePath(props, p);
1319
- });
1320
- } else if (_typeof__default['default'](path) === 'object') {
1321
- result = !Object.entries(path).find(function (_ref3) {
1322
- var _ref4 = _slicedToArray__default['default'](_ref3, 2),
1323
- k = _ref4[0],
1324
- v = _ref4[1];
1358
+ var _ref3 = action.extra || {},
1359
+ skip = _ref3.skip;
1325
1360
 
1326
- return props[k] !== v;
1327
- });
1328
- } else {
1329
- result = testSinglePath(props, path);
1361
+ if (skip && skip(get())) {
1362
+ return Promise.resolve(SKIPPED_ACTION);
1330
1363
  }
1331
1364
 
1332
- return result ? pass : fail;
1333
- };
1334
- } else {
1335
- return function () {
1336
- for (var _len = arguments.length, argsTrue = new Array(_len), _key = 0; _key < _len; _key++) {
1337
- argsTrue[_key] = arguments[_key];
1365
+ var fetched = fetcher();
1366
+
1367
+ if (rollbacker) {
1368
+ dispatcher(function (prevState) {
1369
+ var nextState = reducer(null)(prevState);
1370
+ fetched.catch(function (response) {
1371
+ dispatcher(rollbacker(prevState, nextState, response));
1372
+ });
1373
+ return nextState;
1374
+ });
1338
1375
  }
1339
1376
 
1340
- var check = pass || _identity__default['default'];
1377
+ if (reducer !== undefined) {
1378
+ fetched.then(function (response) {
1379
+ return dispatcher(reducer(response));
1380
+ });
1381
+ }
1341
1382
 
1342
- var fn = function fn(props) {
1343
- return check(_get__default['default'](path, props)) ? styled.css.apply(void 0, argsTrue) : '';
1383
+ return fetched;
1384
+ } else {
1385
+ return function () {
1386
+ return mapAction(get, dispatcher)(action.apply(void 0, arguments));
1344
1387
  };
1388
+ }
1389
+ };
1390
+ };
1345
1391
 
1346
- fn.orElse = function () {
1347
- for (var _len2 = arguments.length, argsFalse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1348
- argsFalse[_key2] = arguments[_key2];
1349
- }
1392
+ var activateActions = function activateActions(get, dispatcher) {
1393
+ for (var _len4 = arguments.length, actions = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
1394
+ actions[_key4 - 2] = arguments[_key4];
1395
+ }
1350
1396
 
1351
- return function (props) {
1352
- return check(_get__default['default'](path, props)) ? styled.css.apply(void 0, argsTrue) : styled.css.apply(void 0, argsFalse);
1353
- };
1354
- };
1397
+ return actions.map(mapAction(get, dispatcher, true));
1398
+ };
1399
+ var SkipAction = function SkipAction(skip, action) {
1400
+ action.extra = _objectSpread({}, action.extra, {
1401
+ skip: skip
1402
+ });
1403
+ return action;
1404
+ };
1355
1405
 
1356
- return fn;
1357
- };
1358
- }
1406
+ var compareBest = function compareBest(compare) {
1407
+ return function (best, next) {
1408
+ return best ? compare(best, next) ? next : best : next;
1409
+ };
1359
1410
  };
1360
- var ifPropEquals = function ifPropEquals(path, str) {
1361
- return ifProp(path, _isEqual__default['default'](str));
1411
+ var toLowest = function toLowest() {
1412
+ var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity;
1413
+ return compareBest(function (best, next) {
1414
+ return getValue(next) < getValue(best);
1415
+ });
1362
1416
  };
1363
- var ifNotProp = function ifNotProp(path) {
1364
- return ifProp(path, function (v) {
1365
- return !v;
1417
+ var toHighest = function toHighest() {
1418
+ var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity;
1419
+ return compareBest(function (best, next) {
1420
+ return getValue(next) > getValue(best);
1366
1421
  });
1367
1422
  };
1368
1423
 
1369
- var checkCustomScreenWidth = function checkCustomScreenWidth(sizeParis, customWidth) {
1370
- var currentWidth = callIfFunction(customWidth);
1371
- return !sizeParis.find(function (_ref5) {
1372
- var _ref6 = _slicedToArray__default['default'](_ref5, 2),
1373
- size = _ref6[0],
1374
- type = _ref6[1];
1375
-
1376
- if (type === "min-width") {
1377
- return currentWidth < size;
1378
- }
1424
+ var addExtraProp = function addExtraProp(element, extra) {
1425
+ var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1426
+ return React.cloneElement(element, override ? _objectSpread({}, element.props, extra) : _objectSpread({}, extra, element.props), element.props.children);
1427
+ };
1379
1428
 
1380
- if (type === "max-width") {
1381
- return currentWidth > size;
1382
- }
1383
- });
1429
+ var useEventListener = function useEventListener(eventName, callback) {
1430
+ var deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1431
+ useEffect(function () {
1432
+ window.addEventListener(eventName, callback);
1433
+ return function () {
1434
+ return window.removeEventListener(eventName, callback);
1435
+ };
1436
+ }, deps);
1437
+ };
1438
+ var useEventListenerFor = function useEventListenerFor(element, eventName, callback) {
1439
+ var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1440
+ useEffect(function () {
1441
+ element.addEventListener(eventName, callback);
1442
+ return function () {
1443
+ return element.removeEventListener(eventName, callback);
1444
+ };
1445
+ }, deps.concat(element));
1384
1446
  };
1385
1447
 
1386
- var media = function media() {
1387
- for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1388
- sizePairs[_key3] = arguments[_key3];
1448
+ var formatPath = function formatPath() {
1449
+ for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
1450
+ paths[_key] = arguments[_key];
1389
1451
  }
1390
1452
 
1453
+ return paths.map(function (path) {
1454
+ return Array.isArray(path) ? path.join('.') : path ? path.toString().replace(/\[/g, '.').replace(/^\./, '').replace(/]/g, '') : '';
1455
+ }).filter(function (_) {
1456
+ return _;
1457
+ }).join('.');
1458
+ };
1459
+ var identityFn = function identityFn() {
1460
+ var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1391
1461
  return function () {
1392
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1393
- args[_key4] = arguments[_key4];
1462
+ for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1463
+ e[_key2] = arguments[_key2];
1394
1464
  }
1395
1465
 
1396
- return styled.css(["", ""], function (props) {
1397
- var _props$theme, _props$theme2;
1398
-
1399
- return ((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.overrideMediaWidth) ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? styled.css.apply(void 0, args) : "" : styled.css(["@media ", "{", "}"], sizePairs.map(function (_ref7) {
1400
- var _ref8 = _slicedToArray__default['default'](_ref7, 2),
1401
- size = _ref8[0],
1402
- type = _ref8[1];
1403
-
1404
- return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
1405
- }).join(' and '), styled.css.apply(void 0, args));
1406
- });
1466
+ return e[n];
1407
1467
  };
1408
1468
  };
1409
- media.mobile = media([600, 'max-width']);
1469
+ var will = function will(fn) {
1470
+ for (var _len3 = arguments.length, props = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
1471
+ props[_key3 - 1] = arguments[_key3];
1472
+ }
1410
1473
 
1411
- media.between = function (min, max) {
1412
- return media([min, 'min-width'], [max, 'max-width']);
1413
- };
1474
+ return function () {
1475
+ for (var _len4 = arguments.length, more = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1476
+ more[_key4] = arguments[_key4];
1477
+ }
1414
1478
 
1415
- media.max = function (n) {
1416
- return media([n, 'max-width']);
1479
+ return fn.apply(void 0, props.concat(more));
1480
+ };
1417
1481
  };
1482
+ var unWill = function unWill(fn) {
1483
+ for (var _len5 = arguments.length, props = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
1484
+ props[_key5 - 1] = arguments[_key5];
1485
+ }
1418
1486
 
1419
- media.min = function (n) {
1420
- return media([n, 'min-width']);
1487
+ return function () {
1488
+ return fn.apply(void 0, props);
1489
+ };
1421
1490
  };
1422
-
1423
- media.desktop = media([601, 'min-width']);
1424
- var vheight = function vheight(strings, size) {
1425
- var propType = strings[0];
1426
- var calc = (strings[1] || "").replace(";", "").trim();
1427
- return "\n ".concat(propType, " ").concat(calc ? "calc(".concat(size, "vh ").concat(calc, ")") : "".concat(size, "vh"), ";\n ").concat(propType, " ").concat(calc ? "calc(calc(var(--vh, 1vh) * ".concat(size, ") ").concat(calc, ")") : "calc(var(--vh, 1vh) * ".concat(size, ")"), ";\n ");
1491
+ var lazyValue = function lazyValue(v) {
1492
+ return function () {
1493
+ return v;
1494
+ };
1428
1495
  };
1429
-
1430
- function testSinglePath(props, path) {
1431
- if (typeof path === 'string') {
1432
- return !!get(path, props);
1433
- } else if (typeof path === 'number') {
1434
- return !!props[path];
1435
- } else {
1436
- return false;
1496
+ var callIfFunction = function callIfFunction(prop) {
1497
+ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
1498
+ args[_key6 - 1] = arguments[_key6];
1437
1499
  }
1438
- }
1439
1500
 
1440
- var getFrameOffset = function getFrameOffset(i, total) {
1441
- return Math.round(i * 100 / (total - 1));
1501
+ return typeof prop === "function" ? prop.apply(void 0, args) : prop;
1442
1502
  };
1443
-
1444
- var emotion = createEmotion__default['default']({
1445
- nonce: __webpack_nonce__
1446
- });
1447
- var oneWayAnimation = function oneWayAnimation() {
1448
- for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1449
- frames[_key5] = arguments[_key5];
1503
+ var callIfFunctions = function callIfFunctions(prop) {
1504
+ for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
1505
+ args[_key7 - 1] = arguments[_key7];
1450
1506
  }
1451
1507
 
1452
- return emotion.keyframes(_templateObject(), frames.map(function (frame, i) {
1453
- return !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }");
1454
- }));
1508
+ return typeof prop === "function" ? prop.apply(void 0, _toConsumableArray(args.map(function (e) {
1509
+ return callIfFunction(e);
1510
+ }))) : prop;
1455
1511
  };
1456
- var twoWayAnimation = function twoWayAnimation() {
1457
- for (var _len6 = arguments.length, frames = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1458
- frames[_key6] = arguments[_key6];
1512
+ var callMany = function callMany() {
1513
+ for (var _len8 = arguments.length, many = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
1514
+ many[_key8] = arguments[_key8];
1459
1515
  }
1460
1516
 
1461
- return [frames, _reverse__default['default'](frames)].map(function (frames) {
1462
- return oneWayAnimation.apply(void 0, _toConsumableArray__default['default'](frames));
1463
- });
1464
- };
1465
- var animationTiming = function animationTiming(props) {
1466
1517
  return function () {
1467
- for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1468
- animations[_key7] = arguments[_key7];
1518
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
1519
+ args[_key9] = arguments[_key9];
1469
1520
  }
1470
1521
 
1471
- return animations.filter(function (_) {
1472
- return _;
1473
- }).map(function (_) {
1474
- return _ + ' ' + props;
1475
- }).join(',');
1522
+ return many.map(function (_) {
1523
+ return callIfFunction.apply(void 0, [_].concat(args));
1524
+ });
1476
1525
  };
1477
1526
  };
1478
- var identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
1479
- var identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
1480
- var styledExtend = function styledExtend(_ref9) {
1481
- var target = _ref9.target,
1482
- componentStyle = _ref9.componentStyle;
1483
- return function () {
1484
- var wasStatic = !_find__default['default'](_isFunction__default['default'], componentStyle.rules);
1485
-
1486
- for (var _len8 = arguments.length, template = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
1487
- template[_key8] = arguments[_key8];
1488
- }
1527
+ var ifUndefined = function ifUndefined(v) {
1528
+ for (var _len10 = arguments.length, or = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) {
1529
+ or[_key10 - 1] = arguments[_key10];
1530
+ }
1489
1531
 
1490
- var v = styled__default['default'](target).apply(void 0, template.concat(_toConsumableArray__default['default'](wasStatic ? [] : [function () {
1491
- return "";
1492
- }])));
1493
- v.componentStyle.rules = _toConsumableArray__default['default'](componentStyle.rules).concat(_toConsumableArray__default['default'](v.componentStyle.rules));
1494
- return v;
1495
- };
1532
+ return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined.apply(void 0, [or[0]].concat(_toConsumableArray(or.slice(1))));
1496
1533
  };
1497
- var printerMedia = function printerMedia() {
1498
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
1499
- args[_key9] = arguments[_key9];
1534
+ var using = function using() {
1535
+ for (var _len11 = arguments.length, v = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
1536
+ v[_key11] = arguments[_key11];
1500
1537
  }
1501
1538
 
1502
- return function (props) {
1503
- return props.theme.printMode ? styled.css.apply(void 0, args) : styled.css(["@media print{", "}"], styled.css.apply(void 0, args));
1539
+ return function (fn) {
1540
+ return fn.apply(void 0, _toConsumableArray(v.map(function (v) {
1541
+ return callIfFunction(v);
1542
+ })));
1504
1543
  };
1505
1544
  };
1506
- var notPrinterMedia = function notPrinterMedia() {
1507
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
1508
- args[_key10] = arguments[_key10];
1509
- }
1510
-
1511
- return function (props) {
1512
- return props.theme.printMode ? '' : styled.css(["@media screen{", "}"], styled.css.apply(void 0, args));
1545
+ var stopPropagation = function stopPropagation(cb) {
1546
+ return function (e) {
1547
+ e && e.stopPropagation && e.stopPropagation();
1548
+ callIfFunction(cb, e);
1549
+ };
1550
+ };
1551
+ var preventDefault = function preventDefault(cb) {
1552
+ return function (e) {
1553
+ e && e.preventDefault && e.preventDefault();
1554
+ callIfFunction(cb, e);
1513
1555
  };
1514
1556
  };
1557
+ var constrainEvent = function constrainEvent(cb) {
1558
+ return function (e) {
1559
+ e === null || e === void 0 ? void 0 : e.preventDefault();
1560
+ e.stopPropagation();
1561
+ callIfFunction(cb, e);
1562
+ };
1563
+ };
1564
+ var mapGetOrSet = function mapGetOrSet(map, key, value) {
1565
+ return (map.has(key) ? map : map.set(key, value)).get(key);
1566
+ };
1567
+ var intToHour = function intToHour(hour) {
1568
+ var autoFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1569
+ if (hour === undefined || hour === null) return '';
1515
1570
 
1516
- var escapedValidParts = /(^|[^\\])(dd?|DD?|mm?|LL?|hh?|MM?|ss|SSS|yy(?:yy)?)/g;
1517
- var validParts = /(dd?|DD?|mm?|LL?|hh?|MM?|yy(?:yy)|yy|ss|SSS)$/;
1518
- var addZero = function addZero(v) {
1519
- return (v < 10 ? '0' : '') + v;
1571
+ if (hour === 0) {
1572
+ return "00:00";
1573
+ } //const [h,m] = ('000' + hour.toString().replace(":","")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2').split(":")
1574
+
1575
+
1576
+ var h = hour.toString().replace(":", "").slice(-4, -2);
1577
+ var m = hour.toString().replace(":", "").slice(-2);
1578
+
1579
+ if (callIfFunction(autoFill, hour)) {
1580
+ return ('000' + (h ? parseInt(h, 10) % 24 : '') + m).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
1581
+ }
1582
+
1583
+ if (h) return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
1584
+ return m;
1520
1585
  };
1586
+ var formatHour = function formatHour() {
1587
+ var hour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1521
1588
 
1522
- var getSet = function getSet(index, ttype) {
1523
- var plus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1524
- var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function (v) {
1525
- return v;
1526
- };
1527
- var parse = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function (v, defaultDate) {
1528
- return v === '0' ? '' : v;
1529
- };
1530
- return [function (date, _, noUTC) {
1531
- return format((typeof date === 'number' ? new Date(date) : date)['get' + (noUTC ? '' : 'UTC') + ttype]() + plus);
1532
- }, function (unformatedStr, date, _, failOnFormat, noUTC) {
1533
- var str = parse(unformatedStr, date, failOnFormat);
1534
- if (str === '' || isNaN(date.getTime())) return date;
1535
- if (str === '\0') return date.setTime(NaN);
1536
- var utcSTR = noUTC ? '' : 'UTC';
1537
- var v = parseInt(str, 10) - plus;
1538
- var prevDay = date['get' + utcSTR + 'Date']();
1589
+ if (!hour) {
1590
+ return "";
1591
+ }
1539
1592
 
1540
- if (ttype !== 'Date') {
1541
- date['set' + utcSTR + 'Date'](1);
1542
- }
1593
+ var h = hour.toString().replace(":", "").slice(-4, -2);
1594
+ var m = hour.toString().replace(":", "").slice(-2);
1543
1595
 
1544
- date['set' + utcSTR + ttype](v);
1596
+ if (!h && parseInt(m) < 24 && !_isFinite(hour)) {
1597
+ return m + ":00";
1598
+ } else if (h) {
1599
+ return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
1600
+ }
1545
1601
 
1546
- if (date['get' + utcSTR + ttype]() !== v) {
1547
- date['set' + utcSTR + ttype](NaN);
1548
- return date;
1602
+ return ('000' + hour.toString().replace(":", "")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
1603
+ };
1604
+ var willRafThrottle = function willRafThrottle() {
1605
+ var ticking = false;
1606
+ return function (fn) {
1607
+ if (!ticking) {
1608
+ window.requestAnimationFrame(function () {
1609
+ fn();
1610
+ ticking = false;
1611
+ });
1612
+ ticking = true;
1549
1613
  }
1614
+ };
1615
+ };
1616
+ var rafThrottle = function rafThrottle(fn) {
1617
+ var throttle = willRafThrottle();
1618
+ return function () {
1619
+ throttle(fn);
1620
+ };
1621
+ };
1622
+ var intsToHour = function intsToHour(_ref) {
1623
+ var open = _ref.open,
1624
+ close = _ref.close;
1625
+ return intToHour(open) + ' - ' + intToHour(close);
1626
+ };
1627
+ function isSmallDevice() {
1628
+ var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
1629
+ var smallDeviceQuery = window.matchMedia ? window.matchMedia("(max-width: ".concat(width + scrollWidth$1, "px)")) : {
1630
+ matches: false
1631
+ };
1632
+ return smallDeviceQuery.matches;
1633
+ }
1634
+ function isHighDensity() {
1635
+ return window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches) || window.devicePixelRatio && window.devicePixelRatio > 1.3;
1636
+ }
1637
+ function isRetina() {
1638
+ return (window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches) || window.devicePixelRatio && window.devicePixelRatio >= 2) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
1639
+ }
1640
+ function isMobile() {
1641
+ var check = false;
1550
1642
 
1551
- if (ttype !== 'Date') {
1552
- date['set' + utcSTR + 'Date'](prevDay);
1643
+ if (typeof navigator === 'undefined') {
1644
+ return false;
1645
+ }
1553
1646
 
1554
- if (date['get' + utcSTR + ttype]() !== v) {
1555
- date['set' + utcSTR + 'Date'](0);
1556
- return date;
1557
- }
1558
- }
1647
+ (function (a) {
1648
+ if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ -/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
1649
+ })(navigator.userAgent || navigator.vendor || window['opera']);
1559
1650
 
1560
- return date;
1561
- }, index];
1651
+ return check;
1652
+ }
1653
+ var isPWA = function isPWA() {
1654
+ return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches;
1562
1655
  };
1563
-
1564
- var getText = function getText(type, total) {
1565
- var slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 99;
1566
- return [function (date, messages, noUTC) {
1567
- return messages(type.toLowerCase(), date['get' + (noUTC ? '' : 'UTC') + type]()).slice(0, slice);
1568
- }];
1656
+ function isTouchDevice() {
1657
+ return window.document && 'ontouchstart' in window.document.documentElement;
1658
+ }
1659
+ var isIOS = function isIOS() {
1660
+ return /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
1569
1661
  };
1662
+ var isIPad = function isIPad() {
1663
+ return navigator.userAgent.match(/iPad/i) != null;
1664
+ };
1665
+ var getNumberInputType2 = function getNumberInputType2() {
1666
+ var isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
1667
+ return isMobile() ? isIOS ? "tel" : "number" : "text";
1668
+ };
1669
+ var getNumberInputType = function getNumberInputType() {
1670
+ return "tel";
1671
+ };
1672
+ function addHttp(s, secure) {
1673
+ s = (s || '').trim();
1570
1674
 
1571
- var yearParse = function yearParse(y, date, failOnFormat) {
1572
- var formattedY = y.length === 2 && y !== '20' ? '20' + y : y.length === 4 ? y : '';
1573
-
1574
- if (formattedY === '') {
1575
- if (failOnFormat) {
1576
- var found = date.getUTCFullYear().toString().indexOf(y);
1577
- return found === 0 || found === 2 ? date.getUTCFullYear() : '\0';
1578
- } else {
1579
- return date.getUTCFullYear();
1580
- }
1675
+ if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) {
1676
+ return s;
1581
1677
  } else {
1582
- return formattedY;
1678
+ return "http".concat(secure ? 's' : '', "://") + s;
1583
1679
  }
1584
- };
1680
+ }
1681
+ var protocols = "(^|\\s|\xA0)(https?://)?(www\\.)?";
1682
+ var subdomains = '([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]?\\.)*';
1683
+ var domain = '(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\\.[a-zA-Z]{2,3})';
1684
+ var resource = "[\xA1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFa-zA-Z0-9-._~:/?#%[\\]@!$&'()*+,;=]*";
1685
+ var linkRegex = new RegExp(protocols + subdomains + domain + resource);
1686
+ function isUrl(url) {
1687
+ return linkRegex.test(addHttp(url));
1688
+ }
1689
+ function ellipsis() {
1690
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1691
+ var length = arguments.length > 1 ? arguments[1] : undefined;
1585
1692
 
1586
- var val = {
1587
- yyyy: getSet(0, 'FullYear', 0, function (v) {
1588
- return v;
1589
- }, yearParse),
1590
- yy: getSet(0, 'FullYear', 0, function (v) {
1591
- return (v + "").slice(2, 4);
1592
- }, yearParse),
1593
- M: getSet(1, 'Month', 1),
1594
- MM: getSet(1, 'Month', 1, addZero),
1595
- L: getText('Month', 12, 3),
1596
- LL: getText('Month', 12),
1597
- d: getSet(2, 'Date'),
1598
- dd: getSet(2, 'Date', 0, addZero),
1599
- D: getText('Day', 7, 3),
1600
- DD: getText('Day', 7),
1601
- m: getSet(4, 'Minutes'),
1602
- mm: getSet(4, 'Minutes', 0, addZero),
1603
- h: getSet(5, 'Hours'),
1604
- hh: getSet(5, 'Hours', 0, addZero),
1605
- ss: getSet(6, 'Seconds', 0, addZero),
1606
- SSS: getSet(7, 'Milliseconds', 0, addZero)
1607
- };
1608
- function formatDateToPattern(format) {
1609
- return format.replace(escapedValidParts, function (_, _1, _2) {
1610
- return _1 + (_2 === 'yy' ? '##' : _2 === 'yyyy' ? '####' : '0#');
1611
- });
1693
+ if (str.length > length) {
1694
+ var words = str.slice(0, length).split(' ');
1695
+ if (str.split(' ').indexOf(words[words.length - 1]) < 0) words = words.slice(0, words.length - 1);
1696
+ return words.join(' ') + '...';
1697
+ } else return str;
1612
1698
  }
1613
- function formatDate(date, format, messages, noUTC) {
1614
- if (!date) return '';
1615
- var separators = format.replace(escapedValidParts, '\0').split('\0');
1616
- var parts = format.match(escapedValidParts);
1617
- var formattedDate = parts.reduce(function (acc, part) {
1618
- return acc.concat(separators.length ? [separators.shift()] : [], part.replace(validParts, ''), val[part.match(validParts)[0]][0](date, messages, noUTC));
1619
- }, []);
1620
- return formattedDate.join('').replace(/\\([dDmLhMy])/g, '$1');
1699
+ function safeNewLineToBr(str, keepMany) {
1700
+ var result = (str || "").replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
1701
+
1702
+ if (keepMany === true) {
1703
+ return result.replace(/\n/g, '<br/>');
1704
+ }
1705
+
1706
+ return result.replace(/\n+/g, '<br/>');
1621
1707
  }
1622
1708
 
1623
- var now = function now() {
1624
- return new Date();
1625
- };
1709
+ function padGroups(pattern, value) {
1710
+ return pattern.split('').reduce(function (_ref2, char, i) {
1711
+ var _ref3 = _slicedToArray(_ref2, 2),
1712
+ acc = _ref3[0],
1713
+ value = _ref3[1];
1626
1714
 
1627
- function parseDate(str, possibleDate, format, messages, failOnFormat, noUTC) {
1628
- if (!str) return possibleDate;
1629
- var separators = format.replace(escapedValidParts, '\0').split('\0');
1630
- var parts = format.match(escapedValidParts);
1631
- var mutations = [];
1632
- parts.reduce(function (rest, part, i) {
1633
- var separator = (separators.length ? separators.shift() : '') + part.replace(validParts, '');
1634
- var current = rest.slice(separator.length);
1715
+ if (char === '0') {
1716
+ var shouldHave = pattern.slice(i).search(/[^0#?*]/);
1717
+ var has = value.slice(i).search(/\D/);
1635
1718
 
1636
- if (current && separator === rest.slice(0, separator.length)) {
1637
- var setType = part.match(validParts)[0];
1638
- var nextSeparator = separators[0];
1639
- var nextStrIndex = current.indexOf(nextSeparator + (parts[i + 1] || '').replace(validParts, ''));
1640
- mutations[val[setType][2]] = [val[setType][1], nextStrIndex ? current.slice(0, nextStrIndex) : current];
1641
- return current.slice(nextStrIndex);
1719
+ if (has > 0 && shouldHave > has) {
1720
+ return [acc.concat('0'), acc.join('') + '0' + value.slice(i)];
1721
+ } else {
1722
+ return [acc.concat(value[i]), value];
1723
+ }
1642
1724
  } else {
1643
- return '';
1725
+ return [acc.concat(value[i]), value];
1644
1726
  }
1645
- }, str);
1646
- var date = possibleDate && possibleDate.getTime() !== -1 ? new Date(possibleDate) : now();
1647
- mutations.forEach(function (_ref) {
1648
- var _ref2 = _slicedToArray__default['default'](_ref, 2),
1649
- setter = _ref2[0],
1650
- text = _ref2[1];
1651
-
1652
- return setter(text, date, messages, failOnFormat, noUTC);
1653
- });
1654
- return date;
1727
+ }, [[], value])[0].join('');
1655
1728
  }
1656
1729
 
1657
- var isNotSelector = function isNotSelector(v) {
1658
- return typeof v !== 'function' || v.length === 0;
1659
- };
1660
-
1661
- var toSelector = function toSelector(v) {
1662
- return isNotSelector(v) ? function (s) {
1663
- return get(callIfFunction(v), s);
1664
- } : v;
1665
- };
1666
-
1667
- var mergeSelectors = function mergeSelectors(prev, next) {
1668
- return function (v) {
1669
- return next(prev(v));
1670
- };
1671
- };
1730
+ var digitsToPattern = function digitsToPattern(patternWithLimit, optValue) {
1731
+ var value = optValue || "";
1732
+ if (patternWithLimit[0] === '>' && Number(patternWithLimit.replace(/^>(\d*).*/g, "$1")) > value.length) return value;
1733
+ var pattern = patternWithLimit.replace(/^>\d+/, '');
1734
+ var digits = padGroups(pattern, value).replace(/\D/g, '');
1735
+ var totalRequired = pattern.split(/[0#]/).length - 1;
1736
+ var totalOptional = pattern.split(/[?*]/).length - 1;
1737
+ var available = digits.length - totalRequired;
1672
1738
 
1673
- var concatSelectors = function concatSelectors() {
1674
- for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
1675
- paths[_key] = arguments[_key];
1739
+ if (available > 0 && totalOptional > 0) {
1740
+ var _i = 0;
1741
+ return digitsToPattern(pattern.replace(/\?/g, function () {
1742
+ return _i++ < available ? '#' : '';
1743
+ }).replace('*', new Array(Math.max(0, available - _i + 1)).join("#")), value);
1676
1744
  }
1677
1745
 
1678
- return paths.reduce(function (_ref, path) {
1679
- var _ref2 = _slicedToArray__default['default'](_ref, 2),
1680
- selector = _ref2[0],
1681
- isSelector = _ref2[1];
1746
+ var i = 0;
1747
+ return pattern.replace(/^>\d*/, '').split('').reduce(function (acc, char) {
1748
+ if (!digits[Math.max(i - 1, 0)] || char === '?' || char === '*') return acc;
1682
1749
 
1683
- return isNotSelector(path) && !isSelector ? [selector.concat(path), false] : [mergeSelectors(toSelector(selector), path), true];
1684
- }, [[], false]);
1750
+ if (char === '#' || char === '0') {
1751
+ return acc + (digits[i++] || '');
1752
+ } else {
1753
+ return acc + char;
1754
+ }
1755
+ }, '');
1685
1756
  };
1686
- var COMPLETE_ACTION = {};
1687
- var REDUCE = {};
1688
- var FETCH = {};
1689
- var SKIP_FETCH = {};
1690
- var SKIP_DISPATCH = {};
1691
- var SKIPPED_ACTION = {};
1692
- var selectPath = function selectPath(useState) {
1693
- for (var _len2 = arguments.length, paths = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1694
- paths[_key2 - 1] = arguments[_key2];
1695
- }
1696
-
1697
- var _useMemo = React.useMemo(function () {
1698
- return concatSelectors.apply(void 0, paths);
1699
- }, paths),
1700
- _useMemo2 = _slicedToArray__default['default'](_useMemo, 1),
1701
- selector = _useMemo2[0];
1702
-
1703
- var _useState = useState(selector),
1704
- _useState2 = _slicedToArray__default['default'](_useState, 1),
1705
- value = _useState2[0];
1757
+ var normalizeTouch = function normalizeTouch(fn, endFn) {
1758
+ return function (e) {
1759
+ var touch = e.touches[0];
1706
1760
 
1707
- return value;
1761
+ if (e.touches.length > 1 && e.type !== 'touchend') {
1762
+ callIfFunction(endFn, e, touch);
1763
+ } else {
1764
+ callIfFunction(fn, e, touch);
1765
+ }
1766
+ };
1708
1767
  };
1709
- var Action = function Action(fnOrArray) {
1710
- var prevArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1711
- var isArray = Array.isArray(fnOrArray);
1712
-
1713
- if (isArray) {
1714
- // excessive paramaeters called on the action, used for options.
1715
- var actionType = _last__default['default'](prevArgs);
1716
-
1717
- var _fnOrArray = _slicedToArray__default['default'](fnOrArray, 3),
1718
- fetcher = _fnOrArray[0],
1719
- reducer = _fnOrArray[1],
1720
- rollbacker = _fnOrArray[2];
1721
-
1722
- if (actionType === REDUCE) {
1723
- return reducer(null, prevArgs);
1724
- } else if (actionType === FETCH) {
1725
- return fetcher();
1768
+ var normalizeMouse = function normalizeMouse(fn, endFn) {
1769
+ return function (e) {
1770
+ if (e.buttons > 1 && e.type !== 'mouseup') {
1771
+ callIfFunction(endFn, e, e);
1726
1772
  } else {
1727
- return _set__default['default']('extra', fnOrArray.extra, [actionType === SKIP_FETCH ? function () {
1728
- return Promise.resolve();
1729
- } : fetcher, actionType === SKIP_DISPATCH ? undefined : reducer].concat(rollbacker || []));
1773
+ callIfFunction(fn, e, e);
1730
1774
  }
1731
- } else {
1732
- return prevArgs.length < fnOrArray.length ? function () {
1733
- for (var _len3 = arguments.length, moreArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1734
- moreArgs[_key3] = arguments[_key3];
1735
- }
1736
-
1737
- return Action(fnOrArray, _toConsumableArray__default['default'](prevArgs).concat(moreArgs));
1738
- } : Action(fnOrArray.apply(void 0, _toConsumableArray__default['default'](prevArgs)), prevArgs);
1739
- }
1775
+ };
1776
+ };
1777
+ var normalizePress = function normalizePress(fn, endFn) {
1778
+ return function (e) {
1779
+ if (e.touches) {
1780
+ normalizeTouch(fn, endFn)(e);
1781
+ } else {
1782
+ normalizeMouse(fn, endFn)(e);
1783
+ }
1784
+ };
1740
1785
  };
1786
+ var touchClick = function touchClick(cb) {
1787
+ var sensibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
1788
+ return function (e) {
1789
+ var _e$touches;
1741
1790
 
1742
- var mapAction = function mapAction(get, dispatcher, firstRun) {
1743
- return function (action) {
1744
- if (Array.isArray(action)) {
1745
- if (firstRun) {
1746
- return function () {
1747
- return mapAction(get, dispatcher)(action);
1748
- };
1749
- }
1791
+ if (((_e$touches = e.touches) === null || _e$touches === void 0 ? void 0 : _e$touches.length) !== 1) {
1792
+ return;
1793
+ }
1750
1794
 
1751
- var _action = _slicedToArray__default['default'](action, 3),
1752
- fetcher = _action[0],
1753
- reducer = _action[1],
1754
- rollbacker = _action[2];
1795
+ var target = e.target;
1796
+ var originalX = e.touches[0].screenX;
1797
+ var originalY = e.touches[0].screenY;
1755
1798
 
1756
- var _ref3 = action.extra || {},
1757
- skip = _ref3.skip;
1799
+ var isInsideBounds = function isInsideBounds(touch) {
1800
+ return Math.sqrt(Math.pow(originalX - touch.screenX, 2) + Math.pow(originalY - touch.screenY, 2)) < sensibility;
1801
+ };
1758
1802
 
1759
- if (skip && skip(get())) {
1760
- return Promise.resolve(SKIPPED_ACTION);
1803
+ var checkBounds = function checkBounds(e) {
1804
+ if (e.touches.length !== 1) {
1805
+ return;
1761
1806
  }
1762
1807
 
1763
- var fetched = fetcher();
1808
+ if (!isInsideBounds(e.changedTouches[0])) {
1809
+ maybeClick();
1810
+ }
1811
+ };
1764
1812
 
1765
- if (rollbacker) {
1766
- dispatcher(function (prevState) {
1767
- var nextState = reducer(null)(prevState);
1768
- fetched.catch(function (response) {
1769
- dispatcher(rollbacker(prevState, nextState, response));
1770
- });
1771
- return nextState;
1772
- });
1813
+ var maybeClick = function maybeClick(e) {
1814
+ var _e$changedTouches;
1815
+
1816
+ target.removeEventListener('touchend', maybeClick);
1817
+ target.removeEventListener('touchmove', checkBounds);
1818
+
1819
+ if ((e === null || e === void 0 ? void 0 : (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches.length) !== 1) {
1820
+ return;
1773
1821
  }
1774
1822
 
1775
- if (reducer !== undefined) {
1776
- fetched.then(function (response) {
1777
- return dispatcher(reducer(response));
1778
- });
1823
+ if (isInsideBounds(e.changedTouches[0])) {
1824
+ e.preventDefault();
1825
+ cb(e);
1779
1826
  }
1827
+ };
1780
1828
 
1781
- return fetched;
1782
- } else {
1783
- return function () {
1784
- return mapAction(get, dispatcher)(action.apply(void 0, arguments));
1785
- };
1786
- }
1829
+ target.addEventListener('touchend', maybeClick);
1830
+ target.addEventListener('touchmove', checkBounds);
1787
1831
  };
1788
1832
  };
1833
+ var isEmptyHtml = function isEmptyHtml() {
1834
+ var __html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1789
1835
 
1790
- var activateActions = function activateActions(get, dispatcher) {
1791
- for (var _len4 = arguments.length, actions = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
1792
- actions[_key4 - 2] = arguments[_key4];
1836
+ var a = document.createElement('span');
1837
+ a.innerHTML = __html;
1838
+ return a.textContent.replace(/\s/g, '').length === 0;
1839
+ };
1840
+ var getScrollParent = function getScrollParent(node) {
1841
+ if (!node) {
1842
+ return window;
1793
1843
  }
1794
1844
 
1795
- return actions.map(mapAction(get, dispatcher, true));
1796
- };
1797
- var SkipAction = function SkipAction(skip, action) {
1798
- action.extra = _objectSpread__default['default']({}, action.extra, {
1799
- skip: skip
1800
- });
1801
- return action;
1802
- };
1845
+ var overflowY = window.getComputedStyle(node).overflowY;
1846
+ var isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
1803
1847
 
1804
- var compareBest = function compareBest(compare) {
1805
- return function (best, next) {
1806
- return best ? compare(best, next) ? next : best : next;
1807
- };
1808
- };
1809
- var toLowest = function toLowest() {
1810
- var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity__default['default'];
1811
- return compareBest(function (best, next) {
1812
- return getValue(next) < getValue(best);
1813
- });
1848
+ if (isScrollable && (node.scrollHeight > node.clientHeight || overflowY === 'scroll')) {
1849
+ return node;
1850
+ } else {
1851
+ return getScrollParent(node.offsetParent);
1852
+ }
1814
1853
  };
1815
- var toHighest = function toHighest() {
1816
- var getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity__default['default'];
1817
- return compareBest(function (best, next) {
1818
- return getValue(next) > getValue(best);
1854
+ var scrollIntoViewWithOffset = function scrollIntoViewWithOffset(el, offset) {
1855
+ var scrollOffset = getScrollParent(el);
1856
+ var scrollY = scrollOffset === window ? window.pageYOffset : scrollOffset.scrollTop;
1857
+ var elTop = el.getBoundingClientRect().top;
1858
+ var computedOffset = callIfFunction(offset, elTop > 0);
1859
+ var y = el.getBoundingClientRect().top + scrollY + computedOffset;
1860
+ scrollOffset.scrollTo({
1861
+ top: y,
1862
+ behavior: 'smooth'
1819
1863
  });
1820
1864
  };
1865
+ var isElementInView =
1866
+ /*#__PURE__*/
1867
+ function () {
1868
+ var _ref4 = _asyncToGenerator(
1869
+ /*#__PURE__*/
1870
+ _regeneratorRuntime.mark(function _callee(element) {
1871
+ var html, rect;
1872
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1873
+ while (1) {
1874
+ switch (_context.prev = _context.next) {
1875
+ case 0:
1876
+ if (element) {
1877
+ _context.next = 2;
1878
+ break;
1879
+ }
1821
1880
 
1822
- var addExtraProp = function addExtraProp(element, extra) {
1823
- var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1824
- return React__default['default'].cloneElement(element, override ? _objectSpread__default['default']({}, element.props, extra) : _objectSpread__default['default']({}, extra, element.props), element.props.children);
1825
- };
1881
+ return _context.abrupt("return", false);
1826
1882
 
1827
- var useEventListener = function useEventListener(eventName, callback) {
1828
- var deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1829
- React.useEffect(function () {
1830
- window.addEventListener(eventName, callback);
1831
- return function () {
1832
- return window.removeEventListener(eventName, callback);
1833
- };
1834
- }, deps);
1883
+ case 2:
1884
+ if (!(1 !== element.nodeType)) {
1885
+ _context.next = 4;
1886
+ break;
1887
+ }
1888
+
1889
+ return _context.abrupt("return", false);
1890
+
1891
+ case 4:
1892
+ html = document.documentElement;
1893
+ rect = element.getBoundingClientRect();
1894
+
1895
+ if (!IntersectionObserver) {
1896
+ _context.next = 8;
1897
+ break;
1898
+ }
1899
+
1900
+ return _context.abrupt("return", new Promise(function (resolve) {
1901
+ var o = new IntersectionObserver(function (_ref5) {
1902
+ var _ref6 = _slicedToArray(_ref5, 1),
1903
+ entry = _ref6[0];
1904
+
1905
+ resolve(entry.intersectionRatio === 1);
1906
+ o.disconnect();
1907
+ });
1908
+ o.observe(element);
1909
+ }));
1910
+
1911
+ case 8:
1912
+ return _context.abrupt("return", !!rect && rect.bottom >= 0 && rect.right >= 0 && rect.left <= html.clientWidth && rect.top <= html.clientHeight);
1913
+
1914
+ case 9:
1915
+ case "end":
1916
+ return _context.stop();
1917
+ }
1918
+ }
1919
+ }, _callee, this);
1920
+ }));
1921
+
1922
+ return function isElementInView(_x) {
1923
+ return _ref4.apply(this, arguments);
1924
+ };
1925
+ }();
1926
+ var i = 0;
1927
+ var getUID = function getUID() {
1928
+ return Date.now().toString(36) + Math.random().toString(36).slice(2) + (i++).toString(36);
1835
1929
  };
1836
- var useEventListenerFor = function useEventListenerFor(element, eventName, callback) {
1837
- var deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1838
- React.useEffect(function () {
1839
- element.addEventListener(eventName, callback);
1840
- return function () {
1841
- return element.removeEventListener(eventName, callback);
1842
- };
1843
- }, deps.concat(element));
1930
+ var getUrlParams = function getUrlParams() {
1931
+ return _fromPairs(Array.from(new URLSearchParams(location.search).entries()));
1844
1932
  };
1845
1933
 
1846
1934
  var disableSelect = function disableSelect(e) {
@@ -1848,10 +1936,10 @@ var disableSelect = function disableSelect(e) {
1848
1936
  };
1849
1937
 
1850
1938
  var createPressEvent = function createPressEvent(onStart) {
1851
- return normalizePress(function (startEvent, info) {
1939
+ return normalizePress$1(function (startEvent, info) {
1852
1940
  var onEnd = onStart(startEvent, info);
1853
- var finish = normalizePress(function (e, info) {
1854
- callIfFunction(onEnd, e, info);
1941
+ var finish = normalizePress$1(function (e, info) {
1942
+ callIfFunction$1(onEnd, e, info);
1855
1943
  window.removeEventListener('selectstart', disableSelect);
1856
1944
  window.removeEventListener('touchend', finish);
1857
1945
  window.removeEventListener('mouseup', finish);
@@ -1868,7 +1956,7 @@ var createPressEvent = function createPressEvent(onStart) {
1868
1956
  var createPressAndHoldEvent = function createPressAndHoldEvent(onStart, interval) {
1869
1957
  return createPressEvent(function (startEvent, info) {
1870
1958
  var _concat = [].concat(onStart(startEvent, info)),
1871
- _concat2 = _slicedToArray__default['default'](_concat, 2),
1959
+ _concat2 = _slicedToArray(_concat, 2),
1872
1960
  onInterval = _concat2[0],
1873
1961
  onEnd = _concat2[1];
1874
1962
 
@@ -1878,8 +1966,8 @@ var createPressAndHoldEvent = function createPressAndHoldEvent(onStart, interval
1878
1966
  var intervalId = setInterval(function () {
1879
1967
  onInterval(i++);
1880
1968
  }, interval);
1881
- return normalizePress(function (e, info) {
1882
- callIfFunction(onEnd, e, info);
1969
+ return normalizePress$1(function (e, info) {
1970
+ callIfFunction$1(onEnd, e, info);
1883
1971
  clearInterval(intervalId);
1884
1972
  });
1885
1973
  } else {
@@ -1895,8 +1983,8 @@ var createPressAndHoldEvent = function createPressAndHoldEvent(onStart, interval
1895
1983
  };
1896
1984
 
1897
1985
  run();
1898
- return normalizePress(function (e, info) {
1899
- callIfFunction(onEnd, e, info);
1986
+ return normalizePress$1(function (e, info) {
1987
+ callIfFunction$1(onEnd, e, info);
1900
1988
  running = false;
1901
1989
  });
1902
1990
  }
@@ -1905,16 +1993,16 @@ var createPressAndHoldEvent = function createPressAndHoldEvent(onStart, interval
1905
1993
  var createPressAndMoveEvent = function createPressAndMoveEvent(onStart) {
1906
1994
  return createPressEvent(function (startEvent, info) {
1907
1995
  var _concat3 = [].concat(onStart(startEvent, info)),
1908
- _concat4 = _slicedToArray__default['default'](_concat3, 2),
1996
+ _concat4 = _slicedToArray(_concat3, 2),
1909
1997
  onMove = _concat4[0],
1910
1998
  onEnd = _concat4[1];
1911
1999
 
1912
- var finish = normalizePress(function (e, info) {
1913
- callIfFunction(onEnd, e, info);
2000
+ var finish = normalizePress$1(function (e, info) {
2001
+ callIfFunction$1(onEnd, e, info);
1914
2002
  window.removeEventListener('touchmove', move);
1915
2003
  window.removeEventListener('mousemove', move);
1916
2004
  });
1917
- var move = normalizePress(onMove, finish);
2005
+ var move = normalizePress$1(onMove, finish);
1918
2006
 
1919
2007
  if (startEvent.touches) {
1920
2008
  window.addEventListener('touchmove', move, {
@@ -1942,9 +2030,8 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
1942
2030
  }
1943
2031
 
1944
2032
  var status;
1945
- var lazyResolver;
1946
- var lazyPromise;
1947
- var checker = _isEqual__default['default'];
2033
+ var awaitReadResolver;
2034
+ var checker = _isEqual;
1948
2035
  var lazyArgs = EMPTY_ARGS;
1949
2036
 
1950
2037
  var _uid = Math.random().toString() + Date.now();
@@ -1952,19 +2039,20 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
1952
2039
  var result;
1953
2040
  var currentValue = UNDEFINED_CURRENT_VALUE;
1954
2041
 
1955
- var suspend = function suspend(maybePromise) {
1956
- status = "pending";
1957
- lazyResolver = _identity__default['default'];
1958
- lazyPromise = _isFunction__default['default'](maybePromise) ? new Promise(function (res) {
1959
- return lazyResolver = res;
1960
- }) : Promise.resolve();
1961
- var returnedPromise = lazyPromise.then(function () {
2042
+ var promisify = function promisify(maybePromise, resolveNow) {
2043
+ return (_isFunction(maybePromise) && !resolveNow ? new Promise(function (res) {
2044
+ return awaitReadResolver = res;
2045
+ }) : Promise.resolve()).then(function () {
1962
2046
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1963
2047
  args[_key2] = arguments[_key2];
1964
2048
  }
1965
2049
 
1966
- return callIfFunction.apply(void 0, [maybePromise].concat(rootArgs, _toConsumableArray__default['default'](lazyArgs), args));
1967
- }).then(function (r) {
2050
+ return callIfFunction$1.apply(void 0, [maybePromise].concat(rootArgs, _toConsumableArray(lazyArgs), args));
2051
+ });
2052
+ };
2053
+
2054
+ var onPromiseSuccess = function onPromiseSuccess(returnedPromise) {
2055
+ return function (r) {
1968
2056
  if (returnedPromise !== suspender) {
1969
2057
  return suspender;
1970
2058
  }
@@ -1973,7 +2061,11 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
1973
2061
  currentValue = r;
1974
2062
  result = r;
1975
2063
  return r;
1976
- }, function (e) {
2064
+ };
2065
+ };
2066
+
2067
+ var onPromiseError = function onPromiseError(returnedPromise) {
2068
+ return function (e) {
1977
2069
  if (returnedPromise !== suspender) {
1978
2070
  return suspender;
1979
2071
  }
@@ -1981,14 +2073,21 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
1981
2073
  status = "error";
1982
2074
  result = e;
1983
2075
  return Promise.reject(e);
1984
- });
2076
+ };
2077
+ };
2078
+
2079
+ var suspend = function suspend(maybePromise) {
2080
+ status = "pending";
2081
+ awaitReadResolver = _identity;
2082
+ var returnedPromise = promisify(maybePromise);
2083
+ returnedPromise.then(onPromiseSuccess(returnedPromise), onPromiseError(returnedPromise));
1985
2084
  return returnedPromise;
1986
2085
  };
1987
2086
 
1988
2087
  var suspender = suspend(maybePromise);
1989
2088
  return {
1990
2089
  read: function read() {
1991
- lazyResolver();
2090
+ awaitReadResolver();
1992
2091
 
1993
2092
  if (status === "pending") {
1994
2093
  throw suspender;
@@ -1999,14 +2098,14 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
1999
2098
  }
2000
2099
  },
2001
2100
  promise: function promise() {
2002
- lazyResolver();
2101
+ awaitReadResolver();
2003
2102
  return suspender;
2004
2103
  },
2005
2104
  refresh: function refresh(force) {
2006
2105
  if (status !== "pending" || force) {
2007
2106
  suspender = suspend(maybePromise);
2008
2107
  _uid = Math.random().toString() + Date.now();
2009
- callIfFunction(refreshCallback, this);
2108
+ callIfFunction$1(refreshCallback, this);
2010
2109
  }
2011
2110
 
2012
2111
  return this;
@@ -2037,13 +2136,27 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
2037
2136
  _getCurrentValue: function _getCurrentValue() {
2038
2137
  return currentValue;
2039
2138
  },
2139
+ silentRefresh: function silentRefresh() {
2140
+ var currentSuspender = suspender;
2141
+ var suspended = promisify(maybePromise, true).then(function (v) {
2142
+ if (currentSuspender === suspender) {
2143
+ suspender = suspended;
2144
+ }
2145
+
2146
+ return v;
2147
+ });
2148
+ suspended.then(onPromiseSuccess(suspended), onPromiseError(suspended));
2149
+ _uid = Math.random().toString() + Date.now();
2150
+ callIfFunction$1(refreshCallback, this);
2151
+ return suspended;
2152
+ },
2040
2153
  and: function and(lazy) {},
2041
2154
  checkWith: function checkWith(isEqual) {
2042
2155
  checker = isEqual;
2043
2156
  return this;
2044
2157
  },
2045
2158
  localUpdate: function localUpdate(updater) {
2046
- currentValue = callIfFunction(updater, currentValue);
2159
+ currentValue = callIfFunction$1(updater, currentValue);
2047
2160
  return this;
2048
2161
  },
2049
2162
  uid: function uid() {
@@ -2052,75 +2165,7 @@ var innerWrapLazy = function innerWrapLazy(refreshCallback) {
2052
2165
  };
2053
2166
  };
2054
2167
  };
2055
-
2056
- var UNMOUNTED = {};
2057
2168
  var wrapLazy = innerWrapLazy();
2058
- var willUseLazy = function willUseLazy() {
2059
- var promiseCallbackRef = {
2060
- current: null
2061
- };
2062
- var promiseRef = {
2063
- current: new Promise(function (res) {
2064
- return promiseCallbackRef.current = res;
2065
- })
2066
- };
2067
-
2068
- var useLazyEffect = function useLazyEffect(callback) {
2069
- var value = lazy._getCurrentValue();
2070
-
2071
- var componentState = React.useRef(value);
2072
- React.useEffect(function () {
2073
- var callbackCaller = function callbackCaller(result) {
2074
- if (componentState.current !== UNMOUNTED) {
2075
- componentState.current = result;
2076
- callback(result);
2077
- promiseRef.current.then(callbackCaller);
2078
- }
2079
- };
2080
-
2081
- promiseRef.current.then(callbackCaller);
2082
- return function () {
2083
- return componentState.current = UNMOUNTED;
2084
- };
2085
- }, []);
2086
- React.useEffect(function () {
2087
- if (value !== componentState.current) {
2088
- callback(value);
2089
- }
2090
- }, [value]);
2091
- };
2092
-
2093
- var lazy = innerWrapLazy(function (lazy) {
2094
- lazy.promise().then(function (result) {
2095
- var tempCallback = promiseCallbackRef.current;
2096
- promiseRef.current = new Promise(function (res) {
2097
- return promiseCallbackRef.current = res;
2098
- });
2099
- tempCallback(result);
2100
- });
2101
- }).apply(void 0, arguments);
2102
- return [lazy, useLazyEffect];
2103
- };
2104
- var willUseAutoLazy = function willUseAutoLazy() {
2105
- var _willUseLazy = willUseLazy.apply(void 0, arguments),
2106
- _willUseLazy2 = _slicedToArray__default['default'](_willUseLazy, 2),
2107
- lazy = _willUseLazy2[0],
2108
- useLazyEffect = _willUseLazy2[1];
2109
-
2110
- var useAutoLazyEffect = function useAutoLazyEffect(extraEffect) {
2111
- var _useState = React.useState(1),
2112
- _useState2 = _slicedToArray__default['default'](_useState, 2),
2113
- update = _useState2[1];
2114
-
2115
- useLazyEffect(function () {
2116
- return update(function (i) {
2117
- return i + 1;
2118
- });
2119
- });
2120
- };
2121
-
2122
- return [lazy, useAutoLazyEffect];
2123
- };
2124
2169
 
2125
2170
  var SECOND = 1000;
2126
2171
  var MINUTE = SECOND * 60;
@@ -2146,22 +2191,22 @@ var isSameDay = function isSameDay(a, b) {
2146
2191
  return getStartOfDay(a, utc).getTime() === getStartOfDay(b, utc).getTime();
2147
2192
  };
2148
2193
  var intervalsIntersect = function intervalsIntersect(_ref, _ref2) {
2149
- var _ref3 = _slicedToArray__default['default'](_ref, 2),
2194
+ var _ref3 = _slicedToArray(_ref, 2),
2150
2195
  a1 = _ref3[0],
2151
2196
  a2 = _ref3[1];
2152
2197
 
2153
- var _ref4 = _slicedToArray__default['default'](_ref2, 2),
2198
+ var _ref4 = _slicedToArray(_ref2, 2),
2154
2199
  b1 = _ref4[0],
2155
2200
  b2 = _ref4[1];
2156
2201
 
2157
2202
  return b2 >= a1 && b1 <= a2;
2158
2203
  };
2159
2204
  var intervalsIntersectExclusive = function intervalsIntersectExclusive(_ref5, _ref6) {
2160
- var _ref7 = _slicedToArray__default['default'](_ref5, 2),
2205
+ var _ref7 = _slicedToArray(_ref5, 2),
2161
2206
  a1 = _ref7[0],
2162
2207
  a2 = _ref7[1];
2163
2208
 
2164
- var _ref8 = _slicedToArray__default['default'](_ref6, 2),
2209
+ var _ref8 = _slicedToArray(_ref6, 2),
2165
2210
  b1 = _ref8[0],
2166
2211
  b2 = _ref8[1];
2167
2212
 
@@ -2175,11 +2220,11 @@ var intervalsIntersection = function intervalsIntersection(a, b) {
2175
2220
  return [[Math.max(a[0], b[0]), Math.min(a[1], b[1])]];
2176
2221
  };
2177
2222
  var diffIntervals = function diffIntervals(_ref9, _ref10) {
2178
- var _ref11 = _slicedToArray__default['default'](_ref9, 2),
2223
+ var _ref11 = _slicedToArray(_ref9, 2),
2179
2224
  a1 = _ref11[0],
2180
2225
  a2 = _ref11[1];
2181
2226
 
2182
- var _ref12 = _slicedToArray__default['default'](_ref10, 2),
2227
+ var _ref12 = _slicedToArray(_ref10, 2),
2183
2228
  b1 = _ref12[0],
2184
2229
  b2 = _ref12[1];
2185
2230
 
@@ -2209,7 +2254,19 @@ var blockDiffIntervals = function blockDiffIntervals(a, b) {
2209
2254
  return intervalsIntersect(a, b) ? [] : [a];
2210
2255
  };
2211
2256
  var startBlockDiffIntervals = function startBlockDiffIntervals(a, b) {
2212
- return intervalsIntersectExclusive(a, b) && a[0] > b[0] ? [] : [a];
2257
+ return intervalsIntersectExclusive(a, b) && a[0] >= b[0] ? [] : [a];
2258
+ };
2259
+
2260
+ var timerPromise = function timerPromise(time) {
2261
+ return new Promise(function (res) {
2262
+ return setTimeout(res, time);
2263
+ });
2264
+ };
2265
+ var cancelableTimer = function cancelableTimer(res, time) {
2266
+ var v = setTimeout(res, time);
2267
+ return function () {
2268
+ return clearTimeout(v);
2269
+ };
2213
2270
  };
2214
2271
 
2215
2272
  var formatJoin = function formatJoin(arr) {
@@ -2222,129 +2279,89 @@ var formatJoinArr = function formatJoinArr(arr, separator, lastSeparator) {
2222
2279
  return i < arr.length - 2 ? [v, separator] : i < arr.length - 1 ? [v, lastSeparator] : [v];
2223
2280
  });
2224
2281
  };
2282
+ var removeAccents = function removeAccents(str) {
2283
+ return (str || "").normalize('NFD').replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u0898-\u089F\u08C9-\u08D2\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C3C\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u1714\u1715\u1734\u17C9-\u17D3\u17DD\u1939-\u193B\u1A60\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABE\u1AC1-\u1ACB\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1BE6\u1BF2\u1BF3\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA806\uA82C\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDD4E\uDD69-\uDD6D\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC46\uDC70\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3B\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74\uDFCE-\uDFD0\uDFD2\uDFD3\uDFE1\uDFE2]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97\uDF41\uDF42\uDF5A]|\uD80D[\uDC47-\uDC55]|\uD818\uDD2F|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD6B\uDD6C\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDC30-\uDC6D\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDDEE\uDDEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g, "");
2284
+ };
2285
+ var asciify = function asciify(str) {
2286
+ return removeAccents(str || "").replace(/[^\x00-\x7F]/g, "");
2287
+ };
2225
2288
  var normalizeText = function normalizeText(str) {
2226
- return (str || "").normalize('NFD').replace(/[0-9A-Za-z\xC0-\xD6\xD9-\xF6\xF9-\u017E\u1E00-\u1EFF]/g, "").toLowerCase();
2227
- };
2228
-
2229
- exports.Action = Action;
2230
- exports.COMPLETE_ACTION = COMPLETE_ACTION;
2231
- exports.DAY = DAY;
2232
- exports.FETCH = FETCH;
2233
- exports.HOUR = HOUR;
2234
- exports.MINUTE = MINUTE;
2235
- exports.MONTH = MONTH;
2236
- exports.REDUCE = REDUCE;
2237
- exports.SECOND = SECOND;
2238
- exports.SKIPPED_ACTION = SKIPPED_ACTION;
2239
- exports.SKIP_DISPATCH = SKIP_DISPATCH;
2240
- exports.SKIP_FETCH = SKIP_FETCH;
2241
- exports.SkipAction = SkipAction;
2242
- exports.WEEK = WEEK;
2243
- exports.YEAR = YEAR;
2244
- exports._s = _s;
2245
- exports.activateActions = activateActions;
2246
- exports.addExtraProp = addExtraProp;
2247
- exports.addHttp = addHttp;
2248
- exports.addQueryString = addQueryString;
2249
- exports.addZero = addZero;
2250
- exports.animationTiming = animationTiming;
2251
- exports.blockDiffIntervals = blockDiffIntervals;
2252
- exports.callIfFunction = callIfFunction;
2253
- exports.callIfFunctions = callIfFunctions;
2254
- exports.callMany = callMany;
2255
- exports.compareBest = compareBest;
2256
- exports.concatSelectors = concatSelectors;
2257
- exports.constrainEvent = constrainEvent;
2258
- exports.createPressAndHoldEvent = createPressAndHoldEvent;
2259
- exports.createPressAndMoveEvent = createPressAndMoveEvent;
2260
- exports.createPressEvent = createPressEvent;
2261
- exports.createPromiseQueue = createPromiseQueue;
2262
- exports.createPromiseResolverPair = createPromiseResolverPair;
2263
- exports.customTheme = customTheme;
2264
- exports.diffIntervals = diffIntervals;
2265
- exports.digitsToPattern = digitsToPattern;
2266
- exports.ellipsis = ellipsis;
2267
- exports.fixMediaQuery = fixMediaQuery;
2268
- exports.formFetch = formFetch;
2269
- exports.formFetchWithResponse = formFetchWithResponse;
2270
- exports.formatDate = formatDate;
2271
- exports.formatDateToPattern = formatDateToPattern;
2272
- exports.formatHour = formatHour;
2273
- exports.formatJoin = formatJoin;
2274
- exports.formatJoinArr = formatJoinArr;
2275
- exports.formatPath = formatPath;
2276
- exports.getClosestOffsetScroll = getClosestOffsetScroll;
2277
- exports.getColor = getColor;
2278
- exports.getFetcher = getFetcher;
2279
- exports.getFetcherWithResponse = getFetcherWithResponse;
2280
- exports.getMargin = getMargin;
2281
- exports.getNumberInputType = getNumberInputType;
2282
- exports.getNumberInputType2 = getNumberInputType2;
2283
- exports.getScrollParent = getScrollParent;
2284
- exports.getStartOfDay = getStartOfDay;
2285
- exports.getUID = getUID;
2286
- exports.getUrlParams = getUrlParams;
2287
- exports.identityFn = identityFn;
2288
- exports.identityOpacityFrames = identityOpacityFrames;
2289
- exports.identityTranslateFrames = identityTranslateFrames;
2290
- exports.ifNotProp = ifNotProp;
2291
- exports.ifProp = ifProp;
2292
- exports.ifPropEquals = ifPropEquals;
2293
- exports.ifUndefined = ifUndefined;
2294
- exports.intToHour = intToHour;
2295
- exports.intervalsIntersect = intervalsIntersect;
2296
- exports.intervalsIntersectExclusive = intervalsIntersectExclusive;
2297
- exports.intervalsIntersection = intervalsIntersection;
2298
- exports.intsToHour = intsToHour;
2299
- exports.isElementInView = isElementInView;
2300
- exports.isEmptyHtml = isEmptyHtml;
2301
- exports.isHighDensity = isHighDensity;
2302
- exports.isIOS = isIOS;
2303
- exports.isIPad = isIPad;
2304
- exports.isMobile = isMobile;
2305
- exports.isPWA = isPWA;
2306
- exports.isRetina = isRetina;
2307
- exports.isSameDay = isSameDay;
2308
- exports.isSmallDevice = isSmallDevice;
2309
- exports.isTouchDevice = isTouchDevice;
2310
- exports.isUrl = isUrl;
2311
- exports.lazyValue = lazyValue;
2312
- exports.linkRegex = linkRegex;
2313
- exports.mapGetOrSet = mapGetOrSet;
2314
- exports.media = media;
2315
- exports.normalizeMouse = normalizeMouse;
2316
- exports.normalizePress = normalizePress;
2317
- exports.normalizeText = normalizeText;
2318
- exports.normalizeTouch = normalizeTouch;
2319
- exports.notPrinterMedia = notPrinterMedia;
2320
- exports.oneWayAnimation = oneWayAnimation;
2321
- exports.parseDate = parseDate;
2322
- exports.postFetcher = postFetcher;
2323
- exports.postFetcherWithResponse = postFetcherWithResponse;
2324
- exports.preventDefault = preventDefault;
2325
- exports.printerMedia = printerMedia;
2326
- exports.prop = prop;
2327
- exports.rafThrottle = rafThrottle;
2328
- exports.safeNewLineToBr = safeNewLineToBr;
2329
- exports.scrollIntoViewWithOffset = scrollIntoViewWithOffset;
2330
- exports.scrollWidth = scrollWidth;
2331
- exports.selectPath = selectPath;
2332
- exports.smoothScroll = smoothScroll;
2333
- exports.startBlockDiffIntervals = startBlockDiffIntervals;
2334
- exports.stopPropagation = stopPropagation;
2335
- exports.styledExtend = styledExtend;
2336
- exports.timerPromise = timerPromise;
2337
- exports.toHighest = toHighest;
2338
- exports.toLowest = toLowest;
2339
- exports.touchClick = touchClick;
2340
- exports.twoWayAnimation = twoWayAnimation;
2341
- exports.unWill = unWill;
2342
- exports.useEventListener = useEventListener;
2343
- exports.useEventListenerFor = useEventListenerFor;
2344
- exports.using = using;
2345
- exports.vheight = vheight;
2346
- exports.will = will;
2347
- exports.willRafThrottle = willRafThrottle;
2348
- exports.willUseAutoLazy = willUseAutoLazy;
2349
- exports.willUseLazy = willUseLazy;
2350
- exports.wrapLazy = wrapLazy;
2289
+ return removeAccents(str).toLowerCase();
2290
+ };
2291
+ var normalizeTextUrl = function normalizeTextUrl(str) {
2292
+ return removeAccents(str).replace(/[\s.\u0022&/]/g, '-').replace(/-{2,}/g, '-').toLowerCase();
2293
+ };
2294
+ var willFormatDecimal = function willFormatDecimal() {
2295
+ var digits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
2296
+
2297
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
2298
+ max = _ref.max,
2299
+ min = _ref.min,
2300
+ padTo = _ref.padTo,
2301
+ zeroless = _ref.zeroless,
2302
+ clean = _ref.clean;
2303
+
2304
+ var splitRegex = new RegExp("(\\d+)(\\d{".concat(digits, "})"));
2305
+ var singleRegex = new RegExp("/^([^,]*,\\d{0,".concat(digits, ").*/"));
2306
+
2307
+ var pad = function pad(str) {
2308
+ return padTo ? str.indexOf(",") >= 0 ? _padCharsEnd("0", str.indexOf(",") + padTo + 1, str) : _padCharsEnd("0", str.length + 1 + padTo, str + ",") : str;
2309
+ };
2310
+
2311
+ var constrain = function constrain(val) {
2312
+ if (_isNumber(max) && parseFloat(val.replace(",", ".")) > max) return max.toString();
2313
+ if (_isNumber(min) && parseFloat(val.replace(",", ".")) < min) return min.toString();
2314
+ return val;
2315
+ };
2316
+
2317
+ var cleaned = function cleaned(val) {
2318
+ return clean ? val.replace(/,$/, '').replace(/^0*,/, '0,') || "0" : val;
2319
+ };
2320
+
2321
+ return function (v) {
2322
+ var skipZero = function skipZero(finalV) {
2323
+ return v !== '0' && zeroless && finalV === '0' ? '' : finalV.replace(/^0+([^,])/, '$1');
2324
+ };
2325
+
2326
+ var formatted = _flow(constrain, pad, skipZero, cleaned);
2327
+
2328
+ if (_isNumber(v)) {
2329
+ return formatted(v.toString().replace(".", ","));
2330
+ }
2331
+
2332
+ var fixComma = function fixComma(v) {
2333
+ return v.replace(/,/g, '').replace(splitRegex, "$1,$2");
2334
+ };
2335
+
2336
+ var format = function format() {
2337
+ var allowedChars = (v || "").replace(/[^\d,]/g, "");
2338
+ var commaIndex = allowedChars.indexOf(',');
2339
+
2340
+ if (commaIndex >= 0 && commaIndex < allowedChars.length - 1 - digits) {
2341
+ var alteredComma = fixComma(allowedChars);
2342
+
2343
+ if (_isNumber(max) && parseFloat(alteredComma.replace(",", ".")) > max) {
2344
+ return fixComma(allowedChars.slice(0, commaIndex + 1 + digits));
2345
+ }
2346
+
2347
+ return alteredComma;
2348
+ }
2349
+
2350
+ var simpleNumber = allowedChars.replace(singleRegex, "$1");
2351
+
2352
+ if (_isNumber(max) && parseInt(simpleNumber) > max) {
2353
+ return simpleNumber.slice(0, -1);
2354
+ }
2355
+
2356
+ return simpleNumber;
2357
+ };
2358
+
2359
+ var result = format();
2360
+ return formatted(result);
2361
+ };
2362
+ };
2363
+ var parseDecimalToNumber = function parseDecimalToNumber(v) {
2364
+ return _isString(v) ? Number(v.replace(/\./g, '').replace(',', ".")) : v || 0;
2365
+ };
2366
+
2367
+ export { Action, COMPLETE_ACTION, DAY, FETCH, HOUR, MINUTE, MONTH, REDUCE, SECOND, SKIPPED_ACTION, SKIP_DISPATCH, SKIP_FETCH, SkipAction, WEEK, YEAR, _s, activateActions, addExtraProp, addHttp, addQueryString, addZero, animationTiming, asciify, asyncDebounce, blockDiffIntervals, callIfFunction, callIfFunctions, callMany, cancelableTimer, compareBest, concatSelectors, constrainEvent, createPressAndHoldEvent, createPressAndMoveEvent, createPressEvent, createPromiseQueue, createPromiseResolverPair, createSimplePromiseLock, customTheme, diffIntervals, digitsToPattern, ellipsis, fixMediaQuery, formFetch, formFetchWithResponse, formatDate, formatDateToPattern, formatHour, formatJoin, formatJoinArr, formatPath, getClosestOffsetScroll, getColor, getFetcher, getFetcherWithResponse, getMargin, getNumberInputType, getNumberInputType2, getScrollParent, getStartOfDay, getUID, getUrlParams, identityFn, identityOpacityFrames, identityTranslateFrames, ifNotProp, ifProp, ifPropEquals, ifUndefined, intToHour, intervalsIntersect, intervalsIntersectExclusive, intervalsIntersection, intsToHour, isElementInView, isEmptyHtml, isHighDensity, isIOS, isIPad, isMobile, isPWA, isRetina, isSameDay, isSmallDevice, isTouchDevice, isUrl, lazyValue, linkRegex, mapGetOrSet, media, normalizeMouse, normalizePress, normalizeText, normalizeTextUrl, normalizeTouch, notPrinterMedia, oneWayAnimation, parseDate, parseDecimalToNumber, postFetcher, postFetcherWithResponse, preventDefault, printerMedia, promiseMapReduce, prop, queryStringToObj, rafThrottle, removeAccents, safeNewLineToBr, scrollIntoViewWithOffset, scrollWidth, selectPath, smoothScroll, startBlockDiffIntervals, stopPropagation, styledExtend, timerPromise, toHighest, toLowest, touchClick, twoWayAnimation, unWill, useEventListener, useEventListenerFor, using, vheight, will, willFormatDecimal, willRafThrottle, wrapLazy };