LearnPress – WordPress LMS Plugin - Version 4.0.3

Version Description

~ Fixed: tool "Reset course progress" ~ Added: tool "Create Database Indexes" ~ Fixed js button "Retake course" if have more than one. ~ Added: tool "Re upgrade Database" ~ If DB upgrade not success

Download this release

Release Info

Developer ThimPress
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 4.0.3
Comparing to
See all releases

Code changes from version 4.0.2 to 4.0.3

Files changed (65) hide show
  1. assets/js/dist/admin/editor/question.min.js +1 -1
  2. assets/js/dist/admin/pages/statistic.js +5 -1
  3. assets/js/dist/admin/pages/statistic.min.js +1 -1
  4. assets/js/dist/admin/pages/tools.js +228 -1
  5. assets/js/dist/admin/pages/tools.min.js +1 -1
  6. assets/js/dist/frontend/config.min.js +1 -1
  7. assets/js/dist/frontend/custom.min.js +1 -1
  8. assets/js/dist/frontend/lesson.min.js +1 -1
  9. assets/js/dist/frontend/modal.min.js +1 -1
  10. assets/js/dist/frontend/question-types.min.js +1 -1
  11. assets/js/dist/frontend/quiz.js +252 -0
  12. assets/js/dist/frontend/quiz.min.js +2 -2
  13. assets/js/dist/frontend/single-course.js +20 -9
  14. assets/js/dist/frontend/single-course.min.js +1 -1
  15. assets/js/dist/frontend/single-curriculum.js +124 -4
  16. assets/js/dist/frontend/single-curriculum.min.js +1 -1
  17. assets/js/dist/js/data-controls.min.js +1 -1
  18. assets/src/apps/js/admin/pages/statistic.js +5 -1
  19. assets/src/apps/js/admin/pages/tools.js +4 -0
  20. assets/src/apps/js/admin/pages/tools/database/create_indexs.js +135 -0
  21. assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js +53 -0
  22. assets/src/apps/js/admin/pages/tools/database/upgrade.js +6 -0
  23. assets/src/apps/js/frontend/quiz/components/result/index.js +12 -0
  24. assets/src/apps/js/frontend/single-course.js +12 -9
  25. assets/src/apps/js/frontend/single-curriculum/components/items-progress.js +47 -0
  26. assets/src/apps/js/frontend/single-curriculum/index.js +3 -0
  27. assets/src/apps/js/utils/lp-modal-overlay.js +11 -1
  28. inc/abstracts/abstract-api_bk_to_remove.php +0 -79
  29. inc/abstracts/abstract-rest-api.php +1 -1
  30. inc/admin/class-lp-admin-assets.php +2 -0
  31. inc/admin/class-lp-reset-data.php +48 -16
  32. inc/admin/meta-box/class-lp-meta-box-v3.php +0 -316
  33. inc/admin/views/tools/course/html-course.php +0 -87
  34. inc/admin/views/tools/course/html-user.php +6 -2
  35. inc/admin/views/tools/database/html-create-indexs-tables.php +26 -0
  36. inc/admin/views/tools/database/html-reupgrade-db.php +25 -0
  37. inc/admin/views/tools/html-database.php +3 -0
  38. inc/databases/class-lp-db.php +63 -6
  39. inc/lp-template-functions.php +1 -1
  40. inc/rest-api/admin/class-lp-admin-core-api.php +0 -33
  41. inc/rest-api/class-lp-admin-core-api.php +47 -0
  42. inc/rest-api/class-lp-core-api.php +15 -4
  43. inc/rest-api/class-lp-rest-authentication.php +1 -1
  44. inc/rest-api/{admin → v1/admin}/class-lp-admin-rest-course-controller.php +0 -0
  45. inc/rest-api/{admin → v1/admin}/class-lp-admin-rest-database-controller.php +90 -3
  46. inc/rest-api/{admin → v1/admin}/class-lp-admin-rest-question-controller.php +0 -0
  47. inc/rest-api/v1/admin/class-lp-admin-rest-tools-controller.php +136 -0
  48. inc/rest-api/{class-lp-rest-courses-controller.php → v1/frontend/class-lp-rest-courses-controller.php} +5 -0
  49. inc/rest-api/{class-lp-rest-lazy-load-controller.php → v1/frontend/class-lp-rest-lazy-load-controller.php} +51 -0
  50. inc/rest-api/{class-lp-rest-settings-controller.php → v1/frontend/class-lp-rest-settings-controller.php} +0 -0
  51. inc/rest-api/{class-lp-rest-users-controller.php → v1/frontend/class-lp-rest-users-controller.php} +0 -0
  52. inc/shortcodes/class-lp-shortcode-profile.php +5 -5
  53. inc/templates/abstract-template.php +2 -0
  54. inc/templates/class-lp-template-course.php +49 -28
  55. inc/updates/learnpress-upgrade-4.php +43 -0
  56. inc/user/abstract-lp-user.php +13 -3
  57. inc/user/class-lp-user-factory.php +2 -0
  58. languages/learnpress.pot +1 -1
  59. learnpress.php +2 -2
  60. readme.txt +7 -1
  61. templates/global/lp-group-step.php +37 -0
  62. templates/pages/profile.php +0 -2
  63. templates/profile/tabs.php +1 -2
  64. templates/single-course/buttons/finish.php +1 -6
  65. templates/single-course/content-item/popup-header.php +0 -6
