sweetalert2 11.9.0 → 11.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sweetalert2.all.js +1040 -688
- package/dist/sweetalert2.all.min.js +3 -3
- package/dist/sweetalert2.css +6 -12
- package/dist/sweetalert2.js +1039 -687
- package/dist/sweetalert2.min.css +1 -1
- package/dist/sweetalert2.min.js +2 -2
- package/package.json +1 -1
- package/src/SweetAlert.js +7 -1
- package/src/scss/_core.scss +6 -12
- package/src/utils/openPopup.js +13 -9
- package/src/utils/params.js +1 -0
- package/sweetalert2.d.ts +47 -27
package/dist/sweetalert2.all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* sweetalert2 v11.
|
|
2
|
+
* sweetalert2 v11.10.0
|
|
3
3
|
* Released under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -8,6 +8,218 @@
|
|
|
8
8
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Sweetalert2 = factory());
|
|
9
9
|
})(this, (function () { 'use strict';
|
|
10
10
|
|
|
11
|
+
function _iterableToArrayLimit(r, l) {
|
|
12
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
13
|
+
if (null != t) {
|
|
14
|
+
var e,
|
|
15
|
+
n,
|
|
16
|
+
i,
|
|
17
|
+
u,
|
|
18
|
+
a = [],
|
|
19
|
+
f = !0,
|
|
20
|
+
o = !1;
|
|
21
|
+
try {
|
|
22
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
23
|
+
if (Object(t) !== t) return;
|
|
24
|
+
f = !1;
|
|
25
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
26
|
+
} catch (r) {
|
|
27
|
+
o = !0, n = r;
|
|
28
|
+
} finally {
|
|
29
|
+
try {
|
|
30
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
31
|
+
} finally {
|
|
32
|
+
if (o) throw n;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return a;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _typeof(o) {
|
|
39
|
+
"@babel/helpers - typeof";
|
|
40
|
+
|
|
41
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
42
|
+
return typeof o;
|
|
43
|
+
} : function (o) {
|
|
44
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
45
|
+
}, _typeof(o);
|
|
46
|
+
}
|
|
47
|
+
function _classCallCheck(instance, Constructor) {
|
|
48
|
+
if (!(instance instanceof Constructor)) {
|
|
49
|
+
throw new TypeError("Cannot call a class as a function");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function _defineProperties(target, props) {
|
|
53
|
+
for (var i = 0; i < props.length; i++) {
|
|
54
|
+
var descriptor = props[i];
|
|
55
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
56
|
+
descriptor.configurable = true;
|
|
57
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
58
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
62
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
63
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
64
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
65
|
+
writable: false
|
|
66
|
+
});
|
|
67
|
+
return Constructor;
|
|
68
|
+
}
|
|
69
|
+
function _inherits(subClass, superClass) {
|
|
70
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
71
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
72
|
+
}
|
|
73
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
74
|
+
constructor: {
|
|
75
|
+
value: subClass,
|
|
76
|
+
writable: true,
|
|
77
|
+
configurable: true
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(subClass, "prototype", {
|
|
81
|
+
writable: false
|
|
82
|
+
});
|
|
83
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
84
|
+
}
|
|
85
|
+
function _getPrototypeOf(o) {
|
|
86
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
87
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
88
|
+
};
|
|
89
|
+
return _getPrototypeOf(o);
|
|
90
|
+
}
|
|
91
|
+
function _setPrototypeOf(o, p) {
|
|
92
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
93
|
+
o.__proto__ = p;
|
|
94
|
+
return o;
|
|
95
|
+
};
|
|
96
|
+
return _setPrototypeOf(o, p);
|
|
97
|
+
}
|
|
98
|
+
function _isNativeReflectConstruct() {
|
|
99
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
100
|
+
if (Reflect.construct.sham) return false;
|
|
101
|
+
if (typeof Proxy === "function") return true;
|
|
102
|
+
try {
|
|
103
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
104
|
+
return true;
|
|
105
|
+
} catch (e) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function _construct(Parent, args, Class) {
|
|
110
|
+
if (_isNativeReflectConstruct()) {
|
|
111
|
+
_construct = Reflect.construct.bind();
|
|
112
|
+
} else {
|
|
113
|
+
_construct = function _construct(Parent, args, Class) {
|
|
114
|
+
var a = [null];
|
|
115
|
+
a.push.apply(a, args);
|
|
116
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
117
|
+
var instance = new Constructor();
|
|
118
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
119
|
+
return instance;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return _construct.apply(null, arguments);
|
|
123
|
+
}
|
|
124
|
+
function _assertThisInitialized(self) {
|
|
125
|
+
if (self === void 0) {
|
|
126
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
127
|
+
}
|
|
128
|
+
return self;
|
|
129
|
+
}
|
|
130
|
+
function _possibleConstructorReturn(self, call) {
|
|
131
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
132
|
+
return call;
|
|
133
|
+
} else if (call !== void 0) {
|
|
134
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
135
|
+
}
|
|
136
|
+
return _assertThisInitialized(self);
|
|
137
|
+
}
|
|
138
|
+
function _createSuper(Derived) {
|
|
139
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
140
|
+
return function _createSuperInternal() {
|
|
141
|
+
var Super = _getPrototypeOf(Derived),
|
|
142
|
+
result;
|
|
143
|
+
if (hasNativeReflectConstruct) {
|
|
144
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
145
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
146
|
+
} else {
|
|
147
|
+
result = Super.apply(this, arguments);
|
|
148
|
+
}
|
|
149
|
+
return _possibleConstructorReturn(this, result);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function _superPropBase(object, property) {
|
|
153
|
+
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
154
|
+
object = _getPrototypeOf(object);
|
|
155
|
+
if (object === null) break;
|
|
156
|
+
}
|
|
157
|
+
return object;
|
|
158
|
+
}
|
|
159
|
+
function _get() {
|
|
160
|
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
161
|
+
_get = Reflect.get.bind();
|
|
162
|
+
} else {
|
|
163
|
+
_get = function _get(target, property, receiver) {
|
|
164
|
+
var base = _superPropBase(target, property);
|
|
165
|
+
if (!base) return;
|
|
166
|
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
167
|
+
if (desc.get) {
|
|
168
|
+
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
169
|
+
}
|
|
170
|
+
return desc.value;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return _get.apply(this, arguments);
|
|
174
|
+
}
|
|
175
|
+
function _slicedToArray(arr, i) {
|
|
176
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
177
|
+
}
|
|
178
|
+
function _toConsumableArray(arr) {
|
|
179
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
180
|
+
}
|
|
181
|
+
function _arrayWithoutHoles(arr) {
|
|
182
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
183
|
+
}
|
|
184
|
+
function _arrayWithHoles(arr) {
|
|
185
|
+
if (Array.isArray(arr)) return arr;
|
|
186
|
+
}
|
|
187
|
+
function _iterableToArray(iter) {
|
|
188
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
189
|
+
}
|
|
190
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
191
|
+
if (!o) return;
|
|
192
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
193
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
194
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
195
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
196
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
197
|
+
}
|
|
198
|
+
function _arrayLikeToArray(arr, len) {
|
|
199
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
200
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
201
|
+
return arr2;
|
|
202
|
+
}
|
|
203
|
+
function _nonIterableSpread() {
|
|
204
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
205
|
+
}
|
|
206
|
+
function _nonIterableRest() {
|
|
207
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
208
|
+
}
|
|
209
|
+
function _toPrimitive(input, hint) {
|
|
210
|
+
if (typeof input !== "object" || input === null) return input;
|
|
211
|
+
var prim = input[Symbol.toPrimitive];
|
|
212
|
+
if (prim !== undefined) {
|
|
213
|
+
var res = prim.call(input, hint || "default");
|
|
214
|
+
if (typeof res !== "object") return res;
|
|
215
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
216
|
+
}
|
|
217
|
+
return (hint === "string" ? String : Number)(input);
|
|
218
|
+
}
|
|
219
|
+
function _toPropertyKey(arg) {
|
|
220
|
+
var key = _toPrimitive(arg, "string");
|
|
221
|
+
return typeof key === "symbol" ? key : String(key);
|
|
222
|
+
}
|
|
11
223
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
12
224
|
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
|
|
13
225
|
return _classApplyDescriptorGet(receiver, descriptor);
|
|
@@ -49,11 +261,11 @@
|
|
|
49
261
|
privateMap.set(obj, value);
|
|
50
262
|
}
|
|
51
263
|
|
|
52
|
-
|
|
264
|
+
var RESTORE_FOCUS_TIMEOUT = 100;
|
|
53
265
|
|
|
54
266
|
/** @type {GlobalState} */
|
|
55
|
-
|
|
56
|
-
|
|
267
|
+
var globalState = {};
|
|
268
|
+
var focusPreviousActiveElement = function focusPreviousActiveElement() {
|
|
57
269
|
if (globalState.previousActiveElement instanceof HTMLElement) {
|
|
58
270
|
globalState.previousActiveElement.focus();
|
|
59
271
|
globalState.previousActiveElement = null;
|
|
@@ -68,14 +280,14 @@
|
|
|
68
280
|
* @param {boolean} returnFocus
|
|
69
281
|
* @returns {Promise<void>}
|
|
70
282
|
*/
|
|
71
|
-
|
|
72
|
-
return new Promise(resolve
|
|
283
|
+
var restoreActiveElement = function restoreActiveElement(returnFocus) {
|
|
284
|
+
return new Promise(function (resolve) {
|
|
73
285
|
if (!returnFocus) {
|
|
74
286
|
return resolve();
|
|
75
287
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
globalState.restoreFocusTimeout = setTimeout(()
|
|
288
|
+
var x = window.scrollX;
|
|
289
|
+
var y = window.scrollY;
|
|
290
|
+
globalState.restoreFocusTimeout = setTimeout(function () {
|
|
79
291
|
focusPreviousActiveElement();
|
|
80
292
|
resolve();
|
|
81
293
|
}, RESTORE_FOCUS_TIMEOUT); // issues/900
|
|
@@ -84,7 +296,7 @@
|
|
|
84
296
|
});
|
|
85
297
|
};
|
|
86
298
|
|
|
87
|
-
|
|
299
|
+
var swalPrefix = 'swal2-';
|
|
88
300
|
|
|
89
301
|
/**
|
|
90
302
|
* @typedef
|
|
@@ -167,20 +379,20 @@
|
|
|
167
379
|
*/
|
|
168
380
|
|
|
169
381
|
/** @type {SwalClass[]} */
|
|
170
|
-
|
|
171
|
-
|
|
382
|
+
var classNames = ['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error'];
|
|
383
|
+
var swalClasses = classNames.reduce(function (acc, className) {
|
|
172
384
|
acc[className] = swalPrefix + className;
|
|
173
385
|
return acc;
|
|
174
386
|
}, /** @type {SwalClasses} */{});
|
|
175
387
|
|
|
176
388
|
/** @type {SwalIcon[]} */
|
|
177
|
-
|
|
178
|
-
|
|
389
|
+
var icons = ['success', 'warning', 'info', 'question', 'error'];
|
|
390
|
+
var iconTypes = icons.reduce(function (acc, icon) {
|
|
179
391
|
acc[icon] = swalPrefix + icon;
|
|
180
392
|
return acc;
|
|
181
393
|
}, /** @type {SwalIcons} */{});
|
|
182
394
|
|
|
183
|
-
|
|
395
|
+
var consolePrefix = 'SweetAlert2:';
|
|
184
396
|
|
|
185
397
|
/**
|
|
186
398
|
* Capitalize the first letter of a string
|
|
@@ -188,15 +400,17 @@
|
|
|
188
400
|
* @param {string} str
|
|
189
401
|
* @returns {string}
|
|
190
402
|
*/
|
|
191
|
-
|
|
403
|
+
var capitalizeFirstLetter = function capitalizeFirstLetter(str) {
|
|
404
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
405
|
+
};
|
|
192
406
|
|
|
193
407
|
/**
|
|
194
408
|
* Standardize console warnings
|
|
195
409
|
*
|
|
196
410
|
* @param {string | string[]} message
|
|
197
411
|
*/
|
|
198
|
-
|
|
199
|
-
console.warn("".concat(consolePrefix, " ").concat(
|
|
412
|
+
var warn = function warn(message) {
|
|
413
|
+
console.warn("".concat(consolePrefix, " ").concat(_typeof(message) === 'object' ? message.join(' ') : message));
|
|
200
414
|
};
|
|
201
415
|
|
|
202
416
|
/**
|
|
@@ -204,7 +418,7 @@
|
|
|
204
418
|
*
|
|
205
419
|
* @param {string} message
|
|
206
420
|
*/
|
|
207
|
-
|
|
421
|
+
var error = function error(message) {
|
|
208
422
|
console.error("".concat(consolePrefix, " ").concat(message));
|
|
209
423
|
};
|
|
210
424
|
|
|
@@ -214,14 +428,14 @@
|
|
|
214
428
|
* @type {string[]}
|
|
215
429
|
* @private
|
|
216
430
|
*/
|
|
217
|
-
|
|
431
|
+
var previousWarnOnceMessages = [];
|
|
218
432
|
|
|
219
433
|
/**
|
|
220
434
|
* Show a console warning, but only if it hasn't already been shown
|
|
221
435
|
*
|
|
222
436
|
* @param {string} message
|
|
223
437
|
*/
|
|
224
|
-
|
|
438
|
+
var warnOnce = function warnOnce(message) {
|
|
225
439
|
if (!previousWarnOnceMessages.includes(message)) {
|
|
226
440
|
previousWarnOnceMessages.push(message);
|
|
227
441
|
warn(message);
|
|
@@ -234,7 +448,7 @@
|
|
|
234
448
|
* @param {string} deprecatedParam
|
|
235
449
|
* @param {string} useInstead
|
|
236
450
|
*/
|
|
237
|
-
|
|
451
|
+
var warnAboutDeprecation = function warnAboutDeprecation(deprecatedParam, useInstead) {
|
|
238
452
|
warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead."));
|
|
239
453
|
};
|
|
240
454
|
|
|
@@ -245,39 +459,49 @@
|
|
|
245
459
|
* @param {Function | any} arg
|
|
246
460
|
* @returns {any}
|
|
247
461
|
*/
|
|
248
|
-
|
|
462
|
+
var callIfFunction = function callIfFunction(arg) {
|
|
463
|
+
return typeof arg === 'function' ? arg() : arg;
|
|
464
|
+
};
|
|
249
465
|
|
|
250
466
|
/**
|
|
251
467
|
* @param {any} arg
|
|
252
468
|
* @returns {boolean}
|
|
253
469
|
*/
|
|
254
|
-
|
|
470
|
+
var hasToPromiseFn = function hasToPromiseFn(arg) {
|
|
471
|
+
return arg && typeof arg.toPromise === 'function';
|
|
472
|
+
};
|
|
255
473
|
|
|
256
474
|
/**
|
|
257
475
|
* @param {any} arg
|
|
258
476
|
* @returns {Promise<any>}
|
|
259
477
|
*/
|
|
260
|
-
|
|
478
|
+
var asPromise = function asPromise(arg) {
|
|
479
|
+
return hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);
|
|
480
|
+
};
|
|
261
481
|
|
|
262
482
|
/**
|
|
263
483
|
* @param {any} arg
|
|
264
484
|
* @returns {boolean}
|
|
265
485
|
*/
|
|
266
|
-
|
|
486
|
+
var isPromise = function isPromise(arg) {
|
|
487
|
+
return arg && Promise.resolve(arg) === arg;
|
|
488
|
+
};
|
|
267
489
|
|
|
268
490
|
/**
|
|
269
491
|
* Gets the popup container which contains the backdrop and the popup itself.
|
|
270
492
|
*
|
|
271
493
|
* @returns {HTMLElement | null}
|
|
272
494
|
*/
|
|
273
|
-
|
|
495
|
+
var getContainer = function getContainer() {
|
|
496
|
+
return document.body.querySelector(".".concat(swalClasses.container));
|
|
497
|
+
};
|
|
274
498
|
|
|
275
499
|
/**
|
|
276
500
|
* @param {string} selectorString
|
|
277
501
|
* @returns {HTMLElement | null}
|
|
278
502
|
*/
|
|
279
|
-
|
|
280
|
-
|
|
503
|
+
var elementBySelector = function elementBySelector(selectorString) {
|
|
504
|
+
var container = getContainer();
|
|
281
505
|
return container ? container.querySelector(selectorString) : null;
|
|
282
506
|
};
|
|
283
507
|
|
|
@@ -285,112 +509,149 @@
|
|
|
285
509
|
* @param {string} className
|
|
286
510
|
* @returns {HTMLElement | null}
|
|
287
511
|
*/
|
|
288
|
-
|
|
512
|
+
var elementByClass = function elementByClass(className) {
|
|
289
513
|
return elementBySelector(".".concat(className));
|
|
290
514
|
};
|
|
291
515
|
|
|
292
516
|
/**
|
|
293
517
|
* @returns {HTMLElement | null}
|
|
294
518
|
*/
|
|
295
|
-
|
|
519
|
+
var getPopup = function getPopup() {
|
|
520
|
+
return elementByClass(swalClasses.popup);
|
|
521
|
+
};
|
|
296
522
|
|
|
297
523
|
/**
|
|
298
524
|
* @returns {HTMLElement | null}
|
|
299
525
|
*/
|
|
300
|
-
|
|
526
|
+
var getIcon = function getIcon() {
|
|
527
|
+
return elementByClass(swalClasses.icon);
|
|
528
|
+
};
|
|
301
529
|
|
|
302
530
|
/**
|
|
303
531
|
* @returns {HTMLElement | null}
|
|
304
532
|
*/
|
|
305
|
-
|
|
533
|
+
var getIconContent = function getIconContent() {
|
|
534
|
+
return elementByClass(swalClasses['icon-content']);
|
|
535
|
+
};
|
|
306
536
|
|
|
307
537
|
/**
|
|
308
538
|
* @returns {HTMLElement | null}
|
|
309
539
|
*/
|
|
310
|
-
|
|
540
|
+
var getTitle = function getTitle() {
|
|
541
|
+
return elementByClass(swalClasses.title);
|
|
542
|
+
};
|
|
311
543
|
|
|
312
544
|
/**
|
|
313
545
|
* @returns {HTMLElement | null}
|
|
314
546
|
*/
|
|
315
|
-
|
|
547
|
+
var getHtmlContainer = function getHtmlContainer() {
|
|
548
|
+
return elementByClass(swalClasses['html-container']);
|
|
549
|
+
};
|
|
316
550
|
|
|
317
551
|
/**
|
|
318
552
|
* @returns {HTMLElement | null}
|
|
319
553
|
*/
|
|
320
|
-
|
|
554
|
+
var getImage = function getImage() {
|
|
555
|
+
return elementByClass(swalClasses.image);
|
|
556
|
+
};
|
|
321
557
|
|
|
322
558
|
/**
|
|
323
559
|
* @returns {HTMLElement | null}
|
|
324
560
|
*/
|
|
325
|
-
|
|
561
|
+
var getProgressSteps = function getProgressSteps() {
|
|
562
|
+
return elementByClass(swalClasses['progress-steps']);
|
|
563
|
+
};
|
|
326
564
|
|
|
327
565
|
/**
|
|
328
566
|
* @returns {HTMLElement | null}
|
|
329
567
|
*/
|
|
330
|
-
|
|
568
|
+
var getValidationMessage = function getValidationMessage() {
|
|
569
|
+
return elementByClass(swalClasses['validation-message']);
|
|
570
|
+
};
|
|
331
571
|
|
|
332
572
|
/**
|
|
333
573
|
* @returns {HTMLButtonElement | null}
|
|
334
574
|
*/
|
|
335
|
-
|
|
575
|
+
var getConfirmButton = function getConfirmButton() {
|
|
576
|
+
return (/** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm))
|
|
577
|
+
);
|
|
578
|
+
};
|
|
336
579
|
|
|
337
580
|
/**
|
|
338
581
|
* @returns {HTMLButtonElement | null}
|
|
339
582
|
*/
|
|
340
|
-
|
|
583
|
+
var getCancelButton = function getCancelButton() {
|
|
584
|
+
return (/** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel))
|
|
585
|
+
);
|
|
586
|
+
};
|
|
341
587
|
|
|
342
588
|
/**
|
|
343
589
|
* @returns {HTMLButtonElement | null}
|
|
344
590
|
*/
|
|
345
|
-
|
|
591
|
+
var getDenyButton = function getDenyButton() {
|
|
592
|
+
return (/** @type {HTMLButtonElement} */elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.deny))
|
|
593
|
+
);
|
|
594
|
+
};
|
|
346
595
|
|
|
347
596
|
/**
|
|
348
597
|
* @returns {HTMLElement | null}
|
|
349
598
|
*/
|
|
350
|
-
|
|
599
|
+
var getInputLabel = function getInputLabel() {
|
|
600
|
+
return elementByClass(swalClasses['input-label']);
|
|
601
|
+
};
|
|
351
602
|
|
|
352
603
|
/**
|
|
353
604
|
* @returns {HTMLElement | null}
|
|
354
605
|
*/
|
|
355
|
-
|
|
606
|
+
var getLoader = function getLoader() {
|
|
607
|
+
return elementBySelector(".".concat(swalClasses.loader));
|
|
608
|
+
};
|
|
356
609
|
|
|
357
610
|
/**
|
|
358
611
|
* @returns {HTMLElement | null}
|
|
359
612
|
*/
|
|
360
|
-
|
|
613
|
+
var getActions = function getActions() {
|
|
614
|
+
return elementByClass(swalClasses.actions);
|
|
615
|
+
};
|
|
361
616
|
|
|
362
617
|
/**
|
|
363
618
|
* @returns {HTMLElement | null}
|
|
364
619
|
*/
|
|
365
|
-
|
|
620
|
+
var getFooter = function getFooter() {
|
|
621
|
+
return elementByClass(swalClasses.footer);
|
|
622
|
+
};
|
|
366
623
|
|
|
367
624
|
/**
|
|
368
625
|
* @returns {HTMLElement | null}
|
|
369
626
|
*/
|
|
370
|
-
|
|
627
|
+
var getTimerProgressBar = function getTimerProgressBar() {
|
|
628
|
+
return elementByClass(swalClasses['timer-progress-bar']);
|
|
629
|
+
};
|
|
371
630
|
|
|
372
631
|
/**
|
|
373
632
|
* @returns {HTMLElement | null}
|
|
374
633
|
*/
|
|
375
|
-
|
|
634
|
+
var getCloseButton = function getCloseButton() {
|
|
635
|
+
return elementByClass(swalClasses.close);
|
|
636
|
+
};
|
|
376
637
|
|
|
377
638
|
// https://github.com/jkup/focusable/blob/master/index.js
|
|
378
|
-
|
|
639
|
+
var focusable = "\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex=\"0\"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n";
|
|
379
640
|
/**
|
|
380
641
|
* @returns {HTMLElement[]}
|
|
381
642
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
643
|
+
var getFocusableElements = function getFocusableElements() {
|
|
644
|
+
var popup = getPopup();
|
|
384
645
|
if (!popup) {
|
|
385
646
|
return [];
|
|
386
647
|
}
|
|
387
648
|
/** @type {NodeListOf<HTMLElement>} */
|
|
388
|
-
|
|
389
|
-
|
|
649
|
+
var focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])');
|
|
650
|
+
var focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex)
|
|
390
651
|
// sort according to tabindex
|
|
391
|
-
.sort((a, b)
|
|
392
|
-
|
|
393
|
-
|
|
652
|
+
.sort(function (a, b) {
|
|
653
|
+
var tabindexA = parseInt(a.getAttribute('tabindex') || '0');
|
|
654
|
+
var tabindexB = parseInt(b.getAttribute('tabindex') || '0');
|
|
394
655
|
if (tabindexA > tabindexB) {
|
|
395
656
|
return 1;
|
|
396
657
|
} else if (tabindexA < tabindexB) {
|
|
@@ -400,23 +661,27 @@
|
|
|
400
661
|
});
|
|
401
662
|
|
|
402
663
|
/** @type {NodeListOf<HTMLElement>} */
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
664
|
+
var otherFocusableElements = popup.querySelectorAll(focusable);
|
|
665
|
+
var otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(function (el) {
|
|
666
|
+
return el.getAttribute('tabindex') !== '-1';
|
|
667
|
+
});
|
|
668
|
+
return _toConsumableArray(new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))).filter(function (el) {
|
|
669
|
+
return isVisible$1(el);
|
|
670
|
+
});
|
|
406
671
|
};
|
|
407
672
|
|
|
408
673
|
/**
|
|
409
674
|
* @returns {boolean}
|
|
410
675
|
*/
|
|
411
|
-
|
|
676
|
+
var isModal = function isModal() {
|
|
412
677
|
return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);
|
|
413
678
|
};
|
|
414
679
|
|
|
415
680
|
/**
|
|
416
681
|
* @returns {boolean}
|
|
417
682
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
683
|
+
var isToast = function isToast() {
|
|
684
|
+
var popup = getPopup();
|
|
420
685
|
if (!popup) {
|
|
421
686
|
return false;
|
|
422
687
|
}
|
|
@@ -426,8 +691,8 @@
|
|
|
426
691
|
/**
|
|
427
692
|
* @returns {boolean}
|
|
428
693
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
694
|
+
var isLoading = function isLoading() {
|
|
695
|
+
var popup = getPopup();
|
|
431
696
|
if (!popup) {
|
|
432
697
|
return false;
|
|
433
698
|
}
|
|
@@ -441,17 +706,17 @@
|
|
|
441
706
|
* @param {HTMLElement} elem
|
|
442
707
|
* @param {string} html
|
|
443
708
|
*/
|
|
444
|
-
|
|
709
|
+
var setInnerHtml = function setInnerHtml(elem, html) {
|
|
445
710
|
elem.textContent = '';
|
|
446
711
|
if (html) {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
head && Array.from(head.childNodes).forEach(child
|
|
712
|
+
var parser = new DOMParser();
|
|
713
|
+
var parsed = parser.parseFromString(html, "text/html");
|
|
714
|
+
var head = parsed.querySelector('head');
|
|
715
|
+
head && Array.from(head.childNodes).forEach(function (child) {
|
|
451
716
|
elem.appendChild(child);
|
|
452
717
|
});
|
|
453
|
-
|
|
454
|
-
body && Array.from(body.childNodes).forEach(child
|
|
718
|
+
var body = parsed.querySelector('body');
|
|
719
|
+
body && Array.from(body.childNodes).forEach(function (child) {
|
|
455
720
|
if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
|
|
456
721
|
elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507
|
|
457
722
|
} else {
|
|
@@ -466,12 +731,12 @@
|
|
|
466
731
|
* @param {string} className
|
|
467
732
|
* @returns {boolean}
|
|
468
733
|
*/
|
|
469
|
-
|
|
734
|
+
var hasClass = function hasClass(elem, className) {
|
|
470
735
|
if (!className) {
|
|
471
736
|
return false;
|
|
472
737
|
}
|
|
473
|
-
|
|
474
|
-
for (
|
|
738
|
+
var classList = className.split(/\s+/);
|
|
739
|
+
for (var i = 0; i < classList.length; i++) {
|
|
475
740
|
if (!elem.classList.contains(classList[i])) {
|
|
476
741
|
return false;
|
|
477
742
|
}
|
|
@@ -483,8 +748,8 @@
|
|
|
483
748
|
* @param {HTMLElement} elem
|
|
484
749
|
* @param {SweetAlertOptions} params
|
|
485
750
|
*/
|
|
486
|
-
|
|
487
|
-
Array.from(elem.classList).forEach(className
|
|
751
|
+
var removeCustomClasses = function removeCustomClasses(elem, params) {
|
|
752
|
+
Array.from(elem.classList).forEach(function (className) {
|
|
488
753
|
if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) {
|
|
489
754
|
elem.classList.remove(className);
|
|
490
755
|
}
|
|
@@ -496,11 +761,11 @@
|
|
|
496
761
|
* @param {SweetAlertOptions} params
|
|
497
762
|
* @param {string} className
|
|
498
763
|
*/
|
|
499
|
-
|
|
764
|
+
var applyCustomClass = function applyCustomClass(elem, params, className) {
|
|
500
765
|
removeCustomClasses(elem, params);
|
|
501
766
|
if (params.customClass && params.customClass[className]) {
|
|
502
767
|
if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) {
|
|
503
|
-
warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(
|
|
768
|
+
warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(_typeof(params.customClass[className]), "\""));
|
|
504
769
|
return;
|
|
505
770
|
}
|
|
506
771
|
addClass(elem, params.customClass[className]);
|
|
@@ -512,7 +777,7 @@
|
|
|
512
777
|
* @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass
|
|
513
778
|
* @returns {HTMLInputElement | null}
|
|
514
779
|
*/
|
|
515
|
-
|
|
780
|
+
var getInput$1 = function getInput(popup, inputClass) {
|
|
516
781
|
if (!inputClass) {
|
|
517
782
|
return null;
|
|
518
783
|
}
|
|
@@ -535,13 +800,13 @@
|
|
|
535
800
|
/**
|
|
536
801
|
* @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input
|
|
537
802
|
*/
|
|
538
|
-
|
|
803
|
+
var focusInput = function focusInput(input) {
|
|
539
804
|
input.focus();
|
|
540
805
|
|
|
541
806
|
// place cursor at end of text in text input
|
|
542
807
|
if (input.type !== 'file') {
|
|
543
808
|
// http://stackoverflow.com/a/2345915
|
|
544
|
-
|
|
809
|
+
var val = input.value;
|
|
545
810
|
input.value = '';
|
|
546
811
|
input.value = val;
|
|
547
812
|
}
|
|
@@ -552,16 +817,16 @@
|
|
|
552
817
|
* @param {string | string[] | readonly string[] | undefined} classList
|
|
553
818
|
* @param {boolean} condition
|
|
554
819
|
*/
|
|
555
|
-
|
|
820
|
+
var toggleClass = function toggleClass(target, classList, condition) {
|
|
556
821
|
if (!target || !classList) {
|
|
557
822
|
return;
|
|
558
823
|
}
|
|
559
824
|
if (typeof classList === 'string') {
|
|
560
825
|
classList = classList.split(/\s+/).filter(Boolean);
|
|
561
826
|
}
|
|
562
|
-
classList.forEach(className
|
|
827
|
+
classList.forEach(function (className) {
|
|
563
828
|
if (Array.isArray(target)) {
|
|
564
|
-
target.forEach(elem
|
|
829
|
+
target.forEach(function (elem) {
|
|
565
830
|
condition ? elem.classList.add(className) : elem.classList.remove(className);
|
|
566
831
|
});
|
|
567
832
|
} else {
|
|
@@ -574,7 +839,7 @@
|
|
|
574
839
|
* @param {HTMLElement | HTMLElement[] | null} target
|
|
575
840
|
* @param {string | string[] | readonly string[] | undefined} classList
|
|
576
841
|
*/
|
|
577
|
-
|
|
842
|
+
var addClass = function addClass(target, classList) {
|
|
578
843
|
toggleClass(target, classList, true);
|
|
579
844
|
};
|
|
580
845
|
|
|
@@ -582,7 +847,7 @@
|
|
|
582
847
|
* @param {HTMLElement | HTMLElement[] | null} target
|
|
583
848
|
* @param {string | string[] | readonly string[] | undefined} classList
|
|
584
849
|
*/
|
|
585
|
-
|
|
850
|
+
var removeClass = function removeClass(target, classList) {
|
|
586
851
|
toggleClass(target, classList, false);
|
|
587
852
|
};
|
|
588
853
|
|
|
@@ -593,10 +858,10 @@
|
|
|
593
858
|
* @param {string} className
|
|
594
859
|
* @returns {HTMLElement | undefined}
|
|
595
860
|
*/
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
for (
|
|
599
|
-
|
|
861
|
+
var getDirectChildByClass = function getDirectChildByClass(elem, className) {
|
|
862
|
+
var children = Array.from(elem.children);
|
|
863
|
+
for (var i = 0; i < children.length; i++) {
|
|
864
|
+
var child = children[i];
|
|
600
865
|
if (child instanceof HTMLElement && hasClass(child, className)) {
|
|
601
866
|
return child;
|
|
602
867
|
}
|
|
@@ -608,7 +873,7 @@
|
|
|
608
873
|
* @param {string} property
|
|
609
874
|
* @param {*} value
|
|
610
875
|
*/
|
|
611
|
-
|
|
876
|
+
var applyNumericalStyle = function applyNumericalStyle(elem, property, value) {
|
|
612
877
|
if (value === "".concat(parseInt(value))) {
|
|
613
878
|
value = parseInt(value);
|
|
614
879
|
}
|
|
@@ -623,15 +888,15 @@
|
|
|
623
888
|
* @param {HTMLElement | null} elem
|
|
624
889
|
* @param {string} display
|
|
625
890
|
*/
|
|
626
|
-
|
|
627
|
-
|
|
891
|
+
var show = function show(elem) {
|
|
892
|
+
var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';
|
|
628
893
|
elem && (elem.style.display = display);
|
|
629
894
|
};
|
|
630
895
|
|
|
631
896
|
/**
|
|
632
897
|
* @param {HTMLElement | null} elem
|
|
633
898
|
*/
|
|
634
|
-
|
|
899
|
+
var hide = function hide(elem) {
|
|
635
900
|
elem && (elem.style.display = 'none');
|
|
636
901
|
};
|
|
637
902
|
|
|
@@ -639,12 +904,12 @@
|
|
|
639
904
|
* @param {HTMLElement | null} elem
|
|
640
905
|
* @param {string} display
|
|
641
906
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
907
|
+
var showWhenInnerHtmlPresent = function showWhenInnerHtmlPresent(elem) {
|
|
908
|
+
var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'block';
|
|
644
909
|
if (!elem) {
|
|
645
910
|
return;
|
|
646
911
|
}
|
|
647
|
-
new MutationObserver(()
|
|
912
|
+
new MutationObserver(function () {
|
|
648
913
|
toggle(elem, elem.innerHTML, display);
|
|
649
914
|
}).observe(elem, {
|
|
650
915
|
childList: true,
|
|
@@ -658,9 +923,9 @@
|
|
|
658
923
|
* @param {string} property
|
|
659
924
|
* @param {string} value
|
|
660
925
|
*/
|
|
661
|
-
|
|
926
|
+
var setStyle = function setStyle(parent, selector, property, value) {
|
|
662
927
|
/** @type {HTMLElement} */
|
|
663
|
-
|
|
928
|
+
var el = parent.querySelector(selector);
|
|
664
929
|
if (el) {
|
|
665
930
|
el.style[property] = value;
|
|
666
931
|
}
|
|
@@ -671,8 +936,8 @@
|
|
|
671
936
|
* @param {any} condition
|
|
672
937
|
* @param {string} display
|
|
673
938
|
*/
|
|
674
|
-
|
|
675
|
-
|
|
939
|
+
var toggle = function toggle(elem, condition) {
|
|
940
|
+
var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';
|
|
676
941
|
condition ? show(elem, display) : hide(elem);
|
|
677
942
|
};
|
|
678
943
|
|
|
@@ -682,18 +947,24 @@
|
|
|
682
947
|
* @param {HTMLElement | null} elem
|
|
683
948
|
* @returns {boolean}
|
|
684
949
|
*/
|
|
685
|
-
|
|
950
|
+
var isVisible$1 = function isVisible(elem) {
|
|
951
|
+
return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
|
|
952
|
+
};
|
|
686
953
|
|
|
687
954
|
/**
|
|
688
955
|
* @returns {boolean}
|
|
689
956
|
*/
|
|
690
|
-
|
|
957
|
+
var allButtonsAreHidden = function allButtonsAreHidden() {
|
|
958
|
+
return !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton());
|
|
959
|
+
};
|
|
691
960
|
|
|
692
961
|
/**
|
|
693
962
|
* @param {HTMLElement} elem
|
|
694
963
|
* @returns {boolean}
|
|
695
964
|
*/
|
|
696
|
-
|
|
965
|
+
var isScrollable = function isScrollable(elem) {
|
|
966
|
+
return !!(elem.scrollHeight > elem.clientHeight);
|
|
967
|
+
};
|
|
697
968
|
|
|
698
969
|
/**
|
|
699
970
|
* borrowed from https://stackoverflow.com/a/46352119
|
|
@@ -701,10 +972,10 @@
|
|
|
701
972
|
* @param {HTMLElement} elem
|
|
702
973
|
* @returns {boolean}
|
|
703
974
|
*/
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
975
|
+
var hasCssAnimation = function hasCssAnimation(elem) {
|
|
976
|
+
var style = window.getComputedStyle(elem);
|
|
977
|
+
var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
|
|
978
|
+
var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
|
|
708
979
|
return animDuration > 0 || transDuration > 0;
|
|
709
980
|
};
|
|
710
981
|
|
|
@@ -712,9 +983,9 @@
|
|
|
712
983
|
* @param {number} timer
|
|
713
984
|
* @param {boolean} reset
|
|
714
985
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
986
|
+
var animateTimerProgressBar = function animateTimerProgressBar(timer) {
|
|
987
|
+
var reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
988
|
+
var timerProgressBar = getTimerProgressBar();
|
|
718
989
|
if (!timerProgressBar) {
|
|
719
990
|
return;
|
|
720
991
|
}
|
|
@@ -723,22 +994,22 @@
|
|
|
723
994
|
timerProgressBar.style.transition = 'none';
|
|
724
995
|
timerProgressBar.style.width = '100%';
|
|
725
996
|
}
|
|
726
|
-
setTimeout(()
|
|
997
|
+
setTimeout(function () {
|
|
727
998
|
timerProgressBar.style.transition = "width ".concat(timer / 1000, "s linear");
|
|
728
999
|
timerProgressBar.style.width = '0%';
|
|
729
1000
|
}, 10);
|
|
730
1001
|
}
|
|
731
1002
|
};
|
|
732
|
-
|
|
733
|
-
|
|
1003
|
+
var stopTimerProgressBar = function stopTimerProgressBar() {
|
|
1004
|
+
var timerProgressBar = getTimerProgressBar();
|
|
734
1005
|
if (!timerProgressBar) {
|
|
735
1006
|
return;
|
|
736
1007
|
}
|
|
737
|
-
|
|
1008
|
+
var timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
|
|
738
1009
|
timerProgressBar.style.removeProperty('transition');
|
|
739
1010
|
timerProgressBar.style.width = '100%';
|
|
740
|
-
|
|
741
|
-
|
|
1011
|
+
var timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
|
|
1012
|
+
var timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;
|
|
742
1013
|
timerProgressBar.style.width = "".concat(timerProgressBarPercent, "%");
|
|
743
1014
|
};
|
|
744
1015
|
|
|
@@ -747,15 +1018,17 @@
|
|
|
747
1018
|
*
|
|
748
1019
|
* @returns {boolean}
|
|
749
1020
|
*/
|
|
750
|
-
|
|
1021
|
+
var isNodeEnv = function isNodeEnv() {
|
|
1022
|
+
return typeof window === 'undefined' || typeof document === 'undefined';
|
|
1023
|
+
};
|
|
751
1024
|
|
|
752
|
-
|
|
1025
|
+
var sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses['html-container'], "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n <button type=\"button\" class=\"").concat(swalClasses.close, "\"></button>\n <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n <div class=\"").concat(swalClasses.icon, "\"></div>\n <img class=\"").concat(swalClasses.image, "\" />\n <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n <div class=\"").concat(swalClasses['html-container'], "\" id=\"").concat(swalClasses['html-container'], "\"></div>\n <input class=\"").concat(swalClasses.input, "\" id=\"").concat(swalClasses.input, "\" />\n <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n <div class=\"").concat(swalClasses.range, "\">\n <input type=\"range\" />\n <output></output>\n </div>\n <select class=\"").concat(swalClasses.select, "\" id=\"").concat(swalClasses.select, "\"></select>\n <div class=\"").concat(swalClasses.radio, "\"></div>\n <label class=\"").concat(swalClasses.checkbox, "\">\n <input type=\"checkbox\" id=\"").concat(swalClasses.checkbox, "\" />\n <span class=\"").concat(swalClasses.label, "\"></span>\n </label>\n <textarea class=\"").concat(swalClasses.textarea, "\" id=\"").concat(swalClasses.textarea, "\"></textarea>\n <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n <div class=\"").concat(swalClasses.actions, "\">\n <div class=\"").concat(swalClasses.loader, "\"></div>\n <button type=\"button\" class=\"").concat(swalClasses.confirm, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.deny, "\"></button>\n <button type=\"button\" class=\"").concat(swalClasses.cancel, "\"></button>\n </div>\n <div class=\"").concat(swalClasses.footer, "\"></div>\n <div class=\"").concat(swalClasses['timer-progress-bar-container'], "\">\n <div class=\"").concat(swalClasses['timer-progress-bar'], "\"></div>\n </div>\n </div>\n").replace(/(^|\n)\s*/g, '');
|
|
753
1026
|
|
|
754
1027
|
/**
|
|
755
1028
|
* @returns {boolean}
|
|
756
1029
|
*/
|
|
757
|
-
|
|
758
|
-
|
|
1030
|
+
var resetOldContainer = function resetOldContainer() {
|
|
1031
|
+
var oldContainer = getContainer();
|
|
759
1032
|
if (!oldContainer) {
|
|
760
1033
|
return false;
|
|
761
1034
|
}
|
|
@@ -763,31 +1036,31 @@
|
|
|
763
1036
|
removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);
|
|
764
1037
|
return true;
|
|
765
1038
|
};
|
|
766
|
-
|
|
1039
|
+
var resetValidationMessage$1 = function resetValidationMessage() {
|
|
767
1040
|
globalState.currentInstance.resetValidationMessage();
|
|
768
1041
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1042
|
+
var addInputChangeListeners = function addInputChangeListeners() {
|
|
1043
|
+
var popup = getPopup();
|
|
1044
|
+
var input = getDirectChildByClass(popup, swalClasses.input);
|
|
1045
|
+
var file = getDirectChildByClass(popup, swalClasses.file);
|
|
773
1046
|
/** @type {HTMLInputElement} */
|
|
774
|
-
|
|
1047
|
+
var range = popup.querySelector(".".concat(swalClasses.range, " input"));
|
|
775
1048
|
/** @type {HTMLOutputElement} */
|
|
776
|
-
|
|
777
|
-
|
|
1049
|
+
var rangeOutput = popup.querySelector(".".concat(swalClasses.range, " output"));
|
|
1050
|
+
var select = getDirectChildByClass(popup, swalClasses.select);
|
|
778
1051
|
/** @type {HTMLInputElement} */
|
|
779
|
-
|
|
780
|
-
|
|
1052
|
+
var checkbox = popup.querySelector(".".concat(swalClasses.checkbox, " input"));
|
|
1053
|
+
var textarea = getDirectChildByClass(popup, swalClasses.textarea);
|
|
781
1054
|
input.oninput = resetValidationMessage$1;
|
|
782
1055
|
file.onchange = resetValidationMessage$1;
|
|
783
1056
|
select.onchange = resetValidationMessage$1;
|
|
784
1057
|
checkbox.onchange = resetValidationMessage$1;
|
|
785
1058
|
textarea.oninput = resetValidationMessage$1;
|
|
786
|
-
range.oninput = ()
|
|
1059
|
+
range.oninput = function () {
|
|
787
1060
|
resetValidationMessage$1();
|
|
788
1061
|
rangeOutput.value = range.value;
|
|
789
1062
|
};
|
|
790
|
-
range.onchange = ()
|
|
1063
|
+
range.onchange = function () {
|
|
791
1064
|
resetValidationMessage$1();
|
|
792
1065
|
rangeOutput.value = range.value;
|
|
793
1066
|
};
|
|
@@ -797,13 +1070,15 @@
|
|
|
797
1070
|
* @param {string | HTMLElement} target
|
|
798
1071
|
* @returns {HTMLElement}
|
|
799
1072
|
*/
|
|
800
|
-
|
|
1073
|
+
var getTarget = function getTarget(target) {
|
|
1074
|
+
return typeof target === 'string' ? document.querySelector(target) : target;
|
|
1075
|
+
};
|
|
801
1076
|
|
|
802
1077
|
/**
|
|
803
1078
|
* @param {SweetAlertOptions} params
|
|
804
1079
|
*/
|
|
805
|
-
|
|
806
|
-
|
|
1080
|
+
var setupAccessibility = function setupAccessibility(params) {
|
|
1081
|
+
var popup = getPopup();
|
|
807
1082
|
popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
|
|
808
1083
|
popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
|
|
809
1084
|
if (!params.toast) {
|
|
@@ -814,7 +1089,7 @@
|
|
|
814
1089
|
/**
|
|
815
1090
|
* @param {HTMLElement} targetElement
|
|
816
1091
|
*/
|
|
817
|
-
|
|
1092
|
+
var setupRTL = function setupRTL(targetElement) {
|
|
818
1093
|
if (window.getComputedStyle(targetElement).direction === 'rtl') {
|
|
819
1094
|
addClass(getContainer(), swalClasses.rtl);
|
|
820
1095
|
}
|
|
@@ -825,20 +1100,20 @@
|
|
|
825
1100
|
*
|
|
826
1101
|
* @param {SweetAlertOptions} params
|
|
827
1102
|
*/
|
|
828
|
-
|
|
1103
|
+
var init = function init(params) {
|
|
829
1104
|
// Clean up the old popup container if it exists
|
|
830
|
-
|
|
1105
|
+
var oldContainerExisted = resetOldContainer();
|
|
831
1106
|
if (isNodeEnv()) {
|
|
832
1107
|
error('SweetAlert2 requires document to initialize');
|
|
833
1108
|
return;
|
|
834
1109
|
}
|
|
835
|
-
|
|
1110
|
+
var container = document.createElement('div');
|
|
836
1111
|
container.className = swalClasses.container;
|
|
837
1112
|
if (oldContainerExisted) {
|
|
838
1113
|
addClass(container, swalClasses['no-transition']);
|
|
839
1114
|
}
|
|
840
1115
|
setInnerHtml(container, sweetHTML);
|
|
841
|
-
|
|
1116
|
+
var targetElement = getTarget(params.target);
|
|
842
1117
|
targetElement.appendChild(container);
|
|
843
1118
|
setupAccessibility(params);
|
|
844
1119
|
setupRTL(targetElement);
|
|
@@ -849,14 +1124,14 @@
|
|
|
849
1124
|
* @param {HTMLElement | object | string} param
|
|
850
1125
|
* @param {HTMLElement} target
|
|
851
1126
|
*/
|
|
852
|
-
|
|
1127
|
+
var parseHtmlToContainer = function parseHtmlToContainer(param, target) {
|
|
853
1128
|
// DOM element
|
|
854
1129
|
if (param instanceof HTMLElement) {
|
|
855
1130
|
target.appendChild(param);
|
|
856
1131
|
}
|
|
857
1132
|
|
|
858
1133
|
// Object
|
|
859
|
-
else if (
|
|
1134
|
+
else if (_typeof(param) === 'object') {
|
|
860
1135
|
handleObject(param, target);
|
|
861
1136
|
}
|
|
862
1137
|
|
|
@@ -870,7 +1145,7 @@
|
|
|
870
1145
|
* @param {any} param
|
|
871
1146
|
* @param {HTMLElement} target
|
|
872
1147
|
*/
|
|
873
|
-
|
|
1148
|
+
var handleObject = function handleObject(param, target) {
|
|
874
1149
|
// JQuery element(s)
|
|
875
1150
|
if (param.jquery) {
|
|
876
1151
|
handleJqueryElem(target, param);
|
|
@@ -886,10 +1161,10 @@
|
|
|
886
1161
|
* @param {HTMLElement} target
|
|
887
1162
|
* @param {any} elem
|
|
888
1163
|
*/
|
|
889
|
-
|
|
1164
|
+
var handleJqueryElem = function handleJqueryElem(target, elem) {
|
|
890
1165
|
target.textContent = '';
|
|
891
1166
|
if (0 in elem) {
|
|
892
|
-
for (
|
|
1167
|
+
for (var i = 0; (i in elem); i++) {
|
|
893
1168
|
target.appendChild(elem[i].cloneNode(true));
|
|
894
1169
|
}
|
|
895
1170
|
} else {
|
|
@@ -900,12 +1175,12 @@
|
|
|
900
1175
|
/**
|
|
901
1176
|
* @returns {'webkitAnimationEnd' | 'animationend' | false}
|
|
902
1177
|
*/
|
|
903
|
-
|
|
1178
|
+
var animationEndEvent = function () {
|
|
904
1179
|
// Prevent run in Node env
|
|
905
1180
|
if (isNodeEnv()) {
|
|
906
1181
|
return false;
|
|
907
1182
|
}
|
|
908
|
-
|
|
1183
|
+
var testEl = document.createElement('div');
|
|
909
1184
|
|
|
910
1185
|
// Chrome, Safari and Opera
|
|
911
1186
|
if (typeof testEl.style.webkitAnimation !== 'undefined') {
|
|
@@ -917,15 +1192,15 @@
|
|
|
917
1192
|
return 'animationend';
|
|
918
1193
|
}
|
|
919
1194
|
return false;
|
|
920
|
-
}
|
|
1195
|
+
}();
|
|
921
1196
|
|
|
922
1197
|
/**
|
|
923
1198
|
* @param {SweetAlert} instance
|
|
924
1199
|
* @param {SweetAlertOptions} params
|
|
925
1200
|
*/
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1201
|
+
var renderActions = function renderActions(instance, params) {
|
|
1202
|
+
var actions = getActions();
|
|
1203
|
+
var loader = getLoader();
|
|
929
1204
|
if (!actions || !loader) {
|
|
930
1205
|
return;
|
|
931
1206
|
}
|
|
@@ -954,9 +1229,9 @@
|
|
|
954
1229
|
* @param {SweetAlertOptions} params
|
|
955
1230
|
*/
|
|
956
1231
|
function renderButtons(actions, loader, params) {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1232
|
+
var confirmButton = getConfirmButton();
|
|
1233
|
+
var denyButton = getDenyButton();
|
|
1234
|
+
var cancelButton = getCancelButton();
|
|
960
1235
|
if (!confirmButton || !denyButton || !cancelButton) {
|
|
961
1236
|
return;
|
|
962
1237
|
}
|
|
@@ -1012,7 +1287,7 @@
|
|
|
1012
1287
|
* @param {SweetAlertOptions} params
|
|
1013
1288
|
*/
|
|
1014
1289
|
function renderButton(button, buttonType, params) {
|
|
1015
|
-
|
|
1290
|
+
var buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType);
|
|
1016
1291
|
toggle(button, params["show".concat(buttonName, "Button")], 'inline-block');
|
|
1017
1292
|
setInnerHtml(button, params["".concat(buttonType, "ButtonText")] || ''); // Set caption text
|
|
1018
1293
|
button.setAttribute('aria-label', params["".concat(buttonType, "ButtonAriaLabel")] || ''); // ARIA label
|
|
@@ -1026,8 +1301,8 @@
|
|
|
1026
1301
|
* @param {SweetAlert} instance
|
|
1027
1302
|
* @param {SweetAlertOptions} params
|
|
1028
1303
|
*/
|
|
1029
|
-
|
|
1030
|
-
|
|
1304
|
+
var renderCloseButton = function renderCloseButton(instance, params) {
|
|
1305
|
+
var closeButton = getCloseButton();
|
|
1031
1306
|
if (!closeButton) {
|
|
1032
1307
|
return;
|
|
1033
1308
|
}
|
|
@@ -1043,8 +1318,8 @@
|
|
|
1043
1318
|
* @param {SweetAlert} instance
|
|
1044
1319
|
* @param {SweetAlertOptions} params
|
|
1045
1320
|
*/
|
|
1046
|
-
|
|
1047
|
-
|
|
1321
|
+
var renderContainer = function renderContainer(instance, params) {
|
|
1322
|
+
var container = getContainer();
|
|
1048
1323
|
if (!container) {
|
|
1049
1324
|
return;
|
|
1050
1325
|
}
|
|
@@ -1110,25 +1385,22 @@
|
|
|
1110
1385
|
domCache: new WeakMap()
|
|
1111
1386
|
};
|
|
1112
1387
|
|
|
1113
|
-
/// <reference path="../../../../sweetalert2.d.ts"/>
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
1388
|
/** @type {InputClass[]} */
|
|
1117
|
-
|
|
1389
|
+
var inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
|
|
1118
1390
|
|
|
1119
1391
|
/**
|
|
1120
1392
|
* @param {SweetAlert} instance
|
|
1121
1393
|
* @param {SweetAlertOptions} params
|
|
1122
1394
|
*/
|
|
1123
|
-
|
|
1124
|
-
|
|
1395
|
+
var renderInput = function renderInput(instance, params) {
|
|
1396
|
+
var popup = getPopup();
|
|
1125
1397
|
if (!popup) {
|
|
1126
1398
|
return;
|
|
1127
1399
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
inputClasses.forEach(inputClass
|
|
1131
|
-
|
|
1400
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
1401
|
+
var rerender = !innerParams || params.input !== innerParams.input;
|
|
1402
|
+
inputClasses.forEach(function (inputClass) {
|
|
1403
|
+
var inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]);
|
|
1132
1404
|
if (!inputContainer) {
|
|
1133
1405
|
return;
|
|
1134
1406
|
}
|
|
@@ -1154,7 +1426,7 @@
|
|
|
1154
1426
|
/**
|
|
1155
1427
|
* @param {SweetAlertOptions} params
|
|
1156
1428
|
*/
|
|
1157
|
-
|
|
1429
|
+
var showInput = function showInput(params) {
|
|
1158
1430
|
if (!params.input) {
|
|
1159
1431
|
return;
|
|
1160
1432
|
}
|
|
@@ -1162,13 +1434,13 @@
|
|
|
1162
1434
|
error("Unexpected type of input! Expected ".concat(Object.keys(renderInputType).join(' | '), ", got \"").concat(params.input, "\""));
|
|
1163
1435
|
return;
|
|
1164
1436
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1437
|
+
var inputContainer = getInputContainer(params.input);
|
|
1438
|
+
var input = renderInputType[params.input](inputContainer, params);
|
|
1167
1439
|
show(inputContainer);
|
|
1168
1440
|
|
|
1169
1441
|
// input autofocus
|
|
1170
1442
|
if (params.inputAutoFocus) {
|
|
1171
|
-
setTimeout(()
|
|
1443
|
+
setTimeout(function () {
|
|
1172
1444
|
focusInput(input);
|
|
1173
1445
|
});
|
|
1174
1446
|
}
|
|
@@ -1177,9 +1449,9 @@
|
|
|
1177
1449
|
/**
|
|
1178
1450
|
* @param {HTMLInputElement} input
|
|
1179
1451
|
*/
|
|
1180
|
-
|
|
1181
|
-
for (
|
|
1182
|
-
|
|
1452
|
+
var removeAttributes = function removeAttributes(input) {
|
|
1453
|
+
for (var i = 0; i < input.attributes.length; i++) {
|
|
1454
|
+
var attrName = input.attributes[i].name;
|
|
1183
1455
|
if (!['id', 'type', 'value', 'style'].includes(attrName)) {
|
|
1184
1456
|
input.removeAttribute(attrName);
|
|
1185
1457
|
}
|
|
@@ -1190,13 +1462,13 @@
|
|
|
1190
1462
|
* @param {InputClass} inputClass
|
|
1191
1463
|
* @param {SweetAlertOptions['inputAttributes']} inputAttributes
|
|
1192
1464
|
*/
|
|
1193
|
-
|
|
1194
|
-
|
|
1465
|
+
var setAttributes = function setAttributes(inputClass, inputAttributes) {
|
|
1466
|
+
var input = getInput$1(getPopup(), inputClass);
|
|
1195
1467
|
if (!input) {
|
|
1196
1468
|
return;
|
|
1197
1469
|
}
|
|
1198
1470
|
removeAttributes(input);
|
|
1199
|
-
for (
|
|
1471
|
+
for (var attr in inputAttributes) {
|
|
1200
1472
|
input.setAttribute(attr, inputAttributes[attr]);
|
|
1201
1473
|
}
|
|
1202
1474
|
};
|
|
@@ -1204,9 +1476,9 @@
|
|
|
1204
1476
|
/**
|
|
1205
1477
|
* @param {SweetAlertOptions} params
|
|
1206
1478
|
*/
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
if (
|
|
1479
|
+
var setCustomClass = function setCustomClass(params) {
|
|
1480
|
+
var inputContainer = getInputContainer(params.input);
|
|
1481
|
+
if (_typeof(params.customClass) === 'object') {
|
|
1210
1482
|
addClass(inputContainer, params.customClass.input);
|
|
1211
1483
|
}
|
|
1212
1484
|
};
|
|
@@ -1215,7 +1487,7 @@
|
|
|
1215
1487
|
* @param {HTMLInputElement | HTMLTextAreaElement} input
|
|
1216
1488
|
* @param {SweetAlertOptions} params
|
|
1217
1489
|
*/
|
|
1218
|
-
|
|
1490
|
+
var setInputPlaceholder = function setInputPlaceholder(input, params) {
|
|
1219
1491
|
if (!input.placeholder || params.inputPlaceholder) {
|
|
1220
1492
|
input.placeholder = params.inputPlaceholder;
|
|
1221
1493
|
}
|
|
@@ -1226,13 +1498,13 @@
|
|
|
1226
1498
|
* @param {Input} prependTo
|
|
1227
1499
|
* @param {SweetAlertOptions} params
|
|
1228
1500
|
*/
|
|
1229
|
-
|
|
1501
|
+
var setInputLabel = function setInputLabel(input, prependTo, params) {
|
|
1230
1502
|
if (params.inputLabel) {
|
|
1231
|
-
|
|
1232
|
-
|
|
1503
|
+
var label = document.createElement('label');
|
|
1504
|
+
var labelClass = swalClasses['input-label'];
|
|
1233
1505
|
label.setAttribute('for', input.id);
|
|
1234
1506
|
label.className = labelClass;
|
|
1235
|
-
if (
|
|
1507
|
+
if (_typeof(params.customClass) === 'object') {
|
|
1236
1508
|
addClass(label, params.customClass.inputLabel);
|
|
1237
1509
|
}
|
|
1238
1510
|
label.innerText = params.inputLabel;
|
|
@@ -1244,7 +1516,7 @@
|
|
|
1244
1516
|
* @param {SweetAlertOptions['input']} inputType
|
|
1245
1517
|
* @returns {HTMLElement}
|
|
1246
1518
|
*/
|
|
1247
|
-
|
|
1519
|
+
var getInputContainer = function getInputContainer(inputType) {
|
|
1248
1520
|
return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input);
|
|
1249
1521
|
};
|
|
1250
1522
|
|
|
@@ -1252,23 +1524,23 @@
|
|
|
1252
1524
|
* @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input
|
|
1253
1525
|
* @param {SweetAlertOptions['inputValue']} inputValue
|
|
1254
1526
|
*/
|
|
1255
|
-
|
|
1256
|
-
if (['string', 'number'].includes(
|
|
1527
|
+
var checkAndSetInputValue = function checkAndSetInputValue(input, inputValue) {
|
|
1528
|
+
if (['string', 'number'].includes(_typeof(inputValue))) {
|
|
1257
1529
|
input.value = "".concat(inputValue);
|
|
1258
1530
|
} else if (!isPromise(inputValue)) {
|
|
1259
|
-
warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(
|
|
1531
|
+
warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(inputValue), "\""));
|
|
1260
1532
|
}
|
|
1261
1533
|
};
|
|
1262
1534
|
|
|
1263
1535
|
/** @type {Record<SweetAlertInput, (input: Input | HTMLElement, params: SweetAlertOptions) => Input>} */
|
|
1264
|
-
|
|
1536
|
+
var renderInputType = {};
|
|
1265
1537
|
|
|
1266
1538
|
/**
|
|
1267
1539
|
* @param {HTMLInputElement} input
|
|
1268
1540
|
* @param {SweetAlertOptions} params
|
|
1269
1541
|
* @returns {HTMLInputElement}
|
|
1270
1542
|
*/
|
|
1271
|
-
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = (input, params)
|
|
1543
|
+
renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = function (input, params) {
|
|
1272
1544
|
checkAndSetInputValue(input, params.inputValue);
|
|
1273
1545
|
setInputLabel(input, input, params);
|
|
1274
1546
|
setInputPlaceholder(input, params);
|
|
@@ -1281,7 +1553,7 @@
|
|
|
1281
1553
|
* @param {SweetAlertOptions} params
|
|
1282
1554
|
* @returns {HTMLInputElement}
|
|
1283
1555
|
*/
|
|
1284
|
-
renderInputType.file = (input, params)
|
|
1556
|
+
renderInputType.file = function (input, params) {
|
|
1285
1557
|
setInputLabel(input, input, params);
|
|
1286
1558
|
setInputPlaceholder(input, params);
|
|
1287
1559
|
return input;
|
|
@@ -1292,9 +1564,9 @@
|
|
|
1292
1564
|
* @param {SweetAlertOptions} params
|
|
1293
1565
|
* @returns {HTMLInputElement}
|
|
1294
1566
|
*/
|
|
1295
|
-
renderInputType.range = (range, params)
|
|
1296
|
-
|
|
1297
|
-
|
|
1567
|
+
renderInputType.range = function (range, params) {
|
|
1568
|
+
var rangeInput = range.querySelector('input');
|
|
1569
|
+
var rangeOutput = range.querySelector('output');
|
|
1298
1570
|
checkAndSetInputValue(rangeInput, params.inputValue);
|
|
1299
1571
|
rangeInput.type = params.input;
|
|
1300
1572
|
checkAndSetInputValue(rangeOutput, params.inputValue);
|
|
@@ -1307,10 +1579,10 @@
|
|
|
1307
1579
|
* @param {SweetAlertOptions} params
|
|
1308
1580
|
* @returns {HTMLSelectElement}
|
|
1309
1581
|
*/
|
|
1310
|
-
renderInputType.select = (select, params)
|
|
1582
|
+
renderInputType.select = function (select, params) {
|
|
1311
1583
|
select.textContent = '';
|
|
1312
1584
|
if (params.inputPlaceholder) {
|
|
1313
|
-
|
|
1585
|
+
var placeholder = document.createElement('option');
|
|
1314
1586
|
setInnerHtml(placeholder, params.inputPlaceholder);
|
|
1315
1587
|
placeholder.value = '';
|
|
1316
1588
|
placeholder.disabled = true;
|
|
@@ -1325,7 +1597,7 @@
|
|
|
1325
1597
|
* @param {HTMLInputElement} radio
|
|
1326
1598
|
* @returns {HTMLInputElement}
|
|
1327
1599
|
*/
|
|
1328
|
-
renderInputType.radio = radio
|
|
1600
|
+
renderInputType.radio = function (radio) {
|
|
1329
1601
|
radio.textContent = '';
|
|
1330
1602
|
return radio;
|
|
1331
1603
|
};
|
|
@@ -1335,11 +1607,11 @@
|
|
|
1335
1607
|
* @param {SweetAlertOptions} params
|
|
1336
1608
|
* @returns {HTMLInputElement}
|
|
1337
1609
|
*/
|
|
1338
|
-
renderInputType.checkbox = (checkboxContainer, params)
|
|
1339
|
-
|
|
1610
|
+
renderInputType.checkbox = function (checkboxContainer, params) {
|
|
1611
|
+
var checkbox = getInput$1(getPopup(), 'checkbox');
|
|
1340
1612
|
checkbox.value = '1';
|
|
1341
1613
|
checkbox.checked = Boolean(params.inputValue);
|
|
1342
|
-
|
|
1614
|
+
var label = checkboxContainer.querySelector('span');
|
|
1343
1615
|
setInnerHtml(label, params.inputPlaceholder);
|
|
1344
1616
|
return checkbox;
|
|
1345
1617
|
};
|
|
@@ -1349,7 +1621,7 @@
|
|
|
1349
1621
|
* @param {SweetAlertOptions} params
|
|
1350
1622
|
* @returns {HTMLTextAreaElement}
|
|
1351
1623
|
*/
|
|
1352
|
-
renderInputType.textarea = (textarea, params)
|
|
1624
|
+
renderInputType.textarea = function (textarea, params) {
|
|
1353
1625
|
checkAndSetInputValue(textarea, params.inputValue);
|
|
1354
1626
|
setInputPlaceholder(textarea, params);
|
|
1355
1627
|
setInputLabel(textarea, textarea, params);
|
|
@@ -1358,19 +1630,21 @@
|
|
|
1358
1630
|
* @param {HTMLElement} el
|
|
1359
1631
|
* @returns {number}
|
|
1360
1632
|
*/
|
|
1361
|
-
|
|
1633
|
+
var getMargin = function getMargin(el) {
|
|
1634
|
+
return parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight);
|
|
1635
|
+
};
|
|
1362
1636
|
|
|
1363
1637
|
// https://github.com/sweetalert2/sweetalert2/issues/2291
|
|
1364
|
-
setTimeout(()
|
|
1638
|
+
setTimeout(function () {
|
|
1365
1639
|
// https://github.com/sweetalert2/sweetalert2/issues/1699
|
|
1366
1640
|
if ('MutationObserver' in window) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1641
|
+
var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);
|
|
1642
|
+
var textareaResizeHandler = function textareaResizeHandler() {
|
|
1369
1643
|
// check if texarea is still in document (i.e. popup wasn't closed in the meantime)
|
|
1370
1644
|
if (!document.body.contains(textarea)) {
|
|
1371
1645
|
return;
|
|
1372
1646
|
}
|
|
1373
|
-
|
|
1647
|
+
var textareaWidth = textarea.offsetWidth + getMargin(textarea);
|
|
1374
1648
|
if (textareaWidth > initialPopupWidth) {
|
|
1375
1649
|
getPopup().style.width = "".concat(textareaWidth, "px");
|
|
1376
1650
|
} else {
|
|
@@ -1390,8 +1664,8 @@
|
|
|
1390
1664
|
* @param {SweetAlert} instance
|
|
1391
1665
|
* @param {SweetAlertOptions} params
|
|
1392
1666
|
*/
|
|
1393
|
-
|
|
1394
|
-
|
|
1667
|
+
var renderContent = function renderContent(instance, params) {
|
|
1668
|
+
var htmlContainer = getHtmlContainer();
|
|
1395
1669
|
if (!htmlContainer) {
|
|
1396
1670
|
return;
|
|
1397
1671
|
}
|
|
@@ -1421,8 +1695,8 @@
|
|
|
1421
1695
|
* @param {SweetAlert} instance
|
|
1422
1696
|
* @param {SweetAlertOptions} params
|
|
1423
1697
|
*/
|
|
1424
|
-
|
|
1425
|
-
|
|
1698
|
+
var renderFooter = function renderFooter(instance, params) {
|
|
1699
|
+
var footer = getFooter();
|
|
1426
1700
|
if (!footer) {
|
|
1427
1701
|
return;
|
|
1428
1702
|
}
|
|
@@ -1440,9 +1714,9 @@
|
|
|
1440
1714
|
* @param {SweetAlert} instance
|
|
1441
1715
|
* @param {SweetAlertOptions} params
|
|
1442
1716
|
*/
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1717
|
+
var renderIcon = function renderIcon(instance, params) {
|
|
1718
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
1719
|
+
var icon = getIcon();
|
|
1446
1720
|
if (!icon) {
|
|
1447
1721
|
return;
|
|
1448
1722
|
}
|
|
@@ -1477,8 +1751,11 @@
|
|
|
1477
1751
|
* @param {HTMLElement} icon
|
|
1478
1752
|
* @param {SweetAlertOptions} params
|
|
1479
1753
|
*/
|
|
1480
|
-
|
|
1481
|
-
for (
|
|
1754
|
+
var applyStyles = function applyStyles(icon, params) {
|
|
1755
|
+
for (var _i = 0, _Object$entries = Object.entries(iconTypes); _i < _Object$entries.length; _i++) {
|
|
1756
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
1757
|
+
iconType = _Object$entries$_i[0],
|
|
1758
|
+
iconClassName = _Object$entries$_i[1];
|
|
1482
1759
|
if (params.icon !== iconType) {
|
|
1483
1760
|
removeClass(icon, iconClassName);
|
|
1484
1761
|
}
|
|
@@ -1496,31 +1773,31 @@
|
|
|
1496
1773
|
};
|
|
1497
1774
|
|
|
1498
1775
|
// Adjust success icon background color to match the popup background color
|
|
1499
|
-
|
|
1500
|
-
|
|
1776
|
+
var adjustSuccessIconBackgroundColor = function adjustSuccessIconBackgroundColor() {
|
|
1777
|
+
var popup = getPopup();
|
|
1501
1778
|
if (!popup) {
|
|
1502
1779
|
return;
|
|
1503
1780
|
}
|
|
1504
|
-
|
|
1781
|
+
var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
|
|
1505
1782
|
/** @type {NodeListOf<HTMLElement>} */
|
|
1506
|
-
|
|
1507
|
-
for (
|
|
1783
|
+
var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
|
|
1784
|
+
for (var i = 0; i < successIconParts.length; i++) {
|
|
1508
1785
|
successIconParts[i].style.backgroundColor = popupBackgroundColor;
|
|
1509
1786
|
}
|
|
1510
1787
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1788
|
+
var successIconHtml = "\n <div class=\"swal2-success-circular-line-left\"></div>\n <span class=\"swal2-success-line-tip\"></span> <span class=\"swal2-success-line-long\"></span>\n <div class=\"swal2-success-ring\"></div> <div class=\"swal2-success-fix\"></div>\n <div class=\"swal2-success-circular-line-right\"></div>\n";
|
|
1789
|
+
var errorIconHtml = "\n <span class=\"swal2-x-mark\">\n <span class=\"swal2-x-mark-line-left\"></span>\n <span class=\"swal2-x-mark-line-right\"></span>\n </span>\n";
|
|
1513
1790
|
|
|
1514
1791
|
/**
|
|
1515
1792
|
* @param {HTMLElement} icon
|
|
1516
1793
|
* @param {SweetAlertOptions} params
|
|
1517
1794
|
*/
|
|
1518
|
-
|
|
1795
|
+
var setContent = function setContent(icon, params) {
|
|
1519
1796
|
if (!params.icon && !params.iconHtml) {
|
|
1520
1797
|
return;
|
|
1521
1798
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1799
|
+
var oldContent = icon.innerHTML;
|
|
1800
|
+
var newContent = '';
|
|
1524
1801
|
if (params.iconHtml) {
|
|
1525
1802
|
newContent = iconContent(params.iconHtml);
|
|
1526
1803
|
} else if (params.icon === 'success') {
|
|
@@ -1529,7 +1806,7 @@
|
|
|
1529
1806
|
} else if (params.icon === 'error') {
|
|
1530
1807
|
newContent = errorIconHtml;
|
|
1531
1808
|
} else if (params.icon) {
|
|
1532
|
-
|
|
1809
|
+
var defaultIconHtml = {
|
|
1533
1810
|
question: '?',
|
|
1534
1811
|
warning: '!',
|
|
1535
1812
|
info: 'i'
|
|
@@ -1545,13 +1822,14 @@
|
|
|
1545
1822
|
* @param {HTMLElement} icon
|
|
1546
1823
|
* @param {SweetAlertOptions} params
|
|
1547
1824
|
*/
|
|
1548
|
-
|
|
1825
|
+
var setColor = function setColor(icon, params) {
|
|
1549
1826
|
if (!params.iconColor) {
|
|
1550
1827
|
return;
|
|
1551
1828
|
}
|
|
1552
1829
|
icon.style.color = params.iconColor;
|
|
1553
1830
|
icon.style.borderColor = params.iconColor;
|
|
1554
|
-
for (
|
|
1831
|
+
for (var _i2 = 0, _arr = ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']; _i2 < _arr.length; _i2++) {
|
|
1832
|
+
var sel = _arr[_i2];
|
|
1555
1833
|
setStyle(icon, sel, 'backgroundColor', params.iconColor);
|
|
1556
1834
|
}
|
|
1557
1835
|
setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);
|
|
@@ -1561,14 +1839,16 @@
|
|
|
1561
1839
|
* @param {string} content
|
|
1562
1840
|
* @returns {string}
|
|
1563
1841
|
*/
|
|
1564
|
-
|
|
1842
|
+
var iconContent = function iconContent(content) {
|
|
1843
|
+
return "<div class=\"".concat(swalClasses['icon-content'], "\">").concat(content, "</div>");
|
|
1844
|
+
};
|
|
1565
1845
|
|
|
1566
1846
|
/**
|
|
1567
1847
|
* @param {SweetAlert} instance
|
|
1568
1848
|
* @param {SweetAlertOptions} params
|
|
1569
1849
|
*/
|
|
1570
|
-
|
|
1571
|
-
|
|
1850
|
+
var renderImage = function renderImage(instance, params) {
|
|
1851
|
+
var image = getImage();
|
|
1572
1852
|
if (!image) {
|
|
1573
1853
|
return;
|
|
1574
1854
|
}
|
|
@@ -1595,9 +1875,9 @@
|
|
|
1595
1875
|
* @param {SweetAlert} instance
|
|
1596
1876
|
* @param {SweetAlertOptions} params
|
|
1597
1877
|
*/
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1878
|
+
var renderPopup = function renderPopup(instance, params) {
|
|
1879
|
+
var container = getContainer();
|
|
1880
|
+
var popup = getPopup();
|
|
1601
1881
|
if (!container || !popup) {
|
|
1602
1882
|
return;
|
|
1603
1883
|
}
|
|
@@ -1607,7 +1887,7 @@
|
|
|
1607
1887
|
if (params.toast) {
|
|
1608
1888
|
applyNumericalStyle(container, 'width', params.width);
|
|
1609
1889
|
popup.style.width = '100%';
|
|
1610
|
-
|
|
1890
|
+
var loader = getLoader();
|
|
1611
1891
|
loader && popup.insertBefore(loader, getIcon());
|
|
1612
1892
|
} else {
|
|
1613
1893
|
applyNumericalStyle(popup, 'width', params.width);
|
|
@@ -1635,8 +1915,8 @@
|
|
|
1635
1915
|
* @param {HTMLElement} popup
|
|
1636
1916
|
* @param {SweetAlertOptions} params
|
|
1637
1917
|
*/
|
|
1638
|
-
|
|
1639
|
-
|
|
1918
|
+
var addClasses$1 = function addClasses(popup, params) {
|
|
1919
|
+
var showClass = params.showClass || {};
|
|
1640
1920
|
// Default Class + showClass when updating Swal.update({})
|
|
1641
1921
|
popup.className = "".concat(swalClasses.popup, " ").concat(isVisible$1(popup) ? showClass.popup : '');
|
|
1642
1922
|
if (params.toast) {
|
|
@@ -1662,15 +1942,13 @@
|
|
|
1662
1942
|
* @param {SweetAlert} instance
|
|
1663
1943
|
* @param {SweetAlertOptions} params
|
|
1664
1944
|
*/
|
|
1665
|
-
|
|
1666
|
-
|
|
1945
|
+
var renderProgressSteps = function renderProgressSteps(instance, params) {
|
|
1946
|
+
var progressStepsContainer = getProgressSteps();
|
|
1667
1947
|
if (!progressStepsContainer) {
|
|
1668
1948
|
return;
|
|
1669
1949
|
}
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
currentProgressStep
|
|
1673
|
-
} = params;
|
|
1950
|
+
var progressSteps = params.progressSteps,
|
|
1951
|
+
currentProgressStep = params.currentProgressStep;
|
|
1674
1952
|
if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) {
|
|
1675
1953
|
hide(progressStepsContainer);
|
|
1676
1954
|
return;
|
|
@@ -1680,14 +1958,14 @@
|
|
|
1680
1958
|
if (currentProgressStep >= progressSteps.length) {
|
|
1681
1959
|
warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
|
|
1682
1960
|
}
|
|
1683
|
-
progressSteps.forEach((step, index)
|
|
1684
|
-
|
|
1961
|
+
progressSteps.forEach(function (step, index) {
|
|
1962
|
+
var stepEl = createStepElement(step);
|
|
1685
1963
|
progressStepsContainer.appendChild(stepEl);
|
|
1686
1964
|
if (index === currentProgressStep) {
|
|
1687
1965
|
addClass(stepEl, swalClasses['active-progress-step']);
|
|
1688
1966
|
}
|
|
1689
1967
|
if (index !== progressSteps.length - 1) {
|
|
1690
|
-
|
|
1968
|
+
var lineEl = createLineElement(params);
|
|
1691
1969
|
progressStepsContainer.appendChild(lineEl);
|
|
1692
1970
|
}
|
|
1693
1971
|
});
|
|
@@ -1697,8 +1975,8 @@
|
|
|
1697
1975
|
* @param {string} step
|
|
1698
1976
|
* @returns {HTMLLIElement}
|
|
1699
1977
|
*/
|
|
1700
|
-
|
|
1701
|
-
|
|
1978
|
+
var createStepElement = function createStepElement(step) {
|
|
1979
|
+
var stepEl = document.createElement('li');
|
|
1702
1980
|
addClass(stepEl, swalClasses['progress-step']);
|
|
1703
1981
|
setInnerHtml(stepEl, step);
|
|
1704
1982
|
return stepEl;
|
|
@@ -1708,8 +1986,8 @@
|
|
|
1708
1986
|
* @param {SweetAlertOptions} params
|
|
1709
1987
|
* @returns {HTMLLIElement}
|
|
1710
1988
|
*/
|
|
1711
|
-
|
|
1712
|
-
|
|
1989
|
+
var createLineElement = function createLineElement(params) {
|
|
1990
|
+
var lineEl = document.createElement('li');
|
|
1713
1991
|
addClass(lineEl, swalClasses['progress-step-line']);
|
|
1714
1992
|
if (params.progressStepsDistance) {
|
|
1715
1993
|
applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);
|
|
@@ -1721,8 +1999,8 @@
|
|
|
1721
1999
|
* @param {SweetAlert} instance
|
|
1722
2000
|
* @param {SweetAlertOptions} params
|
|
1723
2001
|
*/
|
|
1724
|
-
|
|
1725
|
-
|
|
2002
|
+
var renderTitle = function renderTitle(instance, params) {
|
|
2003
|
+
var title = getTitle();
|
|
1726
2004
|
if (!title) {
|
|
1727
2005
|
return;
|
|
1728
2006
|
}
|
|
@@ -1743,7 +2021,7 @@
|
|
|
1743
2021
|
* @param {SweetAlert} instance
|
|
1744
2022
|
* @param {SweetAlertOptions} params
|
|
1745
2023
|
*/
|
|
1746
|
-
|
|
2024
|
+
var render = function render(instance, params) {
|
|
1747
2025
|
renderPopup(instance, params);
|
|
1748
2026
|
renderContainer(instance, params);
|
|
1749
2027
|
renderProgressSteps(instance, params);
|
|
@@ -1754,7 +2032,7 @@
|
|
|
1754
2032
|
renderContent(instance, params);
|
|
1755
2033
|
renderActions(instance, params);
|
|
1756
2034
|
renderFooter(instance, params);
|
|
1757
|
-
|
|
2035
|
+
var popup = getPopup();
|
|
1758
2036
|
if (typeof params.didRender === 'function' && popup) {
|
|
1759
2037
|
params.didRender(popup);
|
|
1760
2038
|
}
|
|
@@ -1763,14 +2041,14 @@
|
|
|
1763
2041
|
/*
|
|
1764
2042
|
* Global function to determine if SweetAlert2 popup is shown
|
|
1765
2043
|
*/
|
|
1766
|
-
|
|
2044
|
+
var isVisible = function isVisible() {
|
|
1767
2045
|
return isVisible$1(getPopup());
|
|
1768
2046
|
};
|
|
1769
2047
|
|
|
1770
2048
|
/*
|
|
1771
2049
|
* Global function to click 'Confirm' button
|
|
1772
2050
|
*/
|
|
1773
|
-
|
|
2051
|
+
var clickConfirm = function clickConfirm() {
|
|
1774
2052
|
var _dom$getConfirmButton;
|
|
1775
2053
|
return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click();
|
|
1776
2054
|
};
|
|
@@ -1778,7 +2056,7 @@
|
|
|
1778
2056
|
/*
|
|
1779
2057
|
* Global function to click 'Deny' button
|
|
1780
2058
|
*/
|
|
1781
|
-
|
|
2059
|
+
var clickDeny = function clickDeny() {
|
|
1782
2060
|
var _dom$getDenyButton;
|
|
1783
2061
|
return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click();
|
|
1784
2062
|
};
|
|
@@ -1786,7 +2064,7 @@
|
|
|
1786
2064
|
/*
|
|
1787
2065
|
* Global function to click 'Cancel' button
|
|
1788
2066
|
*/
|
|
1789
|
-
|
|
2067
|
+
var clickCancel = function clickCancel() {
|
|
1790
2068
|
var _dom$getCancelButton;
|
|
1791
2069
|
return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click();
|
|
1792
2070
|
};
|
|
@@ -1794,7 +2072,7 @@
|
|
|
1794
2072
|
/** @typedef {'cancel' | 'backdrop' | 'close' | 'esc' | 'timer'} DismissReason */
|
|
1795
2073
|
|
|
1796
2074
|
/** @type {Record<DismissReason, DismissReason>} */
|
|
1797
|
-
|
|
2075
|
+
var DismissReason = Object.freeze({
|
|
1798
2076
|
cancel: 'cancel',
|
|
1799
2077
|
backdrop: 'backdrop',
|
|
1800
2078
|
close: 'close',
|
|
@@ -1805,7 +2083,7 @@
|
|
|
1805
2083
|
/**
|
|
1806
2084
|
* @param {GlobalState} globalState
|
|
1807
2085
|
*/
|
|
1808
|
-
|
|
2086
|
+
var removeKeydownHandler = function removeKeydownHandler(globalState) {
|
|
1809
2087
|
if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
|
|
1810
2088
|
globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
|
|
1811
2089
|
capture: globalState.keydownListenerCapture
|
|
@@ -1819,10 +2097,12 @@
|
|
|
1819
2097
|
* @param {SweetAlertOptions} innerParams
|
|
1820
2098
|
* @param {*} dismissWith
|
|
1821
2099
|
*/
|
|
1822
|
-
|
|
2100
|
+
var addKeydownHandler = function addKeydownHandler(globalState, innerParams, dismissWith) {
|
|
1823
2101
|
removeKeydownHandler(globalState);
|
|
1824
2102
|
if (!innerParams.toast) {
|
|
1825
|
-
globalState.keydownHandler =
|
|
2103
|
+
globalState.keydownHandler = function (e) {
|
|
2104
|
+
return keydownHandler(innerParams, e, dismissWith);
|
|
2105
|
+
};
|
|
1826
2106
|
globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();
|
|
1827
2107
|
globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
|
|
1828
2108
|
globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
|
|
@@ -1836,9 +2116,9 @@
|
|
|
1836
2116
|
* @param {number} index
|
|
1837
2117
|
* @param {number} increment
|
|
1838
2118
|
*/
|
|
1839
|
-
|
|
2119
|
+
var setFocus = function setFocus(index, increment) {
|
|
1840
2120
|
var _dom$getPopup;
|
|
1841
|
-
|
|
2121
|
+
var focusableElements = getFocusableElements();
|
|
1842
2122
|
// search for visible elements and select the next possible match
|
|
1843
2123
|
if (focusableElements.length) {
|
|
1844
2124
|
index = index + increment;
|
|
@@ -1857,15 +2137,15 @@
|
|
|
1857
2137
|
// no visible focusable elements, focus the popup
|
|
1858
2138
|
(_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus();
|
|
1859
2139
|
};
|
|
1860
|
-
|
|
1861
|
-
|
|
2140
|
+
var arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
|
|
2141
|
+
var arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
|
|
1862
2142
|
|
|
1863
2143
|
/**
|
|
1864
2144
|
* @param {SweetAlertOptions} innerParams
|
|
1865
2145
|
* @param {KeyboardEvent} event
|
|
1866
2146
|
* @param {Function} dismissWith
|
|
1867
2147
|
*/
|
|
1868
|
-
|
|
2148
|
+
var keydownHandler = function keydownHandler(innerParams, event, dismissWith) {
|
|
1869
2149
|
if (!innerParams) {
|
|
1870
2150
|
return; // This instance has already been destroyed
|
|
1871
2151
|
}
|
|
@@ -1892,7 +2172,7 @@
|
|
|
1892
2172
|
}
|
|
1893
2173
|
|
|
1894
2174
|
// ARROWS - switch focus between buttons
|
|
1895
|
-
else if ([
|
|
2175
|
+
else if ([].concat(arrowKeysNextButton, arrowKeysPreviousButton).includes(event.key)) {
|
|
1896
2176
|
handleArrows(event.key);
|
|
1897
2177
|
}
|
|
1898
2178
|
|
|
@@ -1906,12 +2186,12 @@
|
|
|
1906
2186
|
* @param {KeyboardEvent} event
|
|
1907
2187
|
* @param {SweetAlertOptions} innerParams
|
|
1908
2188
|
*/
|
|
1909
|
-
|
|
2189
|
+
var handleEnter = function handleEnter(event, innerParams) {
|
|
1910
2190
|
// https://github.com/sweetalert2/sweetalert2/issues/2386
|
|
1911
2191
|
if (!callIfFunction(innerParams.allowEnterKey)) {
|
|
1912
2192
|
return;
|
|
1913
2193
|
}
|
|
1914
|
-
|
|
2194
|
+
var input = getInput$1(getPopup(), innerParams.input);
|
|
1915
2195
|
if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) {
|
|
1916
2196
|
if (['textarea', 'file'].includes(innerParams.input)) {
|
|
1917
2197
|
return; // do not submit
|
|
@@ -1925,11 +2205,11 @@
|
|
|
1925
2205
|
/**
|
|
1926
2206
|
* @param {KeyboardEvent} event
|
|
1927
2207
|
*/
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
for (
|
|
2208
|
+
var handleTab = function handleTab(event) {
|
|
2209
|
+
var targetElement = event.target;
|
|
2210
|
+
var focusableElements = getFocusableElements();
|
|
2211
|
+
var btnIndex = -1;
|
|
2212
|
+
for (var i = 0; i < focusableElements.length; i++) {
|
|
1933
2213
|
if (targetElement === focusableElements[i]) {
|
|
1934
2214
|
btnIndex = i;
|
|
1935
2215
|
break;
|
|
@@ -1952,25 +2232,25 @@
|
|
|
1952
2232
|
/**
|
|
1953
2233
|
* @param {string} key
|
|
1954
2234
|
*/
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
2235
|
+
var handleArrows = function handleArrows(key) {
|
|
2236
|
+
var actions = getActions();
|
|
2237
|
+
var confirmButton = getConfirmButton();
|
|
2238
|
+
var denyButton = getDenyButton();
|
|
2239
|
+
var cancelButton = getCancelButton();
|
|
1960
2240
|
if (!actions || !confirmButton || !denyButton || !cancelButton) {
|
|
1961
2241
|
return;
|
|
1962
2242
|
}
|
|
1963
2243
|
/** @type HTMLElement[] */
|
|
1964
|
-
|
|
2244
|
+
var buttons = [confirmButton, denyButton, cancelButton];
|
|
1965
2245
|
if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) {
|
|
1966
2246
|
return;
|
|
1967
2247
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
2248
|
+
var sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
|
|
2249
|
+
var buttonToFocus = document.activeElement;
|
|
1970
2250
|
if (!buttonToFocus) {
|
|
1971
2251
|
return;
|
|
1972
2252
|
}
|
|
1973
|
-
for (
|
|
2253
|
+
for (var i = 0; i < actions.children.length; i++) {
|
|
1974
2254
|
buttonToFocus = buttonToFocus[sibling];
|
|
1975
2255
|
if (!buttonToFocus) {
|
|
1976
2256
|
return;
|
|
@@ -1989,7 +2269,7 @@
|
|
|
1989
2269
|
* @param {SweetAlertOptions} innerParams
|
|
1990
2270
|
* @param {Function} dismissWith
|
|
1991
2271
|
*/
|
|
1992
|
-
|
|
2272
|
+
var handleEsc = function handleEsc(event, innerParams, dismissWith) {
|
|
1993
2273
|
if (callIfFunction(innerParams.allowEscapeKey)) {
|
|
1994
2274
|
event.preventDefault();
|
|
1995
2275
|
dismissWith(DismissReason.esc);
|
|
@@ -2016,9 +2296,9 @@
|
|
|
2016
2296
|
// elements not within the active modal dialog will not be surfaced if a user opens a screen
|
|
2017
2297
|
// reader’s list of elements (headings, form controls, landmarks, etc.) in the document.
|
|
2018
2298
|
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
bodyChildren.forEach(el
|
|
2299
|
+
var setAriaHidden = function setAriaHidden() {
|
|
2300
|
+
var bodyChildren = Array.from(document.body.children);
|
|
2301
|
+
bodyChildren.forEach(function (el) {
|
|
2022
2302
|
if (el === getContainer() || el.contains(getContainer())) {
|
|
2023
2303
|
return;
|
|
2024
2304
|
}
|
|
@@ -2028,9 +2308,9 @@
|
|
|
2028
2308
|
el.setAttribute('aria-hidden', 'true');
|
|
2029
2309
|
});
|
|
2030
2310
|
};
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
bodyChildren.forEach(el
|
|
2311
|
+
var unsetAriaHidden = function unsetAriaHidden() {
|
|
2312
|
+
var bodyChildren = Array.from(document.body.children);
|
|
2313
|
+
bodyChildren.forEach(function (el) {
|
|
2034
2314
|
if (el.hasAttribute('data-previous-aria-hidden')) {
|
|
2035
2315
|
el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || '');
|
|
2036
2316
|
el.removeAttribute('data-previous-aria-hidden');
|
|
@@ -2041,15 +2321,15 @@
|
|
|
2041
2321
|
};
|
|
2042
2322
|
|
|
2043
2323
|
// @ts-ignore
|
|
2044
|
-
|
|
2324
|
+
var isSafariOrIOS = typeof window !== 'undefined' && !!window.GestureEvent; // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394
|
|
2045
2325
|
|
|
2046
2326
|
/**
|
|
2047
2327
|
* Fix iOS scrolling
|
|
2048
2328
|
* http://stackoverflow.com/q/39626302
|
|
2049
2329
|
*/
|
|
2050
|
-
|
|
2330
|
+
var iOSfix = function iOSfix() {
|
|
2051
2331
|
if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) {
|
|
2052
|
-
|
|
2332
|
+
var offset = document.body.scrollTop;
|
|
2053
2333
|
document.body.style.top = "".concat(offset * -1, "px");
|
|
2054
2334
|
addClass(document.body, swalClasses.iosfix);
|
|
2055
2335
|
lockBodyScroll();
|
|
@@ -2059,23 +2339,23 @@
|
|
|
2059
2339
|
/**
|
|
2060
2340
|
* https://github.com/sweetalert2/sweetalert2/issues/1246
|
|
2061
2341
|
*/
|
|
2062
|
-
|
|
2063
|
-
|
|
2342
|
+
var lockBodyScroll = function lockBodyScroll() {
|
|
2343
|
+
var container = getContainer();
|
|
2064
2344
|
if (!container) {
|
|
2065
2345
|
return;
|
|
2066
2346
|
}
|
|
2067
2347
|
/** @type {boolean} */
|
|
2068
|
-
|
|
2348
|
+
var preventTouchMove;
|
|
2069
2349
|
/**
|
|
2070
2350
|
* @param {TouchEvent} event
|
|
2071
2351
|
*/
|
|
2072
|
-
container.ontouchstart = event
|
|
2352
|
+
container.ontouchstart = function (event) {
|
|
2073
2353
|
preventTouchMove = shouldPreventTouchMove(event);
|
|
2074
2354
|
};
|
|
2075
2355
|
/**
|
|
2076
2356
|
* @param {TouchEvent} event
|
|
2077
2357
|
*/
|
|
2078
|
-
container.ontouchmove = event
|
|
2358
|
+
container.ontouchmove = function (event) {
|
|
2079
2359
|
if (preventTouchMove) {
|
|
2080
2360
|
event.preventDefault();
|
|
2081
2361
|
event.stopPropagation();
|
|
@@ -2087,10 +2367,10 @@
|
|
|
2087
2367
|
* @param {TouchEvent} event
|
|
2088
2368
|
* @returns {boolean}
|
|
2089
2369
|
*/
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2370
|
+
var shouldPreventTouchMove = function shouldPreventTouchMove(event) {
|
|
2371
|
+
var target = event.target;
|
|
2372
|
+
var container = getContainer();
|
|
2373
|
+
var htmlContainer = getHtmlContainer();
|
|
2094
2374
|
if (!container || !htmlContainer) {
|
|
2095
2375
|
return false;
|
|
2096
2376
|
}
|
|
@@ -2118,7 +2398,7 @@
|
|
|
2118
2398
|
* @param {*} event
|
|
2119
2399
|
* @returns {boolean}
|
|
2120
2400
|
*/
|
|
2121
|
-
|
|
2401
|
+
var isStylus = function isStylus(event) {
|
|
2122
2402
|
return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';
|
|
2123
2403
|
};
|
|
2124
2404
|
|
|
@@ -2128,12 +2408,12 @@
|
|
|
2128
2408
|
* @param {TouchEvent} event
|
|
2129
2409
|
* @returns {boolean}
|
|
2130
2410
|
*/
|
|
2131
|
-
|
|
2411
|
+
var isZoom = function isZoom(event) {
|
|
2132
2412
|
return event.touches && event.touches.length > 1;
|
|
2133
2413
|
};
|
|
2134
|
-
|
|
2414
|
+
var undoIOSfix = function undoIOSfix() {
|
|
2135
2415
|
if (hasClass(document.body, swalClasses.iosfix)) {
|
|
2136
|
-
|
|
2416
|
+
var offset = parseInt(document.body.style.top, 10);
|
|
2137
2417
|
removeClass(document.body, swalClasses.iosfix);
|
|
2138
2418
|
document.body.style.top = '';
|
|
2139
2419
|
document.body.scrollTop = offset * -1;
|
|
@@ -2146,11 +2426,11 @@
|
|
|
2146
2426
|
*
|
|
2147
2427
|
* @returns {number}
|
|
2148
2428
|
*/
|
|
2149
|
-
|
|
2150
|
-
|
|
2429
|
+
var measureScrollbar = function measureScrollbar() {
|
|
2430
|
+
var scrollDiv = document.createElement('div');
|
|
2151
2431
|
scrollDiv.className = swalClasses['scrollbar-measure'];
|
|
2152
2432
|
document.body.appendChild(scrollDiv);
|
|
2153
|
-
|
|
2433
|
+
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
|
2154
2434
|
document.body.removeChild(scrollDiv);
|
|
2155
2435
|
return scrollbarWidth;
|
|
2156
2436
|
};
|
|
@@ -2159,12 +2439,12 @@
|
|
|
2159
2439
|
* Remember state in cases where opening and handling a modal will fiddle with it.
|
|
2160
2440
|
* @type {number | null}
|
|
2161
2441
|
*/
|
|
2162
|
-
|
|
2442
|
+
var previousBodyPadding = null;
|
|
2163
2443
|
|
|
2164
2444
|
/**
|
|
2165
2445
|
* @param {string} initialBodyOverflow
|
|
2166
2446
|
*/
|
|
2167
|
-
|
|
2447
|
+
var replaceScrollbarWithPadding = function replaceScrollbarWithPadding(initialBodyOverflow) {
|
|
2168
2448
|
// for queues, do not do this more than once
|
|
2169
2449
|
if (previousBodyPadding !== null) {
|
|
2170
2450
|
return;
|
|
@@ -2177,7 +2457,7 @@
|
|
|
2177
2457
|
document.body.style.paddingRight = "".concat(previousBodyPadding + measureScrollbar(), "px");
|
|
2178
2458
|
}
|
|
2179
2459
|
};
|
|
2180
|
-
|
|
2460
|
+
var undoReplaceScrollbarWithPadding = function undoReplaceScrollbarWithPadding() {
|
|
2181
2461
|
if (previousBodyPadding !== null) {
|
|
2182
2462
|
document.body.style.paddingRight = "".concat(previousBodyPadding, "px");
|
|
2183
2463
|
previousBodyPadding = null;
|
|
@@ -2194,7 +2474,9 @@
|
|
|
2194
2474
|
if (isToast()) {
|
|
2195
2475
|
triggerDidCloseAndDispose(instance, didClose);
|
|
2196
2476
|
} else {
|
|
2197
|
-
restoreActiveElement(returnFocus).then(()
|
|
2477
|
+
restoreActiveElement(returnFocus).then(function () {
|
|
2478
|
+
return triggerDidCloseAndDispose(instance, didClose);
|
|
2479
|
+
});
|
|
2198
2480
|
removeKeydownHandler(globalState);
|
|
2199
2481
|
}
|
|
2200
2482
|
|
|
@@ -2229,8 +2511,8 @@
|
|
|
2229
2511
|
*/
|
|
2230
2512
|
function close(resolveValue) {
|
|
2231
2513
|
resolveValue = prepareResolveValue(resolveValue);
|
|
2232
|
-
|
|
2233
|
-
|
|
2514
|
+
var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
|
|
2515
|
+
var didClose = triggerClosePopup(this);
|
|
2234
2516
|
if (this.isAwaitingPromise) {
|
|
2235
2517
|
// A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335
|
|
2236
2518
|
if (!resolveValue.isDismissed) {
|
|
@@ -2242,18 +2524,18 @@
|
|
|
2242
2524
|
swalPromiseResolve(resolveValue);
|
|
2243
2525
|
}
|
|
2244
2526
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2527
|
+
var triggerClosePopup = function triggerClosePopup(instance) {
|
|
2528
|
+
var popup = getPopup();
|
|
2247
2529
|
if (!popup) {
|
|
2248
2530
|
return false;
|
|
2249
2531
|
}
|
|
2250
|
-
|
|
2532
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
2251
2533
|
if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {
|
|
2252
2534
|
return false;
|
|
2253
2535
|
}
|
|
2254
2536
|
removeClass(popup, innerParams.showClass.popup);
|
|
2255
2537
|
addClass(popup, innerParams.hideClass.popup);
|
|
2256
|
-
|
|
2538
|
+
var backdrop = getContainer();
|
|
2257
2539
|
removeClass(backdrop, innerParams.showClass.backdrop);
|
|
2258
2540
|
addClass(backdrop, innerParams.hideClass.backdrop);
|
|
2259
2541
|
handlePopupAnimation(instance, popup, innerParams);
|
|
@@ -2264,7 +2546,7 @@
|
|
|
2264
2546
|
* @param {any} error
|
|
2265
2547
|
*/
|
|
2266
2548
|
function rejectPromise(error) {
|
|
2267
|
-
|
|
2549
|
+
var rejectPromise = privateMethods.swalPromiseReject.get(this);
|
|
2268
2550
|
handleAwaitingPromise(this);
|
|
2269
2551
|
if (rejectPromise) {
|
|
2270
2552
|
// Reject Swal promise
|
|
@@ -2275,7 +2557,7 @@
|
|
|
2275
2557
|
/**
|
|
2276
2558
|
* @param {SweetAlert} instance
|
|
2277
2559
|
*/
|
|
2278
|
-
|
|
2560
|
+
var handleAwaitingPromise = function handleAwaitingPromise(instance) {
|
|
2279
2561
|
if (instance.isAwaitingPromise) {
|
|
2280
2562
|
delete instance.isAwaitingPromise;
|
|
2281
2563
|
// The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335
|
|
@@ -2289,7 +2571,7 @@
|
|
|
2289
2571
|
* @param {any} resolveValue
|
|
2290
2572
|
* @returns {SweetAlertResult}
|
|
2291
2573
|
*/
|
|
2292
|
-
|
|
2574
|
+
var prepareResolveValue = function prepareResolveValue(resolveValue) {
|
|
2293
2575
|
// When user calls Swal.close()
|
|
2294
2576
|
if (typeof resolveValue === 'undefined') {
|
|
2295
2577
|
return {
|
|
@@ -2310,10 +2592,10 @@
|
|
|
2310
2592
|
* @param {HTMLElement} popup
|
|
2311
2593
|
* @param {SweetAlertOptions} innerParams
|
|
2312
2594
|
*/
|
|
2313
|
-
|
|
2314
|
-
|
|
2595
|
+
var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) {
|
|
2596
|
+
var container = getContainer();
|
|
2315
2597
|
// If animation is supported, animate
|
|
2316
|
-
|
|
2598
|
+
var animationIsSupported = animationEndEvent && hasCssAnimation(popup);
|
|
2317
2599
|
if (typeof innerParams.willClose === 'function') {
|
|
2318
2600
|
innerParams.willClose(popup);
|
|
2319
2601
|
}
|
|
@@ -2332,7 +2614,7 @@
|
|
|
2332
2614
|
* @param {boolean} returnFocus
|
|
2333
2615
|
* @param {Function} didClose
|
|
2334
2616
|
*/
|
|
2335
|
-
|
|
2617
|
+
var animatePopup = function animatePopup(instance, popup, container, returnFocus, didClose) {
|
|
2336
2618
|
if (!animationEndEvent) {
|
|
2337
2619
|
return;
|
|
2338
2620
|
}
|
|
@@ -2349,8 +2631,8 @@
|
|
|
2349
2631
|
* @param {SweetAlert} instance
|
|
2350
2632
|
* @param {Function} didClose
|
|
2351
2633
|
*/
|
|
2352
|
-
|
|
2353
|
-
setTimeout(()
|
|
2634
|
+
var triggerDidCloseAndDispose = function triggerDidCloseAndDispose(instance, didClose) {
|
|
2635
|
+
setTimeout(function () {
|
|
2354
2636
|
if (typeof didClose === 'function') {
|
|
2355
2637
|
didClose.bind(instance.params)();
|
|
2356
2638
|
}
|
|
@@ -2367,8 +2649,8 @@
|
|
|
2367
2649
|
*
|
|
2368
2650
|
* @param {HTMLButtonElement | null} [buttonToReplace]
|
|
2369
2651
|
*/
|
|
2370
|
-
|
|
2371
|
-
|
|
2652
|
+
var showLoading = function showLoading(buttonToReplace) {
|
|
2653
|
+
var popup = getPopup();
|
|
2372
2654
|
if (!popup) {
|
|
2373
2655
|
new Swal(); // eslint-disable-line no-new
|
|
2374
2656
|
}
|
|
@@ -2377,7 +2659,7 @@
|
|
|
2377
2659
|
if (!popup) {
|
|
2378
2660
|
return;
|
|
2379
2661
|
}
|
|
2380
|
-
|
|
2662
|
+
var loader = getLoader();
|
|
2381
2663
|
if (isToast()) {
|
|
2382
2664
|
hide(getIcon());
|
|
2383
2665
|
} else {
|
|
@@ -2393,9 +2675,9 @@
|
|
|
2393
2675
|
* @param {HTMLElement} popup
|
|
2394
2676
|
* @param {HTMLButtonElement | null} [buttonToReplace]
|
|
2395
2677
|
*/
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2678
|
+
var replaceButton = function replaceButton(popup, buttonToReplace) {
|
|
2679
|
+
var actions = getActions();
|
|
2680
|
+
var loader = getLoader();
|
|
2399
2681
|
if (!actions || !loader) {
|
|
2400
2682
|
return;
|
|
2401
2683
|
}
|
|
@@ -2415,10 +2697,12 @@
|
|
|
2415
2697
|
* @param {SweetAlert} instance
|
|
2416
2698
|
* @param {SweetAlertOptions} params
|
|
2417
2699
|
*/
|
|
2418
|
-
|
|
2700
|
+
var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) {
|
|
2419
2701
|
if (params.input === 'select' || params.input === 'radio') {
|
|
2420
2702
|
handleInputOptions(instance, params);
|
|
2421
|
-
} else if (['text', 'email', 'number', 'tel', 'textarea'].some(
|
|
2703
|
+
} else if (['text', 'email', 'number', 'tel', 'textarea'].some(function (i) {
|
|
2704
|
+
return i === params.input;
|
|
2705
|
+
}) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {
|
|
2422
2706
|
showLoading(getConfirmButton());
|
|
2423
2707
|
handleInputValue(instance, params);
|
|
2424
2708
|
}
|
|
@@ -2429,8 +2713,8 @@
|
|
|
2429
2713
|
* @param {SweetAlertOptions} innerParams
|
|
2430
2714
|
* @returns {SweetAlertInputValue}
|
|
2431
2715
|
*/
|
|
2432
|
-
|
|
2433
|
-
|
|
2716
|
+
var getInputValue = function getInputValue(instance, innerParams) {
|
|
2717
|
+
var input = instance.getInput();
|
|
2434
2718
|
if (!input) {
|
|
2435
2719
|
return null;
|
|
2436
2720
|
}
|
|
@@ -2450,33 +2734,39 @@
|
|
|
2450
2734
|
* @param {HTMLInputElement} input
|
|
2451
2735
|
* @returns {number}
|
|
2452
2736
|
*/
|
|
2453
|
-
|
|
2737
|
+
var getCheckboxValue = function getCheckboxValue(input) {
|
|
2738
|
+
return input.checked ? 1 : 0;
|
|
2739
|
+
};
|
|
2454
2740
|
|
|
2455
2741
|
/**
|
|
2456
2742
|
* @param {HTMLInputElement} input
|
|
2457
2743
|
* @returns {string | null}
|
|
2458
2744
|
*/
|
|
2459
|
-
|
|
2745
|
+
var getRadioValue = function getRadioValue(input) {
|
|
2746
|
+
return input.checked ? input.value : null;
|
|
2747
|
+
};
|
|
2460
2748
|
|
|
2461
2749
|
/**
|
|
2462
2750
|
* @param {HTMLInputElement} input
|
|
2463
2751
|
* @returns {FileList | File | null}
|
|
2464
2752
|
*/
|
|
2465
|
-
|
|
2753
|
+
var getFileValue = function getFileValue(input) {
|
|
2754
|
+
return input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;
|
|
2755
|
+
};
|
|
2466
2756
|
|
|
2467
2757
|
/**
|
|
2468
2758
|
* @param {SweetAlert} instance
|
|
2469
2759
|
* @param {SweetAlertOptions} params
|
|
2470
2760
|
*/
|
|
2471
|
-
|
|
2472
|
-
|
|
2761
|
+
var handleInputOptions = function handleInputOptions(instance, params) {
|
|
2762
|
+
var popup = getPopup();
|
|
2473
2763
|
if (!popup) {
|
|
2474
2764
|
return;
|
|
2475
2765
|
}
|
|
2476
2766
|
/**
|
|
2477
2767
|
* @param {Record<string, any>} inputOptions
|
|
2478
2768
|
*/
|
|
2479
|
-
|
|
2769
|
+
var processInputOptions = function processInputOptions(inputOptions) {
|
|
2480
2770
|
if (params.input === 'select') {
|
|
2481
2771
|
populateSelectOptions(popup, formatInputOptions(inputOptions), params);
|
|
2482
2772
|
} else if (params.input === 'radio') {
|
|
@@ -2485,14 +2775,14 @@
|
|
|
2485
2775
|
};
|
|
2486
2776
|
if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {
|
|
2487
2777
|
showLoading(getConfirmButton());
|
|
2488
|
-
asPromise(params.inputOptions).then(inputOptions
|
|
2778
|
+
asPromise(params.inputOptions).then(function (inputOptions) {
|
|
2489
2779
|
instance.hideLoading();
|
|
2490
2780
|
processInputOptions(inputOptions);
|
|
2491
2781
|
});
|
|
2492
|
-
} else if (
|
|
2782
|
+
} else if (_typeof(params.inputOptions) === 'object') {
|
|
2493
2783
|
processInputOptions(params.inputOptions);
|
|
2494
2784
|
} else {
|
|
2495
|
-
error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(
|
|
2785
|
+
error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions)));
|
|
2496
2786
|
}
|
|
2497
2787
|
};
|
|
2498
2788
|
|
|
@@ -2500,18 +2790,18 @@
|
|
|
2500
2790
|
* @param {SweetAlert} instance
|
|
2501
2791
|
* @param {SweetAlertOptions} params
|
|
2502
2792
|
*/
|
|
2503
|
-
|
|
2504
|
-
|
|
2793
|
+
var handleInputValue = function handleInputValue(instance, params) {
|
|
2794
|
+
var input = instance.getInput();
|
|
2505
2795
|
if (!input) {
|
|
2506
2796
|
return;
|
|
2507
2797
|
}
|
|
2508
2798
|
hide(input);
|
|
2509
|
-
asPromise(params.inputValue).then(inputValue
|
|
2799
|
+
asPromise(params.inputValue).then(function (inputValue) {
|
|
2510
2800
|
input.value = params.input === 'number' ? "".concat(parseFloat(inputValue) || 0) : "".concat(inputValue);
|
|
2511
2801
|
show(input);
|
|
2512
2802
|
input.focus();
|
|
2513
2803
|
instance.hideLoading();
|
|
2514
|
-
})
|
|
2804
|
+
})["catch"](function (err) {
|
|
2515
2805
|
error("Error in inputValue promise: ".concat(err));
|
|
2516
2806
|
input.value = '';
|
|
2517
2807
|
show(input);
|
|
@@ -2526,7 +2816,7 @@
|
|
|
2526
2816
|
* @param {SweetAlertOptions} params
|
|
2527
2817
|
*/
|
|
2528
2818
|
function populateSelectOptions(popup, inputOptions, params) {
|
|
2529
|
-
|
|
2819
|
+
var select = getDirectChildByClass(popup, swalClasses.select);
|
|
2530
2820
|
if (!select) {
|
|
2531
2821
|
return;
|
|
2532
2822
|
}
|
|
@@ -2535,27 +2825,29 @@
|
|
|
2535
2825
|
* @param {string} optionLabel
|
|
2536
2826
|
* @param {string} optionValue
|
|
2537
2827
|
*/
|
|
2538
|
-
|
|
2539
|
-
|
|
2828
|
+
var renderOption = function renderOption(parent, optionLabel, optionValue) {
|
|
2829
|
+
var option = document.createElement('option');
|
|
2540
2830
|
option.value = optionValue;
|
|
2541
2831
|
setInnerHtml(option, optionLabel);
|
|
2542
2832
|
option.selected = isSelected(optionValue, params.inputValue);
|
|
2543
2833
|
parent.appendChild(option);
|
|
2544
2834
|
};
|
|
2545
|
-
inputOptions.forEach(inputOption
|
|
2546
|
-
|
|
2547
|
-
|
|
2835
|
+
inputOptions.forEach(function (inputOption) {
|
|
2836
|
+
var optionValue = inputOption[0];
|
|
2837
|
+
var optionLabel = inputOption[1];
|
|
2548
2838
|
// <optgroup> spec:
|
|
2549
2839
|
// https://www.w3.org/TR/html401/interact/forms.html#h-17.6
|
|
2550
2840
|
// "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..."
|
|
2551
2841
|
// check whether this is a <optgroup>
|
|
2552
2842
|
if (Array.isArray(optionLabel)) {
|
|
2553
2843
|
// if it is an array, then it is an <optgroup>
|
|
2554
|
-
|
|
2844
|
+
var optgroup = document.createElement('optgroup');
|
|
2555
2845
|
optgroup.label = optionValue;
|
|
2556
2846
|
optgroup.disabled = false; // not configurable for now
|
|
2557
2847
|
select.appendChild(optgroup);
|
|
2558
|
-
optionLabel.forEach(
|
|
2848
|
+
optionLabel.forEach(function (o) {
|
|
2849
|
+
return renderOption(optgroup, o[1], o[0]);
|
|
2850
|
+
});
|
|
2559
2851
|
} else {
|
|
2560
2852
|
// case of <option>
|
|
2561
2853
|
renderOption(select, optionLabel, optionValue);
|
|
@@ -2570,29 +2862,29 @@
|
|
|
2570
2862
|
* @param {SweetAlertOptions} params
|
|
2571
2863
|
*/
|
|
2572
2864
|
function populateRadioOptions(popup, inputOptions, params) {
|
|
2573
|
-
|
|
2865
|
+
var radio = getDirectChildByClass(popup, swalClasses.radio);
|
|
2574
2866
|
if (!radio) {
|
|
2575
2867
|
return;
|
|
2576
2868
|
}
|
|
2577
|
-
inputOptions.forEach(inputOption
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2869
|
+
inputOptions.forEach(function (inputOption) {
|
|
2870
|
+
var radioValue = inputOption[0];
|
|
2871
|
+
var radioLabel = inputOption[1];
|
|
2872
|
+
var radioInput = document.createElement('input');
|
|
2873
|
+
var radioLabelElement = document.createElement('label');
|
|
2582
2874
|
radioInput.type = 'radio';
|
|
2583
2875
|
radioInput.name = swalClasses.radio;
|
|
2584
2876
|
radioInput.value = radioValue;
|
|
2585
2877
|
if (isSelected(radioValue, params.inputValue)) {
|
|
2586
2878
|
radioInput.checked = true;
|
|
2587
2879
|
}
|
|
2588
|
-
|
|
2880
|
+
var label = document.createElement('span');
|
|
2589
2881
|
setInnerHtml(label, radioLabel);
|
|
2590
2882
|
label.className = swalClasses.label;
|
|
2591
2883
|
radioLabelElement.appendChild(radioInput);
|
|
2592
2884
|
radioLabelElement.appendChild(label);
|
|
2593
2885
|
radio.appendChild(radioLabelElement);
|
|
2594
2886
|
});
|
|
2595
|
-
|
|
2887
|
+
var radios = radio.querySelectorAll('input');
|
|
2596
2888
|
if (radios.length) {
|
|
2597
2889
|
radios[0].focus();
|
|
2598
2890
|
}
|
|
@@ -2605,22 +2897,22 @@
|
|
|
2605
2897
|
* @typedef {string[]} InputOptionFlattened
|
|
2606
2898
|
* @returns {InputOptionFlattened[]}
|
|
2607
2899
|
*/
|
|
2608
|
-
|
|
2900
|
+
var formatInputOptions = function formatInputOptions(inputOptions) {
|
|
2609
2901
|
/** @type {InputOptionFlattened[]} */
|
|
2610
|
-
|
|
2902
|
+
var result = [];
|
|
2611
2903
|
if (inputOptions instanceof Map) {
|
|
2612
|
-
inputOptions.forEach((value, key)
|
|
2613
|
-
|
|
2614
|
-
if (
|
|
2904
|
+
inputOptions.forEach(function (value, key) {
|
|
2905
|
+
var valueFormatted = value;
|
|
2906
|
+
if (_typeof(valueFormatted) === 'object') {
|
|
2615
2907
|
// case of <optgroup>
|
|
2616
2908
|
valueFormatted = formatInputOptions(valueFormatted);
|
|
2617
2909
|
}
|
|
2618
2910
|
result.push([key, valueFormatted]);
|
|
2619
2911
|
});
|
|
2620
2912
|
} else {
|
|
2621
|
-
Object.keys(inputOptions).forEach(key
|
|
2622
|
-
|
|
2623
|
-
if (
|
|
2913
|
+
Object.keys(inputOptions).forEach(function (key) {
|
|
2914
|
+
var valueFormatted = inputOptions[key];
|
|
2915
|
+
if (_typeof(valueFormatted) === 'object') {
|
|
2624
2916
|
// case of <optgroup>
|
|
2625
2917
|
valueFormatted = formatInputOptions(valueFormatted);
|
|
2626
2918
|
}
|
|
@@ -2635,15 +2927,17 @@
|
|
|
2635
2927
|
* @param {SweetAlertInputValue} inputValue
|
|
2636
2928
|
* @returns {boolean}
|
|
2637
2929
|
*/
|
|
2638
|
-
|
|
2930
|
+
var isSelected = function isSelected(optionValue, inputValue) {
|
|
2639
2931
|
return !!inputValue && inputValue.toString() === optionValue.toString();
|
|
2640
2932
|
};
|
|
2641
2933
|
|
|
2934
|
+
var _this = undefined;
|
|
2935
|
+
|
|
2642
2936
|
/**
|
|
2643
2937
|
* @param {SweetAlert} instance
|
|
2644
2938
|
*/
|
|
2645
|
-
|
|
2646
|
-
|
|
2939
|
+
var handleConfirmButtonClick = function handleConfirmButtonClick(instance) {
|
|
2940
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
2647
2941
|
instance.disableButtons();
|
|
2648
2942
|
if (innerParams.input) {
|
|
2649
2943
|
handleConfirmOrDenyWithInput(instance, 'confirm');
|
|
@@ -2655,8 +2949,8 @@
|
|
|
2655
2949
|
/**
|
|
2656
2950
|
* @param {SweetAlert} instance
|
|
2657
2951
|
*/
|
|
2658
|
-
|
|
2659
|
-
|
|
2952
|
+
var handleDenyButtonClick = function handleDenyButtonClick(instance) {
|
|
2953
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
2660
2954
|
instance.disableButtons();
|
|
2661
2955
|
if (innerParams.returnInputValueOnDeny) {
|
|
2662
2956
|
handleConfirmOrDenyWithInput(instance, 'deny');
|
|
@@ -2669,7 +2963,7 @@
|
|
|
2669
2963
|
* @param {SweetAlert} instance
|
|
2670
2964
|
* @param {Function} dismissWith
|
|
2671
2965
|
*/
|
|
2672
|
-
|
|
2966
|
+
var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) {
|
|
2673
2967
|
instance.disableButtons();
|
|
2674
2968
|
dismissWith(DismissReason.cancel);
|
|
2675
2969
|
};
|
|
@@ -2678,14 +2972,14 @@
|
|
|
2678
2972
|
* @param {SweetAlert} instance
|
|
2679
2973
|
* @param {'confirm' | 'deny'} type
|
|
2680
2974
|
*/
|
|
2681
|
-
|
|
2682
|
-
|
|
2975
|
+
var handleConfirmOrDenyWithInput = function handleConfirmOrDenyWithInput(instance, type) {
|
|
2976
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
2683
2977
|
if (!innerParams.input) {
|
|
2684
2978
|
error("The \"input\" parameter is needed to be set when using returnInputValueOn".concat(capitalizeFirstLetter(type)));
|
|
2685
2979
|
return;
|
|
2686
2980
|
}
|
|
2687
|
-
|
|
2688
|
-
|
|
2981
|
+
var input = instance.getInput();
|
|
2982
|
+
var inputValue = getInputValue(instance, innerParams);
|
|
2689
2983
|
if (innerParams.inputValidator) {
|
|
2690
2984
|
handleInputValidator(instance, inputValue, type);
|
|
2691
2985
|
} else if (input && !input.checkValidity()) {
|
|
@@ -2703,11 +2997,13 @@
|
|
|
2703
2997
|
* @param {SweetAlertInputValue} inputValue
|
|
2704
2998
|
* @param {'confirm' | 'deny'} type
|
|
2705
2999
|
*/
|
|
2706
|
-
|
|
2707
|
-
|
|
3000
|
+
var handleInputValidator = function handleInputValidator(instance, inputValue, type) {
|
|
3001
|
+
var innerParams = privateProps.innerParams.get(instance);
|
|
2708
3002
|
instance.disableInput();
|
|
2709
|
-
|
|
2710
|
-
|
|
3003
|
+
var validationPromise = Promise.resolve().then(function () {
|
|
3004
|
+
return asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage));
|
|
3005
|
+
});
|
|
3006
|
+
validationPromise.then(function (validationMessage) {
|
|
2711
3007
|
instance.enableButtons();
|
|
2712
3008
|
instance.enableInput();
|
|
2713
3009
|
if (validationMessage) {
|
|
@@ -2724,15 +3020,17 @@
|
|
|
2724
3020
|
* @param {SweetAlert} instance
|
|
2725
3021
|
* @param {any} value
|
|
2726
3022
|
*/
|
|
2727
|
-
|
|
2728
|
-
|
|
3023
|
+
var deny = function deny(instance, value) {
|
|
3024
|
+
var innerParams = privateProps.innerParams.get(instance || _this);
|
|
2729
3025
|
if (innerParams.showLoaderOnDeny) {
|
|
2730
3026
|
showLoading(getDenyButton());
|
|
2731
3027
|
}
|
|
2732
3028
|
if (innerParams.preDeny) {
|
|
2733
3029
|
instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received
|
|
2734
|
-
|
|
2735
|
-
|
|
3030
|
+
var preDenyPromise = Promise.resolve().then(function () {
|
|
3031
|
+
return asPromise(innerParams.preDeny(value, innerParams.validationMessage));
|
|
3032
|
+
});
|
|
3033
|
+
preDenyPromise.then(function (preDenyValue) {
|
|
2736
3034
|
if (preDenyValue === false) {
|
|
2737
3035
|
instance.hideLoading();
|
|
2738
3036
|
handleAwaitingPromise(instance);
|
|
@@ -2742,11 +3040,13 @@
|
|
|
2742
3040
|
value: typeof preDenyValue === 'undefined' ? value : preDenyValue
|
|
2743
3041
|
});
|
|
2744
3042
|
}
|
|
2745
|
-
})
|
|
3043
|
+
})["catch"](function (error) {
|
|
3044
|
+
return rejectWith(instance || _this, error);
|
|
3045
|
+
});
|
|
2746
3046
|
} else {
|
|
2747
3047
|
instance.close({
|
|
2748
3048
|
isDenied: true,
|
|
2749
|
-
value
|
|
3049
|
+
value: value
|
|
2750
3050
|
});
|
|
2751
3051
|
}
|
|
2752
3052
|
};
|
|
@@ -2755,10 +3055,10 @@
|
|
|
2755
3055
|
* @param {SweetAlert} instance
|
|
2756
3056
|
* @param {any} value
|
|
2757
3057
|
*/
|
|
2758
|
-
|
|
3058
|
+
var succeedWith = function succeedWith(instance, value) {
|
|
2759
3059
|
instance.close({
|
|
2760
3060
|
isConfirmed: true,
|
|
2761
|
-
value
|
|
3061
|
+
value: value
|
|
2762
3062
|
});
|
|
2763
3063
|
};
|
|
2764
3064
|
|
|
@@ -2767,7 +3067,7 @@
|
|
|
2767
3067
|
* @param {SweetAlert} instance
|
|
2768
3068
|
* @param {string} error
|
|
2769
3069
|
*/
|
|
2770
|
-
|
|
3070
|
+
var rejectWith = function rejectWith(instance, error) {
|
|
2771
3071
|
instance.rejectPromise(error);
|
|
2772
3072
|
};
|
|
2773
3073
|
|
|
@@ -2776,23 +3076,27 @@
|
|
|
2776
3076
|
* @param {SweetAlert} instance
|
|
2777
3077
|
* @param {any} value
|
|
2778
3078
|
*/
|
|
2779
|
-
|
|
2780
|
-
|
|
3079
|
+
var confirm = function confirm(instance, value) {
|
|
3080
|
+
var innerParams = privateProps.innerParams.get(instance || _this);
|
|
2781
3081
|
if (innerParams.showLoaderOnConfirm) {
|
|
2782
3082
|
showLoading();
|
|
2783
3083
|
}
|
|
2784
3084
|
if (innerParams.preConfirm) {
|
|
2785
3085
|
instance.resetValidationMessage();
|
|
2786
3086
|
instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received
|
|
2787
|
-
|
|
2788
|
-
|
|
3087
|
+
var preConfirmPromise = Promise.resolve().then(function () {
|
|
3088
|
+
return asPromise(innerParams.preConfirm(value, innerParams.validationMessage));
|
|
3089
|
+
});
|
|
3090
|
+
preConfirmPromise.then(function (preConfirmValue) {
|
|
2789
3091
|
if (isVisible$1(getValidationMessage()) || preConfirmValue === false) {
|
|
2790
3092
|
instance.hideLoading();
|
|
2791
3093
|
handleAwaitingPromise(instance);
|
|
2792
3094
|
} else {
|
|
2793
3095
|
succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);
|
|
2794
3096
|
}
|
|
2795
|
-
})
|
|
3097
|
+
})["catch"](function (error) {
|
|
3098
|
+
return rejectWith(instance || _this, error);
|
|
3099
|
+
});
|
|
2796
3100
|
} else {
|
|
2797
3101
|
succeedWith(instance, value);
|
|
2798
3102
|
}
|
|
@@ -2803,11 +3107,11 @@
|
|
|
2803
3107
|
*/
|
|
2804
3108
|
function hideLoading() {
|
|
2805
3109
|
// do nothing if popup is closed
|
|
2806
|
-
|
|
3110
|
+
var innerParams = privateProps.innerParams.get(this);
|
|
2807
3111
|
if (!innerParams) {
|
|
2808
3112
|
return;
|
|
2809
3113
|
}
|
|
2810
|
-
|
|
3114
|
+
var domCache = privateProps.domCache.get(this);
|
|
2811
3115
|
hide(domCache.loader);
|
|
2812
3116
|
if (isToast()) {
|
|
2813
3117
|
if (innerParams.icon) {
|
|
@@ -2823,8 +3127,8 @@
|
|
|
2823
3127
|
domCache.denyButton.disabled = false;
|
|
2824
3128
|
domCache.cancelButton.disabled = false;
|
|
2825
3129
|
}
|
|
2826
|
-
|
|
2827
|
-
|
|
3130
|
+
var showRelatedButton = function showRelatedButton(domCache) {
|
|
3131
|
+
var buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));
|
|
2828
3132
|
if (buttonToReplace.length) {
|
|
2829
3133
|
show(buttonToReplace[0], 'inline-block');
|
|
2830
3134
|
} else if (allButtonsAreHidden()) {
|
|
@@ -2838,8 +3142,8 @@
|
|
|
2838
3142
|
* @returns {HTMLInputElement | null}
|
|
2839
3143
|
*/
|
|
2840
3144
|
function getInput() {
|
|
2841
|
-
|
|
2842
|
-
|
|
3145
|
+
var innerParams = privateProps.innerParams.get(this);
|
|
3146
|
+
var domCache = privateProps.domCache.get(this);
|
|
2843
3147
|
if (!domCache) {
|
|
2844
3148
|
return null;
|
|
2845
3149
|
}
|
|
@@ -2852,8 +3156,8 @@
|
|
|
2852
3156
|
* @param {boolean} disabled
|
|
2853
3157
|
*/
|
|
2854
3158
|
function setButtonsDisabled(instance, buttons, disabled) {
|
|
2855
|
-
|
|
2856
|
-
buttons.forEach(button
|
|
3159
|
+
var domCache = privateProps.domCache.get(instance);
|
|
3160
|
+
buttons.forEach(function (button) {
|
|
2857
3161
|
domCache[button].disabled = disabled;
|
|
2858
3162
|
});
|
|
2859
3163
|
}
|
|
@@ -2863,14 +3167,14 @@
|
|
|
2863
3167
|
* @param {boolean} disabled
|
|
2864
3168
|
*/
|
|
2865
3169
|
function setInputDisabled(input, disabled) {
|
|
2866
|
-
|
|
3170
|
+
var popup = getPopup();
|
|
2867
3171
|
if (!popup || !input) {
|
|
2868
3172
|
return;
|
|
2869
3173
|
}
|
|
2870
3174
|
if (input.type === 'radio') {
|
|
2871
3175
|
/** @type {NodeListOf<HTMLInputElement>} */
|
|
2872
|
-
|
|
2873
|
-
for (
|
|
3176
|
+
var radios = popup.querySelectorAll("[name=\"".concat(swalClasses.radio, "\"]"));
|
|
3177
|
+
for (var i = 0; i < radios.length; i++) {
|
|
2874
3178
|
radios[i].disabled = disabled;
|
|
2875
3179
|
}
|
|
2876
3180
|
} else {
|
|
@@ -2917,15 +3221,15 @@
|
|
|
2917
3221
|
* @this {SweetAlert}
|
|
2918
3222
|
*/
|
|
2919
3223
|
function showValidationMessage(error) {
|
|
2920
|
-
|
|
2921
|
-
|
|
3224
|
+
var domCache = privateProps.domCache.get(this);
|
|
3225
|
+
var params = privateProps.innerParams.get(this);
|
|
2922
3226
|
setInnerHtml(domCache.validationMessage, error);
|
|
2923
3227
|
domCache.validationMessage.className = swalClasses['validation-message'];
|
|
2924
3228
|
if (params.customClass && params.customClass.validationMessage) {
|
|
2925
3229
|
addClass(domCache.validationMessage, params.customClass.validationMessage);
|
|
2926
3230
|
}
|
|
2927
3231
|
show(domCache.validationMessage);
|
|
2928
|
-
|
|
3232
|
+
var input = this.getInput();
|
|
2929
3233
|
if (input) {
|
|
2930
3234
|
input.setAttribute('aria-invalid', 'true');
|
|
2931
3235
|
input.setAttribute('aria-describedby', swalClasses['validation-message']);
|
|
@@ -2940,11 +3244,11 @@
|
|
|
2940
3244
|
* @this {SweetAlert}
|
|
2941
3245
|
*/
|
|
2942
3246
|
function resetValidationMessage() {
|
|
2943
|
-
|
|
3247
|
+
var domCache = privateProps.domCache.get(this);
|
|
2944
3248
|
if (domCache.validationMessage) {
|
|
2945
3249
|
hide(domCache.validationMessage);
|
|
2946
3250
|
}
|
|
2947
|
-
|
|
3251
|
+
var input = this.getInput();
|
|
2948
3252
|
if (input) {
|
|
2949
3253
|
input.removeAttribute('aria-invalid');
|
|
2950
3254
|
input.removeAttribute('aria-describedby');
|
|
@@ -2952,7 +3256,7 @@
|
|
|
2952
3256
|
}
|
|
2953
3257
|
}
|
|
2954
3258
|
|
|
2955
|
-
|
|
3259
|
+
var defaultParams = {
|
|
2956
3260
|
title: '',
|
|
2957
3261
|
titleText: '',
|
|
2958
3262
|
text: '',
|
|
@@ -2963,6 +3267,7 @@
|
|
|
2963
3267
|
iconHtml: undefined,
|
|
2964
3268
|
template: undefined,
|
|
2965
3269
|
toast: false,
|
|
3270
|
+
animation: true,
|
|
2966
3271
|
showClass: {
|
|
2967
3272
|
popup: 'swal2-show',
|
|
2968
3273
|
backdrop: 'swal2-backdrop-show',
|
|
@@ -3042,11 +3347,11 @@
|
|
|
3042
3347
|
didDestroy: undefined,
|
|
3043
3348
|
scrollbarPadding: true
|
|
3044
3349
|
};
|
|
3045
|
-
|
|
3350
|
+
var updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];
|
|
3046
3351
|
|
|
3047
3352
|
/** @type {Record<string, string>} */
|
|
3048
|
-
|
|
3049
|
-
|
|
3353
|
+
var deprecatedParams = {};
|
|
3354
|
+
var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];
|
|
3050
3355
|
|
|
3051
3356
|
/**
|
|
3052
3357
|
* Is valid parameter
|
|
@@ -3054,7 +3359,7 @@
|
|
|
3054
3359
|
* @param {string} paramName
|
|
3055
3360
|
* @returns {boolean}
|
|
3056
3361
|
*/
|
|
3057
|
-
|
|
3362
|
+
var isValidParameter = function isValidParameter(paramName) {
|
|
3058
3363
|
return Object.prototype.hasOwnProperty.call(defaultParams, paramName);
|
|
3059
3364
|
};
|
|
3060
3365
|
|
|
@@ -3064,7 +3369,7 @@
|
|
|
3064
3369
|
* @param {string} paramName
|
|
3065
3370
|
* @returns {boolean}
|
|
3066
3371
|
*/
|
|
3067
|
-
|
|
3372
|
+
var isUpdatableParameter = function isUpdatableParameter(paramName) {
|
|
3068
3373
|
return updatableParams.indexOf(paramName) !== -1;
|
|
3069
3374
|
};
|
|
3070
3375
|
|
|
@@ -3074,14 +3379,14 @@
|
|
|
3074
3379
|
* @param {string} paramName
|
|
3075
3380
|
* @returns {string | undefined}
|
|
3076
3381
|
*/
|
|
3077
|
-
|
|
3382
|
+
var isDeprecatedParameter = function isDeprecatedParameter(paramName) {
|
|
3078
3383
|
return deprecatedParams[paramName];
|
|
3079
3384
|
};
|
|
3080
3385
|
|
|
3081
3386
|
/**
|
|
3082
3387
|
* @param {string} param
|
|
3083
3388
|
*/
|
|
3084
|
-
|
|
3389
|
+
var checkIfParamIsValid = function checkIfParamIsValid(param) {
|
|
3085
3390
|
if (!isValidParameter(param)) {
|
|
3086
3391
|
warn("Unknown parameter \"".concat(param, "\""));
|
|
3087
3392
|
}
|
|
@@ -3090,7 +3395,7 @@
|
|
|
3090
3395
|
/**
|
|
3091
3396
|
* @param {string} param
|
|
3092
3397
|
*/
|
|
3093
|
-
|
|
3398
|
+
var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) {
|
|
3094
3399
|
if (toastIncompatibleParams.includes(param)) {
|
|
3095
3400
|
warn("The parameter \"".concat(param, "\" is incompatible with toasts"));
|
|
3096
3401
|
}
|
|
@@ -3099,8 +3404,8 @@
|
|
|
3099
3404
|
/**
|
|
3100
3405
|
* @param {string} param
|
|
3101
3406
|
*/
|
|
3102
|
-
|
|
3103
|
-
|
|
3407
|
+
var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) {
|
|
3408
|
+
var isDeprecated = isDeprecatedParameter(param);
|
|
3104
3409
|
if (isDeprecated) {
|
|
3105
3410
|
warnAboutDeprecation(param, isDeprecated);
|
|
3106
3411
|
}
|
|
@@ -3111,11 +3416,11 @@
|
|
|
3111
3416
|
*
|
|
3112
3417
|
* @param {SweetAlertOptions} params
|
|
3113
3418
|
*/
|
|
3114
|
-
|
|
3419
|
+
var showWarningsForParams = function showWarningsForParams(params) {
|
|
3115
3420
|
if (params.backdrop === false && params.allowOutsideClick) {
|
|
3116
3421
|
warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');
|
|
3117
3422
|
}
|
|
3118
|
-
for (
|
|
3423
|
+
for (var param in params) {
|
|
3119
3424
|
checkIfParamIsValid(param);
|
|
3120
3425
|
if (params.toast) {
|
|
3121
3426
|
checkIfToastParamIsValid(param);
|
|
@@ -3130,14 +3435,14 @@
|
|
|
3130
3435
|
* @param {SweetAlertOptions} params
|
|
3131
3436
|
*/
|
|
3132
3437
|
function update(params) {
|
|
3133
|
-
|
|
3134
|
-
|
|
3438
|
+
var popup = getPopup();
|
|
3439
|
+
var innerParams = privateProps.innerParams.get(this);
|
|
3135
3440
|
if (!popup || hasClass(popup, innerParams.hideClass.popup)) {
|
|
3136
3441
|
warn("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");
|
|
3137
3442
|
return;
|
|
3138
3443
|
}
|
|
3139
|
-
|
|
3140
|
-
|
|
3444
|
+
var validUpdatableParams = filterValidParams(params);
|
|
3445
|
+
var updatedParams = Object.assign({}, innerParams, validUpdatableParams);
|
|
3141
3446
|
render(this, updatedParams);
|
|
3142
3447
|
privateProps.innerParams.set(this, updatedParams);
|
|
3143
3448
|
Object.defineProperties(this, {
|
|
@@ -3153,9 +3458,9 @@
|
|
|
3153
3458
|
* @param {SweetAlertOptions} params
|
|
3154
3459
|
* @returns {SweetAlertOptions}
|
|
3155
3460
|
*/
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
Object.keys(params).forEach(param
|
|
3461
|
+
var filterValidParams = function filterValidParams(params) {
|
|
3462
|
+
var validUpdatableParams = {};
|
|
3463
|
+
Object.keys(params).forEach(function (param) {
|
|
3159
3464
|
if (isUpdatableParameter(param)) {
|
|
3160
3465
|
validUpdatableParams[param] = params[param];
|
|
3161
3466
|
} else {
|
|
@@ -3169,8 +3474,8 @@
|
|
|
3169
3474
|
* Dispose the current SweetAlert2 instance
|
|
3170
3475
|
*/
|
|
3171
3476
|
function _destroy() {
|
|
3172
|
-
|
|
3173
|
-
|
|
3477
|
+
var domCache = privateProps.domCache.get(this);
|
|
3478
|
+
var innerParams = privateProps.innerParams.get(this);
|
|
3174
3479
|
if (!innerParams) {
|
|
3175
3480
|
disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335
|
|
3176
3481
|
return; // This instance has already been destroyed
|
|
@@ -3190,7 +3495,7 @@
|
|
|
3190
3495
|
/**
|
|
3191
3496
|
* @param {SweetAlert} instance
|
|
3192
3497
|
*/
|
|
3193
|
-
|
|
3498
|
+
var disposeSwal = function disposeSwal(instance) {
|
|
3194
3499
|
disposeWeakMaps(instance);
|
|
3195
3500
|
// Unset this.params so GC will dispose it (#1569)
|
|
3196
3501
|
delete instance.params;
|
|
@@ -3204,7 +3509,7 @@
|
|
|
3204
3509
|
/**
|
|
3205
3510
|
* @param {SweetAlert} instance
|
|
3206
3511
|
*/
|
|
3207
|
-
|
|
3512
|
+
var disposeWeakMaps = function disposeWeakMaps(instance) {
|
|
3208
3513
|
// If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
|
|
3209
3514
|
if (instance.isAwaitingPromise) {
|
|
3210
3515
|
unsetWeakMaps(privateProps, instance);
|
|
@@ -3237,9 +3542,9 @@
|
|
|
3237
3542
|
* @param {object} obj
|
|
3238
3543
|
* @param {SweetAlert} instance
|
|
3239
3544
|
*/
|
|
3240
|
-
|
|
3241
|
-
for (
|
|
3242
|
-
obj[i]
|
|
3545
|
+
var unsetWeakMaps = function unsetWeakMaps(obj, instance) {
|
|
3546
|
+
for (var i in obj) {
|
|
3547
|
+
obj[i]["delete"](instance);
|
|
3243
3548
|
}
|
|
3244
3549
|
};
|
|
3245
3550
|
|
|
@@ -3269,7 +3574,7 @@
|
|
|
3269
3574
|
* @param {DomCache} domCache
|
|
3270
3575
|
* @param {Function} dismissWith
|
|
3271
3576
|
*/
|
|
3272
|
-
|
|
3577
|
+
var handlePopupClick = function handlePopupClick(innerParams, domCache, dismissWith) {
|
|
3273
3578
|
if (innerParams.toast) {
|
|
3274
3579
|
handleToastClick(innerParams, domCache, dismissWith);
|
|
3275
3580
|
} else {
|
|
@@ -3288,9 +3593,9 @@
|
|
|
3288
3593
|
* @param {DomCache} domCache
|
|
3289
3594
|
* @param {Function} dismissWith
|
|
3290
3595
|
*/
|
|
3291
|
-
|
|
3596
|
+
var handleToastClick = function handleToastClick(innerParams, domCache, dismissWith) {
|
|
3292
3597
|
// Closing toast by internal click
|
|
3293
|
-
domCache.popup.onclick = ()
|
|
3598
|
+
domCache.popup.onclick = function () {
|
|
3294
3599
|
if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {
|
|
3295
3600
|
return;
|
|
3296
3601
|
}
|
|
@@ -3302,18 +3607,18 @@
|
|
|
3302
3607
|
* @param {SweetAlertOptions} innerParams
|
|
3303
3608
|
* @returns {boolean}
|
|
3304
3609
|
*/
|
|
3305
|
-
|
|
3610
|
+
var isAnyButtonShown = function isAnyButtonShown(innerParams) {
|
|
3306
3611
|
return !!(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton);
|
|
3307
3612
|
};
|
|
3308
|
-
|
|
3613
|
+
var ignoreOutsideClick = false;
|
|
3309
3614
|
|
|
3310
3615
|
/**
|
|
3311
3616
|
* @param {DomCache} domCache
|
|
3312
3617
|
*/
|
|
3313
|
-
|
|
3314
|
-
domCache.popup.onmousedown = ()
|
|
3618
|
+
var handleModalMousedown = function handleModalMousedown(domCache) {
|
|
3619
|
+
domCache.popup.onmousedown = function () {
|
|
3315
3620
|
domCache.container.onmouseup = function (e) {
|
|
3316
|
-
domCache.container.onmouseup = ()
|
|
3621
|
+
domCache.container.onmouseup = function () {};
|
|
3317
3622
|
// We only check if the mouseup target is the container because usually it doesn't
|
|
3318
3623
|
// have any other direct children aside of the popup
|
|
3319
3624
|
if (e.target === domCache.container) {
|
|
@@ -3326,10 +3631,10 @@
|
|
|
3326
3631
|
/**
|
|
3327
3632
|
* @param {DomCache} domCache
|
|
3328
3633
|
*/
|
|
3329
|
-
|
|
3330
|
-
domCache.container.onmousedown = ()
|
|
3634
|
+
var handleContainerMousedown = function handleContainerMousedown(domCache) {
|
|
3635
|
+
domCache.container.onmousedown = function () {
|
|
3331
3636
|
domCache.popup.onmouseup = function (e) {
|
|
3332
|
-
domCache.popup.onmouseup = ()
|
|
3637
|
+
domCache.popup.onmouseup = function () {};
|
|
3333
3638
|
// We also need to check if the mouseup target is a child of the popup
|
|
3334
3639
|
if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) {
|
|
3335
3640
|
ignoreOutsideClick = true;
|
|
@@ -3343,8 +3648,8 @@
|
|
|
3343
3648
|
* @param {DomCache} domCache
|
|
3344
3649
|
* @param {Function} dismissWith
|
|
3345
3650
|
*/
|
|
3346
|
-
|
|
3347
|
-
domCache.container.onclick = e
|
|
3651
|
+
var handleModalClick = function handleModalClick(innerParams, domCache, dismissWith) {
|
|
3652
|
+
domCache.container.onclick = function (e) {
|
|
3348
3653
|
if (ignoreOutsideClick) {
|
|
3349
3654
|
ignoreOutsideClick = false;
|
|
3350
3655
|
return;
|
|
@@ -3355,19 +3660,23 @@
|
|
|
3355
3660
|
};
|
|
3356
3661
|
};
|
|
3357
3662
|
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3663
|
+
var isJqueryElement = function isJqueryElement(elem) {
|
|
3664
|
+
return _typeof(elem) === 'object' && elem.jquery;
|
|
3665
|
+
};
|
|
3666
|
+
var isElement = function isElement(elem) {
|
|
3667
|
+
return elem instanceof Element || isJqueryElement(elem);
|
|
3668
|
+
};
|
|
3669
|
+
var argsToParams = function argsToParams(args) {
|
|
3670
|
+
var params = {};
|
|
3671
|
+
if (_typeof(args[0]) === 'object' && !isElement(args[0])) {
|
|
3363
3672
|
Object.assign(params, args[0]);
|
|
3364
3673
|
} else {
|
|
3365
|
-
['title', 'html', 'icon'].forEach((name, index)
|
|
3366
|
-
|
|
3674
|
+
['title', 'html', 'icon'].forEach(function (name, index) {
|
|
3675
|
+
var arg = args[index];
|
|
3367
3676
|
if (typeof arg === 'string' || isElement(arg)) {
|
|
3368
3677
|
params[name] = arg;
|
|
3369
3678
|
} else if (arg !== undefined) {
|
|
3370
|
-
error("Unexpected type of ".concat(name, "! Expected \"string\" or \"Element\", got ").concat(
|
|
3679
|
+
error("Unexpected type of ".concat(name, "! Expected \"string\" or \"Element\", got ").concat(_typeof(arg)));
|
|
3371
3680
|
}
|
|
3372
3681
|
});
|
|
3373
3682
|
}
|
|
@@ -3381,11 +3690,11 @@
|
|
|
3381
3690
|
* @returns {Promise<SweetAlertResult>}
|
|
3382
3691
|
*/
|
|
3383
3692
|
function fire() {
|
|
3384
|
-
|
|
3693
|
+
var Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias
|
|
3385
3694
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3386
3695
|
args[_key] = arguments[_key];
|
|
3387
3696
|
}
|
|
3388
|
-
return
|
|
3697
|
+
return _construct(Swal, args);
|
|
3389
3698
|
}
|
|
3390
3699
|
|
|
3391
3700
|
/**
|
|
@@ -3408,12 +3717,21 @@
|
|
|
3408
3717
|
* @returns {SweetAlert}
|
|
3409
3718
|
*/
|
|
3410
3719
|
function mixin(mixinParams) {
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3720
|
+
var MixinSwal = /*#__PURE__*/function (_this) {
|
|
3721
|
+
_inherits(MixinSwal, _this);
|
|
3722
|
+
var _super = _createSuper(MixinSwal);
|
|
3723
|
+
function MixinSwal() {
|
|
3724
|
+
_classCallCheck(this, MixinSwal);
|
|
3725
|
+
return _super.apply(this, arguments);
|
|
3414
3726
|
}
|
|
3415
|
-
|
|
3416
|
-
|
|
3727
|
+
_createClass(MixinSwal, [{
|
|
3728
|
+
key: "_main",
|
|
3729
|
+
value: function _main(params, priorityMixinParams) {
|
|
3730
|
+
return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, params, Object.assign({}, mixinParams, priorityMixinParams));
|
|
3731
|
+
}
|
|
3732
|
+
}]);
|
|
3733
|
+
return MixinSwal;
|
|
3734
|
+
}(this); // @ts-ignore
|
|
3417
3735
|
return MixinSwal;
|
|
3418
3736
|
}
|
|
3419
3737
|
|
|
@@ -3423,7 +3741,7 @@
|
|
|
3423
3741
|
*
|
|
3424
3742
|
* @returns {number | undefined}
|
|
3425
3743
|
*/
|
|
3426
|
-
|
|
3744
|
+
var getTimerLeft = function getTimerLeft() {
|
|
3427
3745
|
return globalState.timeout && globalState.timeout.getTimerLeft();
|
|
3428
3746
|
};
|
|
3429
3747
|
|
|
@@ -3433,7 +3751,7 @@
|
|
|
3433
3751
|
*
|
|
3434
3752
|
* @returns {number | undefined}
|
|
3435
3753
|
*/
|
|
3436
|
-
|
|
3754
|
+
var stopTimer = function stopTimer() {
|
|
3437
3755
|
if (globalState.timeout) {
|
|
3438
3756
|
stopTimerProgressBar();
|
|
3439
3757
|
return globalState.timeout.stop();
|
|
@@ -3446,9 +3764,9 @@
|
|
|
3446
3764
|
*
|
|
3447
3765
|
* @returns {number | undefined}
|
|
3448
3766
|
*/
|
|
3449
|
-
|
|
3767
|
+
var resumeTimer = function resumeTimer() {
|
|
3450
3768
|
if (globalState.timeout) {
|
|
3451
|
-
|
|
3769
|
+
var remaining = globalState.timeout.start();
|
|
3452
3770
|
animateTimerProgressBar(remaining);
|
|
3453
3771
|
return remaining;
|
|
3454
3772
|
}
|
|
@@ -3460,8 +3778,8 @@
|
|
|
3460
3778
|
*
|
|
3461
3779
|
* @returns {number | undefined}
|
|
3462
3780
|
*/
|
|
3463
|
-
|
|
3464
|
-
|
|
3781
|
+
var toggleTimer = function toggleTimer() {
|
|
3782
|
+
var timer = globalState.timeout;
|
|
3465
3783
|
return timer && (timer.running ? stopTimer() : resumeTimer());
|
|
3466
3784
|
};
|
|
3467
3785
|
|
|
@@ -3472,9 +3790,9 @@
|
|
|
3472
3790
|
* @param {number} ms
|
|
3473
3791
|
* @returns {number | undefined}
|
|
3474
3792
|
*/
|
|
3475
|
-
|
|
3793
|
+
var increaseTimer = function increaseTimer(ms) {
|
|
3476
3794
|
if (globalState.timeout) {
|
|
3477
|
-
|
|
3795
|
+
var remaining = globalState.timeout.increase(ms);
|
|
3478
3796
|
animateTimerProgressBar(remaining, true);
|
|
3479
3797
|
return remaining;
|
|
3480
3798
|
}
|
|
@@ -3487,31 +3805,31 @@
|
|
|
3487
3805
|
*
|
|
3488
3806
|
* @returns {boolean}
|
|
3489
3807
|
*/
|
|
3490
|
-
|
|
3808
|
+
var isTimerRunning = function isTimerRunning() {
|
|
3491
3809
|
return !!(globalState.timeout && globalState.timeout.isRunning());
|
|
3492
3810
|
};
|
|
3493
3811
|
|
|
3494
|
-
|
|
3495
|
-
|
|
3812
|
+
var bodyClickListenerAdded = false;
|
|
3813
|
+
var clickHandlers = {};
|
|
3496
3814
|
|
|
3497
3815
|
/**
|
|
3498
3816
|
* @param {string} attr
|
|
3499
3817
|
*/
|
|
3500
3818
|
function bindClickHandler() {
|
|
3501
|
-
|
|
3819
|
+
var attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template';
|
|
3502
3820
|
clickHandlers[attr] = this;
|
|
3503
3821
|
if (!bodyClickListenerAdded) {
|
|
3504
3822
|
document.body.addEventListener('click', bodyClickListener);
|
|
3505
3823
|
bodyClickListenerAdded = true;
|
|
3506
3824
|
}
|
|
3507
3825
|
}
|
|
3508
|
-
|
|
3509
|
-
for (
|
|
3510
|
-
for (
|
|
3511
|
-
|
|
3826
|
+
var bodyClickListener = function bodyClickListener(event) {
|
|
3827
|
+
for (var el = event.target; el && el !== document; el = el.parentNode) {
|
|
3828
|
+
for (var attr in clickHandlers) {
|
|
3829
|
+
var template = el.getAttribute(attr);
|
|
3512
3830
|
if (template) {
|
|
3513
3831
|
clickHandlers[attr].fire({
|
|
3514
|
-
template
|
|
3832
|
+
template: template
|
|
3515
3833
|
});
|
|
3516
3834
|
return;
|
|
3517
3835
|
}
|
|
@@ -3562,12 +3880,13 @@
|
|
|
3562
3880
|
toggleTimer: toggleTimer
|
|
3563
3881
|
});
|
|
3564
3882
|
|
|
3565
|
-
|
|
3883
|
+
var Timer = /*#__PURE__*/function () {
|
|
3566
3884
|
/**
|
|
3567
3885
|
* @param {Function} callback
|
|
3568
3886
|
* @param {number} delay
|
|
3569
3887
|
*/
|
|
3570
|
-
|
|
3888
|
+
function Timer(callback, delay) {
|
|
3889
|
+
_classCallCheck(this, Timer);
|
|
3571
3890
|
this.callback = callback;
|
|
3572
3891
|
this.remaining = delay;
|
|
3573
3892
|
this.running = false;
|
|
@@ -3577,78 +3896,90 @@
|
|
|
3577
3896
|
/**
|
|
3578
3897
|
* @returns {number}
|
|
3579
3898
|
*/
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
this.
|
|
3584
|
-
|
|
3899
|
+
_createClass(Timer, [{
|
|
3900
|
+
key: "start",
|
|
3901
|
+
value: function start() {
|
|
3902
|
+
if (!this.running) {
|
|
3903
|
+
this.running = true;
|
|
3904
|
+
this.started = new Date();
|
|
3905
|
+
this.id = setTimeout(this.callback, this.remaining);
|
|
3906
|
+
}
|
|
3907
|
+
return this.remaining;
|
|
3585
3908
|
}
|
|
3586
|
-
return this.remaining;
|
|
3587
|
-
}
|
|
3588
3909
|
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3910
|
+
/**
|
|
3911
|
+
* @returns {number}
|
|
3912
|
+
*/
|
|
3913
|
+
}, {
|
|
3914
|
+
key: "stop",
|
|
3915
|
+
value: function stop() {
|
|
3916
|
+
if (this.started && this.running) {
|
|
3917
|
+
this.running = false;
|
|
3918
|
+
clearTimeout(this.id);
|
|
3919
|
+
this.remaining -= new Date().getTime() - this.started.getTime();
|
|
3920
|
+
}
|
|
3921
|
+
return this.remaining;
|
|
3597
3922
|
}
|
|
3598
|
-
return this.remaining;
|
|
3599
|
-
}
|
|
3600
3923
|
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
this.
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
this.
|
|
3924
|
+
/**
|
|
3925
|
+
* @param {number} n
|
|
3926
|
+
* @returns {number}
|
|
3927
|
+
*/
|
|
3928
|
+
}, {
|
|
3929
|
+
key: "increase",
|
|
3930
|
+
value: function increase(n) {
|
|
3931
|
+
var running = this.running;
|
|
3932
|
+
if (running) {
|
|
3933
|
+
this.stop();
|
|
3934
|
+
}
|
|
3935
|
+
this.remaining += n;
|
|
3936
|
+
if (running) {
|
|
3937
|
+
this.start();
|
|
3938
|
+
}
|
|
3939
|
+
return this.remaining;
|
|
3613
3940
|
}
|
|
3614
|
-
return this.remaining;
|
|
3615
|
-
}
|
|
3616
3941
|
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
this.
|
|
3942
|
+
/**
|
|
3943
|
+
* @returns {number}
|
|
3944
|
+
*/
|
|
3945
|
+
}, {
|
|
3946
|
+
key: "getTimerLeft",
|
|
3947
|
+
value: function getTimerLeft() {
|
|
3948
|
+
if (this.running) {
|
|
3949
|
+
this.stop();
|
|
3950
|
+
this.start();
|
|
3951
|
+
}
|
|
3952
|
+
return this.remaining;
|
|
3624
3953
|
}
|
|
3625
|
-
return this.remaining;
|
|
3626
|
-
}
|
|
3627
3954
|
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3955
|
+
/**
|
|
3956
|
+
* @returns {boolean}
|
|
3957
|
+
*/
|
|
3958
|
+
}, {
|
|
3959
|
+
key: "isRunning",
|
|
3960
|
+
value: function isRunning() {
|
|
3961
|
+
return this.running;
|
|
3962
|
+
}
|
|
3963
|
+
}]);
|
|
3964
|
+
return Timer;
|
|
3965
|
+
}();
|
|
3635
3966
|
|
|
3636
|
-
|
|
3967
|
+
var swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];
|
|
3637
3968
|
|
|
3638
3969
|
/**
|
|
3639
3970
|
* @param {SweetAlertOptions} params
|
|
3640
3971
|
* @returns {SweetAlertOptions}
|
|
3641
3972
|
*/
|
|
3642
|
-
|
|
3973
|
+
var getTemplateParams = function getTemplateParams(params) {
|
|
3643
3974
|
/** @type {HTMLTemplateElement} */
|
|
3644
|
-
|
|
3975
|
+
var template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;
|
|
3645
3976
|
if (!template) {
|
|
3646
3977
|
return {};
|
|
3647
3978
|
}
|
|
3648
3979
|
/** @type {DocumentFragment} */
|
|
3649
|
-
|
|
3980
|
+
var templateContent = template.content;
|
|
3650
3981
|
showWarningsForElements(templateContent);
|
|
3651
|
-
|
|
3982
|
+
var result = Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));
|
|
3652
3983
|
return result;
|
|
3653
3984
|
};
|
|
3654
3985
|
|
|
@@ -3656,17 +3987,17 @@
|
|
|
3656
3987
|
* @param {DocumentFragment} templateContent
|
|
3657
3988
|
* @returns {SweetAlertOptions}
|
|
3658
3989
|
*/
|
|
3659
|
-
|
|
3660
|
-
|
|
3990
|
+
var getSwalParams = function getSwalParams(templateContent) {
|
|
3991
|
+
var result = {};
|
|
3661
3992
|
/** @type {HTMLElement[]} */
|
|
3662
|
-
|
|
3663
|
-
swalParams.forEach(param
|
|
3993
|
+
var swalParams = Array.from(templateContent.querySelectorAll('swal-param'));
|
|
3994
|
+
swalParams.forEach(function (param) {
|
|
3664
3995
|
showWarningsForAttributes(param, ['name', 'value']);
|
|
3665
|
-
|
|
3666
|
-
|
|
3996
|
+
var paramName = param.getAttribute('name');
|
|
3997
|
+
var value = param.getAttribute('value');
|
|
3667
3998
|
if (typeof defaultParams[paramName] === 'boolean') {
|
|
3668
3999
|
result[paramName] = value !== 'false';
|
|
3669
|
-
} else if (
|
|
4000
|
+
} else if (_typeof(defaultParams[paramName]) === 'object') {
|
|
3670
4001
|
result[paramName] = JSON.parse(value);
|
|
3671
4002
|
} else {
|
|
3672
4003
|
result[paramName] = value;
|
|
@@ -3679,13 +4010,13 @@
|
|
|
3679
4010
|
* @param {DocumentFragment} templateContent
|
|
3680
4011
|
* @returns {SweetAlertOptions}
|
|
3681
4012
|
*/
|
|
3682
|
-
|
|
3683
|
-
|
|
4013
|
+
var getSwalFunctionParams = function getSwalFunctionParams(templateContent) {
|
|
4014
|
+
var result = {};
|
|
3684
4015
|
/** @type {HTMLElement[]} */
|
|
3685
|
-
|
|
3686
|
-
swalFunctions.forEach(param
|
|
3687
|
-
|
|
3688
|
-
|
|
4016
|
+
var swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));
|
|
4017
|
+
swalFunctions.forEach(function (param) {
|
|
4018
|
+
var paramName = param.getAttribute('name');
|
|
4019
|
+
var value = param.getAttribute('value');
|
|
3689
4020
|
result[paramName] = new Function("return ".concat(value))();
|
|
3690
4021
|
});
|
|
3691
4022
|
return result;
|
|
@@ -3695,13 +4026,13 @@
|
|
|
3695
4026
|
* @param {DocumentFragment} templateContent
|
|
3696
4027
|
* @returns {SweetAlertOptions}
|
|
3697
4028
|
*/
|
|
3698
|
-
|
|
3699
|
-
|
|
4029
|
+
var getSwalButtons = function getSwalButtons(templateContent) {
|
|
4030
|
+
var result = {};
|
|
3700
4031
|
/** @type {HTMLElement[]} */
|
|
3701
|
-
|
|
3702
|
-
swalButtons.forEach(button
|
|
4032
|
+
var swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));
|
|
4033
|
+
swalButtons.forEach(function (button) {
|
|
3703
4034
|
showWarningsForAttributes(button, ['type', 'color', 'aria-label']);
|
|
3704
|
-
|
|
4035
|
+
var type = button.getAttribute('type');
|
|
3705
4036
|
result["".concat(type, "ButtonText")] = button.innerHTML;
|
|
3706
4037
|
result["show".concat(capitalizeFirstLetter(type), "Button")] = true;
|
|
3707
4038
|
if (button.hasAttribute('color')) {
|
|
@@ -3718,10 +4049,10 @@
|
|
|
3718
4049
|
* @param {DocumentFragment} templateContent
|
|
3719
4050
|
* @returns {SweetAlertOptions}
|
|
3720
4051
|
*/
|
|
3721
|
-
|
|
3722
|
-
|
|
4052
|
+
var getSwalImage = function getSwalImage(templateContent) {
|
|
4053
|
+
var result = {};
|
|
3723
4054
|
/** @type {HTMLElement} */
|
|
3724
|
-
|
|
4055
|
+
var image = templateContent.querySelector('swal-image');
|
|
3725
4056
|
if (image) {
|
|
3726
4057
|
showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);
|
|
3727
4058
|
if (image.hasAttribute('src')) {
|
|
@@ -3744,10 +4075,10 @@
|
|
|
3744
4075
|
* @param {DocumentFragment} templateContent
|
|
3745
4076
|
* @returns {SweetAlertOptions}
|
|
3746
4077
|
*/
|
|
3747
|
-
|
|
3748
|
-
|
|
4078
|
+
var getSwalIcon = function getSwalIcon(templateContent) {
|
|
4079
|
+
var result = {};
|
|
3749
4080
|
/** @type {HTMLElement} */
|
|
3750
|
-
|
|
4081
|
+
var icon = templateContent.querySelector('swal-icon');
|
|
3751
4082
|
if (icon) {
|
|
3752
4083
|
showWarningsForAttributes(icon, ['type', 'color']);
|
|
3753
4084
|
if (icon.hasAttribute('type')) {
|
|
@@ -3767,10 +4098,10 @@
|
|
|
3767
4098
|
* @param {DocumentFragment} templateContent
|
|
3768
4099
|
* @returns {SweetAlertOptions}
|
|
3769
4100
|
*/
|
|
3770
|
-
|
|
3771
|
-
|
|
4101
|
+
var getSwalInput = function getSwalInput(templateContent) {
|
|
4102
|
+
var result = {};
|
|
3772
4103
|
/** @type {HTMLElement} */
|
|
3773
|
-
|
|
4104
|
+
var input = templateContent.querySelector('swal-input');
|
|
3774
4105
|
if (input) {
|
|
3775
4106
|
showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);
|
|
3776
4107
|
/** @type {SweetAlertInput} */
|
|
@@ -3787,13 +4118,13 @@
|
|
|
3787
4118
|
}
|
|
3788
4119
|
}
|
|
3789
4120
|
/** @type {HTMLElement[]} */
|
|
3790
|
-
|
|
4121
|
+
var inputOptions = Array.from(templateContent.querySelectorAll('swal-input-option'));
|
|
3791
4122
|
if (inputOptions.length) {
|
|
3792
4123
|
result.inputOptions = {};
|
|
3793
|
-
inputOptions.forEach(option
|
|
4124
|
+
inputOptions.forEach(function (option) {
|
|
3794
4125
|
showWarningsForAttributes(option, ['value']);
|
|
3795
|
-
|
|
3796
|
-
|
|
4126
|
+
var optionValue = option.getAttribute('value');
|
|
4127
|
+
var optionName = option.innerHTML;
|
|
3797
4128
|
result.inputOptions[optionValue] = optionName;
|
|
3798
4129
|
});
|
|
3799
4130
|
}
|
|
@@ -3805,12 +4136,12 @@
|
|
|
3805
4136
|
* @param {string[]} paramNames
|
|
3806
4137
|
* @returns {SweetAlertOptions}
|
|
3807
4138
|
*/
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
for (
|
|
3811
|
-
|
|
4139
|
+
var getSwalStringParams = function getSwalStringParams(templateContent, paramNames) {
|
|
4140
|
+
var result = {};
|
|
4141
|
+
for (var i in paramNames) {
|
|
4142
|
+
var paramName = paramNames[i];
|
|
3812
4143
|
/** @type {HTMLElement} */
|
|
3813
|
-
|
|
4144
|
+
var tag = templateContent.querySelector(paramName);
|
|
3814
4145
|
if (tag) {
|
|
3815
4146
|
showWarningsForAttributes(tag, []);
|
|
3816
4147
|
result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();
|
|
@@ -3822,10 +4153,10 @@
|
|
|
3822
4153
|
/**
|
|
3823
4154
|
* @param {DocumentFragment} templateContent
|
|
3824
4155
|
*/
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
Array.from(templateContent.children).forEach(el
|
|
3828
|
-
|
|
4156
|
+
var showWarningsForElements = function showWarningsForElements(templateContent) {
|
|
4157
|
+
var allowedElements = swalStringParams.concat(['swal-param', 'swal-function-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);
|
|
4158
|
+
Array.from(templateContent.children).forEach(function (el) {
|
|
4159
|
+
var tagName = el.tagName.toLowerCase();
|
|
3829
4160
|
if (!allowedElements.includes(tagName)) {
|
|
3830
4161
|
warn("Unrecognized element <".concat(tagName, ">"));
|
|
3831
4162
|
}
|
|
@@ -3836,33 +4167,33 @@
|
|
|
3836
4167
|
* @param {HTMLElement} el
|
|
3837
4168
|
* @param {string[]} allowedAttributes
|
|
3838
4169
|
*/
|
|
3839
|
-
|
|
3840
|
-
Array.from(el.attributes).forEach(attribute
|
|
4170
|
+
var showWarningsForAttributes = function showWarningsForAttributes(el, allowedAttributes) {
|
|
4171
|
+
Array.from(el.attributes).forEach(function (attribute) {
|
|
3841
4172
|
if (allowedAttributes.indexOf(attribute.name) === -1) {
|
|
3842
4173
|
warn(["Unrecognized attribute \"".concat(attribute.name, "\" on <").concat(el.tagName.toLowerCase(), ">."), "".concat(allowedAttributes.length ? "Allowed attributes are: ".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]);
|
|
3843
4174
|
}
|
|
3844
4175
|
});
|
|
3845
4176
|
};
|
|
3846
4177
|
|
|
3847
|
-
|
|
4178
|
+
var SHOW_CLASS_TIMEOUT = 10;
|
|
3848
4179
|
|
|
3849
4180
|
/**
|
|
3850
4181
|
* Open popup, add necessary classes and styles, fix scrollbar
|
|
3851
4182
|
*
|
|
3852
4183
|
* @param {SweetAlertOptions} params
|
|
3853
4184
|
*/
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
4185
|
+
var openPopup = function openPopup(params) {
|
|
4186
|
+
var container = getContainer();
|
|
4187
|
+
var popup = getPopup();
|
|
3857
4188
|
if (typeof params.willOpen === 'function') {
|
|
3858
4189
|
params.willOpen(popup);
|
|
3859
4190
|
}
|
|
3860
|
-
|
|
3861
|
-
|
|
4191
|
+
var bodyStyles = window.getComputedStyle(document.body);
|
|
4192
|
+
var initialBodyOverflow = bodyStyles.overflowY;
|
|
3862
4193
|
addClasses(container, popup, params);
|
|
3863
4194
|
|
|
3864
4195
|
// scrolling is 'hidden' until animation is done, after that 'auto'
|
|
3865
|
-
setTimeout(()
|
|
4196
|
+
setTimeout(function () {
|
|
3866
4197
|
setScrollingVisibility(container, popup);
|
|
3867
4198
|
}, SHOW_CLASS_TIMEOUT);
|
|
3868
4199
|
if (isModal()) {
|
|
@@ -3873,7 +4204,9 @@
|
|
|
3873
4204
|
globalState.previousActiveElement = document.activeElement;
|
|
3874
4205
|
}
|
|
3875
4206
|
if (typeof params.didOpen === 'function') {
|
|
3876
|
-
setTimeout(()
|
|
4207
|
+
setTimeout(function () {
|
|
4208
|
+
return params.didOpen(popup);
|
|
4209
|
+
});
|
|
3877
4210
|
}
|
|
3878
4211
|
removeClass(container, swalClasses['no-transition']);
|
|
3879
4212
|
};
|
|
@@ -3881,12 +4214,12 @@
|
|
|
3881
4214
|
/**
|
|
3882
4215
|
* @param {AnimationEvent} event
|
|
3883
4216
|
*/
|
|
3884
|
-
|
|
3885
|
-
|
|
4217
|
+
var swalOpenAnimationFinished = function swalOpenAnimationFinished(event) {
|
|
4218
|
+
var popup = getPopup();
|
|
3886
4219
|
if (event.target !== popup || !animationEndEvent) {
|
|
3887
4220
|
return;
|
|
3888
4221
|
}
|
|
3889
|
-
|
|
4222
|
+
var container = getContainer();
|
|
3890
4223
|
popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);
|
|
3891
4224
|
container.style.overflowY = 'auto';
|
|
3892
4225
|
};
|
|
@@ -3895,7 +4228,7 @@
|
|
|
3895
4228
|
* @param {HTMLElement} container
|
|
3896
4229
|
* @param {HTMLElement} popup
|
|
3897
4230
|
*/
|
|
3898
|
-
|
|
4231
|
+
var setScrollingVisibility = function setScrollingVisibility(container, popup) {
|
|
3899
4232
|
if (animationEndEvent && hasCssAnimation(popup)) {
|
|
3900
4233
|
container.style.overflowY = 'hidden';
|
|
3901
4234
|
popup.addEventListener(animationEndEvent, swalOpenAnimationFinished);
|
|
@@ -3909,14 +4242,14 @@
|
|
|
3909
4242
|
* @param {boolean} scrollbarPadding
|
|
3910
4243
|
* @param {string} initialBodyOverflow
|
|
3911
4244
|
*/
|
|
3912
|
-
|
|
4245
|
+
var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding, initialBodyOverflow) {
|
|
3913
4246
|
iOSfix();
|
|
3914
4247
|
if (scrollbarPadding && initialBodyOverflow !== 'hidden') {
|
|
3915
4248
|
replaceScrollbarWithPadding(initialBodyOverflow);
|
|
3916
4249
|
}
|
|
3917
4250
|
|
|
3918
4251
|
// sweetalert2/issues/1247
|
|
3919
|
-
setTimeout(()
|
|
4252
|
+
setTimeout(function () {
|
|
3920
4253
|
container.scrollTop = 0;
|
|
3921
4254
|
});
|
|
3922
4255
|
};
|
|
@@ -3926,18 +4259,21 @@
|
|
|
3926
4259
|
* @param {HTMLElement} popup
|
|
3927
4260
|
* @param {SweetAlertOptions} params
|
|
3928
4261
|
*/
|
|
3929
|
-
|
|
4262
|
+
var addClasses = function addClasses(container, popup, params) {
|
|
3930
4263
|
addClass(container, params.showClass.backdrop);
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
4264
|
+
if (params.animation) {
|
|
4265
|
+
// this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059
|
|
4266
|
+
popup.style.setProperty('opacity', '0', 'important');
|
|
4267
|
+
show(popup, 'grid');
|
|
4268
|
+
setTimeout(function () {
|
|
4269
|
+
// Animate popup right after showing it
|
|
4270
|
+
addClass(popup, params.showClass.popup);
|
|
4271
|
+
// and remove the opacity workaround
|
|
4272
|
+
popup.style.removeProperty('opacity');
|
|
4273
|
+
}, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062
|
|
4274
|
+
} else {
|
|
4275
|
+
show(popup, 'grid');
|
|
4276
|
+
}
|
|
3941
4277
|
addClass([document.documentElement, document.body], swalClasses.shown);
|
|
3942
4278
|
if (params.heightAuto && params.backdrop && !params.toast) {
|
|
3943
4279
|
addClass([document.documentElement, document.body], swalClasses['height-auto']);
|
|
@@ -3950,7 +4286,7 @@
|
|
|
3950
4286
|
* @param {string} [validationMessage]
|
|
3951
4287
|
* @returns {Promise<string | void>}
|
|
3952
4288
|
*/
|
|
3953
|
-
email: (string, validationMessage)
|
|
4289
|
+
email: function email(string, validationMessage) {
|
|
3954
4290
|
return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');
|
|
3955
4291
|
},
|
|
3956
4292
|
/**
|
|
@@ -3958,7 +4294,7 @@
|
|
|
3958
4294
|
* @param {string} [validationMessage]
|
|
3959
4295
|
* @returns {Promise<string | void>}
|
|
3960
4296
|
*/
|
|
3961
|
-
url: (string, validationMessage)
|
|
4297
|
+
url: function url(string, validationMessage) {
|
|
3962
4298
|
// taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013
|
|
3963
4299
|
return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');
|
|
3964
4300
|
}
|
|
@@ -4013,14 +4349,15 @@
|
|
|
4013
4349
|
}
|
|
4014
4350
|
|
|
4015
4351
|
/** @type {SweetAlert} */
|
|
4016
|
-
|
|
4352
|
+
var currentInstance;
|
|
4017
4353
|
var _promise = /*#__PURE__*/new WeakMap();
|
|
4018
|
-
|
|
4354
|
+
var SweetAlert = /*#__PURE__*/function () {
|
|
4019
4355
|
/**
|
|
4020
4356
|
* @param {...any} args
|
|
4021
4357
|
* @this {SweetAlert}
|
|
4022
4358
|
*/
|
|
4023
|
-
|
|
4359
|
+
function SweetAlert() {
|
|
4360
|
+
_classCallCheck(this, SweetAlert);
|
|
4024
4361
|
/**
|
|
4025
4362
|
* @type {Promise<SweetAlertResult>}
|
|
4026
4363
|
*/
|
|
@@ -4038,7 +4375,7 @@
|
|
|
4038
4375
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4039
4376
|
args[_key] = arguments[_key];
|
|
4040
4377
|
}
|
|
4041
|
-
|
|
4378
|
+
var outerParams = Object.freeze(this.constructor.argsToParams(args));
|
|
4042
4379
|
|
|
4043
4380
|
/** @type {Readonly<SweetAlertOptions>} */
|
|
4044
4381
|
this.params = outerParams;
|
|
@@ -4047,42 +4384,50 @@
|
|
|
4047
4384
|
this.isAwaitingPromise = false;
|
|
4048
4385
|
_classPrivateFieldSet(this, _promise, this._main(currentInstance.params));
|
|
4049
4386
|
}
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
if (
|
|
4056
|
-
|
|
4387
|
+
_createClass(SweetAlert, [{
|
|
4388
|
+
key: "_main",
|
|
4389
|
+
value: function _main(userParams) {
|
|
4390
|
+
var mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4391
|
+
showWarningsForParams(Object.assign({}, mixinParams, userParams));
|
|
4392
|
+
if (globalState.currentInstance) {
|
|
4393
|
+
globalState.currentInstance._destroy();
|
|
4394
|
+
if (isModal()) {
|
|
4395
|
+
unsetAriaHidden();
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
globalState.currentInstance = currentInstance;
|
|
4399
|
+
var innerParams = prepareParams(userParams, mixinParams);
|
|
4400
|
+
setParameters(innerParams);
|
|
4401
|
+
Object.freeze(innerParams);
|
|
4402
|
+
|
|
4403
|
+
// clear the previous timer
|
|
4404
|
+
if (globalState.timeout) {
|
|
4405
|
+
globalState.timeout.stop();
|
|
4406
|
+
delete globalState.timeout;
|
|
4057
4407
|
}
|
|
4058
|
-
}
|
|
4059
|
-
globalState.currentInstance = currentInstance;
|
|
4060
|
-
const innerParams = prepareParams(userParams, mixinParams);
|
|
4061
|
-
setParameters(innerParams);
|
|
4062
|
-
Object.freeze(innerParams);
|
|
4063
|
-
|
|
4064
|
-
// clear the previous timer
|
|
4065
|
-
if (globalState.timeout) {
|
|
4066
|
-
globalState.timeout.stop();
|
|
4067
|
-
delete globalState.timeout;
|
|
4068
|
-
}
|
|
4069
4408
|
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4409
|
+
// clear the restore focus timeout
|
|
4410
|
+
clearTimeout(globalState.restoreFocusTimeout);
|
|
4411
|
+
var domCache = populateDomCache(currentInstance);
|
|
4412
|
+
render(currentInstance, innerParams);
|
|
4413
|
+
privateProps.innerParams.set(currentInstance, innerParams);
|
|
4414
|
+
return swalPromise(currentInstance, domCache, innerParams);
|
|
4415
|
+
}
|
|
4077
4416
|
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
}
|
|
4085
|
-
|
|
4417
|
+
// `catch` cannot be the name of a module export, so we define our thenable methods here instead
|
|
4418
|
+
}, {
|
|
4419
|
+
key: "then",
|
|
4420
|
+
value: function then(onFulfilled) {
|
|
4421
|
+
return _classPrivateFieldGet(this, _promise).then(onFulfilled);
|
|
4422
|
+
}
|
|
4423
|
+
}, {
|
|
4424
|
+
key: "finally",
|
|
4425
|
+
value: function _finally(onFinally) {
|
|
4426
|
+
return _classPrivateFieldGet(this, _promise)["finally"](onFinally);
|
|
4427
|
+
}
|
|
4428
|
+
}]);
|
|
4429
|
+
return SweetAlert;
|
|
4430
|
+
}();
|
|
4086
4431
|
|
|
4087
4432
|
/**
|
|
4088
4433
|
* @param {SweetAlert} instance
|
|
@@ -4090,30 +4435,30 @@
|
|
|
4090
4435
|
* @param {SweetAlertOptions} innerParams
|
|
4091
4436
|
* @returns {Promise}
|
|
4092
4437
|
*/
|
|
4093
|
-
|
|
4094
|
-
return new Promise((resolve, reject)
|
|
4438
|
+
var swalPromise = function swalPromise(instance, domCache, innerParams) {
|
|
4439
|
+
return new Promise(function (resolve, reject) {
|
|
4095
4440
|
// functions to handle all closings/dismissals
|
|
4096
4441
|
/**
|
|
4097
4442
|
* @param {DismissReason} dismiss
|
|
4098
4443
|
*/
|
|
4099
|
-
|
|
4444
|
+
var dismissWith = function dismissWith(dismiss) {
|
|
4100
4445
|
instance.close({
|
|
4101
4446
|
isDismissed: true,
|
|
4102
|
-
dismiss
|
|
4447
|
+
dismiss: dismiss
|
|
4103
4448
|
});
|
|
4104
4449
|
};
|
|
4105
4450
|
privateMethods.swalPromiseResolve.set(instance, resolve);
|
|
4106
4451
|
privateMethods.swalPromiseReject.set(instance, reject);
|
|
4107
|
-
domCache.confirmButton.onclick = ()
|
|
4452
|
+
domCache.confirmButton.onclick = function () {
|
|
4108
4453
|
handleConfirmButtonClick(instance);
|
|
4109
4454
|
};
|
|
4110
|
-
domCache.denyButton.onclick = ()
|
|
4455
|
+
domCache.denyButton.onclick = function () {
|
|
4111
4456
|
handleDenyButtonClick(instance);
|
|
4112
4457
|
};
|
|
4113
|
-
domCache.cancelButton.onclick = ()
|
|
4458
|
+
domCache.cancelButton.onclick = function () {
|
|
4114
4459
|
handleCancelButtonClick(instance, dismissWith);
|
|
4115
4460
|
};
|
|
4116
|
-
domCache.closeButton.onclick = ()
|
|
4461
|
+
domCache.closeButton.onclick = function () {
|
|
4117
4462
|
dismissWith(DismissReason.close);
|
|
4118
4463
|
};
|
|
4119
4464
|
handlePopupClick(innerParams, domCache, dismissWith);
|
|
@@ -4124,7 +4469,7 @@
|
|
|
4124
4469
|
initFocus(domCache, innerParams);
|
|
4125
4470
|
|
|
4126
4471
|
// Scroll container to top on open (#1247, #1946)
|
|
4127
|
-
setTimeout(()
|
|
4472
|
+
setTimeout(function () {
|
|
4128
4473
|
domCache.container.scrollTop = 0;
|
|
4129
4474
|
});
|
|
4130
4475
|
});
|
|
@@ -4135,11 +4480,17 @@
|
|
|
4135
4480
|
* @param {SweetAlertOptions} mixinParams
|
|
4136
4481
|
* @returns {SweetAlertOptions}
|
|
4137
4482
|
*/
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4483
|
+
var prepareParams = function prepareParams(userParams, mixinParams) {
|
|
4484
|
+
var templateParams = getTemplateParams(userParams);
|
|
4485
|
+
var params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131
|
|
4141
4486
|
params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);
|
|
4142
4487
|
params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);
|
|
4488
|
+
if (params.animation === false) {
|
|
4489
|
+
params.showClass = {
|
|
4490
|
+
backdrop: 'swal2-noanimation'
|
|
4491
|
+
};
|
|
4492
|
+
params.hideClass = {};
|
|
4493
|
+
}
|
|
4143
4494
|
return params;
|
|
4144
4495
|
};
|
|
4145
4496
|
|
|
@@ -4147,8 +4498,8 @@
|
|
|
4147
4498
|
* @param {SweetAlert} instance
|
|
4148
4499
|
* @returns {DomCache}
|
|
4149
4500
|
*/
|
|
4150
|
-
|
|
4151
|
-
|
|
4501
|
+
var populateDomCache = function populateDomCache(instance) {
|
|
4502
|
+
var domCache = {
|
|
4152
4503
|
popup: getPopup(),
|
|
4153
4504
|
container: getContainer(),
|
|
4154
4505
|
actions: getActions(),
|
|
@@ -4169,18 +4520,18 @@
|
|
|
4169
4520
|
* @param {SweetAlertOptions} innerParams
|
|
4170
4521
|
* @param {Function} dismissWith
|
|
4171
4522
|
*/
|
|
4172
|
-
|
|
4173
|
-
|
|
4523
|
+
var setupTimer = function setupTimer(globalState, innerParams, dismissWith) {
|
|
4524
|
+
var timerProgressBar = getTimerProgressBar();
|
|
4174
4525
|
hide(timerProgressBar);
|
|
4175
4526
|
if (innerParams.timer) {
|
|
4176
|
-
globalState.timeout = new Timer(()
|
|
4527
|
+
globalState.timeout = new Timer(function () {
|
|
4177
4528
|
dismissWith('timer');
|
|
4178
4529
|
delete globalState.timeout;
|
|
4179
4530
|
}, innerParams.timer);
|
|
4180
4531
|
if (innerParams.timerProgressBar) {
|
|
4181
4532
|
show(timerProgressBar);
|
|
4182
4533
|
applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');
|
|
4183
|
-
setTimeout(()
|
|
4534
|
+
setTimeout(function () {
|
|
4184
4535
|
if (globalState.timeout && globalState.timeout.running) {
|
|
4185
4536
|
// timer can be already stopped or unset at this point
|
|
4186
4537
|
animateTimerProgressBar(innerParams.timer);
|
|
@@ -4194,7 +4545,7 @@
|
|
|
4194
4545
|
* @param {DomCache} domCache
|
|
4195
4546
|
* @param {SweetAlertOptions} innerParams
|
|
4196
4547
|
*/
|
|
4197
|
-
|
|
4548
|
+
var initFocus = function initFocus(domCache, innerParams) {
|
|
4198
4549
|
if (innerParams.toast) {
|
|
4199
4550
|
return;
|
|
4200
4551
|
}
|
|
@@ -4212,7 +4563,7 @@
|
|
|
4212
4563
|
* @param {SweetAlertOptions} innerParams
|
|
4213
4564
|
* @returns {boolean}
|
|
4214
4565
|
*/
|
|
4215
|
-
|
|
4566
|
+
var focusButton = function focusButton(domCache, innerParams) {
|
|
4216
4567
|
if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) {
|
|
4217
4568
|
domCache.denyButton.focus();
|
|
4218
4569
|
return true;
|
|
@@ -4227,7 +4578,7 @@
|
|
|
4227
4578
|
}
|
|
4228
4579
|
return false;
|
|
4229
4580
|
};
|
|
4230
|
-
|
|
4581
|
+
var blurActiveElement = function blurActiveElement() {
|
|
4231
4582
|
if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {
|
|
4232
4583
|
document.activeElement.blur();
|
|
4233
4584
|
}
|
|
@@ -4235,19 +4586,19 @@
|
|
|
4235
4586
|
|
|
4236
4587
|
// Dear russian users visiting russian sites. Let's have fun.
|
|
4237
4588
|
if (typeof window !== 'undefined' && /^ru\b/.test(navigator.language) && location.host.match(/\.(ru|su|by|xn--p1ai)$/)) {
|
|
4238
|
-
|
|
4239
|
-
|
|
4589
|
+
var now = new Date();
|
|
4590
|
+
var initiationDate = localStorage.getItem('swal-initiation');
|
|
4240
4591
|
if (!initiationDate) {
|
|
4241
4592
|
localStorage.setItem('swal-initiation', "".concat(now));
|
|
4242
4593
|
} else if ((now.getTime() - Date.parse(initiationDate)) / (1000 * 60 * 60 * 24) > 3) {
|
|
4243
|
-
setTimeout(()
|
|
4594
|
+
setTimeout(function () {
|
|
4244
4595
|
document.body.style.pointerEvents = 'none';
|
|
4245
|
-
|
|
4596
|
+
var ukrainianAnthem = document.createElement('audio');
|
|
4246
4597
|
ukrainianAnthem.src = 'https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3';
|
|
4247
4598
|
ukrainianAnthem.loop = true;
|
|
4248
4599
|
document.body.appendChild(ukrainianAnthem);
|
|
4249
|
-
setTimeout(()
|
|
4250
|
-
ukrainianAnthem.play()
|
|
4600
|
+
setTimeout(function () {
|
|
4601
|
+
ukrainianAnthem.play()["catch"](function () {
|
|
4251
4602
|
// ignore
|
|
4252
4603
|
});
|
|
4253
4604
|
}, 2500);
|
|
@@ -4277,27 +4628,28 @@
|
|
|
4277
4628
|
Object.assign(SweetAlert, staticMethods);
|
|
4278
4629
|
|
|
4279
4630
|
// Proxy to instance methods to constructor, for now, for backwards compatibility
|
|
4280
|
-
Object.keys(instanceMethods).forEach(key
|
|
4631
|
+
Object.keys(instanceMethods).forEach(function (key) {
|
|
4281
4632
|
/**
|
|
4282
4633
|
* @param {...any} args
|
|
4283
4634
|
* @returns {any | undefined}
|
|
4284
4635
|
*/
|
|
4285
4636
|
SweetAlert[key] = function () {
|
|
4286
4637
|
if (currentInstance && currentInstance[key]) {
|
|
4287
|
-
|
|
4638
|
+
var _currentInstance;
|
|
4639
|
+
return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments);
|
|
4288
4640
|
}
|
|
4289
4641
|
return null;
|
|
4290
4642
|
};
|
|
4291
4643
|
});
|
|
4292
4644
|
SweetAlert.DismissReason = DismissReason;
|
|
4293
|
-
SweetAlert.version = '11.
|
|
4645
|
+
SweetAlert.version = '11.10.0';
|
|
4294
4646
|
|
|
4295
|
-
|
|
4647
|
+
var Swal = SweetAlert;
|
|
4296
4648
|
// @ts-ignore
|
|
4297
|
-
Swal
|
|
4649
|
+
Swal["default"] = Swal;
|
|
4298
4650
|
|
|
4299
4651
|
return Swal;
|
|
4300
4652
|
|
|
4301
4653
|
}));
|
|
4302
4654
|
if (typeof this !== 'undefined' && this.Sweetalert2){this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}
|
|
4303
|
-
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}");
|
|
4655
|
+
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}");
|