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