assets/js/dist/admin/editor/question.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}({0:function(e,t,n){"use strict";function o(e){var t=window.jQuery||jQuery,n=Vue.http;e=t.extend({ns:"LPRequest",store:!1},e||{});var o=null;LP.Request=function(r){return o=t("#publishing-action"),r.id=e.store.getters.id,r.nonce=e.store.getters.nonce,r["lp-ajax"]=e.store.getters.action,r.code=e.store.getters.code,o.find("#publish").addClass("disabled"),o.find(".spinner").addClass("is-active"),o.addClass("code-"+r.code),n.post(e.store.getters.urlAjax,r,{emulateJSON:!0,params:{namespace:e.ns,code:r.code}})},n.interceptors.push((function(t,n){t.params.namespace===e.ns?(e.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?e.store.dispatch("requestCompleted","successful"):e.store.dispatch("requestCompleted","failed"),o.removeClass("code-"+t.params.code),o.attr("class")||(o.find("#publish").removeClass("disabled"),o.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(t,"a",(function(){return o}))},14:function(e,t,n){"use strict";n.r(t);var o=n(0),r={id:function(e){return e.id},type:function(e){return e.type},code:function(e){return Date.now()},autoDraft:function(e){return e.auto_draft},answers:function(e){return Object.values(e.answers)||[]},settings:function(e){return e.setting},types:function(e){return e.questionTypes||[]},numberCorrect:function(e){var t=0;return Object.keys(e.answers).forEach((function(n){"yes"===e.answers[n].is_true&&(t+=1)})),t},status:function(e){return e.status},currentRequest:function(e){return e.countCurrentRequest||0},action:function(e){return e.action},nonce:function(e){return e.nonce},externalComponent:function(e){return e.externalComponent||[]},supportAnswerOptions:function(e){return e.supportAnswerOptions||[]},state:function(e){return e},i18n:function(e){return e.i18n}},u={UPDATE_STATUS:function(e,t){e.status=t},UPDATE_AUTO_DRAFT_STATUS:function(e,t){e.auto_draft=t},CHANGE_QUESTION_TYPE:function(e,t){e.answers=t.answers,e.type=t.type},SET_ANSWERS:function(e,t){e.answers=t},DELETE_ANSWER:function(e,t){for(var n=0,o=e.answers.length;n<o;n++)if(e.answers[n].question_answer_id==t){e.answers[n].question_answer_id=LP.uniqueId();break}},ADD_NEW_ANSWER:function(e,t){e.answers.push(t)},UPDATE_ANSWERS:function(e,t){e.answers=t},INCREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest--}},i={changeQuestionType:function(e,t){LP.Request({type:"change-question-type",question_type:t.type,draft_question:e.getters.autoDraft?JSON.stringify(t.question):""}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_AUTO_DRAFT_STATUS",!1),e.commit("CHANGE_QUESTION_TYPE",n.data))}))},updateAnswersOrder:function(e,t){LP.Request({type:"sort-answer",order:t}).then((function(e){e.body.success}))},updateAnswerTitle:function(e,t){void 0!==t.question_answer_id&&(t=JSON.stringify(t),LP.Request({type:"update-answer-title",answer:t}))},updateCorrectAnswer:function(e,t){LP.Request({type:"change-correct",correct:JSON.stringify(t)}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_ANSWERS",n.data),e.commit("UPDATE_AUTO_DRAFT_STATUS",!1))}))},deleteAnswer:function(e,t){e.commit("DELETE_ANSWER",t.id),LP.Request({type:"delete-answer",answer_id:t.id}).then((function(t){var n=t.body;n.success&&e.commit("SET_ANSWERS",n.data)}))},newAnswer:function(e,t){e.commit("ADD_NEW_ANSWER",t.answer),LP.Request({type:"new-answer"}).then((function(t){var n=t.body;n.success&&e.commit("UPDATE_ANSWERS",n.data)}))},newRequest:function(e){e.commit("INCREASE_NUMBER_REQUEST"),e.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(e,t){e.commit("DECREASE_NUMBER_REQUEST"),0===e.getters.currentRequest&&(e.commit("UPDATE_STATUS",t),window.onbeforeunload=null)}},s=window.jQuery||jQuery,c=function(e){return{state:s.extend({status:"successful",countCurrentRequest:0,i18n:s.extend({},e.i18n)},e.root),getters:r,mutations:u,actions:i}};n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex;var a=window.jQuery;a(document).ready((function(){window.LP_Question_Store=new $Vuex.Store(c(lp_question_editor)),Object(o.a)({ns:"LPQuestionEditorRequest",store:LP_Question_Store}),setTimeout((function(){a("#admin-editor-lp_question").length&&(window.LP_Question_Editor=new $Vue({el:"#admin-editor-lp_question",template:"<lp-question-editor></lp-question-editor>"}))}),100)}))},2:function(e,t){var n;n=jQuery,window.FIB={getSelectedText:function(){var e="";if(void 0!==window.getSelection){var t=window.getSelection();if(t.rangeCount){for(var n=document.createElement("div"),o=0,r=t.rangeCount;o<r;++o)n.appendChild(t.getRangeAt(o).cloneContents());e=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(e=document.selection.createRange().htmlText);return e},createTextNode:function(e){return document.createTextNode(e)},isContainHtml:function(e){var t=n(e),o="b.fib-blank";return t.is(o)||t.find(o).length||t.parent().is(o)},getSelectionRange:function(){var e="";return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e},outerHTML:function(e){return n("<div>").append(n(e).clone()).html()},doUpgrade:function(e){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(t){console.log(t),e&&e.call(t)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var e=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){e.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
1
+ !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}({0:function(e,t,n){"use strict";function o(e){var t=window.jQuery||jQuery,n=Vue.http;e=t.extend({ns:"LPRequest",store:!1},e||{});var o=null;LP.Request=function(r){return o=t("#publishing-action"),r.id=e.store.getters.id,r.nonce=e.store.getters.nonce,r["lp-ajax"]=e.store.getters.action,r.code=e.store.getters.code,o.find("#publish").addClass("disabled"),o.find(".spinner").addClass("is-active"),o.addClass("code-"+r.code),n.post(e.store.getters.urlAjax,r,{emulateJSON:!0,params:{namespace:e.ns,code:r.code}})},n.interceptors.push((function(t,n){t.params.namespace===e.ns?(e.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?e.store.dispatch("requestCompleted","successful"):e.store.dispatch("requestCompleted","failed"),o.removeClass("code-"+t.params.code),o.attr("class")||(o.find("#publish").removeClass("disabled"),o.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(t,"a",(function(){return o}))},15:function(e,t,n){"use strict";n.r(t);var o=n(0),r={id:function(e){return e.id},type:function(e){return e.type},code:function(e){return Date.now()},autoDraft:function(e){return e.auto_draft},answers:function(e){return Object.values(e.answers)||[]},settings:function(e){return e.setting},types:function(e){return e.questionTypes||[]},numberCorrect:function(e){var t=0;return Object.keys(e.answers).forEach((function(n){"yes"===e.answers[n].is_true&&(t+=1)})),t},status:function(e){return e.status},currentRequest:function(e){return e.countCurrentRequest||0},action:function(e){return e.action},nonce:function(e){return e.nonce},externalComponent:function(e){return e.externalComponent||[]},supportAnswerOptions:function(e){return e.supportAnswerOptions||[]},state:function(e){return e},i18n:function(e){return e.i18n}},u={UPDATE_STATUS:function(e,t){e.status=t},UPDATE_AUTO_DRAFT_STATUS:function(e,t){e.auto_draft=t},CHANGE_QUESTION_TYPE:function(e,t){e.answers=t.answers,e.type=t.type},SET_ANSWERS:function(e,t){e.answers=t},DELETE_ANSWER:function(e,t){for(var n=0,o=e.answers.length;n<o;n++)if(e.answers[n].question_answer_id==t){e.answers[n].question_answer_id=LP.uniqueId();break}},ADD_NEW_ANSWER:function(e,t){e.answers.push(t)},UPDATE_ANSWERS:function(e,t){e.answers=t},INCREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(e){e.countCurrentRequest--}},i={changeQuestionType:function(e,t){LP.Request({type:"change-question-type",question_type:t.type,draft_question:e.getters.autoDraft?JSON.stringify(t.question):""}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_AUTO_DRAFT_STATUS",!1),e.commit("CHANGE_QUESTION_TYPE",n.data))}))},updateAnswersOrder:function(e,t){LP.Request({type:"sort-answer",order:t}).then((function(e){e.body.success}))},updateAnswerTitle:function(e,t){void 0!==t.question_answer_id&&(t=JSON.stringify(t),LP.Request({type:"update-answer-title",answer:t}))},updateCorrectAnswer:function(e,t){LP.Request({type:"change-correct",correct:JSON.stringify(t)}).then((function(t){var n=t.body;n.success&&(e.commit("UPDATE_ANSWERS",n.data),e.commit("UPDATE_AUTO_DRAFT_STATUS",!1))}))},deleteAnswer:function(e,t){e.commit("DELETE_ANSWER",t.id),LP.Request({type:"delete-answer",answer_id:t.id}).then((function(t){var n=t.body;n.success&&e.commit("SET_ANSWERS",n.data)}))},newAnswer:function(e,t){e.commit("ADD_NEW_ANSWER",t.answer),LP.Request({type:"new-answer"}).then((function(t){var n=t.body;n.success&&e.commit("UPDATE_ANSWERS",n.data)}))},newRequest:function(e){e.commit("INCREASE_NUMBER_REQUEST"),e.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(e,t){e.commit("DECREASE_NUMBER_REQUEST"),0===e.getters.currentRequest&&(e.commit("UPDATE_STATUS",t),window.onbeforeunload=null)}},s=window.jQuery||jQuery,c=function(e){return{state:s.extend({status:"successful",countCurrentRequest:0,i18n:s.extend({},e.i18n)},e.root),getters:r,mutations:u,actions:i}};n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex;var a=window.jQuery;a(document).ready((function(){window.LP_Question_Store=new $Vuex.Store(c(lp_question_editor)),Object(o.a)({ns:"LPQuestionEditorRequest",store:LP_Question_Store}),setTimeout((function(){a("#admin-editor-lp_question").length&&(window.LP_Question_Editor=new $Vue({el:"#admin-editor-lp_question",template:"<lp-question-editor></lp-question-editor>"}))}),100)}))},2:function(e,t){var n;n=jQuery,window.FIB={getSelectedText:function(){var e="";if(void 0!==window.getSelection){var t=window.getSelection();if(t.rangeCount){for(var n=document.createElement("div"),o=0,r=t.rangeCount;o<r;++o)n.appendChild(t.getRangeAt(o).cloneContents());e=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(e=document.selection.createRange().htmlText);return e},createTextNode:function(e){return document.createTextNode(e)},isContainHtml:function(e){var t=n(e),o="b.fib-blank";return t.is(o)||t.find(o).length||t.parent().is(o)},getSelectionRange:function(){var e="";return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e},outerHTML:function(e){return n("<div>").append(n(e).clone()).html()},doUpgrade:function(e){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(t){console.log(t),e&&e.call(t)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var e=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){e.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
assets/js/dist/admin/pages/statistic.js CHANGED
@@ -100,7 +100,11 @@
100
  $canvas = $('<canvas />');
101
  $elem.html('');
102
  $canvas.appendTo($elem);
103
- new Chart($canvas.get(0).getContext('2d')).Line(data, config);
 
 
 
 
104
  }); //
105
  };
106
 
100
  $canvas = $('<canvas />');
101
  $elem.html('');
102
  $canvas.appendTo($elem);
103
+ var lineChart = new Chart($canvas, {
104
+ type: 'line',
105
+ data: data,
106
+ options: config
107
+ });
108
  }); //
109
  };
110
 
assets/js/dist/admin/pages/statistic.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}({7:function(t,e){var r;(r=jQuery).fn.LP_Chart_Line=function(t,e){return r.each(this,(function(){var n=r(this),a=r("<canvas />");n.html(""),a.appendTo(n),new Chart(a.get(0).getContext("2d")).Line(t,e)}))},r.fn.LP_Statistic_Users=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),n=e.data("type"),a="",o="";if(t.not(this).not('[data-type="user-custom-time"]').prop("disabled",!1),"user-custom-time"==n){if(a=r('#user-custom-time input[name="from"]').val(),o=r('#user-custom-time input[name="to"]').val(),""==a||""==o)return!1}else e.prop("disabled",!0);var i=r("#learn-press-chart");return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:n,range:[a,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #user-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="user-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Courses=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),n=e.data("type"),a="",o="",i=r("#learn-press-chart");if(t.not(this).not('[data-type="course-custom-time"]').prop("disabled",!1),"course-custom-time"==n){if(a=r('#course-custom-time input[name="from"]').val(),o=r('#course-custom-time input[name="to"]').val(),""==a||""==o)return!1}else e.prop("disabled",!0);return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:n,range:[a,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #course-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="course-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Orders=function(){if(0!==parseInt(r(this).length)){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r("#report_sales_by").val()).show(),r("#report_sales_by").on("change",(function(){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r(this).val()).show(),"date"==r(this).val()&&t()}));var t=function(){var t,e="",n="",a="",o=0,i=0;t=r("#report_sales_by").val(),$container=r("#learn-press-chart"),$container.addClass("loading");var s=r(".chart-buttons button:disabled").not('[data-type="order-custom-time"]');if(parseInt(s.length)>0)e=r(s[0]).data("type");else if(e="order-custom-time",n=r('#order-custom-time input[name="from"]').val(),a=r('#order-custom-time input[name="to"]').val(),""==n||""==a)return!1;"course"===t?i=r("#report-by-course-id").val():"category"===t&&(o=r("#report-by-course-category-id").val()),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:e,range:[n,a],report_sales_by:t,course_id:i,cat_id:o},dataType:"text",success:function(t){t=LP.parseJSON(t),$container.LP_Chart_Line(t,LP_Chart_Config),$container.removeClass("loading")}})};r("#report-by-course-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-id").on("change",(function(){t()})),r("#report-by-course-category-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course_category",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-category-id").on("change",(function(){t()}));var e=r(".chart-buttons button").on("click",(function(){var n=r(this),a=n.data("type");return r("#learn-press-chart"),e.not(this).not('[data-type="order-custom-time"]').prop("disabled",!1),"order-custom-time"!==a&&(n.prop("disabled",!0),r('#order-custom-time input[name="from"]').val(""),r('#order-custom-time input[name="to"]').val("")),t(),!1})),n=r('.chart-buttons #order-custom-time input[type="text"]').on("change",(function(){e.filter('[data-type="order-custom-time"]').prop("disabled",n.filter((function(){return""==this.value})).get().length||!function(){if(new Date(n[0].value)<new Date(n[1].value))return!0}())}))}},r((function(){void 0!==r.fn.datepicker&&r(".date-picker").datepicker({dateFormat:"yy/mm/dd"}),r(".learn-press-statistic-users").LP_Statistic_Users(),r(".learn-press-statistic-courses").LP_Statistic_Courses(),r(".learn-press-statistic-orders").LP_Statistic_Orders()}))}});
1
+ !function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}({7:function(t,e){var r;(r=jQuery).fn.LP_Chart_Line=function(t,e){return r.each(this,(function(){var a=r(this),n=r("<canvas />");a.html(""),n.appendTo(a),new Chart(n,{type:"line",data:t,options:e})}))},r.fn.LP_Statistic_Users=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),a=e.data("type"),n="",o="";if(t.not(this).not('[data-type="user-custom-time"]').prop("disabled",!1),"user-custom-time"==a){if(n=r('#user-custom-time input[name="from"]').val(),o=r('#user-custom-time input[name="to"]').val(),""==n||""==o)return!1}else e.prop("disabled",!0);var i=r("#learn-press-chart");return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:a,range:[n,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #user-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="user-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Courses=function(){if(0!==parseInt(r(this).length))return r.each(this,(function(){var t=r(".chart-buttons button").on("click",(function(){var e=r(this),a=e.data("type"),n="",o="",i=r("#learn-press-chart");if(t.not(this).not('[data-type="course-custom-time"]').prop("disabled",!1),"course-custom-time"==a){if(n=r('#course-custom-time input[name="from"]').val(),o=r('#course-custom-time input[name="to"]').val(),""==n||""==o)return!1}else e.prop("disabled",!0);return i.addClass("loading"),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:a,range:[n,o]},dataType:"text",success:function(t){t=LP.parseJSON(t),i.LP_Chart_Line(t,LP_Chart_Config),i.removeClass("loading")}}),!1})),e=r('.chart-buttons #course-custom-time input[type="text"]').on("change",(function(){t.filter('[data-type="course-custom-time"]').prop("disabled",e.filter((function(){return""==this.value})).get().length||!function(){if(new Date(e[0].value)<new Date(e[1].value))return!0}())}))}))},r.fn.LP_Statistic_Orders=function(){if(0!==parseInt(r(this).length)){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r("#report_sales_by").val()).show(),r("#report_sales_by").on("change",(function(){r(".panel_report_option").hide(),r("#panel_report_sales_by_"+r(this).val()).show(),"date"==r(this).val()&&t()}));var t=function(){var t,e="",a="",n="",o=0,i=0;t=r("#report_sales_by").val(),$container=r("#learn-press-chart"),$container.addClass("loading");var s=r(".chart-buttons button:disabled").not('[data-type="order-custom-time"]');if(parseInt(s.length)>0)e=r(s[0]).data("type");else if(e="order-custom-time",a=r('#order-custom-time input[name="from"]').val(),n=r('#order-custom-time input[name="to"]').val(),""==a||""==n)return!1;"course"===t?i=r("#report-by-course-id").val():"category"===t&&(o=r("#report-by-course-category-id").val()),r.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:e,range:[a,n],report_sales_by:t,course_id:i,cat_id:o},dataType:"text",success:function(t){t=LP.parseJSON(t),$container.LP_Chart_Line(t,LP_Chart_Config),$container.removeClass("loading")}})};r("#report-by-course-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-id").on("change",(function(){t()})),r("#report-by-course-category-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course_category",dataType:"json",quietMillis:250,data:function(t,e){return{q:t}},results:function(t,e){return{results:t.items}},cache:!0}}),r("#report-by-course-category-id").on("change",(function(){t()}));var e=r(".chart-buttons button").on("click",(function(){var a=r(this),n=a.data("type");return r("#learn-press-chart"),e.not(this).not('[data-type="order-custom-time"]').prop("disabled",!1),"order-custom-time"!==n&&(a.prop("disabled",!0),r('#order-custom-time input[name="from"]').val(""),r('#order-custom-time input[name="to"]').val("")),t(),!1})),a=r('.chart-buttons #order-custom-time input[type="text"]').on("change",(function(){e.filter('[data-type="order-custom-time"]').prop("disabled",a.filter((function(){return""==this.value})).get().length||!function(){if(new Date(a[0].value)<new Date(a[1].value))return!0}())}))}},r((function(){void 0!==r.fn.datepicker&&r(".date-picker").datepicker({dateFormat:"yy/mm/dd"}),r(".learn-press-statistic-users").LP_Statistic_Users(),r(".learn-press-statistic-courses").LP_Statistic_Courses(),r(".learn-press-statistic-orders").LP_Statistic_Orders()}))}});
assets/js/dist/admin/pages/tools.js CHANGED
@@ -96,6 +96,10 @@
96
  "use strict";
97
  __webpack_require__.r(__webpack_exports__);
98
  /* harmony import */ var _tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/database/upgrade */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js");
 
 
 
 
99
 
100
 
101
  (function ($) {
@@ -201,12 +205,216 @@ __webpack_require__.r(__webpack_exports__);
201
 
202
  $(function () {
203
  Object(_tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__["default"])();
 
 
204
  $doc.on('click', '.lp-install-sample__install', installSampleCourse).on('click', '.lp-install-sample__uninstall', uninstallSampleCourse).on('click', '#learn-press-clear-cache', clearHardCache).on('click', 'input[name="enable_hard_cache"]', toggleHardCache).on('click', '.lp-install-sample__toggle-options', toggleOptions);
205
  });
206
  })(jQuery);
207
 
208
  /***/ }),
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js":
211
  /*!*********************************************************************************************************************************************************************************!*\
212
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js ***!
@@ -355,6 +563,11 @@ var upgradeDB = function upgradeDB() {
355
  elItemStepCurrent.removeClass('running').addClass('error');
356
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elWrapperUpgradeMessage.html(), function () {
357
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes.text('Retry').show();
 
 
 
 
 
358
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo.show();
359
 
360
  if (!res.message) {
@@ -369,6 +582,11 @@ var upgradeDB = function upgradeDB() {
369
  isUpgrading = 0;
370
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elWrapperUpgradeMessage.html(), function () {
371
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes.text('Retry').show();
 
 
 
 
 
372
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo.show();
373
 
374
  if (!err.message) {
@@ -536,7 +754,12 @@ var lpModalOverlay = {
536
  elFooter: null,
537
  elCalledModal: null,
538
  callBackYes: null,
 
539
  init: function init() {
 
 
 
 
540
  this.elLPOverlay = $('.lp-overlay');
541
 
542
  if (!this.elLPOverlay.length) {
@@ -552,11 +775,15 @@ var lpModalOverlay = {
552
  $(document).on('click', '.close, .btn-no', function () {
553
  elLPOverlay.hide();
554
  });
555
- $(document).on('click', '.btn-yes', function () {
 
 
 
556
  if ('function' === typeof lpModalOverlay.callBackYes) {
557
  lpModalOverlay.callBackYes();
558
  }
559
  });
 
560
  return true;
561
  },
562
  setElCalledModal: function setElCalledModal(elCalledModal) {
96
  "use strict";
97
  __webpack_require__.r(__webpack_exports__);
98
  /* harmony import */ var _tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/database/upgrade */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js");
99
+ /* harmony import */ var _tools_database_create_indexs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools/database/create_indexs */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/create_indexs.js");
100
+ /* harmony import */ var _tools_database_re_upgrade_db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools/database/re-upgrade-db */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js");
101
+
102
+
103
 
104
 
105
  (function ($) {
205
 
206
  $(function () {
207
  Object(_tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__["default"])();
208
+ Object(_tools_database_create_indexs__WEBPACK_IMPORTED_MODULE_1__["default"])();
209
+ Object(_tools_database_re_upgrade_db__WEBPACK_IMPORTED_MODULE_2__["default"])();
210
  $doc.on('click', '.lp-install-sample__install', installSampleCourse).on('click', '.lp-install-sample__uninstall', uninstallSampleCourse).on('click', '#learn-press-clear-cache', clearHardCache).on('click', 'input[name="enable_hard_cache"]', toggleHardCache).on('click', '.lp-install-sample__toggle-options', toggleOptions);
211
  });
212
  })(jQuery);
213
 
214
  /***/ }),
215
 
216
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/create_indexs.js":
217
+ /*!***************************************************************************************************************************************************************************************!*\
218
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/create_indexs.js ***!
219
+ \***************************************************************************************************************************************************************************************/
220
+ /*! exports provided: default */
221
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
222
+
223
+ "use strict";
224
+ __webpack_require__.r(__webpack_exports__);
225
+ /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js");
226
+ /* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js");
227
+
228
+
229
+
230
+ var createIndexes = function createIndexes() {
231
+ var elCreateIndexTables = document.querySelector('#lp-tool-create-indexes-tables');
232
+
233
+ if (!elCreateIndexTables) {
234
+ return;
235
+ }
236
+
237
+ var elBtnCreateIndexes = elCreateIndexTables.querySelector('.lp-btn-create-indexes');
238
+ elBtnCreateIndexes.addEventListener('click', function (e) {
239
+ e.preventDefault();
240
+ var elLoading = elCreateIndexTables.querySelector('.wrapper-lp-loading');
241
+
242
+ if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].init()) {
243
+ return;
244
+ }
245
+
246
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show();
247
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elLoading.innerHTML);
248
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(elCreateIndexTables.querySelector('h2').textContent);
249
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes[0].style.display = 'inline-block';
250
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes[0].textContent = 'Run';
251
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].textContent = 'Close';
252
+ var url = '/lp/v1/tools/list-tables-indexs';
253
+ var params = {};
254
+ var functions = {
255
+ success: function success(res) {
256
+ var status = res.status,
257
+ message = res.message,
258
+ _res$data = res.data,
259
+ tables = _res$data.tables,
260
+ table = _res$data.table;
261
+ var elSteps = document.querySelector('.example-lp-group-step');
262
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elSteps.innerHTML);
263
+ var elGroupStep = _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay[0].querySelector('.lp-group-step '); // Show progress when upgrading.
264
+
265
+ var showProgress = function showProgress(stepCurrent, percent) {
266
+ var elItemStepCurrent = elGroupStep.querySelector('input[value=' + stepCurrent + ']').closest('.lp-item-step');
267
+ elItemStepCurrent.classList.add('running');
268
+
269
+ if (100 === percent) {
270
+ elItemStepCurrent.classList.remove('running');
271
+ elItemStepCurrent.classList.add('completed');
272
+ }
273
+
274
+ var progressBar = elItemStepCurrent.querySelector('.progress-bar');
275
+ progressBar.style.width = percent;
276
+ }; // Scroll to step current.
277
+
278
+
279
+ var scrollToStepCurrent = function scrollToStepCurrent(stepCurrent) {
280
+ var elItemStepCurrent = elGroupStep.querySelector('input[value=' + stepCurrent + ']').closest('.lp-item-step');
281
+ console.log(elItemStepCurrent.offsetTop, _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].offsetTop);
282
+ var offset = elItemStepCurrent.offsetTop - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].offsetTop + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent[0].scrollTop;
283
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elMainContent.stop().animate({
284
+ scrollTop: offset
285
+ }, 600);
286
+ };
287
+
288
+ for (var _table in tables) {
289
+ var elItemStep = _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay[0].querySelector('.lp-item-step').cloneNode(true);
290
+ var input = elItemStep.querySelector('input');
291
+ var label = elItemStep.querySelector('label');
292
+ label.textContent = "Table: ".concat(_table);
293
+ input.value = _table;
294
+ elGroupStep.append(elItemStep);
295
+ }
296
+
297
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
298
+ var url = '/lp/v1/tools/create-indexs';
299
+ var params = {
300
+ tables: tables,
301
+ table: table
302
+ };
303
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].style.display = 'none';
304
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes[0].style.display = 'none';
305
+ showProgress(table, 0.1);
306
+ var functions = {
307
+ success: function success(res) {
308
+ var status = res.status,
309
+ message = res.message,
310
+ _res$data2 = res.data,
311
+ table = _res$data2.table,
312
+ percent = _res$data2.percent;
313
+ showProgress(params.table, percent);
314
+
315
+ if (undefined !== table) {
316
+ if (params.table !== table) {
317
+ showProgress(table, 0.1);
318
+ scrollToStepCurrent(table);
319
+ }
320
+
321
+ params.table = table;
322
+ }
323
+
324
+ if ('success' === status) {
325
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, params, functions);
326
+ } else if ('finished' === status) {
327
+ console.log('finished');
328
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].style.display = 'inline-block';
329
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].textContent = 'Finish';
330
+ } else {
331
+ console.log(message);
332
+ }
333
+ },
334
+ error: function error(err) {
335
+ console.log(err);
336
+ },
337
+ completed: function completed() {}
338
+ };
339
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, params, functions);
340
+ };
341
+ },
342
+ error: function error(err) {},
343
+ completed: function completed() {}
344
+ };
345
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, params, functions);
346
+ });
347
+ };
348
+
349
+ /* harmony default export */ __webpack_exports__["default"] = (createIndexes);
350
+
351
+ /***/ }),
352
+
353
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js":
354
+ /*!***************************************************************************************************************************************************************************************!*\
355
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js ***!
356
+ \***************************************************************************************************************************************************************************************/
357
+ /*! exports provided: default */
358
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
359
+
360
+ "use strict";
361
+ __webpack_require__.r(__webpack_exports__);
362
+ /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js");
363
+ /* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js");
364
+
365
+
366
+
367
+ var reUpgradeDB = function reUpgradeDB() {
368
+ var elToolReUpgradeDB = document.querySelector('#lp-tool-re-upgrade-db');
369
+
370
+ if (!elToolReUpgradeDB) {
371
+ return;
372
+ } // Check valid to show popup re-upgrade
373
+
374
+
375
+ var url = 'lp/v1/database/check-db-valid-re-upgrade';
376
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, {}, {
377
+ success: function success(res) {
378
+ var can_re_upgrade = res.data.can_re_upgrade;
379
+
380
+ if (!can_re_upgrade) {
381
+ return;
382
+ }
383
+
384
+ elToolReUpgradeDB.style.display = 'block';
385
+ var elBtnReUpradeDB = elToolReUpgradeDB.querySelector('.lp-btn-re-upgrade-db');
386
+ var elMessage = elToolReUpgradeDB.querySelector('.learn-press-message');
387
+ elBtnReUpradeDB.addEventListener('click', function () {
388
+ // eslint-disable-next-line no-alert
389
+ if (confirm('Are want Re Upgrade!')) {
390
+ url = 'lp/v1/database/del-tb-lp-upgrade-db';
391
+ Object(_utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__["default"])(url, {}, {
392
+ success: function success(res) {
393
+ var status = res.status,
394
+ message = res.message,
395
+ url = res.data.url;
396
+
397
+ if ('success' === status && undefined !== url) {
398
+ window.location.href = url;
399
+ }
400
+ },
401
+ error: function error(err) {
402
+ elMessage.classList.add('error');
403
+ elMessage.textContent = err.message;
404
+ elMessage.style.display = 'block';
405
+ }
406
+ });
407
+ }
408
+ });
409
+ },
410
+ error: function error(err) {}
411
+ });
412
+ };
413
+
414
+ /* harmony default export */ __webpack_exports__["default"] = (reUpgradeDB);
415
+
416
+ /***/ }),
417
+
418
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js":
419
  /*!*********************************************************************************************************************************************************************************!*\
420
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/database/upgrade.js ***!
563
  elItemStepCurrent.removeClass('running').addClass('error');
564
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elWrapperUpgradeMessage.html(), function () {
565
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes.text('Retry').show();
566
+
567
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
568
+ window.location.href = 'wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db';
569
+ };
570
+
571
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo.show();
572
 
573
  if (!res.message) {
582
  isUpgrading = 0;
583
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal(elWrapperUpgradeMessage.html(), function () {
584
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes.text('Retry').show();
585
+
586
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
587
+ window.location.location = 'wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db';
588
+ };
589
+
590
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo.show();
591
 
592
  if (!err.message) {
754
  elFooter: null,
755
  elCalledModal: null,
756
  callBackYes: null,
757
+ instance: null,
758
  init: function init() {
759
+ if (this.instance) {
760
+ return true;
761
+ }
762
+
763
  this.elLPOverlay = $('.lp-overlay');
764
 
765
  if (!this.elLPOverlay.length) {
775
  $(document).on('click', '.close, .btn-no', function () {
776
  elLPOverlay.hide();
777
  });
778
+ $(document).on('click', '.btn-yes', function (e) {
779
+ e.preventDefault();
780
+ e.stopPropagation();
781
+
782
  if ('function' === typeof lpModalOverlay.callBackYes) {
783
  lpModalOverlay.callBackYes();
784
  }
785
  });
786
+ this.instance = this;
787
  return true;
788
  },
789
  setElCalledModal: function setElCalledModal(elCalledModal) {
assets/js/dist/admin/pages/tools.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(l){if(t[l])return t[l].exports;var a=t[l]={i:l,l:!1,exports:{}};return e[l].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(l,a,function(t){return e[t]}.bind(null,a));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=15)}({15:function(e,t,n){"use strict";n.r(t);var l,a,s,o,r,i,d,c,p=jQuery,u=null,f={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,init:function(){return this.elLPOverlay=p(".lp-overlay"),!!this.elLPOverlay.length&&(u=this.elLPOverlay,this.elMainContent=u.find(".main-content"),this.elTitle=u.find(".modal-title"),this.elBtnYes=u.find(".btn-yes"),this.elBtnNo=u.find(".btn-no"),this.elFooter=u.find(".lp-modal-footer"),p(document).on("click",".close, .btn-no",(function(){u.hide()})),p(document).on("click",".btn-yes",(function(){"function"==typeof f.callBackYes&&f.callBackYes()})),!0)},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},m=f,h=function(e,t,n){wp.apiFetch({path:e,method:"POST",data:t}).then((function(e){"function"==typeof n.success&&n.success(e)})).catch((function(e){"function"==typeof n.error&&n.error(e)})).then((function(){"function"==typeof n.completed&&n.completed()}))},v=jQuery,g=v("#lp-tool-upgrade-db"),b=function(){var e=0,t=g.find(".wrapper-terms-upgrade"),n=g.find(".wrapper-lp-status-upgrade"),l=g.find(".wrapper-lp-upgrade-message"),a=null;if(t.length){m.setContentModal(t.html());var s=m.elLPOverlay.find(".terms-upgrade"),o=s.find("input[name=lp-agree-term]"),r=s.find(".error"),i=v("input[name=message-when-upgrading]").val();a=function(){return r.hide(),r.removeClass("learn-press-message"),o.is(":checked")?(h("/lp/v1/database/agree_terms",{agree_terms:1},{}),m.elFooter.find(".learn-press-notice").remove(),m.elFooter.prepend('<span class="learn-press-notice">'+i+"</span>"),m.setContentModal(n.html()),!0):(r.show(),r.addClass("learn-press-message"),m.elMainContent.animate({scrollTop:r.offset().top}),!1)}}else m.setContentModal(n.html()),a=function(){return!0};m.setTitleModal(g.find("h2").html()),m.elBtnYes.text("Upgrade"),m.elBtnYes.show(),m.elBtnNo.text("close"),m.callBackYes=function(){if(a()){e=1,m.elBtnYes.hide(),m.elBtnNo.hide();var t=m.elLPOverlay.find(".lp-group-step"),n=g.find(".lp-item-step"),s=[];v.each(n,(function(e,t){var n=v(t);if(!n.hasClass("completed")){var l=n.find("input").val();s.push(l)}}));var o={steps:s,step:s[0]},r=null,i=function(e,n){(r=t.find("input[value="+e+"]").closest(".lp-item-step")).addClass("running"),100===n&&r.removeClass("running").addClass("completed"),r.find(".progress-bar").css("width",n+"%"),r.find(".percent").text(n+"%")};i(s[0],.1);var d={success:function(n){var a,s;i(o.step,n.percent),o.step!==n.name&&i(n.name,.1),a=o.step,s=(r=t.find("input[value="+a+"]").closest(".lp-item-step")).offset().top-m.elMainContent.offset().top+m.elMainContent.scrollTop(),m.elMainContent.stop().animate({scrollTop:s},600),"success"===n.status?(o.step=n.name,o.data=n.data,setTimeout((function(){h("/lp/v1/database/upgrade",o,d)}),800)):"finished"===n.status?(e=0,r.removeClass("running").addClass("completed"),setTimeout((function(){m.setContentModal(l.html())}),1e3),m.elFooter.find(".learn-press-notice").remove(),m.elBtnNo.show(),m.elBtnNo.on("click",(function(){window.location.reload()}))):(e=0,m.elFooter.find(".learn-press-notice").remove(),r.removeClass("running").addClass("error"),m.setContentModal(l.html(),(function(){m.elBtnYes.text("Retry").show(),m.elBtnNo.show(),n.message||(n.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),m.elMainContent.find(".learn-press-message").addClass("error").html(n.message)})))},error:function(t){e=0,m.setContentModal(l.html(),(function(){m.elBtnYes.text("Retry").show(),m.elBtnNo.show(),t.message||(t.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),m.elMainContent.find(".learn-press-message").addClass("error").html(t.message)}))},completed:function(){}};h("/lp/v1/database/upgrade",o,d)}},window.onbeforeunload=function(){if(e)return"LP is upgrading Database. Are you want to reload page?"},window.onclose=function(){if(e)return"LP is upgrading Database. Are you want to close page?"}},C=function(){if(g.length&&m.init()){var e=v(".wrapper-lp-status-upgrade"),t=window.location.search,n=new URLSearchParams(t).get("action");"upgrade-db"===n&&(m.elLPOverlay.show(),m.setTitleModal(g.find("h2").html()),m.setContentModal(v(".wrapper-lp-loading").html())),h("/lp/v1/database/get_steps",{},{success:function(t){var l=t.steps_completed,a=t.steps_default;if(void 0===l||void 0===a)return console.log("invalid steps_completed and steps_default"),!1;var s="";for(var o in a){var r=a[o],i=r.steps;for(var d in s='<div class="lp-group-step">',s+="<h3>"+r.label+"</h3>",i){var c=i[d],p="";void 0!==l[d]&&(p="completed"),s+='<div class="lp-item-step '+p+'">',s+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+c.name+'" /></div>',s+='<div class="lp-item-step-right">',s+='<label for=""><strong></strong>'+c.label+"</label>",s+='<div class="description">'+c.description+"</div>",s+='<div class="percent"></div>',s+='<span class="progress-bar"></span>',s+="</div>",s+="</div>"}s+="</div>",e.append(s);var u=v(".lp-btn-upgrade-db");"upgrade-db"===n&&b(),u.on("click",(function(){m.elLPOverlay.show(),b()}))}},error:function(e){},completed:function(){}})}};l=jQuery,a=l(document),s=!1,o=function(e){e.preventDefault();var t=l(this);s||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(t.addClass("disabled").html(t.data("installing-text")),l(".lp-install-sample__response").remove(),s=!0,l.ajax({url:t.attr("href"),data:l(".lp-install-sample__options").serializeJSON(),success:function(e){t.removeClass("disabled").html(t.data("text")),s=!1,l(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),s=!1,l(response).insertBefore(t.parent())}}))},r=function(e){e.preventDefault();var t=l(this);s||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(t.addClass("disabled").html(t.data("uninstalling-text")),s=!0,l.ajax({url:t.attr("href"),success:function(e){t.removeClass("disabled").html(t.data("text")),s=!1,l(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),s=!1,l(response).insertBefore(t.parent())}}))},i=function(e){e.preventDefault();var t=l(this);t.hasClass("disabled")||(t.addClass("disabled").html(t.data("cleaning-text")),l.ajax({url:t.attr("href"),data:{},success:function(e){t.removeClass("disabled").html(t.data("text"))},error:function(){t.removeClass("disabled").html(t.data("text"))}}))},d=function(){l.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success:function(e){},error:function(){}})},c=function(e){e.preventDefault(),l(".lp-install-sample__options").toggleClass("hide-if-js")},l((function(){C(),a.on("click",".lp-install-sample__install",o).on("click",".lp-install-sample__uninstall",r).on("click","#learn-press-clear-cache",i).on("click",'input[name="enable_hard_cache"]',d).on("click",".lp-install-sample__toggle-options",c)}))}});
1
+ !function(e){var t={};function n(l){if(t[l])return t[l].exports;var a=t[l]={i:l,l:!1,exports:{}};return e[l].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(l,a,function(t){return e[t]}.bind(null,a));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}({14:function(e,t,n){"use strict";n.r(t);var l,a,s,o,r,i,c,d,p=jQuery,u=null,f={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=p(".lp-overlay"),!!this.elLPOverlay.length&&(u=this.elLPOverlay,this.elMainContent=u.find(".main-content"),this.elTitle=u.find(".modal-title"),this.elBtnYes=u.find(".btn-yes"),this.elBtnNo=u.find(".btn-no"),this.elFooter=u.find(".lp-modal-footer"),p(document).on("click",".close, .btn-no",(function(){u.hide()})),p(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof f.callBackYes&&f.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},m=f,v=function(e,t,n){wp.apiFetch({path:e,method:"POST",data:t}).then((function(e){"function"==typeof n.success&&n.success(e)})).catch((function(e){"function"==typeof n.error&&n.error(e)})).then((function(){"function"==typeof n.completed&&n.completed()}))},h=jQuery,g=h("#lp-tool-upgrade-db"),b=function(){var e=0,t=g.find(".wrapper-terms-upgrade"),n=g.find(".wrapper-lp-status-upgrade"),l=g.find(".wrapper-lp-upgrade-message"),a=null;if(t.length){m.setContentModal(t.html());var s=m.elLPOverlay.find(".terms-upgrade"),o=s.find("input[name=lp-agree-term]"),r=s.find(".error"),i=h("input[name=message-when-upgrading]").val();a=function(){return r.hide(),r.removeClass("learn-press-message"),o.is(":checked")?(v("/lp/v1/database/agree_terms",{agree_terms:1},{}),m.elFooter.find(".learn-press-notice").remove(),m.elFooter.prepend('<span class="learn-press-notice">'+i+"</span>"),m.setContentModal(n.html()),!0):(r.show(),r.addClass("learn-press-message"),m.elMainContent.animate({scrollTop:r.offset().top}),!1)}}else m.setContentModal(n.html()),a=function(){return!0};m.setTitleModal(g.find("h2").html()),m.elBtnYes.text("Upgrade"),m.elBtnYes.show(),m.elBtnNo.text("close"),m.callBackYes=function(){if(a()){e=1,m.elBtnYes.hide(),m.elBtnNo.hide();var t=m.elLPOverlay.find(".lp-group-step"),n=g.find(".lp-item-step"),s=[];h.each(n,(function(e,t){var n=h(t);if(!n.hasClass("completed")){var l=n.find("input").val();s.push(l)}}));var o={steps:s,step:s[0]},r=null,i=function(e,n){(r=t.find("input[value="+e+"]").closest(".lp-item-step")).addClass("running"),100===n&&r.removeClass("running").addClass("completed"),r.find(".progress-bar").css("width",n+"%"),r.find(".percent").text(n+"%")};i(s[0],.1);var c={success:function(n){var a,s;i(o.step,n.percent),o.step!==n.name&&i(n.name,.1),a=o.step,s=(r=t.find("input[value="+a+"]").closest(".lp-item-step")).offset().top-m.elMainContent.offset().top+m.elMainContent.scrollTop(),m.elMainContent.stop().animate({scrollTop:s},600),"success"===n.status?(o.step=n.name,o.data=n.data,setTimeout((function(){v("/lp/v1/database/upgrade",o,c)}),800)):"finished"===n.status?(e=0,r.removeClass("running").addClass("completed"),setTimeout((function(){m.setContentModal(l.html())}),1e3),m.elFooter.find(".learn-press-notice").remove(),m.elBtnNo.show(),m.elBtnNo.on("click",(function(){window.location.reload()}))):(e=0,m.elFooter.find(".learn-press-notice").remove(),r.removeClass("running").addClass("error"),m.setContentModal(l.html(),(function(){m.elBtnYes.text("Retry").show(),m.callBackYes=function(){window.location.href="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},m.elBtnNo.show(),n.message||(n.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),m.elMainContent.find(".learn-press-message").addClass("error").html(n.message)})))},error:function(t){e=0,m.setContentModal(l.html(),(function(){m.elBtnYes.text("Retry").show(),m.callBackYes=function(){window.location.location="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},m.elBtnNo.show(),t.message||(t.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),m.elMainContent.find(".learn-press-message").addClass("error").html(t.message)}))},completed:function(){}};v("/lp/v1/database/upgrade",o,c)}},window.onbeforeunload=function(){if(e)return"LP is upgrading Database. Are you want to reload page?"},window.onclose=function(){if(e)return"LP is upgrading Database. Are you want to close page?"}},y=function(){if(g.length&&m.init()){var e=h(".wrapper-lp-status-upgrade"),t=window.location.search,n=new URLSearchParams(t).get("action");"upgrade-db"===n&&(m.elLPOverlay.show(),m.setTitleModal(g.find("h2").html()),m.setContentModal(h(".wrapper-lp-loading").html())),v("/lp/v1/database/get_steps",{},{success:function(t){var l=t.steps_completed,a=t.steps_default;if(void 0===l||void 0===a)return console.log("invalid steps_completed and steps_default"),!1;var s="";for(var o in a){var r=a[o],i=r.steps;for(var c in s='<div class="lp-group-step">',s+="<h3>"+r.label+"</h3>",i){var d=i[c],p="";void 0!==l[c]&&(p="completed"),s+='<div class="lp-item-step '+p+'">',s+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+d.name+'" /></div>',s+='<div class="lp-item-step-right">',s+='<label for=""><strong></strong>'+d.label+"</label>",s+='<div class="description">'+d.description+"</div>",s+='<div class="percent"></div>',s+='<span class="progress-bar"></span>',s+="</div>",s+="</div>"}s+="</div>",e.append(s);var u=h(".lp-btn-upgrade-db");"upgrade-db"===n&&b(),u.on("click",(function(){m.elLPOverlay.show(),b()}))}},error:function(e){},completed:function(){}})}},C=function(){var e=document.querySelector("#lp-tool-create-indexes-tables");e&&e.querySelector(".lp-btn-create-indexes").addEventListener("click",(function(t){t.preventDefault();var n=e.querySelector(".wrapper-lp-loading");if(m.init()){m.elLPOverlay.show(),m.setContentModal(n.innerHTML),m.setTitleModal(e.querySelector("h2").textContent),m.elBtnYes[0].style.display="inline-block",m.elBtnYes[0].textContent="Run",m.elBtnNo[0].textContent="Close";var l={success:function(e){e.status,e.message;var t=e.data,n=t.tables,l=t.table,a=document.querySelector(".example-lp-group-step");m.setContentModal(a.innerHTML);var s=m.elLPOverlay[0].querySelector(".lp-group-step "),o=function(e,t){var n=s.querySelector("input[value="+e+"]").closest(".lp-item-step");n.classList.add("running"),100===t&&(n.classList.remove("running"),n.classList.add("completed")),n.querySelector(".progress-bar").style.width=t};for(var r in n){var i=m.elLPOverlay[0].querySelector(".lp-item-step").cloneNode(!0),c=i.querySelector("input");i.querySelector("label").textContent="Table: ".concat(r),c.value=r,s.append(i)}m.callBackYes=function(){var e="/lp/v1/tools/create-indexs",t={tables:n,table:l};m.elBtnNo[0].style.display="none",m.elBtnYes[0].style.display="none",o(l,.1);var a={success:function(n){var l=n.status,r=n.message,i=n.data,c=i.table,d=i.percent;o(t.table,d),void 0!==c&&(t.table!==c&&(o(c,.1),function(e){var t=s.querySelector("input[value="+e+"]").closest(".lp-item-step");console.log(t.offsetTop,m.elMainContent[0].offsetTop);var n=t.offsetTop-m.elMainContent[0].offsetTop+m.elMainContent[0].scrollTop;m.elMainContent.stop().animate({scrollTop:n},600)}(c)),t.table=c),"success"===l?v(e,t,a):"finished"===l?(console.log("finished"),m.elBtnNo[0].style.display="inline-block",m.elBtnNo[0].textContent="Finish"):console.log(r)},error:function(e){console.log(e)},completed:function(){}};v(e,t,a)}},error:function(e){},completed:function(){}};v("/lp/v1/tools/list-tables-indexs",{},l)}}))},w=function(){var e=document.querySelector("#lp-tool-re-upgrade-db");if(e){var t="lp/v1/database/check-db-valid-re-upgrade";v(t,{},{success:function(n){if(n.data.can_re_upgrade){e.style.display="block";var l=e.querySelector(".lp-btn-re-upgrade-db"),a=e.querySelector(".learn-press-message");l.addEventListener("click",(function(){confirm("Are want Re Upgrade!")&&v(t="lp/v1/database/del-tb-lp-upgrade-db",{},{success:function(e){var t=e.status,n=(e.message,e.data.url);"success"===t&&void 0!==n&&(window.location.href=n)},error:function(e){a.classList.add("error"),a.textContent=e.message,a.style.display="block"}})}))}},error:function(e){}})}};l=jQuery,a=l(document),s=!1,o=function(e){e.preventDefault();var t=l(this);s||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(t.addClass("disabled").html(t.data("installing-text")),l(".lp-install-sample__response").remove(),s=!0,l.ajax({url:t.attr("href"),data:l(".lp-install-sample__options").serializeJSON(),success:function(e){t.removeClass("disabled").html(t.data("text")),s=!1,l(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),s=!1,l(response).insertBefore(t.parent())}}))},r=function(e){e.preventDefault();var t=l(this);s||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(t.addClass("disabled").html(t.data("uninstalling-text")),s=!0,l.ajax({url:t.attr("href"),success:function(e){t.removeClass("disabled").html(t.data("text")),s=!1,l(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),s=!1,l(response).insertBefore(t.parent())}}))},i=function(e){e.preventDefault();var t=l(this);t.hasClass("disabled")||(t.addClass("disabled").html(t.data("cleaning-text")),l.ajax({url:t.attr("href"),data:{},success:function(e){t.removeClass("disabled").html(t.data("text"))},error:function(){t.removeClass("disabled").html(t.data("text"))}}))},c=function(){l.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success:function(e){},error:function(){}})},d=function(e){e.preventDefault(),l(".lp-install-sample__options").toggleClass("hide-if-js")},l((function(){y(),C(),w(),a.on("click",".lp-install-sample__install",o).on("click",".lp-install-sample__uninstall",r).on("click","#learn-press-clear-cache",i).on("click",'input[name="enable_hard_cache"]',c).on("click",".lp-install-sample__toggle-options",d)}))}});
assets/js/dist/frontend/config.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.config=function(t){var n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(n){return t[n]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=16)}({16:function(t,n,e){"use strict";e.r(n),e.d(n,"classNames",(function(){return r})),e.d(n,"isQuestionCorrect",(function(){return i})),e.d(n,"questionBlocks",(function(){return s})),e.d(n,"questionFooterButtons",(function(){return c})),e.d(n,"questionTitleParts",(function(){return l})),e.d(n,"questionChecker",(function(){return f})),e.d(n,"quizStartBlocks",(function(){return a}));var o=LP.Hook,r={Quiz:{Result:["quiz-result"],Content:["quiz-content"],Questions:["quiz-questions"],Buttons:["quiz-buttons"],Attempts:["quiz-attempts"]}},u={single_choice:function(){},multi_choice:function(){},true_or_false:function(){}},i={fill_in_blank:function(){return!0}},s=function(){return LP.Hook.applyFilters("question-blocks",["title","content","answer-options","explanation","hint","buttons"])},c=function(){return LP.Hook.applyFilters("question-footer-buttons",["instant-check"])},l=function(){return LP.Hook.applyFilters("question-title-parts",["index","title","hint","edit-permalink"])},f=function(t){var n=LP.Hook.applyFilters("question-checkers",u);return t&&n[t]?n[t]:function(){return{}}},a=function(){o.applyFilters("quiz-start-blocks",{meta:!0,description:!0,custom:"Hello"})}}});
1
+ this.LP=this.LP||{},this.LP.config=function(t){var n={};function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(n){return t[n]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=17)}({17:function(t,n,e){"use strict";e.r(n),e.d(n,"classNames",(function(){return r})),e.d(n,"isQuestionCorrect",(function(){return i})),e.d(n,"questionBlocks",(function(){return s})),e.d(n,"questionFooterButtons",(function(){return c})),e.d(n,"questionTitleParts",(function(){return l})),e.d(n,"questionChecker",(function(){return f})),e.d(n,"quizStartBlocks",(function(){return a}));var o=LP.Hook,r={Quiz:{Result:["quiz-result"],Content:["quiz-content"],Questions:["quiz-questions"],Buttons:["quiz-buttons"],Attempts:["quiz-attempts"]}},u={single_choice:function(){},multi_choice:function(){},true_or_false:function(){}},i={fill_in_blank:function(){return!0}},s=function(){return LP.Hook.applyFilters("question-blocks",["title","content","answer-options","explanation","hint","buttons"])},c=function(){return LP.Hook.applyFilters("question-footer-buttons",["instant-check"])},l=function(){return LP.Hook.applyFilters("question-title-parts",["index","title","hint","edit-permalink"])},f=function(t){var n=LP.Hook.applyFilters("question-checkers",u);return t&&n[t]?n[t]:function(){return{}}},a=function(){o.applyFilters("quiz-start-blocks",{meta:!0,description:!0,custom:"Hello"})}}});
assets/js/dist/frontend/custom.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.custom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=17)}({17:function(t,e){var n=LP.Hook,r=window.jQuery||jQuery;n.addFilter("question-blocks",(function(t){return t})),n.addAction("before-start-quiz",(function(){})),n.addAction("quiz-started",(function(t,e){r(".course-item-".concat(e)).removeClass("status-completed failed passed").addClass("has-status status-started"),window.onbeforeunload=function(){return"Warning!"}})),n.addAction("quiz-submitted",(function(t,e){r(".course-item-".concat(e)).removeClass("status-started passed failed").addClass("has-status status-completed ".concat(t.results.graduation)),window.onbeforeunload=null}))}});
1
+ this.LP=this.LP||{},this.LP.custom=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}({18:function(t,e){var n=LP.Hook,r=window.jQuery||jQuery;n.addFilter("question-blocks",(function(t){return t})),n.addAction("before-start-quiz",(function(){})),n.addAction("quiz-started",(function(t,e){r(".course-item-".concat(e)).removeClass("status-completed failed passed").addClass("has-status status-started"),window.onbeforeunload=function(){return"Warning!"}})),n.addAction("quiz-submitted",(function(t,e){r(".course-item-".concat(e)).removeClass("status-started passed failed").addClass("has-status status-completed ".concat(t.results.graduation)),window.onbeforeunload=null}))}});
assets/js/dist/frontend/lesson.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.lesson=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}({15:function(e,t){}});
1
+ this.LP=this.LP||{},this.LP.lesson=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=16)}({16:function(e,t){}});
assets/js/dist/frontend/modal.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.modal=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},20:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"show",(function(){return f})),n.d(r,"hide",(function(){return p})),n.d(r,"confirm",(function(){return d}));var o={};n.r(o),n.d(o,"isOpen",(function(){return b})),n.d(o,"getMessage",(function(){return O})),n.d(o,"confirm",(function(){return m}));var c=n(1);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l={},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SHOW_MODAL":return u(u({},e),{},{isOpen:!0,message:t.message,cb:t.cb});case"HIDE_MODAL":return u(u({},e),{},{isOpen:!1,message:!1,cb:null});case"CONFIRM":return e.cb&&setTimeout((function(){e.cb()}),10),u(u({},e),{},{confirm:t.value})}return e};function f(e,t){return{type:"SHOW_MODAL",message:e,cb:t}}function p(){return{type:"HIDE_MODAL"}}function d(e){return{type:"CONFIRM",value:e}}function b(e){return e.isOpen}function O(e){return e.message}function m(e,t,n){var r=Object(c.dispatch)("learnpress/modal"),o=r.show,i=r.hide;return e.message?(i(),e.confirm):(o(t,n),"no")}var y=n(4),v=n.n(y),g={ENROLL_COURSE_X:function(e,t){}};var j=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=v()(g)(n)(e.dispatch),e.dispatch=t,e};function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=LP.dataControls.controls,E=Object(c.registerStore)("learnpress/modal",{reducer:s,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},P)});j(E);var S=n(0),_=function(e){var t=e.children,n=Object(c.dispatch)("learnpress/modal"),r=(n.show,n.hide,n.confirm),o=Object(c.useSelect)((function(e){return e("learnpress/modal").isOpen()})),i=Object(c.useSelect)((function(e){return e("learnpress/modal").getMessage()})),u=function(e){return function(t){r(e)}},a={display:o?"block":"none"};return React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement("div",{id:"lp-modal-overlay",style:a}),React.createElement("div",{id:"lp-modal-window",style:a},React.createElement("div",{id:"lp-modal-content",dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{id:"lp-modal-buttons"},React.createElement("button",{className:"lp-button modal-button-ok",onClick:u("yes")},React.createElement("span",null,Object(S._x)("OK","button confirm ok","learnpress"))),React.createElement("button",{className:"lp-button modal-button-cancel",onClick:u("no")},React.createElement("span",null,Object(S._x)("Cancel","button confirm cancel","learnpress")))))),t)};t.default=_},4:function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,c,i=n[r.type],u=t(r);if(i)for(o=0;o<i.length;o++)(c=i[o](r,e))&&e.dispatch(c);return u}}}).effects=n,t}}});
1
+ this.LP=this.LP||{},this.LP.modal=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},21:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"show",(function(){return f})),n.d(r,"hide",(function(){return p})),n.d(r,"confirm",(function(){return d}));var o={};n.r(o),n.d(o,"isOpen",(function(){return b})),n.d(o,"getMessage",(function(){return O})),n.d(o,"confirm",(function(){return m}));var c=n(1);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l={},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SHOW_MODAL":return u(u({},e),{},{isOpen:!0,message:t.message,cb:t.cb});case"HIDE_MODAL":return u(u({},e),{},{isOpen:!1,message:!1,cb:null});case"CONFIRM":return e.cb&&setTimeout((function(){e.cb()}),10),u(u({},e),{},{confirm:t.value})}return e};function f(e,t){return{type:"SHOW_MODAL",message:e,cb:t}}function p(){return{type:"HIDE_MODAL"}}function d(e){return{type:"CONFIRM",value:e}}function b(e){return e.isOpen}function O(e){return e.message}function m(e,t,n){var r=Object(c.dispatch)("learnpress/modal"),o=r.show,i=r.hide;return e.message?(i(),e.confirm):(o(t,n),"no")}var y=n(6),v=n.n(y),g={ENROLL_COURSE_X:function(e,t){}};var j=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=v()(g)(n)(e.dispatch),e.dispatch=t,e};function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=LP.dataControls.controls,E=Object(c.registerStore)("learnpress/modal",{reducer:s,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},P)});j(E);var S=n(0),_=function(e){var t=e.children,n=Object(c.dispatch)("learnpress/modal"),r=(n.show,n.hide,n.confirm),o=Object(c.useSelect)((function(e){return e("learnpress/modal").isOpen()})),i=Object(c.useSelect)((function(e){return e("learnpress/modal").getMessage()})),u=function(e){return function(t){r(e)}},a={display:o?"block":"none"};return React.createElement(React.Fragment,null,React.createElement("div",null,React.createElement("div",{id:"lp-modal-overlay",style:a}),React.createElement("div",{id:"lp-modal-window",style:a},React.createElement("div",{id:"lp-modal-content",dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{id:"lp-modal-buttons"},React.createElement("button",{className:"lp-button modal-button-ok",onClick:u("yes")},React.createElement("span",null,Object(S._x)("OK","button confirm ok","learnpress"))),React.createElement("button",{className:"lp-button modal-button-cancel",onClick:u("no")},React.createElement("span",null,Object(S._x)("Cancel","button confirm cancel","learnpress")))))),t)};t.default=_},6:function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,c,i=n[r.type],u=t(r);if(i)for(o=0;o<i.length;o++)(c=i[o](r,e))&&e.dispatch(c);return u}}}).effects=n,t}}});
assets/js/dist/frontend/question-types.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},19:function(e,t,n){"use strict";n.r(t),n.d(t,"QuestionBase",(function(){return v})),n.d(t,"SingleChoice",(function(){return E})),n.d(t,"MultipleChoices",(function(){return U})),n.d(t,"TrueOrFalse",(function(){return Y})),n.d(t,"FillInBlanks",(function(){return le})),n.d(t,"SortingChoice",(function(){return je}));var r=n(2),o=n(3),i=n(1),c=n(0);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=lodash,d=h.isArray,v=(h.get,h.set,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(u,e);var t,n,r,o=f(u);function u(e){var t;a(this,u),m(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var n=e.question;return n&&n.id!==t.questionId?{options:t.self.parseOptions(n.options)}:null})),m(y(t),"setInputRef",(function(e,n){t.inputs||(t.inputs={}),t.inputs[n]=e})),m(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,n=e.status,r=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===n&&o||r&&!i})),m(y(t),"maybeDisabledOption",(function(e){var n=t.props,r=(n.answered,n.status);return n.isCheckedAnswer||"started"!==r})),m(y(t),"setAnswerChecked",(function(){return function(e){var n=t.props,r=n.updateUserQuestionAnswers,o=n.question;if("started"!==n.status)return"LP Error: can not set answers";var i=t.$wrap.find(".option-check"),c=[],u="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(c.push(t.value),u))return!1})),r(o.id,u?c[0]:c)}})),m(y(t),"maybeCheckedAnswer",(function(e){var n=t.props.answered;return d(n)?!!n.find((function(t){return t==e})):e==n})),m(y(t),"getOptionType",(function(e,t){var n="radio";switch(e){case"multi_choice":n="checkbox"}return n})),m(y(t),"isDefaultType",(function(){return t.props.supportOptions})),m(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(c.__)("Render function should be overwritten from base.","learnpress"))})),m(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),m(y(t),"parseOptions",(function(e){return e&&(e=d(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=d(e)?e:JSON.parse(e)),e||[]})),m(y(t),"getOptions",(function(){return t.state.options||[]})),m(y(t),"isCorrect",(function(){var e,n,r,o=t.props.answered;if(!o)return!1;for(e=0,r=t.getOptions();e<r.length;e++)if("yes"===(n=r[e]).isTrue&&o==n.value)return!0;return!1})),m(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),m(y(t),"getCorrectLabel",(function(){var e=t.props,n=(e.status,e.answered,e.question),r=(LP.config.isQuestionCorrect[n.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(r?" correct":" incorrect")},React.createElement("span",{className:"label"},r?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),r?n.point:0,n.point)))}));var n=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:n?t.parseOptions(n.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=u,r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(n=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(n.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(n.type,t),className:"option-check",name:"started"===r?"learn-press-question-".concat(n.id):"",id:o,ref:function(n){e.setInputRef(n,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===r?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,n),r&&s(t,r),u}(r.Component));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=A(e);if(t){var o=A(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==w(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(n,e);var t=_(n);function n(){var e;j(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return C(P(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=O(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=B(e);if(t){var o=B(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return L(this,n)}}function L(e,t){return!t||"object"!==T(t)&&"function"!=typeof t?M(e):t}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=lodash.isBoolean,U=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(n,e);var t=N(n);function n(){var e;x(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return D(M(e=t.call.apply(t,[this].concat(o))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(F(o)||!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if("yes"===(n=r[t]).isTrue){if(-1===o.indexOf(n.value))return!1}else if(-1!==o.indexOf(n.value))return!1;return!0})),D(M(e),"getOptionClass",(function(t){var n=e.props.answered,r=k(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?-1!==n.indexOf(t.value)&&r.push("answered-correct"):-1!==n.indexOf(t.value)&&r.push("answered-wrong"))),r})),e}return n}(v);function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Q(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=K(e);if(t){var o=K(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return V(this,n)}}function V(e,t){return!t||"object"!==H(t)&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(n,e);var t=W(n);function n(){var e;z(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return X(G(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=Q(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ae(e);if(t){var o=ae(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ce(this,n)}}function ce(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(i,e);var t,n,r,o=ie(i);function i(){var e;ne(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return se(ue(e=o.call.apply(o,[this].concat(n))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),n={};ee(t).map((function(t){t.addEventListener("input",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)})),t.addEventListener("paste",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)}))}))})),se(ue(e),"setAnswered",(function(t,n,r){var o=e.props,i=o.updateUserQuestionAnswers,c=o.question;if("started"!==o.status)return"LP Error: can not set answers";var u=Object.assign(t,se({},n,r));i(c.id,u)})),se(ue(e),"getCorrectLabel",(function(){var t=e.props,n=t.question,r=t.mark,o=r||0;return r&&(Number.isInteger(r)||(o=r.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(c.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(n.point," ").concat(Object(c.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(c.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(c.__)("Incorrect","learnpress")))})),e}return t=i,(n=[{key:"componentDidMount",value:function(){this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(e){return React.createElement("div",{key:"blank-".concat(e.uid),dangerouslySetInnerHTML:{__html:e.title||e.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&re(t.prototype,n),r&&re(t,r),i}(v);function fe(e){return(fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e){return function(e){if(Array.isArray(e))return ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Oe(e);if(t){var o=Oe(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ve(this,n)}}function ve(e,t){return!t||"object"!==fe(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&he(e,t)}(i,e);var t,n,r,o=de(i);function i(){var e;be(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ge(we(e=o.call.apply(o,[this].concat(n))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if(o[(n=r[t]).sorting]!==n.value)return!1;return!0})),ge(we(e),"getCorrectLabel",(function(){var t=e.props.question,n=e.isCorrect.call(we(e));return e.maybeShowCorrectAnswer()&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),n?t.point:0,t.point))))})),ge(we(e),"getAnswerSortingChoice",(function(){var t=e.props.question.options||[],n=e.isCorrect.call(we(e)),r=[];return!n&&t.length>0&&t.map((function(e){var t=e.sorting;if(void 0!==t)return r[t]=e.title})),r})),e}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.updateUserQuestionAnswers,n=e.question,r=document.querySelector("#answer-options-".concat(n.id));return jQuery(r).sortable({items:".answer-option",cursor:"move",axis:"y",handle:".option-drag",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,update:function(e,o){var i=r.querySelectorAll(".answer-option"),c=[];pe(i).map((function(e){return c.push(e.dataset.value)})),c.length>0&&t(n.id,c)}})}},{key:"render",value:function(){var e=this,t=this.props.question,n=this.getAnswerSortingChoice();return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(t.id),className:"answer-options lp-sorting-choice-ul"},this.getOptions().map((function(t,r){return React.createElement(React.Fragment,null,React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.value),"data-value":t.value},React.createElement("span",{className:"option-drag",style:{display:"flex",alignItems:"center",position:"absolute",height:"100%",left:14}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},React.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),React.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"}))),React.createElement("label",{htmlFor:"learn-press-answer-option-".concat(t.value),className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}})),n.length>0&&void 0!==n[r]&&React.createElement("div",{className:"lp-sorting-choice__check-answer",key:"lp-checked-answer-".concat(r),style:{marginBottom:10}},n[r]))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&me(t.prototype,n),r&&me(t,r),i}(v);function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ke(e);if(t){var o=ke(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ee(this,n)}}function Ee(e,t){return!t||"object"!==Se(t)&&"function"!=typeof t?Te(e):t}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ae(e,t)}(i,e);var t,n,r,o=Ce(i);function i(){var e;Re(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return qe(Te(e=o.call.apply(o,[this].concat(n))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks,sorting_choice:LP.questionTypes.SortingChoice})[t.type]})),e}return t=i,(n=[{key:"render",value:function(){var e=this.props,t=e.question,n=e.supportOptions,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){qe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props);r.supportOptions=-1!==n.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(c.sprintf)(Object(c.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,r))}}])&&Pe(t.prototype,n),r&&Pe(t,r),i}(r.Component),Ie=Object(o.compose)(Object(i.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(n),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(xe);t.default=Ie},2:function(e,t){e.exports=window.wp.element},3:function(e,t){e.exports=window.wp.compose}});
1
+ this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},2:function(e,t){e.exports=window.wp.element},20:function(e,t,n){"use strict";n.r(t),n.d(t,"QuestionBase",(function(){return v})),n.d(t,"SingleChoice",(function(){return E})),n.d(t,"MultipleChoices",(function(){return U})),n.d(t,"TrueOrFalse",(function(){return Y})),n.d(t,"FillInBlanks",(function(){return le})),n.d(t,"SortingChoice",(function(){return je}));var r=n(2),o=n(3),i=n(1),c=n(0);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p(this,n)}}function p(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=lodash,d=h.isArray,v=(h.get,h.set,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(u,e);var t,n,r,o=f(u);function u(e){var t;a(this,u),m(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var n=e.question;return n&&n.id!==t.questionId?{options:t.self.parseOptions(n.options)}:null})),m(y(t),"setInputRef",(function(e,n){t.inputs||(t.inputs={}),t.inputs[n]=e})),m(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,n=e.status,r=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===n&&o||r&&!i})),m(y(t),"maybeDisabledOption",(function(e){var n=t.props,r=(n.answered,n.status);return n.isCheckedAnswer||"started"!==r})),m(y(t),"setAnswerChecked",(function(){return function(e){var n=t.props,r=n.updateUserQuestionAnswers,o=n.question;if("started"!==n.status)return"LP Error: can not set answers";var i=t.$wrap.find(".option-check"),c=[],u="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(c.push(t.value),u))return!1})),r(o.id,u?c[0]:c)}})),m(y(t),"maybeCheckedAnswer",(function(e){var n=t.props.answered;return d(n)?!!n.find((function(t){return t==e})):e==n})),m(y(t),"getOptionType",(function(e,t){var n="radio";switch(e){case"multi_choice":n="checkbox"}return n})),m(y(t),"isDefaultType",(function(){return t.props.supportOptions})),m(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(c.__)("Render function should be overwritten from base.","learnpress"))})),m(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),m(y(t),"parseOptions",(function(e){return e&&(e=d(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=d(e)?e:JSON.parse(e)),e||[]})),m(y(t),"getOptions",(function(){return t.state.options||[]})),m(y(t),"isCorrect",(function(){var e,n,r,o=t.props.answered;if(!o)return!1;for(e=0,r=t.getOptions();e<r.length;e++)if("yes"===(n=r[e]).isTrue&&o==n.value)return!0;return!1})),m(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),m(y(t),"getCorrectLabel",(function(){var e=t.props,n=(e.status,e.answered,e.question),r=(LP.config.isQuestionCorrect[n.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(r?" correct":" incorrect")},React.createElement("span",{className:"label"},r?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),r?n.point:0,n.point)))}));var n=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:n?t.parseOptions(n.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=u,r=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(n=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(n.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(n.type,t),className:"option-check",name:"started"===r?"learn-press-question-".concat(n.id):"",id:o,ref:function(n){e.setInputRef(n,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===r?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,n),r&&s(t,r),u}(r.Component));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=A(e);if(t){var o=A(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==w(t)&&"function"!=typeof t?P(e):t}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(n,e);var t=_(n);function n(){var e;j(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return C(P(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=O(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=B(e);if(t){var o=B(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return L(this,n)}}function L(e,t){return!t||"object"!==T(t)&&"function"!=typeof t?M(e):t}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=lodash.isBoolean,U=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(n,e);var t=N(n);function n(){var e;x(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return D(M(e=t.call.apply(t,[this].concat(o))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(F(o)||!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if("yes"===(n=r[t]).isTrue){if(-1===o.indexOf(n.value))return!1}else if(-1!==o.indexOf(n.value))return!1;return!0})),D(M(e),"getOptionClass",(function(t){var n=e.props.answered,r=k(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?-1!==n.indexOf(t.value)&&r.push("answered-correct"):-1!==n.indexOf(t.value)&&r.push("answered-wrong"))),r})),e}return n}(v);function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Q(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=K(e);if(t){var o=K(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return V(this,n)}}function V(e,t){return!t||"object"!==H(t)&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&J(e,t)}(n,e);var t=W(n);function n(){var e;z(this,n);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return X(G(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var n=e.props.answered,r=Q(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&r.push("answer-correct"),n&&("yes"===t.isTrue?n===t.value&&r.push("answered-correct"):n===t.value&&r.push("answered-wrong"))),r})),e}return n}(v);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ae(e);if(t){var o=ae(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ce(this,n)}}function ce(e,t){return!t||"object"!==Z(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(i,e);var t,n,r,o=ie(i);function i(){var e;ne(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return se(ue(e=o.call.apply(o,[this].concat(n))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),n={};ee(t).map((function(t){t.addEventListener("input",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)})),t.addEventListener("paste",(function(r){e.setAnswered(n,t.dataset.id,r.target.value)}))}))})),se(ue(e),"setAnswered",(function(t,n,r){var o=e.props,i=o.updateUserQuestionAnswers,c=o.question;if("started"!==o.status)return"LP Error: can not set answers";var u=Object.assign(t,se({},n,r));i(c.id,u)})),se(ue(e),"getCorrectLabel",(function(){var t=e.props,n=t.question,r=t.mark,o=r||0;return r&&(Number.isInteger(r)||(o=r.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(c.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(n.point," ").concat(Object(c.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(c.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(c.__)("Incorrect","learnpress")))})),e}return t=i,(n=[{key:"componentDidMount",value:function(){this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(e){return React.createElement("div",{key:"blank-".concat(e.uid),dangerouslySetInnerHTML:{__html:e.title||e.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&re(t.prototype,n),r&&re(t,r),i}(v);function fe(e){return(fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e){return function(e){if(Array.isArray(e))return ye(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return ye(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ye(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Oe(e);if(t){var o=Oe(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ve(this,n)}}function ve(e,t){return!t||"object"!==fe(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ge(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var je=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&he(e,t)}(i,e);var t,n,r,o=de(i);function i(){var e;be(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ge(we(e=o.call.apply(o,[this].concat(n))),"isCorrect",(function(){var t,n,r,o=e.props.answered;if(!o)return!1;for(t=0,r=e.getOptions();t<r.length;t++)if(o[(n=r[t]).sorting]!==n.value)return!1;return!0})),ge(we(e),"getCorrectLabel",(function(){var t=e.props.question,n=e.isCorrect.call(we(e));return e.maybeShowCorrectAnswer()&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(c.__)("Correct","learnpress"):Object(c.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(c.__)("%d/%d point","learnpress"),n?t.point:0,t.point))))})),ge(we(e),"getAnswerSortingChoice",(function(){var t=e.props.question.options||[],n=e.isCorrect.call(we(e)),r=[];return!n&&t.length>0&&t.map((function(e){var t=e.sorting;if(void 0!==t)return r[t]=e.title})),r})),e}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.updateUserQuestionAnswers,n=e.question,r=document.querySelector("#answer-options-".concat(n.id));return jQuery(r).sortable({items:".answer-option",cursor:"move",axis:"y",handle:".option-drag",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,update:function(e,o){var i=r.querySelectorAll(".answer-option"),c=[];pe(i).map((function(e){return c.push(e.dataset.value)})),c.length>0&&t(n.id,c)}})}},{key:"render",value:function(){var e=this,t=this.props.question,n=this.getAnswerSortingChoice();return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(t.id),className:"answer-options lp-sorting-choice-ul"},this.getOptions().map((function(t,r){return React.createElement(React.Fragment,null,React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.value),"data-value":t.value},React.createElement("span",{className:"option-drag",style:{display:"flex",alignItems:"center",position:"absolute",height:"100%",left:14}},React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24",viewBox:"0 0 24 24",width:"24"},React.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),React.createElement("path",{d:"M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"}))),React.createElement("label",{htmlFor:"learn-press-answer-option-".concat(t.value),className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}})),n.length>0&&void 0!==n[r]&&React.createElement("div",{className:"lp-sorting-choice__check-answer",key:"lp-checked-answer-".concat(r),style:{marginBottom:10}},n[r]))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&me(t.prototype,n),r&&me(t,r),i}(v);function Se(e){return(Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ae(e,t){return(Ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ke(e);if(t){var o=ke(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ee(this,n)}}function Ee(e,t){return!t||"object"!==Se(t)&&"function"!=typeof t?Te(e):t}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ke(e){return(ke=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ae(e,t)}(i,e);var t,n,r,o=Ce(i);function i(){var e;Re(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return qe(Te(e=o.call.apply(o,[this].concat(n))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks,sorting_choice:LP.questionTypes.SortingChoice})[t.type]})),e}return t=i,(n=[{key:"render",value:function(){var e=this.props,t=e.question,n=e.supportOptions,r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){qe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},this.props);r.supportOptions=-1!==n.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(c.sprintf)(Object(c.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,r))}}])&&Pe(t.prototype,n),r&&Pe(t,r),i}(r.Component),Ie=Object(o.compose)(Object(i.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(n),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(xe);t.default=Ie},3:function(e,t){e.exports=window.wp.compose}});
assets/js/dist/frontend/quiz.js CHANGED
@@ -1639,6 +1639,7 @@ __webpack_require__.r(__webpack_exports__);
1639
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
1640
  /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
1641
  /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
 
1642
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1643
 
1644
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -1668,6 +1669,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1668
 
1669
 
1670
 
 
1671
  var _lodash = lodash,
1672
  debounce = _lodash.debounce;
1673
 
@@ -1723,8 +1725,18 @@ var Result = function Result() {
1723
  itemCompleted.textContent = parseInt(allItemCompleted.length);
1724
  }
1725
  }
 
 
1726
  }, [results]);
1727
 
 
 
 
 
 
 
 
 
1728
  var animate = function animate() {
1729
  setPercentage(0);
1730
  setDone(false);
@@ -3204,6 +3216,68 @@ function getUserMark(state) {
3204
 
3205
  /***/ }),
3206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3207
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js":
3208
  /*!***********************************************************************************************************************************************************************************************!*\
3209
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js ***!
@@ -3296,6 +3370,173 @@ LP.Hook.addAction('lp-question-compatible-builder', function () {
3296
 
3297
  /***/ }),
3298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3299
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/node_modules/classnames/index.js":
3300
  /*!*********************************************************************************************************************************************************!*\
3301
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/node_modules/classnames/index.js ***!
@@ -3477,6 +3718,17 @@ module.exports = refx;
3477
 
3478
  (function() { module.exports = window["wp"]["i18n"]; }());
3479
 
 
 
 
 
 
 
 
 
 
 
 
3480
  /***/ })
3481
 
3482
  /******/ });
1639
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
1640
  /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
1641
  /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
1642
+ /* harmony import */ var _single_curriculum_components_items_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../single-curriculum/components/items-progress */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js");
1643
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1644
 
1645
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1669
 
1670
 
1671
 
1672
+
1673
  var _lodash = lodash,
1674
  debounce = _lodash.debounce;
1675
 
1725
  itemCompleted.textContent = parseInt(allItemCompleted.length);
1726
  }
1727
  }
1728
+
1729
+ updateItemsProgress();
1730
  }, [results]);
