PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.6
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.6
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 4.1.7.3.2 4.2.0 All 139 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.6, at assets/dist/js/admin/admin-courses.js

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