@startlibs/utils 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ActionUtils.mjs +117 -0
- package/lib/ActionUtils.mjs.map +1 -0
- package/lib/FetchUtils.mjs +100 -0
- package/lib/FetchUtils.mjs.map +1 -0
- package/lib/createPressEvent.mjs +74 -0
- package/lib/createPressEvent.mjs.map +1 -0
- package/lib/fixMediaQuery.mjs +64 -0
- package/lib/fixMediaQuery.mjs.map +1 -0
- package/lib/formatDate.mjs +110 -0
- package/lib/formatDate.mjs.map +1 -0
- package/lib/formatUtils.mjs +64 -0
- package/lib/formatUtils.mjs.map +1 -0
- package/lib/getClosestOffsetScroll.mjs +15 -0
- package/lib/getClosestOffsetScroll.mjs.map +1 -0
- package/lib/hooks/useEventListener.mjs +27 -0
- package/lib/hooks/useEventListener.mjs.map +1 -0
- package/lib/index.cjs +1811 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.mjs +19 -0
- package/lib/index.mjs.map +1 -0
- package/lib/lodashUtils.mjs +131 -0
- package/lib/lodashUtils.mjs.map +1 -0
- package/lib/promiseUtils.mjs +92 -0
- package/lib/promiseUtils.mjs.map +1 -0
- package/lib/reactUtils.mjs +12 -0
- package/lib/reactUtils.mjs.map +1 -0
- package/lib/reduceUtils.mjs +14 -0
- package/lib/reduceUtils.mjs.map +1 -0
- package/lib/smoothScroll.mjs +59 -0
- package/lib/smoothScroll.mjs.map +1 -0
- package/lib/styled.mjs +234 -0
- package/lib/styled.mjs.map +1 -0
- package/lib/timeUtils.mjs +81 -0
- package/lib/timeUtils.mjs.map +1 -0
- package/lib/timerUtils.mjs +11 -0
- package/lib/timerUtils.mjs.map +1 -0
- package/lib/utils.mjs +386 -0
- package/lib/utils.mjs.map +1 -0
- package/lib/wrapLazy.mjs +132 -0
- package/lib/wrapLazy.mjs.map +1 -0
- package/package.json +44 -30
- package/src/ActionUtils.js +90 -0
- package/src/FetchUtils.js +87 -0
- package/src/createPressEvent.jsx +79 -0
- package/src/fixMediaQuery.js +71 -0
- package/src/formatDate.js +121 -0
- package/src/formatUtils.jsx +63 -0
- package/src/getClosestOffsetScroll.js +12 -0
- package/src/hooks/useEventListener.js +26 -0
- package/src/index.js +19 -0
- package/src/lodashUtils.jsx +110 -0
- package/src/promiseUtils.jsx +75 -0
- package/src/reactUtils.jsx +7 -0
- package/src/reduceUtils.jsx +6 -0
- package/src/smoothScroll.js +58 -0
- package/src/styled.js +177 -0
- package/src/timeUtils.jsx +57 -0
- package/src/timerUtils.jsx +10 -0
- package/src/utils.jsx +342 -0
- package/src/wrapLazy.jsx +122 -0
- package/.babelrc +0 -26
- package/lib/index.js +0 -2382
- package/rollup.config.js +0 -44
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,1811 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _awaitAsyncGenerator = require('@babel/runtime/helpers/awaitAsyncGenerator');
|
|
6
|
+
var _wrapAsyncGenerator = require('@babel/runtime/helpers/wrapAsyncGenerator');
|
|
7
|
+
var _times = require('lodash/fp/times');
|
|
8
|
+
var _identity = require('lodash/fp/identity');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var _isPlainObject = require('lodash/fp/isPlainObject');
|
|
13
|
+
var _fromPairs = require('lodash/fp/fromPairs');
|
|
14
|
+
var _isFinite = require('lodash/fp/isFinite');
|
|
15
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
16
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
17
|
+
var _find = require('lodash/fp/find');
|
|
18
|
+
var _reverse = require('lodash/fp/reverse');
|
|
19
|
+
var _isEqual = require('lodash/fp/isEqual');
|
|
20
|
+
var _isFunction = require('lodash/fp/isFunction');
|
|
21
|
+
var _get = require('lodash/fp/get');
|
|
22
|
+
var _unset = require('lodash/fp/unset');
|
|
23
|
+
var polished = require('polished');
|
|
24
|
+
var styled = require('styled-components');
|
|
25
|
+
var createEmotion = require('create-emotion');
|
|
26
|
+
var _flow = require('lodash/fp/flow');
|
|
27
|
+
var _without = require('lodash/fp/without');
|
|
28
|
+
var _flatMap = require('lodash/fp/flatMap');
|
|
29
|
+
var _mapValues = require('lodash/fp/mapValues');
|
|
30
|
+
var _map = require('lodash/fp/map');
|
|
31
|
+
var _filter = require('lodash/fp/filter');
|
|
32
|
+
var _each = require('lodash/fp/each');
|
|
33
|
+
var _concat = require('lodash/fp/concat');
|
|
34
|
+
var _assign = require('lodash/fp/assign');
|
|
35
|
+
var _2 = require('lodash/fp/__');
|
|
36
|
+
var _set = require('lodash/fp/set');
|
|
37
|
+
var _update = require('lodash/fp/update');
|
|
38
|
+
var _toPath = require('lodash/fp/toPath');
|
|
39
|
+
var _pullAt = require('lodash/fp/pullAt');
|
|
40
|
+
var _curry = require('lodash/fp/curry');
|
|
41
|
+
var _last = require('lodash/fp/last');
|
|
42
|
+
var _isString = require('lodash/fp/isString');
|
|
43
|
+
var _isNumber = require('lodash/fp/isNumber');
|
|
44
|
+
var _padCharsEnd = require('lodash/fp/padCharsEnd');
|
|
45
|
+
|
|
46
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
47
|
+
|
|
48
|
+
var _awaitAsyncGenerator__default = /*#__PURE__*/_interopDefault(_awaitAsyncGenerator);
|
|
49
|
+
var _wrapAsyncGenerator__default = /*#__PURE__*/_interopDefault(_wrapAsyncGenerator);
|
|
50
|
+
var _times__default = /*#__PURE__*/_interopDefault(_times);
|
|
51
|
+
var _identity__default = /*#__PURE__*/_interopDefault(_identity);
|
|
52
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
53
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
|
|
54
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
|
|
55
|
+
var _isPlainObject__default = /*#__PURE__*/_interopDefault(_isPlainObject);
|
|
56
|
+
var _fromPairs__default = /*#__PURE__*/_interopDefault(_fromPairs);
|
|
57
|
+
var _isFinite__default = /*#__PURE__*/_interopDefault(_isFinite);
|
|
58
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefault(_taggedTemplateLiteral);
|
|
59
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
|
|
60
|
+
var _find__default = /*#__PURE__*/_interopDefault(_find);
|
|
61
|
+
var _reverse__default = /*#__PURE__*/_interopDefault(_reverse);
|
|
62
|
+
var _isEqual__default = /*#__PURE__*/_interopDefault(_isEqual);
|
|
63
|
+
var _isFunction__default = /*#__PURE__*/_interopDefault(_isFunction);
|
|
64
|
+
var _get__default = /*#__PURE__*/_interopDefault(_get);
|
|
65
|
+
var _unset__default = /*#__PURE__*/_interopDefault(_unset);
|
|
66
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
67
|
+
var createEmotion__default = /*#__PURE__*/_interopDefault(createEmotion);
|
|
68
|
+
var _flow__default = /*#__PURE__*/_interopDefault(_flow);
|
|
69
|
+
var _without__default = /*#__PURE__*/_interopDefault(_without);
|
|
70
|
+
var _flatMap__default = /*#__PURE__*/_interopDefault(_flatMap);
|
|
71
|
+
var _mapValues__default = /*#__PURE__*/_interopDefault(_mapValues);
|
|
72
|
+
var _map__default = /*#__PURE__*/_interopDefault(_map);
|
|
73
|
+
var _filter__default = /*#__PURE__*/_interopDefault(_filter);
|
|
74
|
+
var _each__default = /*#__PURE__*/_interopDefault(_each);
|
|
75
|
+
var _concat__default = /*#__PURE__*/_interopDefault(_concat);
|
|
76
|
+
var _assign__default = /*#__PURE__*/_interopDefault(_assign);
|
|
77
|
+
var _2__default = /*#__PURE__*/_interopDefault(_2);
|
|
78
|
+
var _set__default = /*#__PURE__*/_interopDefault(_set);
|
|
79
|
+
var _update__default = /*#__PURE__*/_interopDefault(_update);
|
|
80
|
+
var _toPath__default = /*#__PURE__*/_interopDefault(_toPath);
|
|
81
|
+
var _pullAt__default = /*#__PURE__*/_interopDefault(_pullAt);
|
|
82
|
+
var _curry__default = /*#__PURE__*/_interopDefault(_curry);
|
|
83
|
+
var _last__default = /*#__PURE__*/_interopDefault(_last);
|
|
84
|
+
var _isString__default = /*#__PURE__*/_interopDefault(_isString);
|
|
85
|
+
var _isNumber__default = /*#__PURE__*/_interopDefault(_isNumber);
|
|
86
|
+
var _padCharsEnd__default = /*#__PURE__*/_interopDefault(_padCharsEnd);
|
|
87
|
+
|
|
88
|
+
const createPromiseResolverPair = () => {
|
|
89
|
+
let res, rej;
|
|
90
|
+
const promise = new Promise((res2, rej2) => {
|
|
91
|
+
res = res2;
|
|
92
|
+
rej = rej2;
|
|
93
|
+
});
|
|
94
|
+
return [promise, [res, rej]];
|
|
95
|
+
};
|
|
96
|
+
const createSimplePromiseLock = () => {
|
|
97
|
+
let promiseQueue = Promise.resolve();
|
|
98
|
+
return () => {
|
|
99
|
+
let resolve = _identity__default["default"];
|
|
100
|
+
const nextPromise = new Promise(res => {
|
|
101
|
+
resolve = res;
|
|
102
|
+
});
|
|
103
|
+
const prevPromise = promiseQueue;
|
|
104
|
+
promiseQueue = nextPromise;
|
|
105
|
+
return prevPromise.then(() => resolve);
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
function createSinglePromiseQueue() {
|
|
109
|
+
return _createSinglePromiseQueue.apply(this, arguments);
|
|
110
|
+
}
|
|
111
|
+
function _createSinglePromiseQueue() {
|
|
112
|
+
_createSinglePromiseQueue = _wrapAsyncGenerator__default["default"](function* () {
|
|
113
|
+
let lastPromise = Promise.resolve();
|
|
114
|
+
/* eslint-disable no-await-in-loop */
|
|
115
|
+
while (true) {
|
|
116
|
+
yield _awaitAsyncGenerator__default["default"](lastPromise);
|
|
117
|
+
let resolve = _identity__default["default"];
|
|
118
|
+
lastPromise = new Promise(res => {
|
|
119
|
+
resolve = res;
|
|
120
|
+
});
|
|
121
|
+
yield resolve;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return _createSinglePromiseQueue.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
function createPromiseQueue() {
|
|
127
|
+
return _createPromiseQueue.apply(this, arguments);
|
|
128
|
+
}
|
|
129
|
+
function _createPromiseQueue() {
|
|
130
|
+
_createPromiseQueue = _wrapAsyncGenerator__default["default"](function () {
|
|
131
|
+
let parallel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
132
|
+
return function* () {
|
|
133
|
+
const queues = _times__default["default"](createSinglePromiseQueue, parallel);
|
|
134
|
+
const promises = queues.map(q => q.next());
|
|
135
|
+
const locks = yield _awaitAsyncGenerator__default["default"](Promise.all(promises));
|
|
136
|
+
const getNextAvailableLock = async () => {
|
|
137
|
+
const index = locks.findIndex(Boolean);
|
|
138
|
+
if (index >= 0) {
|
|
139
|
+
const lock = locks[index];
|
|
140
|
+
locks[index] = null;
|
|
141
|
+
promises[index] = queues[index].next().then(result => {
|
|
142
|
+
locks[index] = result;
|
|
143
|
+
});
|
|
144
|
+
return [lock.value, locks.filter(Boolean).length];
|
|
145
|
+
}
|
|
146
|
+
await Promise.race(promises);
|
|
147
|
+
return getNextAvailableLock();
|
|
148
|
+
};
|
|
149
|
+
while (true) {
|
|
150
|
+
const lock = yield _awaitAsyncGenerator__default["default"](getNextAvailableLock());
|
|
151
|
+
yield lock;
|
|
152
|
+
}
|
|
153
|
+
}();
|
|
154
|
+
});
|
|
155
|
+
return _createPromiseQueue.apply(this, arguments);
|
|
156
|
+
}
|
|
157
|
+
const promiseMapReduce = (arr, callback) => arr.reduce((acc, item) => acc.then(seq => callback(item).then(res => [...seq, res])), Promise.resolve([]));
|
|
158
|
+
const asyncDebounce = function (fn) {
|
|
159
|
+
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
160
|
+
let timeout;
|
|
161
|
+
return function () {
|
|
162
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
163
|
+
args[_key] = arguments[_key];
|
|
164
|
+
}
|
|
165
|
+
clearTimeout(timeout);
|
|
166
|
+
return new Promise(res => {
|
|
167
|
+
timeout = setTimeout(() => res(fn(...args)), delay);
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const getClosestOffsetScroll = node => {
|
|
173
|
+
if (!node) {
|
|
174
|
+
return document.body;
|
|
175
|
+
}
|
|
176
|
+
const overflowY = window.getComputedStyle(node).overflowY;
|
|
177
|
+
const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
|
|
178
|
+
if (isScrollable && node.scrollHeight > node.clientHeight) {
|
|
179
|
+
return node;
|
|
180
|
+
} else {
|
|
181
|
+
return getClosestOffsetScroll(node.offsetParent);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Get the top position of an element in the document
|
|
186
|
+
const getTop = function (element, start) {
|
|
187
|
+
// return value of html.getBoundingClientRect().top ... IE : 0, other browsers : -pageYOffset
|
|
188
|
+
if (!element || element.nodeName === 'HTML') return -start;
|
|
189
|
+
return element.getBoundingClientRect().top + start;
|
|
190
|
+
};
|
|
191
|
+
// ease in out function thanks to:
|
|
192
|
+
// http://blog.greweb.fr/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
|
|
193
|
+
const easeInOutCubic = function (t) {
|
|
194
|
+
return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// calculate the scroll position we should be in
|
|
198
|
+
// given the start and end point of the scroll
|
|
199
|
+
// the time elapsed from the beginning of the scroll
|
|
200
|
+
// and the total duration of the scroll (default 500ms)
|
|
201
|
+
const position = function (start, end, elapsed, duration) {
|
|
202
|
+
if (elapsed > duration) return end;
|
|
203
|
+
return start + (end - start) * easeInOutCubic(elapsed / duration); // <-- you can change the easing funtion there
|
|
204
|
+
// return start + (end - start) * (elapsed / duration); // <-- this would give a linear scroll
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// we use requestAnimationFrame to be called by the browser before every repaint
|
|
208
|
+
// if the first argument is an element then scroll to the top of this element
|
|
209
|
+
// if the first argument is numeric then scroll to this location
|
|
210
|
+
// if the callback exist, it is called when the scrolling is finished
|
|
211
|
+
// if context is set then scroll that element, else scroll window
|
|
212
|
+
const smoothScroll = function (el) {
|
|
213
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
214
|
+
let callback = arguments.length > 2 ? arguments[2] : undefined;
|
|
215
|
+
let ctx = arguments.length > 3 ? arguments[3] : undefined;
|
|
216
|
+
const context = ctx || window;
|
|
217
|
+
const start = context.scrollTop || window.pageYOffset;
|
|
218
|
+
const offset = el instanceof HTMLElement ? 0 : el.offset || 0;
|
|
219
|
+
const end = offset + (typeof el === 'number' ? Math.round(el) : el instanceof HTMLElement ? getTop(el, start) : getTop(el.target, start));
|
|
220
|
+
const clock = Date.now();
|
|
221
|
+
const requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
|
|
222
|
+
window.setTimeout(fn, 15);
|
|
223
|
+
};
|
|
224
|
+
const step = () => {
|
|
225
|
+
const elapsed = Date.now() - clock;
|
|
226
|
+
if (context !== window) {
|
|
227
|
+
context.scrollTop = position(start, end, elapsed, duration);
|
|
228
|
+
} else {
|
|
229
|
+
window.scroll(window.pageXOffset, position(start, end, elapsed, duration));
|
|
230
|
+
}
|
|
231
|
+
if (elapsed > duration) {
|
|
232
|
+
if (typeof callback === 'function') {
|
|
233
|
+
callback(el);
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
requestAnimationFrame(step);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
step();
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
let fixed = false;
|
|
243
|
+
const scrollWidth = function () {
|
|
244
|
+
if (!window.document) return 0;
|
|
245
|
+
const html = document.documentElement;
|
|
246
|
+
const oldOverflow = html.style.overflowY;
|
|
247
|
+
html.style.overflowY = 'scroll';
|
|
248
|
+
const width = window.innerWidth - html.clientWidth;
|
|
249
|
+
html.style.overflowY = oldOverflow;
|
|
250
|
+
return width;
|
|
251
|
+
}();
|
|
252
|
+
const fixMediaQueryFn = function () {
|
|
253
|
+
const fontSize = parseFloat(window.getComputedStyle(document.body).getPropertyValue('font-size'));
|
|
254
|
+
if (scrollWidth > 0) {
|
|
255
|
+
[].slice.call(document.styleSheets).filter(styleSheet => isValidExternal(styleSheet) || isInline(styleSheet)).forEach(stylesheet => {
|
|
256
|
+
try {
|
|
257
|
+
[].slice.call(stylesheet.cssRules || stylesheet.media).filter(rule => rule.constructor === window.CSSMediaRule).forEach(rule => {
|
|
258
|
+
rule.media.mediaText = rule.media.mediaText.replace(/m(in|ax)-width:\s*(\d|\.)+(px|em)/gi, function (strA) {
|
|
259
|
+
if (strA.match('px')) {
|
|
260
|
+
return strA.replace(/\d+px/gi, function (strB) {
|
|
261
|
+
return parseInt(strB, 10) + scrollWidth + 'px';
|
|
262
|
+
});
|
|
263
|
+
} else {
|
|
264
|
+
return strA.replace(/\d.+?em/gi, function (strB) {
|
|
265
|
+
return (parseFloat(strB) * fontSize + scrollWidth) / fontSize + 'em';
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
} catch (e) {}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
fixed = true;
|
|
274
|
+
function sameOrigin(url) {
|
|
275
|
+
const loc = window.location,
|
|
276
|
+
a = document.createElement('a');
|
|
277
|
+
a.href = url;
|
|
278
|
+
return a.hostname === loc.hostname && a.protocol === loc.protocol;
|
|
279
|
+
}
|
|
280
|
+
function isInline(stylesheet) {
|
|
281
|
+
try {
|
|
282
|
+
return stylesheet.ownerNode.constructor === HTMLStyleElement && stylesheet.ownerNode.getAttribute("data-styled") === null;
|
|
283
|
+
} catch (e) {
|
|
284
|
+
return stylesheet.ownerNode.constructor === HTMLStyleElement;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function isValidExternal(stylesheet) {
|
|
288
|
+
var _stylesheet$ownerNode;
|
|
289
|
+
return stylesheet.href && (sameOrigin(stylesheet.href) || ((_stylesheet$ownerNode = stylesheet.ownerNode) === null || _stylesheet$ownerNode === void 0 ? void 0 : _stylesheet$ownerNode.crossOrigin) === "anonymous");
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
function fixMediaQuery() {
|
|
293
|
+
if (fixed || !document || !document.readyState) return;
|
|
294
|
+
if (process.env.NODE_ENV === 'test') {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (document.readyState !== 'loading') {
|
|
298
|
+
fixMediaQueryFn();
|
|
299
|
+
} else {
|
|
300
|
+
document.addEventListener('DOMContentLoaded', fixMediaQueryFn);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const formatPath = function () {
|
|
305
|
+
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
306
|
+
paths[_key] = arguments[_key];
|
|
307
|
+
}
|
|
308
|
+
return paths.map(path => Array.isArray(path) ? path.join('.') : path ? path.toString().replace(/\[/g, '.').replace(/^\./, '').replace(/]/g, '') : '').filter(_ => _).join('.');
|
|
309
|
+
};
|
|
310
|
+
const identityFn = function () {
|
|
311
|
+
let n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
312
|
+
return function () {
|
|
313
|
+
for (var _len2 = arguments.length, e = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
314
|
+
e[_key2] = arguments[_key2];
|
|
315
|
+
}
|
|
316
|
+
return e[n];
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
const will = function (fn) {
|
|
320
|
+
for (var _len3 = arguments.length, props = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
321
|
+
props[_key3 - 1] = arguments[_key3];
|
|
322
|
+
}
|
|
323
|
+
return function () {
|
|
324
|
+
for (var _len4 = arguments.length, more = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
325
|
+
more[_key4] = arguments[_key4];
|
|
326
|
+
}
|
|
327
|
+
return fn(...props, ...more);
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
const lazyValue = v => () => v;
|
|
331
|
+
const callIfFunction = function (prop) {
|
|
332
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
333
|
+
args[_key5 - 1] = arguments[_key5];
|
|
334
|
+
}
|
|
335
|
+
return typeof prop === "function" ? prop(...args) : prop;
|
|
336
|
+
};
|
|
337
|
+
const callIfFunctions = function (prop) {
|
|
338
|
+
for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
|
|
339
|
+
args[_key6 - 1] = arguments[_key6];
|
|
340
|
+
}
|
|
341
|
+
return typeof prop === "function" ? prop(...args.map(e => callIfFunction(e))) : prop;
|
|
342
|
+
};
|
|
343
|
+
const callMany = function () {
|
|
344
|
+
for (var _len7 = arguments.length, many = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
345
|
+
many[_key7] = arguments[_key7];
|
|
346
|
+
}
|
|
347
|
+
return function () {
|
|
348
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
349
|
+
args[_key8] = arguments[_key8];
|
|
350
|
+
}
|
|
351
|
+
return many.map(_ => callIfFunction(_, ...args));
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
const ifUndefined = function (v) {
|
|
355
|
+
for (var _len9 = arguments.length, or = new Array(_len9 > 1 ? _len9 - 1 : 0), _key9 = 1; _key9 < _len9; _key9++) {
|
|
356
|
+
or[_key9 - 1] = arguments[_key9];
|
|
357
|
+
}
|
|
358
|
+
return v !== undefined ? v : or.length === 1 ? or[0] : ifUndefined(or[0], ...or.slice(1));
|
|
359
|
+
};
|
|
360
|
+
const using = function () {
|
|
361
|
+
for (var _len0 = arguments.length, v = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
362
|
+
v[_key0] = arguments[_key0];
|
|
363
|
+
}
|
|
364
|
+
return fn => fn(...v.map(v => callIfFunction(v)));
|
|
365
|
+
};
|
|
366
|
+
const stopPropagation = cb => e => {
|
|
367
|
+
e && e.stopPropagation && e.stopPropagation();
|
|
368
|
+
callIfFunction(cb, e);
|
|
369
|
+
};
|
|
370
|
+
const preventDefault = cb => e => {
|
|
371
|
+
e && e.preventDefault && e.preventDefault();
|
|
372
|
+
callIfFunction(cb, e);
|
|
373
|
+
};
|
|
374
|
+
const constrainEvent = cb => e => {
|
|
375
|
+
e === null || e === void 0 || e.preventDefault();
|
|
376
|
+
e.stopPropagation();
|
|
377
|
+
callIfFunction(cb, e);
|
|
378
|
+
};
|
|
379
|
+
const mapGetOrSet = (map, key, value) => (map.has(key) ? map : map.set(key, value)).get(key);
|
|
380
|
+
const intToHour = function (hour) {
|
|
381
|
+
let autoFill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
382
|
+
if (hour === undefined || hour === null) return '';
|
|
383
|
+
if (hour === 0) {
|
|
384
|
+
return "00:00";
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
//const [h,m] = ('000' + hour.toString().replace(":","")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2').split(":")
|
|
388
|
+
|
|
389
|
+
const h = hour.toString().replace(":", "").slice(-4, -2);
|
|
390
|
+
const m = hour.toString().replace(":", "").slice(-2);
|
|
391
|
+
if (callIfFunction(autoFill, hour)) {
|
|
392
|
+
return ('000' + (h ? parseInt(h, 10) % 24 : '') + m).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
|
|
393
|
+
}
|
|
394
|
+
if (h) return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
|
|
395
|
+
return m;
|
|
396
|
+
};
|
|
397
|
+
const formatHour = function () {
|
|
398
|
+
let hour = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
399
|
+
if (!hour) {
|
|
400
|
+
return "";
|
|
401
|
+
}
|
|
402
|
+
const h = hour.toString().replace(":", "").slice(-4, -2);
|
|
403
|
+
const m = hour.toString().replace(":", "").slice(-2);
|
|
404
|
+
if (!h && parseInt(m) < 24 && !_isFinite__default["default"](hour)) {
|
|
405
|
+
return m + ":00";
|
|
406
|
+
} else if (h) {
|
|
407
|
+
return (parseInt(h, 10) > 23 ? h.slice(1) : h) + ':' + m;
|
|
408
|
+
}
|
|
409
|
+
return ('000' + hour.toString().replace(":", "")).slice(-4).replace(/(\d\d)(\d\d)/, '$1:$2');
|
|
410
|
+
};
|
|
411
|
+
const willRafThrottle = () => {
|
|
412
|
+
let ticking = false;
|
|
413
|
+
return fn => {
|
|
414
|
+
if (!ticking) {
|
|
415
|
+
window.requestAnimationFrame(() => {
|
|
416
|
+
fn();
|
|
417
|
+
ticking = false;
|
|
418
|
+
});
|
|
419
|
+
ticking = true;
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
const rafThrottle = fn => {
|
|
424
|
+
const throttle = willRafThrottle();
|
|
425
|
+
return () => {
|
|
426
|
+
throttle(fn);
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
const intsToHour = _ref => {
|
|
430
|
+
let open = _ref.open,
|
|
431
|
+
close = _ref.close;
|
|
432
|
+
return intToHour(open) + ' - ' + intToHour(close);
|
|
433
|
+
};
|
|
434
|
+
function isSmallDevice() {
|
|
435
|
+
let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
|
|
436
|
+
const smallDeviceQuery = window.matchMedia ? window.matchMedia("(max-width: ".concat(width + scrollWidth, "px)")) : {
|
|
437
|
+
matches: false
|
|
438
|
+
};
|
|
439
|
+
return smallDeviceQuery.matches;
|
|
440
|
+
}
|
|
441
|
+
function isHighDensity() {
|
|
442
|
+
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;
|
|
443
|
+
}
|
|
444
|
+
function isRetina() {
|
|
445
|
+
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);
|
|
446
|
+
}
|
|
447
|
+
function isMobile() {
|
|
448
|
+
if (typeof navigator === 'undefined') return false;
|
|
449
|
+
const ua = navigator.userAgent;
|
|
450
|
+
const isAndroid = /android/i.test(ua);
|
|
451
|
+
const isiOS = /iphone|ipod|ipad/i.test(ua);
|
|
452
|
+
|
|
453
|
+
// iPadOS 13+ reports "Macintosh" but has touch
|
|
454
|
+
const isIPadOS = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
455
|
+
return isAndroid || isiOS || isIPadOS;
|
|
456
|
+
}
|
|
457
|
+
function isAndroid() {
|
|
458
|
+
if (navigator.userAgentData) {
|
|
459
|
+
return navigator.userAgentData.platform === "Android";
|
|
460
|
+
}
|
|
461
|
+
return /Android/i.test(navigator.userAgent);
|
|
462
|
+
}
|
|
463
|
+
const isPWA = () => {
|
|
464
|
+
return window.matchMedia && window.matchMedia("(display-mode: standalone)").matches || !!window.hasWebviewBridge;
|
|
465
|
+
};
|
|
466
|
+
function isTouchDevice() {
|
|
467
|
+
return window.document && 'ontouchstart' in window.document.documentElement;
|
|
468
|
+
}
|
|
469
|
+
const isIOS = () => {
|
|
470
|
+
return /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
471
|
+
};
|
|
472
|
+
const isIPad = () => {
|
|
473
|
+
return navigator.userAgent.match(/iPad/i) != null;
|
|
474
|
+
};
|
|
475
|
+
const getNumberInputType2 = () => {
|
|
476
|
+
const isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;
|
|
477
|
+
return isMobile() ? isIOS ? "tel" : "number" : "text";
|
|
478
|
+
};
|
|
479
|
+
const getNumberInputType = () => {
|
|
480
|
+
return "tel";
|
|
481
|
+
};
|
|
482
|
+
function addHttp(s, secure) {
|
|
483
|
+
s = (s || '').trim();
|
|
484
|
+
if (s.indexOf('http://') === 0 || s.indexOf('https://') === 0) {
|
|
485
|
+
return s;
|
|
486
|
+
} else {
|
|
487
|
+
return "http".concat(secure ? 's' : '', "://") + s;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
const protocols = '(^|\\s|\u00a0)(https?://)?(www\\.)?';
|
|
491
|
+
const subdomains = '([a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]?\\.)*';
|
|
492
|
+
const 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})';
|
|
493
|
+
const resource = '[\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFa-zA-Z0-9-._~:/?#%[\\]@!$&\'()*+,;=]*';
|
|
494
|
+
const linkRegex = new RegExp(protocols + subdomains + domain + resource);
|
|
495
|
+
function isUrl(url) {
|
|
496
|
+
return linkRegex.test(addHttp(url));
|
|
497
|
+
}
|
|
498
|
+
function ellipsis() {
|
|
499
|
+
let str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
500
|
+
let length = arguments.length > 1 ? arguments[1] : undefined;
|
|
501
|
+
if (str.length > length) {
|
|
502
|
+
let words = str.slice(0, length).split(' ');
|
|
503
|
+
if (str.split(' ').indexOf(words[words.length - 1]) < 0) words = words.slice(0, words.length - 1);
|
|
504
|
+
return words.join(' ') + '...';
|
|
505
|
+
} else return str;
|
|
506
|
+
}
|
|
507
|
+
function safeNewLineToBr(str, keepMany) {
|
|
508
|
+
const result = (str || "").replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
509
|
+
if (keepMany === true) {
|
|
510
|
+
return result.replace(/\n/g, '<br/>');
|
|
511
|
+
}
|
|
512
|
+
return result.replace(/\n+/g, '<br/>');
|
|
513
|
+
}
|
|
514
|
+
function padGroups(pattern, value) {
|
|
515
|
+
return pattern.split('').reduce((_ref2, char, i) => {
|
|
516
|
+
let _ref3 = _slicedToArray__default["default"](_ref2, 2),
|
|
517
|
+
acc = _ref3[0],
|
|
518
|
+
value = _ref3[1];
|
|
519
|
+
if (char === '0') {
|
|
520
|
+
const shouldHave = pattern.slice(i).search(/[^0#?*]/);
|
|
521
|
+
const has = value.slice(i).search(/\D/);
|
|
522
|
+
if (has > 0 && shouldHave > has) {
|
|
523
|
+
return [acc.concat('0'), acc.join('') + '0' + value.slice(i)];
|
|
524
|
+
} else {
|
|
525
|
+
return [acc.concat(value[i]), value];
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
return [acc.concat(value[i]), value];
|
|
529
|
+
}
|
|
530
|
+
}, [[], value])[0].join('');
|
|
531
|
+
}
|
|
532
|
+
const digitsToPattern = (patternWithLimit, optValue) => {
|
|
533
|
+
const value = optValue || "";
|
|
534
|
+
if (patternWithLimit[0] === '>' && Number(patternWithLimit.replace(/^>(\d*).*/g, "$1")) > value.length) return value;
|
|
535
|
+
const pattern = patternWithLimit.replace(/^>\d+/, '');
|
|
536
|
+
const digits = padGroups(pattern, value).replace(/\D/g, '');
|
|
537
|
+
const totalRequired = pattern.split(/[0#]/).length - 1;
|
|
538
|
+
const totalOptional = pattern.split(/[?*]/).length - 1;
|
|
539
|
+
const available = digits.length - totalRequired;
|
|
540
|
+
if (available > 0 && totalOptional > 0) {
|
|
541
|
+
let i = 0;
|
|
542
|
+
return digitsToPattern(pattern.replace(/\?/g, () => i++ < available ? '#' : '').replace('*', new Array(Math.max(0, available - i + 1)).join("#")), value);
|
|
543
|
+
}
|
|
544
|
+
let i = 0;
|
|
545
|
+
return pattern.replace(/^>\d*/, '').split('').reduce((acc, char) => {
|
|
546
|
+
if (!digits[Math.max(i - 1, 0)] || char === '?' || char === '*') return acc;
|
|
547
|
+
if (char === '#' || char === '0') {
|
|
548
|
+
return acc + (digits[i++] || '');
|
|
549
|
+
} else {
|
|
550
|
+
return acc + char;
|
|
551
|
+
}
|
|
552
|
+
}, '');
|
|
553
|
+
};
|
|
554
|
+
const normalizeTouch = (fn, endFn) => e => {
|
|
555
|
+
const touch = e.touches[0];
|
|
556
|
+
if (e.touches.length > 1 && e.type !== 'touchend') {
|
|
557
|
+
callIfFunction(endFn, e, touch);
|
|
558
|
+
} else {
|
|
559
|
+
callIfFunction(fn, e, touch);
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
const normalizeMouse = (fn, endFn) => e => {
|
|
563
|
+
if (e.buttons > 1 && e.type !== 'mouseup') {
|
|
564
|
+
callIfFunction(endFn, e, e);
|
|
565
|
+
} else {
|
|
566
|
+
callIfFunction(fn, e, e);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
const normalizePress = (fn, endFn) => e => {
|
|
570
|
+
if (e.touches) {
|
|
571
|
+
normalizeTouch(fn, endFn)(e);
|
|
572
|
+
} else {
|
|
573
|
+
normalizeMouse(fn, endFn)(e);
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
const touchClick = function (cb) {
|
|
577
|
+
let sensibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
578
|
+
return e => {
|
|
579
|
+
var _e$touches;
|
|
580
|
+
if (((_e$touches = e.touches) === null || _e$touches === void 0 ? void 0 : _e$touches.length) !== 1) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const target = e.target;
|
|
584
|
+
const originalX = e.touches[0].screenX;
|
|
585
|
+
const originalY = e.touches[0].screenY;
|
|
586
|
+
const isInsideBounds = touch => Math.sqrt(Math.pow(originalX - touch.screenX, 2) + Math.pow(originalY - touch.screenY, 2)) < sensibility;
|
|
587
|
+
const checkBounds = e => {
|
|
588
|
+
if (e.touches.length !== 1) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (!isInsideBounds(e.changedTouches[0])) {
|
|
592
|
+
maybeClick();
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
const maybeClick = e => {
|
|
596
|
+
var _e$changedTouches;
|
|
597
|
+
target.removeEventListener('touchend', maybeClick);
|
|
598
|
+
target.removeEventListener('touchmove', checkBounds);
|
|
599
|
+
if ((e === null || e === void 0 || (_e$changedTouches = e.changedTouches) === null || _e$changedTouches === void 0 ? void 0 : _e$changedTouches.length) !== 1) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (isInsideBounds(e.changedTouches[0])) {
|
|
603
|
+
e.preventDefault();
|
|
604
|
+
cb(e);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
target.addEventListener('touchend', maybeClick);
|
|
608
|
+
target.addEventListener('touchmove', checkBounds);
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
const isEmptyHtml = function () {
|
|
612
|
+
let __html = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
613
|
+
const a = document.createElement('span');
|
|
614
|
+
a.innerHTML = __html;
|
|
615
|
+
return a.textContent.replace(/\s/g, '').length === 0;
|
|
616
|
+
};
|
|
617
|
+
const getScrollParent = node => {
|
|
618
|
+
if (!node) {
|
|
619
|
+
return window;
|
|
620
|
+
}
|
|
621
|
+
const overflowY = window.getComputedStyle(node).overflowY;
|
|
622
|
+
const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
|
|
623
|
+
if (isScrollable && (node.scrollHeight > node.clientHeight || overflowY === 'scroll')) {
|
|
624
|
+
return node;
|
|
625
|
+
} else {
|
|
626
|
+
return getScrollParent(node.offsetParent);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const scrollIntoViewWithOffset = (el, offset) => {
|
|
630
|
+
const scrollOffset = getScrollParent(el);
|
|
631
|
+
const scrollY = scrollOffset === window ? window.pageYOffset : scrollOffset.scrollTop;
|
|
632
|
+
const elTop = el.getBoundingClientRect().top;
|
|
633
|
+
const computedOffset = callIfFunction(offset, elTop > 0);
|
|
634
|
+
const y = el.getBoundingClientRect().top + scrollY + computedOffset;
|
|
635
|
+
scrollOffset.scrollTo({
|
|
636
|
+
top: y,
|
|
637
|
+
behavior: 'smooth'
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
const isElementInView = async element => {
|
|
641
|
+
if (!element) return false;
|
|
642
|
+
if (1 !== element.nodeType) return false;
|
|
643
|
+
var html = document.documentElement;
|
|
644
|
+
var rect = element.getBoundingClientRect();
|
|
645
|
+
if (IntersectionObserver) {
|
|
646
|
+
return new Promise(resolve => {
|
|
647
|
+
const o = new IntersectionObserver(_ref4 => {
|
|
648
|
+
let _ref5 = _slicedToArray__default["default"](_ref4, 1),
|
|
649
|
+
entry = _ref5[0];
|
|
650
|
+
resolve(entry.intersectionRatio === 1);
|
|
651
|
+
o.disconnect();
|
|
652
|
+
});
|
|
653
|
+
o.observe(element);
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
return !!rect && rect.bottom >= 0 && rect.right >= 0 && rect.left <= html.clientWidth && rect.top <= html.clientHeight;
|
|
657
|
+
};
|
|
658
|
+
let i = 0;
|
|
659
|
+
const getUID = () => Date.now().toString(36) + Math.random().toString(36).slice(2) + (i++).toString(36);
|
|
660
|
+
const getUrlParams = () => _fromPairs__default["default"](Array.from(new URLSearchParams(location.search).entries()));
|
|
661
|
+
const isShallowEqualSameKeys = (a, b) => {
|
|
662
|
+
for (var key in a) {
|
|
663
|
+
if (a[key] !== b[key]) {
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return true;
|
|
668
|
+
};
|
|
669
|
+
const isShallowEqual = (a, b) => {
|
|
670
|
+
for (var key in a) {
|
|
671
|
+
if (!(key in b) || a[key] !== b[key]) {
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
for (var key in b) {
|
|
676
|
+
if (!(key in a) || a[key] !== b[key]) {
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return true;
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
684
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
685
|
+
const resolveFetch = async (url, fetchOptions) => {
|
|
686
|
+
try {
|
|
687
|
+
const response = await fetch(url, _objectSpread$3({
|
|
688
|
+
credentials: 'same-origin'
|
|
689
|
+
}, fetchOptions));
|
|
690
|
+
const text = await response.text();
|
|
691
|
+
try {
|
|
692
|
+
const json = JSON.parse(text);
|
|
693
|
+
return [json, response];
|
|
694
|
+
} catch (eror) {
|
|
695
|
+
return [text, response];
|
|
696
|
+
}
|
|
697
|
+
} catch (error) {
|
|
698
|
+
return [error, false];
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
const innerFetcher = async (url, fetchOptions) => {
|
|
702
|
+
const _await$resolveFetch = await resolveFetch(url, fetchOptions),
|
|
703
|
+
_await$resolveFetch2 = _slicedToArray__default["default"](_await$resolveFetch, 2),
|
|
704
|
+
data = _await$resolveFetch2[0],
|
|
705
|
+
response = _await$resolveFetch2[1];
|
|
706
|
+
if (!response || response.status >= 400) {
|
|
707
|
+
throw [data, response];
|
|
708
|
+
} else {
|
|
709
|
+
return [data, response];
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
const queryStringToObj = function () {
|
|
713
|
+
let str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.search;
|
|
714
|
+
return Object.fromEntries(new URLSearchParams(str).entries());
|
|
715
|
+
};
|
|
716
|
+
const addQueryString = function () {
|
|
717
|
+
let existingUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
718
|
+
let obj = arguments.length > 1 ? arguments[1] : undefined;
|
|
719
|
+
const _existingUrl$split = existingUrl.split('?'),
|
|
720
|
+
_existingUrl$split2 = _slicedToArray__default["default"](_existingUrl$split, 2),
|
|
721
|
+
onlyUrl = _existingUrl$split2[0],
|
|
722
|
+
otherQueryString = _existingUrl$split2[1];
|
|
723
|
+
const params = new URLSearchParams(otherQueryString);
|
|
724
|
+
for (let key in obj) {
|
|
725
|
+
const value = obj[key];
|
|
726
|
+
if (value === null) {
|
|
727
|
+
params.delete(key);
|
|
728
|
+
} else {
|
|
729
|
+
params.set(key, obj[key]);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
const paramsStr = params.toString();
|
|
733
|
+
if (!paramsStr) {
|
|
734
|
+
return onlyUrl;
|
|
735
|
+
}
|
|
736
|
+
return onlyUrl + '?' + paramsStr;
|
|
737
|
+
};
|
|
738
|
+
const cleanNulls = str => str.replace(/\0/g, '');
|
|
739
|
+
|
|
740
|
+
// Cross-origin o X-Requested-With só custa: dispara preflight e impede o reuso do
|
|
741
|
+
// <link rel=preload as=fetch>, cujo request vai sem ele. Quem lê o header é servidor nosso.
|
|
742
|
+
const isSameOrigin = url => new URL(url, window.location.href).origin === window.location.origin;
|
|
743
|
+
let postFetcherWithResponse = async function (url, jsonOrForm) {
|
|
744
|
+
let fetchOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
745
|
+
return innerFetcher(url, _objectSpread$3(_objectSpread$3({
|
|
746
|
+
method: 'POST',
|
|
747
|
+
body: typeof jsonOrForm === 'string' ? jsonOrForm : !jsonOrForm || jsonOrForm.constructor === window.FormData || jsonOrForm.constructor === window.File ? jsonOrForm : cleanNulls(JSON.stringify(jsonOrForm))
|
|
748
|
+
}, fetchOptions), {}, {
|
|
749
|
+
headers: _isPlainObject__default["default"](fetchOptions.headers) || !fetchOptions.headers ? _objectSpread$3(_objectSpread$3(_objectSpread$3({}, jsonOrForm && (typeof jsonOrForm === 'string' || jsonOrForm.constructor === window.FormData) ? {} : {
|
|
750
|
+
'Content-Type': 'application/json; charset=UTF-8'
|
|
751
|
+
}), isSameOrigin(url) ? {
|
|
752
|
+
'X-Requested-With': 'XMLHttpRequest'
|
|
753
|
+
} : {}), fetchOptions.headers) : fetchOptions.headers
|
|
754
|
+
}));
|
|
755
|
+
};
|
|
756
|
+
let getFetcherWithResponse = async (url, jsonParams, fetchOptions) => innerFetcher(addQueryString(url, jsonParams), _objectSpread$3(_objectSpread$3({
|
|
757
|
+
method: 'GET'
|
|
758
|
+
}, fetchOptions), {}, {
|
|
759
|
+
headers: _objectSpread$3(_objectSpread$3({}, isSameOrigin(url) ? {
|
|
760
|
+
'X-Requested-With': 'XMLHttpRequest'
|
|
761
|
+
} : {}), fetchOptions === null || fetchOptions === void 0 ? void 0 : fetchOptions.headers)
|
|
762
|
+
}));
|
|
763
|
+
let postFetcher = async (url, json, options) => postFetcherWithResponse(url, json, options).then(_ref => {
|
|
764
|
+
let _ref2 = _slicedToArray__default["default"](_ref, 1),
|
|
765
|
+
json = _ref2[0];
|
|
766
|
+
return json;
|
|
767
|
+
});
|
|
768
|
+
let getFetcher = async (url, json, options) => getFetcherWithResponse(url, json, options).then(_ref3 => {
|
|
769
|
+
let _ref4 = _slicedToArray__default["default"](_ref3, 1),
|
|
770
|
+
json = _ref4[0];
|
|
771
|
+
return json;
|
|
772
|
+
});
|
|
773
|
+
const formFetchWithResponse = (url, options) => (values, meta) => postFetcherWithResponse(callIfFunction(url, meta, values), values, callIfFunction(options, meta, values));
|
|
774
|
+
const formFetch = (url, options) => (values, meta) => postFetcher(callIfFunction(url, meta, values), values, callIfFunction(options, meta, values));
|
|
775
|
+
|
|
776
|
+
const moveElement = _curry__default["default"]((from, to, list) => {
|
|
777
|
+
const el = list[from];
|
|
778
|
+
const without = _pullAt__default["default"](from, list);
|
|
779
|
+
without.splice(to, 0, el);
|
|
780
|
+
return without;
|
|
781
|
+
});
|
|
782
|
+
const unsetOrRemoveAt = _curry__default["default"]((path, value) => {
|
|
783
|
+
const pathArr = toPath(path);
|
|
784
|
+
const _pathArr$slice = pathArr.slice(-1),
|
|
785
|
+
_pathArr$slice2 = _slicedToArray__default["default"](_pathArr$slice, 1),
|
|
786
|
+
lastKey = _pathArr$slice2[0];
|
|
787
|
+
return update(pathArr.slice(0, -1), v => Array.isArray(v) ? removeAt(lastKey, v) : unset(lastKey, v), value);
|
|
788
|
+
});
|
|
789
|
+
const pathToString = path => toPath(path).join(".");
|
|
790
|
+
const sanitizePath = path => Array.isArray(path) ? path.map(sanitizePath) : typeof path === 'number' ? path.toString() : path === undefined ? [] : path;
|
|
791
|
+
const toPath = path => _toPath__default["default"](sanitizePath(path));
|
|
792
|
+
const isEmptyPath = path => path && !path.length;
|
|
793
|
+
const update = _curry__default["default"]((path, updater, state) => {
|
|
794
|
+
const sanitizedPath = sanitizePath(path);
|
|
795
|
+
if (isEmptyPath(sanitizedPath)) {
|
|
796
|
+
return updater(state);
|
|
797
|
+
} else {
|
|
798
|
+
return _update__default["default"](sanitizedPath, updater, state);
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
const get = _curry__default["default"]((path, state) => {
|
|
802
|
+
const sanitizedPath = sanitizePath(path);
|
|
803
|
+
if (isEmptyPath(sanitizedPath)) {
|
|
804
|
+
return state;
|
|
805
|
+
} else {
|
|
806
|
+
return _get__default["default"](sanitizedPath, state);
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
const set = _curry__default["default"]((path, value, state) => {
|
|
810
|
+
const sanitizedPath = sanitizePath(path);
|
|
811
|
+
if (isEmptyPath(sanitizedPath)) {
|
|
812
|
+
return value;
|
|
813
|
+
} else {
|
|
814
|
+
return _set__default["default"](sanitizedPath, value, state);
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
const unset = _curry__default["default"]((path, state) => {
|
|
818
|
+
const sanitizedPath = sanitizePath(path);
|
|
819
|
+
if (isEmptyPath(sanitizedPath)) {
|
|
820
|
+
return undefined;
|
|
821
|
+
} else {
|
|
822
|
+
return _unset__default["default"](sanitizedPath, state);
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
const removeNAt = _curry__default["default"]((pos, n, value) => [...value.slice(0, Number(pos)), ...value.slice(Number(pos) + n)]);
|
|
826
|
+
const removeAt = removeNAt(_2__default["default"], 1);
|
|
827
|
+
const when = _curry__default["default"]((cond, fn, value) => callIfFunction(cond, value) ? fn(value) : value);
|
|
828
|
+
const assign = _curry__default["default"]((a, b) => _assign__default["default"](b, a));
|
|
829
|
+
const concat = _curry__default["default"]((a, b) => _concat__default["default"](b, a));
|
|
830
|
+
const each = _each__default["default"].convert({
|
|
831
|
+
cap: false
|
|
832
|
+
});
|
|
833
|
+
const find = _find__default["default"].convert({
|
|
834
|
+
cap: false
|
|
835
|
+
});
|
|
836
|
+
const filter = _filter__default["default"].convert({
|
|
837
|
+
cap: false
|
|
838
|
+
});
|
|
839
|
+
const map = _map__default["default"].convert({
|
|
840
|
+
cap: false
|
|
841
|
+
});
|
|
842
|
+
const mapValues = _mapValues__default["default"].convert({
|
|
843
|
+
cap: false
|
|
844
|
+
});
|
|
845
|
+
const flatMap = _flatMap__default["default"].convert({
|
|
846
|
+
cap: false
|
|
847
|
+
});
|
|
848
|
+
const insertAt = _curry__default["default"]((pos, newElements, value) => [...value.slice(0, pos).concat(newElements), ...value.slice(pos)]);
|
|
849
|
+
const select = _curry__default["default"]((selector, value) => (_isFunction__default["default"](selector) ? selector : selector ? _get__default["default"](selector) : _identity__default["default"])(value));
|
|
850
|
+
const itemToggle = _curry__default["default"]((item, list) => (list || []).indexOf(item) >= 0 ? _without__default["default"]([item], list) : [...(list || []), item]);
|
|
851
|
+
const _s = {
|
|
852
|
+
moveElement,
|
|
853
|
+
unsetOrRemoveAt,
|
|
854
|
+
pathToString,
|
|
855
|
+
toPath,
|
|
856
|
+
update,
|
|
857
|
+
get,
|
|
858
|
+
set,
|
|
859
|
+
select,
|
|
860
|
+
unset,
|
|
861
|
+
removeNAt,
|
|
862
|
+
removeAt,
|
|
863
|
+
itemToggle,
|
|
864
|
+
when,
|
|
865
|
+
assign,
|
|
866
|
+
concat,
|
|
867
|
+
each,
|
|
868
|
+
find,
|
|
869
|
+
filter,
|
|
870
|
+
map,
|
|
871
|
+
flatMap,
|
|
872
|
+
mapValues,
|
|
873
|
+
insertAt,
|
|
874
|
+
flowEach: function () {
|
|
875
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
876
|
+
args[_key] = arguments[_key];
|
|
877
|
+
}
|
|
878
|
+
return _flow__default["default"](...args.filter(Boolean));
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
var _templateObject;
|
|
883
|
+
const _excluded = ["theme"];
|
|
884
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
885
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
886
|
+
const getColor = (propsOrColor, hover) => {
|
|
887
|
+
if (propsOrColor === undefined) {
|
|
888
|
+
return _ref => {
|
|
889
|
+
let theme = _ref.theme;
|
|
890
|
+
return theme.colors.gray150;
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
if (typeof propsOrColor === 'string') {
|
|
894
|
+
return _ref2 => {
|
|
895
|
+
let theme = _ref2.theme;
|
|
896
|
+
return theme.colors[propsOrColor] || propsOrColor;
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
const theme = propsOrColor.theme,
|
|
900
|
+
props = _objectWithoutProperties__default["default"](propsOrColor, _excluded);
|
|
901
|
+
if (props.dark) {
|
|
902
|
+
return polished.darken(0.1, getColor(_objectSpread$2({
|
|
903
|
+
theme
|
|
904
|
+
}, _unset__default["default"]('dark', props))));
|
|
905
|
+
} else if (hover && props.hover) {
|
|
906
|
+
return getColor({
|
|
907
|
+
theme,
|
|
908
|
+
color: props.hover
|
|
909
|
+
});
|
|
910
|
+
} else if (props.color) {
|
|
911
|
+
return theme.colors[props.color] || props.color;
|
|
912
|
+
} else if (props.highlight) {
|
|
913
|
+
return theme.colors.main;
|
|
914
|
+
} else if (props.alert) {
|
|
915
|
+
return theme.colors.alert;
|
|
916
|
+
} else if (props.success) {
|
|
917
|
+
return theme.colors.success;
|
|
918
|
+
} else {
|
|
919
|
+
return theme.colors.gray150;
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
const getMargin = enumeratedMargins => props => enumeratedMargins[props.margin] || props.margin || enumeratedMargins['default'] || 0;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Returns the value of `props[path]` or `defaultValue`
|
|
926
|
+
* @example
|
|
927
|
+
* const Button = styled.button`
|
|
928
|
+
* color: ${prop('color', 'red')};
|
|
929
|
+
* `
|
|
930
|
+
*/
|
|
931
|
+
const prop = (path, defaultValue) => function () {
|
|
932
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
933
|
+
return _get__default["default"](path.trim(), props) || defaultValue;
|
|
934
|
+
};
|
|
935
|
+
const customTheme = type => function () {
|
|
936
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
937
|
+
return _get__default["default"](["theme", "startlibs", type], props) || '';
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Returns `pass` if prop is truthy. Otherwise returns `fail`
|
|
942
|
+
* @example
|
|
943
|
+
* // usage with styled-theme
|
|
944
|
+
* import styled from 'styled-components'
|
|
945
|
+
* import { ifProp } from 'styled-tools'
|
|
946
|
+
* import { palette } from 'styled-theme'
|
|
947
|
+
*
|
|
948
|
+
* const Button = styled.button`
|
|
949
|
+
* background-color: ${ifProp('transparent', 'transparent', palette(0))};
|
|
950
|
+
* color: ${ifProp(['transparent', 'accent'], palette('secondary', 0))};
|
|
951
|
+
* font-size: ${ifProp({ size: 'large' }, '20px', ifProp({ size: 'medium' }, '16px', '12px'))};
|
|
952
|
+
*`
|
|
953
|
+
*/
|
|
954
|
+
const ifProp = (path, pass, fail) => {
|
|
955
|
+
if (pass && !_isFunction__default["default"](pass)) {
|
|
956
|
+
// old version
|
|
957
|
+
return function () {
|
|
958
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
959
|
+
let result = false;
|
|
960
|
+
if (Array.isArray(path)) {
|
|
961
|
+
result = path.every(p => testSinglePath(props, p));
|
|
962
|
+
} else if (typeof path === 'object') {
|
|
963
|
+
result = !Object.entries(path).find(_ref3 => {
|
|
964
|
+
let _ref4 = _slicedToArray__default["default"](_ref3, 2),
|
|
965
|
+
k = _ref4[0],
|
|
966
|
+
v = _ref4[1];
|
|
967
|
+
return props[k] !== v;
|
|
968
|
+
});
|
|
969
|
+
} else {
|
|
970
|
+
result = testSinglePath(props, path);
|
|
971
|
+
}
|
|
972
|
+
return result ? pass : fail;
|
|
973
|
+
};
|
|
974
|
+
} else {
|
|
975
|
+
return function () {
|
|
976
|
+
for (var _len = arguments.length, argsTrue = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
977
|
+
argsTrue[_key] = arguments[_key];
|
|
978
|
+
}
|
|
979
|
+
const check = pass || _identity__default["default"];
|
|
980
|
+
const fn = props => check(_get__default["default"](path, props)) ? styled.css(...argsTrue) : '';
|
|
981
|
+
fn.orElse = function () {
|
|
982
|
+
for (var _len2 = arguments.length, argsFalse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
983
|
+
argsFalse[_key2] = arguments[_key2];
|
|
984
|
+
}
|
|
985
|
+
return props => check(_get__default["default"](path, props)) ? styled.css(...argsTrue) : styled.css(...argsFalse);
|
|
986
|
+
};
|
|
987
|
+
return fn;
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
const ifPropEquals = (path, str) => ifProp(path, _isEqual__default["default"](str));
|
|
992
|
+
const ifNotProp = path => ifProp(path, v => !v);
|
|
993
|
+
const checkCustomScreenWidth = (sizeParis, customWidth) => {
|
|
994
|
+
const currentWidth = callIfFunction(customWidth);
|
|
995
|
+
return !sizeParis.find(_ref5 => {
|
|
996
|
+
let _ref6 = _slicedToArray__default["default"](_ref5, 2),
|
|
997
|
+
size = _ref6[0],
|
|
998
|
+
type = _ref6[1];
|
|
999
|
+
if (type === "min-width") {
|
|
1000
|
+
return currentWidth < size;
|
|
1001
|
+
}
|
|
1002
|
+
if (type === "max-width") {
|
|
1003
|
+
return currentWidth > size;
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
const media = function () {
|
|
1008
|
+
for (var _len3 = arguments.length, sizePairs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1009
|
+
sizePairs[_key3] = arguments[_key3];
|
|
1010
|
+
}
|
|
1011
|
+
return function () {
|
|
1012
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1013
|
+
args[_key4] = arguments[_key4];
|
|
1014
|
+
}
|
|
1015
|
+
return styled.css(["", ""], props => {
|
|
1016
|
+
var _props$theme, _props$theme2;
|
|
1017
|
+
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.overrideMediaWidth ? checkCustomScreenWidth(sizePairs, (_props$theme2 = props.theme) === null || _props$theme2 === void 0 ? void 0 : _props$theme2.overrideMediaWidth) ? styled.css(...args) : "" : styled.css(["@media ", "{", "}"], sizePairs.map(_ref7 => {
|
|
1018
|
+
let _ref8 = _slicedToArray__default["default"](_ref7, 2),
|
|
1019
|
+
size = _ref8[0],
|
|
1020
|
+
type = _ref8[1];
|
|
1021
|
+
return "(".concat(type, ": ").concat(size + scrollWidth, "px)");
|
|
1022
|
+
}).join(' and '), styled.css(...args));
|
|
1023
|
+
});
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
media.mobile = media([600, 'max-width']);
|
|
1027
|
+
media.between = (min, max) => media([min, 'min-width'], [max, 'max-width']);
|
|
1028
|
+
media.max = n => media([n, 'max-width']);
|
|
1029
|
+
media.min = n => media([n, 'min-width']);
|
|
1030
|
+
media.desktop = media([601, 'min-width']);
|
|
1031
|
+
const vheight = (strings, size) => {
|
|
1032
|
+
const propType = strings[0];
|
|
1033
|
+
const calc = (strings[1] || "").replace(";", "").trim();
|
|
1034
|
+
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 ");
|
|
1035
|
+
};
|
|
1036
|
+
function testSinglePath(props, path) {
|
|
1037
|
+
if (typeof path === 'string') {
|
|
1038
|
+
return !!_s.get(path, props);
|
|
1039
|
+
} else if (typeof path === 'number') {
|
|
1040
|
+
return !!props[path];
|
|
1041
|
+
} else {
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
const getFrameOffset = (i, total) => Math.round(i * 100 / (total - 1));
|
|
1046
|
+
const emotion = createEmotion__default["default"]({
|
|
1047
|
+
nonce: typeof document !== 'undefined' && (document.querySelector('meta[property="csp-nonce"]') || {}).content || 'animation_nonce'
|
|
1048
|
+
});
|
|
1049
|
+
const oneWayAnimation = function () {
|
|
1050
|
+
for (var _len5 = arguments.length, frames = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1051
|
+
frames[_key5] = arguments[_key5];
|
|
1052
|
+
}
|
|
1053
|
+
return emotion.keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n ", ""])), frames.map((frame, i) => !frame ? '' : "".concat(getFrameOffset(i, frames.length), "% {\n ").concat(frame, "\n }")));
|
|
1054
|
+
};
|
|
1055
|
+
const twoWayAnimation = function () {
|
|
1056
|
+
for (var _len6 = arguments.length, frames = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1057
|
+
frames[_key6] = arguments[_key6];
|
|
1058
|
+
}
|
|
1059
|
+
return [frames, _reverse__default["default"](frames)].map(frames => oneWayAnimation(...frames));
|
|
1060
|
+
};
|
|
1061
|
+
const animationTiming = props => function () {
|
|
1062
|
+
for (var _len7 = arguments.length, animations = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1063
|
+
animations[_key7] = arguments[_key7];
|
|
1064
|
+
}
|
|
1065
|
+
return animations.filter(_ => _).map(_ => _ + ' ' + props).join(',');
|
|
1066
|
+
};
|
|
1067
|
+
const identityTranslateFrames = oneWayAnimation('transform: translateY(0);', 'transform: translateY(0);');
|
|
1068
|
+
const identityOpacityFrames = oneWayAnimation('opacity: 1;', 'opacity:1;');
|
|
1069
|
+
const styledExtend = _ref9 => {
|
|
1070
|
+
let target = _ref9.target,
|
|
1071
|
+
componentStyle = _ref9.componentStyle;
|
|
1072
|
+
return function () {
|
|
1073
|
+
const wasStatic = !_find__default["default"](_isFunction__default["default"], componentStyle.rules);
|
|
1074
|
+
for (var _len8 = arguments.length, template = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
1075
|
+
template[_key8] = arguments[_key8];
|
|
1076
|
+
}
|
|
1077
|
+
const v = /*#__PURE__*/styled__default["default"](target)(...template, ...(wasStatic ? [] : [() => ""]));
|
|
1078
|
+
v.componentStyle.rules = [...componentStyle.rules, ...v.componentStyle.rules];
|
|
1079
|
+
return v;
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
const printerMedia = function () {
|
|
1083
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
1084
|
+
args[_key9] = arguments[_key9];
|
|
1085
|
+
}
|
|
1086
|
+
return props => props.theme.printMode ? styled.css(...args) : styled.css(["@media print{", "}"], styled.css(...args));
|
|
1087
|
+
};
|
|
1088
|
+
const notPrinterMedia = function () {
|
|
1089
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
1090
|
+
args[_key0] = arguments[_key0];
|
|
1091
|
+
}
|
|
1092
|
+
return props => props.theme.printMode ? '' : styled.css(["@media screen{", "}"], styled.css(...args));
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
const escapedValidParts = /(^|[^\\])(dd?|DD?|mm?|LL?|hh?|MM?|ss|SSS|yy(?:yy)?)/g;
|
|
1096
|
+
const validParts = /(dd?|DD?|mm?|LL?|hh?|MM?|yy(?:yy)|yy|ss|SSS)$/;
|
|
1097
|
+
const addZero = v => (v < 10 ? '0' : '') + v;
|
|
1098
|
+
const getSet = function (index, ttype) {
|
|
1099
|
+
let plus = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1100
|
+
let format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : v => v;
|
|
1101
|
+
let parse = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : (v, defaultDate) => v === '0' ? '' : v;
|
|
1102
|
+
return [(date, _, noUTC) => format((typeof date === 'number' ? new Date(date) : date)['get' + (noUTC ? '' : 'UTC') + ttype]() + plus), (unformatedStr, date, _, failOnFormat, noUTC) => {
|
|
1103
|
+
const str = parse(unformatedStr, date, failOnFormat);
|
|
1104
|
+
if (str === '' || isNaN(date.getTime())) return date;
|
|
1105
|
+
if (str === '\0') return date.setTime(NaN);
|
|
1106
|
+
const utcSTR = noUTC ? '' : 'UTC';
|
|
1107
|
+
const v = parseInt(str, 10) - plus;
|
|
1108
|
+
const prevDay = date['get' + utcSTR + 'Date']();
|
|
1109
|
+
if (ttype !== 'Date') {
|
|
1110
|
+
date['set' + utcSTR + 'Date'](1);
|
|
1111
|
+
}
|
|
1112
|
+
date['set' + utcSTR + ttype](v);
|
|
1113
|
+
if (date['get' + utcSTR + ttype]() !== v) {
|
|
1114
|
+
date['set' + utcSTR + ttype](NaN);
|
|
1115
|
+
return date;
|
|
1116
|
+
}
|
|
1117
|
+
if (ttype !== 'Date') {
|
|
1118
|
+
date['set' + utcSTR + 'Date'](prevDay);
|
|
1119
|
+
if (date['get' + utcSTR + ttype]() !== v) {
|
|
1120
|
+
date['set' + utcSTR + 'Date'](0);
|
|
1121
|
+
return date;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
return date;
|
|
1125
|
+
}, index];
|
|
1126
|
+
};
|
|
1127
|
+
const getText = function (type, total) {
|
|
1128
|
+
let slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 99;
|
|
1129
|
+
return [(date, messages, noUTC) => messages(type.toLowerCase(), date['get' + (noUTC ? '' : 'UTC') + type]()).slice(0, slice)];
|
|
1130
|
+
};
|
|
1131
|
+
const yearParse = (y, date, failOnFormat) => {
|
|
1132
|
+
const formattedY = y.length === 2 && y !== '20' ? '20' + y : y.length === 4 ? y : '';
|
|
1133
|
+
if (formattedY === '') {
|
|
1134
|
+
if (failOnFormat) {
|
|
1135
|
+
const found = date.getUTCFullYear().toString().indexOf(y);
|
|
1136
|
+
return found === 0 || found === 2 ? date.getUTCFullYear() : '\0';
|
|
1137
|
+
} else {
|
|
1138
|
+
return date.getUTCFullYear();
|
|
1139
|
+
}
|
|
1140
|
+
} else {
|
|
1141
|
+
return formattedY;
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
const val = {
|
|
1145
|
+
yyyy: getSet(0, 'FullYear', 0, v => v, yearParse),
|
|
1146
|
+
yy: getSet(0, 'FullYear', 0, v => (v + "").slice(2, 4), yearParse),
|
|
1147
|
+
M: getSet(1, 'Month', 1),
|
|
1148
|
+
MM: getSet(1, 'Month', 1, addZero),
|
|
1149
|
+
L: getText('Month', 12, 3),
|
|
1150
|
+
LL: getText('Month', 12),
|
|
1151
|
+
d: getSet(2, 'Date'),
|
|
1152
|
+
dd: getSet(2, 'Date', 0, addZero),
|
|
1153
|
+
D: getText('Day', 7, 3),
|
|
1154
|
+
DD: getText('Day', 7),
|
|
1155
|
+
m: getSet(4, 'Minutes'),
|
|
1156
|
+
mm: getSet(4, 'Minutes', 0, addZero),
|
|
1157
|
+
h: getSet(5, 'Hours'),
|
|
1158
|
+
hh: getSet(5, 'Hours', 0, addZero),
|
|
1159
|
+
ss: getSet(6, 'Seconds', 0, addZero),
|
|
1160
|
+
SSS: getSet(7, 'Milliseconds', 0, addZero)
|
|
1161
|
+
};
|
|
1162
|
+
function formatDateToPattern(format) {
|
|
1163
|
+
return format.replace(escapedValidParts, (_, _1, _2) => _1 + (_2 === 'yy' ? '##' : _2 === 'yyyy' ? '####' : '0#'));
|
|
1164
|
+
}
|
|
1165
|
+
function formatDate(date, format, messages, noUTC) {
|
|
1166
|
+
if (!date) return '';
|
|
1167
|
+
const separators = format.replace(escapedValidParts, '\0').split('\0');
|
|
1168
|
+
const parts = format.match(escapedValidParts);
|
|
1169
|
+
const formattedDate = parts.reduce((acc, part) => acc.concat(separators.length ? [separators.shift()] : [], part.replace(validParts, ''), val[part.match(validParts)[0]][0](date, messages, noUTC)), []);
|
|
1170
|
+
return formattedDate.join('').replace(/\\([dDmLhMy])/g, '$1');
|
|
1171
|
+
}
|
|
1172
|
+
const now = () => new Date();
|
|
1173
|
+
function parseDate(str, possibleDate, format, messages, failOnFormat, noUTC) {
|
|
1174
|
+
if (!str) return possibleDate;
|
|
1175
|
+
const separators = format.replace(escapedValidParts, '\0').split('\0');
|
|
1176
|
+
const parts = format.match(escapedValidParts);
|
|
1177
|
+
const mutations = [];
|
|
1178
|
+
parts.reduce((rest, part, i) => {
|
|
1179
|
+
const separator = (separators.length ? separators.shift() : '') + part.replace(validParts, '');
|
|
1180
|
+
const current = rest.slice(separator.length);
|
|
1181
|
+
if (current && separator === rest.slice(0, separator.length)) {
|
|
1182
|
+
const setType = part.match(validParts)[0];
|
|
1183
|
+
const nextSeparator = separators[0];
|
|
1184
|
+
const nextStrIndex = current.indexOf(nextSeparator + (parts[i + 1] || '').replace(validParts, ''));
|
|
1185
|
+
mutations[val[setType][2]] = [val[setType][1], nextStrIndex ? current.slice(0, nextStrIndex) : current];
|
|
1186
|
+
return current.slice(nextStrIndex);
|
|
1187
|
+
} else {
|
|
1188
|
+
return '';
|
|
1189
|
+
}
|
|
1190
|
+
}, str);
|
|
1191
|
+
const date = possibleDate && possibleDate.getTime() !== -1 ? new Date(possibleDate) : now();
|
|
1192
|
+
mutations.forEach(_ref => {
|
|
1193
|
+
let _ref2 = _slicedToArray__default["default"](_ref, 2),
|
|
1194
|
+
setter = _ref2[0],
|
|
1195
|
+
text = _ref2[1];
|
|
1196
|
+
return setter(text, date, messages, failOnFormat, noUTC);
|
|
1197
|
+
});
|
|
1198
|
+
return date;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1202
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1203
|
+
const isNotSelector = v => typeof v !== 'function' || v.length === 0;
|
|
1204
|
+
const toSelector = v => isNotSelector(v) ? s => _s.get(callIfFunction(v), s) : v;
|
|
1205
|
+
const mergeSelectors = (prev, next) => v => next(prev(v));
|
|
1206
|
+
const concatSelectors = function () {
|
|
1207
|
+
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1208
|
+
paths[_key] = arguments[_key];
|
|
1209
|
+
}
|
|
1210
|
+
return paths.reduce((_ref, path) => {
|
|
1211
|
+
let _ref2 = _slicedToArray__default["default"](_ref, 2),
|
|
1212
|
+
selector = _ref2[0],
|
|
1213
|
+
isSelector = _ref2[1];
|
|
1214
|
+
return isNotSelector(path) && !isSelector ? [selector.concat(path), false] : [mergeSelectors(toSelector(selector), path), true];
|
|
1215
|
+
}, [[], false]);
|
|
1216
|
+
};
|
|
1217
|
+
const COMPLETE_ACTION = {};
|
|
1218
|
+
const REDUCE = {};
|
|
1219
|
+
const FETCH = {};
|
|
1220
|
+
const SKIP_FETCH = {};
|
|
1221
|
+
const SKIP_DISPATCH = {};
|
|
1222
|
+
const SKIPPED_ACTION = {};
|
|
1223
|
+
const selectPath = function (useState) {
|
|
1224
|
+
for (var _len2 = arguments.length, paths = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1225
|
+
paths[_key2 - 1] = arguments[_key2];
|
|
1226
|
+
}
|
|
1227
|
+
const _useMemo = React.useMemo(() => concatSelectors(...paths), paths),
|
|
1228
|
+
_useMemo2 = _slicedToArray__default["default"](_useMemo, 1),
|
|
1229
|
+
selector = _useMemo2[0];
|
|
1230
|
+
const _useState = useState(selector),
|
|
1231
|
+
_useState2 = _slicedToArray__default["default"](_useState, 1),
|
|
1232
|
+
value = _useState2[0];
|
|
1233
|
+
return value;
|
|
1234
|
+
};
|
|
1235
|
+
const Action = function (fnOrArray) {
|
|
1236
|
+
let prevArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1237
|
+
const isArray = Array.isArray(fnOrArray);
|
|
1238
|
+
if (isArray) {
|
|
1239
|
+
// excessive paramaeters called on the action, used for options.
|
|
1240
|
+
const actionType = _last__default["default"](prevArgs);
|
|
1241
|
+
const _fnOrArray = _slicedToArray__default["default"](fnOrArray, 3),
|
|
1242
|
+
fetcher = _fnOrArray[0],
|
|
1243
|
+
reducer = _fnOrArray[1],
|
|
1244
|
+
rollbacker = _fnOrArray[2];
|
|
1245
|
+
if (actionType === REDUCE) {
|
|
1246
|
+
return reducer(null, prevArgs);
|
|
1247
|
+
} else if (actionType === FETCH) {
|
|
1248
|
+
return fetcher();
|
|
1249
|
+
} else {
|
|
1250
|
+
return _set__default["default"]('extra', fnOrArray.extra, [actionType === SKIP_FETCH ? () => Promise.resolve() : fetcher, actionType === SKIP_DISPATCH ? undefined : reducer].concat(rollbacker || []));
|
|
1251
|
+
}
|
|
1252
|
+
} else {
|
|
1253
|
+
return prevArgs.length < fnOrArray.length ? function () {
|
|
1254
|
+
for (var _len3 = arguments.length, moreArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1255
|
+
moreArgs[_key3] = arguments[_key3];
|
|
1256
|
+
}
|
|
1257
|
+
return Action(fnOrArray, [...prevArgs, ...moreArgs]);
|
|
1258
|
+
} : Action(fnOrArray(...prevArgs), prevArgs);
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
const mapAction = (get, dispatcher, firstRun) => action => {
|
|
1262
|
+
if (Array.isArray(action)) {
|
|
1263
|
+
if (firstRun) {
|
|
1264
|
+
return () => mapAction(get, dispatcher)(action);
|
|
1265
|
+
}
|
|
1266
|
+
const _action = _slicedToArray__default["default"](action, 3),
|
|
1267
|
+
fetcher = _action[0],
|
|
1268
|
+
reducer = _action[1],
|
|
1269
|
+
rollbacker = _action[2];
|
|
1270
|
+
const _ref3 = action.extra || {},
|
|
1271
|
+
skip = _ref3.skip;
|
|
1272
|
+
if (skip && skip(get())) {
|
|
1273
|
+
return Promise.resolve(SKIPPED_ACTION);
|
|
1274
|
+
}
|
|
1275
|
+
const fetched = fetcher();
|
|
1276
|
+
if (rollbacker) {
|
|
1277
|
+
dispatcher(prevState => {
|
|
1278
|
+
const nextState = reducer(null)(prevState);
|
|
1279
|
+
fetched.catch(response => {
|
|
1280
|
+
dispatcher(rollbacker(prevState, nextState, response));
|
|
1281
|
+
});
|
|
1282
|
+
return nextState;
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
if (reducer !== undefined) {
|
|
1286
|
+
fetched.then(response => dispatcher(reducer(response)));
|
|
1287
|
+
}
|
|
1288
|
+
return fetched;
|
|
1289
|
+
} else {
|
|
1290
|
+
return function () {
|
|
1291
|
+
return mapAction(get, dispatcher)(action(...arguments));
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
const activateActions = function (get, dispatcher) {
|
|
1296
|
+
for (var _len4 = arguments.length, actions = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
|
1297
|
+
actions[_key4 - 2] = arguments[_key4];
|
|
1298
|
+
}
|
|
1299
|
+
return actions.map(mapAction(get, dispatcher, true));
|
|
1300
|
+
};
|
|
1301
|
+
const SkipAction = (skip, action) => {
|
|
1302
|
+
action.extra = _objectSpread$1(_objectSpread$1({}, action.extra), {}, {
|
|
1303
|
+
skip
|
|
1304
|
+
});
|
|
1305
|
+
return action;
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
const compareBest = compare => (best, next) => best ? compare(best, next) ? next : best : next;
|
|
1309
|
+
const toLowest = function () {
|
|
1310
|
+
let getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity__default["default"];
|
|
1311
|
+
return compareBest((best, next) => getValue(next) < getValue(best));
|
|
1312
|
+
};
|
|
1313
|
+
const toHighest = function () {
|
|
1314
|
+
let getValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _identity__default["default"];
|
|
1315
|
+
return compareBest((best, next) => getValue(next) > getValue(best));
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1319
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1320
|
+
const addExtraProp = function (element, extra) {
|
|
1321
|
+
let override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
1322
|
+
return /*#__PURE__*/React__default["default"].cloneElement(element, override ? _objectSpread(_objectSpread({}, element.props), extra) : _objectSpread(_objectSpread({}, extra), element.props), element.props.children);
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
const useEventListener = function (eventName, callback) {
|
|
1326
|
+
let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1327
|
+
React.useEffect(() => {
|
|
1328
|
+
window.addEventListener(eventName, callback);
|
|
1329
|
+
return () => window.removeEventListener(eventName, callback);
|
|
1330
|
+
}, deps);
|
|
1331
|
+
};
|
|
1332
|
+
const useEventListenerIf = function (check, eventName, callback) {
|
|
1333
|
+
let deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1334
|
+
React.useEffect(() => {
|
|
1335
|
+
if (!check()) return;
|
|
1336
|
+
window.addEventListener(eventName, callback);
|
|
1337
|
+
return () => window.removeEventListener(eventName, callback);
|
|
1338
|
+
}, deps);
|
|
1339
|
+
};
|
|
1340
|
+
const useEventListenerFor = function (element, eventName, callback) {
|
|
1341
|
+
let deps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
1342
|
+
React.useEffect(() => {
|
|
1343
|
+
element.addEventListener(eventName, callback);
|
|
1344
|
+
return () => element.removeEventListener(eventName, callback);
|
|
1345
|
+
}, deps.concat(element));
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
const disableSelect = e => {
|
|
1349
|
+
e.preventDefault();
|
|
1350
|
+
};
|
|
1351
|
+
const createPressEvent = onStart => normalizePress((startEvent, info) => {
|
|
1352
|
+
const onEnd = onStart(startEvent, info);
|
|
1353
|
+
const finish = normalizePress((e, info) => {
|
|
1354
|
+
callIfFunction(onEnd, e, info);
|
|
1355
|
+
window.removeEventListener('selectstart', disableSelect);
|
|
1356
|
+
window.removeEventListener('touchend', finish);
|
|
1357
|
+
window.removeEventListener('mouseup', finish);
|
|
1358
|
+
});
|
|
1359
|
+
window.addEventListener('selectstart', disableSelect);
|
|
1360
|
+
if (startEvent.touches) {
|
|
1361
|
+
window.addEventListener('touchend', finish);
|
|
1362
|
+
} else {
|
|
1363
|
+
window.addEventListener("mouseup", finish);
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
const createPressAndHoldEvent = (onStart, interval) => createPressEvent((startEvent, info) => {
|
|
1367
|
+
const _concat = [].concat(onStart(startEvent, info)),
|
|
1368
|
+
_concat2 = _slicedToArray__default["default"](_concat, 2),
|
|
1369
|
+
onInterval = _concat2[0],
|
|
1370
|
+
onEnd = _concat2[1];
|
|
1371
|
+
let i = 0;
|
|
1372
|
+
if (interval) {
|
|
1373
|
+
const intervalId = setInterval(() => {
|
|
1374
|
+
onInterval(i++);
|
|
1375
|
+
}, interval);
|
|
1376
|
+
return normalizePress((e, info) => {
|
|
1377
|
+
callIfFunction(onEnd, e, info);
|
|
1378
|
+
clearInterval(intervalId);
|
|
1379
|
+
});
|
|
1380
|
+
} else {
|
|
1381
|
+
let running = true;
|
|
1382
|
+
const run = () => window.requestAnimationFrame(() => {
|
|
1383
|
+
if (running) {
|
|
1384
|
+
onInterval(i++);
|
|
1385
|
+
run();
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
run();
|
|
1389
|
+
return normalizePress((e, info) => {
|
|
1390
|
+
callIfFunction(onEnd, e, info);
|
|
1391
|
+
running = false;
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
const createPressAndMoveEvent = onStart => createPressEvent((startEvent, info) => {
|
|
1396
|
+
const _concat3 = [].concat(onStart(startEvent, info)),
|
|
1397
|
+
_concat4 = _slicedToArray__default["default"](_concat3, 2),
|
|
1398
|
+
onMove = _concat4[0],
|
|
1399
|
+
onEnd = _concat4[1];
|
|
1400
|
+
const finish = normalizePress((e, info) => {
|
|
1401
|
+
callIfFunction(onEnd, e, info);
|
|
1402
|
+
window.removeEventListener('touchmove', move);
|
|
1403
|
+
window.removeEventListener('mousemove', move);
|
|
1404
|
+
});
|
|
1405
|
+
const move = normalizePress(onMove, finish);
|
|
1406
|
+
if (startEvent.touches) {
|
|
1407
|
+
window.addEventListener('touchmove', move, {
|
|
1408
|
+
passive: false
|
|
1409
|
+
});
|
|
1410
|
+
} else {
|
|
1411
|
+
window.addEventListener("mousemove", move);
|
|
1412
|
+
}
|
|
1413
|
+
return finish;
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
// Suspense integrations like Relay implement
|
|
1417
|
+
// a contract like this to integrate with React.
|
|
1418
|
+
// Real implementations can be significantly more complex.
|
|
1419
|
+
// Don't copy-paste this into your project!
|
|
1420
|
+
const EMPTY_ARGS = [];
|
|
1421
|
+
const UNDEFINED_CURRENT_VALUE = {};
|
|
1422
|
+
const innerWrapLazy = refreshCallback => function (maybePromise) {
|
|
1423
|
+
for (var _len = arguments.length, rootArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1424
|
+
rootArgs[_key - 1] = arguments[_key];
|
|
1425
|
+
}
|
|
1426
|
+
let status;
|
|
1427
|
+
let awaitReadResolver;
|
|
1428
|
+
let checker = _isEqual__default["default"];
|
|
1429
|
+
let lazyArgs = EMPTY_ARGS;
|
|
1430
|
+
let uid = Math.random().toString() + Date.now();
|
|
1431
|
+
let result;
|
|
1432
|
+
let currentValue = UNDEFINED_CURRENT_VALUE;
|
|
1433
|
+
const promisify = (maybePromise, resolveNow) => {
|
|
1434
|
+
return (_isFunction__default["default"](maybePromise) && !resolveNow ? new Promise(res => awaitReadResolver = res) : Promise.resolve()).then(function () {
|
|
1435
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1436
|
+
args[_key2] = arguments[_key2];
|
|
1437
|
+
}
|
|
1438
|
+
return callIfFunction(maybePromise, ...rootArgs, ...lazyArgs, ...args);
|
|
1439
|
+
});
|
|
1440
|
+
};
|
|
1441
|
+
const onPromiseSuccess = returnedPromise => r => {
|
|
1442
|
+
if (returnedPromise !== suspender) {
|
|
1443
|
+
return suspender;
|
|
1444
|
+
}
|
|
1445
|
+
status = "success";
|
|
1446
|
+
currentValue = r;
|
|
1447
|
+
result = r;
|
|
1448
|
+
return r;
|
|
1449
|
+
};
|
|
1450
|
+
const onPromiseError = returnedPromise => e => {
|
|
1451
|
+
if (returnedPromise !== suspender) {
|
|
1452
|
+
return suspender;
|
|
1453
|
+
}
|
|
1454
|
+
status = "error";
|
|
1455
|
+
result = e;
|
|
1456
|
+
return Promise.reject(e);
|
|
1457
|
+
};
|
|
1458
|
+
const suspend = maybePromise => {
|
|
1459
|
+
status = "pending";
|
|
1460
|
+
awaitReadResolver = _identity__default["default"];
|
|
1461
|
+
const returnedPromise = promisify(maybePromise);
|
|
1462
|
+
returnedPromise.then(onPromiseSuccess(returnedPromise), onPromiseError(returnedPromise));
|
|
1463
|
+
return returnedPromise;
|
|
1464
|
+
};
|
|
1465
|
+
let suspender = suspend(maybePromise);
|
|
1466
|
+
return {
|
|
1467
|
+
read() {
|
|
1468
|
+
awaitReadResolver();
|
|
1469
|
+
if (status === "pending") {
|
|
1470
|
+
throw suspender;
|
|
1471
|
+
} else if (status === "error") {
|
|
1472
|
+
throw result;
|
|
1473
|
+
} else if (status === "success") {
|
|
1474
|
+
return currentValue;
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
promise() {
|
|
1478
|
+
awaitReadResolver();
|
|
1479
|
+
return suspender;
|
|
1480
|
+
},
|
|
1481
|
+
refresh(force) {
|
|
1482
|
+
if (status !== "pending" || force) {
|
|
1483
|
+
suspender = suspend(maybePromise);
|
|
1484
|
+
uid = Math.random().toString() + Date.now();
|
|
1485
|
+
callIfFunction(refreshCallback, this);
|
|
1486
|
+
}
|
|
1487
|
+
return this;
|
|
1488
|
+
},
|
|
1489
|
+
next() {
|
|
1490
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1491
|
+
args[_key3] = arguments[_key3];
|
|
1492
|
+
}
|
|
1493
|
+
return wrapLazy(maybePromise, ...rootArgs, ...args).checkWith(checker);
|
|
1494
|
+
},
|
|
1495
|
+
use() {
|
|
1496
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1497
|
+
args[_key4] = arguments[_key4];
|
|
1498
|
+
}
|
|
1499
|
+
if (!checker(args, lazyArgs)) {
|
|
1500
|
+
if (lazyArgs !== EMPTY_ARGS) {
|
|
1501
|
+
uid = Math.random().toString() + Date.now();
|
|
1502
|
+
}
|
|
1503
|
+
lazyArgs = args;
|
|
1504
|
+
suspender = suspend(maybePromise);
|
|
1505
|
+
}
|
|
1506
|
+
return this;
|
|
1507
|
+
},
|
|
1508
|
+
_getCurrentValue() {
|
|
1509
|
+
return currentValue;
|
|
1510
|
+
},
|
|
1511
|
+
silentRefresh() {
|
|
1512
|
+
const currentSuspender = suspender;
|
|
1513
|
+
const suspended = promisify(maybePromise, true).then(v => {
|
|
1514
|
+
if (currentSuspender === suspender) {
|
|
1515
|
+
suspender = suspended;
|
|
1516
|
+
}
|
|
1517
|
+
return v;
|
|
1518
|
+
});
|
|
1519
|
+
suspended.then(onPromiseSuccess(suspended), onPromiseError(suspended));
|
|
1520
|
+
uid = Math.random().toString() + Date.now();
|
|
1521
|
+
callIfFunction(refreshCallback, this);
|
|
1522
|
+
return suspended;
|
|
1523
|
+
},
|
|
1524
|
+
and(lazy) {},
|
|
1525
|
+
checkWith(isEqual) {
|
|
1526
|
+
checker = isEqual;
|
|
1527
|
+
return this;
|
|
1528
|
+
},
|
|
1529
|
+
localUpdate(updater) {
|
|
1530
|
+
currentValue = callIfFunction(updater, currentValue);
|
|
1531
|
+
return this;
|
|
1532
|
+
},
|
|
1533
|
+
uid() {
|
|
1534
|
+
return uid;
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
};
|
|
1538
|
+
const wrapLazy = innerWrapLazy();
|
|
1539
|
+
|
|
1540
|
+
const SECOND = 1000;
|
|
1541
|
+
const MINUTE = SECOND * 60;
|
|
1542
|
+
const HOUR = MINUTE * 60;
|
|
1543
|
+
const DAY = HOUR * 24;
|
|
1544
|
+
const WEEK = DAY * 7;
|
|
1545
|
+
const MONTH = DAY * 31;
|
|
1546
|
+
const YEAR = DAY * 366;
|
|
1547
|
+
const getStartOfDay = function (d) {
|
|
1548
|
+
let utc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1549
|
+
const date = new Date(d);
|
|
1550
|
+
if (utc) {
|
|
1551
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
1552
|
+
} else {
|
|
1553
|
+
date.setHours(0, 0, 0, 0);
|
|
1554
|
+
}
|
|
1555
|
+
return date;
|
|
1556
|
+
};
|
|
1557
|
+
const isSameDay = function (a, b) {
|
|
1558
|
+
let utc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1559
|
+
return getStartOfDay(a, utc).getTime() === getStartOfDay(b, utc).getTime();
|
|
1560
|
+
};
|
|
1561
|
+
const intervalsIntersect = (_ref, _ref2) => {
|
|
1562
|
+
let _ref3 = _slicedToArray__default["default"](_ref, 2),
|
|
1563
|
+
a1 = _ref3[0],
|
|
1564
|
+
a2 = _ref3[1];
|
|
1565
|
+
let _ref4 = _slicedToArray__default["default"](_ref2, 2),
|
|
1566
|
+
b1 = _ref4[0],
|
|
1567
|
+
b2 = _ref4[1];
|
|
1568
|
+
return b2 >= a1 && b1 <= a2;
|
|
1569
|
+
};
|
|
1570
|
+
const intervalsIntersectExclusive = (_ref5, _ref6) => {
|
|
1571
|
+
let _ref7 = _slicedToArray__default["default"](_ref5, 2),
|
|
1572
|
+
a1 = _ref7[0],
|
|
1573
|
+
a2 = _ref7[1];
|
|
1574
|
+
let _ref8 = _slicedToArray__default["default"](_ref6, 2),
|
|
1575
|
+
b1 = _ref8[0],
|
|
1576
|
+
b2 = _ref8[1];
|
|
1577
|
+
return b2 > a1 && b1 < a2;
|
|
1578
|
+
};
|
|
1579
|
+
const intervalsIntersection = (a, b) => {
|
|
1580
|
+
if (!intervalsIntersect(a, b)) {
|
|
1581
|
+
return [];
|
|
1582
|
+
}
|
|
1583
|
+
return [[Math.max(a[0], b[0]), Math.min(a[1], b[1])]];
|
|
1584
|
+
};
|
|
1585
|
+
const diffIntervals = (_ref9, _ref0) => {
|
|
1586
|
+
let _ref1 = _slicedToArray__default["default"](_ref9, 2),
|
|
1587
|
+
a1 = _ref1[0],
|
|
1588
|
+
a2 = _ref1[1];
|
|
1589
|
+
let _ref10 = _slicedToArray__default["default"](_ref0, 2),
|
|
1590
|
+
b1 = _ref10[0],
|
|
1591
|
+
b2 = _ref10[1];
|
|
1592
|
+
if (a1 >= b2 ||
|
|
1593
|
+
// a after b
|
|
1594
|
+
b1 >= a2 // a before b
|
|
1595
|
+
) {
|
|
1596
|
+
return [[a1, a2]];
|
|
1597
|
+
} else if (a1 > b1 && a2 < b2) {
|
|
1598
|
+
// a inside b
|
|
1599
|
+
return [];
|
|
1600
|
+
}
|
|
1601
|
+
if (b1 > a1 && b2 < a2) {
|
|
1602
|
+
// b inside a
|
|
1603
|
+
return [[a1, b1], [b2, a2]];
|
|
1604
|
+
}
|
|
1605
|
+
if (b1 <= a1) {
|
|
1606
|
+
// b intersecting left of a
|
|
1607
|
+
return [[b2, a2]];
|
|
1608
|
+
} else {
|
|
1609
|
+
// b intersecting right of a
|
|
1610
|
+
return [[a1, b1]];
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
const blockDiffIntervals = (a, b) => intervalsIntersect(a, b) ? [] : [a];
|
|
1614
|
+
const startBlockDiffIntervals = (a, b) => intervalsIntersectExclusive(a, b) && a[0] >= b[0] ? [] : [a];
|
|
1615
|
+
|
|
1616
|
+
const timerPromise = time => new Promise(res => setTimeout(res, time));
|
|
1617
|
+
const cancelableTimer = (res, time) => {
|
|
1618
|
+
const v = setTimeout(res, time);
|
|
1619
|
+
return () => clearTimeout(v);
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
const formatJoin = function (arr) {
|
|
1623
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ', ';
|
|
1624
|
+
let lastSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ' e ';
|
|
1625
|
+
return [arr.slice(0, -1).join(separator), arr.slice(-1)].join(lastSeparator);
|
|
1626
|
+
};
|
|
1627
|
+
const formatJoinArr = (arr, separator, lastSeparator) => arr.flatMap((v, i) => i < arr.length - 2 ? [v, separator] : i < arr.length - 1 ? [v, lastSeparator] : [v]);
|
|
1628
|
+
const removeAccents = str => (str || "").normalize('NFD').replace(/\p{Diacritic}/gu, "");
|
|
1629
|
+
const asciify = str => removeAccents(str || "").replace(/[^\x00-\x7F]/g, "");
|
|
1630
|
+
const normalizeText = str => removeAccents(str).toLowerCase();
|
|
1631
|
+
const normalizeTextUrl = str => removeAccents(str).replace(/[\s.\u0022&/]/g, '-').replace(/-{2,}/g, '-').toLowerCase();
|
|
1632
|
+
const willFormatDecimal = function () {
|
|
1633
|
+
let digits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 2;
|
|
1634
|
+
let _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
1635
|
+
max = _ref.max,
|
|
1636
|
+
min = _ref.min,
|
|
1637
|
+
padTo = _ref.padTo,
|
|
1638
|
+
zeroless = _ref.zeroless,
|
|
1639
|
+
clean = _ref.clean;
|
|
1640
|
+
const splitRegex = new RegExp("(\\d+)(\\d{".concat(digits, "})"));
|
|
1641
|
+
const singleRegex = new RegExp("/^([^,]*,\\d{0,".concat(digits, ").*/"));
|
|
1642
|
+
const pad = str => padTo ? str.indexOf(",") >= 0 ? _padCharsEnd__default["default"]("0", str.indexOf(",") + padTo + 1, str) : _padCharsEnd__default["default"]("0", str.length + 1 + padTo, str + ",") : str;
|
|
1643
|
+
const constrain = val => {
|
|
1644
|
+
if (_isNumber__default["default"](max) && parseFloat(val.replace(",", ".")) > max) return max.toString();
|
|
1645
|
+
if (_isNumber__default["default"](min) && parseFloat(val.replace(",", ".")) < min) return min.toString();
|
|
1646
|
+
return val;
|
|
1647
|
+
};
|
|
1648
|
+
const cleaned = val => clean ? val.replace(/,$/, '').replace(/^0*,/, '0,') || "0" : val;
|
|
1649
|
+
return v => {
|
|
1650
|
+
const skipZero = finalV => v !== '0' && zeroless && finalV === '0' ? '' : finalV.replace(/^0+([^,])/, '$1');
|
|
1651
|
+
const formatted = _flow__default["default"](constrain, pad, skipZero, cleaned);
|
|
1652
|
+
if (_isNumber__default["default"](v)) {
|
|
1653
|
+
return formatted(v.toString().replace(".", ","));
|
|
1654
|
+
}
|
|
1655
|
+
const fixComma = v => v.replace(/,/g, '').replace(splitRegex, "$1,$2");
|
|
1656
|
+
const format = () => {
|
|
1657
|
+
const allowedChars = (v || "").replace(/[^\d,]/g, "");
|
|
1658
|
+
const commaIndex = allowedChars.indexOf(',');
|
|
1659
|
+
if (commaIndex >= 0 && commaIndex < allowedChars.length - 1 - digits) {
|
|
1660
|
+
const alteredComma = fixComma(allowedChars);
|
|
1661
|
+
if (_isNumber__default["default"](max) && parseFloat(alteredComma.replace(",", ".")) > max) {
|
|
1662
|
+
return fixComma(allowedChars.slice(0, commaIndex + 1 + digits));
|
|
1663
|
+
}
|
|
1664
|
+
return alteredComma;
|
|
1665
|
+
}
|
|
1666
|
+
const simpleNumber = allowedChars.replace(singleRegex, "$1");
|
|
1667
|
+
if (_isNumber__default["default"](max) && parseInt(simpleNumber) > max) {
|
|
1668
|
+
return simpleNumber.slice(0, -1);
|
|
1669
|
+
}
|
|
1670
|
+
return simpleNumber;
|
|
1671
|
+
};
|
|
1672
|
+
const result = format();
|
|
1673
|
+
return formatted(result);
|
|
1674
|
+
};
|
|
1675
|
+
};
|
|
1676
|
+
const parseDecimalToNumber = v => _isString__default["default"](v) ? Number(v.replace(/\./g, '').replace(',', ".")) : v || 0;
|
|
1677
|
+
|
|
1678
|
+
exports.Action = Action;
|
|
1679
|
+
exports.COMPLETE_ACTION = COMPLETE_ACTION;
|
|
1680
|
+
exports.DAY = DAY;
|
|
1681
|
+
exports.FETCH = FETCH;
|
|
1682
|
+
exports.HOUR = HOUR;
|
|
1683
|
+
exports.MINUTE = MINUTE;
|
|
1684
|
+
exports.MONTH = MONTH;
|
|
1685
|
+
exports.REDUCE = REDUCE;
|
|
1686
|
+
exports.SECOND = SECOND;
|
|
1687
|
+
exports.SKIPPED_ACTION = SKIPPED_ACTION;
|
|
1688
|
+
exports.SKIP_DISPATCH = SKIP_DISPATCH;
|
|
1689
|
+
exports.SKIP_FETCH = SKIP_FETCH;
|
|
1690
|
+
exports.SkipAction = SkipAction;
|
|
1691
|
+
exports.WEEK = WEEK;
|
|
1692
|
+
exports.YEAR = YEAR;
|
|
1693
|
+
exports._s = _s;
|
|
1694
|
+
exports.activateActions = activateActions;
|
|
1695
|
+
exports.addExtraProp = addExtraProp;
|
|
1696
|
+
exports.addHttp = addHttp;
|
|
1697
|
+
exports.addQueryString = addQueryString;
|
|
1698
|
+
exports.addZero = addZero;
|
|
1699
|
+
exports.animationTiming = animationTiming;
|
|
1700
|
+
exports.asciify = asciify;
|
|
1701
|
+
exports.asyncDebounce = asyncDebounce;
|
|
1702
|
+
exports.blockDiffIntervals = blockDiffIntervals;
|
|
1703
|
+
exports.callIfFunction = callIfFunction;
|
|
1704
|
+
exports.callIfFunctions = callIfFunctions;
|
|
1705
|
+
exports.callMany = callMany;
|
|
1706
|
+
exports.cancelableTimer = cancelableTimer;
|
|
1707
|
+
exports.compareBest = compareBest;
|
|
1708
|
+
exports.concatSelectors = concatSelectors;
|
|
1709
|
+
exports.constrainEvent = constrainEvent;
|
|
1710
|
+
exports.createPressAndHoldEvent = createPressAndHoldEvent;
|
|
1711
|
+
exports.createPressAndMoveEvent = createPressAndMoveEvent;
|
|
1712
|
+
exports.createPressEvent = createPressEvent;
|
|
1713
|
+
exports.createPromiseQueue = createPromiseQueue;
|
|
1714
|
+
exports.createPromiseResolverPair = createPromiseResolverPair;
|
|
1715
|
+
exports.createSimplePromiseLock = createSimplePromiseLock;
|
|
1716
|
+
exports.customTheme = customTheme;
|
|
1717
|
+
exports.diffIntervals = diffIntervals;
|
|
1718
|
+
exports.digitsToPattern = digitsToPattern;
|
|
1719
|
+
exports.ellipsis = ellipsis;
|
|
1720
|
+
exports.fixMediaQuery = fixMediaQuery;
|
|
1721
|
+
exports.formFetch = formFetch;
|
|
1722
|
+
exports.formFetchWithResponse = formFetchWithResponse;
|
|
1723
|
+
exports.formatDate = formatDate;
|
|
1724
|
+
exports.formatDateToPattern = formatDateToPattern;
|
|
1725
|
+
exports.formatHour = formatHour;
|
|
1726
|
+
exports.formatJoin = formatJoin;
|
|
1727
|
+
exports.formatJoinArr = formatJoinArr;
|
|
1728
|
+
exports.formatPath = formatPath;
|
|
1729
|
+
exports.getClosestOffsetScroll = getClosestOffsetScroll;
|
|
1730
|
+
exports.getColor = getColor;
|
|
1731
|
+
exports.getFetcher = getFetcher;
|
|
1732
|
+
exports.getFetcherWithResponse = getFetcherWithResponse;
|
|
1733
|
+
exports.getMargin = getMargin;
|
|
1734
|
+
exports.getNumberInputType = getNumberInputType;
|
|
1735
|
+
exports.getNumberInputType2 = getNumberInputType2;
|
|
1736
|
+
exports.getScrollParent = getScrollParent;
|
|
1737
|
+
exports.getStartOfDay = getStartOfDay;
|
|
1738
|
+
exports.getUID = getUID;
|
|
1739
|
+
exports.getUrlParams = getUrlParams;
|
|
1740
|
+
exports.identityFn = identityFn;
|
|
1741
|
+
exports.identityOpacityFrames = identityOpacityFrames;
|
|
1742
|
+
exports.identityTranslateFrames = identityTranslateFrames;
|
|
1743
|
+
exports.ifNotProp = ifNotProp;
|
|
1744
|
+
exports.ifProp = ifProp;
|
|
1745
|
+
exports.ifPropEquals = ifPropEquals;
|
|
1746
|
+
exports.ifUndefined = ifUndefined;
|
|
1747
|
+
exports.intToHour = intToHour;
|
|
1748
|
+
exports.intervalsIntersect = intervalsIntersect;
|
|
1749
|
+
exports.intervalsIntersectExclusive = intervalsIntersectExclusive;
|
|
1750
|
+
exports.intervalsIntersection = intervalsIntersection;
|
|
1751
|
+
exports.intsToHour = intsToHour;
|
|
1752
|
+
exports.isAndroid = isAndroid;
|
|
1753
|
+
exports.isElementInView = isElementInView;
|
|
1754
|
+
exports.isEmptyHtml = isEmptyHtml;
|
|
1755
|
+
exports.isHighDensity = isHighDensity;
|
|
1756
|
+
exports.isIOS = isIOS;
|
|
1757
|
+
exports.isIPad = isIPad;
|
|
1758
|
+
exports.isMobile = isMobile;
|
|
1759
|
+
exports.isPWA = isPWA;
|
|
1760
|
+
exports.isRetina = isRetina;
|
|
1761
|
+
exports.isSameDay = isSameDay;
|
|
1762
|
+
exports.isShallowEqual = isShallowEqual;
|
|
1763
|
+
exports.isShallowEqualSameKeys = isShallowEqualSameKeys;
|
|
1764
|
+
exports.isSmallDevice = isSmallDevice;
|
|
1765
|
+
exports.isTouchDevice = isTouchDevice;
|
|
1766
|
+
exports.isUrl = isUrl;
|
|
1767
|
+
exports.lazyValue = lazyValue;
|
|
1768
|
+
exports.linkRegex = linkRegex;
|
|
1769
|
+
exports.mapGetOrSet = mapGetOrSet;
|
|
1770
|
+
exports.media = media;
|
|
1771
|
+
exports.normalizeMouse = normalizeMouse;
|
|
1772
|
+
exports.normalizePress = normalizePress;
|
|
1773
|
+
exports.normalizeText = normalizeText;
|
|
1774
|
+
exports.normalizeTextUrl = normalizeTextUrl;
|
|
1775
|
+
exports.normalizeTouch = normalizeTouch;
|
|
1776
|
+
exports.notPrinterMedia = notPrinterMedia;
|
|
1777
|
+
exports.oneWayAnimation = oneWayAnimation;
|
|
1778
|
+
exports.parseDate = parseDate;
|
|
1779
|
+
exports.parseDecimalToNumber = parseDecimalToNumber;
|
|
1780
|
+
exports.postFetcher = postFetcher;
|
|
1781
|
+
exports.postFetcherWithResponse = postFetcherWithResponse;
|
|
1782
|
+
exports.preventDefault = preventDefault;
|
|
1783
|
+
exports.printerMedia = printerMedia;
|
|
1784
|
+
exports.promiseMapReduce = promiseMapReduce;
|
|
1785
|
+
exports.prop = prop;
|
|
1786
|
+
exports.queryStringToObj = queryStringToObj;
|
|
1787
|
+
exports.rafThrottle = rafThrottle;
|
|
1788
|
+
exports.removeAccents = removeAccents;
|
|
1789
|
+
exports.safeNewLineToBr = safeNewLineToBr;
|
|
1790
|
+
exports.scrollIntoViewWithOffset = scrollIntoViewWithOffset;
|
|
1791
|
+
exports.scrollWidth = scrollWidth;
|
|
1792
|
+
exports.selectPath = selectPath;
|
|
1793
|
+
exports.smoothScroll = smoothScroll;
|
|
1794
|
+
exports.startBlockDiffIntervals = startBlockDiffIntervals;
|
|
1795
|
+
exports.stopPropagation = stopPropagation;
|
|
1796
|
+
exports.styledExtend = styledExtend;
|
|
1797
|
+
exports.timerPromise = timerPromise;
|
|
1798
|
+
exports.toHighest = toHighest;
|
|
1799
|
+
exports.toLowest = toLowest;
|
|
1800
|
+
exports.touchClick = touchClick;
|
|
1801
|
+
exports.twoWayAnimation = twoWayAnimation;
|
|
1802
|
+
exports.useEventListener = useEventListener;
|
|
1803
|
+
exports.useEventListenerFor = useEventListenerFor;
|
|
1804
|
+
exports.useEventListenerIf = useEventListenerIf;
|
|
1805
|
+
exports.using = using;
|
|
1806
|
+
exports.vheight = vheight;
|
|
1807
|
+
exports.will = will;
|
|
1808
|
+
exports.willFormatDecimal = willFormatDecimal;
|
|
1809
|
+
exports.willRafThrottle = willRafThrottle;
|
|
1810
|
+
exports.wrapLazy = wrapLazy;
|
|
1811
|
+
//# sourceMappingURL=index.cjs.map
|