1731
 
1732
+ var updateItemsProgress = function updateItemsProgress() {
1733
+ var elements = document.querySelectorAll('.popup-header__inner');
1734
+
1735
+ if (elements[0].querySelectorAll('form.form-button-finish-course').length === 0) {
1736
+ Object(_single_curriculum_components_items_progress__WEBPACK_IMPORTED_MODULE_3__["getResponse"])(elements[0]);
1737
+ }
1738
+ };
1739
+
1740
  var animate = function animate() {
1741
  setPercentage(0);
1742
  setDone(false);
3216
 
3217
  /***/ }),
3218
 
3219
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js":
3220
+ /*!*************************************************************************************************************************************************************************************!*\
3221
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***!
3222
+ \*************************************************************************************************************************************************************************************/
3223
+ /*! exports provided: default */
3224
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3225
+
3226
+ "use strict";
3227
+ __webpack_require__.r(__webpack_exports__);
3228
+ /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js");
3229
+ var $ = jQuery;
3230
+
3231
+ var lpModalOverlayCompleteItem = {
3232
+ elBtnFinishCourse: null,
3233
+ elBtnCompleteItem: null,
3234
+ init: function init() {
3235
+ if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].init()) {
3236
+ return;
3237
+ }
3238
+
3239
+ if (undefined === lpGlobalSettings || 'yes' !== lpGlobalSettings.option_enable_popup_confirm_finish) {
3240
+ return;
3241
+ }
3242
+
3243
+ this.elBtnFinishCourse = document.querySelectorAll('.lp-btn-finish-course');
3244
+ this.elBtnCompleteItem = document.querySelector('.lp-btn-complete-item');
3245
+
3246
+ if (this.elBtnCompleteItem) {
3247
+ this.elBtnCompleteItem.addEventListener('click', function (e) {
3248
+ e.preventDefault();
3249
+ var form = e.target.closest('form');
3250
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show();
3251
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title);
3252
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + form.dataset.confirm + '</div>');
3253
+
3254
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
3255
+ form.submit();
3256
+ };
3257
+ });
3258
+ }
3259
+
3260
+ if (this.elBtnFinishCourse) {
3261
+ this.elBtnFinishCourse.forEach(function (element) {
3262
+ return element.addEventListener('click', function (e) {
3263
+ e.preventDefault();
3264
+ var form = e.target.closest('form');
3265
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show();
3266
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title);
3267
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + form.dataset.confirm + '</div>');
3268
+
3269
+ _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
3270
+ form.submit();
3271
+ };
3272
+ });
3273
+ });
3274
+ }
3275
+ }
3276
+ };
3277
+ /* harmony default export */ __webpack_exports__["default"] = (lpModalOverlayCompleteItem);
3278
+
3279
+ /***/ }),
3280
+
3281
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js":
3282
  /*!***********************************************************************************************************************************************************************************************!*\
3283
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js ***!
3370
 
3371
  /***/ }),
