@bigbinary/neeto-rules-frontend 0.3.5 → 0.3.6
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/README.md +12 -458
- package/dist/index.cjs.js +705 -2816
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +685 -2795
- package/dist/index.js.map +1 -1
- package/package.json +140 -113
- package/types.d.ts +3 -0
- package/dist/main.css +0 -2
- package/dist/main.css.map +0 -1
- /package/{src → app/javascript/src}/translations/en.json +0 -0
- /package/{src → app/javascript/src}/translations/fr.json +0 -0
- /package/{src → app/javascript/src}/translations/index.js +0 -0
package/dist/index.js
CHANGED
|
@@ -1,2273 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { isEditorEmpty, FormikEditor } from '@bigbinary/neeto-editor';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import dayjs from 'dayjs';
|
|
18
|
-
import { useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
19
|
-
|
|
20
|
-
function _objectDestructuringEmpty(obj) {
|
|
21
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _setPrototypeOf$1(o, p) {
|
|
25
|
-
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
26
|
-
o.__proto__ = p;
|
|
27
|
-
return o;
|
|
28
|
-
};
|
|
29
|
-
return _setPrototypeOf$1(o, p);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _inheritsLoose$1(subClass, superClass) {
|
|
33
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
34
|
-
subClass.prototype.constructor = subClass;
|
|
35
|
-
_setPrototypeOf$1(subClass, superClass);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var propTypes = {exports: {}};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the MIT license found in the
|
|
44
|
-
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/
|
|
46
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
47
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
51
|
-
*
|
|
52
|
-
* This source code is licensed under the MIT license found in the
|
|
53
|
-
* LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/
|
|
55
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
56
|
-
function emptyFunction() {}
|
|
57
|
-
function emptyFunctionWithReset() {}
|
|
58
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
59
|
-
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
60
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
61
|
-
if (secret === ReactPropTypesSecret) {
|
|
62
|
-
// It is still safe when called from React.
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
66
|
-
err.name = 'Invariant Violation';
|
|
67
|
-
throw err;
|
|
68
|
-
}
|
|
69
|
-
shim.isRequired = shim;
|
|
70
|
-
function getShim() {
|
|
71
|
-
return shim;
|
|
72
|
-
}
|
|
73
|
-
// Important!
|
|
74
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
75
|
-
var ReactPropTypes = {
|
|
76
|
-
array: shim,
|
|
77
|
-
bigint: shim,
|
|
78
|
-
bool: shim,
|
|
79
|
-
func: shim,
|
|
80
|
-
number: shim,
|
|
81
|
-
object: shim,
|
|
82
|
-
string: shim,
|
|
83
|
-
symbol: shim,
|
|
84
|
-
any: shim,
|
|
85
|
-
arrayOf: getShim,
|
|
86
|
-
element: shim,
|
|
87
|
-
elementType: shim,
|
|
88
|
-
instanceOf: getShim,
|
|
89
|
-
node: shim,
|
|
90
|
-
objectOf: getShim,
|
|
91
|
-
oneOf: getShim,
|
|
92
|
-
oneOfType: getShim,
|
|
93
|
-
shape: getShim,
|
|
94
|
-
exact: getShim,
|
|
95
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
96
|
-
resetWarningCache: emptyFunction
|
|
97
|
-
};
|
|
98
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
99
|
-
return ReactPropTypes;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the MIT license found in the
|
|
106
|
-
* LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/
|
|
108
|
-
{
|
|
109
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
110
|
-
// http://fb.me/prop-types-in-prod
|
|
111
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function _extends$1() {
|
|
115
|
-
_extends$1 = Object.assign || function (target) {
|
|
116
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
117
|
-
var source = arguments[i];
|
|
118
|
-
for (var key in source) {
|
|
119
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
120
|
-
target[key] = source[key];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return target;
|
|
125
|
-
};
|
|
126
|
-
return _extends$1.apply(this, arguments);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function isAbsolute(pathname) {
|
|
130
|
-
return pathname.charAt(0) === '/';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
134
|
-
function spliceOne(list, index) {
|
|
135
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
136
|
-
list[i] = list[k];
|
|
137
|
-
}
|
|
138
|
-
list.pop();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// This implementation is based heavily on node's url.parse
|
|
142
|
-
function resolvePathname(to, from) {
|
|
143
|
-
if (from === undefined) from = '';
|
|
144
|
-
var toParts = to && to.split('/') || [];
|
|
145
|
-
var fromParts = from && from.split('/') || [];
|
|
146
|
-
var isToAbs = to && isAbsolute(to);
|
|
147
|
-
var isFromAbs = from && isAbsolute(from);
|
|
148
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
149
|
-
if (to && isAbsolute(to)) {
|
|
150
|
-
// to is absolute
|
|
151
|
-
fromParts = toParts;
|
|
152
|
-
} else if (toParts.length) {
|
|
153
|
-
// to is relative, drop the filename
|
|
154
|
-
fromParts.pop();
|
|
155
|
-
fromParts = fromParts.concat(toParts);
|
|
156
|
-
}
|
|
157
|
-
if (!fromParts.length) return '/';
|
|
158
|
-
var hasTrailingSlash;
|
|
159
|
-
if (fromParts.length) {
|
|
160
|
-
var last = fromParts[fromParts.length - 1];
|
|
161
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
162
|
-
} else {
|
|
163
|
-
hasTrailingSlash = false;
|
|
164
|
-
}
|
|
165
|
-
var up = 0;
|
|
166
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
167
|
-
var part = fromParts[i];
|
|
168
|
-
if (part === '.') {
|
|
169
|
-
spliceOne(fromParts, i);
|
|
170
|
-
} else if (part === '..') {
|
|
171
|
-
spliceOne(fromParts, i);
|
|
172
|
-
up++;
|
|
173
|
-
} else if (up) {
|
|
174
|
-
spliceOne(fromParts, i);
|
|
175
|
-
up--;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (!mustEndAbs) for (; up--; up) {
|
|
179
|
-
fromParts.unshift('..');
|
|
180
|
-
}
|
|
181
|
-
if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');
|
|
182
|
-
var result = fromParts.join('/');
|
|
183
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function _typeof$1(obj) {
|
|
188
|
-
"@babel/helpers - typeof";
|
|
189
|
-
|
|
190
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
191
|
-
return typeof obj;
|
|
192
|
-
} : function (obj) {
|
|
193
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
194
|
-
}, _typeof$1(obj);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var prefix = 'Invariant failed';
|
|
198
|
-
function invariant(condition, message) {
|
|
199
|
-
if (condition) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
{
|
|
203
|
-
throw new Error(prefix);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function addLeadingSlash$1(path) {
|
|
208
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
|
209
|
-
}
|
|
210
|
-
function stripLeadingSlash(path) {
|
|
211
|
-
return path.charAt(0) === '/' ? path.substr(1) : path;
|
|
212
|
-
}
|
|
213
|
-
function hasBasename(path, prefix) {
|
|
214
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
215
|
-
}
|
|
216
|
-
function stripBasename$1(path, prefix) {
|
|
217
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
218
|
-
}
|
|
219
|
-
function stripTrailingSlash(path) {
|
|
220
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
221
|
-
}
|
|
222
|
-
function parsePath(path) {
|
|
223
|
-
var pathname = path || '/';
|
|
224
|
-
var search = '';
|
|
225
|
-
var hash = '';
|
|
226
|
-
var hashIndex = pathname.indexOf('#');
|
|
227
|
-
if (hashIndex !== -1) {
|
|
228
|
-
hash = pathname.substr(hashIndex);
|
|
229
|
-
pathname = pathname.substr(0, hashIndex);
|
|
230
|
-
}
|
|
231
|
-
var searchIndex = pathname.indexOf('?');
|
|
232
|
-
if (searchIndex !== -1) {
|
|
233
|
-
search = pathname.substr(searchIndex);
|
|
234
|
-
pathname = pathname.substr(0, searchIndex);
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
pathname: pathname,
|
|
238
|
-
search: search === '?' ? '' : search,
|
|
239
|
-
hash: hash === '#' ? '' : hash
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function createPath(location) {
|
|
243
|
-
var pathname = location.pathname,
|
|
244
|
-
search = location.search,
|
|
245
|
-
hash = location.hash;
|
|
246
|
-
var path = pathname || '/';
|
|
247
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
248
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
249
|
-
return path;
|
|
250
|
-
}
|
|
251
|
-
function createLocation(path, state, key, currentLocation) {
|
|
252
|
-
var location;
|
|
253
|
-
if (typeof path === 'string') {
|
|
254
|
-
// Two-arg form: push(path, state)
|
|
255
|
-
location = parsePath(path);
|
|
256
|
-
location.state = state;
|
|
257
|
-
} else {
|
|
258
|
-
// One-arg form: push(location)
|
|
259
|
-
location = _extends$1({}, path);
|
|
260
|
-
if (location.pathname === undefined) location.pathname = '';
|
|
261
|
-
if (location.search) {
|
|
262
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
263
|
-
} else {
|
|
264
|
-
location.search = '';
|
|
265
|
-
}
|
|
266
|
-
if (location.hash) {
|
|
267
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
268
|
-
} else {
|
|
269
|
-
location.hash = '';
|
|
270
|
-
}
|
|
271
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
272
|
-
}
|
|
273
|
-
try {
|
|
274
|
-
location.pathname = decodeURI(location.pathname);
|
|
275
|
-
} catch (e) {
|
|
276
|
-
if (e instanceof URIError) {
|
|
277
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
278
|
-
} else {
|
|
279
|
-
throw e;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
if (key) location.key = key;
|
|
283
|
-
if (currentLocation) {
|
|
284
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
285
|
-
if (!location.pathname) {
|
|
286
|
-
location.pathname = currentLocation.pathname;
|
|
287
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
288
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
289
|
-
}
|
|
290
|
-
} else {
|
|
291
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
292
|
-
if (!location.pathname) {
|
|
293
|
-
location.pathname = '/';
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return location;
|
|
297
|
-
}
|
|
298
|
-
function createTransitionManager() {
|
|
299
|
-
var prompt = null;
|
|
300
|
-
function setPrompt(nextPrompt) {
|
|
301
|
-
prompt = nextPrompt;
|
|
302
|
-
return function () {
|
|
303
|
-
if (prompt === nextPrompt) prompt = null;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
|
307
|
-
// TODO: If another transition starts while we're still confirming
|
|
308
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
309
|
-
// best way to handle this.
|
|
310
|
-
if (prompt != null) {
|
|
311
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
312
|
-
if (typeof result === 'string') {
|
|
313
|
-
if (typeof getUserConfirmation === 'function') {
|
|
314
|
-
getUserConfirmation(result, callback);
|
|
315
|
-
} else {
|
|
316
|
-
callback(true);
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
// Return false from a transition hook to cancel the transition.
|
|
320
|
-
callback(result !== false);
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
callback(true);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
var listeners = [];
|
|
327
|
-
function appendListener(fn) {
|
|
328
|
-
var isActive = true;
|
|
329
|
-
function listener() {
|
|
330
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
331
|
-
}
|
|
332
|
-
listeners.push(listener);
|
|
333
|
-
return function () {
|
|
334
|
-
isActive = false;
|
|
335
|
-
listeners = listeners.filter(function (item) {
|
|
336
|
-
return item !== listener;
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function notifyListeners() {
|
|
341
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
342
|
-
args[_key] = arguments[_key];
|
|
343
|
-
}
|
|
344
|
-
listeners.forEach(function (listener) {
|
|
345
|
-
return listener.apply(void 0, args);
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
setPrompt: setPrompt,
|
|
350
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
351
|
-
appendListener: appendListener,
|
|
352
|
-
notifyListeners: notifyListeners
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
356
|
-
function getConfirmation(message, callback) {
|
|
357
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
361
|
-
*
|
|
362
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
363
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
364
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
function supportsHistory() {
|
|
368
|
-
var ua = window.navigator.userAgent;
|
|
369
|
-
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
|
370
|
-
return window.history && 'pushState' in window.history;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Returns true if browser fires popstate on hash change.
|
|
374
|
-
* IE10 and IE11 do not.
|
|
375
|
-
*/
|
|
376
|
-
|
|
377
|
-
function supportsPopStateOnHashChange() {
|
|
378
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Returns false if using go(n) with hash history causes a full page reload.
|
|
382
|
-
*/
|
|
383
|
-
|
|
384
|
-
function supportsGoWithoutReloadUsingHash() {
|
|
385
|
-
return window.navigator.userAgent.indexOf('Firefox') === -1;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
|
389
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
|
390
|
-
* containing undefined state when pressing the back button.
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
function isExtraneousPopstateEvent(event) {
|
|
394
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
|
395
|
-
}
|
|
396
|
-
var PopStateEvent = 'popstate';
|
|
397
|
-
var HashChangeEvent = 'hashchange';
|
|
398
|
-
function getHistoryState() {
|
|
399
|
-
try {
|
|
400
|
-
return window.history.state || {};
|
|
401
|
-
} catch (e) {
|
|
402
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
403
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
404
|
-
return {};
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Creates a history object that uses the HTML5 history API including
|
|
409
|
-
* pushState, replaceState, and the popstate event.
|
|
410
|
-
*/
|
|
411
|
-
|
|
412
|
-
function createBrowserHistory(props) {
|
|
413
|
-
if (props === void 0) {
|
|
414
|
-
props = {};
|
|
415
|
-
}
|
|
416
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
417
|
-
var globalHistory = window.history;
|
|
418
|
-
var canUseHistory = supportsHistory();
|
|
419
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
420
|
-
var _props = props,
|
|
421
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
422
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
423
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
424
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
425
|
-
_props$keyLength = _props.keyLength,
|
|
426
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
427
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
428
|
-
function getDOMLocation(historyState) {
|
|
429
|
-
var _ref = historyState || {},
|
|
430
|
-
key = _ref.key,
|
|
431
|
-
state = _ref.state;
|
|
432
|
-
var _window$location = window.location,
|
|
433
|
-
pathname = _window$location.pathname,
|
|
434
|
-
search = _window$location.search,
|
|
435
|
-
hash = _window$location.hash;
|
|
436
|
-
var path = pathname + search + hash;
|
|
437
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
438
|
-
return createLocation(path, state, key);
|
|
439
|
-
}
|
|
440
|
-
function createKey() {
|
|
441
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
442
|
-
}
|
|
443
|
-
var transitionManager = createTransitionManager();
|
|
444
|
-
function setState(nextState) {
|
|
445
|
-
_extends$1(history, nextState);
|
|
446
|
-
history.length = globalHistory.length;
|
|
447
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
448
|
-
}
|
|
449
|
-
function handlePopState(event) {
|
|
450
|
-
// Ignore extraneous popstate events in WebKit.
|
|
451
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
452
|
-
handlePop(getDOMLocation(event.state));
|
|
453
|
-
}
|
|
454
|
-
function handleHashChange() {
|
|
455
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
456
|
-
}
|
|
457
|
-
var forceNextPop = false;
|
|
458
|
-
function handlePop(location) {
|
|
459
|
-
if (forceNextPop) {
|
|
460
|
-
forceNextPop = false;
|
|
461
|
-
setState();
|
|
462
|
-
} else {
|
|
463
|
-
var action = 'POP';
|
|
464
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
465
|
-
if (ok) {
|
|
466
|
-
setState({
|
|
467
|
-
action: action,
|
|
468
|
-
location: location
|
|
469
|
-
});
|
|
470
|
-
} else {
|
|
471
|
-
revertPop(location);
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
function revertPop(fromLocation) {
|
|
477
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
478
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
479
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
480
|
-
|
|
481
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
482
|
-
if (toIndex === -1) toIndex = 0;
|
|
483
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
484
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
485
|
-
var delta = toIndex - fromIndex;
|
|
486
|
-
if (delta) {
|
|
487
|
-
forceNextPop = true;
|
|
488
|
-
go(delta);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
492
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
493
|
-
|
|
494
|
-
function createHref(location) {
|
|
495
|
-
return basename + createPath(location);
|
|
496
|
-
}
|
|
497
|
-
function push(path, state) {
|
|
498
|
-
var action = 'PUSH';
|
|
499
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
500
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
501
|
-
if (!ok) return;
|
|
502
|
-
var href = createHref(location);
|
|
503
|
-
var key = location.key,
|
|
504
|
-
state = location.state;
|
|
505
|
-
if (canUseHistory) {
|
|
506
|
-
globalHistory.pushState({
|
|
507
|
-
key: key,
|
|
508
|
-
state: state
|
|
509
|
-
}, null, href);
|
|
510
|
-
if (forceRefresh) {
|
|
511
|
-
window.location.href = href;
|
|
512
|
-
} else {
|
|
513
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
514
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
515
|
-
nextKeys.push(location.key);
|
|
516
|
-
allKeys = nextKeys;
|
|
517
|
-
setState({
|
|
518
|
-
action: action,
|
|
519
|
-
location: location
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
} else {
|
|
523
|
-
window.location.href = href;
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
function replace(path, state) {
|
|
528
|
-
var action = 'REPLACE';
|
|
529
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
530
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
531
|
-
if (!ok) return;
|
|
532
|
-
var href = createHref(location);
|
|
533
|
-
var key = location.key,
|
|
534
|
-
state = location.state;
|
|
535
|
-
if (canUseHistory) {
|
|
536
|
-
globalHistory.replaceState({
|
|
537
|
-
key: key,
|
|
538
|
-
state: state
|
|
539
|
-
}, null, href);
|
|
540
|
-
if (forceRefresh) {
|
|
541
|
-
window.location.replace(href);
|
|
542
|
-
} else {
|
|
543
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
544
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
545
|
-
setState({
|
|
546
|
-
action: action,
|
|
547
|
-
location: location
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
} else {
|
|
551
|
-
window.location.replace(href);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
function go(n) {
|
|
556
|
-
globalHistory.go(n);
|
|
557
|
-
}
|
|
558
|
-
function goBack() {
|
|
559
|
-
go(-1);
|
|
560
|
-
}
|
|
561
|
-
function goForward() {
|
|
562
|
-
go(1);
|
|
563
|
-
}
|
|
564
|
-
var listenerCount = 0;
|
|
565
|
-
function checkDOMListeners(delta) {
|
|
566
|
-
listenerCount += delta;
|
|
567
|
-
if (listenerCount === 1 && delta === 1) {
|
|
568
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
569
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
570
|
-
} else if (listenerCount === 0) {
|
|
571
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
572
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
var isBlocked = false;
|
|
576
|
-
function block(prompt) {
|
|
577
|
-
if (prompt === void 0) {
|
|
578
|
-
prompt = false;
|
|
579
|
-
}
|
|
580
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
581
|
-
if (!isBlocked) {
|
|
582
|
-
checkDOMListeners(1);
|
|
583
|
-
isBlocked = true;
|
|
584
|
-
}
|
|
585
|
-
return function () {
|
|
586
|
-
if (isBlocked) {
|
|
587
|
-
isBlocked = false;
|
|
588
|
-
checkDOMListeners(-1);
|
|
589
|
-
}
|
|
590
|
-
return unblock();
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function listen(listener) {
|
|
594
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
595
|
-
checkDOMListeners(1);
|
|
596
|
-
return function () {
|
|
597
|
-
checkDOMListeners(-1);
|
|
598
|
-
unlisten();
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
var history = {
|
|
602
|
-
length: globalHistory.length,
|
|
603
|
-
action: 'POP',
|
|
604
|
-
location: initialLocation,
|
|
605
|
-
createHref: createHref,
|
|
606
|
-
push: push,
|
|
607
|
-
replace: replace,
|
|
608
|
-
go: go,
|
|
609
|
-
goBack: goBack,
|
|
610
|
-
goForward: goForward,
|
|
611
|
-
block: block,
|
|
612
|
-
listen: listen
|
|
613
|
-
};
|
|
614
|
-
return history;
|
|
615
|
-
}
|
|
616
|
-
var HashChangeEvent$1 = 'hashchange';
|
|
617
|
-
var HashPathCoders = {
|
|
618
|
-
hashbang: {
|
|
619
|
-
encodePath: function encodePath(path) {
|
|
620
|
-
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
|
|
621
|
-
},
|
|
622
|
-
decodePath: function decodePath(path) {
|
|
623
|
-
return path.charAt(0) === '!' ? path.substr(1) : path;
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
noslash: {
|
|
627
|
-
encodePath: stripLeadingSlash,
|
|
628
|
-
decodePath: addLeadingSlash$1
|
|
629
|
-
},
|
|
630
|
-
slash: {
|
|
631
|
-
encodePath: addLeadingSlash$1,
|
|
632
|
-
decodePath: addLeadingSlash$1
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
function stripHash(url) {
|
|
636
|
-
var hashIndex = url.indexOf('#');
|
|
637
|
-
return hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
638
|
-
}
|
|
639
|
-
function getHashPath() {
|
|
640
|
-
// We can't use window.location.hash here because it's not
|
|
641
|
-
// consistent across browsers - Firefox will pre-decode it!
|
|
642
|
-
var href = window.location.href;
|
|
643
|
-
var hashIndex = href.indexOf('#');
|
|
644
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
|
645
|
-
}
|
|
646
|
-
function pushHashPath(path) {
|
|
647
|
-
window.location.hash = path;
|
|
648
|
-
}
|
|
649
|
-
function replaceHashPath(path) {
|
|
650
|
-
window.location.replace(stripHash(window.location.href) + '#' + path);
|
|
651
|
-
}
|
|
652
|
-
function createHashHistory(props) {
|
|
653
|
-
if (props === void 0) {
|
|
654
|
-
props = {};
|
|
655
|
-
}
|
|
656
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
657
|
-
var globalHistory = window.history;
|
|
658
|
-
supportsGoWithoutReloadUsingHash();
|
|
659
|
-
var _props = props,
|
|
660
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
661
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
662
|
-
_props$hashType = _props.hashType,
|
|
663
|
-
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
|
|
664
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
665
|
-
var _HashPathCoders$hashT = HashPathCoders[hashType],
|
|
666
|
-
encodePath = _HashPathCoders$hashT.encodePath,
|
|
667
|
-
decodePath = _HashPathCoders$hashT.decodePath;
|
|
668
|
-
function getDOMLocation() {
|
|
669
|
-
var path = decodePath(getHashPath());
|
|
670
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
671
|
-
return createLocation(path);
|
|
672
|
-
}
|
|
673
|
-
var transitionManager = createTransitionManager();
|
|
674
|
-
function setState(nextState) {
|
|
675
|
-
_extends$1(history, nextState);
|
|
676
|
-
history.length = globalHistory.length;
|
|
677
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
678
|
-
}
|
|
679
|
-
var forceNextPop = false;
|
|
680
|
-
var ignorePath = null;
|
|
681
|
-
function locationsAreEqual$$1(a, b) {
|
|
682
|
-
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
|
|
683
|
-
}
|
|
684
|
-
function handleHashChange() {
|
|
685
|
-
var path = getHashPath();
|
|
686
|
-
var encodedPath = encodePath(path);
|
|
687
|
-
if (path !== encodedPath) {
|
|
688
|
-
// Ensure we always have a properly-encoded hash.
|
|
689
|
-
replaceHashPath(encodedPath);
|
|
690
|
-
} else {
|
|
691
|
-
var location = getDOMLocation();
|
|
692
|
-
var prevLocation = history.location;
|
|
693
|
-
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
|
|
694
|
-
|
|
695
|
-
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
|
|
696
|
-
|
|
697
|
-
ignorePath = null;
|
|
698
|
-
handlePop(location);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
function handlePop(location) {
|
|
702
|
-
if (forceNextPop) {
|
|
703
|
-
forceNextPop = false;
|
|
704
|
-
setState();
|
|
705
|
-
} else {
|
|
706
|
-
var action = 'POP';
|
|
707
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
708
|
-
if (ok) {
|
|
709
|
-
setState({
|
|
710
|
-
action: action,
|
|
711
|
-
location: location
|
|
712
|
-
});
|
|
713
|
-
} else {
|
|
714
|
-
revertPop(location);
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
function revertPop(fromLocation) {
|
|
720
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
721
|
-
// keeping a list of paths we've seen in sessionStorage.
|
|
722
|
-
// Instead, we just default to 0 for paths we don't know.
|
|
723
|
-
|
|
724
|
-
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
|
725
|
-
if (toIndex === -1) toIndex = 0;
|
|
726
|
-
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
|
727
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
728
|
-
var delta = toIndex - fromIndex;
|
|
729
|
-
if (delta) {
|
|
730
|
-
forceNextPop = true;
|
|
731
|
-
go(delta);
|
|
732
|
-
}
|
|
733
|
-
} // Ensure the hash is encoded properly before doing anything else.
|
|
734
|
-
|
|
735
|
-
var path = getHashPath();
|
|
736
|
-
var encodedPath = encodePath(path);
|
|
737
|
-
if (path !== encodedPath) replaceHashPath(encodedPath);
|
|
738
|
-
var initialLocation = getDOMLocation();
|
|
739
|
-
var allPaths = [createPath(initialLocation)]; // Public interface
|
|
740
|
-
|
|
741
|
-
function createHref(location) {
|
|
742
|
-
var baseTag = document.querySelector('base');
|
|
743
|
-
var href = '';
|
|
744
|
-
if (baseTag && baseTag.getAttribute('href')) {
|
|
745
|
-
href = stripHash(window.location.href);
|
|
746
|
-
}
|
|
747
|
-
return href + '#' + encodePath(basename + createPath(location));
|
|
748
|
-
}
|
|
749
|
-
function push(path, state) {
|
|
750
|
-
var action = 'PUSH';
|
|
751
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
752
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
753
|
-
if (!ok) return;
|
|
754
|
-
var path = createPath(location);
|
|
755
|
-
var encodedPath = encodePath(basename + path);
|
|
756
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
757
|
-
if (hashChanged) {
|
|
758
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
|
759
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
760
|
-
// is that other hash histories in the page will consider it a POP.
|
|
761
|
-
ignorePath = path;
|
|
762
|
-
pushHashPath(encodedPath);
|
|
763
|
-
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
|
764
|
-
var nextPaths = allPaths.slice(0, prevIndex + 1);
|
|
765
|
-
nextPaths.push(path);
|
|
766
|
-
allPaths = nextPaths;
|
|
767
|
-
setState({
|
|
768
|
-
action: action,
|
|
769
|
-
location: location
|
|
770
|
-
});
|
|
771
|
-
} else {
|
|
772
|
-
setState();
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
function replace(path, state) {
|
|
777
|
-
var action = 'REPLACE';
|
|
778
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
779
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
780
|
-
if (!ok) return;
|
|
781
|
-
var path = createPath(location);
|
|
782
|
-
var encodedPath = encodePath(basename + path);
|
|
783
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
784
|
-
if (hashChanged) {
|
|
785
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
|
786
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
787
|
-
// is that other hash histories in the page will consider it a POP.
|
|
788
|
-
ignorePath = path;
|
|
789
|
-
replaceHashPath(encodedPath);
|
|
790
|
-
}
|
|
791
|
-
var prevIndex = allPaths.indexOf(createPath(history.location));
|
|
792
|
-
if (prevIndex !== -1) allPaths[prevIndex] = path;
|
|
793
|
-
setState({
|
|
794
|
-
action: action,
|
|
795
|
-
location: location
|
|
796
|
-
});
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
function go(n) {
|
|
800
|
-
globalHistory.go(n);
|
|
801
|
-
}
|
|
802
|
-
function goBack() {
|
|
803
|
-
go(-1);
|
|
804
|
-
}
|
|
805
|
-
function goForward() {
|
|
806
|
-
go(1);
|
|
807
|
-
}
|
|
808
|
-
var listenerCount = 0;
|
|
809
|
-
function checkDOMListeners(delta) {
|
|
810
|
-
listenerCount += delta;
|
|
811
|
-
if (listenerCount === 1 && delta === 1) {
|
|
812
|
-
window.addEventListener(HashChangeEvent$1, handleHashChange);
|
|
813
|
-
} else if (listenerCount === 0) {
|
|
814
|
-
window.removeEventListener(HashChangeEvent$1, handleHashChange);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
var isBlocked = false;
|
|
818
|
-
function block(prompt) {
|
|
819
|
-
if (prompt === void 0) {
|
|
820
|
-
prompt = false;
|
|
821
|
-
}
|
|
822
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
823
|
-
if (!isBlocked) {
|
|
824
|
-
checkDOMListeners(1);
|
|
825
|
-
isBlocked = true;
|
|
826
|
-
}
|
|
827
|
-
return function () {
|
|
828
|
-
if (isBlocked) {
|
|
829
|
-
isBlocked = false;
|
|
830
|
-
checkDOMListeners(-1);
|
|
831
|
-
}
|
|
832
|
-
return unblock();
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function listen(listener) {
|
|
836
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
837
|
-
checkDOMListeners(1);
|
|
838
|
-
return function () {
|
|
839
|
-
checkDOMListeners(-1);
|
|
840
|
-
unlisten();
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
var history = {
|
|
844
|
-
length: globalHistory.length,
|
|
845
|
-
action: 'POP',
|
|
846
|
-
location: initialLocation,
|
|
847
|
-
createHref: createHref,
|
|
848
|
-
push: push,
|
|
849
|
-
replace: replace,
|
|
850
|
-
go: go,
|
|
851
|
-
goBack: goBack,
|
|
852
|
-
goForward: goForward,
|
|
853
|
-
block: block,
|
|
854
|
-
listen: listen
|
|
855
|
-
};
|
|
856
|
-
return history;
|
|
857
|
-
}
|
|
858
|
-
function clamp(n, lowerBound, upperBound) {
|
|
859
|
-
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Creates a history object that stores locations in memory.
|
|
863
|
-
*/
|
|
864
|
-
|
|
865
|
-
function createMemoryHistory(props) {
|
|
866
|
-
if (props === void 0) {
|
|
867
|
-
props = {};
|
|
868
|
-
}
|
|
869
|
-
var _props = props,
|
|
870
|
-
getUserConfirmation = _props.getUserConfirmation,
|
|
871
|
-
_props$initialEntries = _props.initialEntries,
|
|
872
|
-
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
|
|
873
|
-
_props$initialIndex = _props.initialIndex,
|
|
874
|
-
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
875
|
-
_props$keyLength = _props.keyLength,
|
|
876
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
877
|
-
var transitionManager = createTransitionManager();
|
|
878
|
-
function setState(nextState) {
|
|
879
|
-
_extends$1(history, nextState);
|
|
880
|
-
history.length = history.entries.length;
|
|
881
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
882
|
-
}
|
|
883
|
-
function createKey() {
|
|
884
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
885
|
-
}
|
|
886
|
-
var index = clamp(initialIndex, 0, initialEntries.length - 1);
|
|
887
|
-
var entries = initialEntries.map(function (entry) {
|
|
888
|
-
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
|
|
889
|
-
}); // Public interface
|
|
890
|
-
|
|
891
|
-
var createHref = createPath;
|
|
892
|
-
function push(path, state) {
|
|
893
|
-
var action = 'PUSH';
|
|
894
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
895
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
896
|
-
if (!ok) return;
|
|
897
|
-
var prevIndex = history.index;
|
|
898
|
-
var nextIndex = prevIndex + 1;
|
|
899
|
-
var nextEntries = history.entries.slice(0);
|
|
900
|
-
if (nextEntries.length > nextIndex) {
|
|
901
|
-
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
|
|
902
|
-
} else {
|
|
903
|
-
nextEntries.push(location);
|
|
904
|
-
}
|
|
905
|
-
setState({
|
|
906
|
-
action: action,
|
|
907
|
-
location: location,
|
|
908
|
-
index: nextIndex,
|
|
909
|
-
entries: nextEntries
|
|
910
|
-
});
|
|
911
|
-
});
|
|
912
|
-
}
|
|
913
|
-
function replace(path, state) {
|
|
914
|
-
var action = 'REPLACE';
|
|
915
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
916
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
917
|
-
if (!ok) return;
|
|
918
|
-
history.entries[history.index] = location;
|
|
919
|
-
setState({
|
|
920
|
-
action: action,
|
|
921
|
-
location: location
|
|
922
|
-
});
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
function go(n) {
|
|
926
|
-
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
|
|
927
|
-
var action = 'POP';
|
|
928
|
-
var location = history.entries[nextIndex];
|
|
929
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
930
|
-
if (ok) {
|
|
931
|
-
setState({
|
|
932
|
-
action: action,
|
|
933
|
-
location: location,
|
|
934
|
-
index: nextIndex
|
|
935
|
-
});
|
|
936
|
-
} else {
|
|
937
|
-
// Mimic the behavior of DOM histories by
|
|
938
|
-
// causing a render after a cancelled POP.
|
|
939
|
-
setState();
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function goBack() {
|
|
944
|
-
go(-1);
|
|
945
|
-
}
|
|
946
|
-
function goForward() {
|
|
947
|
-
go(1);
|
|
948
|
-
}
|
|
949
|
-
function canGo(n) {
|
|
950
|
-
var nextIndex = history.index + n;
|
|
951
|
-
return nextIndex >= 0 && nextIndex < history.entries.length;
|
|
952
|
-
}
|
|
953
|
-
function block(prompt) {
|
|
954
|
-
if (prompt === void 0) {
|
|
955
|
-
prompt = false;
|
|
956
|
-
}
|
|
957
|
-
return transitionManager.setPrompt(prompt);
|
|
958
|
-
}
|
|
959
|
-
function listen(listener) {
|
|
960
|
-
return transitionManager.appendListener(listener);
|
|
961
|
-
}
|
|
962
|
-
var history = {
|
|
963
|
-
length: entries.length,
|
|
964
|
-
action: 'POP',
|
|
965
|
-
location: entries[index],
|
|
966
|
-
index: index,
|
|
967
|
-
entries: entries,
|
|
968
|
-
createHref: createHref,
|
|
969
|
-
push: push,
|
|
970
|
-
replace: replace,
|
|
971
|
-
go: go,
|
|
972
|
-
goBack: goBack,
|
|
973
|
-
goForward: goForward,
|
|
974
|
-
canGo: canGo,
|
|
975
|
-
block: block,
|
|
976
|
-
listen: listen
|
|
977
|
-
};
|
|
978
|
-
return history;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
function _setPrototypeOf(o, p) {
|
|
982
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
983
|
-
o.__proto__ = p;
|
|
984
|
-
return o;
|
|
985
|
-
};
|
|
986
|
-
return _setPrototypeOf(o, p);
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
function _inheritsLoose(subClass, superClass) {
|
|
990
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
991
|
-
subClass.prototype.constructor = subClass;
|
|
992
|
-
_setPrototypeOf(subClass, superClass);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
var MAX_SIGNED_31_BIT_INT = 1073741823;
|
|
996
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
997
|
-
function getUniqueId() {
|
|
998
|
-
var key = '__global_unique_id__';
|
|
999
|
-
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1000
|
-
}
|
|
1001
|
-
function objectIs(x, y) {
|
|
1002
|
-
if (x === y) {
|
|
1003
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1004
|
-
} else {
|
|
1005
|
-
return x !== x && y !== y;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
function createEventEmitter(value) {
|
|
1009
|
-
var handlers = [];
|
|
1010
|
-
return {
|
|
1011
|
-
on: function on(handler) {
|
|
1012
|
-
handlers.push(handler);
|
|
1013
|
-
},
|
|
1014
|
-
off: function off(handler) {
|
|
1015
|
-
handlers = handlers.filter(function (h) {
|
|
1016
|
-
return h !== handler;
|
|
1017
|
-
});
|
|
1018
|
-
},
|
|
1019
|
-
get: function get() {
|
|
1020
|
-
return value;
|
|
1021
|
-
},
|
|
1022
|
-
set: function set(newValue, changedBits) {
|
|
1023
|
-
value = newValue;
|
|
1024
|
-
handlers.forEach(function (handler) {
|
|
1025
|
-
return handler(value, changedBits);
|
|
1026
|
-
});
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
function onlyChild(children) {
|
|
1031
|
-
return Array.isArray(children) ? children[0] : children;
|
|
1032
|
-
}
|
|
1033
|
-
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1034
|
-
var _Provider$childContex, _Consumer$contextType;
|
|
1035
|
-
var contextProp = '__create-react-context-' + getUniqueId() + '__';
|
|
1036
|
-
var Provider = /*#__PURE__*/function (_Component) {
|
|
1037
|
-
_inheritsLoose(Provider, _Component);
|
|
1038
|
-
function Provider() {
|
|
1039
|
-
var _this;
|
|
1040
|
-
_this = _Component.apply(this, arguments) || this;
|
|
1041
|
-
_this.emitter = createEventEmitter(_this.props.value);
|
|
1042
|
-
return _this;
|
|
1043
|
-
}
|
|
1044
|
-
var _proto = Provider.prototype;
|
|
1045
|
-
_proto.getChildContext = function getChildContext() {
|
|
1046
|
-
var _ref;
|
|
1047
|
-
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1048
|
-
};
|
|
1049
|
-
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1050
|
-
if (this.props.value !== nextProps.value) {
|
|
1051
|
-
var oldValue = this.props.value;
|
|
1052
|
-
var newValue = nextProps.value;
|
|
1053
|
-
var changedBits;
|
|
1054
|
-
if (objectIs(oldValue, newValue)) {
|
|
1055
|
-
changedBits = 0;
|
|
1056
|
-
} else {
|
|
1057
|
-
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1058
|
-
changedBits |= 0;
|
|
1059
|
-
if (changedBits !== 0) {
|
|
1060
|
-
this.emitter.set(nextProps.value, changedBits);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
_proto.render = function render() {
|
|
1066
|
-
return this.props.children;
|
|
1067
|
-
};
|
|
1068
|
-
return Provider;
|
|
1069
|
-
}(Component);
|
|
1070
|
-
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = propTypes.exports.object.isRequired, _Provider$childContex);
|
|
1071
|
-
var Consumer = /*#__PURE__*/function (_Component2) {
|
|
1072
|
-
_inheritsLoose(Consumer, _Component2);
|
|
1073
|
-
function Consumer() {
|
|
1074
|
-
var _this2;
|
|
1075
|
-
_this2 = _Component2.apply(this, arguments) || this;
|
|
1076
|
-
_this2.state = {
|
|
1077
|
-
value: _this2.getValue()
|
|
1078
|
-
};
|
|
1079
|
-
_this2.onUpdate = function (newValue, changedBits) {
|
|
1080
|
-
var observedBits = _this2.observedBits | 0;
|
|
1081
|
-
if ((observedBits & changedBits) !== 0) {
|
|
1082
|
-
_this2.setState({
|
|
1083
|
-
value: _this2.getValue()
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
return _this2;
|
|
1088
|
-
}
|
|
1089
|
-
var _proto2 = Consumer.prototype;
|
|
1090
|
-
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1091
|
-
var observedBits = nextProps.observedBits;
|
|
1092
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1093
|
-
};
|
|
1094
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
1095
|
-
if (this.context[contextProp]) {
|
|
1096
|
-
this.context[contextProp].on(this.onUpdate);
|
|
1097
|
-
}
|
|
1098
|
-
var observedBits = this.props.observedBits;
|
|
1099
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1100
|
-
};
|
|
1101
|
-
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1102
|
-
if (this.context[contextProp]) {
|
|
1103
|
-
this.context[contextProp].off(this.onUpdate);
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
_proto2.getValue = function getValue() {
|
|
1107
|
-
if (this.context[contextProp]) {
|
|
1108
|
-
return this.context[contextProp].get();
|
|
1109
|
-
} else {
|
|
1110
|
-
return defaultValue;
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
_proto2.render = function render() {
|
|
1114
|
-
return onlyChild(this.props.children)(this.state.value);
|
|
1115
|
-
};
|
|
1116
|
-
return Consumer;
|
|
1117
|
-
}(Component);
|
|
1118
|
-
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = propTypes.exports.object, _Consumer$contextType);
|
|
1119
|
-
return {
|
|
1120
|
-
Provider: Provider,
|
|
1121
|
-
Consumer: Consumer
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
var index = React.createContext || createReactContext;
|
|
1125
|
-
|
|
1126
|
-
function _extends() {
|
|
1127
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1128
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1129
|
-
var source = arguments[i];
|
|
1130
|
-
for (var key in source) {
|
|
1131
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1132
|
-
target[key] = source[key];
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return target;
|
|
1137
|
-
};
|
|
1138
|
-
return _extends.apply(this, arguments);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
var pathToRegexp$1 = {exports: {}};
|
|
1142
|
-
|
|
1143
|
-
var isarray$1 = Array.isArray || function (arr) {
|
|
1144
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
var isarray = isarray$1;
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Expose `pathToRegexp`.
|
|
1151
|
-
*/
|
|
1152
|
-
pathToRegexp$1.exports = pathToRegexp;
|
|
1153
|
-
pathToRegexp$1.exports.parse = parse;
|
|
1154
|
-
pathToRegexp$1.exports.compile = compile;
|
|
1155
|
-
pathToRegexp$1.exports.tokensToFunction = tokensToFunction;
|
|
1156
|
-
pathToRegexp$1.exports.tokensToRegExp = tokensToRegExp;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* The main path matching regexp utility.
|
|
1160
|
-
*
|
|
1161
|
-
* @type {RegExp}
|
|
1162
|
-
*/
|
|
1163
|
-
var PATH_REGEXP = new RegExp([
|
|
1164
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
1165
|
-
// This allows the user to escape special characters that won't transform.
|
|
1166
|
-
'(\\\\.)',
|
|
1167
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
1168
|
-
// and optional suffixes. Matches appear as:
|
|
1169
|
-
//
|
|
1170
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
1171
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
1172
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
1173
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');
|
|
1174
|
-
|
|
1175
|
-
/**
|
|
1176
|
-
* Parse a string for the raw tokens.
|
|
1177
|
-
*
|
|
1178
|
-
* @param {string} str
|
|
1179
|
-
* @param {Object=} options
|
|
1180
|
-
* @return {!Array}
|
|
1181
|
-
*/
|
|
1182
|
-
function parse(str, options) {
|
|
1183
|
-
var tokens = [];
|
|
1184
|
-
var key = 0;
|
|
1185
|
-
var index = 0;
|
|
1186
|
-
var path = '';
|
|
1187
|
-
var defaultDelimiter = options && options.delimiter || '/';
|
|
1188
|
-
var res;
|
|
1189
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
1190
|
-
var m = res[0];
|
|
1191
|
-
var escaped = res[1];
|
|
1192
|
-
var offset = res.index;
|
|
1193
|
-
path += str.slice(index, offset);
|
|
1194
|
-
index = offset + m.length;
|
|
1195
|
-
|
|
1196
|
-
// Ignore already escaped sequences.
|
|
1197
|
-
if (escaped) {
|
|
1198
|
-
path += escaped[1];
|
|
1199
|
-
continue;
|
|
1200
|
-
}
|
|
1201
|
-
var next = str[index];
|
|
1202
|
-
var prefix = res[2];
|
|
1203
|
-
var name = res[3];
|
|
1204
|
-
var capture = res[4];
|
|
1205
|
-
var group = res[5];
|
|
1206
|
-
var modifier = res[6];
|
|
1207
|
-
var asterisk = res[7];
|
|
1208
|
-
|
|
1209
|
-
// Push the current path onto the tokens.
|
|
1210
|
-
if (path) {
|
|
1211
|
-
tokens.push(path);
|
|
1212
|
-
path = '';
|
|
1213
|
-
}
|
|
1214
|
-
var partial = prefix != null && next != null && next !== prefix;
|
|
1215
|
-
var repeat = modifier === '+' || modifier === '*';
|
|
1216
|
-
var optional = modifier === '?' || modifier === '*';
|
|
1217
|
-
var delimiter = res[2] || defaultDelimiter;
|
|
1218
|
-
var pattern = capture || group;
|
|
1219
|
-
tokens.push({
|
|
1220
|
-
name: name || key++,
|
|
1221
|
-
prefix: prefix || '',
|
|
1222
|
-
delimiter: delimiter,
|
|
1223
|
-
optional: optional,
|
|
1224
|
-
repeat: repeat,
|
|
1225
|
-
partial: partial,
|
|
1226
|
-
asterisk: !!asterisk,
|
|
1227
|
-
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
// Match any characters still remaining.
|
|
1232
|
-
if (index < str.length) {
|
|
1233
|
-
path += str.substr(index);
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
// If the path exists, push it onto the end.
|
|
1237
|
-
if (path) {
|
|
1238
|
-
tokens.push(path);
|
|
1239
|
-
}
|
|
1240
|
-
return tokens;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
/**
|
|
1244
|
-
* Compile a string to a template function for the path.
|
|
1245
|
-
*
|
|
1246
|
-
* @param {string} str
|
|
1247
|
-
* @param {Object=} options
|
|
1248
|
-
* @return {!function(Object=, Object=)}
|
|
1249
|
-
*/
|
|
1250
|
-
function compile(str, options) {
|
|
1251
|
-
return tokensToFunction(parse(str, options), options);
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* Prettier encoding of URI path segments.
|
|
1256
|
-
*
|
|
1257
|
-
* @param {string}
|
|
1258
|
-
* @return {string}
|
|
1259
|
-
*/
|
|
1260
|
-
function encodeURIComponentPretty(str) {
|
|
1261
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
1262
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
1268
|
-
*
|
|
1269
|
-
* @param {string}
|
|
1270
|
-
* @return {string}
|
|
1271
|
-
*/
|
|
1272
|
-
function encodeAsterisk(str) {
|
|
1273
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
1274
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
* Expose a method for transforming tokens into the path function.
|
|
1280
|
-
*/
|
|
1281
|
-
function tokensToFunction(tokens, options) {
|
|
1282
|
-
// Compile all the tokens into regexps.
|
|
1283
|
-
var matches = new Array(tokens.length);
|
|
1284
|
-
|
|
1285
|
-
// Compile all the patterns before compilation.
|
|
1286
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1287
|
-
if (_typeof$1(tokens[i]) === 'object') {
|
|
1288
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
return function (obj, opts) {
|
|
1292
|
-
var path = '';
|
|
1293
|
-
var data = obj || {};
|
|
1294
|
-
var options = opts || {};
|
|
1295
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
|
|
1296
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1297
|
-
var token = tokens[i];
|
|
1298
|
-
if (typeof token === 'string') {
|
|
1299
|
-
path += token;
|
|
1300
|
-
continue;
|
|
1301
|
-
}
|
|
1302
|
-
var value = data[token.name];
|
|
1303
|
-
var segment;
|
|
1304
|
-
if (value == null) {
|
|
1305
|
-
if (token.optional) {
|
|
1306
|
-
// Prepend partial segment prefixes.
|
|
1307
|
-
if (token.partial) {
|
|
1308
|
-
path += token.prefix;
|
|
1309
|
-
}
|
|
1310
|
-
continue;
|
|
1311
|
-
} else {
|
|
1312
|
-
throw new TypeError('Expected "' + token.name + '" to be defined');
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (isarray(value)) {
|
|
1316
|
-
if (!token.repeat) {
|
|
1317
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`');
|
|
1318
|
-
}
|
|
1319
|
-
if (value.length === 0) {
|
|
1320
|
-
if (token.optional) {
|
|
1321
|
-
continue;
|
|
1322
|
-
} else {
|
|
1323
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty');
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
for (var j = 0; j < value.length; j++) {
|
|
1327
|
-
segment = encode(value[j]);
|
|
1328
|
-
if (!matches[i].test(segment)) {
|
|
1329
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`');
|
|
1330
|
-
}
|
|
1331
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
1332
|
-
}
|
|
1333
|
-
continue;
|
|
1334
|
-
}
|
|
1335
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
|
1336
|
-
if (!matches[i].test(segment)) {
|
|
1337
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"');
|
|
1338
|
-
}
|
|
1339
|
-
path += token.prefix + segment;
|
|
1340
|
-
}
|
|
1341
|
-
return path;
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Escape a regular expression string.
|
|
1347
|
-
*
|
|
1348
|
-
* @param {string} str
|
|
1349
|
-
* @return {string}
|
|
1350
|
-
*/
|
|
1351
|
-
function escapeString(str) {
|
|
1352
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
1357
|
-
*
|
|
1358
|
-
* @param {string} group
|
|
1359
|
-
* @return {string}
|
|
1360
|
-
*/
|
|
1361
|
-
function escapeGroup(group) {
|
|
1362
|
-
return group.replace(/([=!:$\/()])/g, '\\$1');
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
/**
|
|
1366
|
-
* Attach the keys as a property of the regexp.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {!RegExp} re
|
|
1369
|
-
* @param {Array} keys
|
|
1370
|
-
* @return {!RegExp}
|
|
1371
|
-
*/
|
|
1372
|
-
function attachKeys(re, keys) {
|
|
1373
|
-
re.keys = keys;
|
|
1374
|
-
return re;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
/**
|
|
1378
|
-
* Get the flags for a regexp from the options.
|
|
1379
|
-
*
|
|
1380
|
-
* @param {Object} options
|
|
1381
|
-
* @return {string}
|
|
1382
|
-
*/
|
|
1383
|
-
function flags(options) {
|
|
1384
|
-
return options && options.sensitive ? '' : 'i';
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
/**
|
|
1388
|
-
* Pull out keys from a regexp.
|
|
1389
|
-
*
|
|
1390
|
-
* @param {!RegExp} path
|
|
1391
|
-
* @param {!Array} keys
|
|
1392
|
-
* @return {!RegExp}
|
|
1393
|
-
*/
|
|
1394
|
-
function regexpToRegexp(path, keys) {
|
|
1395
|
-
// Use a negative lookahead to match only capturing groups.
|
|
1396
|
-
var groups = path.source.match(/\((?!\?)/g);
|
|
1397
|
-
if (groups) {
|
|
1398
|
-
for (var i = 0; i < groups.length; i++) {
|
|
1399
|
-
keys.push({
|
|
1400
|
-
name: i,
|
|
1401
|
-
prefix: null,
|
|
1402
|
-
delimiter: null,
|
|
1403
|
-
optional: false,
|
|
1404
|
-
repeat: false,
|
|
1405
|
-
partial: false,
|
|
1406
|
-
asterisk: false,
|
|
1407
|
-
pattern: null
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
return attachKeys(path, keys);
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
/**
|
|
1415
|
-
* Transform an array into a regexp.
|
|
1416
|
-
*
|
|
1417
|
-
* @param {!Array} path
|
|
1418
|
-
* @param {Array} keys
|
|
1419
|
-
* @param {!Object} options
|
|
1420
|
-
* @return {!RegExp}
|
|
1421
|
-
*/
|
|
1422
|
-
function arrayToRegexp(path, keys, options) {
|
|
1423
|
-
var parts = [];
|
|
1424
|
-
for (var i = 0; i < path.length; i++) {
|
|
1425
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
|
1426
|
-
}
|
|
1427
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
1428
|
-
return attachKeys(regexp, keys);
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
/**
|
|
1432
|
-
* Create a path regexp from string input.
|
|
1433
|
-
*
|
|
1434
|
-
* @param {string} path
|
|
1435
|
-
* @param {!Array} keys
|
|
1436
|
-
* @param {!Object} options
|
|
1437
|
-
* @return {!RegExp}
|
|
1438
|
-
*/
|
|
1439
|
-
function stringToRegexp(path, keys, options) {
|
|
1440
|
-
return tokensToRegExp(parse(path, options), keys, options);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
/**
|
|
1444
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
1445
|
-
*
|
|
1446
|
-
* @param {!Array} tokens
|
|
1447
|
-
* @param {(Array|Object)=} keys
|
|
1448
|
-
* @param {Object=} options
|
|
1449
|
-
* @return {!RegExp}
|
|
1450
|
-
*/
|
|
1451
|
-
function tokensToRegExp(tokens, keys, options) {
|
|
1452
|
-
if (!isarray(keys)) {
|
|
1453
|
-
options = /** @type {!Object} */keys || options;
|
|
1454
|
-
keys = [];
|
|
1455
|
-
}
|
|
1456
|
-
options = options || {};
|
|
1457
|
-
var strict = options.strict;
|
|
1458
|
-
var end = options.end !== false;
|
|
1459
|
-
var route = '';
|
|
1460
|
-
|
|
1461
|
-
// Iterate over the tokens and create our regexp string.
|
|
1462
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1463
|
-
var token = tokens[i];
|
|
1464
|
-
if (typeof token === 'string') {
|
|
1465
|
-
route += escapeString(token);
|
|
1466
|
-
} else {
|
|
1467
|
-
var prefix = escapeString(token.prefix);
|
|
1468
|
-
var capture = '(?:' + token.pattern + ')';
|
|
1469
|
-
keys.push(token);
|
|
1470
|
-
if (token.repeat) {
|
|
1471
|
-
capture += '(?:' + prefix + capture + ')*';
|
|
1472
|
-
}
|
|
1473
|
-
if (token.optional) {
|
|
1474
|
-
if (!token.partial) {
|
|
1475
|
-
capture = '(?:' + prefix + '(' + capture + '))?';
|
|
1476
|
-
} else {
|
|
1477
|
-
capture = prefix + '(' + capture + ')?';
|
|
1478
|
-
}
|
|
1479
|
-
} else {
|
|
1480
|
-
capture = prefix + '(' + capture + ')';
|
|
1481
|
-
}
|
|
1482
|
-
route += capture;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
var delimiter = escapeString(options.delimiter || '/');
|
|
1486
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
|
|
1487
|
-
|
|
1488
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
1489
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
|
1490
|
-
// is valid at the end of a path match, not in the middle. This is important
|
|
1491
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
1492
|
-
if (!strict) {
|
|
1493
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
|
|
1494
|
-
}
|
|
1495
|
-
if (end) {
|
|
1496
|
-
route += '$';
|
|
1497
|
-
} else {
|
|
1498
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
|
1499
|
-
// possible by using a positive lookahead to the end or next path segment.
|
|
1500
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
|
1501
|
-
}
|
|
1502
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys);
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* Normalize the given path string, returning a regular expression.
|
|
1507
|
-
*
|
|
1508
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
1509
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
1510
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
1511
|
-
*
|
|
1512
|
-
* @param {(string|RegExp|Array)} path
|
|
1513
|
-
* @param {(Array|Object)=} keys
|
|
1514
|
-
* @param {Object=} options
|
|
1515
|
-
* @return {!RegExp}
|
|
1516
|
-
*/
|
|
1517
|
-
function pathToRegexp(path, keys, options) {
|
|
1518
|
-
if (!isarray(keys)) {
|
|
1519
|
-
options = /** @type {!Object} */keys || options;
|
|
1520
|
-
keys = [];
|
|
1521
|
-
}
|
|
1522
|
-
options = options || {};
|
|
1523
|
-
if (path instanceof RegExp) {
|
|
1524
|
-
return regexpToRegexp(path, /** @type {!Array} */keys);
|
|
1525
|
-
}
|
|
1526
|
-
if (isarray(path)) {
|
|
1527
|
-
return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options);
|
|
1528
|
-
}
|
|
1529
|
-
return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options);
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
var reactIs$1 = {exports: {}};
|
|
1533
|
-
|
|
1534
|
-
var reactIs_production_min = {};
|
|
1535
|
-
|
|
1536
|
-
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1537
|
-
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1538
|
-
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1539
|
-
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1540
|
-
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1541
|
-
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1542
|
-
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1543
|
-
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1544
|
-
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1545
|
-
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1546
|
-
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1547
|
-
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1548
|
-
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1549
|
-
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1550
|
-
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1551
|
-
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1552
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1553
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1554
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1555
|
-
function z(a) {
|
|
1556
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1557
|
-
var u = a.$$typeof;
|
|
1558
|
-
switch (u) {
|
|
1559
|
-
case c:
|
|
1560
|
-
switch (a = a.type, a) {
|
|
1561
|
-
case l:
|
|
1562
|
-
case m:
|
|
1563
|
-
case e:
|
|
1564
|
-
case g:
|
|
1565
|
-
case f:
|
|
1566
|
-
case p:
|
|
1567
|
-
return a;
|
|
1568
|
-
default:
|
|
1569
|
-
switch (a = a && a.$$typeof, a) {
|
|
1570
|
-
case k:
|
|
1571
|
-
case n:
|
|
1572
|
-
case t:
|
|
1573
|
-
case r:
|
|
1574
|
-
case h:
|
|
1575
|
-
return a;
|
|
1576
|
-
default:
|
|
1577
|
-
return u;
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
case d:
|
|
1581
|
-
return u;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
function A(a) {
|
|
1586
|
-
return z(a) === m;
|
|
1587
|
-
}
|
|
1588
|
-
reactIs_production_min.AsyncMode = l;
|
|
1589
|
-
reactIs_production_min.ConcurrentMode = m;
|
|
1590
|
-
reactIs_production_min.ContextConsumer = k;
|
|
1591
|
-
reactIs_production_min.ContextProvider = h;
|
|
1592
|
-
reactIs_production_min.Element = c;
|
|
1593
|
-
reactIs_production_min.ForwardRef = n;
|
|
1594
|
-
reactIs_production_min.Fragment = e;
|
|
1595
|
-
reactIs_production_min.Lazy = t;
|
|
1596
|
-
reactIs_production_min.Memo = r;
|
|
1597
|
-
reactIs_production_min.Portal = d;
|
|
1598
|
-
reactIs_production_min.Profiler = g;
|
|
1599
|
-
reactIs_production_min.StrictMode = f;
|
|
1600
|
-
reactIs_production_min.Suspense = p;
|
|
1601
|
-
reactIs_production_min.isAsyncMode = function (a) {
|
|
1602
|
-
return A(a) || z(a) === l;
|
|
1603
|
-
};
|
|
1604
|
-
reactIs_production_min.isConcurrentMode = A;
|
|
1605
|
-
reactIs_production_min.isContextConsumer = function (a) {
|
|
1606
|
-
return z(a) === k;
|
|
1607
|
-
};
|
|
1608
|
-
reactIs_production_min.isContextProvider = function (a) {
|
|
1609
|
-
return z(a) === h;
|
|
1610
|
-
};
|
|
1611
|
-
reactIs_production_min.isElement = function (a) {
|
|
1612
|
-
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
1613
|
-
};
|
|
1614
|
-
reactIs_production_min.isForwardRef = function (a) {
|
|
1615
|
-
return z(a) === n;
|
|
1616
|
-
};
|
|
1617
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1618
|
-
return z(a) === e;
|
|
1619
|
-
};
|
|
1620
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1621
|
-
return z(a) === t;
|
|
1622
|
-
};
|
|
1623
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1624
|
-
return z(a) === r;
|
|
1625
|
-
};
|
|
1626
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1627
|
-
return z(a) === d;
|
|
1628
|
-
};
|
|
1629
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1630
|
-
return z(a) === g;
|
|
1631
|
-
};
|
|
1632
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1633
|
-
return z(a) === f;
|
|
1634
|
-
};
|
|
1635
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1636
|
-
return z(a) === p;
|
|
1637
|
-
};
|
|
1638
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1639
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof$1(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
1640
|
-
};
|
|
1641
|
-
reactIs_production_min.typeOf = z;
|
|
1642
|
-
|
|
1643
|
-
(function (module) {
|
|
1644
|
-
|
|
1645
|
-
{
|
|
1646
|
-
module.exports = reactIs_production_min;
|
|
1647
|
-
}
|
|
1648
|
-
})(reactIs$1);
|
|
1649
|
-
|
|
1650
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1651
|
-
if (source == null) return {};
|
|
1652
|
-
var target = {};
|
|
1653
|
-
var sourceKeys = Object.keys(source);
|
|
1654
|
-
var key, i;
|
|
1655
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1656
|
-
key = sourceKeys[i];
|
|
1657
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1658
|
-
target[key] = source[key];
|
|
1659
|
-
}
|
|
1660
|
-
return target;
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
var reactIs = reactIs$1.exports;
|
|
1664
|
-
var FORWARD_REF_STATICS = {
|
|
1665
|
-
'$$typeof': true,
|
|
1666
|
-
render: true,
|
|
1667
|
-
defaultProps: true,
|
|
1668
|
-
displayName: true,
|
|
1669
|
-
propTypes: true
|
|
1670
|
-
};
|
|
1671
|
-
var MEMO_STATICS = {
|
|
1672
|
-
'$$typeof': true,
|
|
1673
|
-
compare: true,
|
|
1674
|
-
defaultProps: true,
|
|
1675
|
-
displayName: true,
|
|
1676
|
-
propTypes: true,
|
|
1677
|
-
type: true
|
|
1678
|
-
};
|
|
1679
|
-
var TYPE_STATICS = {};
|
|
1680
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
1681
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
1682
|
-
|
|
1683
|
-
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1684
|
-
|
|
1685
|
-
var createNamedContext = function createNamedContext(name) {
|
|
1686
|
-
var context = index();
|
|
1687
|
-
context.displayName = name;
|
|
1688
|
-
return context;
|
|
1689
|
-
};
|
|
1690
|
-
var historyContext = /*#__PURE__*/createNamedContext("Router-History");
|
|
1691
|
-
var context = /*#__PURE__*/createNamedContext("Router");
|
|
1692
|
-
|
|
1693
|
-
/**
|
|
1694
|
-
* The public API for putting history on context.
|
|
1695
|
-
*/
|
|
1696
|
-
|
|
1697
|
-
var Router = /*#__PURE__*/function (_React$Component) {
|
|
1698
|
-
_inheritsLoose$1(Router, _React$Component);
|
|
1699
|
-
Router.computeRootMatch = function computeRootMatch(pathname) {
|
|
1700
|
-
return {
|
|
1701
|
-
path: "/",
|
|
1702
|
-
url: "/",
|
|
1703
|
-
params: {},
|
|
1704
|
-
isExact: pathname === "/"
|
|
1705
|
-
};
|
|
1706
|
-
};
|
|
1707
|
-
function Router(props) {
|
|
1708
|
-
var _this;
|
|
1709
|
-
_this = _React$Component.call(this, props) || this;
|
|
1710
|
-
_this.state = {
|
|
1711
|
-
location: props.history.location
|
|
1712
|
-
}; // This is a bit of a hack. We have to start listening for location
|
|
1713
|
-
// changes here in the constructor in case there are any <Redirect>s
|
|
1714
|
-
// on the initial render. If there are, they will replace/push when
|
|
1715
|
-
// they mount and since cDM fires in children before parents, we may
|
|
1716
|
-
// get a new location before the <Router> is mounted.
|
|
1717
|
-
|
|
1718
|
-
_this._isMounted = false;
|
|
1719
|
-
_this._pendingLocation = null;
|
|
1720
|
-
if (!props.staticContext) {
|
|
1721
|
-
_this.unlisten = props.history.listen(function (location) {
|
|
1722
|
-
_this._pendingLocation = location;
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
return _this;
|
|
1726
|
-
}
|
|
1727
|
-
var _proto = Router.prototype;
|
|
1728
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1729
|
-
var _this2 = this;
|
|
1730
|
-
this._isMounted = true;
|
|
1731
|
-
if (this.unlisten) {
|
|
1732
|
-
// Any pre-mount location changes have been captured at
|
|
1733
|
-
// this point, so unregister the listener.
|
|
1734
|
-
this.unlisten();
|
|
1735
|
-
}
|
|
1736
|
-
if (!this.props.staticContext) {
|
|
1737
|
-
this.unlisten = this.props.history.listen(function (location) {
|
|
1738
|
-
if (_this2._isMounted) {
|
|
1739
|
-
_this2.setState({
|
|
1740
|
-
location: location
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
if (this._pendingLocation) {
|
|
1746
|
-
this.setState({
|
|
1747
|
-
location: this._pendingLocation
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1752
|
-
if (this.unlisten) {
|
|
1753
|
-
this.unlisten();
|
|
1754
|
-
this._isMounted = false;
|
|
1755
|
-
this._pendingLocation = null;
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
_proto.render = function render() {
|
|
1759
|
-
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
1760
|
-
value: {
|
|
1761
|
-
history: this.props.history,
|
|
1762
|
-
location: this.state.location,
|
|
1763
|
-
match: Router.computeRootMatch(this.state.location.pathname),
|
|
1764
|
-
staticContext: this.props.staticContext
|
|
1765
|
-
}
|
|
1766
|
-
}, /*#__PURE__*/React.createElement(historyContext.Provider, {
|
|
1767
|
-
children: this.props.children || null,
|
|
1768
|
-
value: this.props.history
|
|
1769
|
-
}));
|
|
1770
|
-
};
|
|
1771
|
-
return Router;
|
|
1772
|
-
}(React.Component);
|
|
1773
|
-
|
|
1774
|
-
/**
|
|
1775
|
-
* The public API for a <Router> that stores location in memory.
|
|
1776
|
-
*/
|
|
1777
|
-
|
|
1778
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1779
|
-
_inheritsLoose$1(MemoryRouter, _React$Component);
|
|
1780
|
-
function MemoryRouter() {
|
|
1781
|
-
var _this;
|
|
1782
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1783
|
-
args[_key] = arguments[_key];
|
|
1784
|
-
}
|
|
1785
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
1786
|
-
_this.history = createMemoryHistory(_this.props);
|
|
1787
|
-
return _this;
|
|
1788
|
-
}
|
|
1789
|
-
var _proto = MemoryRouter.prototype;
|
|
1790
|
-
_proto.render = function render() {
|
|
1791
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
1792
|
-
history: this.history,
|
|
1793
|
-
children: this.props.children
|
|
1794
|
-
});
|
|
1795
|
-
};
|
|
1796
|
-
return MemoryRouter;
|
|
1797
|
-
})(React.Component);
|
|
1798
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1799
|
-
_inheritsLoose$1(Lifecycle, _React$Component);
|
|
1800
|
-
function Lifecycle() {
|
|
1801
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1802
|
-
}
|
|
1803
|
-
var _proto = Lifecycle.prototype;
|
|
1804
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1805
|
-
if (this.props.onMount) this.props.onMount.call(this, this);
|
|
1806
|
-
};
|
|
1807
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1808
|
-
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
|
|
1809
|
-
};
|
|
1810
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1811
|
-
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
|
|
1812
|
-
};
|
|
1813
|
-
_proto.render = function render() {
|
|
1814
|
-
return null;
|
|
1815
|
-
};
|
|
1816
|
-
return Lifecycle;
|
|
1817
|
-
})(React.Component);
|
|
1818
|
-
var cache$1 = {};
|
|
1819
|
-
var cacheLimit$1 = 10000;
|
|
1820
|
-
var cacheCount$1 = 0;
|
|
1821
|
-
function compilePath$1(path, options) {
|
|
1822
|
-
var cacheKey = "" + options.end + options.strict + options.sensitive;
|
|
1823
|
-
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
|
|
1824
|
-
if (pathCache[path]) return pathCache[path];
|
|
1825
|
-
var keys = [];
|
|
1826
|
-
var regexp = pathToRegexp$1.exports(path, keys, options);
|
|
1827
|
-
var result = {
|
|
1828
|
-
regexp: regexp,
|
|
1829
|
-
keys: keys
|
|
1830
|
-
};
|
|
1831
|
-
if (cacheCount$1 < cacheLimit$1) {
|
|
1832
|
-
pathCache[path] = result;
|
|
1833
|
-
cacheCount$1++;
|
|
1834
|
-
}
|
|
1835
|
-
return result;
|
|
1836
|
-
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Public API for matching a URL pathname to a path.
|
|
1839
|
-
*/
|
|
1840
|
-
|
|
1841
|
-
function matchPath(pathname, options) {
|
|
1842
|
-
if (options === void 0) {
|
|
1843
|
-
options = {};
|
|
1844
|
-
}
|
|
1845
|
-
if (typeof options === "string" || Array.isArray(options)) {
|
|
1846
|
-
options = {
|
|
1847
|
-
path: options
|
|
1848
|
-
};
|
|
1849
|
-
}
|
|
1850
|
-
var _options = options,
|
|
1851
|
-
path = _options.path,
|
|
1852
|
-
_options$exact = _options.exact,
|
|
1853
|
-
exact = _options$exact === void 0 ? false : _options$exact,
|
|
1854
|
-
_options$strict = _options.strict,
|
|
1855
|
-
strict = _options$strict === void 0 ? false : _options$strict,
|
|
1856
|
-
_options$sensitive = _options.sensitive,
|
|
1857
|
-
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
1858
|
-
var paths = [].concat(path);
|
|
1859
|
-
return paths.reduce(function (matched, path) {
|
|
1860
|
-
if (!path && path !== "") return null;
|
|
1861
|
-
if (matched) return matched;
|
|
1862
|
-
var _compilePath = compilePath$1(path, {
|
|
1863
|
-
end: exact,
|
|
1864
|
-
strict: strict,
|
|
1865
|
-
sensitive: sensitive
|
|
1866
|
-
}),
|
|
1867
|
-
regexp = _compilePath.regexp,
|
|
1868
|
-
keys = _compilePath.keys;
|
|
1869
|
-
var match = regexp.exec(pathname);
|
|
1870
|
-
if (!match) return null;
|
|
1871
|
-
var url = match[0],
|
|
1872
|
-
values = match.slice(1);
|
|
1873
|
-
var isExact = pathname === url;
|
|
1874
|
-
if (exact && !isExact) return null;
|
|
1875
|
-
return {
|
|
1876
|
-
path: path,
|
|
1877
|
-
// the path used to match
|
|
1878
|
-
url: path === "/" && url === "" ? "/" : url,
|
|
1879
|
-
// the matched portion of the URL
|
|
1880
|
-
isExact: isExact,
|
|
1881
|
-
// whether or not we matched exactly
|
|
1882
|
-
params: keys.reduce(function (memo, key, index) {
|
|
1883
|
-
memo[key.name] = values[index];
|
|
1884
|
-
return memo;
|
|
1885
|
-
}, {})
|
|
1886
|
-
};
|
|
1887
|
-
}, null);
|
|
1888
|
-
}
|
|
1889
|
-
function isEmptyChildren(children) {
|
|
1890
|
-
return React.Children.count(children) === 0;
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* The public API for matching a single path and rendering.
|
|
1894
|
-
*/
|
|
1895
|
-
|
|
1896
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1897
|
-
_inheritsLoose$1(Route, _React$Component);
|
|
1898
|
-
function Route() {
|
|
1899
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1900
|
-
}
|
|
1901
|
-
var _proto = Route.prototype;
|
|
1902
|
-
_proto.render = function render() {
|
|
1903
|
-
var _this = this;
|
|
1904
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context$1) {
|
|
1905
|
-
!context$1 ? invariant(false) : void 0;
|
|
1906
|
-
var location = _this.props.location || context$1.location;
|
|
1907
|
-
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
1908
|
-
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
|
|
1909
|
-
var props = _extends({}, context$1, {
|
|
1910
|
-
location: location,
|
|
1911
|
-
match: match
|
|
1912
|
-
});
|
|
1913
|
-
var _this$props = _this.props,
|
|
1914
|
-
children = _this$props.children,
|
|
1915
|
-
component = _this$props.component,
|
|
1916
|
-
render = _this$props.render; // Preact uses an empty array as children by
|
|
1917
|
-
// default, so use null if that's the case.
|
|
1918
|
-
|
|
1919
|
-
if (Array.isArray(children) && isEmptyChildren(children)) {
|
|
1920
|
-
children = null;
|
|
1921
|
-
}
|
|
1922
|
-
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
1923
|
-
value: props
|
|
1924
|
-
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /*#__PURE__*/React.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? children(props) : null);
|
|
1925
|
-
});
|
|
1926
|
-
};
|
|
1927
|
-
return Route;
|
|
1928
|
-
})(React.Component);
|
|
1929
|
-
function addLeadingSlash(path) {
|
|
1930
|
-
return path.charAt(0) === "/" ? path : "/" + path;
|
|
1931
|
-
}
|
|
1932
|
-
function addBasename(basename, location) {
|
|
1933
|
-
if (!basename) return location;
|
|
1934
|
-
return _extends({}, location, {
|
|
1935
|
-
pathname: addLeadingSlash(basename) + location.pathname
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
function stripBasename(basename, location) {
|
|
1939
|
-
if (!basename) return location;
|
|
1940
|
-
var base = addLeadingSlash(basename);
|
|
1941
|
-
if (location.pathname.indexOf(base) !== 0) return location;
|
|
1942
|
-
return _extends({}, location, {
|
|
1943
|
-
pathname: location.pathname.substr(base.length)
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
function createURL(location) {
|
|
1947
|
-
return typeof location === "string" ? location : createPath(location);
|
|
1948
|
-
}
|
|
1949
|
-
function staticHandler(methodName) {
|
|
1950
|
-
return function () {
|
|
1951
|
-
invariant(false);
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1954
|
-
function noop() {}
|
|
1955
|
-
/**
|
|
1956
|
-
* The public top-level API for a "static" <Router>, so-called because it
|
|
1957
|
-
* can't actually change the current location. Instead, it just records
|
|
1958
|
-
* location changes in a context object. Useful mainly in testing and
|
|
1959
|
-
* server-rendering scenarios.
|
|
1960
|
-
*/
|
|
1961
|
-
|
|
1962
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1963
|
-
_inheritsLoose$1(StaticRouter, _React$Component);
|
|
1964
|
-
function StaticRouter() {
|
|
1965
|
-
var _this;
|
|
1966
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1967
|
-
args[_key] = arguments[_key];
|
|
1968
|
-
}
|
|
1969
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
1970
|
-
_this.handlePush = function (location) {
|
|
1971
|
-
return _this.navigateTo(location, "PUSH");
|
|
1972
|
-
};
|
|
1973
|
-
_this.handleReplace = function (location) {
|
|
1974
|
-
return _this.navigateTo(location, "REPLACE");
|
|
1975
|
-
};
|
|
1976
|
-
_this.handleListen = function () {
|
|
1977
|
-
return noop;
|
|
1978
|
-
};
|
|
1979
|
-
_this.handleBlock = function () {
|
|
1980
|
-
return noop;
|
|
1981
|
-
};
|
|
1982
|
-
return _this;
|
|
1983
|
-
}
|
|
1984
|
-
var _proto = StaticRouter.prototype;
|
|
1985
|
-
_proto.navigateTo = function navigateTo(location, action) {
|
|
1986
|
-
var _this$props = this.props,
|
|
1987
|
-
_this$props$basename = _this$props.basename,
|
|
1988
|
-
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
1989
|
-
_this$props$context = _this$props.context,
|
|
1990
|
-
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
1991
|
-
context.action = action;
|
|
1992
|
-
context.location = addBasename(basename, createLocation(location));
|
|
1993
|
-
context.url = createURL(context.location);
|
|
1994
|
-
};
|
|
1995
|
-
_proto.render = function render() {
|
|
1996
|
-
var _this$props2 = this.props,
|
|
1997
|
-
_this$props2$basename = _this$props2.basename,
|
|
1998
|
-
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
|
|
1999
|
-
_this$props2$context = _this$props2.context,
|
|
2000
|
-
context = _this$props2$context === void 0 ? {} : _this$props2$context,
|
|
2001
|
-
_this$props2$location = _this$props2.location,
|
|
2002
|
-
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
|
|
2003
|
-
rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
|
|
2004
|
-
var history = {
|
|
2005
|
-
createHref: function createHref(path) {
|
|
2006
|
-
return addLeadingSlash(basename + createURL(path));
|
|
2007
|
-
},
|
|
2008
|
-
action: "POP",
|
|
2009
|
-
location: stripBasename(basename, createLocation(location)),
|
|
2010
|
-
push: this.handlePush,
|
|
2011
|
-
replace: this.handleReplace,
|
|
2012
|
-
go: staticHandler(),
|
|
2013
|
-
goBack: staticHandler(),
|
|
2014
|
-
goForward: staticHandler(),
|
|
2015
|
-
listen: this.handleListen,
|
|
2016
|
-
block: this.handleBlock
|
|
2017
|
-
};
|
|
2018
|
-
return /*#__PURE__*/React.createElement(Router, _extends({}, rest, {
|
|
2019
|
-
history: history,
|
|
2020
|
-
staticContext: context
|
|
2021
|
-
}));
|
|
2022
|
-
};
|
|
2023
|
-
return StaticRouter;
|
|
2024
|
-
})(React.Component);
|
|
2025
|
-
|
|
2026
|
-
/**
|
|
2027
|
-
* The public API for rendering the first <Route> that matches.
|
|
2028
|
-
*/
|
|
2029
|
-
|
|
2030
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2031
|
-
_inheritsLoose$1(Switch, _React$Component);
|
|
2032
|
-
function Switch() {
|
|
2033
|
-
return _React$Component.apply(this, arguments) || this;
|
|
2034
|
-
}
|
|
2035
|
-
var _proto = Switch.prototype;
|
|
2036
|
-
_proto.render = function render() {
|
|
2037
|
-
var _this = this;
|
|
2038
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2039
|
-
!context ? invariant(false) : void 0;
|
|
2040
|
-
var location = _this.props.location || context.location;
|
|
2041
|
-
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
2042
|
-
// here because toArray adds keys to all child elements and we do not want
|
|
2043
|
-
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2044
|
-
// component at different URLs.
|
|
2045
|
-
|
|
2046
|
-
React.Children.forEach(_this.props.children, function (child) {
|
|
2047
|
-
if (match == null && /*#__PURE__*/React.isValidElement(child)) {
|
|
2048
|
-
element = child;
|
|
2049
|
-
var path = child.props.path || child.props.from;
|
|
2050
|
-
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
2051
|
-
path: path
|
|
2052
|
-
})) : context.match;
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
return match ? /*#__PURE__*/React.cloneElement(element, {
|
|
2056
|
-
location: location,
|
|
2057
|
-
computedMatch: match
|
|
2058
|
-
}) : null;
|
|
2059
|
-
});
|
|
2060
|
-
};
|
|
2061
|
-
return Switch;
|
|
2062
|
-
})(React.Component);
|
|
2063
|
-
React.useContext;
|
|
2064
|
-
|
|
2065
|
-
/**
|
|
2066
|
-
* The public API for a <Router> that uses HTML5 history.
|
|
2067
|
-
*/
|
|
2068
|
-
|
|
2069
|
-
var BrowserRouter = /*#__PURE__*/function (_React$Component) {
|
|
2070
|
-
_inheritsLoose$1(BrowserRouter, _React$Component);
|
|
2071
|
-
function BrowserRouter() {
|
|
2072
|
-
var _this;
|
|
2073
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2074
|
-
args[_key] = arguments[_key];
|
|
2075
|
-
}
|
|
2076
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2077
|
-
_this.history = createBrowserHistory(_this.props);
|
|
2078
|
-
return _this;
|
|
2079
|
-
}
|
|
2080
|
-
var _proto = BrowserRouter.prototype;
|
|
2081
|
-
_proto.render = function render() {
|
|
2082
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
2083
|
-
history: this.history,
|
|
2084
|
-
children: this.props.children
|
|
2085
|
-
});
|
|
2086
|
-
};
|
|
2087
|
-
return BrowserRouter;
|
|
2088
|
-
}(React.Component);
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* The public API for a <Router> that uses window.location.hash.
|
|
2092
|
-
*/
|
|
1
|
+
import React, { useRef, useEffect, useMemo, useState, memo } from 'react';
|
|
2
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useFormikContext, Formik, Form, useField, FieldArray, ErrorMessage } from 'formik';
|
|
5
|
+
import { findBy, noop, isNotEmpty, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
6
|
+
import { ActionBlock, Textarea, MultiEmailInput, Input as Input$2, Select as Select$1, Radio } from '@bigbinary/neetoui/formik';
|
|
7
|
+
import { t as t$1 } from 'i18next';
|
|
8
|
+
import * as yup from 'yup';
|
|
9
|
+
import { isEditorEmpty, FormikEditor } from '@bigbinary/neeto-editor';
|
|
10
|
+
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
11
|
+
import { Typography, Button, Pane, DatePicker, Dropdown as Dropdown$1, Input as Input$1, Checkbox, Select, Label } from '@bigbinary/neetoui';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { Down, Up, Check, Search, Close, Delete, Plus, Refresh, Eye } from '@bigbinary/neeto-icons';
|
|
14
|
+
import { pluck, isNotNil, assocPath, toLower, isEmpty, isNil, without, append, pipe, partition } from 'ramda';
|
|
15
|
+
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
16
|
+
import { useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
2093
17
|
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
function HashRouter() {
|
|
2097
|
-
var _this;
|
|
2098
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2099
|
-
args[_key] = arguments[_key];
|
|
2100
|
-
}
|
|
2101
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2102
|
-
_this.history = createHashHistory(_this.props);
|
|
2103
|
-
return _this;
|
|
2104
|
-
}
|
|
2105
|
-
var _proto = HashRouter.prototype;
|
|
2106
|
-
_proto.render = function render() {
|
|
2107
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
2108
|
-
history: this.history,
|
|
2109
|
-
children: this.props.children
|
|
2110
|
-
});
|
|
2111
|
-
};
|
|
2112
|
-
return HashRouter;
|
|
2113
|
-
})(React.Component);
|
|
2114
|
-
var resolveToLocation = function resolveToLocation(to, currentLocation) {
|
|
2115
|
-
return typeof to === "function" ? to(currentLocation) : to;
|
|
2116
|
-
};
|
|
2117
|
-
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
|
|
2118
|
-
return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
|
|
2119
|
-
};
|
|
2120
|
-
var forwardRefShim = function forwardRefShim(C) {
|
|
2121
|
-
return C;
|
|
2122
|
-
};
|
|
2123
|
-
var forwardRef = React.forwardRef;
|
|
2124
|
-
if (typeof forwardRef === "undefined") {
|
|
2125
|
-
forwardRef = forwardRefShim;
|
|
2126
|
-
}
|
|
2127
|
-
function isModifiedEvent(event) {
|
|
2128
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
18
|
+
function _objectDestructuringEmpty(obj) {
|
|
19
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
2129
20
|
}
|
|
2130
|
-
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
|
|
2131
|
-
var innerRef = _ref.innerRef,
|
|
2132
|
-
navigate = _ref.navigate,
|
|
2133
|
-
_onClick = _ref.onClick,
|
|
2134
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
|
|
2135
|
-
var target = rest.target;
|
|
2136
|
-
var props = _extends({}, rest, {
|
|
2137
|
-
onClick: function onClick(event) {
|
|
2138
|
-
try {
|
|
2139
|
-
if (_onClick) _onClick(event);
|
|
2140
|
-
} catch (ex) {
|
|
2141
|
-
event.preventDefault();
|
|
2142
|
-
throw ex;
|
|
2143
|
-
}
|
|
2144
|
-
if (!event.defaultPrevented &&
|
|
2145
|
-
// onClick prevented default
|
|
2146
|
-
event.button === 0 && (
|
|
2147
|
-
// ignore everything but left clicks
|
|
2148
|
-
!target || target === "_self") &&
|
|
2149
|
-
// let browser handle "target=_blank" etc.
|
|
2150
|
-
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
2151
|
-
) {
|
|
2152
|
-
event.preventDefault();
|
|
2153
|
-
navigate();
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
}); // React 15 compat
|
|
2157
|
-
|
|
2158
|
-
if (forwardRefShim !== forwardRef) {
|
|
2159
|
-
props.ref = forwardedRef || innerRef;
|
|
2160
|
-
} else {
|
|
2161
|
-
props.ref = innerRef;
|
|
2162
|
-
}
|
|
2163
|
-
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
|
2164
|
-
|
|
2165
|
-
return /*#__PURE__*/React.createElement("a", props);
|
|
2166
|
-
});
|
|
2167
|
-
/**
|
|
2168
|
-
* The public API for rendering a history-aware <a>.
|
|
2169
|
-
*/
|
|
2170
21
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
|
|
2174
|
-
replace = _ref2.replace,
|
|
2175
|
-
to = _ref2.to,
|
|
2176
|
-
innerRef = _ref2.innerRef,
|
|
2177
|
-
rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
|
|
2178
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2179
|
-
!context ? invariant(false) : void 0;
|
|
2180
|
-
var history = context.history;
|
|
2181
|
-
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
|
|
2182
|
-
var href = location ? history.createHref(location) : "";
|
|
2183
|
-
var props = _extends({}, rest, {
|
|
2184
|
-
href: href,
|
|
2185
|
-
navigate: function navigate() {
|
|
2186
|
-
var location = resolveToLocation(to, context.location);
|
|
2187
|
-
var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
|
|
2188
|
-
var method = replace || isDuplicateNavigation ? history.replace : history.push;
|
|
2189
|
-
method(location);
|
|
2190
|
-
}
|
|
2191
|
-
}); // React 15 compat
|
|
22
|
+
function _typeof$1(obj) {
|
|
23
|
+
"@babel/helpers - typeof";
|
|
2192
24
|
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
return /*#__PURE__*/React.createElement(component, props);
|
|
2199
|
-
});
|
|
2200
|
-
});
|
|
2201
|
-
var forwardRefShim$1 = function forwardRefShim(C) {
|
|
2202
|
-
return C;
|
|
2203
|
-
};
|
|
2204
|
-
var forwardRef$1 = React.forwardRef;
|
|
2205
|
-
if (typeof forwardRef$1 === "undefined") {
|
|
2206
|
-
forwardRef$1 = forwardRefShim$1;
|
|
2207
|
-
}
|
|
2208
|
-
function joinClassnames() {
|
|
2209
|
-
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2210
|
-
classnames[_key] = arguments[_key];
|
|
2211
|
-
}
|
|
2212
|
-
return classnames.filter(function (i) {
|
|
2213
|
-
return i;
|
|
2214
|
-
}).join(" ");
|
|
25
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
26
|
+
return typeof obj;
|
|
27
|
+
} : function (obj) {
|
|
28
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
29
|
+
}, _typeof$1(obj);
|
|
2215
30
|
}
|
|
2216
|
-
/**
|
|
2217
|
-
* A <Link> wrapper that knows if it's "active" or not.
|
|
2218
|
-
*/
|
|
2219
|
-
|
|
2220
|
-
forwardRef$1(function (_ref, forwardedRef) {
|
|
2221
|
-
var _ref$ariaCurrent = _ref["aria-current"],
|
|
2222
|
-
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
|
|
2223
|
-
_ref$activeClassName = _ref.activeClassName,
|
|
2224
|
-
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
|
|
2225
|
-
activeStyle = _ref.activeStyle,
|
|
2226
|
-
classNameProp = _ref.className,
|
|
2227
|
-
exact = _ref.exact,
|
|
2228
|
-
isActiveProp = _ref.isActive,
|
|
2229
|
-
locationProp = _ref.location,
|
|
2230
|
-
sensitive = _ref.sensitive,
|
|
2231
|
-
strict = _ref.strict,
|
|
2232
|
-
styleProp = _ref.style,
|
|
2233
|
-
to = _ref.to,
|
|
2234
|
-
innerRef = _ref.innerRef,
|
|
2235
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
|
|
2236
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2237
|
-
!context ? invariant(false) : void 0;
|
|
2238
|
-
var currentLocation = locationProp || context.location;
|
|
2239
|
-
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
|
|
2240
|
-
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
2241
|
-
|
|
2242
|
-
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
2243
|
-
var match = escapedPath ? matchPath(currentLocation.pathname, {
|
|
2244
|
-
path: escapedPath,
|
|
2245
|
-
exact: exact,
|
|
2246
|
-
sensitive: sensitive,
|
|
2247
|
-
strict: strict
|
|
2248
|
-
}) : null;
|
|
2249
|
-
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
2250
|
-
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
2251
|
-
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
2252
|
-
if (isActive) {
|
|
2253
|
-
className = joinClassnames(className, activeClassName);
|
|
2254
|
-
style = _extends({}, style, activeStyle);
|
|
2255
|
-
}
|
|
2256
|
-
var props = _extends({
|
|
2257
|
-
"aria-current": isActive && ariaCurrent || null,
|
|
2258
|
-
className: className,
|
|
2259
|
-
style: style,
|
|
2260
|
-
to: toLocation
|
|
2261
|
-
}, rest); // React 15 compat
|
|
2262
|
-
|
|
2263
|
-
if (forwardRefShim$1 !== forwardRef$1) {
|
|
2264
|
-
props.ref = forwardedRef || innerRef;
|
|
2265
|
-
} else {
|
|
2266
|
-
props.innerRef = innerRef;
|
|
2267
|
-
}
|
|
2268
|
-
return /*#__PURE__*/React.createElement(Link, props);
|
|
2269
|
-
});
|
|
2270
|
-
});
|
|
2271
31
|
|
|
2272
32
|
function _toPrimitive(input, hint) {
|
|
2273
33
|
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
@@ -2300,6 +60,19 @@ function _defineProperty(obj, key, value) {
|
|
|
2300
60
|
return obj;
|
|
2301
61
|
}
|
|
2302
62
|
|
|
63
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
64
|
+
if (source == null) return {};
|
|
65
|
+
var target = {};
|
|
66
|
+
var sourceKeys = Object.keys(source);
|
|
67
|
+
var key, i;
|
|
68
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
69
|
+
key = sourceKeys[i];
|
|
70
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
71
|
+
target[key] = source[key];
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
|
|
2303
76
|
function _objectWithoutProperties(source, excluded) {
|
|
2304
77
|
if (source == null) return {};
|
|
2305
78
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -2329,376 +102,473 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2329
102
|
} else {
|
|
2330
103
|
Promise.resolve(value).then(_next, _throw);
|
|
2331
104
|
}
|
|
2332
|
-
}
|
|
2333
|
-
function _asyncToGenerator(fn) {
|
|
2334
|
-
return function () {
|
|
2335
|
-
var self = this,
|
|
2336
|
-
args = arguments;
|
|
2337
|
-
return new Promise(function (resolve, reject) {
|
|
2338
|
-
var gen = fn.apply(self, args);
|
|
2339
|
-
function _next(value) {
|
|
2340
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2341
|
-
}
|
|
2342
|
-
function _throw(err) {
|
|
2343
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2344
|
-
}
|
|
2345
|
-
_next(undefined);
|
|
2346
|
-
});
|
|
2347
|
-
};
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
var regeneratorRuntime$1 = {exports: {}};
|
|
2351
|
-
|
|
2352
|
-
var _typeof = {exports: {}};
|
|
2353
|
-
|
|
2354
|
-
(function (module) {
|
|
2355
|
-
function _typeof(obj) {
|
|
2356
|
-
"@babel/helpers - typeof";
|
|
2357
|
-
|
|
2358
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2359
|
-
return typeof obj;
|
|
2360
|
-
} : function (obj) {
|
|
2361
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2362
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
2363
|
-
}
|
|
2364
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2365
|
-
})(_typeof);
|
|
2366
|
-
|
|
2367
|
-
(function (module) {
|
|
2368
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
2369
|
-
function _regeneratorRuntime() {
|
|
2370
|
-
|
|
2371
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2372
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
2373
|
-
return exports;
|
|
2374
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2375
|
-
var exports = {},
|
|
2376
|
-
Op = Object.prototype,
|
|
2377
|
-
hasOwn = Op.hasOwnProperty,
|
|
2378
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
2379
|
-
obj[key] = desc.value;
|
|
2380
|
-
},
|
|
2381
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
2382
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
2383
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
2384
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2385
|
-
function define(obj, key, value) {
|
|
2386
|
-
return Object.defineProperty(obj, key, {
|
|
2387
|
-
value: value,
|
|
2388
|
-
enumerable: !0,
|
|
2389
|
-
configurable: !0,
|
|
2390
|
-
writable: !0
|
|
2391
|
-
}), obj[key];
|
|
2392
|
-
}
|
|
2393
|
-
try {
|
|
2394
|
-
define({}, "");
|
|
2395
|
-
} catch (err) {
|
|
2396
|
-
define = function define(obj, key, value) {
|
|
2397
|
-
return obj[key] = value;
|
|
2398
|
-
};
|
|
2399
|
-
}
|
|
2400
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2401
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
2402
|
-
generator = Object.create(protoGenerator.prototype),
|
|
2403
|
-
context = new Context(tryLocsList || []);
|
|
2404
|
-
return defineProperty(generator, "_invoke", {
|
|
2405
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
2406
|
-
}), generator;
|
|
2407
|
-
}
|
|
2408
|
-
function tryCatch(fn, obj, arg) {
|
|
2409
|
-
try {
|
|
2410
|
-
return {
|
|
2411
|
-
type: "normal",
|
|
2412
|
-
arg: fn.call(obj, arg)
|
|
2413
|
-
};
|
|
2414
|
-
} catch (err) {
|
|
2415
|
-
return {
|
|
2416
|
-
type: "throw",
|
|
2417
|
-
arg: err
|
|
2418
|
-
};
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
exports.wrap = wrap;
|
|
2422
|
-
var ContinueSentinel = {};
|
|
2423
|
-
function Generator() {}
|
|
2424
|
-
function GeneratorFunction() {}
|
|
2425
|
-
function GeneratorFunctionPrototype() {}
|
|
2426
|
-
var IteratorPrototype = {};
|
|
2427
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2428
|
-
return this;
|
|
2429
|
-
});
|
|
2430
|
-
var getProto = Object.getPrototypeOf,
|
|
2431
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2432
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
2433
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2434
|
-
function defineIteratorMethods(prototype) {
|
|
2435
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
2436
|
-
define(prototype, method, function (arg) {
|
|
2437
|
-
return this._invoke(method, arg);
|
|
2438
|
-
});
|
|
2439
|
-
});
|
|
2440
|
-
}
|
|
2441
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
2442
|
-
function invoke(method, arg, resolve, reject) {
|
|
2443
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
2444
|
-
if ("throw" !== record.type) {
|
|
2445
|
-
var result = record.arg,
|
|
2446
|
-
value = result.value;
|
|
2447
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2448
|
-
invoke("next", value, resolve, reject);
|
|
2449
|
-
}, function (err) {
|
|
2450
|
-
invoke("throw", err, resolve, reject);
|
|
2451
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2452
|
-
result.value = unwrapped, resolve(result);
|
|
2453
|
-
}, function (error) {
|
|
2454
|
-
return invoke("throw", error, resolve, reject);
|
|
2455
|
-
});
|
|
2456
|
-
}
|
|
2457
|
-
reject(record.arg);
|
|
2458
|
-
}
|
|
2459
|
-
var previousPromise;
|
|
2460
|
-
defineProperty(this, "_invoke", {
|
|
2461
|
-
value: function value(method, arg) {
|
|
2462
|
-
function callInvokeWithMethodAndArg() {
|
|
2463
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
2464
|
-
invoke(method, arg, resolve, reject);
|
|
2465
|
-
});
|
|
2466
|
-
}
|
|
2467
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2468
|
-
}
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
2472
|
-
var state = "suspendedStart";
|
|
2473
|
-
return function (method, arg) {
|
|
2474
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
2475
|
-
if ("completed" === state) {
|
|
2476
|
-
if ("throw" === method) throw arg;
|
|
2477
|
-
return doneResult();
|
|
2478
|
-
}
|
|
2479
|
-
for (context.method = method, context.arg = arg;;) {
|
|
2480
|
-
var delegate = context.delegate;
|
|
2481
|
-
if (delegate) {
|
|
2482
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2483
|
-
if (delegateResult) {
|
|
2484
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
2485
|
-
return delegateResult;
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
2489
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
2490
|
-
context.dispatchException(context.arg);
|
|
2491
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
2492
|
-
state = "executing";
|
|
2493
|
-
var record = tryCatch(innerFn, self, context);
|
|
2494
|
-
if ("normal" === record.type) {
|
|
2495
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
2496
|
-
return {
|
|
2497
|
-
value: record.arg,
|
|
2498
|
-
done: context.done
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
2502
|
-
}
|
|
2503
|
-
};
|
|
2504
|
-
}
|
|
2505
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
2506
|
-
var methodName = context.method,
|
|
2507
|
-
method = delegate.iterator[methodName];
|
|
2508
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
2509
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2510
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
2511
|
-
var info = record.arg;
|
|
2512
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
2513
|
-
}
|
|
2514
|
-
function pushTryEntry(locs) {
|
|
2515
|
-
var entry = {
|
|
2516
|
-
tryLoc: locs[0]
|
|
2517
|
-
};
|
|
2518
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
2519
|
-
}
|
|
2520
|
-
function resetTryEntry(entry) {
|
|
2521
|
-
var record = entry.completion || {};
|
|
2522
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
2523
|
-
}
|
|
2524
|
-
function Context(tryLocsList) {
|
|
2525
|
-
this.tryEntries = [{
|
|
2526
|
-
tryLoc: "root"
|
|
2527
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
2528
|
-
}
|
|
2529
|
-
function values(iterable) {
|
|
2530
|
-
if (iterable) {
|
|
2531
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
2532
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
2533
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
2534
|
-
if (!isNaN(iterable.length)) {
|
|
2535
|
-
var i = -1,
|
|
2536
|
-
next = function next() {
|
|
2537
|
-
for (; ++i < iterable.length;) {
|
|
2538
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
2539
|
-
}
|
|
2540
|
-
return next.value = undefined, next.done = !0, next;
|
|
2541
|
-
};
|
|
2542
|
-
return next.next = next;
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
return {
|
|
2546
|
-
next: doneResult
|
|
2547
|
-
};
|
|
2548
|
-
}
|
|
2549
|
-
function doneResult() {
|
|
2550
|
-
return {
|
|
2551
|
-
value: undefined,
|
|
2552
|
-
done: !0
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
2556
|
-
value: GeneratorFunctionPrototype,
|
|
2557
|
-
configurable: !0
|
|
2558
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
2559
|
-
value: GeneratorFunction,
|
|
2560
|
-
configurable: !0
|
|
2561
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
2562
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
2563
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
2564
|
-
}, exports.mark = function (genFun) {
|
|
2565
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
2566
|
-
}, exports.awrap = function (arg) {
|
|
2567
|
-
return {
|
|
2568
|
-
__await: arg
|
|
2569
|
-
};
|
|
2570
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2571
|
-
return this;
|
|
2572
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2573
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2574
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
2575
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
2576
|
-
return result.done ? result.value : iter.next();
|
|
2577
|
-
});
|
|
2578
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
2579
|
-
return this;
|
|
2580
|
-
}), define(Gp, "toString", function () {
|
|
2581
|
-
return "[object Generator]";
|
|
2582
|
-
}), exports.keys = function (val) {
|
|
2583
|
-
var object = Object(val),
|
|
2584
|
-
keys = [];
|
|
2585
|
-
for (var key in object) {
|
|
2586
|
-
keys.push(key);
|
|
105
|
+
}
|
|
106
|
+
function _asyncToGenerator(fn) {
|
|
107
|
+
return function () {
|
|
108
|
+
var self = this,
|
|
109
|
+
args = arguments;
|
|
110
|
+
return new Promise(function (resolve, reject) {
|
|
111
|
+
var gen = fn.apply(self, args);
|
|
112
|
+
function _next(value) {
|
|
113
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2587
114
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
var key = keys.pop();
|
|
2591
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
2592
|
-
}
|
|
2593
|
-
return next.done = !0, next;
|
|
2594
|
-
};
|
|
2595
|
-
}, exports.values = values, Context.prototype = {
|
|
2596
|
-
constructor: Context,
|
|
2597
|
-
reset: function reset(skipTempReset) {
|
|
2598
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
2599
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
2600
|
-
}
|
|
2601
|
-
},
|
|
2602
|
-
stop: function stop() {
|
|
2603
|
-
this.done = !0;
|
|
2604
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
2605
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
2606
|
-
return this.rval;
|
|
2607
|
-
},
|
|
2608
|
-
dispatchException: function dispatchException(exception) {
|
|
2609
|
-
if (this.done) throw exception;
|
|
2610
|
-
var context = this;
|
|
2611
|
-
function handle(loc, caught) {
|
|
2612
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
2613
|
-
}
|
|
2614
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2615
|
-
var entry = this.tryEntries[i],
|
|
2616
|
-
record = entry.completion;
|
|
2617
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
2618
|
-
if (entry.tryLoc <= this.prev) {
|
|
2619
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
2620
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2621
|
-
if (hasCatch && hasFinally) {
|
|
2622
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2623
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2624
|
-
} else if (hasCatch) {
|
|
2625
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2626
|
-
} else {
|
|
2627
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
2628
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
},
|
|
2633
|
-
abrupt: function abrupt(type, arg) {
|
|
2634
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2635
|
-
var entry = this.tryEntries[i];
|
|
2636
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2637
|
-
var finallyEntry = entry;
|
|
2638
|
-
break;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2642
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2643
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2644
|
-
},
|
|
2645
|
-
complete: function complete(record, afterLoc) {
|
|
2646
|
-
if ("throw" === record.type) throw record.arg;
|
|
2647
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
2648
|
-
},
|
|
2649
|
-
finish: function finish(finallyLoc) {
|
|
2650
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2651
|
-
var entry = this.tryEntries[i];
|
|
2652
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2653
|
-
}
|
|
2654
|
-
},
|
|
2655
|
-
"catch": function _catch(tryLoc) {
|
|
2656
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2657
|
-
var entry = this.tryEntries[i];
|
|
2658
|
-
if (entry.tryLoc === tryLoc) {
|
|
2659
|
-
var record = entry.completion;
|
|
2660
|
-
if ("throw" === record.type) {
|
|
2661
|
-
var thrown = record.arg;
|
|
2662
|
-
resetTryEntry(entry);
|
|
2663
|
-
}
|
|
2664
|
-
return thrown;
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
throw new Error("illegal catch attempt");
|
|
2668
|
-
},
|
|
2669
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2670
|
-
return this.delegate = {
|
|
2671
|
-
iterator: values(iterable),
|
|
2672
|
-
resultName: resultName,
|
|
2673
|
-
nextLoc: nextLoc
|
|
2674
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
115
|
+
function _throw(err) {
|
|
116
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2675
117
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
}
|
|
118
|
+
_next(undefined);
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
124
|
+
|
|
125
|
+
function getDefaultExportFromCjs (x) {
|
|
126
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
130
|
+
|
|
131
|
+
var _typeof = {exports: {}};
|
|
132
|
+
|
|
133
|
+
_typeof.exports;
|
|
134
|
+
|
|
135
|
+
(function (module) {
|
|
136
|
+
function _typeof(obj) {
|
|
137
|
+
"@babel/helpers - typeof";
|
|
138
|
+
|
|
139
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
140
|
+
return typeof obj;
|
|
141
|
+
} : function (obj) {
|
|
142
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
143
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
144
|
+
}
|
|
145
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
146
|
+
} (_typeof));
|
|
147
|
+
|
|
148
|
+
var _typeofExports = _typeof.exports;
|
|
149
|
+
|
|
150
|
+
regeneratorRuntime$1.exports;
|
|
151
|
+
|
|
152
|
+
(function (module) {
|
|
153
|
+
var _typeof = _typeofExports["default"];
|
|
154
|
+
function _regeneratorRuntime() {
|
|
155
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
156
|
+
return exports;
|
|
157
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
158
|
+
var exports = {},
|
|
159
|
+
Op = Object.prototype,
|
|
160
|
+
hasOwn = Op.hasOwnProperty,
|
|
161
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
162
|
+
obj[key] = desc.value;
|
|
163
|
+
},
|
|
164
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
165
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
166
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
167
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
168
|
+
function define(obj, key, value) {
|
|
169
|
+
return Object.defineProperty(obj, key, {
|
|
170
|
+
value: value,
|
|
171
|
+
enumerable: !0,
|
|
172
|
+
configurable: !0,
|
|
173
|
+
writable: !0
|
|
174
|
+
}), obj[key];
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
define({}, "");
|
|
178
|
+
} catch (err) {
|
|
179
|
+
define = function define(obj, key, value) {
|
|
180
|
+
return obj[key] = value;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
184
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
185
|
+
generator = Object.create(protoGenerator.prototype),
|
|
186
|
+
context = new Context(tryLocsList || []);
|
|
187
|
+
return defineProperty(generator, "_invoke", {
|
|
188
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
189
|
+
}), generator;
|
|
190
|
+
}
|
|
191
|
+
function tryCatch(fn, obj, arg) {
|
|
192
|
+
try {
|
|
193
|
+
return {
|
|
194
|
+
type: "normal",
|
|
195
|
+
arg: fn.call(obj, arg)
|
|
196
|
+
};
|
|
197
|
+
} catch (err) {
|
|
198
|
+
return {
|
|
199
|
+
type: "throw",
|
|
200
|
+
arg: err
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.wrap = wrap;
|
|
205
|
+
var ContinueSentinel = {};
|
|
206
|
+
function Generator() {}
|
|
207
|
+
function GeneratorFunction() {}
|
|
208
|
+
function GeneratorFunctionPrototype() {}
|
|
209
|
+
var IteratorPrototype = {};
|
|
210
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
211
|
+
return this;
|
|
212
|
+
});
|
|
213
|
+
var getProto = Object.getPrototypeOf,
|
|
214
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
215
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
216
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
217
|
+
function defineIteratorMethods(prototype) {
|
|
218
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
219
|
+
define(prototype, method, function (arg) {
|
|
220
|
+
return this._invoke(method, arg);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
225
|
+
function invoke(method, arg, resolve, reject) {
|
|
226
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
227
|
+
if ("throw" !== record.type) {
|
|
228
|
+
var result = record.arg,
|
|
229
|
+
value = result.value;
|
|
230
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
231
|
+
invoke("next", value, resolve, reject);
|
|
232
|
+
}, function (err) {
|
|
233
|
+
invoke("throw", err, resolve, reject);
|
|
234
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
235
|
+
result.value = unwrapped, resolve(result);
|
|
236
|
+
}, function (error) {
|
|
237
|
+
return invoke("throw", error, resolve, reject);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
reject(record.arg);
|
|
241
|
+
}
|
|
242
|
+
var previousPromise;
|
|
243
|
+
defineProperty(this, "_invoke", {
|
|
244
|
+
value: function value(method, arg) {
|
|
245
|
+
function callInvokeWithMethodAndArg() {
|
|
246
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
247
|
+
invoke(method, arg, resolve, reject);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
255
|
+
var state = "suspendedStart";
|
|
256
|
+
return function (method, arg) {
|
|
257
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
258
|
+
if ("completed" === state) {
|
|
259
|
+
if ("throw" === method) throw arg;
|
|
260
|
+
return doneResult();
|
|
261
|
+
}
|
|
262
|
+
for (context.method = method, context.arg = arg;;) {
|
|
263
|
+
var delegate = context.delegate;
|
|
264
|
+
if (delegate) {
|
|
265
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
266
|
+
if (delegateResult) {
|
|
267
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
268
|
+
return delegateResult;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
272
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
273
|
+
context.dispatchException(context.arg);
|
|
274
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
275
|
+
state = "executing";
|
|
276
|
+
var record = tryCatch(innerFn, self, context);
|
|
277
|
+
if ("normal" === record.type) {
|
|
278
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
279
|
+
return {
|
|
280
|
+
value: record.arg,
|
|
281
|
+
done: context.done
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
289
|
+
var methodName = context.method,
|
|
290
|
+
method = delegate.iterator[methodName];
|
|
291
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
292
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
293
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
294
|
+
var info = record.arg;
|
|
295
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
296
|
+
}
|
|
297
|
+
function pushTryEntry(locs) {
|
|
298
|
+
var entry = {
|
|
299
|
+
tryLoc: locs[0]
|
|
300
|
+
};
|
|
301
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
302
|
+
}
|
|
303
|
+
function resetTryEntry(entry) {
|
|
304
|
+
var record = entry.completion || {};
|
|
305
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
306
|
+
}
|
|
307
|
+
function Context(tryLocsList) {
|
|
308
|
+
this.tryEntries = [{
|
|
309
|
+
tryLoc: "root"
|
|
310
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
311
|
+
}
|
|
312
|
+
function values(iterable) {
|
|
313
|
+
if (iterable) {
|
|
314
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
315
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
316
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
317
|
+
if (!isNaN(iterable.length)) {
|
|
318
|
+
var i = -1,
|
|
319
|
+
next = function next() {
|
|
320
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
321
|
+
return next.value = undefined, next.done = !0, next;
|
|
322
|
+
};
|
|
323
|
+
return next.next = next;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
next: doneResult
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function doneResult() {
|
|
331
|
+
return {
|
|
332
|
+
value: undefined,
|
|
333
|
+
done: !0
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
337
|
+
value: GeneratorFunctionPrototype,
|
|
338
|
+
configurable: !0
|
|
339
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
340
|
+
value: GeneratorFunction,
|
|
341
|
+
configurable: !0
|
|
342
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
343
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
344
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
345
|
+
}, exports.mark = function (genFun) {
|
|
346
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
347
|
+
}, exports.awrap = function (arg) {
|
|
348
|
+
return {
|
|
349
|
+
__await: arg
|
|
350
|
+
};
|
|
351
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
352
|
+
return this;
|
|
353
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
354
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
355
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
356
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
357
|
+
return result.done ? result.value : iter.next();
|
|
358
|
+
});
|
|
359
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
360
|
+
return this;
|
|
361
|
+
}), define(Gp, "toString", function () {
|
|
362
|
+
return "[object Generator]";
|
|
363
|
+
}), exports.keys = function (val) {
|
|
364
|
+
var object = Object(val),
|
|
365
|
+
keys = [];
|
|
366
|
+
for (var key in object) keys.push(key);
|
|
367
|
+
return keys.reverse(), function next() {
|
|
368
|
+
for (; keys.length;) {
|
|
369
|
+
var key = keys.pop();
|
|
370
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
371
|
+
}
|
|
372
|
+
return next.done = !0, next;
|
|
373
|
+
};
|
|
374
|
+
}, exports.values = values, Context.prototype = {
|
|
375
|
+
constructor: Context,
|
|
376
|
+
reset: function reset(skipTempReset) {
|
|
377
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
378
|
+
},
|
|
379
|
+
stop: function stop() {
|
|
380
|
+
this.done = !0;
|
|
381
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
382
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
383
|
+
return this.rval;
|
|
384
|
+
},
|
|
385
|
+
dispatchException: function dispatchException(exception) {
|
|
386
|
+
if (this.done) throw exception;
|
|
387
|
+
var context = this;
|
|
388
|
+
function handle(loc, caught) {
|
|
389
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
390
|
+
}
|
|
391
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
392
|
+
var entry = this.tryEntries[i],
|
|
393
|
+
record = entry.completion;
|
|
394
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
395
|
+
if (entry.tryLoc <= this.prev) {
|
|
396
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
397
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
398
|
+
if (hasCatch && hasFinally) {
|
|
399
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
400
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
401
|
+
} else if (hasCatch) {
|
|
402
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
403
|
+
} else {
|
|
404
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
405
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
abrupt: function abrupt(type, arg) {
|
|
411
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
412
|
+
var entry = this.tryEntries[i];
|
|
413
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
414
|
+
var finallyEntry = entry;
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
419
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
420
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
421
|
+
},
|
|
422
|
+
complete: function complete(record, afterLoc) {
|
|
423
|
+
if ("throw" === record.type) throw record.arg;
|
|
424
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
425
|
+
},
|
|
426
|
+
finish: function finish(finallyLoc) {
|
|
427
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
428
|
+
var entry = this.tryEntries[i];
|
|
429
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
"catch": function _catch(tryLoc) {
|
|
433
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
434
|
+
var entry = this.tryEntries[i];
|
|
435
|
+
if (entry.tryLoc === tryLoc) {
|
|
436
|
+
var record = entry.completion;
|
|
437
|
+
if ("throw" === record.type) {
|
|
438
|
+
var thrown = record.arg;
|
|
439
|
+
resetTryEntry(entry);
|
|
440
|
+
}
|
|
441
|
+
return thrown;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
throw new Error("illegal catch attempt");
|
|
445
|
+
},
|
|
446
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
447
|
+
return this.delegate = {
|
|
448
|
+
iterator: values(iterable),
|
|
449
|
+
resultName: resultName,
|
|
450
|
+
nextLoc: nextLoc
|
|
451
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
452
|
+
}
|
|
453
|
+
}, exports;
|
|
454
|
+
}
|
|
455
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
456
|
+
} (regeneratorRuntime$1));
|
|
457
|
+
|
|
458
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
2680
459
|
|
|
2681
460
|
// TODO(Babel 8): Remove this file.
|
|
2682
461
|
|
|
2683
|
-
var runtime =
|
|
462
|
+
var runtime = regeneratorRuntimeExports();
|
|
2684
463
|
var regenerator = runtime;
|
|
2685
464
|
|
|
2686
465
|
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
2687
466
|
try {
|
|
2688
467
|
regeneratorRuntime = runtime;
|
|
2689
468
|
} catch (accidentalStrictMode) {
|
|
2690
|
-
if (
|
|
469
|
+
if (typeof globalThis === "object") {
|
|
2691
470
|
globalThis.regeneratorRuntime = runtime;
|
|
2692
471
|
} else {
|
|
2693
472
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
2694
473
|
}
|
|
2695
474
|
}
|
|
2696
475
|
|
|
476
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
477
|
+
|
|
478
|
+
var propTypes = {exports: {}};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
482
|
+
*
|
|
483
|
+
* This source code is licensed under the MIT license found in the
|
|
484
|
+
* LICENSE file in the root directory of this source tree.
|
|
485
|
+
*/
|
|
486
|
+
|
|
487
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
488
|
+
|
|
489
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the MIT license found in the
|
|
495
|
+
* LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
499
|
+
|
|
500
|
+
function emptyFunction() {}
|
|
501
|
+
function emptyFunctionWithReset() {}
|
|
502
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
503
|
+
|
|
504
|
+
var factoryWithThrowingShims = function() {
|
|
505
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
506
|
+
if (secret === ReactPropTypesSecret) {
|
|
507
|
+
// It is still safe when called from React.
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
var err = new Error(
|
|
511
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
512
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
513
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
514
|
+
);
|
|
515
|
+
err.name = 'Invariant Violation';
|
|
516
|
+
throw err;
|
|
517
|
+
} shim.isRequired = shim;
|
|
518
|
+
function getShim() {
|
|
519
|
+
return shim;
|
|
520
|
+
} // Important!
|
|
521
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
522
|
+
var ReactPropTypes = {
|
|
523
|
+
array: shim,
|
|
524
|
+
bigint: shim,
|
|
525
|
+
bool: shim,
|
|
526
|
+
func: shim,
|
|
527
|
+
number: shim,
|
|
528
|
+
object: shim,
|
|
529
|
+
string: shim,
|
|
530
|
+
symbol: shim,
|
|
531
|
+
|
|
532
|
+
any: shim,
|
|
533
|
+
arrayOf: getShim,
|
|
534
|
+
element: shim,
|
|
535
|
+
elementType: shim,
|
|
536
|
+
instanceOf: getShim,
|
|
537
|
+
node: shim,
|
|
538
|
+
objectOf: getShim,
|
|
539
|
+
oneOf: getShim,
|
|
540
|
+
oneOfType: getShim,
|
|
541
|
+
shape: getShim,
|
|
542
|
+
exact: getShim,
|
|
543
|
+
|
|
544
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
545
|
+
resetWarningCache: emptyFunction
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
549
|
+
|
|
550
|
+
return ReactPropTypes;
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
555
|
+
*
|
|
556
|
+
* This source code is licensed under the MIT license found in the
|
|
557
|
+
* LICENSE file in the root directory of this source tree.
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
{
|
|
561
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
562
|
+
// http://fb.me/prop-types-in-prod
|
|
563
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
var propTypesExports = propTypes.exports;
|
|
567
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
568
|
+
|
|
2697
569
|
function _arrayLikeToArray(arr, len) {
|
|
2698
570
|
if (len == null || len > arr.length) len = arr.length;
|
|
2699
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
2700
|
-
arr2[i] = arr[i];
|
|
2701
|
-
}
|
|
571
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2702
572
|
return arr2;
|
|
2703
573
|
}
|
|
2704
574
|
|
|
@@ -3041,7 +911,7 @@ var POSITIVE_NUMBER_REGEX = /^[0-9]+$/;
|
|
|
3041
911
|
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3042
912
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3043
913
|
var buildPayload = function buildPayload(data, values) {
|
|
3044
|
-
|
|
914
|
+
return Object.keys(data).reduce(function (acc, key) {
|
|
3045
915
|
var fieldValue = values[key].value;
|
|
3046
916
|
if (Array.isArray(fieldValue)) {
|
|
3047
917
|
var _values$key;
|
|
@@ -3058,7 +928,6 @@ var buildPayload = function buildPayload(data, values) {
|
|
|
3058
928
|
}
|
|
3059
929
|
return _objectSpread$5(_objectSpread$5({}, acc), {}, _defineProperty({}, key, fieldValue));
|
|
3060
930
|
}, {});
|
|
3061
|
-
return payload;
|
|
3062
931
|
};
|
|
3063
932
|
var formatData = function formatData(data) {
|
|
3064
933
|
return Object.keys(data).reduce(function (acc, key) {
|
|
@@ -3134,23 +1003,21 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3134
1003
|
children = _ref.children,
|
|
3135
1004
|
className = _ref.className,
|
|
3136
1005
|
_ref$handleSubmit = _ref.handleSubmit,
|
|
3137
|
-
handleSubmit = _ref$handleSubmit === void 0 ? noop
|
|
1006
|
+
handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
|
|
3138
1007
|
_ref$handleCancel = _ref.handleCancel,
|
|
3139
|
-
handleCancel = _ref$handleCancel === void 0 ? noop
|
|
1008
|
+
handleCancel = _ref$handleCancel === void 0 ? noop : _ref$handleCancel;
|
|
3140
1009
|
var formRef = useRef(null);
|
|
3141
1010
|
var submitForm = /*#__PURE__*/function () {
|
|
3142
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
1011
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, formikBag) {
|
|
3143
1012
|
var payload;
|
|
3144
|
-
return
|
|
3145
|
-
while (1) {
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
return _context.stop();
|
|
3153
|
-
}
|
|
1013
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1014
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1015
|
+
case 0:
|
|
1016
|
+
payload = buildPayload(data, values);
|
|
1017
|
+
handleSubmit(payload, formikBag);
|
|
1018
|
+
case 2:
|
|
1019
|
+
case "end":
|
|
1020
|
+
return _context.stop();
|
|
3154
1021
|
}
|
|
3155
1022
|
}, _callee);
|
|
3156
1023
|
}));
|
|
@@ -3162,8 +1029,8 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3162
1029
|
return formatData(data);
|
|
3163
1030
|
}, [data]);
|
|
3164
1031
|
return /*#__PURE__*/React.createElement(Formik, {
|
|
3165
|
-
enableReinitialize: true,
|
|
3166
1032
|
initialValues: initialValues,
|
|
1033
|
+
enableReinitialize: true,
|
|
3167
1034
|
validationSchema: getValidationSchema(data),
|
|
3168
1035
|
onSubmit: submitForm
|
|
3169
1036
|
}, function (_ref3) {
|
|
@@ -3199,9 +1066,9 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3199
1066
|
});
|
|
3200
1067
|
};
|
|
3201
1068
|
NeetoRules$2.prototype = {
|
|
3202
|
-
data:
|
|
3203
|
-
handleSubmit:
|
|
3204
|
-
className:
|
|
1069
|
+
data: PropTypes.object,
|
|
1070
|
+
handleSubmit: PropTypes.func,
|
|
1071
|
+
className: PropTypes.string
|
|
3205
1072
|
};
|
|
3206
1073
|
|
|
3207
1074
|
var Main = function Main(_ref) {
|
|
@@ -3209,6 +1076,11 @@ var Main = function Main(_ref) {
|
|
|
3209
1076
|
return /*#__PURE__*/React.createElement(NeetoRules$2, rest);
|
|
3210
1077
|
};
|
|
3211
1078
|
|
|
1079
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
1080
|
+
|
|
1081
|
+
var css = ".neeto-filters-error-boundary{align-items:center;background-color:#f8f9f9;border-radius:2px;display:flex;gap:16px;margin-bottom:12px;padding:8px 20px}.neeto-filters-error-boundary p{color:#2f3941}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lcnJvci1ib3VuZGFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL2Fic3RyYWN0cy9fbmVldG8tdWktdmFyaWFibGVzLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvbWFpbi5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDhCQUlFLGtCQUFBLENBR0Esd0JDS2tCLENETmxCLGlCQ2VvQixDRGxCcEIsWUFBQSxDQUVBLFFBQUEsQ0FIQSxrQkFBQSxDQURBLGdCRU9GLENGQ0UsZ0NBQ0UsYUVDSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogJG5lZXRvLXVpLXJvdW5kZWQtc207XG4gIGJhY2tncm91bmQtY29sb3I6ICRuZWV0by11aS1ncmF5LTEwMDtcblxuICBwIHtcbiAgICBjb2xvcjogJG5lZXRvLXVpLWdyYXktODAwO1xuICB9XG59XG4iLCIvLyBDb2xvciBwZWxldHRlXG5cbi8vIHByaW1hcnlcbiRuZWV0by11aS13aGl0ZTogI2ZmZmZmZjtcbi8vIGdyYXlzXG4kbmVldG8tdWktZ3JheS04MDA6ICMyZjM5NDE7XG4kbmVldG8tdWktZ3JheS03MDA6ICM0OTU0NWM7XG4kbmVldG8tdWktZ3JheS02MDA6ICM2ODczN2Q7XG4kbmVldG8tdWktZ3JheS01MDA6ICM4NzkyOWQ7XG4kbmVldG8tdWktZ3JheS00MDA6ICNjMmM4Y2M7XG4kbmVldG8tdWktZ3JheS0zMDA6ICNkOGRjZGU7XG4kbmVldG8tdWktZ3JheS0yMDA6ICNlOWViZWQ7XG4kbmVldG8tdWktZ3JheS0xMDA6ICNmOGY5Zjk7XG4vLyBwYXN0ZWxzXG4kbmVldG8tdWktcGFzdGVsLWJsdWU6ICNlYWYzZmM7XG5cbi8vIEZvbnQgd2VpZ2h0c1xuJG5lZXRvLXVpLWZvbnQtc2VtaWJvbGQ6IDYwMDtcbiRuZWV0by11aS1mb250LW5vcm1hbDogNDAwO1xuXG4vLyBCb3JkZXIgUmFkaXVzXG4kbmVldG8tdWktcm91bmRlZC1zbTogMnB4O1xuXG4vLyBCb3ggU2hhZG93c1xuJG5lZXRvLXVpLXNoYWRvdy1zOiAwcHggM3B4IDEycHggLTFweCByZ2JhKDI4LCA1MiwgODQsIDAuMTIpLFxuICAwcHggMnB4IDRweCAtMXB4IHJnYmEoMjgsIDU1LCA5MCwgMC4wOCk7XG5cbi8vIFRyYW5zaXRpb25cbiRuZWV0by11aS10cmFuc2l0aW9uOiBhbGwgMC4zcyBlYXNlLWluLW91dDtcbiIsIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogMnB4O1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjhmOWY5O1xufVxuLm5lZXRvLWZpbHRlcnMtZXJyb3ItYm91bmRhcnkgcCB7XG4gIGNvbG9yOiAjMmYzOTQxO1xufSJdfQ== */";
|
|
1082
|
+
n(css,{});
|
|
1083
|
+
|
|
3212
1084
|
var NeetoRules$1 = function NeetoRules(_ref) {
|
|
3213
1085
|
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
3214
1086
|
return /*#__PURE__*/React.createElement(BrowserRouter, null, /*#__PURE__*/React.createElement(Main, rest));
|
|
@@ -3232,9 +1104,7 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3232
1104
|
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3233
1105
|
if (Object(_i) !== _i) return;
|
|
3234
1106
|
_n = !1;
|
|
3235
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
3236
|
-
;
|
|
3237
|
-
}
|
|
1107
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3238
1108
|
} catch (err) {
|
|
3239
1109
|
_d = !0, _e = err;
|
|
3240
1110
|
} finally {
|
|
@@ -3287,10 +1157,10 @@ var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
|
3287
1157
|
};
|
|
3288
1158
|
|
|
3289
1159
|
var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOption) {
|
|
3290
|
-
var _findBy
|
|
1160
|
+
var _findBy;
|
|
3291
1161
|
return (_findBy = findBy({
|
|
3292
1162
|
value: entitiy.metadata.value
|
|
3293
|
-
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0
|
|
1163
|
+
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
3294
1164
|
};
|
|
3295
1165
|
|
|
3296
1166
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
@@ -3322,10 +1192,10 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3322
1192
|
return action.metadata.value.includes(value);
|
|
3323
1193
|
}));
|
|
3324
1194
|
return /*#__PURE__*/React.createElement(MultiSelectValues, {
|
|
1195
|
+
values: values,
|
|
3325
1196
|
separator: t("neetoRules.common.and", {
|
|
3326
1197
|
what: ""
|
|
3327
|
-
})
|
|
3328
|
-
values: values
|
|
1198
|
+
})
|
|
3329
1199
|
});
|
|
3330
1200
|
}
|
|
3331
1201
|
return null;
|
|
@@ -3356,9 +1226,9 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3356
1226
|
className: "mt-3 w-full"
|
|
3357
1227
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
3358
1228
|
icon: !viewMore ? Down : Up,
|
|
3359
|
-
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3360
1229
|
size: "small",
|
|
3361
1230
|
style: "link",
|
|
1231
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3362
1232
|
onClick: function onClick() {
|
|
3363
1233
|
return setViewMore(function (prevState) {
|
|
3364
1234
|
return !prevState;
|
|
@@ -3389,8 +1259,8 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
3389
1259
|
return condition.metadata.values.includes(value);
|
|
3390
1260
|
}));
|
|
3391
1261
|
return /*#__PURE__*/React.createElement(MultiSelectValues, {
|
|
3392
|
-
|
|
3393
|
-
|
|
1262
|
+
values: values,
|
|
1263
|
+
separator: t$1("neetoRules.common.or")
|
|
3394
1264
|
});
|
|
3395
1265
|
}
|
|
3396
1266
|
if (conditionOption.type === "dropdown") {
|
|
@@ -3490,7 +1360,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3490
1360
|
className: "neeto-ui-text-gray-800",
|
|
3491
1361
|
style: "h5",
|
|
3492
1362
|
weight: "semibold"
|
|
3493
|
-
}, currentPerformer === null || currentPerformer === void 0
|
|
1363
|
+
}, currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase())), /*#__PURE__*/React.createElement(ConditionsDetail, {
|
|
3494
1364
|
conditionOptions: conditions.conditionOptions,
|
|
3495
1365
|
conditionVerbs: conditions.verbs,
|
|
3496
1366
|
conditions: allConditions
|
|
@@ -3498,9 +1368,9 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3498
1368
|
className: "mt-3 w-full"
|
|
3499
1369
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
3500
1370
|
icon: !viewMore ? Down : Up,
|
|
3501
|
-
label: !viewMore ? t$1("neetoRules.common.viewMore") : t$1("neetoRules.common.viewLess"),
|
|
3502
1371
|
size: "small",
|
|
3503
1372
|
style: "link",
|
|
1373
|
+
label: !viewMore ? t$1("neetoRules.common.viewMore") : t$1("neetoRules.common.viewLess"),
|
|
3504
1374
|
onClick: function onClick() {
|
|
3505
1375
|
return setViewMore(function (prevState) {
|
|
3506
1376
|
return !prevState;
|
|
@@ -3598,7 +1468,7 @@ var useOnButtonPressed = function useOnButtonPressed(ref, handler) {
|
|
|
3598
1468
|
var DEFAULT_LONG_TEXT_ROWS = 8;
|
|
3599
1469
|
|
|
3600
1470
|
var LongTextField = function LongTextField(_ref) {
|
|
3601
|
-
var _errors$actions,
|
|
1471
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3602
1472
|
var name = _ref.name,
|
|
3603
1473
|
_ref$value = _ref.value,
|
|
3604
1474
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -3620,8 +1490,8 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3620
1490
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3621
1491
|
return setShowPane(false);
|
|
3622
1492
|
});
|
|
3623
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3624
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1493
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1494
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || defaultSeparator;
|
|
3625
1495
|
var label = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || defaultLabel;
|
|
3626
1496
|
var rows = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.rows) || DEFAULT_LONG_TEXT_ROWS;
|
|
3627
1497
|
return /*#__PURE__*/React.createElement(React.Fragment, null, separator && /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -3655,11 +1525,11 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3655
1525
|
style: "h3",
|
|
3656
1526
|
weight: "semibold"
|
|
3657
1527
|
}, label)), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement(Textarea, {
|
|
3658
|
-
required: true,
|
|
3659
|
-
className: "w-full",
|
|
3660
1528
|
name: name,
|
|
3661
1529
|
rows: rows,
|
|
3662
|
-
value: value
|
|
1530
|
+
value: value,
|
|
1531
|
+
required: true,
|
|
1532
|
+
className: "w-full"
|
|
3663
1533
|
})), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
3664
1534
|
className: "flex items-center space-x-2"
|
|
3665
1535
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -3678,7 +1548,7 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3678
1548
|
};
|
|
3679
1549
|
|
|
3680
1550
|
var CustomAction = function CustomAction(_ref) {
|
|
3681
|
-
var _errors$actions,
|
|
1551
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3682
1552
|
var ActionComponent = _ref.ActionComponent,
|
|
3683
1553
|
name = _ref.name,
|
|
3684
1554
|
action = _ref.action,
|
|
@@ -3695,8 +1565,8 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3695
1565
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3696
1566
|
return setShowPane(false);
|
|
3697
1567
|
});
|
|
3698
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3699
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1568
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1569
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
3700
1570
|
var defaultLabel = selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder;
|
|
3701
1571
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
3702
1572
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -3745,8 +1615,19 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3745
1615
|
}))));
|
|
3746
1616
|
};
|
|
3747
1617
|
|
|
1618
|
+
var dayjs_min = {exports: {}};
|
|
1619
|
+
|
|
1620
|
+
dayjs_min.exports;
|
|
1621
|
+
|
|
1622
|
+
(function (module, exports) {
|
|
1623
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof b},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new b(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var b=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,f=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=O.p(f),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return O.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return O.s(e.$y,4,"0");case"M":return a+1;case"MM":return O.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return O.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return O.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return O.s(u,2,"0");case"s":return String(e.$s);case"ss":return O.s(e.$s,2,"0");case"SSS":return O.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=O.p(d),m=w(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return O.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:O.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),_=b.prototype;return w.prototype=_,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){_[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,b,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
1624
|
+
} (dayjs_min, dayjs_min.exports));
|
|
1625
|
+
|
|
1626
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
1627
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
1628
|
+
|
|
3748
1629
|
var DateField$1 = function DateField(_ref) {
|
|
3749
|
-
var _actions$value$index$, _selectedField$separa, _errors$actions,
|
|
1630
|
+
var _actions$value$index$, _selectedField$separa, _errors$actions, _touched$actions;
|
|
3750
1631
|
var name = _ref.name,
|
|
3751
1632
|
index = _ref.index,
|
|
3752
1633
|
selectedField = _ref.selectedField;
|
|
@@ -3762,8 +1643,8 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3762
1643
|
setShowInput = _useState2[1];
|
|
3763
1644
|
var valueTerm = (_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value;
|
|
3764
1645
|
var label = valueTerm || t$1("neetoRules.form.selectDate").toLowerCase();
|
|
3765
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
3766
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1646
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
1647
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
3767
1648
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !selectedField.hideSeparator && /*#__PURE__*/React.createElement(Typography, {
|
|
3768
1649
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
3769
1650
|
"data-cy": "action-dropdown-seperator-text",
|
|
@@ -3816,14 +1697,13 @@ var getActionOptions = function getActionOptions(currentAction, selectedActions)
|
|
|
3816
1697
|
};
|
|
3817
1698
|
var buildEmailValues = function buildEmailValues(emails) {
|
|
3818
1699
|
var emailRegex = EMAIL_REGEX;
|
|
3819
|
-
|
|
1700
|
+
return emails.map(function (email) {
|
|
3820
1701
|
return typeof email === "string" ? {
|
|
3821
1702
|
label: email,
|
|
3822
1703
|
value: email,
|
|
3823
1704
|
valid: emailRegex.test(email)
|
|
3824
1705
|
} : email;
|
|
3825
1706
|
});
|
|
3826
|
-
return formattedEmails;
|
|
3827
1707
|
};
|
|
3828
1708
|
var getDetailsByValue = function getDetailsByValue(value, options) {
|
|
3829
1709
|
return options.find(function (option) {
|
|
@@ -3853,7 +1733,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3853
1733
|
if (action !== null && action !== void 0 && (_action$metadata = action.metadata) !== null && _action$metadata !== void 0 && _action$metadata.value) {
|
|
3854
1734
|
var selectedOption = opts.find(function (op) {
|
|
3855
1735
|
var _action$metadata2;
|
|
3856
|
-
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0
|
|
1736
|
+
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0 || (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value);
|
|
3857
1737
|
});
|
|
3858
1738
|
if (!selectedOption) {
|
|
3859
1739
|
return {
|
|
@@ -3870,7 +1750,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3870
1750
|
var Menu$9 = Dropdown$1.Menu,
|
|
3871
1751
|
MenuItem$9 = Dropdown$1.MenuItem;
|
|
3872
1752
|
var DropdownField$1 = function DropdownField(_ref) {
|
|
3873
|
-
var _actions$value$index$, _actions$value$index, _errors$actions,
|
|
1753
|
+
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions, _selectedField$separa, _defaultSelectedOptio;
|
|
3874
1754
|
var dropdownOptions = _ref.dropdownOptions,
|
|
3875
1755
|
name = _ref.name,
|
|
3876
1756
|
index = _ref.index,
|
|
@@ -3898,8 +1778,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3898
1778
|
setSearchTerm = _useState6[1];
|
|
3899
1779
|
var defaultValue = ((_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value) || ((_actions$value$index = actions.value[index]) === null || _actions$value$index === void 0 ? void 0 : _actions$value$index.value);
|
|
3900
1780
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
3901
|
-
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3902
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1781
|
+
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1782
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
3903
1783
|
var handleClose = function handleClose() {
|
|
3904
1784
|
setIsActive(false);
|
|
3905
1785
|
setSearchTerm("");
|
|
@@ -3952,7 +1832,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3952
1832
|
return !prevState;
|
|
3953
1833
|
});
|
|
3954
1834
|
}
|
|
3955
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
1835
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
3956
1836
|
onClose: handleClose
|
|
3957
1837
|
}, /*#__PURE__*/React.createElement(Menu$9, {
|
|
3958
1838
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4008,14 +1888,14 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
4008
1888
|
setFieldValue(name, editorData);
|
|
4009
1889
|
}, [debouncedValue]);
|
|
4010
1890
|
return /*#__PURE__*/React.createElement(FormikEditor, {
|
|
1891
|
+
label: label,
|
|
1892
|
+
name: name,
|
|
1893
|
+
variables: variables,
|
|
4011
1894
|
autoFocus: true,
|
|
4012
1895
|
hideSlashCommands: true,
|
|
4013
1896
|
addons: EDITOR_ADDONS,
|
|
4014
1897
|
className: "w-full",
|
|
4015
1898
|
"data-cy": "neeto-editor",
|
|
4016
|
-
label: label,
|
|
4017
|
-
name: name,
|
|
4018
|
-
variables: variables,
|
|
4019
1899
|
onChange: function onChange(value) {
|
|
4020
1900
|
return setEditorData(value);
|
|
4021
1901
|
}
|
|
@@ -4033,8 +1913,8 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4033
1913
|
return /*#__PURE__*/React.createElement("div", {
|
|
4034
1914
|
className: "mb-4"
|
|
4035
1915
|
}, /*#__PURE__*/React.createElement(MultiEmailInput, {
|
|
4036
|
-
label: t$1("neetoRules.common.emailIds"),
|
|
4037
1916
|
name: name,
|
|
1917
|
+
label: t$1("neetoRules.common.emailIds"),
|
|
4038
1918
|
placeholder: t$1("neetoRules.placeholders.emailField"),
|
|
4039
1919
|
ref: initialFocusRef,
|
|
4040
1920
|
value: formattedEmails,
|
|
@@ -4047,6 +1927,21 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4047
1927
|
}));
|
|
4048
1928
|
};
|
|
4049
1929
|
|
|
1930
|
+
function _extends() {
|
|
1931
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1932
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1933
|
+
var source = arguments[i];
|
|
1934
|
+
for (var key in source) {
|
|
1935
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1936
|
+
target[key] = source[key];
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
return target;
|
|
1941
|
+
};
|
|
1942
|
+
return _extends.apply(this, arguments);
|
|
1943
|
+
}
|
|
1944
|
+
|
|
4050
1945
|
var useDebouncedUpdate = function useDebouncedUpdate(value, setValue) {
|
|
4051
1946
|
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
|
4052
1947
|
var _useState = useState(value),
|
|
@@ -4089,7 +1984,7 @@ var InputField$2 = function InputField(_ref) {
|
|
|
4089
1984
|
};
|
|
4090
1985
|
|
|
4091
1986
|
var EmailFields = function EmailFields(_ref) {
|
|
4092
|
-
var _errors$actions,
|
|
1987
|
+
var _errors$actions, _touched$actions, _selectedField$separa, _action$metadata;
|
|
4093
1988
|
var _ref$isEmailIdField = _ref.isEmailIdField,
|
|
4094
1989
|
isEmailIdField = _ref$isEmailIdField === void 0 ? false : _ref$isEmailIdField,
|
|
4095
1990
|
name = _ref.name,
|
|
@@ -4109,8 +2004,8 @@ var EmailFields = function EmailFields(_ref) {
|
|
|
4109
2004
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4110
2005
|
return setShowPane(false);
|
|
4111
2006
|
});
|
|
4112
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4113
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2007
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2008
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
4114
2009
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || t$1("neetoRules.common.email");
|
|
4115
2010
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
4116
2011
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -4192,15 +2087,14 @@ var useCloseInputField = function useCloseInputField(ref, showInput, handler) {
|
|
|
4192
2087
|
};
|
|
4193
2088
|
};
|
|
4194
2089
|
useEffect(function () {
|
|
4195
|
-
if (showInput)
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
}
|
|
2090
|
+
if (!showInput) return;
|
|
2091
|
+
ref.current.focus();
|
|
2092
|
+
buttonPressed();
|
|
4199
2093
|
}, [showInput]);
|
|
4200
2094
|
};
|
|
4201
2095
|
|
|
4202
2096
|
var Input = function Input(_ref) {
|
|
4203
|
-
var _action$metadata, _selectedField$separa, _errors$actions,
|
|
2097
|
+
var _action$metadata, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4204
2098
|
var name = _ref.name,
|
|
4205
2099
|
index = _ref.index,
|
|
4206
2100
|
selectedField = _ref.selectedField;
|
|
@@ -4219,8 +2113,8 @@ var Input = function Input(_ref) {
|
|
|
4219
2113
|
var action = actions.value[index];
|
|
4220
2114
|
var valueTerm = (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value;
|
|
4221
2115
|
var label = valueTerm && isNotEmpty(valueTerm === null || valueTerm === void 0 ? void 0 : valueTerm.trim()) ? valueTerm : t$1("neetoRules.form.addValue");
|
|
4222
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4223
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2116
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
2117
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4224
2118
|
useEffect(function () {
|
|
4225
2119
|
setShowInput(false);
|
|
4226
2120
|
}, [action.name]);
|
|
@@ -4344,9 +2238,9 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4344
2238
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.save,
|
|
4345
2239
|
onClick: onSubmit
|
|
4346
2240
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
2241
|
+
ref: ref,
|
|
4347
2242
|
"data-cy": "inline-input-cancel-button",
|
|
4348
2243
|
icon: Close,
|
|
4349
|
-
ref: ref,
|
|
4350
2244
|
style: "text",
|
|
4351
2245
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.cancel,
|
|
4352
2246
|
onClick: handleCancel
|
|
@@ -4356,7 +2250,7 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4356
2250
|
InlineInput.displayName = "InlineInput";
|
|
4357
2251
|
|
|
4358
2252
|
var ListField = function ListField(_ref) {
|
|
4359
|
-
var _errors$actions,
|
|
2253
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4360
2254
|
var name = _ref.name,
|
|
4361
2255
|
_ref$values = _ref.values,
|
|
4362
2256
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
@@ -4377,8 +2271,8 @@ var ListField = function ListField(_ref) {
|
|
|
4377
2271
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4378
2272
|
return setShowPane(false);
|
|
4379
2273
|
});
|
|
4380
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4381
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2274
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2275
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
4382
2276
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
4383
2277
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
4384
2278
|
"data-cy": "list-action-separator-text",
|
|
@@ -4416,7 +2310,7 @@ var ListField = function ListField(_ref) {
|
|
|
4416
2310
|
}, function (arrayHelper) {
|
|
4417
2311
|
return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (item, index) {
|
|
4418
2312
|
return /*#__PURE__*/React.createElement("div", {
|
|
4419
|
-
className: "flex flex-wrap justify-between border border-dashed
|
|
2313
|
+
className: "neeto-ui-bg-white flex flex-wrap justify-between border border-dashed px-2 py-1",
|
|
4420
2314
|
key: "".concat(item, ".").concat(index)
|
|
4421
2315
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
4422
2316
|
className: "w-4/5 overflow-x-auto",
|
|
@@ -4433,8 +2327,8 @@ var ListField = function ListField(_ref) {
|
|
|
4433
2327
|
}
|
|
4434
2328
|
}));
|
|
4435
2329
|
}), /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
4436
|
-
|
|
4437
|
-
|
|
2330
|
+
name: name,
|
|
2331
|
+
className: "w-full"
|
|
4438
2332
|
}, function (message) {
|
|
4439
2333
|
return /*#__PURE__*/React.createElement(Typography, {
|
|
4440
2334
|
className: "neeto-ui-text-error-500 neeto-ui-text-gray-700 mt-1",
|
|
@@ -4479,7 +2373,7 @@ var ListField = function ListField(_ref) {
|
|
|
4479
2373
|
var Menu$8 = Dropdown$1.Menu,
|
|
4480
2374
|
MenuItem$8 = Dropdown$1.MenuItem;
|
|
4481
2375
|
var MultiSelect$1 = function MultiSelect(_ref) {
|
|
4482
|
-
var _selectedField$placeh, _selectedField$separa, _errors$actions,
|
|
2376
|
+
var _selectedField$placeh, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4483
2377
|
var _ref$values = _ref.values,
|
|
4484
2378
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
4485
2379
|
_ref$dropDownOptions = _ref.dropDownOptions,
|
|
@@ -4506,10 +2400,10 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4506
2400
|
});
|
|
4507
2401
|
}, [values, dropDownOptions]);
|
|
4508
2402
|
var selectedOptions = getSelectedOptions(allOptions);
|
|
4509
|
-
var defaultLabel = (selectedField === null || selectedField === void 0
|
|
2403
|
+
var defaultLabel = (selectedField === null || selectedField === void 0 || (_selectedField$placeh = selectedField.placeholder) === null || _selectedField$placeh === void 0 ? void 0 : _selectedField$placeh.toLowerCase()) || t$1("neetoRules.form.selectValues").toLowerCase();
|
|
4510
2404
|
var searchedOptions = getSearchedOptions$3(dropDownOptions, searchTerm);
|
|
4511
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4512
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2405
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
2406
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4513
2407
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4514
2408
|
var options = values.includes(option.value) ? without([option.value], values) : append(option.value, values);
|
|
4515
2409
|
setFieldValue(name, options);
|
|
@@ -4535,7 +2429,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4535
2429
|
className: "flex flex-wrap",
|
|
4536
2430
|
key: idx
|
|
4537
2431
|
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
4538
|
-
className: "neeto-ui-text-gray-700
|
|
2432
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
4539
2433
|
style: "h5",
|
|
4540
2434
|
weight: "normal",
|
|
4541
2435
|
onClick: function onClick(e) {
|
|
@@ -4547,7 +2441,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4547
2441
|
"data-cy": "multi-select-action-button",
|
|
4548
2442
|
style: "h5",
|
|
4549
2443
|
weight: "semibold",
|
|
4550
|
-
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2444
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
4551
2445
|
"neeto-ui-text-primary-800": activeOption === (option === null || option === void 0 ? void 0 : option.value)
|
|
4552
2446
|
}),
|
|
4553
2447
|
onClick: function onClick() {
|
|
@@ -4601,7 +2495,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4601
2495
|
};
|
|
4602
2496
|
|
|
4603
2497
|
var NoteField = function NoteField(_ref) {
|
|
4604
|
-
var _errors$actions,
|
|
2498
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4605
2499
|
var name = _ref.name,
|
|
4606
2500
|
_ref$value = _ref.value,
|
|
4607
2501
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -4618,8 +2512,8 @@ var NoteField = function NoteField(_ref) {
|
|
|
4618
2512
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4619
2513
|
return setShowPane(false);
|
|
4620
2514
|
});
|
|
4621
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4622
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2515
|
+
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2516
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
4623
2517
|
var variables = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables) || [];
|
|
4624
2518
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || t$1("neetoRules.form.note");
|
|
4625
2519
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -4684,55 +2578,55 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4684
2578
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailToIds) {
|
|
4685
2579
|
var _action$metadata;
|
|
4686
2580
|
return /*#__PURE__*/React.createElement(EmailFields, {
|
|
4687
|
-
isEmailIdField: true,
|
|
4688
2581
|
action: action,
|
|
4689
|
-
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
4690
2582
|
index: index,
|
|
4691
|
-
key: name,
|
|
4692
2583
|
name: name,
|
|
4693
|
-
selectedField: selectedField
|
|
2584
|
+
selectedField: selectedField,
|
|
2585
|
+
isEmailIdField: true,
|
|
2586
|
+
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
2587
|
+
key: name
|
|
4694
2588
|
});
|
|
4695
2589
|
}
|
|
4696
2590
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.email) {
|
|
4697
2591
|
return /*#__PURE__*/React.createElement(EmailFields, {
|
|
4698
2592
|
action: action,
|
|
4699
2593
|
index: index,
|
|
4700
|
-
key: name,
|
|
4701
2594
|
name: name,
|
|
4702
|
-
selectedField: selectedField
|
|
2595
|
+
selectedField: selectedField,
|
|
2596
|
+
key: name
|
|
4703
2597
|
});
|
|
4704
2598
|
}
|
|
4705
2599
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailTo) {
|
|
4706
2600
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownField$1, {
|
|
4707
|
-
dropdownOptions: options,
|
|
4708
2601
|
index: index,
|
|
2602
|
+
selectedField: selectedField,
|
|
2603
|
+
dropdownOptions: options,
|
|
4709
2604
|
key: "".concat(name, ".value"),
|
|
4710
|
-
name: "".concat(name, ".value")
|
|
4711
|
-
selectedField: selectedField
|
|
2605
|
+
name: "".concat(name, ".value")
|
|
4712
2606
|
}), /*#__PURE__*/React.createElement(EmailFields, {
|
|
4713
2607
|
action: action,
|
|
4714
2608
|
index: index,
|
|
4715
|
-
key: name,
|
|
4716
2609
|
name: name,
|
|
4717
|
-
selectedField: selectedField
|
|
2610
|
+
selectedField: selectedField,
|
|
2611
|
+
key: name
|
|
4718
2612
|
}));
|
|
4719
2613
|
}
|
|
4720
2614
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.dropdown) {
|
|
4721
2615
|
return /*#__PURE__*/React.createElement(DropdownField$1, {
|
|
4722
|
-
dropdownOptions: options,
|
|
4723
2616
|
index: index,
|
|
2617
|
+
selectedField: selectedField,
|
|
2618
|
+
dropdownOptions: options,
|
|
4724
2619
|
key: name,
|
|
4725
|
-
name: "".concat(name, ".value")
|
|
4726
|
-
selectedField: selectedField
|
|
2620
|
+
name: "".concat(name, ".value")
|
|
4727
2621
|
});
|
|
4728
2622
|
}
|
|
4729
2623
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.note) {
|
|
4730
2624
|
var _action$metadata2;
|
|
4731
2625
|
return /*#__PURE__*/React.createElement(NoteField, {
|
|
4732
2626
|
index: index,
|
|
2627
|
+
selectedField: selectedField,
|
|
4733
2628
|
key: name,
|
|
4734
2629
|
name: "".concat(name, ".value"),
|
|
4735
|
-
selectedField: selectedField,
|
|
4736
2630
|
value: (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value
|
|
4737
2631
|
});
|
|
4738
2632
|
}
|
|
@@ -4740,20 +2634,20 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4740
2634
|
var _action$metadata3;
|
|
4741
2635
|
return /*#__PURE__*/React.createElement(ListField, {
|
|
4742
2636
|
index: index,
|
|
2637
|
+
selectedField: selectedField,
|
|
4743
2638
|
key: name,
|
|
4744
2639
|
name: "".concat(name, ".value"),
|
|
4745
|
-
selectedField: selectedField,
|
|
4746
2640
|
values: (_action$metadata3 = action.metadata) === null || _action$metadata3 === void 0 ? void 0 : _action$metadata3.value
|
|
4747
2641
|
});
|
|
4748
2642
|
}
|
|
4749
2643
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.multiSelect) {
|
|
4750
2644
|
var _action$metadata4;
|
|
4751
2645
|
return /*#__PURE__*/React.createElement(MultiSelect$1, {
|
|
4752
|
-
dropDownOptions: options,
|
|
4753
2646
|
index: index,
|
|
2647
|
+
selectedField: selectedField,
|
|
2648
|
+
dropDownOptions: options,
|
|
4754
2649
|
key: name,
|
|
4755
2650
|
name: "".concat(name, ".value"),
|
|
4756
|
-
selectedField: selectedField,
|
|
4757
2651
|
values: (_action$metadata4 = action.metadata) === null || _action$metadata4 === void 0 ? void 0 : _action$metadata4.value
|
|
4758
2652
|
});
|
|
4759
2653
|
}
|
|
@@ -4774,12 +2668,12 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4774
2668
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.longText || (selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.textarea) {
|
|
4775
2669
|
var _action$metadata5;
|
|
4776
2670
|
return /*#__PURE__*/React.createElement(LongTextField, {
|
|
2671
|
+
index: index,
|
|
2672
|
+
selectedField: selectedField,
|
|
4777
2673
|
defaultLabel: t("neetoRules.labels.body"),
|
|
4778
2674
|
defaultSeparator: t("neetoRules.common.as"),
|
|
4779
|
-
index: index,
|
|
4780
2675
|
key: name,
|
|
4781
2676
|
name: "".concat(name, ".value"),
|
|
4782
|
-
selectedField: selectedField,
|
|
4783
2677
|
value: (_action$metadata5 = action.metadata) === null || _action$metadata5 === void 0 ? void 0 : _action$metadata5.value
|
|
4784
2678
|
});
|
|
4785
2679
|
}
|
|
@@ -4800,7 +2694,7 @@ var ActionSubItem = /*#__PURE__*/memo(ActionSubItems);
|
|
|
4800
2694
|
var Menu$7 = Dropdown$1.Menu,
|
|
4801
2695
|
MenuItem$7 = Dropdown$1.MenuItem;
|
|
4802
2696
|
var ActionItem = function ActionItem(_ref) {
|
|
4803
|
-
var _errors$actions,
|
|
2697
|
+
var _errors$actions, _touched$actions, _selectedOption$label;
|
|
4804
2698
|
var name = _ref.name,
|
|
4805
2699
|
action = _ref.action,
|
|
4806
2700
|
index = _ref.index,
|
|
@@ -4839,7 +2733,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4839
2733
|
return getFieldDetails$1(action.name, actionOptions);
|
|
4840
2734
|
}, [action, actionOptions]);
|
|
4841
2735
|
var searchedOptions = getSearchedOptions$3(actionOptions, searchTerm);
|
|
4842
|
-
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === t$1("neetoRules.form.doThis") && errors.actions && touched.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2736
|
+
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === t$1("neetoRules.form.doThis") && errors.actions && touched.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4843
2737
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4844
2738
|
setFieldValue("".concat(name, ".name"), option.value);
|
|
4845
2739
|
setFieldValue("".concat(name, ".metadata"), {});
|
|
@@ -4899,7 +2793,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4899
2793
|
return !prevState;
|
|
4900
2794
|
});
|
|
4901
2795
|
}
|
|
4902
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2796
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
4903
2797
|
onClose: handleClose
|
|
4904
2798
|
}, /*#__PURE__*/React.createElement(Menu$7, {
|
|
4905
2799
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4934,9 +2828,9 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4934
2828
|
}, t$1("neetoRules.common.noOptions")))), /*#__PURE__*/React.createElement(ActionSubItem, {
|
|
4935
2829
|
action: action,
|
|
4936
2830
|
index: index,
|
|
2831
|
+
selectedField: selectedField,
|
|
4937
2832
|
name: "".concat(name, ".metadata"),
|
|
4938
|
-
options: getSelectedFieldOptions()
|
|
4939
|
-
selectedField: selectedField
|
|
2833
|
+
options: getSelectedFieldOptions()
|
|
4940
2834
|
}));
|
|
4941
2835
|
};
|
|
4942
2836
|
var ActionItem$1 = /*#__PURE__*/memo(ActionItem);
|
|
@@ -4964,7 +2858,7 @@ var Actions = function Actions(_ref) {
|
|
|
4964
2858
|
_ref$showAddButton = _ref.showAddButton,
|
|
4965
2859
|
showAddButton = _ref$showAddButton === void 0 ? true : _ref$showAddButton,
|
|
4966
2860
|
_ref$handleSlackChann = _ref.handleSlackChannelRefresh,
|
|
4967
|
-
handleSlackChannelRefresh = _ref$handleSlackChann === void 0 ? noop
|
|
2861
|
+
handleSlackChannelRefresh = _ref$handleSlackChann === void 0 ? noop : _ref$handleSlackChann;
|
|
4968
2862
|
var _useFormikContext = useFormikContext(),
|
|
4969
2863
|
values = _useFormikContext.values,
|
|
4970
2864
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
@@ -4997,10 +2891,10 @@ var Actions = function Actions(_ref) {
|
|
|
4997
2891
|
action: action,
|
|
4998
2892
|
elementProps: elementProps,
|
|
4999
2893
|
index: index,
|
|
5000
|
-
|
|
5001
|
-
parentName: name,
|
|
2894
|
+
onSelectAction: onSelectAction,
|
|
5002
2895
|
selectedActionOptions: selectedActionOptions,
|
|
5003
|
-
|
|
2896
|
+
name: "".concat(name, ".value.").concat(index),
|
|
2897
|
+
parentName: name
|
|
5004
2898
|
}), /*#__PURE__*/React.createElement("div", {
|
|
5005
2899
|
className: "-mx-1 flex flex-wrap"
|
|
5006
2900
|
}, handleSlackChannelRefresh && action.name === "message_to_slack" && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -5066,13 +2960,12 @@ var getSearchedOptions$2 = function getSearchedOptions(dropDownOptions, searchTe
|
|
|
5066
2960
|
});
|
|
5067
2961
|
};
|
|
5068
2962
|
var getAllOptions = function getAllOptions(options) {
|
|
5069
|
-
|
|
2963
|
+
return Array.isArray(options) ? options.map(function (option) {
|
|
5070
2964
|
return {
|
|
5071
2965
|
label: option,
|
|
5072
2966
|
value: option
|
|
5073
2967
|
};
|
|
5074
2968
|
}) : [];
|
|
5075
|
-
return allOptions;
|
|
5076
2969
|
};
|
|
5077
2970
|
|
|
5078
2971
|
var Menu$6 = Dropdown$1.Menu,
|
|
@@ -5131,7 +3024,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5131
3024
|
return !prevState;
|
|
5132
3025
|
});
|
|
5133
3026
|
}
|
|
5134
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3027
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
5135
3028
|
onClose: handleClose
|
|
5136
3029
|
}, /*#__PURE__*/React.createElement(Menu$6, {
|
|
5137
3030
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5174,7 +3067,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5174
3067
|
var Menu$5 = Dropdown$1.Menu,
|
|
5175
3068
|
MenuItem$5 = Dropdown$1.MenuItem;
|
|
5176
3069
|
var Dropdown = function Dropdown(_ref) {
|
|
5177
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3070
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions, _defaultSelectedOptio;
|
|
5178
3071
|
var name = _ref.name,
|
|
5179
3072
|
options = _ref.options,
|
|
5180
3073
|
index = _ref.index;
|
|
@@ -5201,7 +3094,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5201
3094
|
setSearchTerm = _useState6[1];
|
|
5202
3095
|
var defaultValue = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5203
3096
|
var searchedOptions = getSearchedOptions$2(options, searchTerm);
|
|
5204
|
-
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3097
|
+
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5205
3098
|
var handleClose = function handleClose() {
|
|
5206
3099
|
setIsActive(false);
|
|
5207
3100
|
setSearchTerm("");
|
|
@@ -5248,7 +3141,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5248
3141
|
return !prevState;
|
|
5249
3142
|
});
|
|
5250
3143
|
}
|
|
5251
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
3144
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
5252
3145
|
onClose: handleClose
|
|
5253
3146
|
}, /*#__PURE__*/React.createElement(Menu$5, {
|
|
5254
3147
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5287,7 +3180,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5287
3180
|
};
|
|
5288
3181
|
|
|
5289
3182
|
var InputField$1 = function InputField(_ref) {
|
|
5290
|
-
var _condition$metadata,
|
|
3183
|
+
var _condition$metadata, _errors$conditions, _touched$conditions;
|
|
5291
3184
|
var name = _ref.name,
|
|
5292
3185
|
index = _ref.index,
|
|
5293
3186
|
placeholder = _ref.placeholder;
|
|
@@ -5304,9 +3197,9 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5304
3197
|
return setShowInput(false);
|
|
5305
3198
|
});
|
|
5306
3199
|
var condition = conditions.value[index];
|
|
5307
|
-
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0
|
|
3200
|
+
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 || (_condition$metadata = _condition$metadata.value) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.toString();
|
|
5308
3201
|
var label = valueTerm && valueTerm !== null && valueTerm !== void 0 && valueTerm.trim().length ? valueTerm : t$1("neetoRules.form.addValue");
|
|
5309
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3202
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5310
3203
|
useEffect(function () {
|
|
5311
3204
|
setShowInput(false);
|
|
5312
3205
|
}, [condition.verb]);
|
|
@@ -5340,7 +3233,7 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5340
3233
|
var Menu$4 = Dropdown$1.Menu,
|
|
5341
3234
|
MenuItem$4 = Dropdown$1.MenuItem;
|
|
5342
3235
|
var MultiSelect = function MultiSelect(_ref) {
|
|
5343
|
-
var _conditions$value$ind,
|
|
3236
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5344
3237
|
var name = _ref.name,
|
|
5345
3238
|
dropDownOptions = _ref.dropDownOptions,
|
|
5346
3239
|
index = _ref.index;
|
|
@@ -5358,14 +3251,14 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5358
3251
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
5359
3252
|
searchTerm = _useState4[0],
|
|
5360
3253
|
setSearchTerm = _useState4[1];
|
|
5361
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
3254
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
5362
3255
|
var selectedOptions = values || [];
|
|
5363
3256
|
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
5364
3257
|
var options = dropDownOptions === null || dropDownOptions === void 0 ? void 0 : dropDownOptions.filter(function (option) {
|
|
5365
3258
|
return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value);
|
|
5366
3259
|
});
|
|
5367
3260
|
var searchedOptions = getSearchedOptions$2(dropDownOptions, searchTerm);
|
|
5368
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3261
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5369
3262
|
var handleMultiSelectOption = function handleMultiSelectOption(value) {
|
|
5370
3263
|
var options = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(value) ? without([value], selectedOptions) : append(value, selectedOptions);
|
|
5371
3264
|
setFieldValue(name, options);
|
|
@@ -5386,21 +3279,21 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5386
3279
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
5387
3280
|
key: idx
|
|
5388
3281
|
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
5389
|
-
className: "neeto-ui-text-gray-700
|
|
3282
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
5390
3283
|
style: "h5",
|
|
5391
3284
|
weight: "normal"
|
|
5392
3285
|
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(Typography, {
|
|
5393
3286
|
"data-cy": "condition-value-multi-select-field",
|
|
5394
3287
|
style: "h5",
|
|
5395
3288
|
weight: "semibold",
|
|
5396
|
-
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
3289
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
5397
3290
|
"neeto-ui-text-primary-800": activeOption === option.value
|
|
5398
3291
|
}),
|
|
5399
3292
|
onClick: function onClick() {
|
|
5400
3293
|
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
5401
3294
|
setActiveOption(activeOption ? null : option.value);
|
|
5402
3295
|
}
|
|
5403
|
-
}, option === null || option === void 0
|
|
3296
|
+
}, option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toLowerCase()));
|
|
5404
3297
|
})) : /*#__PURE__*/React.createElement(Typography, {
|
|
5405
3298
|
"data-cy": "condition-value-multi-select-field",
|
|
5406
3299
|
style: "h5",
|
|
@@ -5449,7 +3342,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5449
3342
|
|
|
5450
3343
|
var _excluded$6 = ["name", "index"];
|
|
5451
3344
|
var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
5452
|
-
var _conditions$value$ind,
|
|
3345
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5453
3346
|
var name = _ref.name,
|
|
5454
3347
|
index = _ref.index,
|
|
5455
3348
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
@@ -5467,10 +3360,10 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5467
3360
|
useOnButtonPressed(initialFocusRef, function () {
|
|
5468
3361
|
return setShowPane(false);
|
|
5469
3362
|
});
|
|
5470
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
3363
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
5471
3364
|
var allOptions = getAllOptions(values);
|
|
5472
3365
|
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
5473
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3366
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5474
3367
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isEmpty(allOptions) && /*#__PURE__*/React.createElement(Typography, {
|
|
5475
3368
|
"data-cy": "condition-value-multi-select-create-button",
|
|
5476
3369
|
style: "h5",
|
|
@@ -5543,7 +3436,7 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5543
3436
|
};
|
|
5544
3437
|
|
|
5545
3438
|
var DateField = function DateField(_ref) {
|
|
5546
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3439
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5547
3440
|
var name = _ref.name,
|
|
5548
3441
|
index = _ref.index,
|
|
5549
3442
|
conditionName = _ref.conditionName;
|
|
@@ -5560,30 +3453,28 @@ var DateField = function DateField(_ref) {
|
|
|
5560
3453
|
setShowInput = _useState2[1];
|
|
5561
3454
|
var valueTerm = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5562
3455
|
var label = valueTerm || t$1("neetoRules.form.selectDate").toLowerCase();
|
|
5563
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3456
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5564
3457
|
var handleValidate = /*#__PURE__*/function () {
|
|
5565
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
5566
|
-
return
|
|
5567
|
-
while (1) {
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
if (isEmpty(errors)) {
|
|
5572
|
-
_context.next = 4;
|
|
5573
|
-
break;
|
|
5574
|
-
}
|
|
3458
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3459
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3460
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3461
|
+
case 0:
|
|
3462
|
+
_context.prev = 0;
|
|
3463
|
+
if (isEmpty(errors)) {
|
|
5575
3464
|
_context.next = 4;
|
|
5576
|
-
return validateField(conditionName);
|
|
5577
|
-
case 4:
|
|
5578
|
-
_context.next = 8;
|
|
5579
3465
|
break;
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
3466
|
+
}
|
|
3467
|
+
_context.next = 4;
|
|
3468
|
+
return validateField(conditionName);
|
|
3469
|
+
case 4:
|
|
3470
|
+
_context.next = 8;
|
|
3471
|
+
break;
|
|
3472
|
+
case 6:
|
|
3473
|
+
_context.prev = 6;
|
|
3474
|
+
_context.t0 = _context["catch"](0);
|
|
3475
|
+
case 8:
|
|
3476
|
+
case "end":
|
|
3477
|
+
return _context.stop();
|
|
5587
3478
|
}
|
|
5588
3479
|
}, _callee, null, [[0, 6]]);
|
|
5589
3480
|
}));
|
|
@@ -5645,8 +3536,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5645
3536
|
if (INPUT_FIELD_TYPES.includes(fieldType)) {
|
|
5646
3537
|
return /*#__PURE__*/React.createElement(InputField$1, {
|
|
5647
3538
|
conditionName: conditionName,
|
|
5648
|
-
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5649
3539
|
index: index,
|
|
3540
|
+
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5650
3541
|
name: "".concat(name, ".value"),
|
|
5651
3542
|
placeholder: t("neetoRules.common.value")
|
|
5652
3543
|
});
|
|
@@ -5654,8 +3545,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5654
3545
|
if (fieldType === CONDITION_VALUE_TYPES.textarea) {
|
|
5655
3546
|
var _condition$metadata;
|
|
5656
3547
|
return /*#__PURE__*/React.createElement(LongTextField, {
|
|
5657
|
-
defaultLabel: t("neetoRules.labels.text"),
|
|
5658
3548
|
index: index,
|
|
3549
|
+
defaultLabel: t("neetoRules.labels.text"),
|
|
5659
3550
|
name: "".concat(name, ".value"),
|
|
5660
3551
|
value: (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.value
|
|
5661
3552
|
});
|
|
@@ -5663,23 +3554,23 @@ var ValueField = function ValueField(_ref) {
|
|
|
5663
3554
|
if (fieldType === CONDITION_VALUE_TYPES.dropdown) {
|
|
5664
3555
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
5665
3556
|
index: index,
|
|
5666
|
-
|
|
5667
|
-
|
|
3557
|
+
options: options,
|
|
3558
|
+
name: "".concat(name, ".value")
|
|
5668
3559
|
});
|
|
5669
3560
|
}
|
|
5670
3561
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelect) {
|
|
5671
3562
|
return /*#__PURE__*/React.createElement(MultiSelect, {
|
|
5672
|
-
dropDownOptions: options,
|
|
5673
3563
|
index: index,
|
|
3564
|
+
dropDownOptions: options,
|
|
5674
3565
|
name: "".concat(name, ".values")
|
|
5675
3566
|
});
|
|
5676
3567
|
}
|
|
5677
3568
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelectCreate) {
|
|
5678
3569
|
return /*#__PURE__*/React.createElement(MultiSelectCreate, {
|
|
5679
|
-
isCreateable: true,
|
|
5680
3570
|
index: index,
|
|
5681
|
-
name: "".concat(name, ".values"),
|
|
5682
3571
|
options: options,
|
|
3572
|
+
isCreateable: true,
|
|
3573
|
+
name: "".concat(name, ".values"),
|
|
5683
3574
|
placeholder: t("neetoRules.placeholders.multiSelect")
|
|
5684
3575
|
});
|
|
5685
3576
|
}
|
|
@@ -5744,22 +3635,22 @@ var ConditionItem = function ConditionItem(_ref) {
|
|
|
5744
3635
|
style: "h5",
|
|
5745
3636
|
weight: "normal"
|
|
5746
3637
|
}, defaultLabel), /*#__PURE__*/React.createElement(DropdownField, {
|
|
3638
|
+
index: index,
|
|
5747
3639
|
fieldType: "field",
|
|
5748
3640
|
handleSelect: handleFieldChange,
|
|
5749
|
-
index: index,
|
|
5750
3641
|
options: conditionOptions,
|
|
5751
3642
|
placeholder: t("neetoRules.form.selectField")
|
|
5752
3643
|
}), /*#__PURE__*/React.createElement(DropdownField, {
|
|
3644
|
+
index: index,
|
|
5753
3645
|
fieldType: "verb",
|
|
5754
3646
|
handleSelect: handleVerbChange,
|
|
5755
|
-
index: index,
|
|
5756
3647
|
options: verbOptions,
|
|
5757
3648
|
placeholder: t("neetoRules.form.selectVerb")
|
|
5758
3649
|
}), /*#__PURE__*/React.createElement(ValueField, {
|
|
5759
3650
|
condition: condition,
|
|
3651
|
+
index: index,
|
|
5760
3652
|
conditionName: name,
|
|
5761
3653
|
field: selectedField,
|
|
5762
|
-
index: index,
|
|
5763
3654
|
name: "".concat(name, ".metadata"),
|
|
5764
3655
|
options: getSelectedFieldOptions()
|
|
5765
3656
|
}));
|
|
@@ -5805,7 +3696,7 @@ var Conditions = function Conditions(_ref) {
|
|
|
5805
3696
|
var _elementProps$conditi;
|
|
5806
3697
|
arrayHelpers.push({
|
|
5807
3698
|
field: elementProps === null || elementProps === void 0 ? void 0 : elementProps.conditionOptions[0].value,
|
|
5808
|
-
verb: elementProps === null || elementProps === void 0
|
|
3699
|
+
verb: elementProps === null || elementProps === void 0 || (_elementProps$conditi = elementProps.conditionOptions[0]) === null || _elementProps$conditi === void 0 ? void 0 : _elementProps$conditi.allowMatching[0],
|
|
5809
3700
|
joinType: logicOperation,
|
|
5810
3701
|
metadata: {}
|
|
5811
3702
|
});
|
|
@@ -5846,10 +3737,10 @@ var Conditions = function Conditions(_ref) {
|
|
|
5846
3737
|
elementProps: elementProps,
|
|
5847
3738
|
index: index,
|
|
5848
3739
|
isWithEvents: isWithEvents,
|
|
5849
|
-
|
|
5850
|
-
name: "".concat(name, ".value.").concat(index),
|
|
3740
|
+
onSelectCondition: onSelectCondition,
|
|
5851
3741
|
selectedConditionOptions: selectedConditionOptions,
|
|
5852
|
-
|
|
3742
|
+
key: index,
|
|
3743
|
+
name: "".concat(name, ".value.").concat(index)
|
|
5853
3744
|
})), /*#__PURE__*/React.createElement("div", {
|
|
5854
3745
|
className: "flex"
|
|
5855
3746
|
}, index === conditions.length - 1 && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -6008,7 +3899,7 @@ var Performer$1 = function Performer(_ref) {
|
|
|
6008
3899
|
return !prevState;
|
|
6009
3900
|
});
|
|
6010
3901
|
}
|
|
6011
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3902
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6012
3903
|
onClose: handleClose
|
|
6013
3904
|
}, /*#__PURE__*/React.createElement(Menu$3, {
|
|
6014
3905
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6172,7 +4063,7 @@ var Events$1 = function Events(_ref) {
|
|
|
6172
4063
|
onClick: function onClick() {
|
|
6173
4064
|
return setActiveOption(activeOption ? null : event.value);
|
|
6174
4065
|
}
|
|
6175
|
-
}, event === null || event === void 0
|
|
4066
|
+
}, event === null || event === void 0 || (_event$label = event.label) === null || _event$label === void 0 ? void 0 : _event$label.toLowerCase()));
|
|
6176
4067
|
})) : /*#__PURE__*/React.createElement(Typography, {
|
|
6177
4068
|
"data-cy": "condition-value-multi-select-field",
|
|
6178
4069
|
style: "h5",
|
|
@@ -6242,7 +4133,7 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6242
4133
|
var _conditionProps$condi;
|
|
6243
4134
|
setFieldValue("".concat(conditionsName, ".value"), [{
|
|
6244
4135
|
field: conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.conditionOptions[0].value,
|
|
6245
|
-
verb: conditionProps === null || conditionProps === void 0
|
|
4136
|
+
verb: conditionProps === null || conditionProps === void 0 || (_conditionProps$condi = conditionProps.conditionOptions[0]) === null || _conditionProps$condi === void 0 ? void 0 : _conditionProps$condi.allowMatching[0],
|
|
6246
4137
|
joinType: OPERATORS.or,
|
|
6247
4138
|
metadata: {}
|
|
6248
4139
|
}]);
|
|
@@ -6258,8 +4149,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6258
4149
|
}, /*#__PURE__*/React.createElement(Events$1, {
|
|
6259
4150
|
data: data,
|
|
6260
4151
|
name: name,
|
|
6261
|
-
|
|
6262
|
-
|
|
4152
|
+
onSelectEvent: onSelectEvent,
|
|
4153
|
+
performerName: performerName
|
|
6263
4154
|
})), showAddButton && /*#__PURE__*/React.createElement(Button, {
|
|
6264
4155
|
"data-cy": "add-condition-button",
|
|
6265
4156
|
"data-test-id": "automation-rules-add-events-button",
|
|
@@ -6274,8 +4165,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6274
4165
|
})), !showAddButton && /*#__PURE__*/React.createElement("div", {
|
|
6275
4166
|
className: "mt-3"
|
|
6276
4167
|
}, /*#__PURE__*/React.createElement(Conditions, _extends({
|
|
6277
|
-
isWithEvents: true,
|
|
6278
4168
|
data: data,
|
|
4169
|
+
isWithEvents: true,
|
|
6279
4170
|
name: conditionsName
|
|
6280
4171
|
}, config)))));
|
|
6281
4172
|
};
|
|
@@ -6478,7 +4369,7 @@ var Performer = function Performer(_ref) {
|
|
|
6478
4369
|
return !prevState;
|
|
6479
4370
|
});
|
|
6480
4371
|
}
|
|
6481
|
-
}, selectedOption === null || selectedOption === void 0
|
|
4372
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6482
4373
|
onClose: handleClose
|
|
6483
4374
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
6484
4375
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6539,10 +4430,9 @@ var Events = function Events(_ref) {
|
|
|
6539
4430
|
arrayHelpers.remove(index);
|
|
6540
4431
|
};
|
|
6541
4432
|
var popEvent = function popEvent(arrayHelpers) {
|
|
6542
|
-
if (isNotEmpty(arrayHelpers) && isNotEmpty(events))
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
}
|
|
4433
|
+
if (!(isNotEmpty(arrayHelpers) && isNotEmpty(events))) return;
|
|
4434
|
+
var eventIdx = events.length - 1;
|
|
4435
|
+
_removeEvent(eventIdx, events[eventIdx], arrayHelpers);
|
|
6546
4436
|
};
|
|
6547
4437
|
var handleAddEvent = function handleAddEvent(arrayHelpers) {
|
|
6548
4438
|
return arrayHelpers.push({
|
|
@@ -6583,7 +4473,7 @@ var Events = function Events(_ref) {
|
|
|
6583
4473
|
return /*#__PURE__*/React.createElement("div", {
|
|
6584
4474
|
className: "flex justify-between"
|
|
6585
4475
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6586
|
-
className: classNames("flex flex-wrap gap-
|
|
4476
|
+
className: classNames("flex flex-wrap gap-x-2 gap-y-2", {
|
|
6587
4477
|
"max-w-2xl": showAddButton
|
|
6588
4478
|
})
|
|
6589
4479
|
}, showMessage && /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -6606,12 +4496,12 @@ var Events = function Events(_ref) {
|
|
|
6606
4496
|
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(EventItem, {
|
|
6607
4497
|
elementProps: elementProps,
|
|
6608
4498
|
event: event,
|
|
4499
|
+
onSelectEvent: onSelectEvent,
|
|
6609
4500
|
name: "".concat(name, ".value.").concat(index, ".name"),
|
|
6610
4501
|
parentName: name,
|
|
6611
4502
|
removeEvent: function removeEvent() {
|
|
6612
4503
|
return _removeEvent(index, event, arrayHelpers);
|
|
6613
|
-
}
|
|
6614
|
-
onSelectEvent: onSelectEvent
|
|
4504
|
+
}
|
|
6615
4505
|
}));
|
|
6616
4506
|
}), !showMessage && /*#__PURE__*/React.createElement(Performer, {
|
|
6617
4507
|
data: data,
|
|
@@ -6716,9 +4606,9 @@ var RadioField = function RadioField(_ref) {
|
|
|
6716
4606
|
var label = _ref2.label,
|
|
6717
4607
|
value = _ref2.value;
|
|
6718
4608
|
return /*#__PURE__*/React.createElement(Radio.Item, {
|
|
6719
|
-
key: index,
|
|
6720
4609
|
label: label,
|
|
6721
|
-
value: value
|
|
4610
|
+
value: value,
|
|
4611
|
+
key: index
|
|
6722
4612
|
});
|
|
6723
4613
|
})));
|
|
6724
4614
|
};
|