PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.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 4.2.0 All 139 releases
learnpress / assets / js / dist / frontend / single-course.js

single-course.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.9, at assets/js/dist/frontend/single-course.js

2,867 lines 99.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./assets/src/apps/js/frontend/material.js"
5 /*!*************************************************!*\
6 !*** ./assets/src/apps/js/frontend/material.js ***!
7 \*************************************************/
8 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
10 "use strict";
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ "default": () => (/* binding */ lpMaterialsLoad)
14 /* harmony export */ });
15 /* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../js/utils.js */ "./assets/src/js/utils.js");
16
17 function lpMaterialsLoad() {
18 document.addEventListener('click', function (e) {
19 const target = e.target;
20 if (target.classList.contains('lp-loadmore-material')) {
21 const loadMoreButton = target;
22 const lpTarget = target.closest('.lp-target');
23 const dataSend = window.lpAJAXG.getDataSetCurrent(lpTarget);
24 dataSend.args.paged++;
25 _js_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(loadMoreButton, 1);
26 const callBack = {
27 success: response => {
28 const {
29 status,
30 message,
31 data
32 } = response;
33 if (status === 'success') {
34 const tableBody = lpTarget.querySelector('table.course-material-table tbody');
35 tableBody.insertAdjacentHTML('beforeend', data.content);
36 if (data.paged === data.total_pages) {
37 loadMoreButton.remove();
38 }
39 window.lpAJAXG.setDataSetCurrent(lpTarget, dataSend);
40 } else {
41 console.error(message);
42 }
43 },
44 error: error => {
45 console.error(error);
46 },
47 completed: () => {
48 _js_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(loadMoreButton, 0);
49 }
50 };
51 window.lpAJAXG.fetchAJAX(dataSend, callBack);
52 }
53 });
54 }
55
56 /***/ },
57
58 /***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js"
59 /*!**********************************************************************!*\
60 !*** ./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***!
61 \**********************************************************************/
62 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
63
64 "use strict";
65 __webpack_require__.r(__webpack_exports__);
66 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
67 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
68 /* harmony export */ });
69 /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
70
71 const lpModalOverlayCompleteItem = {
72 elBtnFinishCourse: null,
73 elBtnCompleteItem: null,
74 init() {
75 if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].init()) {
76 return;
77 }
78 if (undefined === lpGlobalSettings || 'yes' !== lpGlobalSettings.option_enable_popup_confirm_finish) {
79 return;
80 }
81 this.elBtnFinishCourse = document.querySelectorAll('.lp-btn-finish-course');
82 this.elBtnCompleteItem = document.querySelector('.lp-btn-complete-item');
83 if (this.elBtnCompleteItem) {
84 this.elBtnCompleteItem.addEventListener('click', e => {
85 e.preventDefault();
86 const form = e.target.closest('form');
87 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show();
88 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title);
89 // ESC html
90 const div = document.createElement('div');
91 div.appendChild(document.createTextNode(form.dataset.confirm));
92 const contentModal = div.innerHTML;
93 // End ESC html
94 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + contentModal + '</div>');
95 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = () => {
96 form.submit();
97 };
98 });
99 }
100 if (this.elBtnFinishCourse) {
101 this.elBtnFinishCourse.forEach(element => element.addEventListener('click', e => {
102 e.preventDefault();
103 const form = e.target.closest('form');
104 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show();
105 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title);
106 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + form.dataset.confirm + '</div>');
107 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = () => {
108 form.submit();
109 };
110 }));
111 }
112 }
113 };
114 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lpModalOverlayCompleteItem);
115
116 /***/ },
117
118 /***/ "./assets/src/apps/js/frontend/single-course/index.js"
119 /*!************************************************************!*\
120 !*** ./assets/src/apps/js/frontend/single-course/index.js ***!
121 \************************************************************/
122 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
123
124 "use strict";
125 __webpack_require__.r(__webpack_exports__);
126 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
127 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
128 /* harmony export */ });
129 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
130 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
131 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
132 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
133 /* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @learnpress/quiz */ "@learnpress/quiz");
134 /* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_learnpress_quiz__WEBPACK_IMPORTED_MODULE_2__);
135 /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/single-course/store/index.js");
136 /* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_store__WEBPACK_IMPORTED_MODULE_3__);
137 /* harmony import */ var _single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../single-curriculum/components/sidebar */ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js");
138
139
140
141
142 // Use toggle in Curriculum tab.
143
144 class SingleCourse extends _wordpress_element__WEBPACK_IMPORTED_MODULE_1__.Component {
145 render() {
146 return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null);
147 }
148 }
149 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SingleCourse);
150 function run() {
151 (0,_single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_4__.Sidebar)();
152 }
153 document.addEventListener('DOMContentLoaded', () => {
154 run();
155 });
156
157 /***/ },
158
159 /***/ "./assets/src/apps/js/frontend/single-course/store/index.js"
160 /*!******************************************************************!*\
161 !*** ./assets/src/apps/js/frontend/single-course/store/index.js ***!
162 \******************************************************************/
163 () {
164
165 /**
166 * Created by tu on 9/19/19.
167 */
168
169 /***/ },
170
171 /***/ "./assets/src/apps/js/frontend/single-curriculum/components/search.js"
172 /*!****************************************************************************!*\
173 !*** ./assets/src/apps/js/frontend/single-curriculum/components/search.js ***!
174 \****************************************************************************/
175 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
176
177 "use strict";
178 __webpack_require__.r(__webpack_exports__);
179 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
180 /* harmony export */ searchCourseContent: () => (/* binding */ searchCourseContent)
181 /* harmony export */ });
182 const searchCourseContent = () => {
183 const popup = document.querySelector('#popup-course');
184 const list = document.querySelector('#learn-press-course-curriculum');
185 if (popup && list) {
186 const items = list.querySelector('.curriculum-sections');
187 const form = popup.querySelector('.search-course');
188 const search = popup.querySelector('.search-course input[type="text"]');
189 if (!search || !items || !form) {
190 return;
191 }
192 const sections = items.querySelectorAll('li.section');
193 const dataItems = items.querySelectorAll('li.course-item');
194 const dataSearch = [];
195 dataItems.forEach(item => {
196 const itemID = item.dataset.id;
197 const name = item.querySelector('.item-name');
198 dataSearch.push({
199 id: itemID,
200 name: name ? name.textContent.toLowerCase() : ''
201 });
202 });
203 const submit = event => {
204 event.preventDefault();
205 const inputVal = search.value;
206 form.classList.add('searching');
207 if (!inputVal) {
208 form.classList.remove('searching');
209 }
210 const outputs = [];
211 dataSearch.forEach(i => {
212 if (!inputVal || i.name.match(inputVal.toLowerCase())) {
213 outputs.push(i.id);
214 dataItems.forEach(c => {
215 if (outputs.indexOf(c.dataset.id) !== -1) {
216 c.classList.remove('hide-if-js');
217 } else {
218 c.classList.add('hide-if-js');
219 }
220 });
221 }
222 });
223 sections.forEach(section => {
224 const listItem = section.querySelectorAll('.course-item');
225 const isTrue = [];
226 listItem.forEach(a => {
227 if (outputs.includes(a.dataset.id)) {
228 isTrue.push(a.dataset.id);
229 }
230 });
231 if (isTrue.length === 0) {
232 section.classList.add('hide-if-js');
233 } else {
234 section.classList.remove('hide-if-js');
235 }
236 });
237 };
238 const clear = form.querySelector('.clear');
239 if (clear) {
240 clear.addEventListener('click', e => {
241 e.preventDefault();
242 search.value = '';
243 submit(e);
244 });
245 }
246 form.addEventListener('submit', submit);
247 search.addEventListener('keyup', submit);
248 }
249 };
250
251 /***/ },
252
253 /***/ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js"
254 /*!*****************************************************************************!*\
255 !*** ./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js ***!
256 \*****************************************************************************/
257 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
258
259 "use strict";
260 __webpack_require__.r(__webpack_exports__);
261 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
262 /* harmony export */ Sidebar: () => (/* binding */ Sidebar)
263 /* harmony export */ });
264 const $ = jQuery;
265 const {
266 throttle
267 } = lodash;
268 const Sidebar = () => {
269 // Tungnx - Show/hide sidebar curriculumn
270 const elSidebarToggle = document.querySelector('#sidebar-toggle');
271
272 // For style of theme
273 const toggleSidebar = toggle => {
274 $('body').removeClass('lp-sidebar-toggle__open');
275 $('body').removeClass('lp-sidebar-toggle__close');
276 if (toggle) {
277 $('body').addClass('lp-sidebar-toggle__close');
278 } else {
279 $('body').addClass('lp-sidebar-toggle__open');
280 }
281 };
282
283 // For lp and theme
284 if (elSidebarToggle) {
285 if ($(window).innerWidth() <= 768) {
286 elSidebarToggle.setAttribute('checked', 'checked');
287 } else if (LP.Cookies.get('sidebar-toggle')) {
288 elSidebarToggle.setAttribute('checked', 'checked');
289 } else {
290 elSidebarToggle.removeAttribute('checked');
291 }
292 }
293 // End editor by tungnx
294
295 // Code for old curriculum
296 /*const $curriculum = $( '#learn-press-course-curriculum' );
297 $curriculum.find( '.section-desc' ).each( ( i, el ) => {
298 const a = $( '<span class="show-desc"></span>' ).on( 'click', () => {
299 b.toggleClass( 'c' );
300 } );
301 const b = $( el ).siblings( '.section-title' ).append( a );
302 } );*/
303
304 // Code for old curriculum
305 /*$( '.section' ).each( function() {
306 const $section = $( this ),
307 $toggle = $section.find( '.section-left' );
308
309 $toggle.on( 'click', function() {
310 const isClose = $section.toggleClass( 'closed' ).hasClass( 'closed' );
311 const sections = LP.Cookies.get( 'closed-section-' + lpGlobalSettings.post_id ) || [];
312 const sectionId = parseInt( $section.data( 'section-id' ) );
313 const at = sections.findIndex( ( id ) => {
314 return id == sectionId;
315 } );
316
317 if ( isClose ) {
318 sections.push( parseInt( $section.data( 'section-id' ) ) );
319 } else {
320 sections.splice( at, 1 );
321 }
322
323 LP.Cookies.remove( 'closed-section-(.*)' );
324 LP.Cookies.set( 'closed-section-' + lpGlobalSettings.post_id, [ ...new Set( sections ) ] );
325 } );
326 } );*/
327
328 document.addEventListener('click', e => {
329 if (e.target.id === 'sidebar-toggle') {
330 LP.Cookies.set('sidebar-toggle', e.target.checked ? true : false);
331 toggleSidebar(LP.Cookies.get('sidebar-toggle'));
332 }
333 });
334 };
335
336 /***/ },
337
338 /***/ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js"
339 /*!***********************************************************************!*\
340 !*** ./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js ***!
341 \***********************************************************************/
342 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
343
344 "use strict";
345 __webpack_require__.r(__webpack_exports__);
346 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
347 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
348 /* harmony export */ });
349 /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
350
351 const $ = jQuery;
352 const scrollToItemCurrent = {
353 init() {
354 this.scrollToItemViewing = function () {
355 const elItemViewing = $('.viewing-course-item');
356 if (elItemViewing.length) {
357 const elCourseCurriculumn = $('#learn-press-course-curriculum');
358 const heightCourseItemContentHeader = $('#popup-sidebar').outerHeight();
359 const heightSectionTitle = $('.section-title').outerHeight();
360 const heightSectionHeader = $('.section-header').outerHeight();
361 const regex = new RegExp('^viewing-course-item-([0-9].*)');
362 const classList = elItemViewing.attr('class');
363 const classArr = classList.split(/\s+/);
364 let idItem = 0;
365 $.each(classArr, function (i, className) {
366 const compare = regex.exec(className);
367 if (compare) {
368 idItem = compare[1];
369 return false;
370 }
371 });
372 if (0 === idItem) {
373 return;
374 }
375 const elItemCurrent = $('.course-item-' + idItem);
376 elItemCurrent.addClass('current');
377 const offSetTop = elItemCurrent.offset().top;
378 const offset = elItemCurrent.offset().top - elCourseCurriculumn.offset().top + elCourseCurriculumn.scrollTop();
379 elCourseCurriculumn.animate({
380 scrollTop: LP.Hook.applyFilters('scroll-item-current', offset - heightSectionHeader)
381 }, 800);
382 }
383 };
384 this.scrollToItemViewing();
385 }
386 };
387 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (scrollToItemCurrent);
388
389 /***/ },
390
391 /***/ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js"
392 /*!*******************************************************************!*\
393 !*** ./assets/src/apps/js/frontend/single-curriculum/skeleton.js ***!
394 \*******************************************************************/
395 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
396
397 "use strict";
398 __webpack_require__.r(__webpack_exports__);
399 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
400 /* harmony export */ "default": () => (/* binding */ courseCurriculumSkeleton)
401 /* harmony export */ });
402 /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
403 /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
404 /* harmony import */ var _scrolltoitem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrolltoitem */ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js");
405 /* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/search */ "./assets/src/apps/js/frontend/single-curriculum/components/search.js");
406 // Rest API load content in Tab Curriculum - Nhamdv.
407
408 //import apiFetch from '@wordpress/api-fetch';
409
410
411 function courseCurriculumSkeleton(courseID = '') {
412 let idItemViewing = 0;
413 const elItemViewing = document.querySelector('.viewing-course-item');
414 if (elItemViewing) {
415 const regex = new RegExp('^viewing-course-item-([0-9].*)');
416 const classList = elItemViewing.classList;
417 classList.forEach(function (className) {
418 const compare = regex.exec(className);
419 if (compare) {
420 idItemViewing = compare[1];
421 return false;
422 }
423 });
424 }
425 let isLoadingItems = false;
426 let isLoadingSections = false;
427 const Sekeleton = () => {
428 const elementCurriculum = document.querySelector('.learnpress-course-curriculum');
429 if (!elementCurriculum) {
430 return;
431 }
432 getResponse(elementCurriculum);
433 };
434 const getResponse = async ele => {
435 const skeleton = ele.querySelector('.lp-skeleton-animation');
436 const itemID = ele.dataset.id;
437 const sectionID = ele.dataset.section;
438 try {
439 const page = 1;
440 let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum/';
441 url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, {
442 courseId: courseID || lpGlobalSettings.post_id || '',
443 page,
444 sectionID: sectionID || '',
445 idItemViewing
446 });
447 let paramsFetch = {};
448 if (0 !== parseInt(lpData.user_id)) {
449 paramsFetch = {
450 headers: {
451 'X-WP-Nonce': lpData.nonce
452 }
453 };
454 }
455 let response = await fetch(url, {
456 method: 'GET',
457 ...paramsFetch
458 });
459 response = await response.json();
460 const {
461 data,
462 status,
463 message
464 } = response;
465 const section_ids = data.section_ids;
466 if (status === 'error') {
467 throw new Error(message || 'Error');
468 }
469 const returnData = data.content;
470 if (sectionID) {
471 if (section_ids && !section_ids.includes(sectionID)) {
472 const response2 = await getResponsive('', page + 1, sectionID);
473 if (response2) {
474 const {
475 data2,
476 pages2,
477 page2
478 } = response2;
479 await parseContentItems({
480 ele,
481 returnData,
482 sectionID,
483 itemID,
484 data2,
485 pages2,
486 page2
487 });
488 }
489 } else {
490 await parseContentItems({
491 ele,
492 returnData,
493 sectionID,
494 itemID
495 });
496 }
497 } else {
498 returnData && ele.insertAdjacentHTML('beforeend', returnData);
499 }
500 } catch (error) {
501 ele.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${error.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`);
502 }
503 skeleton && skeleton.remove();
504 (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)();
505 };
506 const parseContentItems = async ({
507 ele,
508 returnData,
509 sectionID,
510 itemID,
511 data2,
512 pages2,
513 page2
514 }) => {
515 const parser = new DOMParser();
516 const doc = parser.parseFromString(returnData, 'text/html');
517 if (data2) {
518 const sections = doc.querySelector('.curriculum-sections');
519 const loadMoreBtn = doc.querySelector('.curriculum-more__button');
520 if (loadMoreBtn) {
521 if (pages2 <= page2) {
522 loadMoreBtn.remove();
523 } else {
524 loadMoreBtn.dataset.page = page2;
525 }
526 }
527 sections.insertAdjacentHTML('beforeend', data2);
528 }
529 const section = doc.querySelector(`[data-section-id="${sectionID}"]`);
530 if (section) {
531 const items = section.querySelectorAll('.course-item');
532 const item_ids = [...items].map(item => item.dataset.id);
533 const sectionContent = section.querySelector('.section-content');
534 const itemLoadMore = section.querySelector('.section-item__loadmore');
535 if (itemID && !item_ids.includes(itemID)) {
536 const responseItem = await getResponsiveItem('', 2, sectionID, itemID);
537 const {
538 data3,
539 pages3,
540 paged3,
541 page
542 } = responseItem;
543 if (pages3 <= paged3 || pages3 <= page) {
544 itemLoadMore.remove();
545 } else {
546 itemLoadMore.dataset.page = page;
547 }
548 if (data3 && sectionContent) {
549 sectionContent.insertAdjacentHTML('beforeend', data3);
550 }
551 }
552 }
553 ele.insertAdjacentHTML('beforeend', doc.body.innerHTML);
554 _scrolltoitem__WEBPACK_IMPORTED_MODULE_1__["default"].init();
555 };
556 const getResponsiveItem = async (returnData, paged, sectionID, itemID) => {
557 let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum-items/';
558 url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, {
559 sectionId: sectionID || '',
560 page: paged
561 });
562 let paramsFetch = {};
563 if (0 !== parseInt(lpData.user_id)) {
564 paramsFetch = {
565 headers: {
566 'X-WP-Nonce': lpData.nonce
567 }
568 };
569 }
570 let response = await fetch(url, {
571 method: 'GET',
572 ...paramsFetch
573 });
574 response = await response.json();
575 const {
576 data,
577 status,
578 pages,
579 message
580 } = response;
581 const {
582 page
583 } = data;
584 let item_ids;
585 if (status === 'success') {
586 const dataTmp = data.content;
587 item_ids = data.item_ids;
588 returnData += dataTmp;
589 if (sectionID && item_ids && itemID && !item_ids.includes(itemID)) {
590 return getResponsiveItem(returnData, paged + 1, sectionID, itemID);
591 }
592 }
593 isLoadingItems = false;
594 return {
595 data3: returnData,
596 pages3: pages || data.pages,
597 status3: status,
598 message3: message,
599 page: page || 0
600 };
601 };
602 const getResponsive = async (returnData, page, sectionID) => {
603 let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum/';
604 url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, {
605 courseId: courseID || lpGlobalSettings.post_id || '',
606 page,
607 sectionID: sectionID || '',
608 loadMore: true
609 });
610 let paramsFetch = {};
611 if (0 !== parseInt(lpData.user_id)) {
612 paramsFetch = {
613 headers: {
614 'X-WP-Nonce': lpData.nonce
615 }
616 };
617 }
618 let response = await fetch(url, {
619 method: 'GET',
620 ...paramsFetch
621 });
622 response = await response.json();
623 const {
624 data,
625 status,
626 message
627 } = response;
628 const returnDataTmp = data.content;
629 const section_ids = data.section_ids;
630 const pages = data.pages;
631 if (status === 'success') {
632 returnData += returnDataTmp;
633 if (sectionID && section_ids && section_ids.length > 0 && !section_ids.includes(sectionID)) {
634 return getResponsive(returnData, page + 1, sectionID);
635 }
636 }
637 isLoadingSections = false;
638 return {
639 data2: returnData,
640 pages2: pages || data.pages,
641 page2: page,
642 status2: status,
643 message2: message
644 };
645 };
646 Sekeleton();
647 document.addEventListener('click', e => {
648 const sectionBtns = document.querySelectorAll('.section-item__loadmore');
649 [...sectionBtns].map(async sectionBtn => {
650 if (sectionBtn.contains(e.target) && !isLoadingItems) {
651 isLoadingItems = true;
652 const sectionItem = sectionBtn.parentNode;
653 const sectionId = sectionItem.getAttribute('data-section-id');
654 const sectionContent = sectionItem.querySelector('.section-content');
655 const paged = parseInt(sectionBtn.dataset.page);
656 sectionBtn.classList.add('loading');
657 try {
658 const response = await getResponsiveItem('', paged + 1, sectionId, '');
659 const {
660 data3,
661 pages3,
662 status3,
663 message3
664 } = response;
665 if (status3 === 'error') {
666 throw new Error(message3 || 'Error');
667 }
668 if (pages3 <= paged + 1) {
669 sectionBtn.remove();
670 } else {
671 sectionBtn.dataset.page = paged + 1;
672 }
673 sectionContent.insertAdjacentHTML('beforeend', data3);
674 } catch (e) {
675 sectionContent.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${e.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`);
676 }
677 sectionBtn.classList.remove('loading');
678 (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)();
679 }
680 });
681
682 // Load more Sections
683 const moreSections = document.querySelectorAll('.curriculum-more__button');
684 [...moreSections].map(async moreSection => {
685 if (moreSection.contains(e.target) && !isLoadingSections) {
686 isLoadingSections = true;
687 const paged = parseInt(moreSection.dataset.page);
688 const sections = moreSection.parentNode.parentNode.querySelector('.curriculum-sections');
689 if (paged && sections) {
690 moreSection.classList.add('loading');
691 try {
692 const response2 = await getResponsive('', paged + 1, '');
693 const {
694 data2,
695 pages2,
696 status2,
697 message2
698 } = response2;
699 if (status2 === 'error') {
700 throw new Error(message2 || 'Error');
701 }
702 if (pages2 <= paged + 1) {
703 moreSection.remove();
704 } else {
705 moreSection.dataset.page = paged + 1;
706 }
707 sections.insertAdjacentHTML('beforeend', data2);
708 } catch (e) {
709 sections.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${e.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`);
710 }
711 moreSection.classList.remove('loading');
712 (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)();
713 }
714 }
715 });
716
717 // Show/Hide accordion
718 if (document.querySelector('.learnpress-course-curriculum')) {
719 const sections = document.querySelectorAll('.section');
720 [...sections].map(section => {
721 if (section.contains(e.target)) {
722 const toggle = section.querySelector('.section-left');
723 toggle.contains(e.target) && section.classList.toggle('closed');
724 }
725 });
726 }
727 });
728 }
729
730 /***/ },
731
732 /***/ "./assets/src/apps/js/frontend/tabs-scroll.js"
733 /*!****************************************************!*\
734 !*** ./assets/src/apps/js/frontend/tabs-scroll.js ***!
735 \****************************************************/
736 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
737
738 "use strict";
739 __webpack_require__.r(__webpack_exports__);
740 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
741 /* harmony export */ "default": () => (/* binding */ TabsDragScroll)
742 /* harmony export */ });
743 function TabsDragScroll() {
744 // Selectors and DOM elements
745 const TabsDragScroll = document.querySelector('.TabsDragScroll');
746 if (!TabsDragScroll) return;
747 const tabMenu = TabsDragScroll.querySelector('ul');
748
749 // Dragging functionality
750 let activeDrag = false;
751 tabMenu.addEventListener('mousemove', event => {
752 if (!activeDrag) return;
753 tabMenu.scrollLeft -= event.movementX;
754 // iconVisibility();
755 tabMenu.classList.add('dragging');
756 });
757 document.addEventListener('mouseup', () => {
758 activeDrag = false;
759 tabMenu.classList.remove('dragging');
760 });
761 tabMenu.addEventListener('mousedown', () => {
762 activeDrag = true;
763 });
764
765 // Scroll to <li> on click
766 const scrollToLi = li => {
767 const liLeft = li.offsetLeft;
768 const liWidth = li.offsetWidth;
769 const tabCenter = tabMenu.clientWidth / 2 - liWidth / 2;
770 tabMenu.scrollTo({
771 left: liLeft - tabCenter,
772 behavior: 'smooth'
773 });
774 };
775
776 // Add click event listeners to all <li> elements
777 tabMenu.querySelectorAll('li').forEach(li => {
778 li.addEventListener('click', () => scrollToLi(li));
779 });
780 }
781
782 /***/ },
783
784 /***/ "./assets/src/apps/js/utils/lp-modal-overlay.js"
785 /*!******************************************************!*\
786 !*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***!
787 \******************************************************/
788 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
789
790 "use strict";
791 __webpack_require__.r(__webpack_exports__);
792 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
793 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
794 /* harmony export */ });
795 const $ = jQuery;
796 let elLPOverlay = null;
797 const lpModalOverlay = {
798 elLPOverlay: null,
799 elMainContent: null,
800 elTitle: null,
801 elBtnYes: null,
802 elBtnNo: null,
803 elFooter: null,
804 elCalledModal: null,
805 callBackYes: null,
806 instance: null,
807 init() {
808 if (this.instance) {
809 return true;
810 }
811 this.elLPOverlay = $('.lp-overlay');
812 if (!this.elLPOverlay.length) {
813 return false;
814 }
815 elLPOverlay = this.elLPOverlay;
816 this.elMainContent = elLPOverlay.find('.main-content');
817 this.elTitle = elLPOverlay.find('.modal-title');
818 this.elBtnYes = elLPOverlay.find('.btn-yes');
819 this.elBtnNo = elLPOverlay.find('.btn-no');
820 this.elFooter = elLPOverlay.find('.lp-modal-footer');
821 $(document).on('click', '.close, .btn-no', function () {
822 elLPOverlay.hide();
823 });
824 $(document).on('click', '.btn-yes', function (e) {
825 e.preventDefault();
826 e.stopPropagation();
827 if ('function' === typeof lpModalOverlay.callBackYes) {
828 lpModalOverlay.callBackYes(e);
829 }
830 });
831 this.instance = this;
832 return true;
833 },
834 setElCalledModal(elCalledModal) {
835 this.elCalledModal = elCalledModal;
836 },
837 setContentModal(content, event) {
838 this.elMainContent.html(content);
839 if ('function' === typeof event) {
840 event();
841 }
842 },
843 setTitleModal(content) {
844 this.elTitle.html(content);
845 }
846 };
847 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lpModalOverlay);
848
849 /***/ },
850
851 /***/ "./assets/src/js/frontend/copy-to-clipboard.js"
852 /*!*****************************************************!*\
853 !*** ./assets/src/js/frontend/copy-to-clipboard.js ***!
854 \*****************************************************/
855 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
856
857 "use strict";
858 __webpack_require__.r(__webpack_exports__);
859 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
860 /* harmony export */ "default": () => (/* binding */ CopyToClipboard)
861 /* harmony export */ });
862 function LPClick(element, iconBtn, inner) {
863 const wrappers = document.querySelectorAll(element);
864 if (!wrappers.length) {
865 return;
866 }
867 wrappers.forEach(wrapper => {
868 const clickBtn = wrapper.querySelector(iconBtn);
869 const class_open = element.replace('.', '') + '__open';
870 const closeElement = wrapper.querySelector(element + '__close');
871 const isOpenElement = () => wrapper.classList.contains(class_open);
872 const showElement = () => {
873 if (!isOpenElement()) {
874 wrapper.classList.add(class_open);
875 }
876 };
877 const hideElement = () => {
878 if (isOpenElement()) {
879 wrapper.classList.remove(class_open);
880 }
881 };
882 const toggleElement = () => {
883 if (isOpenElement()) {
884 hideElement();
885 } else {
886 showElement();
887 }
888 };
889 const onKeyDown = e => {
890 if (e.keyCode === 27) {
891 hideElement();
892 }
893 };
894 if (clickBtn) {
895 clickBtn.onclick = function (e) {
896 e.preventDefault();
897 toggleElement();
898 };
899 }
900 document.addEventListener('click', e => {
901 if (!isOpenElement()) {
902 return;
903 }
904 const target = e.target;
905 if (target.closest(inner) || target.closest(iconBtn)) {
906 return;
907 }
908 hideElement();
909 });
910 if (closeElement) {
911 closeElement.addEventListener('click', e => {
912 e.preventDefault();
913 hideElement();
914 });
915 }
916 document.addEventListener('keydown', onKeyDown, false);
917 });
918 }
919 function CopyToClipboard() {
920 LPClick('.social-share-toggle', '.share-toggle-icon', '.content-widget-social-share');
921 var copyTextareaBtn = document.querySelector('.btn-clipboard');
922 if (copyTextareaBtn) {
923 copyTextareaBtn.addEventListener('click', function (event) {
924 var copyTextarea = document.querySelector('.clipboard-value');
925 copyTextarea.focus();
926 copyTextarea.select();
927 try {
928 var successful = document.execCommand('copy');
929 var msg = copyTextareaBtn.getAttribute('data-copied');
930 copyTextareaBtn.innerHTML = msg + '<span class="tooltip">' + msg + '</span>';
931 } catch (err) {}
932 });
933 }
934 }
935
936 /***/ },
937
938 /***/ "./assets/src/js/utils.js"
939 /*!********************************!*\
940 !*** ./assets/src/js/utils.js ***!
941 \********************************/
942 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
943
944 "use strict";
945 __webpack_require__.r(__webpack_exports__);
946 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
947 /* harmony export */ debounce: () => (/* binding */ debounce),
948 /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers),
949 /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm),
950 /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm),
951 /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated),
952 /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed),
953 /* harmony export */ lpAddQueryArgs: () => (/* binding */ lpAddQueryArgs),
954 /* harmony export */ lpAjaxParseJsonOld: () => (/* binding */ lpAjaxParseJsonOld),
955 /* harmony export */ lpClassName: () => (/* binding */ lpClassName),
956 /* harmony export */ lpFetchAPI: () => (/* binding */ lpFetchAPI),
957 /* harmony export */ lpGetCurrentURLNoParam: () => (/* binding */ lpGetCurrentURLNoParam),
958 /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady),
959 /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl),
960 /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl),
961 /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm),
962 /* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse)
963 /* harmony export */ });
964 /**
965 * Utils functions
966 *
967 * @param url
968 * @param data
969 * @param functions
970 * @since 4.2.5.1
971 * @version 1.0.6
972 */
973 const lpClassName = {
974 hidden: 'lp-hidden',
975 loading: 'loading',
976 elCollapse: 'lp-collapse',
977 elSectionToggle: '.lp-section-toggle',
978 elTriggerToggle: '.lp-trigger-toggle'
979 };
980 const lpFetchAPI = (url, data = {}, functions = {}) => {
981 if ('function' === typeof functions.before) {
982 functions.before();
983 }
984 fetch(url, {
985 method: 'GET',
986 ...data
987 }).then(response => response.json()).then(response => {
988 if ('function' === typeof functions.success) {
989 functions.success(response);
990 }
991 }).catch(err => {
992 if ('function' === typeof functions.error) {
993 functions.error(err);
994 }
995 }).finally(() => {
996 if ('function' === typeof functions.completed) {
997 functions.completed();
998 }
999 });
1000 };
1001
1002 /**
1003 * Get current URL without params.
1004 *
1005 * @since 4.2.5.1
1006 */
1007 const lpGetCurrentURLNoParam = () => {
1008 let currentUrl = window.location.href;
1009 const hasParams = currentUrl.includes('?');
1010 if (hasParams) {
1011 currentUrl = currentUrl.split('?')[0];
1012 }
1013 return currentUrl;
1014 };
1015 const lpAddQueryArgs = (endpoint, args) => {
1016 const url = new URL(endpoint);
1017 Object.keys(args).forEach(arg => {
1018 url.searchParams.set(arg, args[arg]);
1019 });
1020 return url;
1021 };
1022
1023 /**
1024 * Listen element viewed.
1025 *
1026 * @param el
1027 * @param callback
1028 * @since 4.2.5.8
1029 */
1030 const listenElementViewed = (el, callback) => {
1031 const observerSeeItem = new IntersectionObserver(function (entries) {
1032 for (const entry of entries) {
1033 if (entry.isIntersecting) {
1034 callback(entry);
1035 }
1036 }
1037 });
1038 observerSeeItem.observe(el);
1039 };
1040
1041 /**
1042 * Listen element created.
1043 *
1044 * @param callback
1045 * @since 4.2.5.8
1046 */
1047 const listenElementCreated = callback => {
1048 const observerCreateItem = new MutationObserver(function (mutations) {
1049 mutations.forEach(function (mutation) {
1050 if (mutation.addedNodes) {
1051 mutation.addedNodes.forEach(function (node) {
1052 if (node.nodeType === 1) {
1053 callback(node);
1054 }
1055 });
1056 }
1057 });
1058 });
1059 observerCreateItem.observe(document, {
1060 childList: true,
1061 subtree: true
1062 });
1063 // End.
1064 };
1065
1066 /**
1067 * Listen element created.
1068 *
1069 * @param selector
1070 * @param callback
1071 * @since 4.2.7.1
1072 */
1073 const lpOnElementReady = (selector, callback) => {
1074 const element = document.querySelector(selector);
1075 if (element) {
1076 callback(element);
1077 return;
1078 }
1079 const observer = new MutationObserver((mutations, obs) => {
1080 const element = document.querySelector(selector);
1081 if (element) {
1082 obs.disconnect();
1083 callback(element);
1084 }
1085 });
1086 observer.observe(document.documentElement, {
1087 childList: true,
1088 subtree: true
1089 });
1090 };
1091
1092 // Parse JSON from string with content include LP_AJAX_START.
1093 const lpAjaxParseJsonOld = data => {
1094 if (typeof data !== 'string') {
1095 return data;
1096 }
1097 const m = String.raw({
1098 raw: data
1099 }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
1100 try {
1101 if (m) {
1102 data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, ''));
1103 } else {
1104 data = JSON.parse(data);
1105 }
1106 } catch (e) {
1107 data = {};
1108 }
1109 return data;
1110 };
1111
1112 // status 0: hide, 1: show
1113 const lpShowHideEl = (el, status = 0) => {
1114 if (!el) {
1115 return;
1116 }
1117 if (!status) {
1118 el.classList.add(lpClassName.hidden);
1119 } else {
1120 el.classList.remove(lpClassName.hidden);
1121 }
1122 };
1123
1124 // status 0: hide, 1: show
1125 const lpSetLoadingEl = (el, status) => {
1126 if (!el) {
1127 return;
1128 }
1129 if (!status) {
1130 el.classList.remove(lpClassName.loading);
1131 } else {
1132 el.classList.add(lpClassName.loading);
1133 }
1134 };
1135
1136 // Toggle collapse section
1137 const toggleCollapse = (e, target, elTriggerClassName = '', elsExclude = [], callback) => {
1138 if (!elTriggerClassName) {
1139 elTriggerClassName = lpClassName.elTriggerToggle;
1140 }
1141
1142 // Exclude elements, which should not trigger the collapse toggle
1143 if (elsExclude && elsExclude.length > 0) {
1144 for (const elExclude of elsExclude) {
1145 if (target.closest(elExclude)) {
1146 return;
1147 }
1148 }
1149 }
1150 const elTrigger = target.closest(elTriggerClassName);
1151 if (!elTrigger) {
1152 return;
1153 }
1154
1155 //console.log( 'elTrigger', elTrigger );
1156
1157 const elSectionToggle = elTrigger.closest(`${lpClassName.elSectionToggle}`);
1158 if (!elSectionToggle) {
1159 return;
1160 }
1161 elSectionToggle.classList.toggle(`${lpClassName.elCollapse}`);
1162 if ('function' === typeof callback) {
1163 callback(elSectionToggle);
1164 }
1165 };
1166
1167 // Get data of form
1168 const getDataOfForm = form => {
1169 const dataSend = {};
1170 const formData = new FormData(form);
1171 for (const pair of formData.entries()) {
1172 const key = pair[0];
1173 const value = formData.getAll(key);
1174 if (!dataSend.hasOwnProperty(key)) {
1175 // Convert value array to string.
1176 dataSend[key] = value.join(',');
1177 }
1178 }
1179 return dataSend;
1180 };
1181
1182 // Get field keys of form
1183 const getFieldKeysOfForm = form => {
1184 const keys = [];
1185 const elements = form.elements;
1186 for (let i = 0; i < elements.length; i++) {
1187 const name = elements[i].name;
1188 if (name && !keys.includes(name)) {
1189 keys.push(name);
1190 }
1191 }
1192 return keys;
1193 };
1194
1195 // Merge data handle with data form.
1196 const mergeDataWithDatForm = (elForm, dataHandle) => {
1197 const dataForm = getDataOfForm(elForm);
1198 const keys = getFieldKeysOfForm(elForm);
1199 keys.forEach(key => {
1200 if (!dataForm.hasOwnProperty(key)) {
1201 delete dataHandle[key];
1202 } else if (dataForm[key][0] === '') {
1203 delete dataForm[key];
1204 delete dataHandle[key];
1205 }
1206 });
1207 dataHandle = {
1208 ...dataHandle,
1209 ...dataForm
1210 };
1211 return dataHandle;
1212 };
1213
1214 /**
1215 * Event trigger
1216 * For each list of event handlers, listen event on document.
1217 *
1218 * eventName: 'click', 'change', ...
1219 * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
1220 *
1221 * @param eventName
1222 * @param eventHandlers
1223 */
1224 const eventHandlers = (eventName, eventHandlers) => {
1225 document.addEventListener(eventName, e => {
1226 const target = e.target;
1227 let args = {
1228 e,
1229 target
1230 };
1231 eventHandlers.forEach(eventHandler => {
1232 args = {
1233 ...args,
1234 ...eventHandler
1235 };
1236
1237 //console.log( args );
1238
1239 // Check condition before call back
1240 if (eventHandler.conditionBeforeCallBack) {
1241 if (eventHandler.conditionBeforeCallBack(args) !== true) {
1242 return;
1243 }
1244 }
1245
1246 // Special check for keydown event with checkIsEventEnter = true
1247 if (eventName === 'keydown' && eventHandler.checkIsEventEnter) {
1248 if (e.key !== 'Enter') {
1249 return;
1250 }
1251 }
1252 if (target.closest(eventHandler.selector)) {
1253 if (eventHandler.class) {
1254 // Call method of class, function callBack will understand exactly {this} is class object.
1255 eventHandler.class[eventHandler.callBack](args);
1256 } else {
1257 // For send args is objected, {this} is eventHandler object, not class object.
1258 eventHandler.callBack(args);
1259 }
1260 }
1261 });
1262 });
1263 };
1264
1265 /**
1266 * Debounce - delays function execution until after `wait` ms of inactivity.
1267 *
1268 * Each call resets the timer. Only the last call in a burst executes.
1269 *
1270 * USE CASES:
1271 * - Search inputs, form validation, window resize
1272 * - Multiple elements need independent timers
1273 * - When you need to call with different arguments
1274 *
1275 * EXAMPLES:
1276 * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
1277 * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
1278 *
1279 * const debouncedResize = debounce( recalculateLayout, 250 );
1280 * window.addEventListener('resize', debouncedResize);
1281 *
1282 * ⚠️ Create ONCE outside event handlers, not inside.
1283 *
1284 * @param {Function} func - Function to debounce (can be anonymous)
1285 * @param {number} wait - Milliseconds to wait (default: 500)
1286 * @return {Function} Debounced wrapper function
1287 * @since 4.3.7
1288 * @version 1.0.0
1289 */
1290 const debounce = (func, wait = 500) => {
1291 let timer;
1292 return args => {
1293 clearTimeout(timer);
1294 timer = setTimeout(() => func(args), wait);
1295 };
1296 };
1297
1298 /***/ },
1299
1300 /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"
1301 /*!*****************************************************************************************!*\
1302 !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***!
1303 \*****************************************************************************************/
1304 (module, __webpack_exports__, __webpack_require__) {
1305
1306 "use strict";
1307 __webpack_require__.r(__webpack_exports__);
1308 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1309 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1310 /* harmony export */ });
1311 /* 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");
1312 /* 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__);
1313 /* 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");
1314 /* 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__);
1315 // Imports
1316
1317
1318 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()));
1319 // Module
1320 ___CSS_LOADER_EXPORT___.push([module.id, `/*!
1321 * Toastify js 1.12.0
1322 * https://github.com/apvarun/toastify-js
1323 * @license MIT licensed
1324 *
1325 * Copyright (C) 2018 Varun A P
1326 */
1327
1328 .toastify {
1329 padding: 12px 20px;
1330 color: #ffffff;
1331 display: inline-block;
1332 box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
1333 background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
1334 background: linear-gradient(135deg, #73a5ff, #5477f5);
1335 position: fixed;
1336 opacity: 0;
1337 transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
1338 border-radius: 2px;
1339 cursor: pointer;
1340 text-decoration: none;
1341 max-width: calc(50% - 20px);
1342 z-index: 2147483647;
1343 }
1344
1345 .toastify.on {
1346 opacity: 1;
1347 }
1348
1349 .toast-close {
1350 background: transparent;
1351 border: 0;
1352 color: white;
1353 cursor: pointer;
1354 font-family: inherit;
1355 font-size: 1em;
1356 opacity: 0.4;
1357 padding: 0 5px;
1358 }
1359
1360 .toastify-right {
1361 right: 15px;
1362 }
1363
1364 .toastify-left {
1365 left: 15px;
1366 }
1367
1368 .toastify-top {
1369 top: -150px;
1370 }
1371
1372 .toastify-bottom {
1373 bottom: -150px;
1374 }
1375
1376 .toastify-rounded {
1377 border-radius: 25px;
1378 }
1379
1380 .toastify-avatar {
1381 width: 1.5em;
1382 height: 1.5em;
1383 margin: -7px 5px;
1384 border-radius: 2px;
1385 }
1386
1387 .toastify-center {
1388 margin-left: auto;
1389 margin-right: auto;
1390 left: 0;
1391 right: 0;
1392 max-width: fit-content;
1393 max-width: -moz-fit-content;
1394 }
1395
1396 @media only screen and (max-width: 360px) {
1397 .toastify-right, .toastify-left {
1398 margin-left: auto;
1399 margin-right: auto;
1400 left: 0;
1401 right: 0;
1402 max-width: fit-content;
1403 }
1404 }
1405 `, "",{"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":""}]);
1406 // Exports
1407 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
1408
1409
1410 /***/ },
1411
1412 /***/ "./node_modules/css-loader/dist/runtime/api.js"
1413 /*!*****************************************************!*\
1414 !*** ./node_modules/css-loader/dist/runtime/api.js ***!
1415 \*****************************************************/
1416 (module) {
1417
1418 "use strict";
1419
1420
1421 /*
1422 MIT License http://www.opensource.org/licenses/mit-license.php
1423 Author Tobias Koppers @sokra
1424 */
1425 module.exports = function (cssWithMappingToString) {
1426 var list = [];
1427
1428 // return the list of modules as css string
1429 list.toString = function toString() {
1430 return this.map(function (item) {
1431 var content = "";
1432 var needLayer = typeof item[5] !== "undefined";
1433 if (item[4]) {
1434 content += "@supports (".concat(item[4], ") {");
1435 }
1436 if (item[2]) {
1437 content += "@media ".concat(item[2], " {");
1438 }
1439 if (needLayer) {
1440 content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
1441 }
1442 content += cssWithMappingToString(item);
1443 if (needLayer) {
1444 content += "}";
1445 }
1446 if (item[2]) {
1447 content += "}";
1448 }
1449 if (item[4]) {
1450 content += "}";
1451 }
1452 return content;
1453 }).join("");
1454 };
1455
1456 // import a list of modules into the list
1457 list.i = function i(modules, media, dedupe, supports, layer) {
1458 if (typeof modules === "string") {
1459 modules = [[null, modules, undefined]];
1460 }
1461 var alreadyImportedModules = {};
1462 if (dedupe) {
1463 for (var k = 0; k < this.length; k++) {
1464 var id = this[k][0];
1465 if (id != null) {
1466 alreadyImportedModules[id] = true;
1467 }
1468 }
1469 }
1470 for (var _k = 0; _k < modules.length; _k++) {
1471 var item = [].concat(modules[_k]);
1472 if (dedupe && alreadyImportedModules[item[0]]) {
1473 continue;
1474 }
1475 if (typeof layer !== "undefined") {
1476 if (typeof item[5] === "undefined") {
1477 item[5] = layer;
1478 } else {
1479 item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
1480 item[5] = layer;
1481 }
1482 }
1483 if (media) {
1484 if (!item[2]) {
1485 item[2] = media;
1486 } else {
1487 item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
1488 item[2] = media;
1489 }
1490 }
1491 if (supports) {
1492 if (!item[4]) {
1493 item[4] = "".concat(supports);
1494 } else {
1495 item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
1496 item[4] = supports;
1497 }
1498 }
1499 list.push(item);
1500 }
1501 };
1502 return list;
1503 };
1504
1505 /***/ },
1506
1507 /***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js"
1508 /*!************************************************************!*\
1509 !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***!
1510 \************************************************************/
1511 (module) {
1512
1513 "use strict";
1514
1515
1516 module.exports = function (item) {
1517 var content = item[1];
1518 var cssMapping = item[3];
1519 if (!cssMapping) {
1520 return content;
1521 }
1522 if (typeof btoa === "function") {
1523 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
1524 var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
1525 var sourceMapping = "/*# ".concat(data, " */");
1526 return [content].concat([sourceMapping]).join("\n");
1527 }
1528 return [content].join("\n");
1529 };
1530
1531 /***/ },
1532
1533 /***/ "./node_modules/toastify-js/src/toastify.css"
1534 /*!***************************************************!*\
1535 !*** ./node_modules/toastify-js/src/toastify.css ***!
1536 \***************************************************/
1537 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1538
1539 "use strict";
1540 __webpack_require__.r(__webpack_exports__);
1541 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1542 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1543 /* harmony export */ });
1544 /* 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");
1545 /* 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__);
1546 /* 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");
1547 /* 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__);
1548 /* 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");
1549 /* 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__);
1550 /* 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");
1551 /* 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__);
1552 /* 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");
1553 /* 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__);
1554 /* 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");
1555 /* 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__);
1556 /* 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");
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568 var options = {};
1569
1570 options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());
1571 options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());
1572
1573 options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head");
1574
1575 options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());
1576 options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());
1577
1578 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);
1579
1580
1581
1582
1583 /* 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);
1584
1585
1586 /***/ },
1587
1588 /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"
1589 /*!****************************************************************************!*\
1590 !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
1591 \****************************************************************************/
1592 (module) {
1593
1594 "use strict";
1595
1596
1597 var stylesInDOM = [];
1598 function getIndexByIdentifier(identifier) {
1599 var result = -1;
1600 for (var i = 0; i < stylesInDOM.length; i++) {
1601 if (stylesInDOM[i].identifier === identifier) {
1602 result = i;
1603 break;
1604 }
1605 }
1606 return result;
1607 }
1608 function modulesToDom(list, options) {
1609 var idCountMap = {};
1610 var identifiers = [];
1611 for (var i = 0; i < list.length; i++) {
1612 var item = list[i];
1613 var id = options.base ? item[0] + options.base : item[0];
1614 var count = idCountMap[id] || 0;
1615 var identifier = "".concat(id, " ").concat(count);
1616 idCountMap[id] = count + 1;
1617 var indexByIdentifier = getIndexByIdentifier(identifier);
1618 var obj = {
1619 css: item[1],
1620 media: item[2],
1621 sourceMap: item[3],
1622 supports: item[4],
1623 layer: item[5]
1624 };
1625 if (indexByIdentifier !== -1) {
1626 stylesInDOM[indexByIdentifier].references++;
1627 stylesInDOM[indexByIdentifier].updater(obj);
1628 } else {
1629 var updater = addElementStyle(obj, options);
1630 options.byIndex = i;
1631 stylesInDOM.splice(i, 0, {
1632 identifier: identifier,
1633 updater: updater,
1634 references: 1
1635 });
1636 }
1637 identifiers.push(identifier);
1638 }
1639 return identifiers;
1640 }
1641 function addElementStyle(obj, options) {
1642 var api = options.domAPI(options);
1643 api.update(obj);
1644 var updater = function updater(newObj) {
1645 if (newObj) {
1646 if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
1647 return;
1648 }
1649 api.update(obj = newObj);
1650 } else {
1651 api.remove();
1652 }
1653 };
1654 return updater;
1655 }
1656 module.exports = function (list, options) {
1657 options = options || {};
1658 list = list || [];
1659 var lastIdentifiers = modulesToDom(list, options);
1660 return function update(newList) {
1661 newList = newList || [];
1662 for (var i = 0; i < lastIdentifiers.length; i++) {
1663 var identifier = lastIdentifiers[i];
1664 var index = getIndexByIdentifier(identifier);
1665 stylesInDOM[index].references--;
1666 }
1667 var newLastIdentifiers = modulesToDom(newList, options);
1668 for (var _i = 0; _i < lastIdentifiers.length; _i++) {
1669 var _identifier = lastIdentifiers[_i];
1670 var _index = getIndexByIdentifier(_identifier);
1671 if (stylesInDOM[_index].references === 0) {
1672 stylesInDOM[_index].updater();
1673 stylesInDOM.splice(_index, 1);
1674 }
1675 }
1676 lastIdentifiers = newLastIdentifiers;
1677 };
1678 };
1679
1680 /***/ },
1681
1682 /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js"
1683 /*!********************************************************************!*\
1684 !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
1685 \********************************************************************/
1686 (module) {
1687
1688 "use strict";
1689
1690
1691 var memo = {};
1692
1693 /* istanbul ignore next */
1694 function getTarget(target) {
1695 if (typeof memo[target] === "undefined") {
1696 var styleTarget = document.querySelector(target);
1697
1698 // Special case to return head of iframe instead of iframe itself
1699 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
1700 try {
1701 // This will throw an exception if access to iframe is blocked
1702 // due to cross-origin restrictions
1703 styleTarget = styleTarget.contentDocument.head;
1704 } catch (e) {
1705 // istanbul ignore next
1706 styleTarget = null;
1707 }
1708 }
1709 memo[target] = styleTarget;
1710 }
1711 return memo[target];
1712 }
1713
1714 /* istanbul ignore next */
1715 function insertBySelector(insert, style) {
1716 var target = getTarget(insert);
1717 if (!target) {
1718 throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
1719 }
1720 target.appendChild(style);
1721 }
1722 module.exports = insertBySelector;
1723
1724 /***/ },
1725
1726 /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"
1727 /*!**********************************************************************!*\
1728 !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
1729 \**********************************************************************/
1730 (module) {
1731
1732 "use strict";
1733
1734
1735 /* istanbul ignore next */
1736 function insertStyleElement(options) {
1737 var element = document.createElement("style");
1738 options.setAttributes(element, options.attributes);
1739 options.insert(element, options.options);
1740 return element;
1741 }
1742 module.exports = insertStyleElement;
1743
1744 /***/ },
1745
1746 /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"
1747 /*!**********************************************************************************!*\
1748 !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
1749 \**********************************************************************************/
1750 (module, __unused_webpack_exports, __webpack_require__) {
1751
1752 "use strict";
1753
1754
1755 /* istanbul ignore next */
1756 function setAttributesWithoutAttributes(styleElement) {
1757 var nonce = true ? __webpack_require__.nc : 0;
1758 if (nonce) {
1759 styleElement.setAttribute("nonce", nonce);
1760 }
1761 }
1762 module.exports = setAttributesWithoutAttributes;
1763
1764 /***/ },
1765
1766 /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"
1767 /*!***************************************************************!*\
1768 !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
1769 \***************************************************************/
1770 (module) {
1771
1772 "use strict";
1773
1774
1775 /* istanbul ignore next */
1776 function apply(styleElement, options, obj) {
1777 var css = "";
1778 if (obj.supports) {
1779 css += "@supports (".concat(obj.supports, ") {");
1780 }
1781 if (obj.media) {
1782 css += "@media ".concat(obj.media, " {");
1783 }
1784 var needLayer = typeof obj.layer !== "undefined";
1785 if (needLayer) {
1786 css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
1787 }
1788 css += obj.css;
1789 if (needLayer) {
1790 css += "}";
1791 }
1792 if (obj.media) {
1793 css += "}";
1794 }
1795 if (obj.supports) {
1796 css += "}";
1797 }
1798 var sourceMap = obj.sourceMap;
1799 if (sourceMap && typeof btoa !== "undefined") {
1800 css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
1801 }
1802
1803 // For old IE
1804 /* istanbul ignore if */
1805 options.styleTagTransform(css, styleElement, options.options);
1806 }
1807 function removeStyleElement(styleElement) {
1808 // istanbul ignore if
1809 if (styleElement.parentNode === null) {
1810 return false;
1811 }
1812 styleElement.parentNode.removeChild(styleElement);
1813 }
1814
1815 /* istanbul ignore next */
1816 function domAPI(options) {
1817 if (typeof document === "undefined") {
1818 return {
1819 update: function update() {},
1820 remove: function remove() {}
1821 };
1822 }
1823 var styleElement = options.insertStyleElement(options);
1824 return {
1825 update: function update(obj) {
1826 apply(styleElement, options, obj);
1827 },
1828 remove: function remove() {
1829 removeStyleElement(styleElement);
1830 }
1831 };
1832 }
1833 module.exports = domAPI;
1834
1835 /***/ },
1836
1837 /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"
1838 /*!*********************************************************************!*\
1839 !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
1840 \*********************************************************************/
1841 (module) {
1842
1843 "use strict";
1844
1845
1846 /* istanbul ignore next */
1847 function styleTagTransform(css, styleElement) {
1848 if (styleElement.styleSheet) {
1849 styleElement.styleSheet.cssText = css;
1850 } else {
1851 while (styleElement.firstChild) {
1852 styleElement.removeChild(styleElement.firstChild);
1853 }
1854 styleElement.appendChild(document.createTextNode(css));
1855 }
1856 }
1857 module.exports = styleTagTransform;
1858
1859 /***/ },
1860
1861 /***/ "./node_modules/toastify-js/src/toastify.js"
1862 /*!**************************************************!*\
1863 !*** ./node_modules/toastify-js/src/toastify.js ***!
1864 \**************************************************/
1865 (module) {
1866
1867 /*!
1868 * Toastify js 1.12.0
1869 * https://github.com/apvarun/toastify-js
1870 * @license MIT licensed
1871 *
1872 * Copyright (C) 2018 Varun A P
1873 */
1874 (function(root, factory) {
1875 if ( true && module.exports) {
1876 module.exports = factory();
1877 } else {
1878 root.Toastify = factory();
1879 }
1880 })(this, function(global) {
1881 // Object initialization
1882 var Toastify = function(options) {
1883 // Returning a new init object
1884 return new Toastify.lib.init(options);
1885 },
1886 // Library version
1887 version = "1.12.0";
1888
1889 // Set the default global options
1890 Toastify.defaults = {
1891 oldestFirst: true,
1892 text: "Toastify is awesome!",
1893 node: undefined,
1894 duration: 3000,
1895 selector: undefined,
1896 callback: function () {
1897 },
1898 destination: undefined,
1899 newWindow: false,
1900 close: false,
1901 gravity: "toastify-top",
1902 positionLeft: false,
1903 position: '',
1904 backgroundColor: '',
1905 avatar: "",
1906 className: "",
1907 stopOnFocus: true,
1908 onClick: function () {
1909 },
1910 offset: {x: 0, y: 0},
1911 escapeMarkup: true,
1912 ariaLive: 'polite',
1913 style: {background: ''}
1914 };
1915
1916 // Defining the prototype of the object
1917 Toastify.lib = Toastify.prototype = {
1918 toastify: version,
1919
1920 constructor: Toastify,
1921
1922 // Initializing the object with required parameters
1923 init: function(options) {
1924 // Verifying and validating the input object
1925 if (!options) {
1926 options = {};
1927 }
1928
1929 // Creating the options object
1930 this.options = {};
1931
1932 this.toastElement = null;
1933
1934 // Validating the options
1935 this.options.text = options.text || Toastify.defaults.text; // Display message
1936 this.options.node = options.node || Toastify.defaults.node; // Display content as node
1937 this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration
1938 this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector
1939 this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display
1940 this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination
1941 this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window
1942 this.options.close = options.close || Toastify.defaults.close; // Show toast close icon
1943 this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom
1944 this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right
1945 this.options.position = options.position || Toastify.defaults.position; // toast position - left or right
1946 this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color
1947 this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path
1948 this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast
1949 this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus
1950 this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click
1951 this.options.offset = options.offset || Toastify.defaults.offset; // toast offset
1952 this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup;
1953 this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive;
1954 this.options.style = options.style || Toastify.defaults.style;
1955 if(options.backgroundColor) {
1956 this.options.style.background = options.backgroundColor;
1957 }
1958
1959 // Returning the current object for chaining functions
1960 return this;
1961 },
1962
1963 // Building the DOM element
1964 buildToast: function() {
1965 // Validating if the options are defined
1966 if (!this.options) {
1967 throw "Toastify is not initialized";
1968 }
1969
1970 // Creating the DOM object
1971 var divElement = document.createElement("div");
1972 divElement.className = "toastify on " + this.options.className;
1973
1974 // Positioning toast to left or right or center
1975 if (!!this.options.position) {
1976 divElement.className += " toastify-" + this.options.position;
1977 } else {
1978 // To be depreciated in further versions
1979 if (this.options.positionLeft === true) {
1980 divElement.className += " toastify-left";
1981 console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.')
1982 } else {
1983 // Default position
1984 divElement.className += " toastify-right";
1985 }
1986 }
1987
1988 // Assigning gravity of element
1989 divElement.className += " " + this.options.gravity;
1990
1991 if (this.options.backgroundColor) {
1992 // This is being deprecated in favor of using the style HTML DOM property
1993 console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
1994 }
1995
1996 // Loop through our style object and apply styles to divElement
1997 for (var property in this.options.style) {
1998 divElement.style[property] = this.options.style[property];
1999 }
2000
2001 // Announce the toast to screen readers
2002 if (this.options.ariaLive) {
2003 divElement.setAttribute('aria-live', this.options.ariaLive)
2004 }
2005
2006 // Adding the toast message/node
2007 if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {
2008 // If we have a valid node, we insert it
2009 divElement.appendChild(this.options.node)
2010 } else {
2011 if (this.options.escapeMarkup) {
2012 divElement.innerText = this.options.text;
2013 } else {
2014 divElement.innerHTML = this.options.text;
2015 }
2016
2017 if (this.options.avatar !== "") {
2018 var avatarElement = document.createElement("img");
2019 avatarElement.src = this.options.avatar;
2020
2021 avatarElement.className = "toastify-avatar";
2022
2023 if (this.options.position == "left" || this.options.positionLeft === true) {
2024 // Adding close icon on the left of content
2025 divElement.appendChild(avatarElement);
2026 } else {
2027 // Adding close icon on the right of content
2028 divElement.insertAdjacentElement("afterbegin", avatarElement);
2029 }
2030 }
2031 }
2032
2033 // Adding a close icon to the toast
2034 if (this.options.close === true) {
2035 // Create a span for close element
2036 var closeElement = document.createElement("button");
2037 closeElement.type = "button";
2038 closeElement.setAttribute("aria-label", "Close");
2039 closeElement.className = "toast-close";
2040 closeElement.innerHTML = "&#10006;";
2041
2042 // Triggering the removal of toast from DOM on close click
2043 closeElement.addEventListener(
2044 "click",
2045 function(event) {
2046 event.stopPropagation();
2047 this.removeElement(this.toastElement);
2048 window.clearTimeout(this.toastElement.timeOutValue);
2049 }.bind(this)
2050 );
2051
2052 //Calculating screen width
2053 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
2054
2055 // Adding the close icon to the toast element
2056 // Display on the right if screen width is less than or equal to 360px
2057 if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) {
2058 // Adding close icon on the left of content
2059 divElement.insertAdjacentElement("afterbegin", closeElement);
2060 } else {
2061 // Adding close icon on the right of content
2062 divElement.appendChild(closeElement);
2063 }
2064 }
2065
2066 // Clear timeout while toast is focused
2067 if (this.options.stopOnFocus && this.options.duration > 0) {
2068 var self = this;
2069 // stop countdown
2070 divElement.addEventListener(
2071 "mouseover",
2072 function(event) {
2073 window.clearTimeout(divElement.timeOutValue);
2074 }
2075 )
2076 // add back the timeout
2077 divElement.addEventListener(
2078 "mouseleave",
2079 function() {
2080 divElement.timeOutValue = window.setTimeout(
2081 function() {
2082 // Remove the toast from DOM
2083 self.removeElement(divElement);
2084 },
2085 self.options.duration
2086 )
2087 }
2088 )
2089 }
2090
2091 // Adding an on-click destination path
2092 if (typeof this.options.destination !== "undefined") {
2093 divElement.addEventListener(
2094 "click",
2095 function(event) {
2096 event.stopPropagation();
2097 if (this.options.newWindow === true) {
2098 window.open(this.options.destination, "_blank");
2099 } else {
2100 window.location = this.options.destination;
2101 }
2102 }.bind(this)
2103 );
2104 }
2105
2106 if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") {
2107 divElement.addEventListener(
2108 "click",
2109 function(event) {
2110 event.stopPropagation();
2111 this.options.onClick();
2112 }.bind(this)
2113 );
2114 }
2115
2116 // Adding offset
2117 if(typeof this.options.offset === "object") {
2118
2119 var x = getAxisOffsetAValue("x", this.options);
2120 var y = getAxisOffsetAValue("y", this.options);
2121
2122 var xOffset = this.options.position == "left" ? x : "-" + x;
2123 var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y;
2124
2125 divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")";
2126
2127 }
2128
2129 // Returning the generated element
2130 return divElement;
2131 },
2132
2133 // Displaying the toast
2134 showToast: function() {
2135 // Creating the DOM object for the toast
2136 this.toastElement = this.buildToast();
2137
2138 // Getting the root element to with the toast needs to be added
2139 var rootElement;
2140 if (typeof this.options.selector === "string") {
2141 rootElement = document.getElementById(this.options.selector);
2142 } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) {
2143 rootElement = this.options.selector;
2144 } else {
2145 rootElement = document.body;
2146 }
2147
2148 // Validating if root element is present in DOM
2149 if (!rootElement) {
2150 throw "Root element is not defined";
2151 }
2152
2153 // Adding the DOM element
2154 var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild;
2155 rootElement.insertBefore(this.toastElement, elementToInsert);
2156
2157 // Repositioning the toasts in case multiple toasts are present
2158 Toastify.reposition();
2159
2160 if (this.options.duration > 0) {
2161 this.toastElement.timeOutValue = window.setTimeout(
2162 function() {
2163 // Remove the toast from DOM
2164 this.removeElement(this.toastElement);
2165 }.bind(this),
2166 this.options.duration
2167 ); // Binding `this` for function invocation
2168 }
2169
2170 // Supporting function chaining
2171 return this;
2172 },
2173
2174 hideToast: function() {
2175 if (this.toastElement.timeOutValue) {
2176 clearTimeout(this.toastElement.timeOutValue);
2177 }
2178 this.removeElement(this.toastElement);
2179 },
2180
2181 // Removing the element from the DOM
2182 removeElement: function(toastElement) {
2183 // Hiding the element
2184 // toastElement.classList.remove("on");
2185 toastElement.className = toastElement.className.replace(" on", "");
2186
2187 // Removing the element from DOM after transition end
2188 window.setTimeout(
2189 function() {
2190 // remove options node if any
2191 if (this.options.node && this.options.node.parentNode) {
2192 this.options.node.parentNode.removeChild(this.options.node);
2193 }
2194
2195 // Remove the element from the DOM, only when the parent node was not removed before.
2196 if (toastElement.parentNode) {
2197 toastElement.parentNode.removeChild(toastElement);
2198 }
2199
2200 // Calling the callback function
2201 this.options.callback.call(toastElement);
2202
2203 // Repositioning the toasts again
2204 Toastify.reposition();
2205 }.bind(this),
2206 400
2207 ); // Binding `this` for function invocation
2208 },
2209 };
2210
2211 // Positioning the toasts on the DOM
2212 Toastify.reposition = function() {
2213
2214 // Top margins with gravity
2215 var topLeftOffsetSize = {
2216 top: 15,
2217 bottom: 15,
2218 };
2219 var topRightOffsetSize = {
2220 top: 15,
2221 bottom: 15,
2222 };
2223 var offsetSize = {
2224 top: 15,
2225 bottom: 15,
2226 };
2227
2228 // Get all toast messages on the DOM
2229 var allToasts = document.getElementsByClassName("toastify");
2230
2231 var classUsed;
2232
2233 // Modifying the position of each toast element
2234 for (var i = 0; i < allToasts.length; i++) {
2235 // Getting the applied gravity
2236 if (containsClass(allToasts[i], "toastify-top") === true) {
2237 classUsed = "toastify-top";
2238 } else {
2239 classUsed = "toastify-bottom";
2240 }
2241
2242 var height = allToasts[i].offsetHeight;
2243 classUsed = classUsed.substr(9, classUsed.length-1)
2244 // Spacing between toasts
2245 var offset = 15;
2246
2247 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
2248
2249 // Show toast in center if screen with less than or equal to 360px
2250 if (width <= 360) {
2251 // Setting the position
2252 allToasts[i].style[classUsed] = offsetSize[classUsed] + "px";
2253
2254 offsetSize[classUsed] += height + offset;
2255 } else {
2256 if (containsClass(allToasts[i], "toastify-left") === true) {
2257 // Setting the position
2258 allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px";
2259
2260 topLeftOffsetSize[classUsed] += height + offset;
2261 } else {
2262 // Setting the position
2263 allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px";
2264
2265 topRightOffsetSize[classUsed] += height + offset;
2266 }
2267 }
2268 }
2269
2270 // Supporting function chaining
2271 return this;
2272 };
2273
2274 // Helper function to get offset.
2275 function getAxisOffsetAValue(axis, options) {
2276
2277 if(options.offset[axis]) {
2278 if(isNaN(options.offset[axis])) {
2279 return options.offset[axis];
2280 }
2281 else {
2282 return options.offset[axis] + 'px';
2283 }
2284 }
2285
2286 return '0px';
2287
2288 }
2289
2290 function containsClass(elem, yourClass) {
2291 if (!elem || typeof yourClass !== "string") {
2292 return false;
2293 } else if (
2294 elem.className &&
2295 elem.className
2296 .trim()
2297 .split(/\s+/gi)
2298 .indexOf(yourClass) > -1
2299 ) {
2300 return true;
2301 } else {
2302 return false;
2303 }
2304 }
2305
2306 // Setting up the prototype for the init object
2307 Toastify.lib.init.prototype = Toastify.lib;
2308
2309 // Returning the Toastify function to be assigned to the window object/module
2310 return Toastify;
2311 });
2312
2313
2314 /***/ },
2315
2316 /***/ "react"
2317 /*!************************!*\
2318 !*** external "React" ***!
2319 \************************/
2320 (module) {
2321
2322 "use strict";
2323 module.exports = window["React"];
2324
2325 /***/ },
2326
2327 /***/ "@learnpress/quiz"
2328 /*!******************************!*\
2329 !*** external ["LP","quiz"] ***!
2330 \******************************/
2331 (module) {
2332
2333 "use strict";
2334 module.exports = window["LP"]["quiz"];
2335
2336 /***/ },
2337
2338 /***/ "@wordpress/element"
2339 /*!*********************************!*\
2340 !*** external ["wp","element"] ***!
2341 \*********************************/
2342 (module) {
2343
2344 "use strict";
2345 module.exports = window["wp"]["element"];
2346
2347 /***/ },
2348
2349 /***/ "@wordpress/url"
2350 /*!*****************************!*\
2351 !*** external ["wp","url"] ***!
2352 \*****************************/
2353 (module) {
2354
2355 "use strict";
2356 module.exports = window["wp"]["url"];
2357
2358 /***/ }
2359
2360 /******/ });
2361 /************************************************************************/
2362 /******/ // The module cache
2363 /******/ var __webpack_module_cache__ = {};
2364 /******/
2365 /******/ // The require function
2366 /******/ function __webpack_require__(moduleId) {
2367 /******/ // Check if module is in cache
2368 /******/ var cachedModule = __webpack_module_cache__[moduleId];
2369 /******/ if (cachedModule !== undefined) {
2370 /******/ return cachedModule.exports;
2371 /******/ }
2372 /******/ // Create a new module (and put it into the cache)
2373 /******/ var module = __webpack_module_cache__[moduleId] = {
2374 /******/ id: moduleId,
2375 /******/ // no module.loaded needed
2376 /******/ exports: {}
2377 /******/ };
2378 /******/
2379 /******/ // Execute the module function
2380 /******/ if (!(moduleId in __webpack_modules__)) {
2381 /******/ delete __webpack_module_cache__[moduleId];
2382 /******/ var e = new Error("Cannot find module '" + moduleId + "'");
2383 /******/ e.code = 'MODULE_NOT_FOUND';
2384 /******/ throw e;
2385 /******/ }
2386 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2387 /******/
2388 /******/ // Return the exports of the module
2389 /******/ return module.exports;
2390 /******/ }
2391 /******/
2392 /************************************************************************/
2393 /******/ /* webpack/runtime/compat get default export */
2394 /******/ (() => {
2395 /******/ // getDefaultExport function for compatibility with non-harmony modules
2396 /******/ __webpack_require__.n = (module) => {
2397 /******/ var getter = module && module.__esModule ?
2398 /******/ () => (module['default']) :
2399 /******/ () => (module);
2400 /******/ __webpack_require__.d(getter, { a: getter });
2401 /******/ return getter;
2402 /******/ };
2403 /******/ })();
2404 /******/
2405 /******/ /* webpack/runtime/define property getters */
2406 /******/ (() => {
2407 /******/ // define getter functions for harmony exports
2408 /******/ __webpack_require__.d = (exports, definition) => {
2409 /******/ for(var key in definition) {
2410 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2411 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2412 /******/ }
2413 /******/ }
2414 /******/ };
2415 /******/ })();
2416 /******/
2417 /******/ /* webpack/runtime/hasOwnProperty shorthand */
2418 /******/ (() => {
2419 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2420 /******/ })();
2421 /******/
2422 /******/ /* webpack/runtime/make namespace object */
2423 /******/ (() => {
2424 /******/ // define __esModule on exports
2425 /******/ __webpack_require__.r = (exports) => {
2426 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2427 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2428 /******/ }
2429 /******/ Object.defineProperty(exports, '__esModule', { value: true });
2430 /******/ };
2431 /******/ })();
2432 /******/
2433 /******/ /* webpack/runtime/nonce */
2434 /******/ (() => {
2435 /******/ __webpack_require__.nc = undefined;
2436 /******/ })();
2437 /******/
2438 /************************************************************************/
2439 var __webpack_exports__ = {};
2440 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
2441 (() => {
2442 "use strict";
2443 /*!******************************************************!*\
2444 !*** ./assets/src/apps/js/frontend/single-course.js ***!
2445 \******************************************************/
2446 __webpack_require__.r(__webpack_exports__);
2447 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2448 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
2449 /* harmony export */ enrollCourse: () => (/* binding */ enrollCourse),
2450 /* harmony export */ init: () => (/* binding */ init),
2451 /* harmony export */ initCourseSidebar: () => (/* binding */ initCourseSidebar),
2452 /* harmony export */ initCourseTabs: () => (/* binding */ initCourseTabs)
2453 /* harmony export */ });
2454 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
2455 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2456 /* harmony import */ var _single_course_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./single-course/index */ "./assets/src/apps/js/frontend/single-course/index.js");
2457 /* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
2458 /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
2459 /* harmony import */ var _single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./single-curriculum/skeleton */ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js");
2460 /* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./material */ "./assets/src/apps/js/frontend/material.js");
2461 /* harmony import */ var _tabs_scroll__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./tabs-scroll */ "./assets/src/apps/js/frontend/tabs-scroll.js");
2462 /* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../js/utils.js */ "./assets/src/js/utils.js");
2463 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js");
2464 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_8__);
2465 /* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css");
2466 /* harmony import */ var _js_frontend_copy_to_clipboard_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../js/frontend/copy-to-clipboard.js */ "./assets/src/js/frontend/copy-to-clipboard.js");
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"]);
2479 const init = () => {
2480 wp.element.render((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"], null));
2481 };
2482 const $ = jQuery;
2483 const initCourseTabs = function () {
2484 $('#learn-press-course-tabs').on('change', 'input[name="learn-press-course-tab-radio"]', function (e) {
2485 const selectedTab = $('input[name="learn-press-course-tab-radio"]:checked').val();
2486 LP.Cookies.set('course-tab', selectedTab);
2487 $('label[for="' + $(e.target).attr('id') + '"]').closest('li').addClass('active').siblings().removeClass('active');
2488 });
2489 };
2490 const initCourseSidebar = function initCourseSidebar() {
2491 const $sidebar = $('.course-summary-sidebar');
2492 if (!$sidebar.length) {
2493 return;
2494 }
2495 const $window = $(window);
2496 const $scrollable = $sidebar.children();
2497 const offset = $sidebar.offset();
2498 let scrollTop = 0;
2499 const maxHeight = $sidebar.height();
2500 const scrollHeight = $scrollable.height();
2501 const options = {
2502 offsetTop: 32
2503 };
2504 const onScroll = function () {
2505 scrollTop = $window.scrollTop();
2506 const top = scrollTop - offset.top + options.offsetTop;
2507 if (top < 0) {
2508 $sidebar.removeClass('slide-top slide-down');
2509 $scrollable.css('top', '');
2510 return;
2511 }
2512 if (top > maxHeight - scrollHeight) {
2513 $sidebar.removeClass('slide-down').addClass('slide-top');
2514 $scrollable.css('top', maxHeight - scrollHeight);
2515 } else {
2516 $sidebar.removeClass('slide-top').addClass('slide-down');
2517 $scrollable.css('top', options.offsetTop);
2518 }
2519 };
2520 $window.on('scroll.fixed-course-sidebar', onScroll).trigger('scroll.fixed-course-sidebar');
2521 };
2522
2523 // Rest API Enroll course - Nhamdv.
2524 const enrollCourse = () => {
2525 const formEnrolls = document.querySelectorAll('form.enroll-course');
2526 if (formEnrolls.length > 0) {
2527 formEnrolls.forEach(formEnroll => {
2528 const submit = async (id, btnEnroll) => {
2529 const status = 'error';
2530 try {
2531 const response = await wp.apiFetch({
2532 path: 'lp/v1/courses/enroll-course',
2533 method: 'POST',
2534 data: {
2535 id
2536 }
2537 });
2538 const {
2539 status,
2540 data: {
2541 redirect
2542 },
2543 message
2544 } = response;
2545 if (status === 'success') {
2546 btnEnroll.remove();
2547 } else {
2548 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnEnroll, 0);
2549 throw new Error(message);
2550 }
2551 if (message && status) {
2552 formEnroll.innerHTML += `<div class="learn-press-message ${status}">${message}</div>`;
2553 if (redirect) {
2554 window.location.href = redirect;
2555 }
2556 }
2557 } catch (error) {
2558 toastify_js__WEBPACK_IMPORTED_MODULE_8___default()({
2559 text: error.message,
2560 gravity: lpData.toast.gravity,
2561 // `top` or `bottom`
2562 position: lpData.toast.position,
2563 // `left`, `center` or `right`
2564 className: `${lpData.toast.classPrefix} ${status}`,
2565 close: lpData.toast.close == 1,
2566 stopOnFocus: lpData.toast.stopOnFocus == 1,
2567 duration: lpData.toast.duration
2568 }).showToast();
2569 }
2570 };
2571 formEnroll.addEventListener('submit', event => {
2572 event.preventDefault();
2573 const id = formEnroll.querySelector('input[name=enroll-course]').value;
2574 const btnEnroll = formEnroll.querySelector('button.button-enroll-course');
2575 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnEnroll, 1);
2576 submit(id, btnEnroll);
2577 });
2578 });
2579 }
2580
2581 // Reload when press back button in chrome.
2582 if (document.querySelector('.course-detail-info') !== null) {
2583 window.addEventListener('pageshow', event => {
2584 const hasCache = event.persisted || typeof window.performance != 'undefined' && String(window.performance.getEntriesByType('navigation')[0].type) == 'back_forward';
2585 if (hasCache) {
2586 location.reload();
2587 }
2588 });
2589 }
2590 };
2591
2592 // Rest API purchase course - Nhamdv.
2593 const purchaseCourse = () => {
2594 const forms = document.querySelectorAll('form.purchase-course');
2595 if (forms.length > 0) {
2596 forms.forEach(form => {
2597 // Allow Repurchase.
2598 const allowRepurchase = () => {
2599 const continueRepurchases = document.querySelectorAll('.lp_allow_repurchase_select');
2600 continueRepurchases.forEach(repurchase => {
2601 const radios = repurchase.querySelectorAll('[name=_lp_allow_repurchase_type]');
2602 for (let i = 0, length = radios.length; i < length; i++) {
2603 if (radios[i].checked) {
2604 const repurchaseType = radios[i].value;
2605 const id = form.querySelector('input[name=purchase-course]').value;
2606 const btnBuyNow = form.querySelector('button.button-purchase-course');
2607 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnBuyNow, 1);
2608 submit(id, btnBuyNow, repurchaseType);
2609 break;
2610 }
2611 }
2612 });
2613 };
2614 const submit = async (id, btn, repurchaseType = false) => {
2615 const status = 'error';
2616 try {
2617 const formData = new FormData(form);
2618 const dataSend = Object.fromEntries(Array.from(formData.keys(), key => {
2619 const val = formData.getAll(key);
2620 return [key, val.length > 1 ? val : val.pop()];
2621 }));
2622 dataSend.id = id;
2623 dataSend.repurchaseType = repurchaseType;
2624 const response = await wp.apiFetch({
2625 path: 'lp/v1/courses/purchase-course',
2626 method: 'POST',
2627 data: dataSend
2628 });
2629 const {
2630 status,
2631 data: {
2632 redirect,
2633 type,
2634 html,
2635 titlePopup
2636 },
2637 message
2638 } = response;
2639 if (status === 'success') {
2640 if (type === 'allow_repurchase') {
2641 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 0);
2642 } else {
2643 btn.remove();
2644 }
2645 } else {
2646 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 0);
2647 throw new Error(message);
2648 }
2649 if (type === 'allow_repurchase' && status === 'success') {
2650 if (!form.querySelector('.lp_allow_repurchase_select')) {
2651 if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].init()) {
2652 return;
2653 }
2654 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].elLPOverlay.show();
2655 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].setTitleModal(titlePopup || '');
2656 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].setContentModal(html);
2657 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].callBackYes = () => {
2658 _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].elLPOverlay.hide();
2659 allowRepurchase();
2660 };
2661 }
2662 } else if (message && status) {
2663 form.innerHTML += `<div class="learn-press-message ${status}">${message}</div>`;
2664 if ('success' === status && redirect) {
2665 window.location.href = redirect;
2666 }
2667 }
2668 } catch (error) {
2669 toastify_js__WEBPACK_IMPORTED_MODULE_8___default()({
2670 text: error.message,
2671 gravity: lpData.toast.gravity,
2672 // `top` or `bottom`
2673 position: lpData.toast.position,
2674 // `left`, `center` or `right`
2675 className: `${lpData.toast.classPrefix} ${status}`,
2676 close: lpData.toast.close == 1,
2677 stopOnFocus: lpData.toast.stopOnFocus == 1,
2678 duration: lpData.toast.duration
2679 }).showToast();
2680 }
2681 };
2682 form.addEventListener('submit', event => {
2683 event.preventDefault();
2684 const id = form.querySelector('input[name=purchase-course]').value;
2685 const btn = form.querySelector('button.button-purchase-course');
2686 (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 1);
2687 submit(id, btn);
2688 });
2689 });
2690 }
2691 };
2692 const retakeCourse = () => {
2693 const elFormRetakeCourses = document.querySelectorAll('.lp-form-retake-course');
2694 if (!elFormRetakeCourses.length) {
2695 return;
2696 }
2697 elFormRetakeCourses.forEach(elFormRetakeCourse => {
2698 const elButtonRetakeCourses = elFormRetakeCourse.querySelector('.button-retake-course');
2699 const elCourseId = elFormRetakeCourse.querySelector('[name=retake-course]').value;
2700 const elAjaxMessage = elFormRetakeCourse.querySelector('.lp-ajax-message');
2701 const submit = elButtonRetakeCourse => {
2702 wp.apiFetch({
2703 path: '/lp/v1/courses/retake-course',
2704 method: 'POST',
2705 data: {
2706 id: elCourseId
2707 }
2708 }).then(res => {
2709 const {
2710 status,
2711 message,
2712 data
2713 } = res;
2714 elAjaxMessage.innerHTML = message;
2715 if (undefined != status && status === 'success') {
2716 elButtonRetakeCourse.style.display = 'none';
2717 setTimeout(() => {
2718 window.location.replace(data.url_redirect);
2719 }, 1000);
2720 } else {
2721 elAjaxMessage.classList.add('error');
2722 }
2723 }).catch(err => {
2724 elAjaxMessage.classList.add('error');
2725 elAjaxMessage.innerHTML = 'error: ' + err.message;
2726 }).then(() => {
2727 elButtonRetakeCourse.classList.remove('loading');
2728 elButtonRetakeCourse.disabled = false;
2729 elAjaxMessage.style.display = 'block';
2730 });
2731 };
2732 elFormRetakeCourse.addEventListener('submit', e => {
2733 e.preventDefault();
2734 });
2735 elButtonRetakeCourses.addEventListener('click', e => {
2736 e.preventDefault();
2737 elButtonRetakeCourses.classList.add('loading');
2738 elButtonRetakeCourses.disabled = true;
2739 submit(elButtonRetakeCourses);
2740 });
2741 });
2742 };
2743
2744 // Rest API load content course progress - Nhamdv.
2745 const courseProgress = () => {
2746 const elements = document.querySelectorAll('.lp-course-progress-wrapper');
2747 if (!elements.length) {
2748 return;
2749 }
2750 if ('IntersectionObserver' in window) {
2751 const eleObserver = new IntersectionObserver((entries, observer) => {
2752 entries.forEach(entry => {
2753 if (entry.isIntersecting) {
2754 const ele = entry.target;
2755 setTimeout(function () {
2756 getResponse(ele);
2757 }, 600);
2758 eleObserver.unobserve(ele);
2759 }
2760 });
2761 });
2762 [...elements].map(ele => eleObserver.observe(ele));
2763 }
2764 const getResponse = async ele => {
2765 let url = 'lp/v1/lazy-load/course-progress';
2766 if (lpData.urlParams.hasOwnProperty('lang')) {
2767 url += '?lang=' + lpData.urlParams.lang;
2768 }
2769 const response = await wp.apiFetch({
2770 path: url,
2771 method: 'POST',
2772 data: {
2773 courseId: lpGlobalSettings.post_id || '',
2774 userId: lpData.user_id || ''
2775 }
2776 });
2777 const {
2778 data
2779 } = response;
2780 ele.innerHTML = data;
2781 };
2782 };
2783 const accordionExtraTab = () => {
2784 const elements = document.querySelectorAll('.course-extra-box');
2785 [...elements].map(ele => {
2786 const title = ele.querySelector('.course-extra-box__title');
2787 ele.classList.remove('active');
2788 const content = ele.querySelector('.course-extra-box__content');
2789 content.style.height = '0';
2790 title.addEventListener('click', () => {
2791 const isActive = ele.classList.contains('active');
2792 [...elements].forEach(otherEle => {
2793 if (otherEle !== ele) {
2794 otherEle.classList.remove('active');
2795 otherEle.querySelector('.course-extra-box__content').style.height = '0';
2796 }
2797 });
2798 if (isActive) {
2799 ele.classList.remove('active');
2800 content.style.height = '0';
2801 } else {
2802 ele.classList.add('active');
2803 content.style.height = content.scrollHeight + 'px';
2804 }
2805 });
2806 });
2807 };
2808 const courseContinue = () => {
2809 const formContinue = document.querySelectorAll('form.continue-course');
2810 if (formContinue.length && lpData.user_id > 0) {
2811 const getResponse = async ele => {
2812 const response = await wp.apiFetch({
2813 path: 'lp/v1/courses/continue-course',
2814 method: 'POST',
2815 data: {
2816 courseId: lpGlobalSettings.post_id || '',
2817 userId: lpGlobalSettings.user_id || ''
2818 }
2819 });
2820 return response;
2821 };
2822 getResponse(formContinue).then(function (result) {
2823 if (result.status === 'success') {
2824 formContinue.forEach(form => {
2825 form.style.display = 'inline-block';
2826 form.action = result.data;
2827 });
2828 }
2829 });
2830 }
2831 };
2832
2833 document.addEventListener('DOMContentLoaded', function () {
2834 const $popup = $('#popup-course');
2835 let timerClearScroll;
2836 const $curriculum = $('#learn-press-course-curriculum');
2837 accordionExtraTab();
2838 initCourseTabs();
2839 initCourseSidebar();
2840 enrollCourse();
2841 purchaseCourse();
2842 retakeCourse();
2843 courseProgress();
2844 courseContinue();
2845 _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__["default"].init();
2846 (0,_material__WEBPACK_IMPORTED_MODULE_5__["default"])();
2847 //courseCurriculumSkeleton();
2848 (0,_tabs_scroll__WEBPACK_IMPORTED_MODULE_6__["default"])();
2849 (0,_js_frontend_copy_to_clipboard_js__WEBPACK_IMPORTED_MODULE_10__["default"])();
2850 });
2851 const detectedElCurriculum = setInterval(function () {
2852 const elementCurriculum = document.querySelector('.learnpress-course-curriculum');
2853 if (elementCurriculum) {
2854 (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__["default"])();
2855 clearInterval(detectedElCurriculum);
2856 }
2857 }, 1);
2858
2859 // Add callback for Thimkits
2860 LP.Hook.addAction('lp_course_curriculum_skeleton', function (id) {
2861 (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__["default"])(id);
2862 });
2863 })();
2864
2865 /******/ })()
2866 ;
2867 //# sourceMappingURL=single-course.js.map