3372
 
3373
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js":
3374
+ /*!***************************************************************************************************************************************************************************************************!*\
3375
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js ***!
3376
+ \***************************************************************************************************************************************************************************************************/
3377
+ /*! exports provided: itemsProgress, getResponse */
3378
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3379
+
3380
+ "use strict";
3381
+ __webpack_require__.r(__webpack_exports__);
3382
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "itemsProgress", function() { return itemsProgress; });
3383
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
3384
+ /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
3385
+ /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
3386
+ /* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
3387
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
3388
+
3389
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3390
+
3391
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3392
+
3393
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3394
+
3395
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3396
+
3397
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
3398
+
3399
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3400
+
3401
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3402
+
3403
+ // Rest API load content course progress - Nhamdv.
3404
+
3405
+
3406
+ var itemsProgress = function itemsProgress() {
3407
+ var elements = document.querySelectorAll('.popup-header__inner');
3408
+
3409
+ if (!elements.length) {
3410
+ return;
3411
+ }
3412
+
3413
+ if (document.querySelector('#learn-press-quiz-app div.quiz-result') !== null) {
3414
+ return;
3415
+ }
3416
+
3417
+ if ('IntersectionObserver' in window) {
3418
+ var eleObserver = new IntersectionObserver(function (entries, observer) {
3419
+ entries.forEach(function (entry) {
3420
+ if (entry.isIntersecting) {
3421
+ var ele = entry.target;
3422
+ getResponse(ele);
3423
+ eleObserver.unobserve(ele);
3424
+ }
3425
+ });
3426
+ });
3427
+
3428
+ _toConsumableArray(elements).map(function (ele) {
3429
+ return eleObserver.observe(ele);
3430
+ });
3431
+ }
3432
+ };
3433
+ var getResponse = /*#__PURE__*/function () {
3434
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ele) {
3435
+ var response, data;
3436
+ return regeneratorRuntime.wrap(function _callee$(_context) {
3437
+ while (1) {
3438
+ switch (_context.prev = _context.next) {
3439
+ case 0:
3440
+ _context.next = 2;
3441
+ return wp.apiFetch({
3442
+ path: Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__["addQueryArgs"])('lp/v1/lazy-load/items-progress', {
3443
+ courseId: lpGlobalSettings.post_id || '',
3444
+ userId: lpGlobalSettings.user_id || ''
3445
+ }),
3446
+ method: 'GET'
3447
+ });
3448
+
3449
+ case 2:
3450
+ response = _context.sent;
3451
+ data = response.data;
3452
+ ele.innerHTML += data;
3453
+ _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__["default"].init();
3454
+
3455
+ case 6:
3456
+ case "end":
3457
+ return _context.stop();
3458
+ }
3459
+ }
3460
+ }, _callee);
3461
+ }));
3462
+
3463
+ return function getResponse(_x) {
3464
+ return _ref.apply(this, arguments);
3465
+ };
3466
+ }();
3467
+
3468
+ /***/ }),
3469
+
3470
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js":
3471
+ /*!*********************************************************************************************************************************************************************!*\
3472
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js ***!
3473
+ \*********************************************************************************************************************************************************************/
3474
+ /*! exports provided: default */
3475
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3476
+
3477
+ "use strict";
3478
+ __webpack_require__.r(__webpack_exports__);
3479
+ var $ = jQuery;
3480
+ var elLPOverlay = null;
3481
+ var lpModalOverlay = {
3482
+ elLPOverlay: null,
3483
+ elMainContent: null,
3484
+ elTitle: null,
3485
+ elBtnYes: null,
3486
+ elBtnNo: null,
3487
+ elFooter: null,
3488
+ elCalledModal: null,
3489
+ callBackYes: null,
3490
+ instance: null,
3491
+ init: function init() {
3492
+ if (this.instance) {
3493
+ return true;
3494
+ }
3495
+
3496
+ this.elLPOverlay = $('.lp-overlay');
3497
+
3498
+ if (!this.elLPOverlay.length) {
3499
+ return false;
3500
+ }
3501
+
3502
+ elLPOverlay = this.elLPOverlay;
3503
+ this.elMainContent = elLPOverlay.find('.main-content');
3504
+ this.elTitle = elLPOverlay.find('.modal-title');
3505
+ this.elBtnYes = elLPOverlay.find('.btn-yes');
3506
+ this.elBtnNo = elLPOverlay.find('.btn-no');
3507
+ this.elFooter = elLPOverlay.find('.lp-modal-footer');
3508
+ $(document).on('click', '.close, .btn-no', function () {
3509
+ elLPOverlay.hide();
3510
+ });
3511
+ $(document).on('click', '.btn-yes', function (e) {
3512
+ e.preventDefault();
3513
+ e.stopPropagation();
3514
+
3515
+ if ('function' === typeof lpModalOverlay.callBackYes) {
3516
+ lpModalOverlay.callBackYes();
3517
+ }
3518
+ });
3519
+ this.instance = this;
3520
+ return true;
3521
+ },
3522
+ setElCalledModal: function setElCalledModal(elCalledModal) {
3523
+ this.elCalledModal = elCalledModal;
3524
+ },
3525
+ setContentModal: function setContentModal(content, event) {
3526
+ this.elMainContent.html(content);
3527
+
3528
+ if ('function' === typeof event) {
3529
+ event();
3530
+ }
3531
+ },
3532
+ setTitleModal: function setTitleModal(content) {
3533
+ this.elTitle.html(content);
3534
+ }
3535
+ };
3536
+ /* harmony default export */ __webpack_exports__["default"] = (lpModalOverlay);
3537
+
3538
+ /***/ }),
3539
+
3540
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/node_modules/classnames/index.js":
3541
  /*!*********************************************************************************************************************************************************!*\
3542
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/node_modules/classnames/index.js ***!
3718
 
3719
  (function() { module.exports = window["wp"]["i18n"]; }());
3720
 
3721
+ /***/ }),
3722
+
3723
+ /***/ "@wordpress/url":
3724
+ /*!*****************************!*\
3725
+ !*** external ["wp","url"] ***!
3726
+ \*****************************/
3727
+ /*! no static exports found */
3728
+ /***/ (function(module, exports) {
3729
+
3730
+ (function() { module.exports = window["wp"]["url"]; }());
3731
+
3732
  /***/ })
