PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9.1
4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 All 141 releases
learnpress / assets / dist / js / admin / admin-courses.js

admin-courses.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.9.1, at assets/dist/js/admin/admin-courses.js

7,135 lines 254.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./assets/src/js/admin/courses/generate-with-ai.js"
5 /*!*********************************************************!*\
6 !*** ./assets/src/js/admin/courses/generate-with-ai.js ***!
7 \*********************************************************/
8 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
10 "use strict";
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ CreateCourseViaAI: () => (/* binding */ CreateCourseViaAI)
14 /* harmony export */ });
15 /* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
16 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js");
17 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(sweetalert2__WEBPACK_IMPORTED_MODULE_1__);
18 /* harmony import */ var lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lpAssetsJsPath/lpToastify.js */ "./assets/src/js/lpToastify.js");
19 /**
20 * Create course with AI
21 */
22
23
24
25
26 let lp_structure_course;
27 let lp_is_generating_course_data = false;
28 const lp_course_ai_setting = JSON.parse(localStorage.getItem('lp_course_ai_setting')) || {};
29 class CreateCourseViaAI {
30 constructor(options = {}) {
31 this.options = {
32 autoInsertButton: true,
33 isCourseBuilder: false,
34 redirectDelayMs: 2000,
35 ...options
36 };
37 this.init();
38 }
39 static selectors = {
40 elGenerateDataAiWrap: '.lp-generate-data-ai-wrap'
41 };
42 init() {
43 if (this.options.autoInsertButton) {
44 if (!lpData?.enable_open_ai) {
45 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady('.page-title-action', el => {
46 el.insertAdjacentHTML('afterend', `<button type="button" class="lp-btn-warning-enable-ai lp-btn-ai-style">
47 <i class="lp-ico-ai"></i>
48 <span>${lpData.i18n.generate_with_ai}</span>
49 </button>`);
50 });
51 } else {
52 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady('.page-title-action', el => {
53 el.insertAdjacentHTML('afterend', `<button type="button" class="lp-btn-generate-course-with-ai lp-btn-ai-style">
54 <i class="lp-ico-ai"></i>
55 <span>${lpData.i18n.generate_with_ai}</span>
56 </button>`);
57 });
58 }
59 }
60 this.events();
61 }
62 events() {
63 if (CreateCourseViaAI._loadedEvents) {
64 return;
65 }
66 CreateCourseViaAI._loadedEvents = true;
67 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{
68 selector: '.lp-btn-warning-enable-ai',
69 class: this,
70 callBack: this.showPopupEnableAI.name
71 }, {
72 selector: '.lp-btn-generate-course-with-ai',
73 class: this,
74 callBack: this.showPopupCreateFullCourse.name
75 }, {
76 selector: '.lp-btn-step',
77 class: this,
78 callBack: this.showStep.name
79 }, {
80 selector: '.lp-btn-generate-prompt',
81 class: this,
82 callBack: this.generatePrompt.name
83 }, {
84 selector: '.lp-btn-call-open-ai',
85 class: this,
86 callBack: this.generateDataCourse.name
87 }, {
88 selector: '.lp-btn-create-course',
89 class: this,
90 callBack: this.createCourse.name
91 }, {
92 selector: '.lp-btn-close-ai-popup',
93 //class: this,
94 callBack: args => {
95 const {
96 e,
97 target
98 } = args;
99 const message = lpData?.i18n?.confirm_close_ai || 'Are you sure you want to close? Generate data will stop.';
100 if (!lp_is_generating_course_data) {
101 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
102 } else if (confirm(message)) {
103 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
104 }
105
106 // Testing custom confirm box
107 /*if ( confirm( message ) ) {
108 SweetAlert.close();
109 }*/
110 }
111 }]);
112 }
113
114 // Show popup warning enable AI before using.
115 showPopupEnableAI() {
116 const modalTemplate = document.querySelector('#lp-tmpl-must-enable-ai');
117 if (!modalTemplate) {
118 console.error('Enable OpenAI Modal Template not found!');
119 return;
120 }
121 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
122 html: modalTemplate.innerHTML,
123 width: '420px',
124 showCloseButton: false,
125 showConfirmButton: false
126 });
127 }
128 showPopupCreateFullCourse() {
129 const modalTemplate = document.querySelector('#lp-tmpl-create-course-ai');
130 if (!modalTemplate) {
131 console.error('AI Create Full Course Modal Template not found!');
132 return;
133 }
134 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
135 html: modalTemplate.innerHTML,
136 width: '60%',
137 showCloseButton: false,
138 showConfirmButton: false,
139 allowOutsideClick: false,
140 allowEscapeKey: false,
141 didOpen: () => {
142 const popup = sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().getPopup();
143 popup.click();
144 const targetAudience = popup.querySelector('select[name="target_audience"]');
145 if (targetAudience && lp_course_ai_setting?.target_audience) {
146 targetAudience.tomselect.setValue(lp_course_ai_setting.target_audience);
147 }
148 const tone = popup.querySelector('select[name="tone"]');
149 if (tone && lp_course_ai_setting?.tone) {
150 tone.tomselect.setValue(lp_course_ai_setting.tone);
151 }
152 const language = popup.querySelector('select[name="language"]');
153 if (language && lp_course_ai_setting?.language) {
154 language.tomselect.setValue(lp_course_ai_setting.language);
155 }
156 targetAudience.addEventListener('change', event => {
157 lp_course_ai_setting.target_audience = targetAudience.tomselect.getValue();
158 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
159 });
160 tone.addEventListener('change', event => {
161 lp_course_ai_setting.tone = tone.tomselect.getValue();
162 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
163 });
164 language.addEventListener('change', event => {
165 const value = language.tomselect.getValue();
166 lp_course_ai_setting.language = value ? [value] : [];
167 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
168 });
169 }
170 }).then(result => {
171 if (result.isDismissed) {
172 if (lp_is_generating_course_data) {
173 lp_is_generating_course_data = false;
174 }
175 }
176 });
177 }
178 showStep(args) {
179 const {
180 e,
181 target
182 } = args;
183 e.preventDefault();
184 const elBtnActions = target.closest('.button-actions');
185 const elCreateCourseAIWrap = elBtnActions.closest(CreateCourseViaAI.selectors.elGenerateDataAiWrap);
186 let step = parseInt(elBtnActions.dataset.step);
187 const stepAction = target.dataset.action;
188 if (stepAction === 'next') {
189 step++;
190 } else if (stepAction === 'prev') {
191 step--;
192 }
193 elBtnActions.dataset.step = step;
194 const elForm = target.closest('form');
195 const elContentStep = elForm.querySelector(`.step-content[data-step="${step}"]`);
196 const elItemStep = elCreateCourseAIWrap.querySelector(`.step-item[data-step="${step}"]`);
197 elForm.querySelectorAll('.step-content').forEach(el => el.classList.remove('active'));
198 elContentStep.classList.add('active');
199 elCreateCourseAIWrap.querySelectorAll('.step-item').forEach(el => el.classList.remove('active'));
200 elItemStep.classList.add('active');
201
202 // Get all buttons step to show/hide
203 const form = target.closest('form');
204 const elBtnSteps = form.querySelectorAll('button[data-step-show]');
205 elBtnSteps.forEach(el => {
206 const stepsShow = el.dataset.stepShow.split(',').map(s => parseInt(s.trim()));
207 if (stepsShow.includes(step)) {
208 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(el, 1);
209 } else {
210 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(el, 0);
211 }
212 });
213 }
214
215 /**
216 * Create prompt from data config
217 * @param args
218 */
219 generatePrompt(args) {
220 const {
221 e,
222 target
223 } = args;
224 e.preventDefault();
225 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
226
227 // Get dataSend
228 const form = target.closest('form');
229 let dataSend = JSON.parse(target.dataset.send);
230 dataSend = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.mergeDataWithDatForm(form, dataSend);
231
232 // Ajax to generate prompt
233 const callBack = {
234 success: response => {
235 const {
236 message,
237 status,
238 data
239 } = response;
240 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
241 if (status === 'success') {
242 const elBtnNext = form.querySelector('.lp-btn-step[data-action=next]');
243 elBtnNext.click();
244 const elPromptTextarea = form.querySelector('textarea[name=lp-openai-prompt-generated-field]');
245 elPromptTextarea.value = data;
246 }
247 },
248 error: error => {
249 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
250 },
251 completed: () => {
252 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
253 }
254 };
255 window.lpAJAXG.fetchAJAX(dataSend, callBack);
256 }
257
258 /**
259 * Submit prompt to OpenAI to generate course data
260 * @param args
261 */
262 generateDataCourse(args) {
263 const {
264 e,
265 target
266 } = args;
267 e.preventDefault();
268 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
269
270 // Get dataSend
271 const form = target.closest('form');
272 let dataSend = JSON.parse(target.dataset.send);
273 dataSend = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.mergeDataWithDatForm(form, dataSend);
274 const btnPrev = form.querySelector('.lp-btn-step[data-action=prev]');
275 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(btnPrev, 0);
276
277 // Ajax to generate prompt
278 const callBack = {
279 success: response => {
280 const {
281 message,
282 status,
283 data
284 } = response;
285 if (lp_is_generating_course_data) {
286 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
287 }
288 if (status === 'success') {
289 // Save structure data
290 lp_structure_course = data.lp_structure_course;
291
292 // Set preview HTML
293 const elResults = form.querySelector('.lp-ai-generated-results');
294 elResults.innerHTML = data.lp_html_preview;
295 const elBtnNext = form.querySelector('.lp-btn-step[data-action=next]');
296 elBtnNext.click();
297 }
298 },
299 error: error => {
300 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
301 },
302 completed: () => {
303 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
304 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(btnPrev, 1);
305 lp_is_generating_course_data = false;
306 }
307 };
308 lp_is_generating_course_data = true;
309 window.lpAJAXG.fetchAJAX(dataSend, callBack);
310 }
311
312 /**
313 * Create course with data of OpenAI
314 * @param args
315 */
316 createCourse(args) {
317 const {
318 e,
319 target
320 } = args;
321 e.preventDefault();
322 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
323
324 // Get dataSend
325 const dataSend = JSON.parse(target.dataset.send);
326 dataSend.lp_structure_course = lp_structure_course;
327 if (this.options.isCourseBuilder) {
328 dataSend.is_course_builder = 1;
329 }
330 const form = target.closest('form');
331 const elBtnPrev = form.querySelector('.lp-btn-step[data-action=prev]');
332 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 0);
333 const windowWidth = window.outerWidth;
334 let alertWidth;
335 if (windowWidth < 768) {
336 alertWidth = '90%';
337 } else {
338 alertWidth = '30%';
339 }
340 const creatingCourseAiModal = document.querySelector('#lp-tmpl-creating-course-ai');
341 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
342 html: creatingCourseAiModal.innerHTML,
343 showCloseButton: false,
344 showConfirmButton: false,
345 allowOutsideClick: false,
346 width: alertWidth
347 });
348
349 // Ajax to generate prompt
350 const callBack = {
351 success: response => {
352 const {
353 message,
354 status,
355 data
356 } = response;
357 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
358 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
359 if (status === 'success') {
360 setTimeout(() => {
361 window.location.href = data.edit_course_url;
362 }, this.options.redirectDelayMs);
363 } else {
364 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 1);
365 }
366 },
367 error: error => {
368 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
369 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 1);
370 },
371 completed: () => {
372 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
373 }
374 };
375 window.lpAJAXG.fetchAJAX(dataSend, callBack);
376 }
377 }
378
379 /***/ },
380
381 /***/ "./assets/src/js/admin/courses/view-students-modal.js"
382 /*!************************************************************!*\
383 !*** ./assets/src/js/admin/courses/view-students-modal.js ***!
384 \************************************************************/
385 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
386
387 "use strict";
388 __webpack_require__.r(__webpack_exports__);
389 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
390 /* harmony export */ ViewStudentsModal: () => (/* binding */ ViewStudentsModal)
391 /* harmony export */ });
392 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js");
393 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sweetalert2__WEBPACK_IMPORTED_MODULE_0__);
394 /* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
395
396
397 class ViewStudentsModal {
398 constructor() {
399 this.isRequesting = false;
400 this.activeCourseId = 0;
401 this.init();
402 }
403 static selectors = {
404 wrap: '#lp-modal-enrolled-wrap',
405 form: '#lp-modal-enrolled-form',
406 toolbarTemplate: '#lp-tmpl-enrolled-students-toolbar-modal',
407 targetTemplate: '#lp-tmpl-enrolled-students-target-modal',
408 toolbar: '.lp-enrolled-students-table-toolbar--modal',
409 courseTrigger: '.lp-btn-view-students',
410 searchInput: '#lp-modal-enrolled-search-input',
411 startDateInput: '#lp-modal-enrolled-filter-start-date',
412 endDateInput: '#lp-modal-enrolled-filter-end-date',
413 searchBtn: '.lp-enrolled-btn-search-modal',
414 clearBtn: '.lp-enrolled-btn-clear-modal',
415 modalSearchFields: '#lp-modal-enrolled-search-input, #lp-modal-enrolled-filter-start-date, #lp-modal-enrolled-filter-end-date'
416 };
417 setButtonLoadingState(btn, isLoading) {
418 if (!btn) {
419 return;
420 }
421 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.lpSetLoadingEl(btn, isLoading ? 1 : 0);
422 }
423 init() {
424 if (ViewStudentsModal._loadedEvents) {
425 return;
426 }
427 ViewStudentsModal._loadedEvents = true;
428 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('click', [{
429 selector: ViewStudentsModal.selectors.courseTrigger,
430 class: this,
431 callBack: this.handleOpenModal.name
432 }, {
433 selector: ViewStudentsModal.selectors.searchBtn,
434 class: this,
435 callBack: this.handleModalSearch.name
436 }, {
437 selector: ViewStudentsModal.selectors.clearBtn,
438 class: this,
439 callBack: this.handleModalClear.name
440 }]);
441 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('keydown', [{
442 selector: ViewStudentsModal.selectors.modalSearchFields,
443 class: this,
444 callBack: this.handleModalSearchOnEnter.name,
445 checkIsEventEnter: true
446 }]);
447 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('change', [{
448 selector: ViewStudentsModal.selectors.startDateInput,
449 class: this,
450 callBack: this.checkDatesRange.name
451 }, {
452 selector: ViewStudentsModal.selectors.endDateInput,
453 class: this,
454 callBack: this.checkDatesRange.name
455 }]);
456 }
457 handleOpenModal(args) {
458 const btn = args?.target?.closest(ViewStudentsModal.selectors.courseTrigger);
459 if (!btn || this.isRequesting || btn.classList.contains('loading')) {
460 return;
461 }
462 const courseId = parseInt(btn.dataset.courseId, 10) || 0;
463 if (!courseId) {
464 return;
465 }
466 const courseTitle = btn.dataset.courseTitle || '';
467 this.activeCourseId = courseId;
468 this.setButtonLoadingState(btn, true);
469 this.openModal(courseId, courseTitle, btn);
470 }
471 handleModalSearch(args) {
472 const btn = args?.target?.closest(ViewStudentsModal.selectors.searchBtn);
473 if (!btn || !this.activeCourseId) {
474 return;
475 }
476 if (args?.e) {
477 args.e.preventDefault();
478 }
479 if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
480 return;
481 }
482 this.setButtonLoadingState(btn, true);
483 this.loadEnrolledStudents(this.activeCourseId, 1, btn);
484 }
485 handleModalSearchOnEnter(args) {
486 if (args?.e) {
487 args.e.preventDefault();
488 }
489 const form = this.getModalForm();
490 if (!form) {
491 return;
492 }
493 const btn = form.querySelector(ViewStudentsModal.selectors.searchBtn);
494 if (!btn) {
495 return;
496 }
497 this.handleModalSearch({
498 ...args,
499 target: btn
500 });
501 }
502 handleModalClear(args) {
503 const btn = args?.target?.closest(ViewStudentsModal.selectors.clearBtn);
504 const form = this.getModalForm();
505 if (!btn || !form || !this.activeCourseId) {
506 return;
507 }
508 if (args?.e) {
509 args.e.preventDefault();
510 }
511 if (this.isRequesting || btn.classList.contains('loading')) {
512 return;
513 }
514 form.reset();
515 this.setButtonLoadingState(btn, true);
516 this.loadEnrolledStudents(this.activeCourseId, 1, btn);
517 }
518 getModalPopup() {
519 return (sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().getPopup) ? sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().getPopup() : null;
520 }
521 getModalToolbarHtml() {
522 const template = document.querySelector(ViewStudentsModal.selectors.toolbarTemplate);
523 return template ? template.innerHTML : '';
524 }
525 getModalTargetHtml() {
526 const template = document.querySelector(ViewStudentsModal.selectors.targetTemplate);
527 return template ? template.innerHTML : '';
528 }
529 getAjaxHandle() {
530 const ajaxHandle = window.lpAJAXG;
531 if (!ajaxHandle || typeof ajaxHandle.getDataSetCurrent !== 'function' || typeof ajaxHandle.setDataSetCurrent !== 'function' || typeof ajaxHandle.showHideLoading !== 'function' || typeof ajaxHandle.fetchAJAX !== 'function') {
532 return null;
533 }
534 return ajaxHandle;
535 }
536 getModalForm() {
537 const popup = this.getModalPopup();
538 if (!popup) {
539 return null;
540 }
541 return popup.querySelector(ViewStudentsModal.selectors.form);
542 }
543 getModalFilterArgs(dataArgs = {}) {
544 const form = this.getModalForm();
545 if (!form) {
546 return dataArgs;
547 }
548 return lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.mergeDataWithDatForm(form, dataArgs);
549 }
550 loadEnrolledStudents(courseId, paged, elLoading = null) {
551 const wrap = document.querySelector(ViewStudentsModal.selectors.wrap);
552 const elTarget = wrap?.querySelector('.lp-target');
553 const ajaxHandle = this.getAjaxHandle();
554 if (!wrap || !elTarget || !ajaxHandle || this.isRequesting) {
555 return;
556 }
557 this.isRequesting = true;
558 if (elLoading) {
559 this.setButtonLoadingState(elLoading, true);
560 }
561 const dataSend = ajaxHandle.getDataSetCurrent(elTarget);
562 dataSend.args = this.getModalFilterArgs(dataSend.args || {});
563 dataSend.args.course_id = parseInt(courseId, 10) || 0;
564 dataSend.args.paged = paged;
565 ajaxHandle.setDataSetCurrent(elTarget, dataSend);
566 ajaxHandle.showHideLoading(elTarget, 1);
567 const callBack = {
568 success: response => {
569 elTarget.innerHTML = response.data.content;
570 },
571 error: err => {
572 console.error(err);
573 },
574 completed: () => {
575 this.isRequesting = false;
576 ajaxHandle.showHideLoading(elTarget, 0);
577 if (elLoading) {
578 this.setButtonLoadingState(elLoading, false);
579 }
580 }
581 };
582 ajaxHandle.fetchAJAX(dataSend, callBack);
583 }
584 openModal(courseId, courseTitle, elTrigger = null) {
585 const modalToolbarHtml = this.getModalToolbarHtml();
586 const modalTargetHtml = this.getModalTargetHtml();
587 if (!modalToolbarHtml || !modalTargetHtml) {
588 if (elTrigger) {
589 this.setButtonLoadingState(elTrigger, false);
590 }
591 return;
592 }
593 this.activeCourseId = parseInt(courseId, 10) || 0;
594 sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().fire({
595 title: `${courseTitle}`,
596 html: modalToolbarHtml + modalTargetHtml,
597 width: '80%',
598 showConfirmButton: false,
599 showCloseButton: true,
600 didOpen: () => {
601 this.loadEnrolledStudents(this.activeCourseId, 1, elTrigger);
602 },
603 didClose: () => {
604 this.activeCourseId = 0;
605 if (elTrigger) {
606 this.setButtonLoadingState(elTrigger, false);
607 }
608 }
609 });
610 }
611
612 // Ensure start date is not after end date and vice versa. If invalid, adjust the other date to match.
613 checkDatesRange(args) {
614 const {
615 e
616 } = args;
617 const elInput = e?.target;
618 if (!elInput) {
619 return;
620 }
621 const elForm = elInput.closest(ViewStudentsModal.selectors.form);
622 if (!elForm) {
623 return;
624 }
625 const startDateInput = elForm.querySelector(ViewStudentsModal.selectors.startDateInput);
626 const endDateInput = elForm.querySelector(ViewStudentsModal.selectors.endDateInput);
627 if (elInput === startDateInput) {
628 if (startDateInput.value) {
629 endDateInput.min = startDateInput.value;
630 if (endDateInput.value && endDateInput.value < startDateInput.value) {
631 endDateInput.value = startDateInput.value;
632 }
633 } else {
634 endDateInput.min = '';
635 }
636 } else if (elInput === endDateInput) {
637 if (endDateInput.value) {
638 startDateInput.max = endDateInput.value;
639 if (startDateInput.value && startDateInput.value > endDateInput.value) {
640 startDateInput.value = endDateInput.value;
641 }
642 } else {
643 startDateInput.max = '';
644 }
645 }
646 }
647 }
648
649 /***/ },
650
651 /***/ "./assets/src/js/lpToastify.js"
652 /*!*************************************!*\
653 !*** ./assets/src/js/lpToastify.js ***!
654 \*************************************/
655 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
656
657 "use strict";
658 __webpack_require__.r(__webpack_exports__);
659 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
660 /* harmony export */ show: () => (/* binding */ show)
661 /* harmony export */ });
662 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js");
663 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_0__);
664 /* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css");
665 /**
666 * Utils functions
667 *
668 * @param url
669 * @param data
670 * @param functions
671 * @since 4.3.0
672 * @version 1.0.0
673 */
674
675
676 const argsToastify = {
677 text: '',
678 gravity: lpData.toast.gravity,
679 // `top` or `bottom`
680 position: lpData.toast.position,
681 // `left`, `center` or `right`
682 className: `${lpData.toast.classPrefix}`,
683 close: lpData.toast.close == 1,
684 stopOnFocus: lpData.toast.stopOnFocus == 1,
685 duration: lpData.toast.duration
686 };
687 const show = (message, status = 'success', argsCustom) => {
688 let args = argsToastify;
689 if (argsCustom) {
690 args = {
691 ...args,
692 ...argsCustom
693 };
694 }
695 const toastify = new (toastify_js__WEBPACK_IMPORTED_MODULE_0___default())({
696 ...args,
697 text: message,
698 className: `${lpData.toast.classPrefix} ${status}`
699 });
700 toastify.showToast();
701 };
702
703 /***/ },
704
705 /***/ "./assets/src/js/utils.js"
706 /*!********************************!*\
707 !*** ./assets/src/js/utils.js ***!
708 \********************************/
709 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
710
711 "use strict";
712 __webpack_require__.r(__webpack_exports__);
713 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
714 /* harmony export */ debounce: () => (/* binding */ debounce),
715 /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers),
716 /* harmony export */ fullScreenView: () => (/* binding */ fullScreenView),
717 /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm),
718 /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm),
719 /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated),
720 /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed),
721 /* harmony export */ lpAddQueryArgs: () => (/* binding */ lpAddQueryArgs),
722 /* harmony export */ lpAjaxParseJsonOld: () => (/* binding */ lpAjaxParseJsonOld),
723 /* harmony export */ lpClassName: () => (/* binding */ lpClassName),
724 /* harmony export */ lpFetchAPI: () => (/* binding */ lpFetchAPI),
725 /* harmony export */ lpGetCurrentURLNoParam: () => (/* binding */ lpGetCurrentURLNoParam),
726 /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady),
727 /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl),
728 /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl),
729 /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm),
730 /* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse),
731 /* harmony export */ toggleEnable: () => (/* binding */ toggleEnable)
732 /* harmony export */ });
733 /**
734 * Utils functions
735 *
736 * @param url
737 * @param data
738 * @param functions
739 * @since 4.2.5.1
740 * @version 1.0.7
741 */
742 const lpClassName = {
743 hidden: 'lp-hidden',
744 loading: 'loading',
745 elCollapse: 'lp-collapse',
746 elSectionToggle: '.lp-section-toggle',
747 elTriggerToggle: '.lp-trigger-toggle',
748 elBtnFullScreen: '.lp-btn-full-screen-view',
749 elFullScreen: 'lp-full-screen-view',
750 elBtnFullScreenClose: 'lp-full-screen-view__close'
751 };
752 const lpFetchAPI = (url, data = {}, functions = {}) => {
753 if ('function' === typeof functions.before) {
754 functions.before();
755 }
756 fetch(url, {
757 method: 'GET',
758 ...data
759 }).then(response => response.json()).then(response => {
760 if ('function' === typeof functions.success) {
761 functions.success(response);
762 }
763 }).catch(err => {
764 if ('function' === typeof functions.error) {
765 functions.error(err);
766 }
767 }).finally(() => {
768 if ('function' === typeof functions.completed) {
769 functions.completed();
770 }
771 });
772 };
773
774 /**
775 * Get current URL without params.
776 *
777 * @since 4.2.5.1
778 */
779 const lpGetCurrentURLNoParam = () => {
780 let currentUrl = window.location.href;
781 const hasParams = currentUrl.includes('?');
782 if (hasParams) {
783 currentUrl = currentUrl.split('?')[0];
784 }
785 return currentUrl;
786 };
787 const lpAddQueryArgs = (endpoint, args) => {
788 const url = new URL(endpoint);
789 Object.keys(args).forEach(arg => {
790 url.searchParams.set(arg, args[arg]);
791 });
792 return url;
793 };
794
795 /**
796 * Listen element viewed.
797 *
798 * @param el
799 * @param callback
800 * @since 4.2.5.8
801 */
802 const listenElementViewed = (el, callback) => {
803 const observerSeeItem = new IntersectionObserver(function (entries) {
804 for (const entry of entries) {
805 if (entry.isIntersecting) {
806 callback(entry);
807 }
808 }
809 });
810 observerSeeItem.observe(el);
811 };
812
813 /**
814 * Listen element created.
815 *
816 * @param callback
817 * @since 4.2.5.8
818 */
819 const listenElementCreated = callback => {
820 const observerCreateItem = new MutationObserver(function (mutations) {
821 mutations.forEach(function (mutation) {
822 if (mutation.addedNodes) {
823 mutation.addedNodes.forEach(function (node) {
824 if (node.nodeType === 1) {
825 callback(node);
826 }
827 });
828 }
829 });
830 });
831 observerCreateItem.observe(document, {
832 childList: true,
833 subtree: true
834 });
835 // End.
836 };
837
838 /**
839 * Listen element created.
840 *
841 * @param selector
842 * @param callback
843 * @since 4.2.7.1
844 */
845 const lpOnElementReady = (selector, callback) => {
846 const element = document.querySelector(selector);
847 if (element) {
848 callback(element);
849 return;
850 }
851 const observer = new MutationObserver((mutations, obs) => {
852 const element = document.querySelector(selector);
853 if (element) {
854 obs.disconnect();
855 callback(element);
856 }
857 });
858 observer.observe(document.documentElement, {
859 childList: true,
860 subtree: true
861 });
862 };
863
864 // Parse JSON from string with content include LP_AJAX_START.
865 const lpAjaxParseJsonOld = data => {
866 if (typeof data !== 'string') {
867 return data;
868 }
869 const m = String.raw({
870 raw: data
871 }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
872 try {
873 if (m) {
874 data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, ''));
875 } else {
876 data = JSON.parse(data);
877 }
878 } catch (e) {
879 data = {};
880 }
881 return data;
882 };
883
884 // status 0: hide, 1: show
885 const lpShowHideEl = (el, status = 0) => {
886 if (!el) {
887 return;
888 }
889 if (!status) {
890 el.classList.add(lpClassName.hidden);
891 } else {
892 el.classList.remove(lpClassName.hidden);
893 }
894 };
895
896 // status 0: hide, 1: show
897 const lpSetLoadingEl = (el, status) => {
898 if (!el) {
899 return;
900 }
901 if (!status) {
902 el.classList.remove(lpClassName.loading);
903 } else {
904 el.classList.add(lpClassName.loading);
905 }
906 };
907
908 // Toggle collapse section
909 const toggleCollapse = (e, target, elTriggerClassName = '', elsExclude = [], callback) => {
910 if (!elTriggerClassName) {
911 elTriggerClassName = lpClassName.elTriggerToggle;
912 }
913
914 // Exclude elements, which should not trigger the collapse toggle
915 if (elsExclude && elsExclude.length > 0) {
916 for (const elExclude of elsExclude) {
917 if (target.closest(elExclude)) {
918 return;
919 }
920 }
921 }
922 const elTrigger = target.closest(elTriggerClassName);
923 if (!elTrigger) {
924 return;
925 }
926
927 //console.log( 'elTrigger', elTrigger );
928
929 const elSectionToggle = elTrigger.closest(`${lpClassName.elSectionToggle}`);
930 if (!elSectionToggle) {
931 return;
932 }
933 elSectionToggle.classList.toggle(`${lpClassName.elCollapse}`);
934 if ('function' === typeof callback) {
935 callback(elSectionToggle);
936 }
937 };
938
939 // Get data of form
940 const getDataOfForm = form => {
941 const dataSend = {};
942 const formData = new FormData(form);
943 for (const pair of formData.entries()) {
944 const key = pair[0];
945 const value = formData.getAll(key);
946 if (!dataSend.hasOwnProperty(key)) {
947 // Convert value array to string.
948 dataSend[key] = value.join(',');
949 }
950 }
951 return dataSend;
952 };
953
954 // Get field keys of form
955 const getFieldKeysOfForm = form => {
956 const keys = [];
957 const elements = form.elements;
958 for (let i = 0; i < elements.length; i++) {
959 const name = elements[i].name;
960 if (name && !keys.includes(name)) {
961 keys.push(name);
962 }
963 }
964 return keys;
965 };
966
967 // Merge data handle with data form.
968 const mergeDataWithDatForm = (elForm, dataHandle) => {
969 const dataForm = getDataOfForm(elForm);
970 const keys = getFieldKeysOfForm(elForm);
971 keys.forEach(key => {
972 if (!dataForm.hasOwnProperty(key)) {
973 delete dataHandle[key];
974 } else if (dataForm[key][0] === '') {
975 delete dataForm[key];
976 delete dataHandle[key];
977 }
978 });
979 dataHandle = {
980 ...dataHandle,
981 ...dataForm
982 };
983 return dataHandle;
984 };
985
986 /**
987 * Event trigger
988 * For each list of event handlers, listen event on document.
989 *
990 * eventName: 'click', 'change', ...
991 * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
992 *
993 * @param eventName
994 * @param eventHandlers
995 */
996 const eventHandlers = (eventName, eventHandlers) => {
997 document.addEventListener(eventName, e => {
998 const target = e.target;
999 let args = {
1000 e,
1001 target
1002 };
1003 eventHandlers.forEach(eventHandler => {
1004 args = {
1005 ...args,
1006 ...eventHandler
1007 };
1008
1009 //console.log( args );
1010
1011 // Check condition before call back
1012 if (eventHandler.conditionBeforeCallBack) {
1013 if (eventHandler.conditionBeforeCallBack(args) !== true) {
1014 return;
1015 }
1016 }
1017
1018 // Special check for keydown event with checkIsEventEnter = true
1019 if (eventName === 'keydown' && eventHandler.checkIsEventEnter) {
1020 if (e.key !== 'Enter') {
1021 return;
1022 }
1023 }
1024 if (target.closest(eventHandler.selector)) {
1025 if (eventHandler.class) {
1026 // Call method of class, function callBack will understand exactly {this} is class object.
1027 eventHandler.class[eventHandler.callBack](args);
1028 } else {
1029 // For send args is objected, {this} is eventHandler object, not class object.
1030 eventHandler.callBack(args);
1031 }
1032 }
1033 });
1034 });
1035 };
1036
1037 /**
1038 * Debounce - delays function execution until after `wait` ms of inactivity.
1039 *
1040 * Each call resets the timer. Only the last call in a burst executes.
1041 *
1042 * USE CASES:
1043 * - Search inputs, form validation, window resize
1044 * - Multiple elements need independent timers
1045 * - When you need to call with different arguments
1046 *
1047 * EXAMPLES:
1048 * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
1049 * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
1050 *
1051 * const debouncedResize = debounce( recalculateLayout, 250 );
1052 * window.addEventListener('resize', debouncedResize);
1053 *
1054 * ⚠️ Create ONCE outside event handlers, not inside.
1055 *
1056 * @param {Function} func - Function to debounce (can be anonymous)
1057 * @param {number} wait - Milliseconds to wait (default: 500)
1058 * @return {Function} Debounced wrapper function
1059 * @since 4.3.7
1060 * @version 1.0.0
1061 */
1062 const debounce = (func, wait = 500) => {
1063 let timer;
1064 return args => {
1065 clearTimeout(timer);
1066 timer = setTimeout(() => func(args), wait);
1067 };
1068 };
1069
1070 /**
1071 * Initialize lp-toggle-enable components.
1072 *
1073 * Finds all `.lp-toggle-enable` elements and wires up toggle behavior.
1074 * Reads initial state from `data-enabled` attribute ("true"/"false").
1075 * Calls `data-on-toggle` callback (if provided via options) on state change.
1076 *
1077 * HTML structure:
1078 * <label class="lp-toggle-enable" data-enabled="true">
1079 * <input type="checkbox" class="lp-toggle-enable__input" />
1080 * <span class="lp-toggle-enable__track"></span>
1081 * </label>
1082 *
1083 * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable')
1084 * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change
1085 * @since 4.4.5
1086 * @version 1.0.0
1087 */
1088 window.lpToggleEnableInit = 0;
1089 const toggleEnable = (onToggle = null) => {
1090 if (window.lpToggleEnableInit) {
1091 return;
1092 }
1093 window.lpToggleEnableInit = 1;
1094 const selector = '.lp-toggle-enable';
1095 const updateUI = (toggle, isEnabled) => {
1096 toggle.classList.toggle('is-enabled', isEnabled);
1097 const input = toggle.querySelector('.lp-toggle-enable__input');
1098 if (input) {
1099 input.checked = isEnabled;
1100 input.value = isEnabled ? '1' : '0';
1101 }
1102 };
1103
1104 // Delegate click handling via eventHandlers.
1105 eventHandlers('click', [{
1106 selector,
1107 callBack: args => {
1108 const {
1109 e,
1110 target
1111 } = args;
1112 const toggle = target.closest(selector);
1113 if (!toggle || toggle.classList.contains('is-disabled')) {
1114 return;
1115 }
1116 e.preventDefault();
1117 const isEnabled = !toggle.classList.contains('is-enabled');
1118 updateUI(toggle, isEnabled);
1119 if ('function' === typeof onToggle) {
1120 onToggle(toggle, isEnabled);
1121 }
1122 }
1123 }]);
1124 };
1125
1126 /**
1127 * Initialize custom fullscreen view buttons.
1128 *
1129 * Delegates clicks on `.lp-btn-full-screen-view` buttons to
1130 * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the
1131 * target element. Falls back to the button's parent element when
1132 * `data-target` is not provided.
1133 *
1134 * @since 4.4.5
1135 * @version 1.0.0
1136 */
1137 window.lpFullScreenViewInit = 0;
1138 const fullScreenView = () => {
1139 if (window.lpFullScreenViewInit) {
1140 return;
1141 }
1142 window.lpFullScreenViewInit = 1;
1143 let lastScrollY = 0;
1144 const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => {
1145 const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen);
1146 if (isFullscreen) {
1147 elTarget.classList.remove(lpClassName.elFullScreen);
1148 document.documentElement.classList.remove('lp-full-screen-active');
1149 window.scrollTo(0, lastScrollY);
1150 } else {
1151 lastScrollY = window.scrollY;
1152 elTarget.classList.add(lpClassName.elFullScreen);
1153 document.documentElement.classList.add('lp-full-screen-active');
1154 }
1155 if (!isFullscreen) {
1156 if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) {
1157 const closeButton = document.createElement('button');
1158 closeButton.type = 'button';
1159 closeButton.className = lpClassName.elBtnFullScreenClose;
1160 closeButton.setAttribute('aria-label', 'Close');
1161 closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close &times;';
1162 closeButton.addEventListener('click', e => {
1163 e.preventDefault();
1164 lpToggleFullscreenView(elTarget);
1165 });
1166 elTarget.appendChild(closeButton);
1167 }
1168 } else {
1169 const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`);
1170 if (closeButton) {
1171 closeButton.remove();
1172 }
1173 }
1174 };
1175 eventHandlers('click', [{
1176 selector: lpClassName.elBtnFullScreen,
1177 callBack: args => {
1178 const {
1179 e,
1180 target
1181 } = args;
1182 const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen);
1183 if (!elBtnFullScreen) {
1184 console.log('No full screen button found');
1185 return;
1186 }
1187 e.preventDefault();
1188 let elTarget = null;
1189 const targetSelector = elBtnFullScreen.dataset.targetFullscreen;
1190 console.log(targetSelector);
1191 if (targetSelector) {
1192 elTarget = document.querySelector(targetSelector);
1193 }
1194 if (!elTarget) {
1195 console.log('No target element found');
1196 return;
1197 }
1198 lpToggleFullscreenView(elTarget, elBtnFullScreen);
1199 }
1200 }]);
1201 };
1202
1203 /***/ },
1204
1205 /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"
1206 /*!*****************************************************************************************!*\
1207 !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***!
1208 \*****************************************************************************************/
1209 (module, __webpack_exports__, __webpack_require__) {
1210
1211 "use strict";
1212 __webpack_require__.r(__webpack_exports__);
1213 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1214 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1215 /* harmony export */ });
1216 /* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js");
1217 /* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
1218 /* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");
1219 /* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
1220 // Imports
1221
1222
1223 var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
1224 // Module
1225 ___CSS_LOADER_EXPORT___.push([module.id, `/*!
1226 * Toastify js 1.12.0
1227 * https://github.com/apvarun/toastify-js
1228 * @license MIT licensed
1229 *
1230 * Copyright (C) 2018 Varun A P
1231 */
1232
1233 .toastify {
1234 padding: 12px 20px;
1235 color: #ffffff;
1236 display: inline-block;
1237 box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
1238 background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
1239 background: linear-gradient(135deg, #73a5ff, #5477f5);
1240 position: fixed;
1241 opacity: 0;
1242 transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
1243 border-radius: 2px;
1244 cursor: pointer;
1245 text-decoration: none;
1246 max-width: calc(50% - 20px);
1247 z-index: 2147483647;
1248 }
1249
1250 .toastify.on {
1251 opacity: 1;
1252 }
1253
1254 .toast-close {
1255 background: transparent;
1256 border: 0;
1257 color: white;
1258 cursor: pointer;
1259 font-family: inherit;
1260 font-size: 1em;
1261 opacity: 0.4;
1262 padding: 0 5px;
1263 }
1264
1265 .toastify-right {
1266 right: 15px;
1267 }
1268
1269 .toastify-left {
1270 left: 15px;
1271 }
1272
1273 .toastify-top {
1274 top: -150px;
1275 }
1276
1277 .toastify-bottom {
1278 bottom: -150px;
1279 }
1280
1281 .toastify-rounded {
1282 border-radius: 25px;
1283 }
1284
1285 .toastify-avatar {
1286 width: 1.5em;
1287 height: 1.5em;
1288 margin: -7px 5px;
1289 border-radius: 2px;
1290 }
1291
1292 .toastify-center {
1293 margin-left: auto;
1294 margin-right: auto;
1295 left: 0;
1296 right: 0;
1297 max-width: fit-content;
1298 max-width: -moz-fit-content;
1299 }
1300
1301 @media only screen and (max-width: 360px) {
1302 .toastify-right, .toastify-left {
1303 margin-left: auto;
1304 margin-right: auto;
1305 left: 0;
1306 right: 0;
1307 max-width: fit-content;
1308 }
1309 }
1310 `, "",{"version":3,"sources":["webpack://./node_modules/toastify-js/src/toastify.css"],"names":[],"mappings":"AAAA;;;;;;EAME;;AAEF;IACI,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,uFAAuF;IACvF,6DAA6D;IAC7D,qDAAqD;IACrD,eAAe;IACf,UAAU;IACV,wDAAwD;IACxD,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,mBAAmB;AACvB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,SAAS;IACT,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,YAAY;IACZ,cAAc;AAClB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,sBAAsB;IACtB,2BAA2B;AAC/B;;AAEA;IACI;QACI,iBAAiB;QACjB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,sBAAsB;IAC1B;AACJ","sourcesContent":["/*!\n * Toastify js 1.12.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n.toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n}\n\n.toastify.on {\n opacity: 1;\n}\n\n.toast-close {\n background: transparent;\n border: 0;\n color: white;\n cursor: pointer;\n font-family: inherit;\n font-size: 1em;\n opacity: 0.4;\n padding: 0 5px;\n}\n\n.toastify-right {\n right: 15px;\n}\n\n.toastify-left {\n left: 15px;\n}\n\n.toastify-top {\n top: -150px;\n}\n\n.toastify-bottom {\n bottom: -150px;\n}\n\n.toastify-rounded {\n border-radius: 25px;\n}\n\n.toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: -7px 5px;\n border-radius: 2px;\n}\n\n.toastify-center {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n max-width: -moz-fit-content;\n}\n\n@media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n}\n"],"sourceRoot":""}]);
1311 // Exports
1312 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
1313
1314
1315 /***/ },
1316
1317 /***/ "./node_modules/css-loader/dist/runtime/api.js"
1318 /*!*****************************************************!*\
1319 !*** ./node_modules/css-loader/dist/runtime/api.js ***!
1320 \*****************************************************/
1321 (module) {
1322
1323 "use strict";
1324
1325
1326 /*
1327 MIT License http://www.opensource.org/licenses/mit-license.php
1328 Author Tobias Koppers @sokra
1329 */
1330 module.exports = function (cssWithMappingToString) {
1331 var list = [];
1332
1333 // return the list of modules as css string
1334 list.toString = function toString() {
1335 return this.map(function (item) {
1336 var content = "";
1337 var needLayer = typeof item[5] !== "undefined";
1338 if (item[4]) {
1339 content += "@supports (".concat(item[4], ") {");
1340 }
1341 if (item[2]) {
1342 content += "@media ".concat(item[2], " {");
1343 }
1344 if (needLayer) {
1345 content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
1346 }
1347 content += cssWithMappingToString(item);
1348 if (needLayer) {
1349 content += "}";
1350 }
1351 if (item[2]) {
1352 content += "}";
1353 }
1354 if (item[4]) {
1355 content += "}";
1356 }
1357 return content;
1358 }).join("");
1359 };
1360
1361 // import a list of modules into the list
1362 list.i = function i(modules, media, dedupe, supports, layer) {
1363 if (typeof modules === "string") {
1364 modules = [[null, modules, undefined]];
1365 }
1366 var alreadyImportedModules = {};
1367 if (dedupe) {
1368 for (var k = 0; k < this.length; k++) {
1369 var id = this[k][0];
1370 if (id != null) {
1371 alreadyImportedModules[id] = true;
1372 }
1373 }
1374 }
1375 for (var _k = 0; _k < modules.length; _k++) {
1376 var item = [].concat(modules[_k]);
1377 if (dedupe && alreadyImportedModules[item[0]]) {
1378 continue;
1379 }
1380 if (typeof layer !== "undefined") {
1381 if (typeof item[5] === "undefined") {
1382 item[5] = layer;
1383 } else {
1384 item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
1385 item[5] = layer;
1386 }
1387 }
1388 if (media) {
1389 if (!item[2]) {
1390 item[2] = media;
1391 } else {
1392 item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
1393 item[2] = media;
1394 }
1395 }
1396 if (supports) {
1397 if (!item[4]) {
1398 item[4] = "".concat(supports);
1399 } else {
1400 item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
1401 item[4] = supports;
1402 }
1403 }
1404 list.push(item);
1405 }
1406 };
1407 return list;
1408 };
1409
1410 /***/ },
1411
1412 /***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js"
1413 /*!************************************************************!*\
1414 !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***!
1415 \************************************************************/
1416 (module) {
1417
1418 "use strict";
1419
1420
1421 module.exports = function (item) {
1422 var content = item[1];
1423 var cssMapping = item[3];
1424 if (!cssMapping) {
1425 return content;
1426 }
1427 if (typeof btoa === "function") {
1428 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
1429 var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
1430 var sourceMapping = "/*# ".concat(data, " */");
1431 return [content].concat([sourceMapping]).join("\n");
1432 }
1433 return [content].join("\n");
1434 };
1435
1436 /***/ },
1437
1438 /***/ "./node_modules/toastify-js/src/toastify.css"
1439 /*!***************************************************!*\
1440 !*** ./node_modules/toastify-js/src/toastify.css ***!
1441 \***************************************************/
1442 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1443
1444 "use strict";
1445 __webpack_require__.r(__webpack_exports__);
1446 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1447 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1448 /* harmony export */ });
1449 /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
1450 /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);
1451 /* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js");
1452 /* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);
1453 /* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js");
1454 /* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);
1455 /* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js");
1456 /* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);
1457 /* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js");
1458 /* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);
1459 /* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js");
1460 /* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);
1461 /* harmony import */ var _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js!./toastify.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css");
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473 var options = {};
1474
1475 options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());
1476 options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());
1477
1478 options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head");
1479
1480 options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());
1481 options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());
1482
1483 var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"], options);
1484
1485
1486
1487
1488 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined);
1489
1490
1491 /***/ },
1492
1493 /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"
1494 /*!****************************************************************************!*\
1495 !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
1496 \****************************************************************************/
1497 (module) {
1498
1499 "use strict";
1500
1501
1502 var stylesInDOM = [];
1503 function getIndexByIdentifier(identifier) {
1504 var result = -1;
1505 for (var i = 0; i < stylesInDOM.length; i++) {
1506 if (stylesInDOM[i].identifier === identifier) {
1507 result = i;
1508 break;
1509 }
1510 }
1511 return result;
1512 }
1513 function modulesToDom(list, options) {
1514 var idCountMap = {};
1515 var identifiers = [];
1516 for (var i = 0; i < list.length; i++) {
1517 var item = list[i];
1518 var id = options.base ? item[0] + options.base : item[0];
1519 var count = idCountMap[id] || 0;
1520 var identifier = "".concat(id, " ").concat(count);
1521 idCountMap[id] = count + 1;
1522 var indexByIdentifier = getIndexByIdentifier(identifier);
1523 var obj = {
1524 css: item[1],
1525 media: item[2],
1526 sourceMap: item[3],
1527 supports: item[4],
1528 layer: item[5]
1529 };
1530 if (indexByIdentifier !== -1) {
1531 stylesInDOM[indexByIdentifier].references++;
1532 stylesInDOM[indexByIdentifier].updater(obj);
1533 } else {
1534 var updater = addElementStyle(obj, options);
1535 options.byIndex = i;
1536 stylesInDOM.splice(i, 0, {
1537 identifier: identifier,
1538 updater: updater,
1539 references: 1
1540 });
1541 }
1542 identifiers.push(identifier);
1543 }
1544 return identifiers;
1545 }
1546 function addElementStyle(obj, options) {
1547 var api = options.domAPI(options);
1548 api.update(obj);
1549 var updater = function updater(newObj) {
1550 if (newObj) {
1551 if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
1552 return;
1553 }
1554 api.update(obj = newObj);
1555 } else {
1556 api.remove();
1557 }
1558 };
1559 return updater;
1560 }
1561 module.exports = function (list, options) {
1562 options = options || {};
1563 list = list || [];
1564 var lastIdentifiers = modulesToDom(list, options);
1565 return function update(newList) {
1566 newList = newList || [];
1567 for (var i = 0; i < lastIdentifiers.length; i++) {
1568 var identifier = lastIdentifiers[i];
1569 var index = getIndexByIdentifier(identifier);
1570 stylesInDOM[index].references--;
1571 }
1572 var newLastIdentifiers = modulesToDom(newList, options);
1573 for (var _i = 0; _i < lastIdentifiers.length; _i++) {
1574 var _identifier = lastIdentifiers[_i];
1575 var _index = getIndexByIdentifier(_identifier);
1576 if (stylesInDOM[_index].references === 0) {
1577 stylesInDOM[_index].updater();
1578 stylesInDOM.splice(_index, 1);
1579 }
1580 }
1581 lastIdentifiers = newLastIdentifiers;
1582 };
1583 };
1584
1585 /***/ },
1586
1587 /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js"
1588 /*!********************************************************************!*\
1589 !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
1590 \********************************************************************/
1591 (module) {
1592
1593 "use strict";
1594
1595
1596 var memo = {};
1597
1598 /* istanbul ignore next */
1599 function getTarget(target) {
1600 if (typeof memo[target] === "undefined") {
1601 var styleTarget = document.querySelector(target);
1602
1603 // Special case to return head of iframe instead of iframe itself
1604 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
1605 try {
1606 // This will throw an exception if access to iframe is blocked
1607 // due to cross-origin restrictions
1608 styleTarget = styleTarget.contentDocument.head;
1609 } catch (e) {
1610 // istanbul ignore next
1611 styleTarget = null;
1612 }
1613 }
1614 memo[target] = styleTarget;
1615 }
1616 return memo[target];
1617 }
1618
1619 /* istanbul ignore next */
1620 function insertBySelector(insert, style) {
1621 var target = getTarget(insert);
1622 if (!target) {
1623 throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
1624 }
1625 target.appendChild(style);
1626 }
1627 module.exports = insertBySelector;
1628
1629 /***/ },
1630
1631 /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"
1632 /*!**********************************************************************!*\
1633 !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
1634 \**********************************************************************/
1635 (module) {
1636
1637 "use strict";
1638
1639
1640 /* istanbul ignore next */
1641 function insertStyleElement(options) {
1642 var element = document.createElement("style");
1643 options.setAttributes(element, options.attributes);
1644 options.insert(element, options.options);
1645 return element;
1646 }
1647 module.exports = insertStyleElement;
1648
1649 /***/ },
1650
1651 /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"
1652 /*!**********************************************************************************!*\
1653 !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
1654 \**********************************************************************************/
1655 (module, __unused_webpack_exports, __webpack_require__) {
1656
1657 "use strict";
1658
1659
1660 /* istanbul ignore next */
1661 function setAttributesWithoutAttributes(styleElement) {
1662 var nonce = true ? __webpack_require__.nc : 0;
1663 if (nonce) {
1664 styleElement.setAttribute("nonce", nonce);
1665 }
1666 }
1667 module.exports = setAttributesWithoutAttributes;
1668
1669 /***/ },
1670
1671 /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"
1672 /*!***************************************************************!*\
1673 !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
1674 \***************************************************************/
1675 (module) {
1676
1677 "use strict";
1678
1679
1680 /* istanbul ignore next */
1681 function apply(styleElement, options, obj) {
1682 var css = "";
1683 if (obj.supports) {
1684 css += "@supports (".concat(obj.supports, ") {");
1685 }
1686 if (obj.media) {
1687 css += "@media ".concat(obj.media, " {");
1688 }
1689 var needLayer = typeof obj.layer !== "undefined";
1690 if (needLayer) {
1691 css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
1692 }
1693 css += obj.css;
1694 if (needLayer) {
1695 css += "}";
1696 }
1697 if (obj.media) {
1698 css += "}";
1699 }
1700 if (obj.supports) {
1701 css += "}";
1702 }
1703 var sourceMap = obj.sourceMap;
1704 if (sourceMap && typeof btoa !== "undefined") {
1705 css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
1706 }
1707
1708 // For old IE
1709 /* istanbul ignore if */
1710 options.styleTagTransform(css, styleElement, options.options);
1711 }
1712 function removeStyleElement(styleElement) {
1713 // istanbul ignore if
1714 if (styleElement.parentNode === null) {
1715 return false;
1716 }
1717 styleElement.parentNode.removeChild(styleElement);
1718 }
1719
1720 /* istanbul ignore next */
1721 function domAPI(options) {
1722 if (typeof document === "undefined") {
1723 return {
1724 update: function update() {},
1725 remove: function remove() {}
1726 };
1727 }
1728 var styleElement = options.insertStyleElement(options);
1729 return {
1730 update: function update(obj) {
1731 apply(styleElement, options, obj);
1732 },
1733 remove: function remove() {
1734 removeStyleElement(styleElement);
1735 }
1736 };
1737 }
1738 module.exports = domAPI;
1739
1740 /***/ },
1741
1742 /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"
1743 /*!*********************************************************************!*\
1744 !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
1745 \*********************************************************************/
1746 (module) {
1747
1748 "use strict";
1749
1750
1751 /* istanbul ignore next */
1752 function styleTagTransform(css, styleElement) {
1753 if (styleElement.styleSheet) {
1754 styleElement.styleSheet.cssText = css;
1755 } else {
1756 while (styleElement.firstChild) {
1757 styleElement.removeChild(styleElement.firstChild);
1758 }
1759 styleElement.appendChild(document.createTextNode(css));
1760 }
1761 }
1762 module.exports = styleTagTransform;
1763
1764 /***/ },
1765
1766 /***/ "./node_modules/sweetalert2/dist/sweetalert2.all.js"
1767 /*!**********************************************************!*\
1768 !*** ./node_modules/sweetalert2/dist/sweetalert2.all.js ***!
1769 \**********************************************************/
1770 (module) {
1771
1772 /*!
1773 * sweetalert2 v11.26.25
1774 * Released under the MIT License.
1775 */
1776 (function (global, factory) {
1777 true ? module.exports = factory() :
1778 0;
1779 })(this, (function () { 'use strict';
1780
1781 function _assertClassBrand(e, t, n) {
1782 if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
1783 throw new TypeError("Private element is not present on this object");
1784 }
1785 function _checkPrivateRedeclaration(e, t) {
1786 if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1787 }
1788 function _classPrivateFieldGet2(s, a) {
1789 return s.get(_assertClassBrand(s, a));
1790 }
1791 function _classPrivateFieldInitSpec(e, t, a) {
1792 _checkPrivateRedeclaration(e, t), t.set(e, a);
1793 }
1794 function _classPrivateFieldSet2(s, a, r) {
1795 return s.set(_assertClassBrand(s, a), r), r;
1796 }
1797
1798 const RESTORE_FOCUS_TIMEOUT = 100;
1799
1800 /** @type {GlobalState} */
1801 const globalState = {};
1802 const focusPreviousActiveElement = () => {
1803 if (globalState.previousActiveElement instanceof HTMLElement) {
1804 globalState.previousActiveElement.focus();
1805 globalState.previousActiveElement = null;
1806 } else if (document.body) {
1807 document.body.focus();
1808 }
1809 };
1810
1811 /**
1812 * Restore previous active (focused) element
1813 *
1814 * @param {boolean} returnFocus
1815 * @returns {Promise<void>}
1816 */
1817 const restoreActiveElement = returnFocus => {
1818 return new Promise(resolve => {
1819 if (!returnFocus) {
1820 return resolve();
1821 }
1822 const x = window.scrollX;
1823 const y = window.scrollY;
1824 globalState.restoreFocusTimeout = setTimeout(() => {
1825 focusPreviousActiveElement();
1826 resolve();
1827 }, RESTORE_FOCUS_TIMEOUT); // issues/900
1828
1829 window.scrollTo(x, y);
1830 });
1831 };
1832
1833 const swalPrefix = 'swal2-';
1834
1835 /**
1836 * @typedef {Record<SwalClass, string>} SwalClasses
1837 */
1838
1839 /**
1840 * @typedef {'success' | 'warning' | 'info' | 'question' | 'error'} SwalIcon
1841 * @typedef {Record<SwalIcon, string>} SwalIcons
1842 */
1843
1844 /** @type {SwalClass[]} */
1845 const 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', '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', 'draggable', 'dragging'];
1846 const swalClasses = classNames.reduce((acc, className) => {
1847 acc[className] = swalPrefix + className;
1848 return acc;
1849 }, /** @type {SwalClasses} */{});
1850
1851 /** @type {SwalIcon[]} */
1852 const icons = ['success', 'warning', 'info', 'question', 'error'];
1853 const iconTypes = icons.reduce((acc, icon) => {
1854 acc[icon] = swalPrefix + icon;
1855 return acc;
1856 }, /** @type {SwalIcons} */{});
1857
1858 const consolePrefix = 'SweetAlert2:';
1859
1860 /**
1861 * Capitalize the first letter of a string
1862 *
1863 * @param {string} str
1864 * @returns {string}
1865 */
1866 const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);
1867
1868 /**
1869 * Standardize console warnings
1870 *
1871 * @param {string | string[]} message
1872 */
1873 const warn = message => {
1874 console.warn(`${consolePrefix} ${typeof message === 'object' ? message.join(' ') : message}`);
1875 };
1876
1877 /**
1878 * Standardize console errors
1879 *
1880 * @param {string} message
1881 */
1882 const error = message => {
1883 console.error(`${consolePrefix} ${message}`);
1884 };
1885
1886 /**
1887 * Private global state for `warnOnce`
1888 *
1889 * @type {string[]}
1890 * @private
1891 */
1892 const previousWarnOnceMessages = [];
1893
1894 /**
1895 * Show a console warning, but only if it hasn't already been shown
1896 *
1897 * @param {string} message
1898 */
1899 const warnOnce = message => {
1900 if (!previousWarnOnceMessages.includes(message)) {
1901 previousWarnOnceMessages.push(message);
1902 warn(message);
1903 }
1904 };
1905
1906 /**
1907 * Show a one-time console warning about deprecated params/methods
1908 *
1909 * @param {string} deprecatedParam
1910 * @param {string?} useInstead
1911 */
1912 const warnAboutDeprecation = (deprecatedParam, useInstead = null) => {
1913 warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release.${useInstead ? ` Use "${useInstead}" instead.` : ''}`);
1914 };
1915
1916 /**
1917 * If `arg` is a function, call it (with no arguments or context) and return the result.
1918 * Otherwise, just pass the value through
1919 *
1920 * @param {(() => *) | *} arg
1921 * @returns {*}
1922 */
1923 const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;
1924
1925 /**
1926 * @param {*} arg
1927 * @returns {boolean}
1928 */
1929 const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';
1930
1931 /**
1932 * @param {*} arg
1933 * @returns {Promise<*>}
1934 */
1935 const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);
1936
1937 /**
1938 * @param {*} arg
1939 * @returns {boolean}
1940 */
1941 const isPromise = arg => arg && Promise.resolve(arg) === arg;
1942
1943 /**
1944 * @returns {boolean}
1945 */
1946 const isFirefox = () => navigator.userAgent.includes('Firefox');
1947
1948 /**
1949 * Gets the popup container which contains the backdrop and the popup itself.
1950 *
1951 * @returns {HTMLElement | null}
1952 */
1953 const getContainer = () => document.body.querySelector(`.${swalClasses.container}`);
1954
1955 /**
1956 * @param {string} selectorString
1957 * @returns {HTMLElement | null}
1958 */
1959 const elementBySelector = selectorString => {
1960 const container = getContainer();
1961 return container ? container.querySelector(selectorString) : null;
1962 };
1963
1964 /**
1965 * @param {string} className
1966 * @returns {HTMLElement | null}
1967 */
1968 const elementByClass = className => {
1969 return elementBySelector(`.${className}`);
1970 };
1971
1972 /**
1973 * @returns {HTMLElement | null}
1974 */
1975 const getPopup = () => elementByClass(swalClasses.popup);
1976
1977 /**
1978 * @returns {HTMLElement | null}
1979 */
1980 const getIcon = () => elementByClass(swalClasses.icon);
1981
1982 /**
1983 * @returns {HTMLElement | null}
1984 */
1985 const getIconContent = () => elementByClass(swalClasses['icon-content']);
1986
1987 /**
1988 * @returns {HTMLElement | null}
1989 */
1990 const getTitle = () => elementByClass(swalClasses.title);
1991
1992 /**
1993 * @returns {HTMLElement | null}
1994 */
1995 const getHtmlContainer = () => elementByClass(swalClasses['html-container']);
1996
1997 /**
1998 * @returns {HTMLElement | null}
1999 */
2000 const getImage = () => elementByClass(swalClasses.image);
2001
2002 /**
2003 * @returns {HTMLElement | null}
2004 */
2005 const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);
2006
2007 /**
2008 * @returns {HTMLElement | null}
2009 */
2010 const getValidationMessage = () => elementByClass(swalClasses['validation-message']);
2011
2012 /**
2013 * @returns {HTMLButtonElement | null}
2014 */
2015 const getConfirmButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`));
2016
2017 /**
2018 * @returns {HTMLButtonElement | null}
2019 */
2020 const getCancelButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`));
2021
2022 /**
2023 * @returns {HTMLButtonElement | null}
2024 */
2025 const getDenyButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`));
2026
2027 /**
2028 * @returns {HTMLElement | null}
2029 */
2030 const getInputLabel = () => elementByClass(swalClasses['input-label']);
2031
2032 /**
2033 * @returns {HTMLElement | null}
2034 */
2035 const getLoader = () => elementBySelector(`.${swalClasses.loader}`);
2036
2037 /**
2038 * @returns {HTMLElement | null}
2039 */
2040 const getActions = () => elementByClass(swalClasses.actions);
2041
2042 /**
2043 * @returns {HTMLElement | null}
2044 */
2045 const getFooter = () => elementByClass(swalClasses.footer);
2046
2047 /**
2048 * @returns {HTMLElement | null}
2049 */
2050 const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);
2051
2052 /**
2053 * @returns {HTMLElement | null}
2054 */
2055 const getCloseButton = () => elementByClass(swalClasses.close);
2056
2057 // https://github.com/jkup/focusable/blob/master/index.js
2058 const focusable = `
2059 a[href],
2060 area[href],
2061 input:not([disabled]),
2062 select:not([disabled]),
2063 textarea:not([disabled]),
2064 button:not([disabled]),
2065 iframe,
2066 object,
2067 embed,
2068 [tabindex="0"],
2069 [contenteditable],
2070 audio[controls],
2071 video[controls],
2072 summary
2073 `;
2074 /**
2075 * @returns {HTMLElement[]}
2076 */
2077 const getFocusableElements = () => {
2078 const popup = getPopup();
2079 if (!popup) {
2080 return [];
2081 }
2082 /** @type {NodeListOf<HTMLElement>} */
2083 const focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])');
2084 const focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex)
2085 // sort according to tabindex
2086 .sort((a, b) => {
2087 const tabindexA = parseInt(a.getAttribute('tabindex') || '0');
2088 const tabindexB = parseInt(b.getAttribute('tabindex') || '0');
2089 if (tabindexA > tabindexB) {
2090 return 1;
2091 } else if (tabindexA < tabindexB) {
2092 return -1;
2093 }
2094 return 0;
2095 });
2096
2097 /** @type {NodeListOf<HTMLElement>} */
2098 const otherFocusableElements = popup.querySelectorAll(focusable);
2099 const otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(el => el.getAttribute('tabindex') !== '-1');
2100 return [...new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))].filter(el => isVisible$1(el));
2101 };
2102
2103 /**
2104 * @returns {boolean}
2105 */
2106 const isModal = () => {
2107 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);
2108 };
2109
2110 /**
2111 * @returns {boolean}
2112 */
2113 const isToast = () => {
2114 const popup = getPopup();
2115 if (!popup) {
2116 return false;
2117 }
2118 return hasClass(popup, swalClasses.toast);
2119 };
2120
2121 /**
2122 * @returns {boolean}
2123 */
2124 const isLoading = () => {
2125 const popup = getPopup();
2126 if (!popup) {
2127 return false;
2128 }
2129 return popup.hasAttribute('data-loading');
2130 };
2131
2132 /**
2133 * Securely set innerHTML of an element
2134 * https://github.com/sweetalert2/sweetalert2/issues/1926
2135 *
2136 * @param {HTMLElement} elem
2137 * @param {string} html
2138 */
2139 const setInnerHtml = (elem, html) => {
2140 elem.textContent = '';
2141 if (html) {
2142 const parser = new DOMParser();
2143 const parsed = parser.parseFromString(html, `text/html`);
2144 const head = parsed.querySelector('head');
2145 if (head) {
2146 Array.from(head.childNodes).forEach(child => {
2147 elem.appendChild(child);
2148 });
2149 }
2150 const body = parsed.querySelector('body');
2151 if (body) {
2152 Array.from(body.childNodes).forEach(child => {
2153 if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
2154 elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507
2155 } else {
2156 elem.appendChild(child);
2157 }
2158 });
2159 }
2160 }
2161 };
2162
2163 /**
2164 * @param {HTMLElement} elem
2165 * @param {string} className
2166 * @returns {boolean}
2167 */
2168 const hasClass = (elem, className) => {
2169 if (!className) {
2170 return false;
2171 }
2172 return className.split(/\s+/).every(cls => elem.classList.contains(cls));
2173 };
2174
2175 /**
2176 * @param {HTMLElement} elem
2177 * @param {SweetAlertOptions} params
2178 */
2179 const removeCustomClasses = (elem, params) => {
2180 Array.from(elem.classList).forEach(className => {
2181 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) {
2182 elem.classList.remove(className);
2183 }
2184 });
2185 };
2186
2187 /**
2188 * @param {HTMLElement} elem
2189 * @param {SweetAlertOptions} params
2190 * @param {string} className
2191 */
2192 const applyCustomClass = (elem, params, className) => {
2193 removeCustomClasses(elem, params);
2194 if (!params.customClass) {
2195 return;
2196 }
2197 const customClass = params.customClass[(/** @type {keyof SweetAlertCustomClass} */className)];
2198 if (!customClass) {
2199 return;
2200 }
2201 if (typeof customClass !== 'string' && !customClass.forEach) {
2202 warn(`Invalid type of customClass.${className}! Expected string or iterable object, got "${typeof customClass}"`);
2203 return;
2204 }
2205 addClass(elem, customClass);
2206 };
2207
2208 /**
2209 * @param {HTMLElement} popup
2210 * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass
2211 * @returns {HTMLInputElement | null}
2212 */
2213 const getInput$1 = (popup, inputClass) => {
2214 if (!inputClass) {
2215 return null;
2216 }
2217 switch (inputClass) {
2218 case 'select':
2219 case 'textarea':
2220 case 'file':
2221 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses[inputClass]}`);
2222 case 'checkbox':
2223 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.checkbox} input`);
2224 case 'radio':
2225 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:checked`) || popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:first-child`);
2226 case 'range':
2227 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.range} input`);
2228 default:
2229 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.input}`);
2230 }
2231 };
2232
2233 /**
2234 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input
2235 */
2236 const focusInput = input => {
2237 input.focus();
2238
2239 // place cursor at end of text in text input
2240 if (input.type !== 'file') {
2241 // http://stackoverflow.com/a/2345915
2242 const val = input.value;
2243 input.value = '';
2244 input.value = val;
2245 }
2246 };
2247
2248 /**
2249 * @param {HTMLElement | HTMLElement[] | null} target
2250 * @param {string | string[] | readonly string[] | undefined} classList
2251 * @param {boolean} condition
2252 */
2253 const toggleClass = (target, classList, condition) => {
2254 if (!target || !classList) {
2255 return;
2256 }
2257 const classes = typeof classList === 'string' ? classList.split(/\s+/).filter(Boolean) : classList;
2258 const targets = Array.isArray(target) ? target : [target];
2259 targets.forEach(elem => {
2260 classes.forEach(className => {
2261 if (condition) {
2262 elem.classList.add(className);
2263 } else {
2264 elem.classList.remove(className);
2265 }
2266 });
2267 });
2268 };
2269
2270 /**
2271 * @param {HTMLElement | HTMLElement[] | null} target
2272 * @param {string | string[] | readonly string[] | undefined} classList
2273 */
2274 const addClass = (target, classList) => {
2275 toggleClass(target, classList, true);
2276 };
2277
2278 /**
2279 * @param {HTMLElement | HTMLElement[] | null} target
2280 * @param {string | string[] | readonly string[] | undefined} classList
2281 */
2282 const removeClass = (target, classList) => {
2283 toggleClass(target, classList, false);
2284 };
2285
2286 /**
2287 * Get direct child of an element by class name
2288 *
2289 * @param {HTMLElement} elem
2290 * @param {string} className
2291 * @returns {HTMLElement | undefined}
2292 */
2293 const getDirectChildByClass = (elem, className) => (/** @type {HTMLElement | undefined} */
2294 Array.from(elem.children).find(child => child instanceof HTMLElement && hasClass(child, className)));
2295
2296 /**
2297 * @param {HTMLElement} elem
2298 * @param {string} property
2299 * @param {string | number | null | undefined} value
2300 */
2301 const applyNumericalStyle = (elem, property, value) => {
2302 if (value === `${parseInt(`${value}`)}`) {
2303 value = parseInt(value);
2304 }
2305 if (value || value === 0) {
2306 elem.style.setProperty(property, typeof value === 'number' ? `${value}px` : (/** @type {string} */value));
2307 } else {
2308 elem.style.removeProperty(property);
2309 }
2310 };
2311
2312 /**
2313 * @param {HTMLElement | null} elem
2314 * @param {string} display
2315 */
2316 const show = (elem, display = 'flex') => {
2317 if (!elem) {
2318 return;
2319 }
2320 elem.style.display = display;
2321 };
2322
2323 /**
2324 * @param {HTMLElement | null} elem
2325 */
2326 const hide = elem => {
2327 if (!elem) {
2328 return;
2329 }
2330 elem.style.display = 'none';
2331 };
2332
2333 /**
2334 * @param {HTMLElement | null} elem
2335 * @param {string} display
2336 */
2337 const showWhenInnerHtmlPresent = (elem, display = 'block') => {
2338 if (!elem) {
2339 return;
2340 }
2341 new MutationObserver(() => {
2342 toggle(elem, elem.innerHTML, display);
2343 }).observe(elem, {
2344 childList: true,
2345 subtree: true
2346 });
2347 };
2348
2349 /**
2350 * @param {HTMLElement} parent
2351 * @param {string} selector
2352 * @param {string} property
2353 * @param {string} value
2354 */
2355 const setStyle = (parent, selector, property, value) => {
2356 /** @type {HTMLElement | null} */
2357 const el = parent.querySelector(selector);
2358 if (el) {
2359 el.style.setProperty(property, value);
2360 }
2361 };
2362
2363 /**
2364 * @param {HTMLElement} elem
2365 * @param {boolean | string | null | undefined} condition
2366 * @param {string} display
2367 */
2368 const toggle = (elem, condition, display = 'flex') => {
2369 if (condition) {
2370 show(elem, display);
2371 } else {
2372 hide(elem);
2373 }
2374 };
2375
2376 /**
2377 * borrowed from jquery $(elem).is(':visible') implementation
2378 *
2379 * @param {HTMLElement | null} elem
2380 * @returns {boolean}
2381 */
2382 const isVisible$1 = elem => Boolean(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
2383
2384 /**
2385 * @returns {boolean}
2386 */
2387 const allButtonsAreHidden = () => !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton());
2388
2389 /**
2390 * @param {HTMLElement} elem
2391 * @returns {boolean}
2392 */
2393 const isScrollable = elem => Boolean(elem.scrollHeight > elem.clientHeight);
2394
2395 /**
2396 * @param {HTMLElement} element
2397 * @param {HTMLElement} stopElement
2398 * @returns {boolean}
2399 */
2400 const selfOrParentIsScrollable = (element, stopElement) => {
2401 let parent = /** @type {HTMLElement | null} */element;
2402 while (parent && parent !== stopElement) {
2403 if (isScrollable(parent)) {
2404 return true;
2405 }
2406 parent = parent.parentElement;
2407 }
2408 return false;
2409 };
2410
2411 /**
2412 * borrowed from https://stackoverflow.com/a/46352119
2413 *
2414 * @param {HTMLElement} elem
2415 * @returns {boolean}
2416 */
2417 const hasCssAnimation = elem => {
2418 const style = window.getComputedStyle(elem);
2419 const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
2420 const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
2421 return animDuration > 0 || transDuration > 0;
2422 };
2423
2424 /**
2425 * @param {number} timer
2426 * @param {boolean} reset
2427 */
2428 const animateTimerProgressBar = (timer, reset = false) => {
2429 const timerProgressBar = getTimerProgressBar();
2430 if (!timerProgressBar) {
2431 return;
2432 }
2433 if (isVisible$1(timerProgressBar)) {
2434 if (reset) {
2435 timerProgressBar.style.transition = 'none';
2436 timerProgressBar.style.width = '100%';
2437 }
2438 setTimeout(() => {
2439 timerProgressBar.style.transition = `width ${timer / 1000}s linear`;
2440 timerProgressBar.style.width = '0%';
2441 }, 10);
2442 }
2443 };
2444 const stopTimerProgressBar = () => {
2445 const timerProgressBar = getTimerProgressBar();
2446 if (!timerProgressBar) {
2447 return;
2448 }
2449 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
2450 timerProgressBar.style.removeProperty('transition');
2451 timerProgressBar.style.width = '100%';
2452 const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
2453 const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;
2454 timerProgressBar.style.width = `${timerProgressBarPercent}%`;
2455 };
2456
2457 /**
2458 * Detect Node env
2459 *
2460 * @returns {boolean}
2461 */
2462 const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';
2463
2464 const sweetHTML = `
2465 <div aria-labelledby="${swalClasses.title}" aria-describedby="${swalClasses['html-container']}" class="${swalClasses.popup}" tabindex="-1">
2466 <button type="button" class="${swalClasses.close}"></button>
2467 <ul class="${swalClasses['progress-steps']}"></ul>
2468 <div class="${swalClasses.icon}"></div>
2469 <img class="${swalClasses.image}" />
2470 <h2 class="${swalClasses.title}" id="${swalClasses.title}"></h2>
2471 <div class="${swalClasses['html-container']}" id="${swalClasses['html-container']}"></div>
2472 <input class="${swalClasses.input}" id="${swalClasses.input}" />
2473 <input type="file" class="${swalClasses.file}" />
2474 <div class="${swalClasses.range}">
2475 <input type="range" />
2476 <output></output>
2477 </div>
2478 <select class="${swalClasses.select}" id="${swalClasses.select}"></select>
2479 <div class="${swalClasses.radio}"></div>
2480 <label class="${swalClasses.checkbox}">
2481 <input type="checkbox" id="${swalClasses.checkbox}" />
2482 <span class="${swalClasses.label}"></span>
2483 </label>
2484 <textarea class="${swalClasses.textarea}" id="${swalClasses.textarea}"></textarea>
2485 <div class="${swalClasses['validation-message']}" id="${swalClasses['validation-message']}"></div>
2486 <div class="${swalClasses.actions}">
2487 <div class="${swalClasses.loader}"></div>
2488 <button type="button" class="${swalClasses.confirm}"></button>
2489 <button type="button" class="${swalClasses.deny}"></button>
2490 <button type="button" class="${swalClasses.cancel}"></button>
2491 </div>
2492 <div class="${swalClasses.footer}"></div>
2493 <div class="${swalClasses['timer-progress-bar-container']}">
2494 <div class="${swalClasses['timer-progress-bar']}"></div>
2495 </div>
2496 </div>
2497 `.replace(/(^|\n)\s*/g, '');
2498
2499 /**
2500 * @returns {boolean}
2501 */
2502 const resetOldContainer = () => {
2503 const oldContainer = getContainer();
2504 if (!oldContainer) {
2505 return false;
2506 }
2507 oldContainer.remove();
2508 removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'],
2509 // @ts-ignore: 'has-column' is not defined in swalClasses but may be set dynamically
2510 swalClasses['has-column']]);
2511 return true;
2512 };
2513 const resetValidationMessage$1 = () => {
2514 if (globalState.currentInstance) {
2515 globalState.currentInstance.resetValidationMessage();
2516 }
2517 };
2518 const addInputChangeListeners = () => {
2519 const popup = getPopup();
2520 if (!popup) {
2521 return;
2522 }
2523 const input = getDirectChildByClass(popup, swalClasses.input);
2524 const file = getDirectChildByClass(popup, swalClasses.file);
2525 /** @type {HTMLInputElement | null} */
2526 const range = popup.querySelector(`.${swalClasses.range} input`);
2527 /** @type {HTMLOutputElement | null} */
2528 const rangeOutput = popup.querySelector(`.${swalClasses.range} output`);
2529 const select = getDirectChildByClass(popup, swalClasses.select);
2530 /** @type {HTMLInputElement | null} */
2531 const checkbox = popup.querySelector(`.${swalClasses.checkbox} input`);
2532 const textarea = getDirectChildByClass(popup, swalClasses.textarea);
2533 if (input) {
2534 input.oninput = resetValidationMessage$1;
2535 }
2536 if (file) {
2537 file.onchange = resetValidationMessage$1;
2538 }
2539 if (select) {
2540 select.onchange = resetValidationMessage$1;
2541 }
2542 if (checkbox) {
2543 checkbox.onchange = resetValidationMessage$1;
2544 }
2545 if (textarea) {
2546 textarea.oninput = resetValidationMessage$1;
2547 }
2548 if (range && rangeOutput) {
2549 range.oninput = () => {
2550 resetValidationMessage$1();
2551 rangeOutput.value = range.value;
2552 };
2553 range.onchange = () => {
2554 resetValidationMessage$1();
2555 rangeOutput.value = range.value;
2556 };
2557 }
2558 };
2559
2560 /**
2561 * @param {string | HTMLElement} target
2562 * @returns {HTMLElement}
2563 */
2564 const getTarget = target => {
2565 if (typeof target === 'string') {
2566 const element = document.querySelector(target);
2567 if (!element) {
2568 throw new Error(`Target element "${target}" not found`);
2569 }
2570 return /** @type {HTMLElement} */element;
2571 }
2572 return target;
2573 };
2574
2575 /**
2576 * @param {SweetAlertOptions} params
2577 */
2578 const setupAccessibility = params => {
2579 const popup = getPopup();
2580 if (!popup) {
2581 return;
2582 }
2583 popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
2584 popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
2585 if (!params.toast) {
2586 popup.setAttribute('aria-modal', 'true');
2587 }
2588 };
2589
2590 /**
2591 * @param {HTMLElement} targetElement
2592 */
2593 const setupRTL = targetElement => {
2594 if (window.getComputedStyle(targetElement).direction === 'rtl') {
2595 addClass(getContainer(), swalClasses.rtl);
2596 globalState.isRTL = true;
2597 }
2598 };
2599
2600 /**
2601 * Add modal + backdrop to DOM
2602 *
2603 * @param {SweetAlertOptions} params
2604 */
2605 const init = params => {
2606 // Clean up the old popup container if it exists
2607 const oldContainerExisted = resetOldContainer();
2608 if (isNodeEnv()) {
2609 error('SweetAlert2 requires document to initialize');
2610 return;
2611 }
2612 const container = document.createElement('div');
2613 container.className = swalClasses.container;
2614 if (oldContainerExisted) {
2615 addClass(container, swalClasses['no-transition']);
2616 }
2617 setInnerHtml(container, sweetHTML);
2618 container.dataset['swal2Theme'] = params.theme;
2619 const targetElement = getTarget(params.target || 'body');
2620 targetElement.appendChild(container);
2621 if (params.topLayer) {
2622 container.setAttribute('popover', '');
2623 container.showPopover();
2624 }
2625 setupAccessibility(params);
2626 setupRTL(targetElement);
2627 addInputChangeListeners();
2628 };
2629
2630 /**
2631 * @param {HTMLElement | object | string} param
2632 * @param {HTMLElement} target
2633 */
2634 const parseHtmlToContainer = (param, target) => {
2635 // DOM element
2636 if (param instanceof HTMLElement) {
2637 target.appendChild(param);
2638 }
2639
2640 // Object
2641 else if (typeof param === 'object') {
2642 handleObject(param, target);
2643 }
2644
2645 // Plain string
2646 else if (param) {
2647 setInnerHtml(target, param);
2648 }
2649 };
2650
2651 /**
2652 * @param {object} param
2653 * @param {HTMLElement} target
2654 */
2655 const handleObject = (param, target) => {
2656 // JQuery element(s)
2657 if ('jquery' in param) {
2658 handleJqueryElem(target, param);
2659 }
2660
2661 // For other objects use their string representation
2662 else {
2663 setInnerHtml(target, param.toString());
2664 }
2665 };
2666
2667 /**
2668 * @param {HTMLElement} target
2669 * @param {any} elem
2670 */
2671 const handleJqueryElem = (target, elem) => {
2672 target.textContent = '';
2673 if (0 in elem) {
2674 for (let i = 0; i in elem; i++) {
2675 target.appendChild(elem[i].cloneNode(true));
2676 }
2677 } else {
2678 target.appendChild(elem.cloneNode(true));
2679 }
2680 };
2681
2682 /**
2683 * @param {SweetAlert} instance
2684 * @param {SweetAlertOptions} params
2685 */
2686 const renderActions = (instance, params) => {
2687 const actions = getActions();
2688 const loader = getLoader();
2689 if (!actions || !loader) {
2690 return;
2691 }
2692
2693 // Actions (buttons) wrapper
2694 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {
2695 hide(actions);
2696 } else {
2697 show(actions);
2698 }
2699
2700 // Custom class
2701 applyCustomClass(actions, params, 'actions');
2702
2703 // Render all the buttons
2704 renderButtons(actions, loader, params);
2705
2706 // Loader
2707 setInnerHtml(loader, params.loaderHtml || '');
2708 applyCustomClass(loader, params, 'loader');
2709 };
2710
2711 /**
2712 * @param {HTMLElement} actions
2713 * @param {HTMLElement} loader
2714 * @param {SweetAlertOptions} params
2715 */
2716 function renderButtons(actions, loader, params) {
2717 const confirmButton = getConfirmButton();
2718 const denyButton = getDenyButton();
2719 const cancelButton = getCancelButton();
2720 if (!confirmButton || !denyButton || !cancelButton) {
2721 return;
2722 }
2723
2724 // Render buttons
2725 renderButton(confirmButton, 'confirm', params);
2726 renderButton(denyButton, 'deny', params);
2727 renderButton(cancelButton, 'cancel', params);
2728 handleButtonsStyling(confirmButton, denyButton, cancelButton, params);
2729 if (params.reverseButtons) {
2730 if (params.toast) {
2731 actions.insertBefore(cancelButton, confirmButton);
2732 actions.insertBefore(denyButton, confirmButton);
2733 } else {
2734 actions.insertBefore(cancelButton, loader);
2735 actions.insertBefore(denyButton, loader);
2736 actions.insertBefore(confirmButton, loader);
2737 }
2738 }
2739 }
2740
2741 /**
2742 * @param {HTMLElement} confirmButton
2743 * @param {HTMLElement} denyButton
2744 * @param {HTMLElement} cancelButton
2745 * @param {SweetAlertOptions} params
2746 */
2747 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {
2748 if (!params.buttonsStyling) {
2749 removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);
2750 return;
2751 }
2752 addClass([confirmButton, denyButton, cancelButton], swalClasses.styled);
2753
2754 // Apply custom background colors and outline colors to action buttons
2755 /** @type {[HTMLElement, string, string | undefined][]} */
2756 const buttons = [[confirmButton, 'confirm', params.confirmButtonColor], [denyButton, 'deny', params.denyButtonColor], [cancelButton, 'cancel', params.cancelButtonColor]];
2757 buttons.forEach(([button, type, color]) => {
2758 if (color) {
2759 button.style.setProperty(`--swal2-${type}-button-background-color`, color);
2760 }
2761 applyOutlineColor(button);
2762 });
2763 }
2764
2765 /**
2766 * @param {HTMLElement} button
2767 */
2768 function applyOutlineColor(button) {
2769 const buttonStyle = window.getComputedStyle(button);
2770 if (buttonStyle.getPropertyValue('--swal2-action-button-focus-box-shadow')) {
2771 // If the button already has a custom outline color, no need to change it
2772 return;
2773 }
2774 const outlineColor = buttonStyle.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/, 'rgba($1, $2, $3, 0.5)');
2775 button.style.setProperty('--swal2-action-button-focus-box-shadow', buttonStyle.getPropertyValue('--swal2-outline').replace(/ rgba\(.*/, ` ${outlineColor}`));
2776 }
2777
2778 /**
2779 * @param {HTMLElement} button
2780 * @param {'confirm' | 'deny' | 'cancel'} buttonType
2781 * @param {SweetAlertOptions} params
2782 */
2783 function renderButton(button, buttonType, params) {
2784 const buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType);
2785 toggle(button, params[`show${buttonName}Button`], 'inline-block');
2786 setInnerHtml(button, params[`${buttonType}ButtonText`] || ''); // Set caption text
2787 button.setAttribute('aria-label', params[`${buttonType}ButtonAriaLabel`] || ''); // ARIA label
2788
2789 // Add buttons custom classes
2790 button.className = swalClasses[buttonType];
2791 applyCustomClass(button, params, `${buttonType}Button`);
2792 }
2793
2794 /**
2795 * @param {SweetAlert} instance
2796 * @param {SweetAlertOptions} params
2797 */
2798 const renderCloseButton = (instance, params) => {
2799 const closeButton = getCloseButton();
2800 if (!closeButton) {
2801 return;
2802 }
2803 setInnerHtml(closeButton, params.closeButtonHtml || '');
2804
2805 // Custom class
2806 applyCustomClass(closeButton, params, 'closeButton');
2807 toggle(closeButton, params.showCloseButton);
2808 closeButton.setAttribute('aria-label', params.closeButtonAriaLabel || '');
2809 };
2810
2811 /**
2812 * @param {SweetAlert} instance
2813 * @param {SweetAlertOptions} params
2814 */
2815 const renderContainer = (instance, params) => {
2816 const container = getContainer();
2817 if (!container) {
2818 return;
2819 }
2820 handleBackdropParam(container, params.backdrop);
2821 handlePositionParam(container, params.position);
2822 handleGrowParam(container, params.grow);
2823
2824 // Custom class
2825 applyCustomClass(container, params, 'container');
2826 };
2827
2828 /**
2829 * @param {HTMLElement} container
2830 * @param {SweetAlertOptions['backdrop']} backdrop
2831 */
2832 function handleBackdropParam(container, backdrop) {
2833 if (typeof backdrop === 'string') {
2834 container.style.background = backdrop;
2835 } else if (!backdrop) {
2836 addClass([document.documentElement, document.body], swalClasses['no-backdrop']);
2837 }
2838 }
2839
2840 /**
2841 * @param {HTMLElement} container
2842 * @param {SweetAlertOptions['position']} position
2843 */
2844 function handlePositionParam(container, position) {
2845 if (!position) {
2846 return;
2847 }
2848 if (position in swalClasses) {
2849 addClass(container, swalClasses[position]);
2850 } else {
2851 warn('The "position" parameter is not valid, defaulting to "center"');
2852 addClass(container, swalClasses.center);
2853 }
2854 }
2855
2856 /**
2857 * @param {HTMLElement} container
2858 * @param {SweetAlertOptions['grow']} grow
2859 */
2860 function handleGrowParam(container, grow) {
2861 if (!grow) {
2862 return;
2863 }
2864 addClass(container, swalClasses[`grow-${grow}`]);
2865 }
2866
2867 /**
2868 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
2869 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
2870 * This is the approach that Babel will probably take to implement private methods/fields
2871 * https://github.com/tc39/proposal-private-methods
2872 * https://github.com/babel/babel/pull/7555
2873 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
2874 * then we can use that language feature.
2875 */
2876
2877 var privateProps = {
2878 innerParams: new WeakMap(),
2879 domCache: new WeakMap(),
2880 focusedElement: new WeakMap()
2881 };
2882
2883 /// <reference path="../../../../sweetalert2.d.ts"/>
2884
2885
2886 /** @type {InputClass[]} */
2887 const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
2888
2889 /**
2890 * @param {SweetAlert} instance
2891 * @param {SweetAlertOptions} params
2892 */
2893 const renderInput = (instance, params) => {
2894 const popup = getPopup();
2895 if (!popup) {
2896 return;
2897 }
2898 const innerParams = privateProps.innerParams.get(instance);
2899 const rerender = !innerParams || params.input !== innerParams.input;
2900 inputClasses.forEach(inputClass => {
2901 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]);
2902 if (!inputContainer) {
2903 return;
2904 }
2905
2906 // set attributes
2907 setAttributes(inputClass, params.inputAttributes);
2908
2909 // set class
2910 inputContainer.className = swalClasses[inputClass];
2911 if (rerender) {
2912 hide(inputContainer);
2913 }
2914 });
2915 if (params.input) {
2916 if (rerender) {
2917 showInput(params);
2918 }
2919 // set custom class
2920 setCustomClass(params);
2921 }
2922 };
2923
2924 /**
2925 * @param {SweetAlertOptions} params
2926 */
2927 const showInput = params => {
2928 if (!params.input) {
2929 return;
2930 }
2931 if (!renderInputType[params.input]) {
2932 error(`Unexpected type of input! Expected ${Object.keys(renderInputType).join(' | ')}, got "${params.input}"`);
2933 return;
2934 }
2935 const inputContainer = getInputContainer(params.input);
2936 if (!inputContainer) {
2937 return;
2938 }
2939 const input = renderInputType[params.input](inputContainer, params);
2940 show(inputContainer);
2941
2942 // input autofocus
2943 if (params.inputAutoFocus) {
2944 setTimeout(() => {
2945 focusInput(input);
2946 });
2947 }
2948 };
2949
2950 /**
2951 * @param {HTMLInputElement} input
2952 */
2953 const removeAttributes = input => {
2954 for (const {
2955 name
2956 } of Array.from(input.attributes)) {
2957 if (!['id', 'type', 'value', 'style'].includes(name)) {
2958 input.removeAttribute(name);
2959 }
2960 }
2961 };
2962
2963 /**
2964 * @param {InputClass} inputClass
2965 * @param {SweetAlertOptions['inputAttributes']} inputAttributes
2966 */
2967 const setAttributes = (inputClass, inputAttributes) => {
2968 const popup = getPopup();
2969 if (!popup) {
2970 return;
2971 }
2972 const input = getInput$1(popup, inputClass);
2973 if (!input) {
2974 return;
2975 }
2976 removeAttributes(input);
2977 for (const attr in inputAttributes) {
2978 input.setAttribute(attr, inputAttributes[attr]);
2979 }
2980 };
2981
2982 /**
2983 * @param {SweetAlertOptions} params
2984 */
2985 const setCustomClass = params => {
2986 if (!params.input) {
2987 return;
2988 }
2989 const inputContainer = getInputContainer(params.input);
2990 if (inputContainer) {
2991 applyCustomClass(inputContainer, params, 'input');
2992 }
2993 };
2994
2995 /**
2996 * @param {HTMLInputElement | HTMLTextAreaElement} input
2997 * @param {SweetAlertOptions} params
2998 */
2999 const setInputPlaceholder = (input, params) => {
3000 if (!input.placeholder && params.inputPlaceholder) {
3001 input.placeholder = params.inputPlaceholder;
3002 }
3003 };
3004
3005 /**
3006 * @param {Input} input
3007 * @param {Input} prependTo
3008 * @param {SweetAlertOptions} params
3009 */
3010 const setInputLabel = (input, prependTo, params) => {
3011 if (params.inputLabel) {
3012 const label = document.createElement('label');
3013 const labelClass = swalClasses['input-label'];
3014 label.setAttribute('for', input.id);
3015 label.className = labelClass;
3016 if (typeof params.customClass === 'object') {
3017 addClass(label, params.customClass.inputLabel);
3018 }
3019 label.innerText = params.inputLabel;
3020 prependTo.insertAdjacentElement('beforebegin', label);
3021 }
3022 };
3023
3024 /**
3025 * @param {SweetAlertInput} inputType
3026 * @returns {HTMLElement | undefined}
3027 */
3028 const getInputContainer = inputType => {
3029 const popup = getPopup();
3030 if (!popup) {
3031 return;
3032 }
3033 return getDirectChildByClass(popup, swalClasses[(/** @type {SwalClass} */inputType)] || swalClasses.input);
3034 };
3035
3036 /**
3037 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input
3038 * @param {SweetAlertOptions['inputValue']} inputValue
3039 */
3040 const checkAndSetInputValue = (input, inputValue) => {
3041 if (['string', 'number'].includes(typeof inputValue)) {
3042 input.value = `${inputValue}`;
3043 } else if (!isPromise(inputValue)) {
3044 warn(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof inputValue}"`);
3045 }
3046 };
3047
3048 /** @type {Record<SweetAlertInput, (input: Input | HTMLElement, params: SweetAlertOptions) => Input>} */
3049 const renderInputType = {};
3050
3051 /**
3052 * @param {Input | HTMLElement} input
3053 * @param {SweetAlertOptions} params
3054 * @returns {Input}
3055 */
3056 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 = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */
3057 (input, params) => {
3058 // oxfmt-ignore
3059 const inputElement = /** @type {HTMLInputElement} */input;
3060 checkAndSetInputValue(inputElement, params.inputValue);
3061 setInputLabel(inputElement, inputElement, params);
3062 setInputPlaceholder(inputElement, params);
3063 // oxfmt-ignore
3064 inputElement.type = /** @type {string} */params.input;
3065 return inputElement;
3066 };
3067
3068 /**
3069 * @param {Input | HTMLElement} input
3070 * @param {SweetAlertOptions} params
3071 * @returns {Input}
3072 */
3073 renderInputType.file = (input, params) => {
3074 const inputElement = /** @type {HTMLInputElement} */input;
3075 setInputLabel(inputElement, inputElement, params);
3076 setInputPlaceholder(inputElement, params);
3077 return inputElement;
3078 };
3079
3080 /**
3081 * @param {Input | HTMLElement} range
3082 * @param {SweetAlertOptions} params
3083 * @returns {Input}
3084 */
3085 renderInputType.range = (range, params) => {
3086 const rangeContainer = /** @type {HTMLElement} */range;
3087 const rangeInput = rangeContainer.querySelector('input');
3088 const rangeOutput = rangeContainer.querySelector('output');
3089 if (rangeInput) {
3090 checkAndSetInputValue(rangeInput, params.inputValue);
3091 rangeInput.type = /** @type {string} */params.input;
3092 setInputLabel(rangeInput, /** @type {Input} */range, params);
3093 }
3094 if (rangeOutput) {
3095 checkAndSetInputValue(rangeOutput, params.inputValue);
3096 }
3097 return /** @type {Input} */range;
3098 };
3099
3100 /**
3101 * @param {Input | HTMLElement} select
3102 * @param {SweetAlertOptions} params
3103 * @returns {Input}
3104 */
3105 renderInputType.select = (select, params) => {
3106 const selectElement = /** @type {HTMLSelectElement} */select;
3107 selectElement.textContent = '';
3108 if (params.inputPlaceholder) {
3109 const placeholder = document.createElement('option');
3110 setInnerHtml(placeholder, params.inputPlaceholder);
3111 placeholder.value = '';
3112 placeholder.disabled = true;
3113 placeholder.selected = true;
3114 selectElement.appendChild(placeholder);
3115 }
3116 setInputLabel(selectElement, selectElement, params);
3117 return selectElement;
3118 };
3119
3120 /**
3121 * @param {Input | HTMLElement} radio
3122 * @returns {Input}
3123 */
3124 renderInputType.radio = radio => {
3125 const radioElement = /** @type {HTMLElement} */radio;
3126 radioElement.textContent = '';
3127 return /** @type {Input} */radio;
3128 };
3129
3130 /**
3131 * @param {Input | HTMLElement} checkboxContainer
3132 * @param {SweetAlertOptions} params
3133 * @returns {Input}
3134 */
3135 renderInputType.checkbox = (checkboxContainer, params) => {
3136 const popup = getPopup();
3137 if (!popup) {
3138 throw new Error('Popup not found');
3139 }
3140 const checkbox = getInput$1(popup, 'checkbox');
3141 if (!checkbox) {
3142 throw new Error('Checkbox input not found');
3143 }
3144 checkbox.value = '1';
3145 checkbox.checked = Boolean(params.inputValue);
3146 const containerElement = /** @type {HTMLElement} */checkboxContainer;
3147 const label = containerElement.querySelector('span');
3148 if (label) {
3149 const placeholderOrLabel = params.inputPlaceholder || params.inputLabel;
3150 if (placeholderOrLabel) {
3151 setInnerHtml(label, placeholderOrLabel);
3152 }
3153 }
3154 return checkbox;
3155 };
3156
3157 /**
3158 * @param {Input | HTMLElement} textarea
3159 * @param {SweetAlertOptions} params
3160 * @returns {Input}
3161 */
3162 renderInputType.textarea = (textarea, params) => {
3163 const textareaElement = /** @type {HTMLTextAreaElement} */textarea;
3164 checkAndSetInputValue(textareaElement, params.inputValue);
3165 setInputPlaceholder(textareaElement, params);
3166 setInputLabel(textareaElement, textareaElement, params);
3167
3168 /**
3169 * @param {HTMLElement} el
3170 * @returns {number}
3171 */
3172 const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight);
3173
3174 // https://github.com/sweetalert2/sweetalert2/issues/2291
3175 setTimeout(() => {
3176 // https://github.com/sweetalert2/sweetalert2/issues/1699
3177 if ('MutationObserver' in window) {
3178 const popup = getPopup();
3179 if (!popup) {
3180 return;
3181 }
3182 const initialPopupWidth = parseInt(window.getComputedStyle(popup).width);
3183 const textareaResizeHandler = () => {
3184 // check if texarea is still in document (i.e. popup wasn't closed in the meantime)
3185 if (!document.body.contains(textareaElement)) {
3186 return;
3187 }
3188 const textareaWidth = textareaElement.offsetWidth + getMargin(textareaElement);
3189 const popupElement = getPopup();
3190 if (popupElement) {
3191 if (textareaWidth > initialPopupWidth) {
3192 popupElement.style.width = `${textareaWidth}px`;
3193 } else {
3194 applyNumericalStyle(popupElement, 'width', params.width);
3195 }
3196 }
3197 };
3198 new MutationObserver(textareaResizeHandler).observe(textareaElement, {
3199 attributes: true,
3200 attributeFilter: ['style']
3201 });
3202 }
3203 });
3204 return textareaElement;
3205 };
3206
3207 /**
3208 * @param {SweetAlert} instance
3209 * @param {SweetAlertOptions} params
3210 */
3211 const renderContent = (instance, params) => {
3212 const htmlContainer = getHtmlContainer();
3213 if (!htmlContainer) {
3214 return;
3215 }
3216 showWhenInnerHtmlPresent(htmlContainer);
3217 applyCustomClass(htmlContainer, params, 'htmlContainer');
3218
3219 // Content as HTML
3220 if (params.html) {
3221 parseHtmlToContainer(params.html, htmlContainer);
3222 show(htmlContainer, 'block');
3223 }
3224
3225 // Content as plain text
3226 else if (params.text) {
3227 htmlContainer.textContent = params.text;
3228 show(htmlContainer, 'block');
3229 }
3230
3231 // No content
3232 else {
3233 hide(htmlContainer);
3234 }
3235 renderInput(instance, params);
3236 };
3237
3238 /**
3239 * @param {SweetAlert} instance
3240 * @param {SweetAlertOptions} params
3241 */
3242 const renderFooter = (instance, params) => {
3243 const footer = getFooter();
3244 if (!footer) {
3245 return;
3246 }
3247 showWhenInnerHtmlPresent(footer);
3248 toggle(footer, Boolean(params.footer), 'block');
3249 if (params.footer) {
3250 parseHtmlToContainer(params.footer, footer);
3251 }
3252
3253 // Custom class
3254 applyCustomClass(footer, params, 'footer');
3255 };
3256
3257 /**
3258 * @param {SweetAlert} instance
3259 * @param {SweetAlertOptions} params
3260 */
3261 const renderIcon = (instance, params) => {
3262 const innerParams = privateProps.innerParams.get(instance);
3263 const icon = getIcon();
3264 if (!icon) {
3265 return;
3266 }
3267
3268 // if the given icon already rendered, apply the styling without re-rendering the icon
3269 if (innerParams && params.icon === innerParams.icon) {
3270 // Custom or default content
3271 setContent(icon, params);
3272 applyStyles(icon, params);
3273 return;
3274 }
3275 if (!params.icon && !params.iconHtml) {
3276 hide(icon);
3277 return;
3278 }
3279 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {
3280 error(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${params.icon}"`);
3281 hide(icon);
3282 return;
3283 }
3284 show(icon);
3285
3286 // Custom or default content
3287 setContent(icon, params);
3288 applyStyles(icon, params);
3289
3290 // Animate icon
3291 addClass(icon, params.showClass && params.showClass.icon);
3292
3293 // Re-adjust the success icon on system theme change
3294 const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: dark)');
3295 colorSchemeQueryList.addEventListener('change', adjustSuccessIconBackgroundColor);
3296 };
3297
3298 /**
3299 * @param {HTMLElement} icon
3300 * @param {SweetAlertOptions} params
3301 */
3302 const applyStyles = (icon, params) => {
3303 for (const [iconType, iconClassName] of Object.entries(iconTypes)) {
3304 if (params.icon !== iconType) {
3305 removeClass(icon, iconClassName);
3306 }
3307 }
3308 addClass(icon, params.icon && iconTypes[params.icon]);
3309
3310 // Icon color
3311 setColor(icon, params);
3312
3313 // Success icon background color
3314 adjustSuccessIconBackgroundColor();
3315
3316 // Custom class
3317 applyCustomClass(icon, params, 'icon');
3318 };
3319
3320 // Adjust success icon background color to match the popup background color
3321 const adjustSuccessIconBackgroundColor = () => {
3322 const popup = getPopup();
3323 if (!popup) {
3324 return;
3325 }
3326 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
3327 /** @type {NodeListOf<HTMLElement>} */
3328 const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
3329 successIconParts.forEach(part => {
3330 part.style.backgroundColor = popupBackgroundColor;
3331 });
3332 };
3333
3334 /**
3335 *
3336 * @param {SweetAlertOptions} params
3337 * @returns {string}
3338 */
3339 const successIconHtml = params => `
3340 ${params.animation ? '<div class="swal2-success-circular-line-left"></div>' : ''}
3341 <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
3342 <div class="swal2-success-ring"></div>
3343 ${params.animation ? '<div class="swal2-success-fix"></div>' : ''}
3344 ${params.animation ? '<div class="swal2-success-circular-line-right"></div>' : ''}
3345 `;
3346 const errorIconHtml = `
3347 <span class="swal2-x-mark">
3348 <span class="swal2-x-mark-line-left"></span>
3349 <span class="swal2-x-mark-line-right"></span>
3350 </span>
3351 `;
3352
3353 /**
3354 * @param {HTMLElement} icon
3355 * @param {SweetAlertOptions} params
3356 */
3357 const setContent = (icon, params) => {
3358 if (!params.icon && !params.iconHtml) {
3359 return;
3360 }
3361 let oldContent = icon.innerHTML;
3362 let newContent = '';
3363 if (params.iconHtml) {
3364 newContent = iconContent(params.iconHtml);
3365 } else if (params.icon === 'success') {
3366 newContent = successIconHtml(params);
3367 oldContent = oldContent.replace(/ style=".*?"/g, ''); // undo adjustSuccessIconBackgroundColor()
3368 } else if (params.icon === 'error') {
3369 newContent = errorIconHtml;
3370 } else if (params.icon) {
3371 const defaultIconHtml = {
3372 question: '?',
3373 warning: '!',
3374 info: 'i'
3375 };
3376 newContent = iconContent(defaultIconHtml[params.icon]);
3377 }
3378 if (oldContent.trim() !== newContent.trim()) {
3379 setInnerHtml(icon, newContent);
3380 }
3381 };
3382
3383 /**
3384 * @param {HTMLElement} icon
3385 * @param {SweetAlertOptions} params
3386 */
3387 const setColor = (icon, params) => {
3388 if (!params.iconColor) {
3389 return;
3390 }
3391 icon.style.color = params.iconColor;
3392 icon.style.borderColor = params.iconColor;
3393 for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {
3394 setStyle(icon, sel, 'background-color', params.iconColor);
3395 }
3396 setStyle(icon, '.swal2-success-ring', 'border-color', params.iconColor);
3397 };
3398
3399 /**
3400 * @param {string} content
3401 * @returns {string}
3402 */
3403 const iconContent = content => `<div class="${swalClasses['icon-content']}">${content}</div>`;
3404
3405 /**
3406 * @param {SweetAlert} instance
3407 * @param {SweetAlertOptions} params
3408 */
3409 const renderImage = (instance, params) => {
3410 const image = getImage();
3411 if (!image) {
3412 return;
3413 }
3414 if (!params.imageUrl) {
3415 hide(image);
3416 return;
3417 }
3418 show(image, '');
3419
3420 // Src, alt
3421 image.setAttribute('src', params.imageUrl);
3422 image.setAttribute('alt', params.imageAlt || '');
3423
3424 // Width, height
3425 applyNumericalStyle(image, 'width', params.imageWidth);
3426 applyNumericalStyle(image, 'height', params.imageHeight);
3427
3428 // Class
3429 image.className = swalClasses.image;
3430 applyCustomClass(image, params, 'image');
3431 };
3432
3433 let dragging = false;
3434 let mousedownX = 0;
3435 let mousedownY = 0;
3436 let initialX = 0;
3437 let initialY = 0;
3438
3439 /**
3440 * @param {HTMLElement} popup
3441 */
3442 const addDraggableListeners = popup => {
3443 popup.addEventListener('mousedown', down);
3444 document.body.addEventListener('mousemove', move);
3445 popup.addEventListener('mouseup', up);
3446 popup.addEventListener('touchstart', down);
3447 document.body.addEventListener('touchmove', move);
3448 popup.addEventListener('touchend', up);
3449 };
3450
3451 /**
3452 * @param {HTMLElement} popup
3453 */
3454 const removeDraggableListeners = popup => {
3455 popup.removeEventListener('mousedown', down);
3456 document.body.removeEventListener('mousemove', move);
3457 popup.removeEventListener('mouseup', up);
3458 popup.removeEventListener('touchstart', down);
3459 document.body.removeEventListener('touchmove', move);
3460 popup.removeEventListener('touchend', up);
3461 };
3462
3463 /**
3464 * @param {MouseEvent | TouchEvent} event
3465 */
3466 const down = event => {
3467 const popup = getPopup();
3468 if (!popup) {
3469 return;
3470 }
3471 const icon = getIcon();
3472 if (event.target === popup || icon && icon.contains(/** @type {HTMLElement} */event.target)) {
3473 dragging = true;
3474 const clientXY = getClientXY(event);
3475 mousedownX = clientXY.clientX;
3476 mousedownY = clientXY.clientY;
3477 initialX = parseInt(popup.style.insetInlineStart) || 0;
3478 initialY = parseInt(popup.style.insetBlockStart) || 0;
3479 addClass(popup, 'swal2-dragging');
3480 }
3481 };
3482
3483 /**
3484 * @param {MouseEvent | TouchEvent} event
3485 */
3486 const move = event => {
3487 const popup = getPopup();
3488 if (!popup) {
3489 return;
3490 }
3491 if (dragging) {
3492 let {
3493 clientX,
3494 clientY
3495 } = getClientXY(event);
3496 const deltaX = clientX - mousedownX;
3497 // In RTL mode, negate the horizontal delta since insetInlineStart refers to the right edge
3498 popup.style.insetInlineStart = `${initialX + (globalState.isRTL ? -deltaX : deltaX)}px`;
3499 popup.style.insetBlockStart = `${initialY + (clientY - mousedownY)}px`;
3500 }
3501 };
3502 const up = () => {
3503 const popup = getPopup();
3504 dragging = false;
3505 removeClass(popup, 'swal2-dragging');
3506 };
3507
3508 /**
3509 * @param {MouseEvent | TouchEvent} event
3510 * @returns {{ clientX: number, clientY: number }}
3511 */
3512 const getClientXY = event => {
3513 const source = event.type.startsWith('touch') ? /** @type {TouchEvent} */event.touches[0] : (/** @type {MouseEvent} */event);
3514 return {
3515 clientX: source.clientX,
3516 clientY: source.clientY
3517 };
3518 };
3519
3520 /**
3521 * @param {SweetAlert} instance
3522 * @param {SweetAlertOptions} params
3523 */
3524 const renderPopup = (instance, params) => {
3525 const container = getContainer();
3526 const popup = getPopup();
3527 if (!container || !popup) {
3528 return;
3529 }
3530
3531 // Width
3532 // https://github.com/sweetalert2/sweetalert2/issues/2170
3533 if (params.toast) {
3534 applyNumericalStyle(container, 'width', params.width);
3535 popup.style.width = '100%';
3536 const loader = getLoader();
3537 if (loader) {
3538 popup.insertBefore(loader, getIcon());
3539 }
3540 } else {
3541 applyNumericalStyle(popup, 'width', params.width);
3542 }
3543
3544 // Padding
3545 applyNumericalStyle(popup, 'padding', params.padding);
3546
3547 // Color
3548 if (params.color) {
3549 popup.style.color = params.color;
3550 }
3551
3552 // Background
3553 if (params.background) {
3554 popup.style.background = params.background;
3555 }
3556 hide(getValidationMessage());
3557
3558 // Classes
3559 addClasses$1(popup, params);
3560 if (params.draggable && !params.toast) {
3561 addClass(popup, swalClasses.draggable);
3562 addDraggableListeners(popup);
3563 } else {
3564 removeClass(popup, swalClasses.draggable);
3565 removeDraggableListeners(popup);
3566 }
3567 };
3568
3569 /**
3570 * @param {HTMLElement} popup
3571 * @param {SweetAlertOptions} params
3572 */
3573 const addClasses$1 = (popup, params) => {
3574 const showClass = params.showClass || {};
3575 // Default Class + showClass when updating Swal.update({})
3576 popup.className = `${swalClasses.popup} ${isVisible$1(popup) ? showClass.popup : ''}`;
3577 if (params.toast) {
3578 addClass([document.documentElement, document.body], swalClasses['toast-shown']);
3579 addClass(popup, swalClasses.toast);
3580 } else {
3581 addClass(popup, swalClasses.modal);
3582 }
3583
3584 // Custom class
3585 applyCustomClass(popup, params, 'popup');
3586 // TODO: remove in the next major
3587 if (typeof params.customClass === 'string') {
3588 addClass(popup, params.customClass);
3589 }
3590
3591 // Icon class (#1842)
3592 if (params.icon) {
3593 addClass(popup, swalClasses[`icon-${params.icon}`]);
3594 }
3595 };
3596
3597 /**
3598 * @param {SweetAlert} instance
3599 * @param {SweetAlertOptions} params
3600 */
3601 const renderProgressSteps = (instance, params) => {
3602 const progressStepsContainer = getProgressSteps();
3603 if (!progressStepsContainer) {
3604 return;
3605 }
3606 const {
3607 progressSteps,
3608 currentProgressStep
3609 } = params;
3610 if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) {
3611 hide(progressStepsContainer);
3612 return;
3613 }
3614 show(progressStepsContainer);
3615 progressStepsContainer.textContent = '';
3616 if (currentProgressStep >= progressSteps.length) {
3617 warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
3618 }
3619 progressSteps.forEach((step, index) => {
3620 const stepEl = createStepElement(step);
3621 progressStepsContainer.appendChild(stepEl);
3622 if (index === currentProgressStep) {
3623 addClass(stepEl, swalClasses['active-progress-step']);
3624 }
3625 if (index !== progressSteps.length - 1) {
3626 const lineEl = createLineElement(params);
3627 progressStepsContainer.appendChild(lineEl);
3628 }
3629 });
3630 };
3631
3632 /**
3633 * @param {string} step
3634 * @returns {HTMLLIElement}
3635 */
3636 const createStepElement = step => {
3637 const stepEl = document.createElement('li');
3638 addClass(stepEl, swalClasses['progress-step']);
3639 setInnerHtml(stepEl, step);
3640 return stepEl;
3641 };
3642
3643 /**
3644 * @param {SweetAlertOptions} params
3645 * @returns {HTMLLIElement}
3646 */
3647 const createLineElement = params => {
3648 const lineEl = document.createElement('li');
3649 addClass(lineEl, swalClasses['progress-step-line']);
3650 if (params.progressStepsDistance) {
3651 applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);
3652 }
3653 return lineEl;
3654 };
3655
3656 /**
3657 * @param {SweetAlert} instance
3658 * @param {SweetAlertOptions} params
3659 */
3660 const renderTitle = (instance, params) => {
3661 const title = getTitle();
3662 if (!title) {
3663 return;
3664 }
3665 showWhenInnerHtmlPresent(title);
3666 toggle(title, Boolean(params.title || params.titleText), 'block');
3667 if (params.title) {
3668 parseHtmlToContainer(params.title, title);
3669 }
3670 if (params.titleText) {
3671 title.innerText = params.titleText;
3672 }
3673
3674 // Custom class
3675 applyCustomClass(title, params, 'title');
3676 };
3677
3678 /**
3679 * @param {SweetAlert} instance
3680 * @param {SweetAlertOptions} params
3681 */
3682 const render = (instance, params) => {
3683 var _globalState$eventEmi;
3684 renderPopup(instance, params);
3685 renderContainer(instance, params);
3686 renderProgressSteps(instance, params);
3687 renderIcon(instance, params);
3688 renderImage(instance, params);
3689 renderTitle(instance, params);
3690 renderCloseButton(instance, params);
3691 renderContent(instance, params);
3692 renderActions(instance, params);
3693 renderFooter(instance, params);
3694 const popup = getPopup();
3695 if (typeof params.didRender === 'function' && popup) {
3696 params.didRender(popup);
3697 }
3698 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('didRender', popup);
3699 };
3700
3701 /*
3702 * Global function to determine if SweetAlert2 popup is shown
3703 */
3704 const isVisible = () => {
3705 return isVisible$1(getPopup());
3706 };
3707
3708 /*
3709 * Global function to click 'Confirm' button
3710 */
3711 const clickConfirm = () => {
3712 var _dom$getConfirmButton;
3713 return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click();
3714 };
3715
3716 /*
3717 * Global function to click 'Deny' button
3718 */
3719 const clickDeny = () => {
3720 var _dom$getDenyButton;
3721 return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click();
3722 };
3723
3724 /*
3725 * Global function to click 'Cancel' button
3726 */
3727 const clickCancel = () => {
3728 var _dom$getCancelButton;
3729 return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click();
3730 };
3731
3732 /** @type {Record<DismissReason, DismissReason>} */
3733 const DismissReason = Object.freeze({
3734 cancel: 'cancel',
3735 backdrop: 'backdrop',
3736 close: 'close',
3737 esc: 'esc',
3738 timer: 'timer'
3739 });
3740
3741 /**
3742 * @param {GlobalState} globalState
3743 */
3744 const removeKeydownHandler = globalState => {
3745 if (globalState.keydownTarget && globalState.keydownHandlerAdded && globalState.keydownHandler) {
3746 const handler = /** @type {EventListenerOrEventListenerObject} */
3747 /** @type {unknown} */globalState.keydownHandler;
3748 globalState.keydownTarget.removeEventListener('keydown', handler, {
3749 capture: globalState.keydownListenerCapture
3750 });
3751 globalState.keydownHandlerAdded = false;
3752 }
3753 };
3754
3755 /**
3756 * @param {GlobalState} globalState
3757 * @param {SweetAlertOptions} innerParams
3758 * @param {(dismiss: DismissReason) => void} dismissWith
3759 */
3760 const addKeydownHandler = (globalState, innerParams, dismissWith) => {
3761 removeKeydownHandler(globalState);
3762 if (!innerParams.toast) {
3763 /** @type {(this: HTMLElement, event: KeyboardEvent) => void} */
3764 const handler = e => keydownHandler(innerParams, e, dismissWith);
3765 globalState.keydownHandler = handler;
3766 const target = innerParams.keydownListenerCapture ? window : getPopup();
3767 if (target) {
3768 globalState.keydownTarget = target;
3769 globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
3770 const eventHandler = /** @type {EventListenerOrEventListenerObject} */ /** @type {unknown} */handler;
3771 globalState.keydownTarget.addEventListener('keydown', eventHandler, {
3772 capture: globalState.keydownListenerCapture
3773 });
3774 globalState.keydownHandlerAdded = true;
3775 }
3776 }
3777 };
3778
3779 /**
3780 * @param {number} index
3781 * @param {number} increment
3782 * @returns {boolean} shouldPreventDefault
3783 */
3784 const setFocus = (index, increment) => {
3785 var _dom$getPopup;
3786 const focusableElements = getFocusableElements();
3787 // search for visible elements and select the next possible match
3788 if (focusableElements.length) {
3789 index = index + increment;
3790
3791 // shift + tab when .swal2-popup is focused
3792 if (index === -2) {
3793 index = focusableElements.length - 1;
3794 }
3795
3796 // rollover to first item
3797 if (index === focusableElements.length) {
3798 index = 0;
3799
3800 // go to last item
3801 } else if (index === -1) {
3802 index = focusableElements.length - 1;
3803 }
3804 focusableElements[index].focus();
3805
3806 // don't prevent default for iframes (Firefox fix)
3807 // https://github.com/sweetalert2/sweetalert2/issues/2931
3808 if (isFirefox() && focusableElements[index] instanceof HTMLIFrameElement) {
3809 return false;
3810 }
3811 return true;
3812 }
3813 // no visible focusable elements, focus the popup
3814 (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus();
3815 return true;
3816 };
3817 const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
3818 const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
3819
3820 /**
3821 * @param {SweetAlertOptions} innerParams
3822 * @param {KeyboardEvent} event
3823 * @param {(dismiss: DismissReason) => void} dismissWith
3824 */
3825 const keydownHandler = (innerParams, event, dismissWith) => {
3826 if (!innerParams) {
3827 return; // This instance has already been destroyed
3828 }
3829
3830 // Ignore keydown during IME composition
3831 // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition
3832 // https://github.com/sweetalert2/sweetalert2/issues/720
3833 // https://github.com/sweetalert2/sweetalert2/issues/2406
3834 if (event.isComposing || event.keyCode === 229) {
3835 return;
3836 }
3837 if (innerParams.stopKeydownPropagation) {
3838 event.stopPropagation();
3839 }
3840
3841 // ENTER
3842 if (event.key === 'Enter') {
3843 handleEnter(event, innerParams);
3844 }
3845
3846 // TAB
3847 else if (event.key === 'Tab') {
3848 handleTab(event);
3849 }
3850
3851 // ARROWS - switch focus between buttons
3852 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(event.key)) {
3853 handleArrows(event.key);
3854 }
3855
3856 // ESC
3857 else if (event.key === 'Escape') {
3858 handleEsc(event, innerParams, dismissWith);
3859 }
3860 };
3861
3862 /**
3863 * @param {KeyboardEvent} event
3864 * @param {SweetAlertOptions} innerParams
3865 */
3866 const handleEnter = (event, innerParams) => {
3867 // https://github.com/sweetalert2/sweetalert2/issues/2386
3868 if (!callIfFunction(innerParams.allowEnterKey)) {
3869 return;
3870 }
3871 const popup = getPopup();
3872 if (!popup || !innerParams.input) {
3873 return;
3874 }
3875 const input = getInput$1(popup, innerParams.input);
3876 if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) {
3877 if (['textarea', 'file'].includes(innerParams.input)) {
3878 return; // do not submit
3879 }
3880 clickConfirm();
3881 event.preventDefault();
3882 }
3883 };
3884
3885 /**
3886 * @param {KeyboardEvent} event
3887 */
3888 const handleTab = event => {
3889 const targetElement = event.target;
3890 const focusableElements = getFocusableElements();
3891 const btnIndex = focusableElements.findIndex(el => el === targetElement);
3892
3893 // don't prevent default for iframes (Firefox fix)
3894 // https://github.com/sweetalert2/sweetalert2/issues/2931
3895 let shouldPreventDefault = true;
3896
3897 // Cycle to the next button
3898 if (!event.shiftKey) {
3899 shouldPreventDefault = setFocus(btnIndex, 1);
3900 }
3901
3902 // Cycle to the prev button
3903 else {
3904 shouldPreventDefault = setFocus(btnIndex, -1);
3905 }
3906 event.stopPropagation();
3907 if (shouldPreventDefault) {
3908 event.preventDefault();
3909 }
3910 };
3911
3912 /**
3913 * @param {string} key
3914 */
3915 const handleArrows = key => {
3916 const actions = getActions();
3917 const confirmButton = getConfirmButton();
3918 const denyButton = getDenyButton();
3919 const cancelButton = getCancelButton();
3920 if (!actions || !confirmButton || !denyButton || !cancelButton) {
3921 return;
3922 }
3923 /** @type HTMLElement[] */
3924 const buttons = [confirmButton, denyButton, cancelButton];
3925 if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) {
3926 return;
3927 }
3928 const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
3929 let buttonToFocus = document.activeElement;
3930 if (!buttonToFocus) {
3931 return;
3932 }
3933 for (let i = 0; i < actions.children.length; i++) {
3934 buttonToFocus = buttonToFocus[sibling];
3935 if (!buttonToFocus) {
3936 return;
3937 }
3938 if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) {
3939 break;
3940 }
3941 }
3942 if (buttonToFocus instanceof HTMLButtonElement) {
3943 buttonToFocus.focus();
3944 }
3945 };
3946
3947 /**
3948 * @param {KeyboardEvent} event
3949 * @param {SweetAlertOptions} innerParams
3950 * @param {(dismiss: DismissReason) => void} dismissWith
3951 */
3952 const handleEsc = (event, innerParams, dismissWith) => {
3953 event.preventDefault();
3954 if (callIfFunction(innerParams.allowEscapeKey)) {
3955 dismissWith(DismissReason.esc);
3956 }
3957 };
3958
3959 /**
3960 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
3961 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
3962 * This is the approach that Babel will probably take to implement private methods/fields
3963 * https://github.com/tc39/proposal-private-methods
3964 * https://github.com/babel/babel/pull/7555
3965 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
3966 * then we can use that language feature.
3967 */
3968
3969 var privateMethods = {
3970 swalPromiseResolve: new WeakMap(),
3971 swalPromiseReject: new WeakMap()
3972 };
3973
3974 // From https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/
3975 // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that
3976 // elements not within the active modal dialog will not be surfaced if a user opens a screen
3977 // reader’s list of elements (headings, form controls, landmarks, etc.) in the document.
3978
3979 const setAriaHidden = () => {
3980 const container = getContainer();
3981 const bodyChildren = Array.from(document.body.children);
3982 bodyChildren.forEach(el => {
3983 if (el.contains(container)) {
3984 return;
3985 }
3986 if (el.hasAttribute('aria-hidden')) {
3987 el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden') || '');
3988 }
3989 el.setAttribute('aria-hidden', 'true');
3990 });
3991 };
3992 const unsetAriaHidden = () => {
3993 const bodyChildren = Array.from(document.body.children);
3994 bodyChildren.forEach(el => {
3995 if (el.hasAttribute('data-previous-aria-hidden')) {
3996 el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || '');
3997 el.removeAttribute('data-previous-aria-hidden');
3998 } else {
3999 el.removeAttribute('aria-hidden');
4000 }
4001 });
4002 };
4003
4004 // @ts-ignore
4005 const isSafariOrIOS = typeof window !== 'undefined' && Boolean(window.GestureEvent); // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394
4006
4007 // @ts-ignore
4008 const isIOS = isSafariOrIOS && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
4009
4010 /**
4011 * Fix iOS scrolling
4012 * http://stackoverflow.com/q/39626302
4013 */
4014 const iOSfix = () => {
4015 if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) {
4016 const offset = document.body.scrollTop;
4017 document.body.style.top = `${offset * -1}px`;
4018 addClass(document.body, swalClasses.iosfix);
4019 lockBodyScroll();
4020 }
4021 };
4022
4023 /**
4024 * https://github.com/sweetalert2/sweetalert2/issues/1246
4025 */
4026 const lockBodyScroll = () => {
4027 const container = getContainer();
4028 if (!container) {
4029 return;
4030 }
4031 /** @type {boolean} */
4032 let preventTouchMove;
4033 /**
4034 * @param {TouchEvent} event
4035 */
4036 container.ontouchstart = event => {
4037 preventTouchMove = shouldPreventTouchMove(event);
4038 };
4039 /**
4040 * @param {TouchEvent} event
4041 */
4042 container.ontouchmove = event => {
4043 if (preventTouchMove) {
4044 event.preventDefault();
4045 event.stopPropagation();
4046 }
4047 };
4048 };
4049
4050 /**
4051 * @param {TouchEvent} event
4052 * @returns {boolean}
4053 */
4054 const shouldPreventTouchMove = event => {
4055 const target = event.target;
4056 const container = getContainer();
4057 const htmlContainer = getHtmlContainer();
4058 if (!container || !htmlContainer) {
4059 return false;
4060 }
4061 if (isStylus(event) || isZoom(event)) {
4062 return false;
4063 }
4064 if (target === container) {
4065 return true;
4066 }
4067 if (!isScrollable(container) && target instanceof HTMLElement && !selfOrParentIsScrollable(target, htmlContainer) &&
4068 // #2823
4069 target.tagName !== 'INPUT' &&
4070 // #1603
4071 target.tagName !== 'TEXTAREA' &&
4072 // #2266
4073 !(isScrollable(htmlContainer) &&
4074 // #1944
4075 htmlContainer.contains(target))) {
4076 return true;
4077 }
4078 return false;
4079 };
4080
4081 /**
4082 * https://github.com/sweetalert2/sweetalert2/issues/1786
4083 *
4084 * @param {TouchEvent} event
4085 * @returns {boolean}
4086 */
4087 const isStylus = event => {
4088 return Boolean(event.touches && event.touches.length &&
4089 // @ts-ignore - touchType is not a standard property
4090 event.touches[0].touchType === 'stylus');
4091 };
4092
4093 /**
4094 * https://github.com/sweetalert2/sweetalert2/issues/1891
4095 *
4096 * @param {TouchEvent} event
4097 * @returns {boolean}
4098 */
4099 const isZoom = event => {
4100 return event.touches && event.touches.length > 1;
4101 };
4102 const undoIOSfix = () => {
4103 if (hasClass(document.body, swalClasses.iosfix)) {
4104 const offset = parseInt(document.body.style.top, 10);
4105 removeClass(document.body, swalClasses.iosfix);
4106 document.body.style.top = '';
4107 document.body.scrollTop = offset * -1;
4108 }
4109 };
4110
4111 /**
4112 * Measure scrollbar width for padding body during modal show/hide
4113 * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js
4114 *
4115 * @returns {number}
4116 */
4117 const measureScrollbar = () => {
4118 const scrollDiv = document.createElement('div');
4119 scrollDiv.className = swalClasses['scrollbar-measure'];
4120 document.body.appendChild(scrollDiv);
4121 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
4122 document.body.removeChild(scrollDiv);
4123 return scrollbarWidth;
4124 };
4125
4126 /**
4127 * Remember state in cases where opening and handling a modal will fiddle with it.
4128 * @type {number | null}
4129 */
4130 let previousBodyPadding = null;
4131
4132 /**
4133 * @param {string} initialBodyOverflow
4134 */
4135 const replaceScrollbarWithPadding = initialBodyOverflow => {
4136 // for queues, do not do this more than once
4137 if (previousBodyPadding !== null) {
4138 return;
4139 }
4140 // if the body has overflow
4141 if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === 'scroll' // https://github.com/sweetalert2/sweetalert2/issues/2663
4142 ) {
4143 // add padding so the content doesn't shift after removal of scrollbar
4144 previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));
4145 document.body.style.paddingRight = `${previousBodyPadding + measureScrollbar()}px`;
4146 }
4147 };
4148 const undoReplaceScrollbarWithPadding = () => {
4149 if (previousBodyPadding !== null) {
4150 document.body.style.paddingRight = `${previousBodyPadding}px`;
4151 previousBodyPadding = null;
4152 }
4153 };
4154
4155 /**
4156 * @param {SweetAlert} instance
4157 * @param {HTMLElement} container
4158 * @param {boolean} returnFocus
4159 * @param {(() => void) | undefined} didClose
4160 */
4161 function removePopupAndResetState(instance, container, returnFocus, didClose) {
4162 if (isToast()) {
4163 triggerDidCloseAndDispose(instance, didClose);
4164 } else {
4165 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));
4166 removeKeydownHandler(globalState);
4167 }
4168
4169 // workaround for https://github.com/sweetalert2/sweetalert2/issues/2088
4170 // for some reason removing the container in Safari will scroll the document to bottom
4171 if (isSafariOrIOS) {
4172 container.setAttribute('style', 'display:none !important');
4173 container.removeAttribute('class');
4174 container.innerHTML = '';
4175 } else {
4176 container.remove();
4177 }
4178 if (isModal()) {
4179 undoReplaceScrollbarWithPadding();
4180 undoIOSfix();
4181 unsetAriaHidden();
4182 }
4183 removeBodyClasses();
4184 }
4185
4186 /**
4187 * Remove SweetAlert2 classes from body
4188 */
4189 function removeBodyClasses() {
4190 removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);
4191 }
4192
4193 /**
4194 * Instance method to close sweetAlert
4195 *
4196 * @param {SweetAlertResult | undefined} resolveValue
4197 * @this {SweetAlert}
4198 */
4199 function close(resolveValue) {
4200 resolveValue = prepareResolveValue(resolveValue);
4201 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
4202 const didClose = triggerClosePopup(this);
4203 if (this.isAwaitingPromise) {
4204 // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335
4205 if (!resolveValue.isDismissed) {
4206 handleAwaitingPromise(this);
4207 swalPromiseResolve(resolveValue);
4208 }
4209 } else if (didClose) {
4210 // Resolve Swal promise
4211 swalPromiseResolve(resolveValue);
4212 }
4213 }
4214
4215 /**
4216 * @param {SweetAlert} instance
4217 * @returns {boolean}
4218 */
4219 const triggerClosePopup = instance => {
4220 const popup = getPopup();
4221 if (!popup) {
4222 return false;
4223 }
4224 const innerParams = privateProps.innerParams.get(instance);
4225 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {
4226 return false;
4227 }
4228 removeClass(popup, innerParams.showClass.popup);
4229 addClass(popup, innerParams.hideClass.popup);
4230 const backdrop = getContainer();
4231 removeClass(backdrop, innerParams.showClass.backdrop);
4232 addClass(backdrop, innerParams.hideClass.backdrop);
4233 handlePopupAnimation(instance, popup, innerParams);
4234 return true;
4235 };
4236
4237 /**
4238 * @param {Error | string} error
4239 * @this {SweetAlert}
4240 */
4241 function rejectPromise(error) {
4242 const rejectPromise = privateMethods.swalPromiseReject.get(this);
4243 handleAwaitingPromise(this);
4244 if (rejectPromise) {
4245 // Reject Swal promise
4246 rejectPromise(error);
4247 }
4248 }
4249
4250 /**
4251 * @param {SweetAlert} instance
4252 */
4253 const handleAwaitingPromise = instance => {
4254 if (instance.isAwaitingPromise) {
4255 // @ts-ignore
4256 delete instance.isAwaitingPromise;
4257 // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335
4258 if (!privateProps.innerParams.get(instance)) {
4259 instance._destroy();
4260 }
4261 }
4262 };
4263
4264 /**
4265 * @param {SweetAlertResult | undefined} resolveValue
4266 * @returns {SweetAlertResult}
4267 */
4268 const prepareResolveValue = resolveValue => {
4269 // When user calls Swal.close()
4270 if (typeof resolveValue === 'undefined') {
4271 return {
4272 isConfirmed: false,
4273 isDenied: false,
4274 isDismissed: true
4275 };
4276 }
4277 return Object.assign({
4278 isConfirmed: false,
4279 isDenied: false,
4280 isDismissed: false
4281 }, resolveValue);
4282 };
4283
4284 /**
4285 * @param {SweetAlert} instance
4286 * @param {HTMLElement} popup
4287 * @param {SweetAlertOptions} innerParams
4288 */
4289 const handlePopupAnimation = (instance, popup, innerParams) => {
4290 var _globalState$eventEmi;
4291 const container = getContainer();
4292 // If animation is supported, animate
4293 const animationIsSupported = hasCssAnimation(popup);
4294 if (typeof innerParams.willClose === 'function') {
4295 innerParams.willClose(popup);
4296 }
4297 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('willClose', popup);
4298 if (animationIsSupported && container) {
4299 animatePopup(instance, popup, container, Boolean(innerParams.returnFocus), innerParams.didClose);
4300 } else if (container) {
4301 // Otherwise, remove immediately
4302 removePopupAndResetState(instance, container, Boolean(innerParams.returnFocus), innerParams.didClose);
4303 }
4304 };
4305
4306 /**
4307 * @param {SweetAlert} instance
4308 * @param {HTMLElement} popup
4309 * @param {HTMLElement} container
4310 * @param {boolean} returnFocus
4311 * @param {(() => void) | undefined} didClose
4312 */
4313 const animatePopup = (instance, popup, container, returnFocus, didClose) => {
4314 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);
4315 /**
4316 * @param {AnimationEvent | TransitionEvent} e
4317 */
4318 const swalCloseAnimationFinished = function (e) {
4319 if (e.target === popup) {
4320 var _globalState$swalClos;
4321 (_globalState$swalClos = globalState.swalCloseEventFinishedCallback) === null || _globalState$swalClos === void 0 || _globalState$swalClos.call(globalState);
4322 delete globalState.swalCloseEventFinishedCallback;
4323 popup.removeEventListener('animationend', swalCloseAnimationFinished);
4324 popup.removeEventListener('transitionend', swalCloseAnimationFinished);
4325 }
4326 };
4327 popup.addEventListener('animationend', swalCloseAnimationFinished);
4328 popup.addEventListener('transitionend', swalCloseAnimationFinished);
4329 };
4330
4331 /**
4332 * @param {SweetAlert} instance
4333 * @param {(() => void) | undefined} didClose
4334 */
4335 const triggerDidCloseAndDispose = (instance, didClose) => {
4336 setTimeout(() => {
4337 var _globalState$eventEmi2;
4338 if (typeof didClose === 'function') {
4339 didClose.bind(instance.params)();
4340 }
4341 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit('didClose');
4342 // instance might have been destroyed already
4343 if (instance._destroy) {
4344 instance._destroy();
4345 }
4346 });
4347 };
4348
4349 /**
4350 * Shows loader (spinner), this is useful with AJAX requests.
4351 * By default the loader be shown instead of the "Confirm" button.
4352 *
4353 * @param {HTMLButtonElement | null} [buttonToReplace]
4354 */
4355 const showLoading = buttonToReplace => {
4356 let popup = getPopup();
4357 if (!popup) {
4358 new Swal();
4359 }
4360 popup = getPopup();
4361 if (!popup) {
4362 return;
4363 }
4364 const loader = getLoader();
4365 if (isToast()) {
4366 hide(getIcon());
4367 } else {
4368 replaceButton(popup, buttonToReplace);
4369 }
4370 show(loader);
4371 popup.setAttribute('data-loading', 'true');
4372 popup.setAttribute('aria-busy', 'true');
4373 popup.focus();
4374 };
4375
4376 /**
4377 * @param {HTMLElement} popup
4378 * @param {HTMLButtonElement | null} [buttonToReplace]
4379 */
4380 const replaceButton = (popup, buttonToReplace) => {
4381 const actions = getActions();
4382 const loader = getLoader();
4383 if (!actions || !loader) {
4384 return;
4385 }
4386 if (!buttonToReplace && isVisible$1(getConfirmButton())) {
4387 buttonToReplace = getConfirmButton();
4388 }
4389 show(actions);
4390 if (buttonToReplace) {
4391 hide(buttonToReplace);
4392 loader.setAttribute('data-button-to-replace', buttonToReplace.className);
4393 actions.insertBefore(loader, buttonToReplace);
4394 }
4395 addClass([popup, actions], swalClasses.loading);
4396 };
4397
4398 /**
4399 * @param {SweetAlert} instance
4400 * @param {SweetAlertOptions} params
4401 */
4402 const handleInputOptionsAndValue = (instance, params) => {
4403 if (params.input === 'select' || params.input === 'radio') {
4404 handleInputOptions(instance, params);
4405 } else if (['text', 'email', 'number', 'tel', 'textarea'].some(i => i === params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {
4406 showLoading(getConfirmButton());
4407 handleInputValue(instance, params);
4408 }
4409 };
4410
4411 /**
4412 * @param {SweetAlert} instance
4413 * @param {SweetAlertOptions} innerParams
4414 * @returns {SweetAlertInputValue}
4415 */
4416 const getInputValue = (instance, innerParams) => {
4417 const input = instance.getInput();
4418 if (!input) {
4419 return null;
4420 }
4421 switch (innerParams.input) {
4422 case 'checkbox':
4423 return getCheckboxValue(input);
4424 case 'radio':
4425 return getRadioValue(input);
4426 case 'file':
4427 return getFileValue(input);
4428 default:
4429 return innerParams.inputAutoTrim ? input.value.trim() : input.value;
4430 }
4431 };
4432
4433 /**
4434 * @param {HTMLInputElement} input
4435 * @returns {number}
4436 */
4437 const getCheckboxValue = input => input.checked ? 1 : 0;
4438
4439 /**
4440 * @param {HTMLInputElement} input
4441 * @returns {string | null}
4442 */
4443 const getRadioValue = input => input.checked ? input.value : null;
4444
4445 /**
4446 * @param {HTMLInputElement} input
4447 * @returns {FileList | File | null}
4448 */
4449 const getFileValue = input => input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;
4450
4451 /**
4452 * @param {SweetAlert} instance
4453 * @param {SweetAlertOptions} params
4454 */
4455 const handleInputOptions = (instance, params) => {
4456 const popup = getPopup();
4457 if (!popup) {
4458 return;
4459 }
4460 /**
4461 * @param {*} inputOptions
4462 */
4463 const processInputOptions = inputOptions => {
4464 if (params.input === 'select') {
4465 populateSelectOptions(popup, formatInputOptions(inputOptions), params);
4466 } else if (params.input === 'radio') {
4467 populateRadioOptions(popup, formatInputOptions(inputOptions), params);
4468 }
4469 };
4470 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {
4471 showLoading(getConfirmButton());
4472 asPromise(params.inputOptions).then(inputOptions => {
4473 instance.hideLoading();
4474 processInputOptions(inputOptions);
4475 });
4476 } else if (typeof params.inputOptions === 'object') {
4477 processInputOptions(params.inputOptions);
4478 } else {
4479 error(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof params.inputOptions}`);
4480 }
4481 };
4482
4483 /**
4484 * @param {SweetAlert} instance
4485 * @param {SweetAlertOptions} params
4486 */
4487 const handleInputValue = (instance, params) => {
4488 const input = instance.getInput();
4489 if (!input) {
4490 return;
4491 }
4492 hide(input);
4493 asPromise(params.inputValue).then(inputValue => {
4494 input.value = params.input === 'number' ? `${parseFloat(inputValue) || 0}` : `${inputValue}`;
4495 show(input);
4496 input.focus();
4497 instance.hideLoading();
4498 }).catch(err => {
4499 error(`Error in inputValue promise: ${err}`);
4500 input.value = '';
4501 show(input);
4502 input.focus();
4503 instance.hideLoading();
4504 });
4505 };
4506
4507 /**
4508 * @param {HTMLElement} popup
4509 * @param {InputOptionFlattened[]} inputOptions
4510 * @param {SweetAlertOptions} params
4511 */
4512 function populateSelectOptions(popup, inputOptions, params) {
4513 const select = getDirectChildByClass(popup, swalClasses.select);
4514 if (!select) {
4515 return;
4516 }
4517 /**
4518 * @param {HTMLElement} parent
4519 * @param {string} optionLabel
4520 * @param {string} optionValue
4521 */
4522 const renderOption = (parent, optionLabel, optionValue) => {
4523 const option = document.createElement('option');
4524 option.value = optionValue;
4525 setInnerHtml(option, optionLabel);
4526 option.selected = isSelected(optionValue, params.inputValue);
4527 parent.appendChild(option);
4528 };
4529 inputOptions.forEach(inputOption => {
4530 const optionValue = inputOption[0];
4531 const optionLabel = inputOption[1];
4532 // <optgroup> spec:
4533 // https://www.w3.org/TR/html401/interact/forms.html#h-17.6
4534 // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..."
4535 // check whether this is a <optgroup>
4536 if (Array.isArray(optionLabel)) {
4537 // if it is an array, then it is an <optgroup>
4538 const optgroup = document.createElement('optgroup');
4539 optgroup.label = optionValue;
4540 optgroup.disabled = false; // not configurable for now
4541 select.appendChild(optgroup);
4542 optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));
4543 } else {
4544 // case of <option>
4545 renderOption(select, optionLabel, optionValue);
4546 }
4547 });
4548 select.focus();
4549 }
4550
4551 /**
4552 * @param {HTMLElement} popup
4553 * @param {InputOptionFlattened[]} inputOptions
4554 * @param {SweetAlertOptions} params
4555 */
4556 function populateRadioOptions(popup, inputOptions, params) {
4557 const radio = getDirectChildByClass(popup, swalClasses.radio);
4558 if (!radio) {
4559 return;
4560 }
4561 inputOptions.forEach(inputOption => {
4562 const radioValue = inputOption[0];
4563 const radioLabel = inputOption[1];
4564 const radioInput = document.createElement('input');
4565 const radioLabelElement = document.createElement('label');
4566 radioInput.type = 'radio';
4567 radioInput.name = swalClasses.radio;
4568 radioInput.value = radioValue;
4569 if (isSelected(radioValue, params.inputValue)) {
4570 radioInput.checked = true;
4571 }
4572 const label = document.createElement('span');
4573 setInnerHtml(label, radioLabel);
4574 label.className = swalClasses.label;
4575 radioLabelElement.appendChild(radioInput);
4576 radioLabelElement.appendChild(label);
4577 radio.appendChild(radioLabelElement);
4578 });
4579 const radios = radio.querySelectorAll('input');
4580 if (radios.length) {
4581 radios[0].focus();
4582 }
4583 }
4584
4585 /**
4586 * Converts `inputOptions` into an array of `[value, label]`s
4587 *
4588 * @param {*} inputOptions
4589 * @typedef {string[]} InputOptionFlattened
4590 * @returns {InputOptionFlattened[]}
4591 */
4592 const formatInputOptions = inputOptions => {
4593 const entries = inputOptions instanceof Map ? Array.from(inputOptions) : Object.entries(inputOptions);
4594 return entries.map(([key, value]) => [key, typeof value === 'object' ? formatInputOptions(value) : value]); // case of <optgroup>
4595 };
4596
4597 /**
4598 * @param {string} optionValue
4599 * @param {SweetAlertInputValue} inputValue
4600 * @returns {boolean}
4601 */
4602 const isSelected = (optionValue, inputValue) => Boolean(inputValue) && inputValue != null && inputValue.toString() === optionValue.toString();
4603
4604 /**
4605 * @param {SweetAlert} instance
4606 */
4607 const handleConfirmButtonClick = instance => {
4608 const innerParams = privateProps.innerParams.get(instance);
4609 instance.disableButtons();
4610 if (innerParams.input) {
4611 handleConfirmOrDenyWithInput(instance, 'confirm');
4612 } else {
4613 confirm(instance, true);
4614 }
4615 };
4616
4617 /**
4618 * @param {SweetAlert} instance
4619 */
4620 const handleDenyButtonClick = instance => {
4621 const innerParams = privateProps.innerParams.get(instance);
4622 instance.disableButtons();
4623 if (innerParams.returnInputValueOnDeny) {
4624 handleConfirmOrDenyWithInput(instance, 'deny');
4625 } else {
4626 deny(instance, false);
4627 }
4628 };
4629
4630 /**
4631 * @param {SweetAlert} instance
4632 * @param {(dismiss: DismissReason) => void} dismissWith
4633 */
4634 const handleCancelButtonClick = (instance, dismissWith) => {
4635 instance.disableButtons();
4636 dismissWith(DismissReason.cancel);
4637 };
4638
4639 /**
4640 * @param {SweetAlert} instance
4641 * @param {'confirm' | 'deny'} type
4642 */
4643 const handleConfirmOrDenyWithInput = (instance, type) => {
4644 const innerParams = privateProps.innerParams.get(instance);
4645 if (!innerParams.input) {
4646 error(`The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`);
4647 return;
4648 }
4649 const input = instance.getInput();
4650 const inputValue = getInputValue(instance, innerParams);
4651 if (innerParams.inputValidator) {
4652 handleInputValidator(instance, inputValue, type);
4653 } else if (input && !input.checkValidity()) {
4654 instance.enableButtons();
4655 instance.showValidationMessage(innerParams.validationMessage || input.validationMessage);
4656 } else if (type === 'deny') {
4657 deny(instance, inputValue);
4658 } else {
4659 confirm(instance, inputValue);
4660 }
4661 };
4662
4663 /**
4664 * @param {SweetAlert} instance
4665 * @param {SweetAlertInputValue} inputValue
4666 * @param {'confirm' | 'deny'} type
4667 */
4668 const handleInputValidator = (instance, inputValue, type) => {
4669 const innerParams = privateProps.innerParams.get(instance);
4670 instance.disableInput();
4671 const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage)));
4672 validationPromise.then(validationMessage => {
4673 instance.enableButtons();
4674 instance.enableInput();
4675 if (validationMessage) {
4676 instance.showValidationMessage(validationMessage);
4677 } else if (type === 'deny') {
4678 deny(instance, inputValue);
4679 } else {
4680 confirm(instance, inputValue);
4681 }
4682 });
4683 };
4684
4685 /**
4686 * @param {SweetAlert} instance
4687 * @param {*} value
4688 */
4689 const deny = (instance, value) => {
4690 const innerParams = privateProps.innerParams.get(instance);
4691 if (innerParams.showLoaderOnDeny) {
4692 showLoading(getDenyButton());
4693 }
4694 if (innerParams.preDeny) {
4695 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
4696 const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage)));
4697 preDenyPromise.then(preDenyValue => {
4698 if (preDenyValue === false) {
4699 instance.hideLoading();
4700 handleAwaitingPromise(instance);
4701 } else {
4702 instance.close(/** @type SweetAlertResult */{
4703 isDenied: true,
4704 value: typeof preDenyValue === 'undefined' ? value : preDenyValue
4705 });
4706 }
4707 }).catch(error => rejectWith(instance, error));
4708 } else {
4709 instance.close(/** @type SweetAlertResult */{
4710 isDenied: true,
4711 value
4712 });
4713 }
4714 };
4715
4716 /**
4717 * @param {SweetAlert} instance
4718 * @param {*} value
4719 */
4720 const succeedWith = (instance, value) => {
4721 instance.close(/** @type SweetAlertResult */{
4722 isConfirmed: true,
4723 value
4724 });
4725 };
4726
4727 /**
4728 *
4729 * @param {SweetAlert} instance
4730 * @param {string} error
4731 */
4732 const rejectWith = (instance, error) => {
4733 instance.rejectPromise(error);
4734 };
4735
4736 /**
4737 *
4738 * @param {SweetAlert} instance
4739 * @param {*} value
4740 */
4741 const confirm = (instance, value) => {
4742 const innerParams = privateProps.innerParams.get(instance);
4743 if (innerParams.showLoaderOnConfirm) {
4744 showLoading();
4745 }
4746 if (innerParams.preConfirm) {
4747 instance.resetValidationMessage();
4748 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
4749 const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage)));
4750 preConfirmPromise.then(preConfirmValue => {
4751 if (isVisible$1(getValidationMessage()) || preConfirmValue === false) {
4752 instance.hideLoading();
4753 handleAwaitingPromise(instance);
4754 } else {
4755 succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);
4756 }
4757 }).catch(error => rejectWith(instance, error));
4758 } else {
4759 succeedWith(instance, value);
4760 }
4761 };
4762
4763 /**
4764 * Hides loader and shows back the button which was hidden by .showLoading()
4765 * @this {SweetAlert}
4766 */
4767 function hideLoading() {
4768 // do nothing if popup is closed
4769 const innerParams = privateProps.innerParams.get(this);
4770 if (!innerParams) {
4771 return;
4772 }
4773 const domCache = privateProps.domCache.get(this);
4774 hide(domCache.loader);
4775 if (isToast()) {
4776 if (innerParams.icon) {
4777 show(getIcon());
4778 }
4779 } else {
4780 showRelatedButton(domCache);
4781 }
4782 removeClass([domCache.popup, domCache.actions], swalClasses.loading);
4783 domCache.popup.removeAttribute('aria-busy');
4784 domCache.popup.removeAttribute('data-loading');
4785 this.enableButtons();
4786 }
4787
4788 /**
4789 * @param {DomCache} domCache
4790 */
4791 const showRelatedButton = domCache => {
4792 const dataButtonToReplace = domCache.loader.getAttribute('data-button-to-replace');
4793 const buttonToReplace = dataButtonToReplace ? domCache.popup.getElementsByClassName(dataButtonToReplace) : [];
4794 if (buttonToReplace.length) {
4795 show(/** @type {HTMLElement} */buttonToReplace[0], 'inline-block');
4796 } else if (allButtonsAreHidden()) {
4797 hide(domCache.actions);
4798 }
4799 };
4800
4801 /**
4802 * Gets the input DOM node, this method works with input parameter.
4803 *
4804 * @returns {HTMLInputElement | null}
4805 * @this {SweetAlert}
4806 */
4807 function getInput() {
4808 const innerParams = privateProps.innerParams.get(this);
4809 const domCache = privateProps.domCache.get(this);
4810 if (!domCache) {
4811 return null;
4812 }
4813 return getInput$1(domCache.popup, innerParams.input);
4814 }
4815
4816 /**
4817 * @param {SweetAlert} instance
4818 * @param {string[]} buttons
4819 * @param {boolean} disabled
4820 */
4821 function setButtonsDisabled(instance, buttons, disabled) {
4822 const domCache = privateProps.domCache.get(instance);
4823 buttons.forEach(button => {
4824 domCache[button].disabled = disabled;
4825 });
4826 }
4827
4828 /**
4829 * @param {HTMLInputElement | null} input
4830 * @param {boolean} disabled
4831 */
4832 function setInputDisabled(input, disabled) {
4833 const popup = getPopup();
4834 if (!popup || !input) {
4835 return;
4836 }
4837 if (input.type === 'radio') {
4838 /** @type {NodeListOf<HTMLInputElement>} */
4839 const radios = popup.querySelectorAll(`[name="${swalClasses.radio}"]`);
4840 radios.forEach(radio => {
4841 radio.disabled = disabled;
4842 });
4843 } else {
4844 input.disabled = disabled;
4845 }
4846 }
4847
4848 /**
4849 * Enable all the buttons
4850 * @this {SweetAlert}
4851 */
4852 function enableButtons() {
4853 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);
4854 const focusedElement = privateProps.focusedElement.get(this);
4855 if (focusedElement instanceof HTMLElement && document.activeElement === document.body) {
4856 focusedElement.focus();
4857 }
4858 privateProps.focusedElement.delete(this);
4859 }
4860
4861 /**
4862 * Disable all the buttons
4863 * @this {SweetAlert}
4864 */
4865 function disableButtons() {
4866 privateProps.focusedElement.set(this, document.activeElement);
4867 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);
4868 }
4869
4870 /**
4871 * Enable the input field
4872 * @this {SweetAlert}
4873 */
4874 function enableInput() {
4875 setInputDisabled(this.getInput(), false);
4876 }
4877
4878 /**
4879 * Disable the input field
4880 * @this {SweetAlert}
4881 */
4882 function disableInput() {
4883 setInputDisabled(this.getInput(), true);
4884 }
4885
4886 /**
4887 * Show block with validation message
4888 *
4889 * @param {string} error
4890 * @this {SweetAlert}
4891 */
4892 function showValidationMessage(error) {
4893 const domCache = privateProps.domCache.get(this);
4894 const params = privateProps.innerParams.get(this);
4895 setInnerHtml(domCache.validationMessage, error);
4896 domCache.validationMessage.className = swalClasses['validation-message'];
4897 if (params.customClass && params.customClass.validationMessage) {
4898 addClass(domCache.validationMessage, params.customClass.validationMessage);
4899 }
4900 show(domCache.validationMessage);
4901 const input = this.getInput();
4902 if (input) {
4903 input.setAttribute('aria-invalid', 'true');
4904 input.setAttribute('aria-describedby', swalClasses['validation-message']);
4905 focusInput(input);
4906 addClass(input, swalClasses.inputerror);
4907 }
4908 }
4909
4910 /**
4911 * Hide block with validation message
4912 *
4913 * @this {SweetAlert}
4914 */
4915 function resetValidationMessage() {
4916 const domCache = privateProps.domCache.get(this);
4917 if (domCache.validationMessage) {
4918 hide(domCache.validationMessage);
4919 }
4920 const input = this.getInput();
4921 if (input) {
4922 input.removeAttribute('aria-invalid');
4923 input.removeAttribute('aria-describedby');
4924 removeClass(input, swalClasses.inputerror);
4925 }
4926 }
4927
4928 const defaultParams = {
4929 title: '',
4930 titleText: '',
4931 text: '',
4932 html: '',
4933 footer: '',
4934 icon: undefined,
4935 iconColor: undefined,
4936 iconHtml: undefined,
4937 template: undefined,
4938 toast: false,
4939 draggable: false,
4940 animation: true,
4941 theme: 'light',
4942 showClass: {
4943 popup: 'swal2-show',
4944 backdrop: 'swal2-backdrop-show',
4945 icon: 'swal2-icon-show'
4946 },
4947 hideClass: {
4948 popup: 'swal2-hide',
4949 backdrop: 'swal2-backdrop-hide',
4950 icon: 'swal2-icon-hide'
4951 },
4952 customClass: {},
4953 target: 'body',
4954 color: undefined,
4955 backdrop: true,
4956 heightAuto: true,
4957 allowOutsideClick: true,
4958 allowEscapeKey: true,
4959 allowEnterKey: true,
4960 stopKeydownPropagation: true,
4961 keydownListenerCapture: false,
4962 showConfirmButton: true,
4963 showDenyButton: false,
4964 showCancelButton: false,
4965 preConfirm: undefined,
4966 preDeny: undefined,
4967 confirmButtonText: 'OK',
4968 confirmButtonAriaLabel: '',
4969 confirmButtonColor: undefined,
4970 denyButtonText: 'No',
4971 denyButtonAriaLabel: '',
4972 denyButtonColor: undefined,
4973 cancelButtonText: 'Cancel',
4974 cancelButtonAriaLabel: '',
4975 cancelButtonColor: undefined,
4976 buttonsStyling: true,
4977 reverseButtons: false,
4978 focusConfirm: true,
4979 focusDeny: false,
4980 focusCancel: false,
4981 returnFocus: true,
4982 showCloseButton: false,
4983 closeButtonHtml: '&times;',
4984 closeButtonAriaLabel: 'Close this dialog',
4985 loaderHtml: '',
4986 showLoaderOnConfirm: false,
4987 showLoaderOnDeny: false,
4988 imageUrl: undefined,
4989 imageWidth: undefined,
4990 imageHeight: undefined,
4991 imageAlt: '',
4992 timer: undefined,
4993 timerProgressBar: false,
4994 width: undefined,
4995 padding: undefined,
4996 background: undefined,
4997 input: undefined,
4998 inputPlaceholder: '',
4999 inputLabel: '',
5000 inputValue: '',
5001 inputOptions: {},
5002 inputAutoFocus: true,
5003 inputAutoTrim: true,
5004 inputAttributes: {},
5005 inputValidator: undefined,
5006 returnInputValueOnDeny: false,
5007 validationMessage: undefined,
5008 grow: false,
5009 position: 'center',
5010 progressSteps: [],
5011 currentProgressStep: undefined,
5012 progressStepsDistance: undefined,
5013 willOpen: undefined,
5014 didOpen: undefined,
5015 didRender: undefined,
5016 willClose: undefined,
5017 didClose: undefined,
5018 didDestroy: undefined,
5019 scrollbarPadding: true,
5020 topLayer: false
5021 };
5022 const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'draggable', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'theme', 'willClose'];
5023
5024 /** @type {Record<string, string | undefined>} */
5025 const deprecatedParams = {
5026 allowEnterKey: undefined
5027 };
5028 const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'draggable', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];
5029
5030 /**
5031 * Is valid parameter
5032 *
5033 * @param {string} paramName
5034 * @returns {boolean}
5035 */
5036 const isValidParameter = paramName => {
5037 return Object.prototype.hasOwnProperty.call(defaultParams, paramName);
5038 };
5039
5040 /**
5041 * Is valid parameter for Swal.update() method
5042 *
5043 * @param {string} paramName
5044 * @returns {boolean}
5045 */
5046 const isUpdatableParameter = paramName => {
5047 return updatableParams.indexOf(paramName) !== -1;
5048 };
5049
5050 /**
5051 * Is deprecated parameter
5052 *
5053 * @param {string} paramName
5054 * @returns {string | undefined}
5055 */
5056 const isDeprecatedParameter = paramName => {
5057 return deprecatedParams[paramName];
5058 };
5059
5060 /**
5061 * @param {string} param
5062 */
5063 const checkIfParamIsValid = param => {
5064 if (!isValidParameter(param)) {
5065 warn(`Unknown parameter "${param}"`);
5066 }
5067 };
5068
5069 /**
5070 * @param {string} param
5071 */
5072 const checkIfToastParamIsValid = param => {
5073 if (toastIncompatibleParams.includes(param)) {
5074 warn(`The parameter "${param}" is incompatible with toasts`);
5075 }
5076 };
5077
5078 /**
5079 * @param {string} param
5080 */
5081 const checkIfParamIsDeprecated = param => {
5082 const isDeprecated = isDeprecatedParameter(param);
5083 if (isDeprecated) {
5084 warnAboutDeprecation(param, isDeprecated);
5085 }
5086 };
5087
5088 /**
5089 * Show relevant warnings for given params
5090 *
5091 * @param {SweetAlertOptions} params
5092 */
5093 const showWarningsForParams = params => {
5094 if (params.backdrop === false && params.allowOutsideClick) {
5095 warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');
5096 }
5097 if (params.theme && !['light', 'dark', 'auto', 'minimal', 'borderless', 'bootstrap-4', 'bootstrap-4-light', 'bootstrap-4-dark', 'bootstrap-5', 'bootstrap-5-light', 'bootstrap-5-dark', 'material-ui', 'material-ui-light', 'material-ui-dark', 'embed-iframe', 'bulma', 'bulma-light', 'bulma-dark'].includes(params.theme)) {
5098 warn(`Invalid theme "${params.theme}"`);
5099 }
5100 for (const param in params) {
5101 checkIfParamIsValid(param);
5102 if (params.toast) {
5103 checkIfToastParamIsValid(param);
5104 }
5105 checkIfParamIsDeprecated(param);
5106 }
5107 };
5108
5109 /**
5110 * Updates popup parameters.
5111 *
5112 * @this {any}
5113 * @param {SweetAlertOptions} params
5114 */
5115 function update(params) {
5116 const container = getContainer();
5117 const popup = getPopup();
5118 const innerParams = privateProps.innerParams.get(this);
5119 if (!popup || hasClass(popup, innerParams.hideClass.popup)) {
5120 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.`);
5121 return;
5122 }
5123 const validUpdatableParams = filterValidParams(params);
5124 const updatedParams = Object.assign({}, innerParams, validUpdatableParams);
5125 showWarningsForParams(updatedParams);
5126 if (container) {
5127 container.dataset['swal2Theme'] = updatedParams.theme;
5128 }
5129 render(this, updatedParams);
5130 privateProps.innerParams.set(this, updatedParams);
5131 Object.defineProperties(this, {
5132 params: {
5133 value: Object.assign({}, this.params, params),
5134 writable: false,
5135 enumerable: true
5136 }
5137 });
5138 }
5139
5140 /**
5141 * @param {SweetAlertOptions} params
5142 * @returns {SweetAlertOptions}
5143 */
5144 const filterValidParams = params => {
5145 /** @type {Record<string, any>} */
5146 const validUpdatableParams = {};
5147 Object.keys(params).forEach(param => {
5148 if (isUpdatableParameter(param)) {
5149 const typedParams = /** @type {Record<string, any>} */params;
5150 validUpdatableParams[param] = typedParams[param];
5151 } else {
5152 warn(`Invalid parameter to update: ${param}`);
5153 }
5154 });
5155 return validUpdatableParams;
5156 };
5157
5158 /**
5159 * Dispose the current SweetAlert2 instance
5160 * @this {SweetAlert}
5161 */
5162 function _destroy() {
5163 var _globalState$eventEmi;
5164 const domCache = privateProps.domCache.get(this);
5165 const innerParams = privateProps.innerParams.get(this);
5166 if (!innerParams) {
5167 disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335
5168 return; // This instance has already been destroyed
5169 }
5170
5171 // Check if there is another Swal closing
5172 if (domCache.popup && globalState.swalCloseEventFinishedCallback) {
5173 globalState.swalCloseEventFinishedCallback();
5174 delete globalState.swalCloseEventFinishedCallback;
5175 }
5176 if (typeof innerParams.didDestroy === 'function') {
5177 innerParams.didDestroy();
5178 }
5179 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('didDestroy');
5180 disposeSwal(this);
5181 }
5182
5183 /**
5184 * @param {SweetAlert} instance
5185 */
5186 const disposeSwal = instance => {
5187 disposeWeakMaps(instance);
5188 // Unset this.params so GC will dispose it (#1569)
5189 // @ts-ignore
5190 delete instance.params;
5191 // Unset globalState props so GC will dispose globalState (#1569)
5192 delete globalState.keydownHandler;
5193 delete globalState.keydownTarget;
5194 // Unset currentInstance
5195 delete globalState.currentInstance;
5196 };
5197
5198 /**
5199 * @param {SweetAlert} instance
5200 */
5201 const disposeWeakMaps = instance => {
5202 // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
5203 if (instance.isAwaitingPromise) {
5204 unsetWeakMaps(privateProps, instance);
5205 instance.isAwaitingPromise = true;
5206 } else {
5207 unsetWeakMaps(privateMethods, instance);
5208 unsetWeakMaps(privateProps, instance);
5209
5210 // @ts-ignore
5211 delete instance.isAwaitingPromise;
5212 // Unset instance methods
5213 // @ts-ignore
5214 delete instance.disableButtons;
5215 // @ts-ignore
5216 delete instance.enableButtons;
5217 // @ts-ignore
5218 delete instance.getInput;
5219 // @ts-ignore
5220 delete instance.disableInput;
5221 // @ts-ignore
5222 delete instance.enableInput;
5223 // @ts-ignore
5224 delete instance.hideLoading;
5225 // @ts-ignore
5226 delete instance.disableLoading;
5227 // @ts-ignore
5228 delete instance.showValidationMessage;
5229 // @ts-ignore
5230 delete instance.resetValidationMessage;
5231 // @ts-ignore
5232 delete instance.close;
5233 // @ts-ignore
5234 delete instance.closePopup;
5235 // @ts-ignore
5236 delete instance.closeModal;
5237 // @ts-ignore
5238 delete instance.closeToast;
5239 // @ts-ignore
5240 delete instance.rejectPromise;
5241 // @ts-ignore
5242 delete instance.update;
5243 // @ts-ignore
5244 delete instance._destroy;
5245 }
5246 };
5247
5248 /**
5249 * @param {Record<string, WeakMap<any, any>>} obj
5250 * @param {SweetAlert} instance
5251 */
5252 const unsetWeakMaps = (obj, instance) => {
5253 for (const i in obj) {
5254 obj[i].delete(instance);
5255 }
5256 };
5257
5258 var instanceMethods = /*#__PURE__*/Object.freeze({
5259 __proto__: null,
5260 _destroy: _destroy,
5261 close: close,
5262 closeModal: close,
5263 closePopup: close,
5264 closeToast: close,
5265 disableButtons: disableButtons,
5266 disableInput: disableInput,
5267 disableLoading: hideLoading,
5268 enableButtons: enableButtons,
5269 enableInput: enableInput,
5270 getInput: getInput,
5271 handleAwaitingPromise: handleAwaitingPromise,
5272 hideLoading: hideLoading,
5273 rejectPromise: rejectPromise,
5274 resetValidationMessage: resetValidationMessage,
5275 showValidationMessage: showValidationMessage,
5276 update: update
5277 });
5278
5279 /**
5280 * @param {SweetAlertOptions} innerParams
5281 * @param {DomCache} domCache
5282 * @param {(dismiss: DismissReason) => void} dismissWith
5283 */
5284 const handlePopupClick = (innerParams, domCache, dismissWith) => {
5285 if (innerParams.toast) {
5286 handleToastClick(innerParams, domCache, dismissWith);
5287 } else {
5288 // Ignore click events that had mousedown on the popup but mouseup on the container
5289 // This can happen when the user drags a slider
5290 handleModalMousedown(domCache);
5291
5292 // Ignore click events that had mousedown on the container but mouseup on the popup
5293 handleContainerMousedown(domCache);
5294 handleModalClick(innerParams, domCache, dismissWith);
5295 }
5296 };
5297
5298 /**
5299 * @param {SweetAlertOptions} innerParams
5300 * @param {DomCache} domCache
5301 * @param {(dismiss: DismissReason) => void} dismissWith
5302 */
5303 const handleToastClick = (innerParams, domCache, dismissWith) => {
5304 // Closing toast by internal click
5305 domCache.popup.onclick = () => {
5306 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {
5307 return;
5308 }
5309 dismissWith(DismissReason.close);
5310 };
5311 };
5312
5313 /**
5314 * @param {SweetAlertOptions} innerParams
5315 * @returns {boolean}
5316 */
5317 const isAnyButtonShown = innerParams => {
5318 return Boolean(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton);
5319 };
5320 let ignoreOutsideClick = false;
5321
5322 /**
5323 * @param {DomCache} domCache
5324 */
5325 const handleModalMousedown = domCache => {
5326 domCache.popup.onmousedown = () => {
5327 domCache.container.onmouseup = function (e) {
5328 domCache.container.onmouseup = () => {};
5329 // We only check if the mouseup target is the container because usually it doesn't
5330 // have any other direct children aside of the popup
5331 if (e.target === domCache.container) {
5332 ignoreOutsideClick = true;
5333 }
5334 };
5335 };
5336 };
5337
5338 /**
5339 * @param {DomCache} domCache
5340 */
5341 const handleContainerMousedown = domCache => {
5342 domCache.container.onmousedown = e => {
5343 // prevent the modal text from being selected on double click on the container (allowOutsideClick: false)
5344 if (e.target === domCache.container) {
5345 e.preventDefault();
5346 }
5347 domCache.popup.onmouseup = function (e) {
5348 domCache.popup.onmouseup = () => {};
5349 // We also need to check if the mouseup target is a child of the popup
5350 if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) {
5351 ignoreOutsideClick = true;
5352 }
5353 };
5354 };
5355 };
5356
5357 /**
5358 * @param {SweetAlertOptions} innerParams
5359 * @param {DomCache} domCache
5360 * @param {(dismiss: DismissReason) => void} dismissWith
5361 */
5362 const handleModalClick = (innerParams, domCache, dismissWith) => {
5363 domCache.container.onclick = e => {
5364 if (ignoreOutsideClick) {
5365 ignoreOutsideClick = false;
5366 return;
5367 }
5368 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {
5369 dismissWith(DismissReason.backdrop);
5370 }
5371 };
5372 };
5373
5374 /**
5375 * @param {unknown} elem
5376 * @returns {boolean}
5377 */
5378 const isJqueryElement = elem => typeof elem === 'object' && elem !== null && 'jquery' in elem;
5379
5380 /**
5381 * @param {unknown} elem
5382 * @returns {boolean}
5383 */
5384 const isElement = elem => elem instanceof Element || isJqueryElement(elem);
5385
5386 /**
5387 * @param {ReadonlyArray<unknown>} args
5388 * @returns {SweetAlertOptions}
5389 */
5390 const argsToParams = args => {
5391 /** @type {Record<string, unknown>} */
5392 const params = {};
5393 if (typeof args[0] === 'object' && !isElement(args[0])) {
5394 Object.assign(params, args[0]);
5395 } else {
5396 ['title', 'html', 'icon'].forEach((name, index) => {
5397 const arg = args[index];
5398 if (typeof arg === 'string' || isElement(arg)) {
5399 params[name] = arg;
5400 } else if (arg !== undefined) {
5401 error(`Unexpected type of ${name}! Expected "string" or "Element", got ${typeof arg}`);
5402 }
5403 });
5404 }
5405 return /** @type {SweetAlertOptions} */params;
5406 };
5407
5408 /**
5409 * Main method to create a new SweetAlert2 popup
5410 *
5411 * @this {new (...args: any[]) => any}
5412 * @param {...SweetAlertOptions} args
5413 * @returns {Promise<SweetAlertResult>}
5414 */
5415 function fire(...args) {
5416 return new this(...args);
5417 }
5418
5419 /**
5420 * Returns an extended version of `Swal` containing `params` as defaults.
5421 * Useful for reusing Swal configuration.
5422 *
5423 * For example:
5424 *
5425 * Before:
5426 * const textPromptOptions = { input: 'text', showCancelButton: true }
5427 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })
5428 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })
5429 *
5430 * After:
5431 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })
5432 * const {value: firstName} = await TextPrompt('What is your first name?')
5433 * const {value: lastName} = await TextPrompt('What is your last name?')
5434 *
5435 * @param {SweetAlertOptions} mixinParams
5436 * @returns {SweetAlert}
5437 * @this {typeof import('../SweetAlert.js').SweetAlert}
5438 */
5439 function mixin(mixinParams) {
5440 // @ts-ignore: 'this' refers to the SweetAlert constructor
5441 class MixinSwal extends this {
5442 /**
5443 * @param {any} params
5444 * @param {any} priorityMixinParams
5445 */
5446 _main(params, priorityMixinParams) {
5447 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams));
5448 }
5449 }
5450 // @ts-ignore
5451 return MixinSwal;
5452 }
5453
5454 /**
5455 * If `timer` parameter is set, returns number of milliseconds of timer remained.
5456 * Otherwise, returns undefined.
5457 *
5458 * @returns {number | undefined}
5459 */
5460 const getTimerLeft = () => {
5461 return globalState.timeout && globalState.timeout.getTimerLeft();
5462 };
5463
5464 /**
5465 * Stop timer. Returns number of milliseconds of timer remained.
5466 * If `timer` parameter isn't set, returns undefined.
5467 *
5468 * @returns {number | undefined}
5469 */
5470 const stopTimer = () => {
5471 if (globalState.timeout) {
5472 stopTimerProgressBar();
5473 return globalState.timeout.stop();
5474 }
5475 };
5476
5477 /**
5478 * Resume timer. Returns number of milliseconds of timer remained.
5479 * If `timer` parameter isn't set, returns undefined.
5480 *
5481 * @returns {number | undefined}
5482 */
5483 const resumeTimer = () => {
5484 if (globalState.timeout) {
5485 const remaining = globalState.timeout.start();
5486 animateTimerProgressBar(remaining);
5487 return remaining;
5488 }
5489 };
5490
5491 /**
5492 * Resume timer. Returns number of milliseconds of timer remained.
5493 * If `timer` parameter isn't set, returns undefined.
5494 *
5495 * @returns {number | undefined}
5496 */
5497 const toggleTimer = () => {
5498 const timer = globalState.timeout;
5499 return timer && (timer.running ? stopTimer() : resumeTimer());
5500 };
5501
5502 /**
5503 * Increase timer. Returns number of milliseconds of an updated timer.
5504 * If `timer` parameter isn't set, returns undefined.
5505 *
5506 * @param {number} ms
5507 * @returns {number | undefined}
5508 */
5509 const increaseTimer = ms => {
5510 if (globalState.timeout) {
5511 const remaining = globalState.timeout.increase(ms);
5512 animateTimerProgressBar(remaining, true);
5513 return remaining;
5514 }
5515 };
5516
5517 /**
5518 * Check if timer is running. Returns true if timer is running
5519 * or false if timer is paused or stopped.
5520 * If `timer` parameter isn't set, returns undefined
5521 *
5522 * @returns {boolean}
5523 */
5524 const isTimerRunning = () => {
5525 return Boolean(globalState.timeout && globalState.timeout.isRunning());
5526 };
5527
5528 let bodyClickListenerAdded = false;
5529 /** @type {Record<string, any>} */
5530 const clickHandlers = {};
5531
5532 /**
5533 * @this {any}
5534 * @param {string} attr
5535 */
5536 function bindClickHandler(attr = 'data-swal-template') {
5537 clickHandlers[attr] = this;
5538 if (!bodyClickListenerAdded) {
5539 document.body.addEventListener('click', bodyClickListener);
5540 bodyClickListenerAdded = true;
5541 }
5542 }
5543
5544 /**
5545 * @param {MouseEvent} event
5546 */
5547 const bodyClickListener = event => {
5548 for (let el = /** @type {any} */event.target; el && el !== document; el = el.parentNode) {
5549 for (const attr in clickHandlers) {
5550 const template = el.getAttribute && el.getAttribute(attr);
5551 if (template) {
5552 clickHandlers[attr].fire({
5553 template
5554 });
5555 return;
5556 }
5557 }
5558 }
5559 };
5560
5561 // Source: https://gist.github.com/mudge/5830382?permalink_comment_id=2691957#gistcomment-2691957
5562
5563 class EventEmitter {
5564 constructor() {
5565 /** @type {Events} */
5566 this.events = {};
5567 }
5568
5569 /**
5570 * @param {string} eventName
5571 * @returns {EventHandlers}
5572 */
5573 _getHandlersByEventName(eventName) {
5574 if (typeof this.events[eventName] === 'undefined') {
5575 // not Set because we need to keep the FIFO order
5576 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1748990334
5577 this.events[eventName] = [];
5578 }
5579 return this.events[eventName];
5580 }
5581
5582 /**
5583 * @param {string} eventName
5584 * @param {EventHandler} eventHandler
5585 */
5586 on(eventName, eventHandler) {
5587 const currentHandlers = this._getHandlersByEventName(eventName);
5588 if (!currentHandlers.includes(eventHandler)) {
5589 currentHandlers.push(eventHandler);
5590 }
5591 }
5592
5593 /**
5594 * @param {string} eventName
5595 * @param {EventHandler} eventHandler
5596 */
5597 once(eventName, eventHandler) {
5598 /**
5599 * @param {...any} args
5600 */
5601 const onceFn = (...args) => {
5602 this.removeListener(eventName, onceFn);
5603 // @ts-ignore
5604 eventHandler.apply(this, args);
5605 };
5606 this.on(eventName, onceFn);
5607 }
5608
5609 /**
5610 * @param {string} eventName
5611 * @param {...any} args
5612 */
5613 emit(eventName, ...args) {
5614 this._getHandlersByEventName(eventName).forEach(
5615 /**
5616 * @param {EventHandler} eventHandler
5617 */
5618 eventHandler => {
5619 try {
5620 // @ts-ignore
5621 eventHandler.apply(this, args);
5622 } catch (error) {
5623 console.error(error);
5624 }
5625 });
5626 }
5627
5628 /**
5629 * @param {string} eventName
5630 * @param {EventHandler} eventHandler
5631 */
5632 removeListener(eventName, eventHandler) {
5633 const currentHandlers = this._getHandlersByEventName(eventName);
5634 const index = currentHandlers.indexOf(eventHandler);
5635 if (index > -1) {
5636 currentHandlers.splice(index, 1);
5637 }
5638 }
5639
5640 /**
5641 * @param {string} eventName
5642 */
5643 removeAllListeners(eventName) {
5644 if (this.events[eventName] !== undefined) {
5645 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1749239222
5646 this.events[eventName].length = 0;
5647 }
5648 }
5649 reset() {
5650 this.events = {};
5651 }
5652 }
5653
5654 globalState.eventEmitter = new EventEmitter();
5655
5656 /**
5657 * @param {string} eventName
5658 * @param {EventHandler} eventHandler
5659 */
5660 const on = (eventName, eventHandler) => {
5661 if (globalState.eventEmitter) {
5662 globalState.eventEmitter.on(eventName, eventHandler);
5663 }
5664 };
5665
5666 /**
5667 * @param {string} eventName
5668 * @param {EventHandler} eventHandler
5669 */
5670 const once = (eventName, eventHandler) => {
5671 if (globalState.eventEmitter) {
5672 globalState.eventEmitter.once(eventName, eventHandler);
5673 }
5674 };
5675
5676 /**
5677 * @param {string} [eventName]
5678 * @param {EventHandler} [eventHandler]
5679 */
5680 const off = (eventName, eventHandler) => {
5681 if (!globalState.eventEmitter) {
5682 return;
5683 }
5684
5685 // Remove all handlers for all events
5686 if (!eventName) {
5687 globalState.eventEmitter.reset();
5688 return;
5689 }
5690 if (eventHandler) {
5691 // Remove a specific handler
5692 globalState.eventEmitter.removeListener(eventName, eventHandler);
5693 } else {
5694 // Remove all handlers for a specific event
5695 globalState.eventEmitter.removeAllListeners(eventName);
5696 }
5697 };
5698
5699 var staticMethods = /*#__PURE__*/Object.freeze({
5700 __proto__: null,
5701 argsToParams: argsToParams,
5702 bindClickHandler: bindClickHandler,
5703 clickCancel: clickCancel,
5704 clickConfirm: clickConfirm,
5705 clickDeny: clickDeny,
5706 enableLoading: showLoading,
5707 fire: fire,
5708 getActions: getActions,
5709 getCancelButton: getCancelButton,
5710 getCloseButton: getCloseButton,
5711 getConfirmButton: getConfirmButton,
5712 getContainer: getContainer,
5713 getDenyButton: getDenyButton,
5714 getFocusableElements: getFocusableElements,
5715 getFooter: getFooter,
5716 getHtmlContainer: getHtmlContainer,
5717 getIcon: getIcon,
5718 getIconContent: getIconContent,
5719 getImage: getImage,
5720 getInputLabel: getInputLabel,
5721 getLoader: getLoader,
5722 getPopup: getPopup,
5723 getProgressSteps: getProgressSteps,
5724 getTimerLeft: getTimerLeft,
5725 getTimerProgressBar: getTimerProgressBar,
5726 getTitle: getTitle,
5727 getValidationMessage: getValidationMessage,
5728 increaseTimer: increaseTimer,
5729 isDeprecatedParameter: isDeprecatedParameter,
5730 isLoading: isLoading,
5731 isTimerRunning: isTimerRunning,
5732 isUpdatableParameter: isUpdatableParameter,
5733 isValidParameter: isValidParameter,
5734 isVisible: isVisible,
5735 mixin: mixin,
5736 off: off,
5737 on: on,
5738 once: once,
5739 resumeTimer: resumeTimer,
5740 showLoading: showLoading,
5741 stopTimer: stopTimer,
5742 toggleTimer: toggleTimer
5743 });
5744
5745 class Timer {
5746 /**
5747 * @param {() => void} callback
5748 * @param {number} delay
5749 */
5750 constructor(callback, delay) {
5751 this.callback = callback;
5752 this.remaining = delay;
5753 this.running = false;
5754 this.start();
5755 }
5756
5757 /**
5758 * @returns {number}
5759 */
5760 start() {
5761 if (!this.running) {
5762 this.running = true;
5763 this.started = new Date();
5764 this.id = setTimeout(this.callback, this.remaining);
5765 }
5766 return this.remaining;
5767 }
5768
5769 /**
5770 * @returns {number}
5771 */
5772 stop() {
5773 if (this.started && this.running) {
5774 this.running = false;
5775 clearTimeout(this.id);
5776 this.remaining -= new Date().getTime() - this.started.getTime();
5777 }
5778 return this.remaining;
5779 }
5780
5781 /**
5782 * @param {number} n
5783 * @returns {number}
5784 */
5785 increase(n) {
5786 const running = this.running;
5787 if (running) {
5788 this.stop();
5789 }
5790 this.remaining += n;
5791 if (running) {
5792 this.start();
5793 }
5794 return this.remaining;
5795 }
5796
5797 /**
5798 * @returns {number}
5799 */
5800 getTimerLeft() {
5801 if (this.running) {
5802 this.stop();
5803 this.start();
5804 }
5805 return this.remaining;
5806 }
5807
5808 /**
5809 * @returns {boolean}
5810 */
5811 isRunning() {
5812 return this.running;
5813 }
5814 }
5815
5816 const swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];
5817
5818 /**
5819 * @param {SweetAlertOptions} params
5820 * @returns {SweetAlertOptions}
5821 */
5822 const getTemplateParams = params => {
5823 const template = typeof params.template === 'string' ? (/** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template;
5824 if (!template) {
5825 return {};
5826 }
5827 /** @type {DocumentFragment} */
5828 const templateContent = template.content;
5829 showWarningsForElements(templateContent);
5830 const result = Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));
5831 return result;
5832 };
5833
5834 /**
5835 * @param {DocumentFragment} templateContent
5836 * @returns {Record<string, string | boolean | number>}
5837 */
5838 const getSwalParams = templateContent => {
5839 /** @type {Record<string, string | boolean | number>} */
5840 const result = {};
5841 /** @type {HTMLElement[]} */
5842 const swalParams = Array.from(templateContent.querySelectorAll('swal-param'));
5843 swalParams.forEach(param => {
5844 showWarningsForAttributes(param, ['name', 'value']);
5845 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
5846 const value = param.getAttribute('value');
5847 if (!paramName || !value) {
5848 return;
5849 }
5850 if (paramName in defaultParams && typeof defaultParams[(/** @type {keyof typeof defaultParams} */paramName)] === 'boolean') {
5851 result[paramName] = value !== 'false';
5852 } else if (paramName in defaultParams && typeof defaultParams[(/** @type {keyof typeof defaultParams} */paramName)] === 'object') {
5853 result[paramName] = JSON.parse(value);
5854 } else {
5855 result[paramName] = value;
5856 }
5857 });
5858 return result;
5859 };
5860
5861 /**
5862 * @param {DocumentFragment} templateContent
5863 * @returns {Record<string, () => void>}
5864 */
5865 const getSwalFunctionParams = templateContent => {
5866 /** @type {Record<string, () => void>} */
5867 const result = {};
5868 /** @type {HTMLElement[]} */
5869 const swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));
5870 swalFunctions.forEach(param => {
5871 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
5872 const value = param.getAttribute('value');
5873 if (!paramName || !value) {
5874 return;
5875 }
5876 result[paramName] = new Function(`return ${value}`)();
5877 });
5878 return result;
5879 };
5880
5881 /**
5882 * @param {DocumentFragment} templateContent
5883 * @returns {Record<string, string | boolean>}
5884 */
5885 const getSwalButtons = templateContent => {
5886 /** @type {Record<string, string | boolean>} */
5887 const result = {};
5888 /** @type {HTMLElement[]} */
5889 const swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));
5890 swalButtons.forEach(button => {
5891 showWarningsForAttributes(button, ['type', 'color', 'aria-label']);
5892 const type = button.getAttribute('type');
5893 if (!type || !['confirm', 'cancel', 'deny'].includes(type)) {
5894 return;
5895 }
5896 result[`${type}ButtonText`] = button.innerHTML;
5897 result[`show${capitalizeFirstLetter(type)}Button`] = true;
5898 const color = button.getAttribute('color');
5899 if (color !== null) {
5900 result[`${type}ButtonColor`] = color;
5901 }
5902 const ariaLabel = button.getAttribute('aria-label');
5903 if (ariaLabel !== null) {
5904 result[`${type}ButtonAriaLabel`] = ariaLabel;
5905 }
5906 });
5907 return result;
5908 };
5909
5910 /**
5911 * @param {DocumentFragment} templateContent
5912 * @returns {Pick<SweetAlertOptions, 'imageUrl' | 'imageWidth' | 'imageHeight' | 'imageAlt'>}
5913 */
5914 const getSwalImage = templateContent => {
5915 const result = {};
5916 /** @type {HTMLElement | null} */
5917 const image = templateContent.querySelector('swal-image');
5918 if (image) {
5919 showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);
5920 // getAttribute returns null if attribute is absent; `|| undefined` converts empty string to undefined
5921 const src = image.getAttribute('src');
5922 if (src !== null) result.imageUrl = src || undefined;
5923 const width = image.getAttribute('width');
5924 if (width !== null) result.imageWidth = width || undefined;
5925 const height = image.getAttribute('height');
5926 if (height !== null) result.imageHeight = height || undefined;
5927 const alt = image.getAttribute('alt');
5928 if (alt !== null) result.imageAlt = alt || undefined;
5929 }
5930 return result;
5931 };
5932
5933 /**
5934 * @param {DocumentFragment} templateContent
5935 * @returns {object}
5936 */
5937 const getSwalIcon = templateContent => {
5938 const result = {};
5939 /** @type {HTMLElement | null} */
5940 const icon = templateContent.querySelector('swal-icon');
5941 if (icon) {
5942 showWarningsForAttributes(icon, ['type', 'color']);
5943 if (icon.hasAttribute('type')) {
5944 result.icon = icon.getAttribute('type');
5945 }
5946 if (icon.hasAttribute('color')) {
5947 result.iconColor = icon.getAttribute('color');
5948 }
5949 result.iconHtml = icon.innerHTML;
5950 }
5951 return result;
5952 };
5953
5954 /**
5955 * @param {DocumentFragment} templateContent
5956 * @returns {object}
5957 */
5958 const getSwalInput = templateContent => {
5959 /** @type {Record<string, any>} */
5960 const result = {};
5961 /** @type {HTMLElement | null} */
5962 const input = templateContent.querySelector('swal-input');
5963 if (input) {
5964 showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);
5965 result.input = input.getAttribute('type') || 'text';
5966 if (input.hasAttribute('label')) {
5967 result.inputLabel = input.getAttribute('label');
5968 }
5969 if (input.hasAttribute('placeholder')) {
5970 result.inputPlaceholder = input.getAttribute('placeholder');
5971 }
5972 if (input.hasAttribute('value')) {
5973 result.inputValue = input.getAttribute('value');
5974 }
5975 }
5976 /** @type {HTMLElement[]} */
5977 const inputOptions = Array.from(templateContent.querySelectorAll('swal-input-option'));
5978 if (inputOptions.length) {
5979 result.inputOptions = {};
5980 inputOptions.forEach(option => {
5981 showWarningsForAttributes(option, ['value']);
5982 const optionValue = option.getAttribute('value');
5983 if (!optionValue) {
5984 return;
5985 }
5986 const optionName = option.innerHTML;
5987 result.inputOptions[optionValue] = optionName;
5988 });
5989 }
5990 return result;
5991 };
5992
5993 /**
5994 * @param {DocumentFragment} templateContent
5995 * @param {string[]} paramNames
5996 * @returns {Record<string, string>}
5997 */
5998 const getSwalStringParams = (templateContent, paramNames) => {
5999 /** @type {Record<string, string>} */
6000 const result = {};
6001 for (const i in paramNames) {
6002 const paramName = paramNames[i];
6003 /** @type {HTMLElement | null} */
6004 const tag = templateContent.querySelector(paramName);
6005 if (tag) {
6006 showWarningsForAttributes(tag, []);
6007 result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();
6008 }
6009 }
6010 return result;
6011 };
6012
6013 /**
6014 * @param {DocumentFragment} templateContent
6015 */
6016 const showWarningsForElements = templateContent => {
6017 const allowedElements = swalStringParams.concat(['swal-param', 'swal-function-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);
6018 Array.from(templateContent.children).forEach(el => {
6019 const tagName = el.tagName.toLowerCase();
6020 if (!allowedElements.includes(tagName)) {
6021 warn(`Unrecognized element <${tagName}>`);
6022 }
6023 });
6024 };
6025
6026 /**
6027 * @param {HTMLElement} el
6028 * @param {string[]} allowedAttributes
6029 */
6030 const showWarningsForAttributes = (el, allowedAttributes) => {
6031 Array.from(el.attributes).forEach(attribute => {
6032 if (allowedAttributes.indexOf(attribute.name) === -1) {
6033 warn([`Unrecognized attribute "${attribute.name}" on <${el.tagName.toLowerCase()}>.`, `${allowedAttributes.length ? `Allowed attributes are: ${allowedAttributes.join(', ')}` : 'To set the value, use HTML within the element.'}`]);
6034 }
6035 });
6036 };
6037
6038 const SHOW_CLASS_TIMEOUT = 10;
6039
6040 /**
6041 * Open popup, add necessary classes and styles, fix scrollbar
6042 *
6043 * @param {SweetAlertOptions} params
6044 */
6045 const openPopup = params => {
6046 var _globalState$eventEmi, _globalState$eventEmi2;
6047 const container = getContainer();
6048 const popup = getPopup();
6049 if (!container || !popup) {
6050 return;
6051 }
6052 if (typeof params.willOpen === 'function') {
6053 params.willOpen(popup);
6054 }
6055 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('willOpen', popup);
6056 const bodyStyles = window.getComputedStyle(document.body);
6057 const initialBodyOverflow = bodyStyles.overflowY;
6058 addClasses(container, popup, params);
6059
6060 // scrolling is 'hidden' until animation is done, after that 'auto'
6061 setTimeout(() => {
6062 setScrollingVisibility(container, popup);
6063 }, SHOW_CLASS_TIMEOUT);
6064 if (isModal()) {
6065 fixScrollContainer(container, params.scrollbarPadding !== undefined ? params.scrollbarPadding : false, initialBodyOverflow);
6066 setAriaHidden();
6067 }
6068
6069 // https://github.com/sweetalert2/sweetalert2/issues/2923
6070 if (isIOS && params.backdrop === false && popup.scrollHeight > container.clientHeight) {
6071 // remove pointer-events: none from container, it breaks scrolling tall popups in iOS
6072 container.style.pointerEvents = 'auto';
6073 }
6074 if (!isToast() && !globalState.previousActiveElement) {
6075 globalState.previousActiveElement = document.activeElement;
6076 }
6077 if (typeof params.didOpen === 'function') {
6078 const didOpen = params.didOpen;
6079 setTimeout(() => didOpen(popup));
6080 }
6081 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit('didOpen', popup);
6082 };
6083
6084 /**
6085 * @param {Event} event
6086 */
6087 const swalOpenAnimationFinished = event => {
6088 const popup = getPopup();
6089 if (!popup || event.target !== popup) {
6090 return;
6091 }
6092 const container = getContainer();
6093 if (!container) {
6094 return;
6095 }
6096 popup.removeEventListener('animationend', swalOpenAnimationFinished);
6097 popup.removeEventListener('transitionend', swalOpenAnimationFinished);
6098 container.style.overflowY = 'auto';
6099
6100 // no-transition is added in init() in case one swal is opened right after another
6101 removeClass(container, swalClasses['no-transition']);
6102 };
6103
6104 /**
6105 * @param {HTMLElement} container
6106 * @param {HTMLElement} popup
6107 */
6108 const setScrollingVisibility = (container, popup) => {
6109 if (hasCssAnimation(popup)) {
6110 container.style.overflowY = 'hidden';
6111 popup.addEventListener('animationend', swalOpenAnimationFinished);
6112 popup.addEventListener('transitionend', swalOpenAnimationFinished);
6113 } else {
6114 container.style.overflowY = 'auto';
6115 }
6116 };
6117
6118 /**
6119 * @param {HTMLElement} container
6120 * @param {boolean} scrollbarPadding
6121 * @param {string} initialBodyOverflow
6122 */
6123 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => {
6124 iOSfix();
6125 if (scrollbarPadding && initialBodyOverflow !== 'hidden') {
6126 replaceScrollbarWithPadding(initialBodyOverflow);
6127 }
6128
6129 // sweetalert2/issues/1247
6130 setTimeout(() => {
6131 container.scrollTop = 0;
6132 });
6133 };
6134
6135 /**
6136 * @param {HTMLElement} container
6137 * @param {HTMLElement} popup
6138 * @param {SweetAlertOptions} params
6139 */
6140 const addClasses = (container, popup, params) => {
6141 var _params$showClass;
6142 if ((_params$showClass = params.showClass) !== null && _params$showClass !== void 0 && _params$showClass.backdrop) {
6143 addClass(container, params.showClass.backdrop);
6144 }
6145 if (params.animation) {
6146 // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059
6147 popup.style.setProperty('opacity', '0', 'important');
6148 show(popup, 'grid');
6149 setTimeout(() => {
6150 var _params$showClass2;
6151 // Animate popup right after showing it
6152 if ((_params$showClass2 = params.showClass) !== null && _params$showClass2 !== void 0 && _params$showClass2.popup) {
6153 addClass(popup, params.showClass.popup);
6154 }
6155 // and remove the opacity workaround
6156 popup.style.removeProperty('opacity');
6157 }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062
6158 } else {
6159 show(popup, 'grid');
6160 }
6161 addClass([document.documentElement, document.body], swalClasses.shown);
6162 if (params.heightAuto && params.backdrop && !params.toast) {
6163 addClass([document.documentElement, document.body], swalClasses['height-auto']);
6164 }
6165 };
6166
6167 var defaultInputValidators = {
6168 /**
6169 * @param {string} string
6170 * @param {string} [validationMessage]
6171 * @returns {Promise<string | void>}
6172 */
6173 email: (string, validationMessage) => {
6174 return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');
6175 },
6176 /**
6177 * @param {string} string
6178 * @param {string} [validationMessage]
6179 * @returns {Promise<string | void>}
6180 */
6181 url: (string, validationMessage) => {
6182 // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013
6183 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');
6184 }
6185 };
6186
6187 /**
6188 * @param {SweetAlertOptions} params
6189 */
6190 function setDefaultInputValidators(params) {
6191 // Use default `inputValidator` for supported input types if not provided
6192 if (params.inputValidator) {
6193 return;
6194 }
6195 if (params.input === 'email') {
6196 params.inputValidator = defaultInputValidators['email'];
6197 }
6198 if (params.input === 'url') {
6199 params.inputValidator = defaultInputValidators['url'];
6200 }
6201 }
6202
6203 /**
6204 * @param {SweetAlertOptions} params
6205 */
6206 function validateCustomTargetElement(params) {
6207 // Determine if the custom target element is valid
6208 if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {
6209 warn('Target parameter is not valid, defaulting to "body"');
6210 params.target = 'body';
6211 }
6212 }
6213
6214 /**
6215 * Set type, text and actions on popup
6216 *
6217 * @param {SweetAlertOptions} params
6218 */
6219 function setParameters(params) {
6220 setDefaultInputValidators(params);
6221
6222 // showLoaderOnConfirm && preConfirm
6223 if (params.showLoaderOnConfirm && !params.preConfirm) {
6224 warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request');
6225 }
6226 validateCustomTargetElement(params);
6227
6228 // Replace newlines with <br> in title
6229 if (typeof params.title === 'string') {
6230 params.title = params.title.split('\n').join('<br />');
6231 }
6232 init(params);
6233 }
6234
6235 /** @type {SweetAlert} */
6236 let currentInstance;
6237 var _promise = /*#__PURE__*/new WeakMap();
6238 class SweetAlert {
6239 /**
6240 * @param {...(SweetAlertOptions | string)} args
6241 * @this {SweetAlert}
6242 */
6243 constructor(...args) {
6244 /**
6245 * @type {Promise<SweetAlertResult>}
6246 */
6247 _classPrivateFieldInitSpec(this, _promise, /** @type {Promise<SweetAlertResult>} */
6248 Promise.resolve({
6249 isConfirmed: false,
6250 isDenied: false,
6251 isDismissed: true
6252 }));
6253 // Prevent run in Node env
6254 if (typeof window === 'undefined') {
6255 return;
6256 }
6257 currentInstance = this;
6258
6259 // @ts-ignore
6260 const outerParams = Object.freeze(this.constructor.argsToParams(args));
6261
6262 /** @type {Readonly<SweetAlertOptions>} */
6263 this.params = outerParams;
6264
6265 /** @type {boolean} */
6266 this.isAwaitingPromise = false;
6267 _classPrivateFieldSet2(_promise, this, this._main(currentInstance.params));
6268 }
6269
6270 /**
6271 * @param {any} userParams
6272 * @param {any} mixinParams
6273 */
6274 _main(userParams, mixinParams = {}) {
6275 showWarningsForParams(Object.assign({}, mixinParams, userParams));
6276 if (globalState.currentInstance) {
6277 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(globalState.currentInstance);
6278 const {
6279 isAwaitingPromise
6280 } = globalState.currentInstance;
6281 globalState.currentInstance._destroy();
6282 if (!isAwaitingPromise) {
6283 swalPromiseResolve({
6284 isDismissed: true
6285 });
6286 }
6287 if (isModal()) {
6288 unsetAriaHidden();
6289 }
6290 }
6291 globalState.currentInstance = currentInstance;
6292 const innerParams = prepareParams(userParams, mixinParams);
6293 setParameters(innerParams);
6294 Object.freeze(innerParams);
6295
6296 // clear the previous timer
6297 if (globalState.timeout) {
6298 globalState.timeout.stop();
6299 delete globalState.timeout;
6300 }
6301
6302 // clear the restore focus timeout
6303 clearTimeout(globalState.restoreFocusTimeout);
6304 const domCache = populateDomCache(currentInstance);
6305 render(currentInstance, innerParams);
6306 privateProps.innerParams.set(currentInstance, innerParams);
6307 return swalPromise(currentInstance, domCache, innerParams);
6308 }
6309
6310 // `catch` cannot be the name of a module export, so we define our thenable methods here instead
6311 /**
6312 * @param {any} onFulfilled
6313 */
6314 // oxlint-disable-next-line unicorn/no-thenable
6315 then(onFulfilled) {
6316 return _classPrivateFieldGet2(_promise, this).then(onFulfilled);
6317 }
6318
6319 /**
6320 * @param {any} onFinally
6321 */
6322 finally(onFinally) {
6323 return _classPrivateFieldGet2(_promise, this).finally(onFinally);
6324 }
6325 }
6326
6327 /**
6328 * @param {SweetAlert} instance
6329 * @param {DomCache} domCache
6330 * @param {SweetAlertOptions} innerParams
6331 * @returns {Promise<SweetAlertResult>}
6332 */
6333 const swalPromise = (instance, domCache, innerParams) => {
6334 return new Promise((resolve, reject) => {
6335 // functions to handle all closings/dismissals
6336 /**
6337 * @param {DismissReason} dismiss
6338 */
6339 const dismissWith = dismiss => {
6340 instance.close({
6341 isDismissed: true,
6342 dismiss,
6343 isConfirmed: false,
6344 isDenied: false
6345 });
6346 };
6347 privateMethods.swalPromiseResolve.set(instance, resolve);
6348 privateMethods.swalPromiseReject.set(instance, reject);
6349 domCache.confirmButton.onclick = () => {
6350 handleConfirmButtonClick(instance);
6351 };
6352 domCache.denyButton.onclick = () => {
6353 handleDenyButtonClick(instance);
6354 };
6355 domCache.cancelButton.onclick = () => {
6356 handleCancelButtonClick(instance, dismissWith);
6357 };
6358 domCache.closeButton.onclick = () => {
6359 dismissWith(DismissReason.close);
6360 };
6361 handlePopupClick(innerParams, domCache, dismissWith);
6362 addKeydownHandler(globalState, innerParams, dismissWith);
6363 handleInputOptionsAndValue(instance, innerParams);
6364 openPopup(innerParams);
6365 setupTimer(globalState, innerParams, dismissWith);
6366 initFocus(domCache, innerParams);
6367
6368 // Scroll container to top on open (#1247, #1946)
6369 setTimeout(() => {
6370 domCache.container.scrollTop = 0;
6371 });
6372 });
6373 };
6374
6375 /**
6376 * @param {SweetAlertOptions} userParams
6377 * @param {SweetAlertOptions} mixinParams
6378 * @returns {SweetAlertOptions}
6379 */
6380 const prepareParams = (userParams, mixinParams) => {
6381 const templateParams = getTemplateParams(userParams);
6382 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131
6383 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);
6384 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);
6385 if (params.animation === false) {
6386 params.showClass = {
6387 backdrop: 'swal2-noanimation'
6388 };
6389 params.hideClass = {};
6390 }
6391 return params;
6392 };
6393
6394 /**
6395 * @param {SweetAlert} instance
6396 * @returns {DomCache}
6397 */
6398 const populateDomCache = instance => {
6399 const domCache = /** @type {DomCache} */{
6400 popup: (/** @type {HTMLElement} */getPopup()),
6401 container: (/** @type {HTMLElement} */getContainer()),
6402 actions: (/** @type {HTMLElement} */getActions()),
6403 confirmButton: (/** @type {HTMLElement} */getConfirmButton()),
6404 denyButton: (/** @type {HTMLElement} */getDenyButton()),
6405 cancelButton: (/** @type {HTMLElement} */getCancelButton()),
6406 loader: (/** @type {HTMLElement} */getLoader()),
6407 closeButton: (/** @type {HTMLElement} */getCloseButton()),
6408 validationMessage: (/** @type {HTMLElement} */getValidationMessage()),
6409 progressSteps: (/** @type {HTMLElement} */getProgressSteps())
6410 };
6411 privateProps.domCache.set(instance, domCache);
6412 return domCache;
6413 };
6414
6415 /**
6416 * @param {GlobalState} globalState
6417 * @param {SweetAlertOptions} innerParams
6418 * @param {(dismiss: DismissReason) => void} dismissWith
6419 */
6420 const setupTimer = (globalState, innerParams, dismissWith) => {
6421 const timerProgressBar = getTimerProgressBar();
6422 hide(timerProgressBar);
6423 if (innerParams.timer) {
6424 globalState.timeout = new Timer(() => {
6425 dismissWith('timer');
6426 delete globalState.timeout;
6427 }, innerParams.timer);
6428 if (innerParams.timerProgressBar && timerProgressBar) {
6429 show(timerProgressBar);
6430 applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');
6431 setTimeout(() => {
6432 if (globalState.timeout && globalState.timeout.running) {
6433 // timer can be already stopped or unset at this point
6434 animateTimerProgressBar(/** @type {number} */innerParams.timer);
6435 }
6436 });
6437 }
6438 }
6439 };
6440
6441 /**
6442 * Initialize focus in the popup:
6443 *
6444 * 1. If `toast` is `true`, don't steal focus from the document.
6445 * 2. Else if there is an [autofocus] element, focus it.
6446 * 3. Else if `focusConfirm` is `true` and confirm button is visible, focus it.
6447 * 4. Else if `focusDeny` is `true` and deny button is visible, focus it.
6448 * 5. Else if `focusCancel` is `true` and cancel button is visible, focus it.
6449 * 6. Else focus the first focusable element in a popup (if any).
6450 *
6451 * @param {DomCache} domCache
6452 * @param {SweetAlertOptions} innerParams
6453 */
6454 const initFocus = (domCache, innerParams) => {
6455 if (innerParams.toast) {
6456 return;
6457 }
6458 // TODO: this is dumb, remove `allowEnterKey` param in the next major version
6459 if (!callIfFunction(innerParams.allowEnterKey)) {
6460 warnAboutDeprecation('allowEnterKey', 'preConfirm: () => false');
6461 domCache.popup.focus();
6462 return;
6463 }
6464 if (focusAutofocus(domCache)) {
6465 return;
6466 }
6467 if (focusButton(domCache, innerParams)) {
6468 return;
6469 }
6470 setFocus(-1, 1);
6471 };
6472
6473 /**
6474 * @param {DomCache} domCache
6475 * @returns {boolean}
6476 */
6477 const focusAutofocus = domCache => {
6478 const autofocusElements = Array.from(domCache.popup.querySelectorAll('[autofocus]'));
6479 for (const autofocusElement of autofocusElements) {
6480 if (autofocusElement instanceof HTMLElement && isVisible$1(autofocusElement)) {
6481 autofocusElement.focus();
6482 return true;
6483 }
6484 }
6485 return false;
6486 };
6487
6488 /**
6489 * @param {DomCache} domCache
6490 * @param {SweetAlertOptions} innerParams
6491 * @returns {boolean}
6492 */
6493 const focusButton = (domCache, innerParams) => {
6494 if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) {
6495 domCache.denyButton.focus();
6496 return true;
6497 }
6498 if (innerParams.focusCancel && isVisible$1(domCache.cancelButton)) {
6499 domCache.cancelButton.focus();
6500 return true;
6501 }
6502 if (innerParams.focusConfirm && isVisible$1(domCache.confirmButton)) {
6503 domCache.confirmButton.focus();
6504 return true;
6505 }
6506 return false;
6507 };
6508
6509 // Assign instance methods from src/instanceMethods/*.js to prototype
6510 SweetAlert.prototype.disableButtons = disableButtons;
6511 SweetAlert.prototype.enableButtons = enableButtons;
6512 SweetAlert.prototype.getInput = getInput;
6513 SweetAlert.prototype.disableInput = disableInput;
6514 SweetAlert.prototype.enableInput = enableInput;
6515 SweetAlert.prototype.hideLoading = hideLoading;
6516 SweetAlert.prototype.disableLoading = hideLoading;
6517 SweetAlert.prototype.showValidationMessage = showValidationMessage;
6518 SweetAlert.prototype.resetValidationMessage = resetValidationMessage;
6519 SweetAlert.prototype.close = close;
6520 SweetAlert.prototype.closePopup = close;
6521 SweetAlert.prototype.closeModal = close;
6522 SweetAlert.prototype.closeToast = close;
6523 SweetAlert.prototype.rejectPromise = rejectPromise;
6524 SweetAlert.prototype.update = update;
6525 SweetAlert.prototype._destroy = _destroy;
6526
6527 // Assign static methods from src/staticMethods/*.js to constructor
6528 Object.assign(SweetAlert, staticMethods);
6529
6530 // Proxy to instance methods to constructor, for now, for backwards compatibility
6531 Object.keys(instanceMethods).forEach(key => {
6532 /**
6533 * @param {...(SweetAlertOptions | string | undefined)} args
6534 * @returns {SweetAlertResult | Promise<SweetAlertResult> | undefined}
6535 */
6536 // @ts-ignore: Dynamic property assignment for backwards compatibility
6537 SweetAlert[key] = function (...args) {
6538 // @ts-ignore
6539 if (currentInstance && currentInstance[key]) {
6540 // @ts-ignore
6541 return currentInstance[key](...args);
6542 }
6543 return undefined;
6544 };
6545 });
6546 SweetAlert.DismissReason = DismissReason;
6547 SweetAlert.version = '11.26.25';
6548
6549 const Swal = SweetAlert;
6550 // @ts-ignore
6551 Swal.default = Swal;
6552
6553 return Swal;
6554
6555 }));
6556 if (typeof this !== 'undefined' && this.Sweetalert2){this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}
6557 "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,":root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.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:auto}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}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}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}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:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}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)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);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) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}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:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}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:var(--swal2-action-button-transition);border:none;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):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}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 var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}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:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);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:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}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:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);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):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}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:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}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:var(--swal2-background)}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:var(--swal2-input-background);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:var(--swal2-input-background);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:var(--swal2-background);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:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);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:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}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;zoom:var(--swal2-icon-zoom);border:.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:#f8bb86;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:#3fc3ee;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:#87adbd;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;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:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.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}.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;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:auto}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.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-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.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-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-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);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}}@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}}");
6558
6559 /***/ },
6560
6561 /***/ "./node_modules/toastify-js/src/toastify.js"
6562 /*!**************************************************!*\
6563 !*** ./node_modules/toastify-js/src/toastify.js ***!
6564 \**************************************************/
6565 (module) {
6566
6567 /*!
6568 * Toastify js 1.12.0
6569 * https://github.com/apvarun/toastify-js
6570 * @license MIT licensed
6571 *
6572 * Copyright (C) 2018 Varun A P
6573 */
6574 (function(root, factory) {
6575 if ( true && module.exports) {
6576 module.exports = factory();
6577 } else {
6578 root.Toastify = factory();
6579 }
6580 })(this, function(global) {
6581 // Object initialization
6582 var Toastify = function(options) {
6583 // Returning a new init object
6584 return new Toastify.lib.init(options);
6585 },
6586 // Library version
6587 version = "1.12.0";
6588
6589 // Set the default global options
6590 Toastify.defaults = {
6591 oldestFirst: true,
6592 text: "Toastify is awesome!",
6593 node: undefined,
6594 duration: 3000,
6595 selector: undefined,
6596 callback: function () {
6597 },
6598 destination: undefined,
6599 newWindow: false,
6600 close: false,
6601 gravity: "toastify-top",
6602 positionLeft: false,
6603 position: '',
6604 backgroundColor: '',
6605 avatar: "",
6606 className: "",
6607 stopOnFocus: true,
6608 onClick: function () {
6609 },
6610 offset: {x: 0, y: 0},
6611 escapeMarkup: true,
6612 ariaLive: 'polite',
6613 style: {background: ''}
6614 };
6615
6616 // Defining the prototype of the object
6617 Toastify.lib = Toastify.prototype = {
6618 toastify: version,
6619
6620 constructor: Toastify,
6621
6622 // Initializing the object with required parameters
6623 init: function(options) {
6624 // Verifying and validating the input object
6625 if (!options) {
6626 options = {};
6627 }
6628
6629 // Creating the options object
6630 this.options = {};
6631
6632 this.toastElement = null;
6633
6634 // Validating the options
6635 this.options.text = options.text || Toastify.defaults.text; // Display message
6636 this.options.node = options.node || Toastify.defaults.node; // Display content as node
6637 this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration
6638 this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector
6639 this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display
6640 this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination
6641 this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window
6642 this.options.close = options.close || Toastify.defaults.close; // Show toast close icon
6643 this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom
6644 this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right
6645 this.options.position = options.position || Toastify.defaults.position; // toast position - left or right
6646 this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color
6647 this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path
6648 this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast
6649 this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus
6650 this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click
6651 this.options.offset = options.offset || Toastify.defaults.offset; // toast offset
6652 this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup;
6653 this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive;
6654 this.options.style = options.style || Toastify.defaults.style;
6655 if(options.backgroundColor) {
6656 this.options.style.background = options.backgroundColor;
6657 }
6658
6659 // Returning the current object for chaining functions
6660 return this;
6661 },
6662
6663 // Building the DOM element
6664 buildToast: function() {
6665 // Validating if the options are defined
6666 if (!this.options) {
6667 throw "Toastify is not initialized";
6668 }
6669
6670 // Creating the DOM object
6671 var divElement = document.createElement("div");
6672 divElement.className = "toastify on " + this.options.className;
6673
6674 // Positioning toast to left or right or center
6675 if (!!this.options.position) {
6676 divElement.className += " toastify-" + this.options.position;
6677 } else {
6678 // To be depreciated in further versions
6679 if (this.options.positionLeft === true) {
6680 divElement.className += " toastify-left";
6681 console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.')
6682 } else {
6683 // Default position
6684 divElement.className += " toastify-right";
6685 }
6686 }
6687
6688 // Assigning gravity of element
6689 divElement.className += " " + this.options.gravity;
6690
6691 if (this.options.backgroundColor) {
6692 // This is being deprecated in favor of using the style HTML DOM property
6693 console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
6694 }
6695
6696 // Loop through our style object and apply styles to divElement
6697 for (var property in this.options.style) {
6698 divElement.style[property] = this.options.style[property];
6699 }
6700
6701 // Announce the toast to screen readers
6702 if (this.options.ariaLive) {
6703 divElement.setAttribute('aria-live', this.options.ariaLive)
6704 }
6705
6706 // Adding the toast message/node
6707 if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {
6708 // If we have a valid node, we insert it
6709 divElement.appendChild(this.options.node)
6710 } else {
6711 if (this.options.escapeMarkup) {
6712 divElement.innerText = this.options.text;
6713 } else {
6714 divElement.innerHTML = this.options.text;
6715 }
6716
6717 if (this.options.avatar !== "") {
6718 var avatarElement = document.createElement("img");
6719 avatarElement.src = this.options.avatar;
6720
6721 avatarElement.className = "toastify-avatar";
6722
6723 if (this.options.position == "left" || this.options.positionLeft === true) {
6724 // Adding close icon on the left of content
6725 divElement.appendChild(avatarElement);
6726 } else {
6727 // Adding close icon on the right of content
6728 divElement.insertAdjacentElement("afterbegin", avatarElement);
6729 }
6730 }
6731 }
6732
6733 // Adding a close icon to the toast
6734 if (this.options.close === true) {
6735 // Create a span for close element
6736 var closeElement = document.createElement("button");
6737 closeElement.type = "button";
6738 closeElement.setAttribute("aria-label", "Close");
6739 closeElement.className = "toast-close";
6740 closeElement.innerHTML = "&#10006;";
6741
6742 // Triggering the removal of toast from DOM on close click
6743 closeElement.addEventListener(
6744 "click",
6745 function(event) {
6746 event.stopPropagation();
6747 this.removeElement(this.toastElement);
6748 window.clearTimeout(this.toastElement.timeOutValue);
6749 }.bind(this)
6750 );
6751
6752 //Calculating screen width
6753 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
6754
6755 // Adding the close icon to the toast element
6756 // Display on the right if screen width is less than or equal to 360px
6757 if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) {
6758 // Adding close icon on the left of content
6759 divElement.insertAdjacentElement("afterbegin", closeElement);
6760 } else {
6761 // Adding close icon on the right of content
6762 divElement.appendChild(closeElement);
6763 }
6764 }
6765
6766 // Clear timeout while toast is focused
6767 if (this.options.stopOnFocus && this.options.duration > 0) {
6768 var self = this;
6769 // stop countdown
6770 divElement.addEventListener(
6771 "mouseover",
6772 function(event) {
6773 window.clearTimeout(divElement.timeOutValue);
6774 }
6775 )
6776 // add back the timeout
6777 divElement.addEventListener(
6778 "mouseleave",
6779 function() {
6780 divElement.timeOutValue = window.setTimeout(
6781 function() {
6782 // Remove the toast from DOM
6783 self.removeElement(divElement);
6784 },
6785 self.options.duration
6786 )
6787 }
6788 )
6789 }
6790
6791 // Adding an on-click destination path
6792 if (typeof this.options.destination !== "undefined") {
6793 divElement.addEventListener(
6794 "click",
6795 function(event) {
6796 event.stopPropagation();
6797 if (this.options.newWindow === true) {
6798 window.open(this.options.destination, "_blank");
6799 } else {
6800 window.location = this.options.destination;
6801 }
6802 }.bind(this)
6803 );
6804 }
6805
6806 if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") {
6807 divElement.addEventListener(
6808 "click",
6809 function(event) {
6810 event.stopPropagation();
6811 this.options.onClick();
6812 }.bind(this)
6813 );
6814 }
6815
6816 // Adding offset
6817 if(typeof this.options.offset === "object") {
6818
6819 var x = getAxisOffsetAValue("x", this.options);
6820 var y = getAxisOffsetAValue("y", this.options);
6821
6822 var xOffset = this.options.position == "left" ? x : "-" + x;
6823 var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y;
6824
6825 divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")";
6826
6827 }
6828
6829 // Returning the generated element
6830 return divElement;
6831 },
6832
6833 // Displaying the toast
6834 showToast: function() {
6835 // Creating the DOM object for the toast
6836 this.toastElement = this.buildToast();
6837
6838 // Getting the root element to with the toast needs to be added
6839 var rootElement;
6840 if (typeof this.options.selector === "string") {
6841 rootElement = document.getElementById(this.options.selector);
6842 } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) {
6843 rootElement = this.options.selector;
6844 } else {
6845 rootElement = document.body;
6846 }
6847
6848 // Validating if root element is present in DOM
6849 if (!rootElement) {
6850 throw "Root element is not defined";
6851 }
6852
6853 // Adding the DOM element
6854 var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild;
6855 rootElement.insertBefore(this.toastElement, elementToInsert);
6856
6857 // Repositioning the toasts in case multiple toasts are present
6858 Toastify.reposition();
6859
6860 if (this.options.duration > 0) {
6861 this.toastElement.timeOutValue = window.setTimeout(
6862 function() {
6863 // Remove the toast from DOM
6864 this.removeElement(this.toastElement);
6865 }.bind(this),
6866 this.options.duration
6867 ); // Binding `this` for function invocation
6868 }
6869
6870 // Supporting function chaining
6871 return this;
6872 },
6873
6874 hideToast: function() {
6875 if (this.toastElement.timeOutValue) {
6876 clearTimeout(this.toastElement.timeOutValue);
6877 }
6878 this.removeElement(this.toastElement);
6879 },
6880
6881 // Removing the element from the DOM
6882 removeElement: function(toastElement) {
6883 // Hiding the element
6884 // toastElement.classList.remove("on");
6885 toastElement.className = toastElement.className.replace(" on", "");
6886
6887 // Removing the element from DOM after transition end
6888 window.setTimeout(
6889 function() {
6890 // remove options node if any
6891 if (this.options.node && this.options.node.parentNode) {
6892 this.options.node.parentNode.removeChild(this.options.node);
6893 }
6894
6895 // Remove the element from the DOM, only when the parent node was not removed before.
6896 if (toastElement.parentNode) {
6897 toastElement.parentNode.removeChild(toastElement);
6898 }
6899
6900 // Calling the callback function
6901 this.options.callback.call(toastElement);
6902
6903 // Repositioning the toasts again
6904 Toastify.reposition();
6905 }.bind(this),
6906 400
6907 ); // Binding `this` for function invocation
6908 },
6909 };
6910
6911 // Positioning the toasts on the DOM
6912 Toastify.reposition = function() {
6913
6914 // Top margins with gravity
6915 var topLeftOffsetSize = {
6916 top: 15,
6917 bottom: 15,
6918 };
6919 var topRightOffsetSize = {
6920 top: 15,
6921 bottom: 15,
6922 };
6923 var offsetSize = {
6924 top: 15,
6925 bottom: 15,
6926 };
6927
6928 // Get all toast messages on the DOM
6929 var allToasts = document.getElementsByClassName("toastify");
6930
6931 var classUsed;
6932
6933 // Modifying the position of each toast element
6934 for (var i = 0; i < allToasts.length; i++) {
6935 // Getting the applied gravity
6936 if (containsClass(allToasts[i], "toastify-top") === true) {
6937 classUsed = "toastify-top";
6938 } else {
6939 classUsed = "toastify-bottom";
6940 }
6941
6942 var height = allToasts[i].offsetHeight;
6943 classUsed = classUsed.substr(9, classUsed.length-1)
6944 // Spacing between toasts
6945 var offset = 15;
6946
6947 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
6948
6949 // Show toast in center if screen with less than or equal to 360px
6950 if (width <= 360) {
6951 // Setting the position
6952 allToasts[i].style[classUsed] = offsetSize[classUsed] + "px";
6953
6954 offsetSize[classUsed] += height + offset;
6955 } else {
6956 if (containsClass(allToasts[i], "toastify-left") === true) {
6957 // Setting the position
6958 allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px";
6959
6960 topLeftOffsetSize[classUsed] += height + offset;
6961 } else {
6962 // Setting the position
6963 allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px";
6964
6965 topRightOffsetSize[classUsed] += height + offset;
6966 }
6967 }
6968 }
6969
6970 // Supporting function chaining
6971 return this;
6972 };
6973
6974 // Helper function to get offset.
6975 function getAxisOffsetAValue(axis, options) {
6976
6977 if(options.offset[axis]) {
6978 if(isNaN(options.offset[axis])) {
6979 return options.offset[axis];
6980 }
6981 else {
6982 return options.offset[axis] + 'px';
6983 }
6984 }
6985
6986 return '0px';
6987
6988 }
6989
6990 function containsClass(elem, yourClass) {
6991 if (!elem || typeof yourClass !== "string") {
6992 return false;
6993 } else if (
6994 elem.className &&
6995 elem.className
6996 .trim()
6997 .split(/\s+/gi)
6998 .indexOf(yourClass) > -1
6999 ) {
7000 return true;
7001 } else {
7002 return false;
7003 }
7004 }
7005
7006 // Setting up the prototype for the init object
7007 Toastify.lib.init.prototype = Toastify.lib;
7008
7009 // Returning the Toastify function to be assigned to the window object/module
7010 return Toastify;
7011 });
7012
7013
7014 /***/ }
7015
7016 /******/ });
7017 /************************************************************************/
7018 /******/ // The module cache
7019 /******/ const __webpack_module_cache__ = {};
7020 /******/
7021 /******/ // The require function
7022 /******/ function __webpack_require__(moduleId) {
7023 /******/ // Check if module is in cache
7024 /******/ const cachedModule = __webpack_module_cache__[moduleId];
7025 /******/ if (cachedModule !== undefined) {
7026 /******/ return cachedModule.exports;
7027 /******/ }
7028 /******/ // Create a new module (and put it into the cache)
7029 /******/ const module = __webpack_module_cache__[moduleId] = {
7030 /******/ id: moduleId,
7031 /******/ // no module.loaded needed
7032 /******/ exports: {}
7033 /******/ };
7034 /******/
7035 /******/ // Execute the module function
7036 /******/ if (!(moduleId in __webpack_modules__)) {
7037 /******/ delete __webpack_module_cache__[moduleId];
7038 /******/ const e = new Error("Cannot find module '" + moduleId + "'");
7039 /******/ e.code = 'MODULE_NOT_FOUND';
7040 /******/ throw e;
7041 /******/ }
7042 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
7043 /******/
7044 /******/ // Return the exports of the module
7045 /******/ return module.exports;
7046 /******/ }
7047 /******/
7048 /************************************************************************/
7049 /******/ /* webpack/runtime/compat get default export */
7050 /******/ (() => {
7051 /******/ // getDefaultExport function for compatibility with non-harmony modules
7052 /******/ __webpack_require__.n = (module) => {
7053 /******/ const getter = module && module.__esModule ?
7054 /******/ () => (module['default']) :
7055 /******/ () => (module);
7056 /******/ __webpack_require__.d(getter, { a: getter });
7057 /******/ return getter;
7058 /******/ };
7059 /******/ })();
7060 /******/
7061 /******/ /* webpack/runtime/define property getters */
7062 /******/ (() => {
7063 /******/ // define getter/value functions for harmony exports
7064 /******/ __webpack_require__.d = (exports, definition) => {
7065 /******/ if(Array.isArray(definition)) {
7066 /******/ var i = 0;
7067 /******/ while(i < definition.length) {
7068 /******/ var key = definition[i++];
7069 /******/ var binding = definition[i++];
7070 /******/ if(!__webpack_require__.o(exports, key)) {
7071 /******/ if(binding === 0) {
7072 /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
7073 /******/ } else {
7074 /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
7075 /******/ }
7076 /******/ } else if(binding === 0) { i++; }
7077 /******/ }
7078 /******/ } else {
7079 /******/ for(var key in definition) {
7080 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7081 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7082 /******/ }
7083 /******/ }
7084 /******/ }
7085 /******/ };
7086 /******/ })();
7087 /******/
7088 /******/ /* webpack/runtime/hasOwnProperty shorthand */
7089 /******/ (() => {
7090 /******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
7091 /******/ })();
7092 /******/
7093 /******/ /* webpack/runtime/make namespace object */
7094 /******/ (() => {
7095 /******/ // define __esModule on exports
7096 /******/ __webpack_require__.r = (exports) => {
7097 /******/ if(Symbol.toStringTag) {
7098 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7099 /******/ }
7100 /******/ Object.defineProperty(exports, '__esModule', { value: true });
7101 /******/ };
7102 /******/ })();
7103 /******/
7104 /******/ /* webpack/runtime/nonce */
7105 /******/ (() => {
7106 /******/ __webpack_require__.nc = undefined;
7107 /******/ })();
7108 /******/
7109 /************************************************************************/
7110 let __webpack_exports__ = {};
7111 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
7112 (() => {
7113 "use strict";
7114 /*!**********************************************!*\
7115 !*** ./assets/src/js/admin/admin-courses.js ***!
7116 \**********************************************/
7117 __webpack_require__.r(__webpack_exports__);
7118 /* harmony import */ var _courses_generate_with_ai_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./courses/generate-with-ai.js */ "./assets/src/js/admin/courses/generate-with-ai.js");
7119 /* harmony import */ var _courses_view_students_modal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./courses/view-students-modal.js */ "./assets/src/js/admin/courses/view-students-modal.js");
7120 /**
7121 * Admin Courses JS
7122 *
7123 * @since 4.3.0
7124 * @version 1.0.1
7125 */
7126
7127
7128
7129 new _courses_generate_with_ai_js__WEBPACK_IMPORTED_MODULE_0__.CreateCourseViaAI();
7130 new _courses_view_students_modal_js__WEBPACK_IMPORTED_MODULE_1__.ViewStudentsModal();
7131 })();
7132
7133 /******/ })()
7134 ;
7135 //# sourceMappingURL=admin-courses.js.map