3733
 
3734
  /******/ });
assets/js/dist/frontend/quiz.min.js CHANGED
@@ -1,6 +1,6 @@
1
- this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,,function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
- */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return qn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return vt})),n.d(r,"setCurrentQuestion",(function(){return Ot})),n.d(r,"setCurrentPage",(function(){return wt})),n.d(r,"__requestBeforeStartQuiz",(function(){return _t})),n.d(r,"__requestStartQuizSuccess",(function(){return jt})),n.d(r,"startQuiz",(function(){return Rt})),n.d(r,"__requestSubmitQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuizSuccess",(function(){return St})),n.d(r,"submitQuiz",(function(){return Et})),n.d(r,"updateUserQuestionAnswers",(function(){return Pt})),n.d(r,"__requestShowHintSuccess",(function(){return kt})),n.d(r,"showHint",(function(){return zt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return Qt})),n.d(r,"checkAnswer",(function(){return At})),n.d(r,"markQuestionRendered",(function(){return It})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Ct}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Ut})),n.d(o,"getItemStatus",(function(){return Mt})),n.d(o,"getProp",(function(){return Lt})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Ft})),n.d(o,"getQuestions",(function(){return Bt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return Jt})),n.d(o,"getQuestionMark",(function(){return Zt})),n.d(o,"getCurrentQuestion",(function(){return $t})),n.d(o,"getQuestion",(function(){return Gt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Yt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return Xt})),n.d(o,"getUserMark",(function(){return en}));var i=n(2),a=n(3),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a("Are you sure you want to retry quiz?",e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c._x)("Retake","label button retry quiz","learnpress")).concat(u?" (".concat(u,")"):""):Object(c._x)("Start","label button start quiz","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&g(t.prototype,n),r&&g(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(N(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),U=n(11),M=n.n(U);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Z(e);if(t){var o=Z(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return W(this,n)}}function W(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?J(e):t}function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=K(i);function i(){var e;return H(this,i),$(J(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:M()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c._x)("Check answer","label of button check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&F(t.prototype,n),r&&F(t,r),i}(i.Component),V=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(G),Y=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:V,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return n.title},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(Y,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ge(e,t)}(i,e);var t,n,r,o=ve(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||Object(c._x)("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Ee(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))};function ze(e){return function(e){if(Array.isArray(e))return Ie(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ae(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||Ae(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Ce=function(){var e=Qe(Object(i.useState)(0),2),t=e[0],n=e[1],r=Qe(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]);Object(i.useEffect)((function(){p();var e="";if(e=s.graduation?s.graduation:s.result>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=ze(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[s]);var p=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},d=t;Number.isInteger(t)||(d=parseFloat(t).toFixed(2));var m=190*Math.PI,b=m-d/100*m,y={strokeDasharray:"".concat(m," ").concat(m),strokeDashoffset:b},h=s.passingGrade||l,g="";g=s.graduation?s.graduation:d>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed";var v="";v=s.graduationText?s.graduationText:"passed"===g?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var O=["quiz-result",g];return React.createElement("div",{className:O.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:y,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(d,"%")),React.createElement("span",{className:"result-require"},h||Object(c._x)("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},v),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},Te=jQuery,xe=lodash.debounce,De=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=Te("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");Te(window).on("resize.refresh-quiz-stauts-bar",xe((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Ue(e){return function(e){if(Array.isArray(e))return Me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Me(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Be=lodash,Ke=(Be.omit,Be.flow),We=Be.isArray,Je=Be.chunk,Ze=(LP.camelCaseDashObjectKeys,LP.localStorage),$e=Ze.get,Ge=Ze.set,Ve={},Ye=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Fe({},t.questionId,n))})},Xe=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Ue(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},et=function(e,t){return t.currentPage&&Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},tt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Ue(n)})},nt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Ue(n),answered:He(He({},e.answered),{},Fe({},t.questionId,t.result)),checkedQuestions:[].concat(Ue(e.checkedQuestions),[t.questionId])})},rt=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return et(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Ue(n)}))},ot=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return et(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},it=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),at=Object(u.combineReducers)({blocks:it,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=Je(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:$e("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return ot(e,t);case"SET_CURRENT_QUESTION":return Ge("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return rt(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Ye(e,t):e;case"MARK_QUESTION_RENDERED":return Xe(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?et(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return tt(e,t);case"CHECK_ANSWER":return nt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),ut=n(7);function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ct=regeneratorRuntime.mark(Et),lt=regeneratorRuntime.mark(zt),ft=regeneratorRuntime.mark(At);function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dt(e){return function(e){if(Array.isArray(e))return mt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return mt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,dt(e))}var yt=LP,ht=yt.camelCaseDashObjectKeys,gt=yt.Hook;function vt(e,t){return t="string"==typeof e?pt({},e,t):e,{type:"SET_QUIZ_DATA",data:ht(t)}}function Ot(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function wt(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function _t(e,t,n){return{type:"BEFORE_START_QUIZ"}}function jt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var Rt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(ut.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,bt("learnpress/quiz","__requestStartQuizSuccess",ht(o),n,r);case 10:case"end":return e.stop()}}),e)}));function qt(){return{type:"SUBMIT_QUIZ"}}function St(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Et(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(ut.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,bt("learnpress/quiz","__requestSubmitQuizSuccess",ht(s.results),o,i);case 13:case"end":return c.stop()}}),ct)}function Pt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function kt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function zt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,bt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),lt)}function Qt(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?st(Object(n),!0).forEach((function(t){pt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function At(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(ut.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,bt("learnpress/quiz","__requestCheckAnswerSuccess",e,ht(s));case 7:case"end":return c.stop()}}),ft)}function It(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Ct(e){return setTimeout((function(){bt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var Tt=lodash,xt=Tt.get,Dt=Tt.isArray,Ut=function(e,t){console.time("parseOptions");var n=Gt(e,t).options;return n=Dt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Dt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Mt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.status"):""}function Lt(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.attempts"):[]}function Ft(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.answered",{}):{}}function Bt(e){var t=e.userQuiz,n=xt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?xt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function Jt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".answered"))||void 0}function Zt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".mark"))||void 0}function $t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=xt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=xt(e,"userQuiz.currentPage")||1;return xt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Gt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(xt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Yt(e,t){}var Xt=function(e,t){var n=xt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function en(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var tn=n(4),nn=n.n(tn),rn={ENROLL_COURSE_X:function(e,t){}};var on=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=nn()(rn)(n)(e.dispatch),e.dispatch=t,e};function an(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function un(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sn=LP.dataControls.controls,cn=Object(u.registerStore)("learnpress/quiz",{reducer:at,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?an(Object(n),!0).forEach((function(t){un(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):an(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},sn)});on(cn);function ln(e){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=hn(e);if(t){var o=hn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return bn(this,n)}}function bn(e,t){return!t||"object"!==ln(t)&&"function"!=typeof t?yn(e):t}function yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vn=lodash.chunk,On=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(i,e);var t,n,r,o=mn(i);function i(e){var t;return fn(this,i),gn(yn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=vn(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Ce,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(De,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(E,null),r&&!n&&React.createElement(Se,null)))}}])&&pn(t.prototype,n),r&&pn(t,r),i}(i.Component),wn=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(On);n(8);function _n(e){return function(e){if(Array.isArray(e))return jn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rn=LP.modal.default,qn=(t.default=wn,function(e,t){wp.element.render(React.createElement(Rn,null,React.createElement(wn,{settings:t})),_n(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
1
+ this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},a=i,u=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}}))})))}});t.a=u},function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(5),o=n(4);function i(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;c(n),t.unobserve(n)}}))}));a(e).map((function(e){return t.observe(e)}))}},c=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}()},function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
+ */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return Sn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return Ot})),n.d(r,"setCurrentQuestion",(function(){return wt})),n.d(r,"setCurrentPage",(function(){return _t})),n.d(r,"__requestBeforeStartQuiz",(function(){return jt})),n.d(r,"__requestStartQuizSuccess",(function(){return Rt})),n.d(r,"startQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuiz",(function(){return St})),n.d(r,"__requestSubmitQuizSuccess",(function(){return Pt})),n.d(r,"submitQuiz",(function(){return Et})),n.d(r,"updateUserQuestionAnswers",(function(){return kt})),n.d(r,"__requestShowHintSuccess",(function(){return zt})),n.d(r,"showHint",(function(){return Qt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return At})),n.d(r,"checkAnswer",(function(){return It})),n.d(r,"markQuestionRendered",(function(){return Ct})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Tt}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Lt})),n.d(o,"getItemStatus",(function(){return Ut})),n.d(o,"getProp",(function(){return Ft})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Bt})),n.d(o,"getQuestions",(function(){return Gt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return $t})),n.d(o,"getQuestionMark",(function(){return Jt})),n.d(o,"getCurrentQuestion",(function(){return Zt})),n.d(o,"getQuestion",(function(){return Yt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Xt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return en})),n.d(o,"getUserMark",(function(){return tn}));var i=n(2),a=n(3),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a("Are you sure you want to retry quiz?",e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c._x)("Retake","label button retry quiz","learnpress")).concat(u?" (".concat(u,")"):""):Object(c._x)("Start","label button start quiz","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&v(t.prototype,n),r&&v(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),P=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(t){var o=N(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?C(e):t}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(C(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),M=n(12),L=n.n(M);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=$(e);if(t){var o=$(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return K(this,n)}}function K(e,t){return!t||"object"!==U(t)&&"function"!=typeof t?W(e):t}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=G(i);function i(){var e;return F(this,i),J(W(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:L()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c._x)("Check answer","label of button check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&H(t.prototype,n),r&&H(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(Z),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return n.title},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(i,e);var t,n,r,o=ge(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||Object(c._x)("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Pe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Pe(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))},ze=n(8);function Qe(e){return function(e){if(Array.isArray(e))return Ce(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ie(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||Ie(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Te=function(){var e=Ae(Object(i.useState)(0),2),t=e[0],n=e[1],r=Ae(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]);Object(i.useEffect)((function(){d();var e="";if(e=s.graduation?s.graduation:s.result>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=Qe(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}p()}),[s]);var p=function(){var e=document.querySelectorAll(".popup-header__inner");0===e[0].querySelectorAll("form.form-button-finish-course").length&&Object(ze.a)(e[0])},d=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},m=t;Number.isInteger(t)||(m=parseFloat(t).toFixed(2));var b=190*Math.PI,y=b-m/100*b,h={strokeDasharray:"".concat(b," ").concat(b),strokeDashoffset:y},v=s.passingGrade||l,g="";g=s.graduation?s.graduation:m>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed";var O="";O=s.graduationText?s.graduationText:"passed"===g?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var w=["quiz-result",g];return React.createElement("div",{className:w.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:h,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(m,"%")),React.createElement("span",{className:"result-require"},v||Object(c._x)("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},O),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},xe=jQuery,De=lodash.debounce,Me=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=xe("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");xe(window).on("resize.refresh-quiz-stauts-bar",De((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Le(e){return function(e){if(Array.isArray(e))return Ue(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ge=lodash,Ke=(Ge.omit,Ge.flow),We=Ge.isArray,$e=Ge.chunk,Je=(LP.camelCaseDashObjectKeys,LP.localStorage),Ze=Je.get,Ye=Je.set,Ve={},Xe=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Be({},t.questionId,n))})},et=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Le(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},tt=function(e,t){return t.currentPage&&Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},nt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Le(n)})},rt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Le(n),answered:He(He({},e.answered),{},Be({},t.questionId,t.result)),checkedQuestions:[].concat(Le(e.checkedQuestions),[t.questionId])})},ot=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return tt(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Le(n)}))},it=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return tt(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},at=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),ut=Object(u.combineReducers)({blocks:at,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=$e(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:Ze("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return it(e,t);case"SET_CURRENT_QUESTION":return Ye("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ye("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return ot(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Xe(e,t):e;case"MARK_QUESTION_RENDERED":return et(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?tt(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return nt(e,t);case"CHECK_ANSWER":return rt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),st=n(9);function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var lt=regeneratorRuntime.mark(Et),ft=regeneratorRuntime.mark(Qt),pt=regeneratorRuntime.mark(It);function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){return function(e){if(Array.isArray(e))return bt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return bt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function yt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,mt(e))}var ht=LP,vt=ht.camelCaseDashObjectKeys,gt=ht.Hook;function Ot(e,t){return t="string"==typeof e?dt({},e,t):e,{type:"SET_QUIZ_DATA",data:vt(t)}}function wt(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function _t(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function jt(e,t,n){return{type:"BEFORE_START_QUIZ"}}function Rt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var qt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(st.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,yt("learnpress/quiz","__requestStartQuizSuccess",vt(o),n,r);case 10:case"end":return e.stop()}}),e)}));function St(){return{type:"SUBMIT_QUIZ"}}function Pt(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Et(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(st.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,yt("learnpress/quiz","__requestSubmitQuizSuccess",vt(s.results),o,i);case 13:case"end":return c.stop()}}),lt)}function kt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function zt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function Qt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,yt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),ft)}function At(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function It(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(st.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,yt("learnpress/quiz","__requestCheckAnswerSuccess",e,vt(s));case 7:case"end":return c.stop()}}),pt)}function Ct(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Tt(e){return setTimeout((function(){yt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var xt=lodash,Dt=xt.get,Mt=xt.isArray,Lt=function(e,t){console.time("parseOptions");var n=Yt(e,t).options;return n=Mt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Mt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Ut(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.status"):""}function Ft(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.attempts"):[]}function Bt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.answered",{}):{}}function Gt(e){var t=e.userQuiz,n=Dt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?Dt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function $t(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".answered"))||void 0}function Jt(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".mark"))||void 0}function Zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Dt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=Dt(e,"userQuiz.currentPage")||1;return Dt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Yt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(Dt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Xt(e,t){}var en=function(e,t){var n=Dt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function tn(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var nn=n(6),rn=n.n(nn),on={ENROLL_COURSE_X:function(e,t){}};var an=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=rn()(on)(n)(e.dispatch),e.dispatch=t,e};function un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=LP.dataControls.controls,ln=Object(u.registerStore)("learnpress/quiz",{reducer:ut,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?un(Object(n),!0).forEach((function(t){sn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):un(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},cn)});an(ln);function fn(e){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vn(e);if(t){var o=vn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return yn(this,n)}}function yn(e,t){return!t||"object"!==fn(t)&&"function"!=typeof t?hn(e):t}function hn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vn(e){return(vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var On=lodash.chunk,wn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mn(e,t)}(i,e);var t,n,r,o=bn(i);function i(e){var t;return pn(this,i),gn(hn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=On(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Te,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(Me,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(P,null),r&&!n&&React.createElement(Se,null)))}}])&&dn(t.prototype,n),r&&dn(t,r),i}(i.Component),_n=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(wn);n(10);function jn(e){return function(e){if(Array.isArray(e))return Rn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qn=LP.modal.default,Sn=(t.default=_n,function(e,t){wp.element.render(React.createElement(qn,null,React.createElement(_n,{settings:t})),jn(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
assets/js/dist/frontend/single-course.js CHANGED
@@ -397,11 +397,11 @@ var retakeCourse = function retakeCourse() {
397
  return;
398
  }
399
 
400
- var elButtonRetakeCourse = elFormRetakeCourse.querySelector('.button-retake-course');
401
  var elCourseId = elFormRetakeCourse.querySelector('[name=retake-course]').value;
402
  var elAjaxMessage = elFormRetakeCourse.querySelector('.lp-ajax-message');
403
 
404
- var submit = function submit() {
405
  wp.apiFetch({
406
  path: '/lp/v1/courses/retake-course',
407
  method: 'POST',
@@ -424,7 +424,7 @@ var retakeCourse = function retakeCourse() {
424
  }
425
  })["catch"](function (err) {
426
  elAjaxMessage.classList.add('error');
427
- elAjaxMessage.innerHTML = 'error: ' + err.data.status + ' ' + err.message;
428
  }).then(function () {
429
  elButtonRetakeCourse.classList.remove('loading');
430
  elButtonRetakeCourse.disabled = false;
@@ -435,11 +435,13 @@ var retakeCourse = function retakeCourse() {
435
  elFormRetakeCourse.addEventListener('submit', function (e) {
436
  e.preventDefault();
437
  });
438
- elButtonRetakeCourse.addEventListener('click', function (e) {
439
- e.preventDefault();
440
- elButtonRetakeCourse.classList.add('loading');
441
- elButtonRetakeCourse.disabled = true;
442
- submit();
 
 
443
  });
444
  }; // Rest API load content course progress - Nhamdv.
445
 
@@ -810,7 +812,12 @@ var lpModalOverlay = {
810
  elFooter: null,
811
  elCalledModal: null,
812
  callBackYes: null,
 
813
  init: function init() {
 
 
 
 
814
  this.elLPOverlay = $('.lp-overlay');
815
 
816
  if (!this.elLPOverlay.length) {
@@ -826,11 +833,15 @@ var lpModalOverlay = {
826
  $(document).on('click', '.close, .btn-no', function () {
827
  elLPOverlay.hide();
828
  });
829
- $(document).on('click', '.btn-yes', function () {
 
 
 
830
  if ('function' === typeof lpModalOverlay.callBackYes) {
831
  lpModalOverlay.callBackYes();
832
  }
833
  });
 
834
  return true;
835
  },
836
  setElCalledModal: function setElCalledModal(elCalledModal) {
397
  return;
398
  }
399
 
400
+ var elButtonRetakeCourses = elFormRetakeCourse.querySelectorAll('.button-retake-course');
401
  var elCourseId = elFormRetakeCourse.querySelector('[name=retake-course]').value;
402
  var elAjaxMessage = elFormRetakeCourse.querySelector('.lp-ajax-message');
403
 
404
+ var submit = function submit(elButtonRetakeCourse) {
405
  wp.apiFetch({
406
  path: '/lp/v1/courses/retake-course',
407
  method: 'POST',
424
  }
425
  })["catch"](function (err) {
426
  elAjaxMessage.classList.add('error');
427
+ elAjaxMessage.innerHTML = 'error: ' + err.message;
428
  }).then(function () {
429
  elButtonRetakeCourse.classList.remove('loading');
430
  elButtonRetakeCourse.disabled = false;
435
  elFormRetakeCourse.addEventListener('submit', function (e) {
436
  e.preventDefault();
437
  });
438
+ elButtonRetakeCourses.forEach(function (element) {
439
+ return element.addEventListener('click', function (e) {
440
+ e.preventDefault();
441
+ element.classList.add('loading');
442
+ element.disabled = true;
443
+ submit(element);
444
+ });
445
  });
446
  }; // Rest API load content course progress - Nhamdv.
447
 
812
  elFooter: null,
813
  elCalledModal: null,
814
  callBackYes: null,
815
+ instance: null,
816
  init: function init() {
817
+ if (this.instance) {
818
+ return true;
819
+ }
820
+
821
  this.elLPOverlay = $('.lp-overlay');
822
 
823
  if (!this.elLPOverlay.length) {
833
  $(document).on('click', '.close, .btn-no', function () {
834
  elLPOverlay.hide();
835
  });
836
+ $(document).on('click', '.btn-yes', function (e) {
837
+ e.preventDefault();
838
+ e.stopPropagation();
839
+
840
  if ('function' === typeof lpModalOverlay.callBackYes) {
841
  lpModalOverlay.callBackYes();
842
  }
843
  });
844
+ this.instance = this;
845
  return true;
846
  },
847
  setElCalledModal: function setElCalledModal(elCalledModal) {
assets/js/dist/frontend/single-course.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.singleCourse=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}([,,function(e,t){e.exports=window.wp.element},,,function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return s}));var i=jQuery,a=lodash.throttle,s=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),o(e.target.checked)}));var o=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};o(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))})),t.length&&(n.on("scroll",a((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,init:function(){return this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(){"function"==typeof i.callBackYes&&i.callBackYes()})),!0)},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},a=i,s=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}}))})))}});t.a=s},,,,function(e,t){e.exports=window.wp.url},,,function(e,t){!function(){e.exports=this.LP.quiz}()},function(e,t){},,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return h})),n.d(t,"initCourseTabs",(function(){return w})),n.d(t,"initCourseSidebar",(function(){return S})),n.d(t,"enrollCourse",(function(){return C}));var r=n(2),o=(n(13),n(14),n(5));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(i,e);var t,n,r,o=c(i);function i(){return a(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return React.createElement(React.Fragment,null)}}])&&s(t.prototype,n),r&&s(t,r),i}(r.Component);window.addEventListener("DOMContentLoaded",(function(){Object(o.a)()}));n(10);var p=n(6);function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}t.default=f;var h=function(){wp.element.render(React.createElement(f,null))},g=jQuery,w=function(){g("#learn-press-course-tabs").on("change",'input[name="learn-press-course-tab-radio"]',(function(e){var t=g('input[name="learn-press-course-tab-radio"]:checked').val();LP.Cookies.set("course-tab",t),g('label[for="'+g(e.target).attr("id")+'"]').closest("li").addClass("active").siblings().removeClass("active")}))},S=function(){var e=g(".course-summary-sidebar");if(e.length){var t=g(window),n=e.children(),r=e.offset(),o=e.height(),i=n.height(),a=32;t.on("scroll.fixed-course-sidebar",(function(){var s=t.scrollTop()-r.top+a;if(s<0)return e.removeClass("slide-top slide-down"),void n.css("top","");s>o-i?(e.removeClass("slide-down").addClass("slide-top"),n.css("top",o-i)):(e.removeClass("slide-top").addClass("slide-down"),n.css("top",a))})).trigger("scroll.fixed-course-sidebar")}},C=function(){var e=document.querySelectorAll("form.enroll-course");e.length>0&&e.forEach((function(e){var t=function(){var t=b(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/enroll-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(r.style.display="none",e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),form.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=enroll-course]").value,o=e.querySelector("button.button-enroll-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),null!==document.querySelector(".course-detail-info")&&window.addEventListener("pageshow",(function(e){(e.persisted||void 0!==window.performance&&"back_forward"==String(window.performance.getEntriesByType("navigation")[0].type))&&location.reload()}))},L=function(){var e=document.querySelector(".lp-form-retake-course");if(e){var t=e.querySelector(".button-retake-course"),n=e.querySelector("[name=retake-course]").value,r=e.querySelector(".lp-ajax-message");e.addEventListener("submit",(function(e){e.preventDefault()})),t.addEventListener("click",(function(e){e.preventDefault(),t.classList.add("loading"),t.disabled=!0,wp.apiFetch({path:"/lp/v1/courses/retake-course",method:"POST",data:{id:n}}).then((function(e){var n=e.status,o=e.message,i=e.data;r.innerHTML=o,null!=n&&"success"===n?(t.style.display="none",setTimeout((function(){window.location.replace(i.url_redirect)}),1e3)):r.classList.add("error")})).catch((function(e){r.classList.add("error"),r.innerHTML="error: "+e.data.status+" "+e.message})).then((function(){t.classList.remove("loading"),t.disabled=!1,r.style.display="block"}))}))}};g(window).on("load",(function(){var e;g("#popup-course"),g("#learn-press-course-curriculum");v(document.querySelectorAll(".course-extra-box")).map((function(e){var t=e.querySelector(".course-extra-box__title");t.addEventListener("click",(function(){var n=t.nextElementSibling,r=document.querySelector(".course-extra-box.active");r&&!e.classList.contains("active")&&(r.classList.remove("active"),r.querySelector(".course-extra-box__content").style.display="none"),e.classList.contains("active")?(e.classList.remove("active"),n.style.display="none"):(e.classList.add("active"),n.style.display="block")}))})),w(),S(),C(),(e=document.querySelectorAll("form.purchase-course")).length>0&&e.forEach((function(e){var t=function(){var t=b(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/purchase-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),"success"===i&&a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),e.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=purchase-course]").value,o=e.querySelector("button.button-purchase-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),L(),function(){var e=document.querySelectorAll(".lp-course-progress-wrapper");if(e.length){if("IntersectionObserver"in window){var t=new IntersectionObserver((function(e,r){e.forEach((function(e){if(e.isIntersecting){var r=e.target;setTimeout((function(){n(r)}),600),t.unobserve(r)}}))}));v(e).map((function(e){return t.observe(e)}))}var n=function(){var e=b(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:"lp/v1/lazy-load/course-progress",method:"POST",data:{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}});case 2:n=e.sent,r=n.data,t.innerHTML=r;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}}(),p.a.init()}))}]);
1
+ this.LP=this.LP||{},this.LP.singleCourse=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}({14:function(e,t){!function(){e.exports=this.LP.quiz}()},15:function(e,t){},2:function(e,t){e.exports=window.wp.element},23:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return b})),n.d(t,"initCourseTabs",(function(){return w})),n.d(t,"initCourseSidebar",(function(){return S})),n.d(t,"enrollCourse",(function(){return C}));var r=n(2),o=(n(14),n(15),n(7));function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return u(this,n)}}function u(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(i,e);var t,n,r,o=c(i);function i(){return a(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){return React.createElement(React.Fragment,null)}}])&&s(t.prototype,n),r&&s(t,r),i}(r.Component);window.addEventListener("DOMContentLoaded",(function(){Object(o.a)()}));n(5);var p=n(4);function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){y(i,r,o,a,s,"next",e)}function s(e){y(i,r,o,a,s,"throw",e)}a(void 0)}))}}t.default=f;var b=function(){wp.element.render(React.createElement(f,null))},g=jQuery,w=function(){g("#learn-press-course-tabs").on("change",'input[name="learn-press-course-tab-radio"]',(function(e){var t=g('input[name="learn-press-course-tab-radio"]:checked').val();LP.Cookies.set("course-tab",t),g('label[for="'+g(e.target).attr("id")+'"]').closest("li").addClass("active").siblings().removeClass("active")}))},S=function(){var e=g(".course-summary-sidebar");if(e.length){var t=g(window),n=e.children(),r=e.offset(),o=e.height(),i=n.height(),a=32;t.on("scroll.fixed-course-sidebar",(function(){var s=t.scrollTop()-r.top+a;if(s<0)return e.removeClass("slide-top slide-down"),void n.css("top","");s>o-i?(e.removeClass("slide-down").addClass("slide-top"),n.css("top",o-i)):(e.removeClass("slide-top").addClass("slide-down"),n.css("top",a))})).trigger("scroll.fixed-course-sidebar")}},C=function(){var e=document.querySelectorAll("form.enroll-course");e.length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/enroll-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(r.style.display="none",e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),form.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=enroll-course]").value,o=e.querySelector("button.button-enroll-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),null!==document.querySelector(".course-detail-info")&&window.addEventListener("pageshow",(function(e){(e.persisted||void 0!==window.performance&&"back_forward"==String(window.performance.getEntriesByType("navigation")[0].type))&&location.reload()}))},L=function(){var e=document.querySelector(".lp-form-retake-course");if(e){var t=e.querySelectorAll(".button-retake-course"),n=e.querySelector("[name=retake-course]").value,r=e.querySelector(".lp-ajax-message");e.addEventListener("submit",(function(e){e.preventDefault()})),t.forEach((function(e){return e.addEventListener("click",(function(t){var o;t.preventDefault(),e.classList.add("loading"),e.disabled=!0,o=e,wp.apiFetch({path:"/lp/v1/courses/retake-course",method:"POST",data:{id:n}}).then((function(e){var t=e.status,n=e.message,i=e.data;r.innerHTML=n,null!=t&&"success"===t?(o.style.display="none",setTimeout((function(){window.location.replace(i.url_redirect)}),1e3)):r.classList.add("error")})).catch((function(e){r.classList.add("error"),r.innerHTML="error: "+e.message})).then((function(){o.classList.remove("loading"),o.disabled=!1,r.style.display="block"}))}))}))}};g(window).on("load",(function(){var e;g("#popup-course"),g("#learn-press-course-curriculum");v(document.querySelectorAll(".course-extra-box")).map((function(e){var t=e.querySelector(".course-extra-box__title");t.addEventListener("click",(function(){var n=t.nextElementSibling,r=document.querySelector(".course-extra-box.active");r&&!e.classList.contains("active")&&(r.classList.remove("active"),r.querySelector(".course-extra-box__content").style.display="none"),e.classList.contains("active")?(e.classList.remove("active"),n.style.display="none"):(e.classList.add("active"),n.style.display="block")}))})),w(),S(),C(),(e=document.querySelectorAll("form.purchase-course")).length>0&&e.forEach((function(e){var t=function(){var t=h(regeneratorRuntime.mark((function t(n,r){var o,i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,wp.apiFetch({path:"lp/v1/courses/purchase-course",method:"POST",data:{id:n}});case 3:o=t.sent,r.classList.remove("loading"),r.disabled=!1,i=o.status,a=o.data.redirect,(s=o.message)&&i&&(e.innerHTML+='<div class="lp-enroll-notice '.concat(i,'">').concat(s,"</div>"),"success"===i&&a&&(window.location.href=a)),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),e.innerHTML+='<div class="lp-enroll-notice error">'.concat(t.t0.message&&t.t0.message,"</div>");case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e,n){return t.apply(this,arguments)}}();e.addEventListener("submit",(function(n){n.preventDefault();var r=e.querySelector("input[name=purchase-course]").value,o=e.querySelector("button.button-purchase-course");o.classList.add("loading"),o.disabled=!0,t(r,o)}))})),L(),function(){var e=document.querySelectorAll(".lp-course-progress-wrapper");if(e.length){if("IntersectionObserver"in window){var t=new IntersectionObserver((function(e,r){e.forEach((function(e){if(e.isIntersecting){var r=e.target;setTimeout((function(){n(r)}),600),t.unobserve(r)}}))}));v(e).map((function(e){return t.observe(e)}))}var n=function(){var e=h(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:"lp/v1/lazy-load/course-progress",method:"POST",data:{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}});case 2:n=e.sent,r=n.data,t.innerHTML=r;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}}(),p.a.init()}))},4:function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},a=i,s=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){a.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");a.elLPOverlay.show(),a.setTitleModal(t.dataset.title),a.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),a.callBackYes=function(){t.submit()}}))})))}});t.a=s},5:function(e,t){e.exports=window.wp.url},7:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return s}));var i=jQuery,a=lodash.throttle,s=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),o(e.target.checked)}));var o=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};o(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))})),t.length&&(n.on("scroll",a((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}}});
assets/js/dist/frontend/single-curriculum.js CHANGED
@@ -328,6 +328,103 @@ LP.Hook.addAction('lp-question-compatible-builder', function () {
328
 
329
  /***/ }),
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js":
332
  /*!*********************************************************************************************************************************************************************************************!*\
333
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js ***!
@@ -554,8 +651,9 @@ __webpack_require__.r(__webpack_exports__);
554
  /* harmony import */ var _components_sidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/sidebar */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/sidebar.js");
555
  /* harmony import */ var _components_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/progress */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js");
556
  /* harmony import */ var _components_comment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/comment */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/comment.js");
557
- /* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/compatible */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js");
558
- /* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_components_compatible__WEBPACK_IMPORTED_MODULE_5__);
 
559
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
560
 
561
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -586,6 +684,7 @@ var $ = jQuery;
586
 
587
 
588
 
 
589
  var SingleCurriculums = /*#__PURE__*/function (_Component) {
590
  _inherits(SingleCurriculums, _Component);
591
 
@@ -630,7 +729,8 @@ window.addEventListener('DOMContentLoaded', function () {
630
  Object(_components_search__WEBPACK_IMPORTED_MODULE_1__["searchCourseContent"])();
631
  Object(_components_sidebar__WEBPACK_IMPORTED_MODULE_2__["Sidebar"])();
632
  Object(_components_progress__WEBPACK_IMPORTED_MODULE_3__["progressBar"])();
633
- Object(_components_comment__WEBPACK_IMPORTED_MODULE_4__["commentForm"])(); // Check duration expire of course
 
634
 
635
  var singleCurriculums = new SingleCurriculums();
636
  singleCurriculums.checkCourseDurationExpire();
@@ -717,7 +817,12 @@ var lpModalOverlay = {
717
  elFooter: null,
718
  elCalledModal: null,
719
  callBackYes: null,
 
720
  init: function init() {
 
 
 
 
721
  this.elLPOverlay = $('.lp-overlay');
722
 
723
  if (!this.elLPOverlay.length) {
@@ -733,11 +838,15 @@ var lpModalOverlay = {
733
  $(document).on('click', '.close, .btn-no', function () {
734
  elLPOverlay.hide();
735
  });
736
- $(document).on('click', '.btn-yes', function () {
 
 
 
737
  if ('function' === typeof lpModalOverlay.callBackYes) {
738
  lpModalOverlay.callBackYes();
739
  }
740
  });
 
741
  return true;
742
  },
743
  setElCalledModal: function setElCalledModal(elCalledModal) {
@@ -767,6 +876,17 @@ var lpModalOverlay = {
767
 
768
  (function() { module.exports = window["wp"]["element"]; }());
769
 
 
 
 
 
 
 
 
 
 
 
 
770
  /***/ })
771
 
772
  /******/ });
328
 
329
  /***/ }),
330
 
331
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js":
332
+ /*!***************************************************************************************************************************************************************************************************!*\
333
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js ***!
334
+ \***************************************************************************************************************************************************************************************************/
335
+ /*! exports provided: itemsProgress, getResponse */
336
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
337
+
338
+ "use strict";
339
+ __webpack_require__.r(__webpack_exports__);
340
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "itemsProgress", function() { return itemsProgress; });
341
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
342
+ /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
343
+ /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
344
+ /* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
345
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
346
+
347
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
348
+
349
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
350
+
351
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
352
+
353
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
354
+
355
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
356
+
357
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
358
+
359
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
360
+
361
+ // Rest API load content course progress - Nhamdv.
362
+
363
+
364
+ var itemsProgress = function itemsProgress() {
365
+ var elements = document.querySelectorAll('.popup-header__inner');
366
+
367
+ if (!elements.length) {
368
+ return;
369
+ }
370
+
371
+ if (document.querySelector('#learn-press-quiz-app div.quiz-result') !== null) {
372
+ return;
373
+ }
374
+
375
+ if ('IntersectionObserver' in window) {
376
+ var eleObserver = new IntersectionObserver(function (entries, observer) {
377
+ entries.forEach(function (entry) {
378
+ if (entry.isIntersecting) {
379
+ var ele = entry.target;
380
+ getResponse(ele);
381
+ eleObserver.unobserve(ele);
382
+ }
383
+ });
384
+ });
385
+
386
+ _toConsumableArray(elements).map(function (ele) {
387
+ return eleObserver.observe(ele);
388
+ });
389
+ }
390
+ };
391
+ var getResponse = /*#__PURE__*/function () {
392
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(ele) {
393
+ var response, data;
394
+ return regeneratorRuntime.wrap(function _callee$(_context) {
395
+ while (1) {
396
+ switch (_context.prev = _context.next) {
397
+ case 0:
398
+ _context.next = 2;
399
+ return wp.apiFetch({
400
+ path: Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__["addQueryArgs"])('lp/v1/lazy-load/items-progress', {
401
+ courseId: lpGlobalSettings.post_id || '',
402
+ userId: lpGlobalSettings.user_id || ''
403
+ }),
404
+ method: 'GET'
405
+ });
406
+
407
+ case 2:
408
+ response = _context.sent;
409
+ data = response.data;
410
+ ele.innerHTML += data;
411
+ _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__["default"].init();
412
+
413
+ case 6:
414
+ case "end":
415
+ return _context.stop();
416
+ }
417
+ }
418
+ }, _callee);
419
+ }));
420
+
421
+ return function getResponse(_x) {
422
+ return _ref.apply(this, arguments);
423
+ };
424
+ }();
425
+
426
+ /***/ }),
427
+
428
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js":
429
  /*!*********************************************************************************************************************************************************************************************!*\
430
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js ***!
651
  /* harmony import */ var _components_sidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/sidebar */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/sidebar.js");
652
  /* harmony import */ var _components_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/progress */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/progress.js");
653
  /* harmony import */ var _components_comment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/comment */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/comment.js");
654
+ /* harmony import */ var _components_items_progress__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/items-progress */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/items-progress.js");
655
+ /* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/compatible */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/components/compatible.js");
656
+ /* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_compatible__WEBPACK_IMPORTED_MODULE_6__);
657
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
658
 
659
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
684
 
685
 
686
 
687
+
688
  var SingleCurriculums = /*#__PURE__*/function (_Component) {
689
  _inherits(SingleCurriculums, _Component);
690
 
729
  Object(_components_search__WEBPACK_IMPORTED_MODULE_1__["searchCourseContent"])();
730
  Object(_components_sidebar__WEBPACK_IMPORTED_MODULE_2__["Sidebar"])();
731
  Object(_components_progress__WEBPACK_IMPORTED_MODULE_3__["progressBar"])();
732
+ Object(_components_comment__WEBPACK_IMPORTED_MODULE_4__["commentForm"])();
733
+ Object(_components_items_progress__WEBPACK_IMPORTED_MODULE_5__["itemsProgress"])(); // Check duration expire of course
734
 
735
  var singleCurriculums = new SingleCurriculums();
736
  singleCurriculums.checkCourseDurationExpire();
817
  elFooter: null,
818
  elCalledModal: null,
819
  callBackYes: null,
820
+ instance: null,
821
  init: function init() {
822
+ if (this.instance) {
823
+ return true;
824
+ }
825
+
826
  this.elLPOverlay = $('.lp-overlay');
827
 
828
  if (!this.elLPOverlay.length) {
838
  $(document).on('click', '.close, .btn-no', function () {
839
  elLPOverlay.hide();
840
  });
841
+ $(document).on('click', '.btn-yes', function (e) {
842
+ e.preventDefault();
843
+ e.stopPropagation();
844
+
845
  if ('function' === typeof lpModalOverlay.callBackYes) {
846
  lpModalOverlay.callBackYes();
847
  }
848
  });
849
+ this.instance = this;
850
  return true;
851
  },
852
  setElCalledModal: function setElCalledModal(elCalledModal) {
876
 
877
  (function() { module.exports = window["wp"]["element"]; }());
878
 
879
+ /***/ }),
880
+
881
+ /***/ "@wordpress/url":
882
+ /*!*****************************!*\
883
+ !*** external ["wp","url"] ***!
884
+ \*****************************/
885
+ /*! no static exports found */
886
+ /***/ (function(module, exports) {
887
+
888
+ (function() { module.exports = window["wp"]["url"]; }());
889
+
890
  /***/ })
891
 
892
  /******/ });
assets/js/dist/frontend/single-curriculum.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}({2:function(e,t){e.exports=window.wp.element},21:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return b}));var o=n(2),r=n(5),i=jQuery;n(8);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=f(e);if(t){var r=f(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,e);var t,n,o,r=s(i);function i(){return c(this,i),r.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&u(t.prototype,n),o&&u(t,o),i}(o.Component),m=p;window.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),o=e.querySelector(".search-course"),r=e.querySelector('.search-course input[type="text"]');if(!r||!n||!o)return;var i=n.querySelectorAll("li.section"),l=n.querySelectorAll("li.course-item"),c=[];l.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");c.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=r.value;o.classList.add("searching"),t||o.classList.remove("searching");var n=[];c.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),l.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),o=[];t.forEach((function(e){n.includes(e.dataset.id)&&o.push(e.dataset.id)})),0===o.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=o.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),r.value="",u(e)})),o.addEventListener("submit",u),r.addEventListener("keyup",u)}}(),Object(r.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),function(){var e=document.querySelector(".lp-lesson-comment-btn");if(e){var t=e.textContent,n=e.dataset.close;window.location.hash.includes("comment")&&e.parentNode.classList.add("open-comments");var o=function(e,o){o.classList.contains("open-comments")?e.textContent=n:e.textContent=t};o(e,e.parentNode),e.addEventListener("click",(function(t){t.preventDefault(),e.parentNode.classList.toggle("open-comments"),o(e,e.parentNode)}))}}(),(new p).checkCourseDurationExpire()}));var y=n(6),v=jQuery,h={init:function(){this.scrollToItemViewing=function(){var e=v(".viewing-course-item");if(e.length){var t=v("#popup-sidebar").outerHeight(),n=v(".section-title").outerHeight(),o=v(".section-header").outerHeight(),r=new RegExp("^viewing-course-item-([0-9].*)"),i=e.attr("class").split(/\s+/),l=0;if(v.each(i,(function(e,t){var n=r.exec(t);if(n)return l=n[1],!1})),0===l)return;var c=v(".course-item-"+l).offset().top-t;void 0===n?c=c-o+20:c-=n,v("#learn-press-course-curriculum").animate({scrollTop:c+7},800)}},this.scrollToItemViewing()}},b=(jQuery,t.default=m,function(){wp.element.render(React.createElement(m,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),y.a.init(),h.init()}))},5:function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.d(t,"a",(function(){return c}));var i=jQuery,l=lodash.throttle,c=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),r(e.target.checked)}));var r=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};r(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){o.toggleClass("c")})),o=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],r=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==r}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,o(new Set(n)))}))})),t.length&&(n.on("scroll",l((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},6:function(e,t,n){"use strict";var o=jQuery,r=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,init:function(){return this.elLPOverlay=o(".lp-overlay"),!!this.elLPOverlay.length&&(r=this.elLPOverlay,this.elMainContent=r.find(".main-content"),this.elTitle=r.find(".modal-title"),this.elBtnYes=r.find(".btn-yes"),this.elBtnNo=r.find(".btn-no"),this.elFooter=r.find(".lp-modal-footer"),o(document).on("click",".close, .btn-no",(function(){r.hide()})),o(document).on("click",".btn-yes",(function(){"function"==typeof i.callBackYes&&i.callBackYes()})),!0)},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},l=i,c=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){l.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}}))})))}});t.a=c},8:function(e,t){function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))}});
1
+ this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=22)}({10:function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},2:function(e,t){e.exports=window.wp.element},22:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return g}));var r=n(2),o=n(7),i=jQuery,c=n(8);n(10);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p(e);if(t){var o=p(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r,o=f(i);function i(){return u(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&a(t.prototype,n),r&&a(t,r),i}(r.Component),y=m;window.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),r=e.querySelector(".search-course"),o=e.querySelector('.search-course input[type="text"]');if(!o||!n||!r)return;var i=n.querySelectorAll("li.section"),c=n.querySelectorAll("li.course-item"),l=[];c.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");l.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=o.value;r.classList.add("searching"),t||r.classList.remove("searching");var n=[];l.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),c.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),r=[];t.forEach((function(e){n.includes(e.dataset.id)&&r.push(e.dataset.id)})),0===r.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=r.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),o.value="",u(e)})),r.addEventListener("submit",u),o.addEventListener("keyup",u)}}(),Object(o.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),function(){var e=document.querySelector(".lp-lesson-comment-btn");if(e){var t=e.textContent,n=e.dataset.close;window.location.hash.includes("comment")&&e.parentNode.classList.add("open-comments");var r=function(e,r){r.classList.contains("open-comments")?e.textContent=n:e.textContent=t};r(e,e.parentNode),e.addEventListener("click",(function(t){t.preventDefault(),e.parentNode.classList.toggle("open-comments"),r(e,e.parentNode)}))}}(),Object(c.b)(),(new m).checkCourseDurationExpire()}));var v=n(4),h=jQuery,b={init:function(){this.scrollToItemViewing=function(){var e=h(".viewing-course-item");if(e.length){var t=h("#popup-sidebar").outerHeight(),n=h(".section-title").outerHeight(),r=h(".section-header").outerHeight(),o=new RegExp("^viewing-course-item-([0-9].*)"),i=e.attr("class").split(/\s+/),c=0;if(h.each(i,(function(e,t){var n=o.exec(t);if(n)return c=n[1],!1})),0===c)return;var l=h(".course-item-"+c).offset().top-t;void 0===n?l=l-r+20:l-=n,h("#learn-press-course-curriculum").animate({scrollTop:l+300},800)}},this.scrollToItemViewing()}},g=(jQuery,t.default=y,function(){wp.element.render(React.createElement(y,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),v.a.init(),b.init()}))},4:function(e,t,n){"use strict";var r=jQuery,o=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,instance:null,init:function(){return!!this.instance||(this.elLPOverlay=r(".lp-overlay"),!!this.elLPOverlay.length&&(o=this.elLPOverlay,this.elMainContent=o.find(".main-content"),this.elTitle=o.find(".modal-title"),this.elBtnYes=o.find(".btn-yes"),this.elBtnNo=o.find(".btn-no"),this.elFooter=o.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){o.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof i.callBackYes&&i.callBackYes()})),this.instance=this,!0))},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},c=i,l=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){c.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");c.elLPOverlay.show(),c.setTitleModal(t.dataset.title),c.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),c.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");c.elLPOverlay.show(),c.setTitleModal(t.dataset.title),c.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),c.callBackYes=function(){t.submit()}}))})))}});t.a=l},5:function(e,t){e.exports=window.wp.url},7:function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return l}));var i=jQuery,c=lodash.throttle,l=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),o(e.target.checked)}));var o=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};o(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){r.toggleClass("c")})),r=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],o=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==o}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,r(new Set(n)))}))})),t.length&&(n.on("scroll",c((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},8:function(e,t,n){"use strict";n.d(t,"b",(function(){return u})),n.d(t,"a",(function(){return a}));var r=n(5),o=n(4);function i(e,t,n,r,o,i,c){try{var l=e[i](c),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).then(r,o)}function c(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=function(){var e=document.querySelectorAll(".popup-header__inner");if(e.length&&null===document.querySelector("#learn-press-quiz-app div.quiz-result")&&"IntersectionObserver"in window){var t=new IntersectionObserver((function(e,n){e.forEach((function(e){if(e.isIntersecting){var n=e.target;a(n),t.unobserve(n)}}))}));c(e).map((function(e){return t.observe(e)}))}},a=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wp.apiFetch({path:Object(r.addQueryArgs)("lp/v1/lazy-load/items-progress",{courseId:lpGlobalSettings.post_id||"",userId:lpGlobalSettings.user_id||""}),method:"GET"});case 2:n=e.sent,i=n.data,t.innerHTML+=i,o.a.init();case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function l(e){i(c,r,o,l,u,"next",e)}function u(e){i(c,r,o,l,u,"throw",e)}l(void 0)}))});return function(e){return t.apply(this,arguments)}}()}});
assets/js/dist/js/data-controls.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.dataControls=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=12)}({12:function(r,t,e){"use strict";e.r(t),e.d(t,"apiFetch",(function(){return c})),e.d(t,"select",(function(){return f})),e.d(t,"dispatch",(function(){return s})),e.d(t,"controls",(function(){return l}));var n=e(9),o=e.n(n);function u(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return i(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(r,t)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var a=function(r){return r.isRegistryControl=!0,r},c=function(r){return{type:"API_FETCH",request:r}};function f(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"SELECT",storeKey:r,selectorName:t,args:n}}function s(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"DISPATCH",storeKey:r,actionName:t,args:n}}var l={API_FETCH:function(r){var t=r.request;return o()(t)},SELECT:a((function(r){return function(t){var e,n=t.storeKey,o=t.selectorName,i=t.args;return r.select(n)[o].hasResolver?function(r,t){var e=t.storeKey,n=t.selectorName,o=t.args;return new Promise((function(t){var u=function(){return r.select("").hasFinishedResolution(e,n,o)},i=function(){return r.select(e)[n].apply(null,o)},a=i();if(u())return t(a);var c=r.subscribe((function(){u()&&(c(),t(i()))}))}))}(r,{storeKey:n,selectorName:o,args:i}):(e=r.select(n))[o].apply(e,u(i))}})),DISPATCH:a((function(r){return function(t){var e,n=t.storeKey,o=t.actionName,i=t.args;return(e=r.dispatch(n))[o].apply(e,u(i))}}))}},9:function(r,t){r.exports=window.wp.apiFetch}});
1
+ this.LP=this.LP||{},this.LP.dataControls=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=13)}({11:function(r,t){r.exports=window.wp.apiFetch},13:function(r,t,e){"use strict";e.r(t),e.d(t,"apiFetch",(function(){return c})),e.d(t,"select",(function(){return f})),e.d(t,"dispatch",(function(){return s})),e.d(t,"controls",(function(){return l}));var n=e(11),o=e.n(n);function u(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return i(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(r,t)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}var a=function(r){return r.isRegistryControl=!0,r},c=function(r){return{type:"API_FETCH",request:r}};function f(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"SELECT",storeKey:r,selectorName:t,args:n}}function s(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return{type:"DISPATCH",storeKey:r,actionName:t,args:n}}var l={API_FETCH:function(r){var t=r.request;return o()(t)},SELECT:a((function(r){return function(t){var e,n=t.storeKey,o=t.selectorName,i=t.args;return r.select(n)[o].hasResolver?function(r,t){var e=t.storeKey,n=t.selectorName,o=t.args;return new Promise((function(t){var u=function(){return r.select("").hasFinishedResolution(e,n,o)},i=function(){return r.select(e)[n].apply(null,o)},a=i();if(u())return t(a);var c=r.subscribe((function(){u()&&(c(),t(i()))}))}))}(r,{storeKey:n,selectorName:o,args:i}):(e=r.select(n))[o].apply(e,u(i))}})),DISPATCH:a((function(r){return function(t){var e,n=t.storeKey,o=t.actionName,i=t.args;return(e=r.dispatch(n))[o].apply(e,u(i))}}))}}});
assets/src/apps/js/admin/pages/statistic.js CHANGED
@@ -5,7 +5,11 @@
5
  $canvas = $( '<canvas />' );
6
  $elem.html( '' );
7
  $canvas.appendTo( $elem );
8
- new Chart( $canvas.get( 0 ).getContext( '2d' ) ).Line( data, config );
 
 
 
 
9
  } );
10
  //
11
  };
5