LearnPress – WordPress LMS Plugin - Version 4.0.5

Version Description

~ Fixed: error "Duplicate entry" for case upgrade LP4, if user install LP4 and save setting before Upgrade Database ~ Fixed: get option 'avatar_dimensions' set default value if user not set ~ Fixed: get option 'course_thumbnail_dimensions' set default value if user not set ~ Modify template Profile ~ Fixed: tool "Reset course progress" ~ Fixed: get options "Courses per page"

Download this release

Release Info

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

Code changes from version 4.0.3 to 4.0.5

assets/css/learnpress.css CHANGED
@@ -1573,73 +1573,15 @@
1573
  width: 100%;
1574
  }
1575
 
1576
- #learn-press-profile {
1577
- background: #fff;
1578
- }
1579
-
1580
- #learn-press-profile .wrapper-profile-header {
1581
- color: #fff;
1582
- background: var(--lp-secondary-color);
1583
  }
1584
 
1585
- #learn-press-profile .wrapper-profile-header #profile-header .lp-profile-header__inner {
1586
- width: 90%;
1587
- min-height: 252px;
1588
- margin: 0 auto;
1589
- padding: 82px 200px 30px 240px;
1590
- }
1591
-
1592
- #learn-press-profile .wrapper-profile-header #profile-header .lp-profile-header__inner .lp-profile-username {
1593
- padding-bottom: 18px;
1594
- font-size: 18px;
1595
- font-weight: 500;
1596
- text-transform: capitalize;
1597
- }
1598
-
1599
- #learn-press-profile .wrapper-profile-header #profile-header .lp-profile-header__inner .lp-profile-user-bio {
1600
- font-size: 16px;
1601
- font-weight: 300;
1602
- line-height: 26px;
1603
- }
1604
-
1605
- @media (max-width: 990px) {
1606
- #learn-press-profile .wrapper-profile-header #profile-header .lp-profile-header__inner {
1607
- width: 100%;
1608
- padding: 65px 0 30px 0;
1609
- text-align: center;
1610
- }
1611
- }
1612
-
1613
- @media (max-width: 767px) {
1614
- #learn-press-profile .wrapper-profile-header #profile-header .lp-profile-header__inner {
1615
- padding: 30px 0;
1616
- }
1617
- }
1618
-
1619
- #learn-press-profile #profile-sidebar {
1620
- float: left;
1621
- width: 270px;
1622
- margin-top: -212px;
1623
- border-radius: 4px;
1624
  background: #fff;
1625
- box-shadow: 0 15px 20px 0 rgba(0, 0, 0, 0.1);
1626
- }
1627
-
1628
- @media (max-width: 990px) {
1629
- #learn-press-profile #profile-sidebar {
1630
- width: 50%;
1631
- margin-top: 58px;
1632
- }
1633
- }
1634
-
1635
- @media (max-width: 767px) {
1636
- #learn-press-profile #profile-sidebar {
1637
- width: 100%;
1638
- }
1639
- }
1640
-
1641
- #learn-press-profile .lp-user-profile-avatar {
1642
- margin: 25px;
1643
  }
1644
 
1645
  #learn-press-profile .lp-user-profile-avatar img {
@@ -1653,8 +1595,7 @@
1653
  display: flex;
1654
  position: relative;
1655
  z-index: 1;
1656
- margin: -47px 26px 0 26px;
1657
- padding-bottom: 30px;
1658
  justify-content: center;
1659
  -webkit-flex-wrap: wrap;
1660
  -ms-flex-wrap: wrap;
@@ -1683,6 +1624,113 @@
1683
  background: var(--lp-primary-color);
1684
  }
1685
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1686
  #learn-press-profile #profile-nav .lp-profile-nav-tabs {
1687
  margin: 0;
1688
  padding: 0;
@@ -1821,6 +1869,81 @@
1821
  color: #ffb606;
1822
  }
1823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1824
  #learn-press-profile #profile-content {
1825
  float: right;
1826
  width: calc(100% - 300px);
@@ -1836,11 +1959,22 @@
1836
 
1837
  @media (max-width: 767px) {
1838
  #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav {
1839
- display: grid;
 
1840
  border: 0;
1841
  }
 
 
 
 
 
1842
  #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav .learn-press-tabs__tab {
1843
  border-right: 0;
 
 
 
 
 
1844
  }
1845
  }
1846
 
@@ -8238,59 +8372,16 @@ body.admin-bar #popup-course {
8238
  margin: 0 10px 0 10px;
8239
  }
8240
 
8241
- #popup-content #learn-press-item-comments {
8242
- visibility: hidden;
8243
- overflow: auto;
8244
- position: absolute;
8245
- z-index: 99;
8246
- top: 0;
8247
- right: 0;
8248
- left: 0;
8249
- opacity: 0;
8250
- background: #fff;
8251
- transition: all 0.3s ease;
8252
- pointer-events: none;
8253
- }
8254
-
8255
- #popup-content #learn-press-item-comments .learn-press-comments {
8256
- width: 800px;
8257
- max-width: 90%;
8258
- margin: 20px auto;
8259
- padding: 50px;
8260
- }
8261
-
8262
- #popup-content.open-comments #learn-press-content-item {
8263
- display: none;
8264
- }
8265
-
8266
- #popup-content.open-comments #learn-press-item-comments {
8267
- visibility: visible;
8268
- opacity: 1;
8269
- pointer-events: visible;
8270
- }
8271
-
8272
- body.learnpress #popup-content > a.lp-lesson-comment-btn {
8273
- position: fixed;
8274
- z-index: 100;
8275
- right: 40px;
8276
- bottom: 60px;
8277
- height: 42px;
8278
- margin: 0;
8279
- padding: 0 18px;
8280
- border-radius: 4px;
8281
- color: #fff;
8282
- background-color: var(--lp-primary-color);
8283
- box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.16);
8284
- font-size: 15px;
8285
- font-weight: 400;
8286
- line-height: 42px;
8287
- cursor: pointer;
8288
  }
8289
 
8290
- body.learnpress #popup-content > a.lp-lesson-comment-btn:focus {
8291
- outline: none;
8292
- background-color: var(--lp-primary-color);
8293
- text-decoration: none;
8294
  }
8295
 
8296
  .learn-press-progress {
1573
  width: 100%;
1574
  }
1575
 
1576
+ body div.entry-content > div.learnpress {
1577
+ --responsive--aligndefault-width: 100%;
1578
+ max-width: var(--lp-content-width, 100%);
 
 
 
 
1579
  }
1580
 
1581
+ #learn-press-profile {
1582
+ overflow: hidden;
1583
+ position: relative;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  background: #fff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1585
  }
1586
 
1587
  #learn-press-profile .lp-user-profile-avatar img {
1595
  display: flex;
1596
  position: relative;
1597
  z-index: 1;
1598
+ margin-top: -17px;
 
1599
  justify-content: center;
1600
  -webkit-flex-wrap: wrap;
1601
  -ms-flex-wrap: wrap;
1624
  background: var(--lp-primary-color);
1625
  }
1626
 
1627
+ #learn-press-profile .wrapper-profile-header {
1628
+ color: #fff;
1629
+ background: var(--lp-secondary-color);
1630
+ }
1631
+
1632
+ #learn-press-profile .wrapper-profile-header .lp-profile-content-area {
1633
+ position: relative;
1634
+ min-height: 345px;
1635
+ padding-top: 50px;
1636
+ }
1637
+
1638
+ #learn-press-profile .wrapper-profile-header .lp-profile-left {
1639
+ width: 270px;
1640
+ position: absolute;
1641
+ bottom: 0;
1642
+ left: 0;
1643
+ padding: 20px;
1644
+ background: #fff;
1645
+ border: 1px solid rgba(0, 0, 0, 0.1);
1646
+ border-bottom: 0;
1647
+ }
1648
+
1649
+ #learn-press-profile .wrapper-profile-header .lp-profile-right {
1650
+ margin-left: 270px;
1651
+ padding-left: 35px;
1652
+ padding-right: 15px;
1653
+ }
1654
+
1655
+ #learn-press-profile .wrapper-profile-header .lp-profile-right .lp-profile-username {
1656
+ padding-bottom: 18px;
1657
+ font-size: 18px;
1658
+ font-weight: 500;
1659
+ text-transform: capitalize;
1660
+ }
1661
+
1662
+ #learn-press-profile .wrapper-profile-header .lp-profile-right .lp-profile-user-bio {
1663
+ font-size: 16px;
1664
+ font-weight: 300;
1665
+ line-height: 26px;
1666
+ }
1667
+
1668
+ @media (max-width: 990px) {
1669
+ #learn-press-profile .wrapper-profile-header .lp-profile-content-area {
1670
+ min-height: inherit;
1671
+ padding: 20px 15px;
1672
+ }
1673
+ #learn-press-profile .wrapper-profile-header .lp-profile-left {
1674
+ position: static;
1675
+ float: left;
1676
+ }
1677
+ #learn-press-profile .wrapper-profile-header .lp-profile-right {
1678
+ width: calc(100% - 270px);
1679
+ float: right;
1680
+ margin-left: 0;
1681
+ }
1682
+ }
1683
+
1684
+ @media (max-width: 768px) {
1685
+ #learn-press-profile .wrapper-profile-header .lp-profile-left {
1686
+ width: 220px;
1687
+ }
1688
+ #learn-press-profile .wrapper-profile-header .lp-profile-right {
1689
+ width: calc(100% - 220px);
1690
+ }
1691
+ #learn-press-profile .wrapper-profile-header .lp-user-profile-socials {
1692
+ margin-left: -5px;
1693
+ margin-right: -5px;
1694
+ }
1695
+ #learn-press-profile .wrapper-profile-header .lp-user-profile-socials a {
1696
+ width: 36px;
1697
+ height: 36px;
1698
+ margin: 0 5px;
1699
+ line-height: 36px;
1700
+ }
1701
+ }
1702
+
1703
+ @media (max-width: 500px) {
1704
+ #learn-press-profile .wrapper-profile-header .lp-profile-left {
1705
+ float: none;
1706
+ margin: 0 auto;
1707
+ }
1708
+ #learn-press-profile .wrapper-profile-header .lp-profile-right {
1709
+ width: 100%;
1710
+ text-align: center;
1711
+ padding-top: 30px;
1712
+ }
1713
+ }
1714
+
1715
+ #learn-press-profile #profile-sidebar {
1716
+ float: left;
1717
+ width: 270px;
1718
+ margin-top: 0;
1719
+ border: 1px solid rgba(0, 0, 0, 0.1);
1720
+ border-top: 0;
1721
+ background: #fff;
1722
+ }
1723
+
1724
+ @media (max-width: 990px) {
1725
+ #learn-press-profile #profile-sidebar {
1726
+ width: 100%;
1727
+ margin-top: 58px;
1728
+ }
1729
+ #learn-press-profile #profile-sidebar .lp-user-profile-avatar {
1730
+ max-width: 150px;
1731
+ }
1732
+ }
1733
+
1734
  #learn-press-profile #profile-nav .lp-profile-nav-tabs {
1735
  margin: 0;
1736
  padding: 0;
1869
  color: #ffb606;
1870
  }
1871
 
1872
+ @media (max-width: 990px) {
1873
+ #learn-press-profile #profile-nav {
1874
+ overflow-x: scroll;
1875
+ border-top: 1px solid rgba(204, 204, 204, 0.3);
1876
+ }
1877
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs {
1878
+ width: max-content;
1879
+ }
1880
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs:after {
1881
+ display: table;
1882
+ content: "";
1883
+ clear: both;
1884
+ }
1885
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li {
1886
+ border: none;
1887
+ border-right: 1px solid rgba(204, 204, 204, 0.3);
1888
+ float: left;
1889
+ }
1890
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li > a {
1891
+ height: auto;
1892
+ padding: 0 20px 0 45px;
1893
+ }
1894
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li > a:after {
1895
+ margin-left: 10px;
1896
+ }
1897
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.has-child a:after {
1898
+ content: "\f077";
1899
+ }
1900
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active a {
1901
+ padding-left: 45px;
1902
+ }
1903
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active a:after {
1904
+ content: "\f078";
1905
+ }
1906
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active.has-child ul {
1907
+ display: none;
1908
+ width: max-content;
1909
+ transform: translateX(-20%);
1910
+ }
1911
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active.has-child ul:after {
1912
+ display: table;
1913
+ content: "";
1914
+ clear: both;
1915
+ box-shadow: 0 0 0;
1916
+ }
1917
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active.has-child ul li {
1918
+ float: left;
1919
+ border-right: 1px solid rgba(204, 204, 204, 0.3);
1920
+ }
1921
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active.has-child ul li:last-child {
1922
+ border-right: none;
1923
+ }
1924
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li.active.has-child ul li a {
1925
+ padding: 0 10px;
1926
+ }
1927
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs li:hover ul {
1928
+ display: none !important;
1929
+ }
1930
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs li:not(.has-child) > a:after {
1931
+ display: none;
1932
+ }
1933
+ }
1934
+
1935
+ @media (max-width: 560px) {
1936
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li {
1937
+ max-width: 80px;
1938
+ }
1939
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li > a {
1940
+ font-size: 0;
1941
+ }
1942
+ #learn-press-profile #profile-nav .lp-profile-nav-tabs > li > a:after {
1943
+ margin-left: 0;
1944
+ }
1945
+ }
1946
+
1947
  #learn-press-profile #profile-content {
1948
  float: right;
1949
  width: calc(100% - 300px);
1959
 
1960
  @media (max-width: 767px) {
1961
  #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav {
1962
+ display: block;
1963
+ width: 100%;
1964
  border: 0;
1965
  }
1966
+ #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav:after {
1967
+ content: "";
1968
+ clear: both;
1969
+ display: table;
1970
+ }
1971
  #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav .learn-press-tabs__tab {
1972
  border-right: 0;
1973
+ float: left;
1974
+ }
1975
+ #learn-press-profile #profile-content .learn-press-tabs .learn-press-tabs__nav .learn-press-tabs__tab label {
1976
+ padding-right: 25px;
1977
+ padding-left: 25px;
1978
  }
1979
  }
1980
 
8372
  margin: 0 10px 0 10px;
8373
  }
8374
 
8375
+ .learn-press-comments {
8376
+ width: 792px;
8377
+ max-width: 100%;
8378
+ margin: 0 auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8379
  }
8380
 
8381
+ @media (max-width: 1024px) {
8382
+ .learn-press-comments {
8383
+ width: 100%;
8384
+ }
8385
  }
8386
 
8387
  .learn-press-progress {
assets/js/dist/admin/editor/course.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=11)}({0:function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},1:function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},11:function(t,e,n){"use strict";n.r(e);var i=n(0),o={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},types:function(t){return t.types},section:function(t){return t.sectionId}},s={TOGGLE:function(t){t.open=!t.open},SET_SECTION:function(t,e){t.sectionId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEMS_REQUEST:function(t){t.status="loading"},SEARCH_ITEMS_SUCCESS:function(t){t.status="successful"},SEARCH_ITEMS_FAILURE:function(t){t.status="failed"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_SECTION",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEMS_REQUEST"),LP.Request({type:"search-items",query:e.query,item_type:e.type,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEMS_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAILURE"),console.error(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addItemsToSection:function(t){var e=t.getters.addedItems;e.length>0&&LP.Request({type:"add-items-to-section",section_id:t.getters.section,items:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){t.commit("TOGGLE");var i=n.data;t.commit("ss/UPDATE_SECTION_ITEMS",{section_id:t.getters.section,items:i},{root:!0})}}),(function(t){console.error(t)}))}},u=window.jQuery||jQuery,r=function(t){var e=u.extend({},t.chooseItems);return e.sectionId=!1,e.pagination="",e.status="",{namespaced:!0,state:e,getters:o,mutations:s,actions:c}},d=window.jQuery||jQuery,a={toggleAllSections:function(t){t.getters.isHiddenAllSections?t.commit("OPEN_ALL_SECTIONS"):t.commit("CLOSE_ALL_SECTIONS"),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSectionsOrder:function(t,e){LP.Request({type:"sort-sections",order:JSON.stringify(e)}).then((function(e){var n=e.body.data;t.commit("SORT_SECTION",n)}),(function(t){console.error(t)}))},toggleSection:function(t,e){e.open?t.commit("CLOSE_SECTION",e):t.commit("OPEN_SECTION",e),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSection:function(t,e){t.commit("UPDATE_SECTION_REQUEST",e.id),LP.Request({type:"update-section",section:JSON.stringify(e)}).then((function(){t.commit("UPDATE_SECTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_SECTION_FAILURE",e.id)}))},removeSection:function(t,e){t.commit("REMOVE_SECTION",e.index),LP.Request({type:"remove-section",section_id:e.section.id}).then((function(t){t.body}),(function(t){console.error(t)}))},newSection:function(t,e){var n={type:"new-section",section_name:e,temp_id:LP.uniqueId()};t.commit("ADD_NEW_SECTION",{id:n.temp_id,items:[],open:!1,title:n.section_name}),LP.Request(n).then((function(e){var n=e.body;if(n.success){var i=d.extend({},n.data,{open:!0});t.commit("ADD_NEW_SECTION",i)}}),(function(t){console.error(t)}))},updateSectionItem:function(t,e){t.commit("UPDATE_SECTION_ITEM_REQUEST",e.item.id),LP.Request({type:"update-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){t.commit("UPDATE_SECTION_ITEM_SUCCESS",e.item.id);var i=n.body;if(i.success){var o=i.data;t.commit("UPDATE_SECTION_ITEM",{section_id:e.section_id,item:o})}}),(function(n){t.commit("UPDATE_SECTION_ITEM_FAILURE",e.item.id),console.error(n)}))},removeSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"remove-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},deleteSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"delete-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},newSectionItem:function(t,e){t.commit("APPEND_EMPTY_ITEM_TO_SECTION",e),LP.Request({type:"new-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){var i=n.body;if(i.success){var o={};d.each(i.data,(function(t,e){o[e.old_id?e.old_id:e.id]=e})),t.commit("UPDATE_ITEM_SECTION_BY_ID",{section_id:e.section_id,items:o})}}),(function(t){console.error(t)}))},updateSectionItems:function(t,e){var n=t.state;LP.Request({type:"update-section-items",section_id:e.section_id,items:JSON.stringify(e.items),last_section:n.sections[n.sections.length-1]===e.section_id}).then((function(t){t.body.success}),(function(t){console.error(t)}))}},E={SORT_SECTION:function(t,e){t.sections=t.sections.map((function(t){return t.order=e[t.id],t}))},SET_SECTIONS:function(t,e){t.sections=e},ADD_NEW_SECTION:function(t,e){var n;void 0===e.open&&(e.open=!0),e.temp_id&&t.sections.map((function(t,i){if(e.temp_id==t.id)return n=i,!1})),void 0!==n?$Vue.set(t.sections,n,e):t.sections.push(e)},ADD_EMPTY_SECTION:function(t,e){e.open=!0,t.sections.push(e)},REMOVE_SECTION:function(t,e){t.sections.splice(e,1)},REMOVE_SECTION_ITEM:function(t,e){var n=t.sections.find((function(t){return t.id===e.section_id})).items||[],i=e.item,o=-1;n.forEach((function(t,e){t.id===i.id&&(o=e)})),-1!==o&&(i.temp_id?n[o].id=i.temp_id:n.splice(o,1))},UPDATE_SECTION_ITEMS:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&(n.items=e.items)},UPDATE_SECTION_ITEM:function(t,e){},CLOSE_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!1)}))},OPEN_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!0)}))},OPEN_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!0,t}))},CLOSE_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!1,t}))},UPDATE_SECTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateSection,e,"updating")},UPDATE_SECTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSection,e,"successful")},UPDATE_SECTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateSection,e,"failed")},UPDATE_SECTION_ITEM_REQUEST:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"updating")},UPDATE_SECTION_ITEM_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"successful")},UPDATE_SECTION_ITEM_FAILURE:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"failed")},APPEND_EMPTY_ITEM_TO_SECTION:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&n.items.push({id:e.item.id,title:e.item.title,type:"empty-item"})},UPDATE_ITEM_SECTION_BY_ID:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));if(n)for(var i=0;i<n.items.length;i++)try{if(!n.items[i])continue;var o=n.items[i].id;o&&e.items[o]&&$Vue.set(n.items,i,e.items[o])}catch(t){console.log(t)}}},m={sections:function(t){return t.sections||[]},urlEdit:function(t){return t.urlEdit},hiddenSections:function(t){return t.sections.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenAllSections:function(t,e){var n=e.sections;return e.hiddenSections.length===n.length},statusUpdateSection:function(t){return t.statusUpdateSection},statusUpdateSectionItem:function(t){return t.statusUpdateSectionItem}},f=window.jQuery,_=function(t){var e=f.extend({},t.sections);return e.statusUpdateSection={},e.statusUpdateSectionItem={},e.sections=e.sections.map((function(t){var n=e.hidden_sections.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t})),{namespaced:!0,state:e,getters:m,mutations:E,actions:a}},S=n(1),T={heartbeat:function(t){return t.heartbeat},action:function(t){return t.action},id:function(t){return t.course_id},autoDraft:function(t){return t.auto_draft},disable_curriculum:function(t){return t.disable_curriculum},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},urlAjax:function(t){return t.ajax},nonce:function(t){return t.nonce}},p={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_AUTO_DRAFT_STATUS:function(t,e){t.auto_draft=e},UPDATE_STATUS:function(t,e){t.status=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},I={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},draftCourse:function(t,e){t.getters.autoDraft&&LP.Request({type:"draft-course",course:JSON.stringify(e)}).then((function(e){e.body.success&&t.commit("UPDATE_AUTO_DRAFT_STATUS",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},l=window.jQuery,O=function(t){var e=l.extend({},t.root);return e.status="success",e.heartbeat=!0,e.countCurrentRequest=0,{state:e,getters:T,mutations:p,actions:I,modules:{ci:r(t),i18n:Object(S.a)(t.i18n),ss:_(t)}}};window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,(0,window.jQuery)(document).ready((function(){window.LP_Curriculum_Store=new $Vuex.Store(O(lpAdminCourseEditorSettings)),Object(i.a)({ns:"LPCurriculumRequest",store:LP_Curriculum_Store}),setTimeout((function(){window.LP_Course_Editor=new $Vue({el:"#admin-editor-lp_course",template:"<lp-course-editor></lp-course-editor>"})}),100)}))}});
1
+ !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=10)}({0:function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},1:function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},10:function(t,e,n){"use strict";n.r(e);var i=n(0),o={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},types:function(t){return t.types},section:function(t){return t.sectionId}},s={TOGGLE:function(t){t.open=!t.open},SET_SECTION:function(t,e){t.sectionId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEMS_REQUEST:function(t){t.status="loading"},SEARCH_ITEMS_SUCCESS:function(t){t.status="successful"},SEARCH_ITEMS_FAILURE:function(t){t.status="failed"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_SECTION",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEMS_REQUEST"),LP.Request({type:"search-items",query:e.query,item_type:e.type,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEMS_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAILURE"),console.error(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addItemsToSection:function(t){var e=t.getters.addedItems;e.length>0&&LP.Request({type:"add-items-to-section",section_id:t.getters.section,items:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){t.commit("TOGGLE");var i=n.data;t.commit("ss/UPDATE_SECTION_ITEMS",{section_id:t.getters.section,items:i},{root:!0})}}),(function(t){console.error(t)}))}},u=window.jQuery||jQuery,r=function(t){var e=u.extend({},t.chooseItems);return e.sectionId=!1,e.pagination="",e.status="",{namespaced:!0,state:e,getters:o,mutations:s,actions:c}},d=window.jQuery||jQuery,a={toggleAllSections:function(t){t.getters.isHiddenAllSections?t.commit("OPEN_ALL_SECTIONS"):t.commit("CLOSE_ALL_SECTIONS"),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSectionsOrder:function(t,e){LP.Request({type:"sort-sections",order:JSON.stringify(e)}).then((function(e){var n=e.body.data;t.commit("SORT_SECTION",n)}),(function(t){console.error(t)}))},toggleSection:function(t,e){e.open?t.commit("CLOSE_SECTION",e):t.commit("OPEN_SECTION",e),LP.Request({type:"hidden-sections",hidden:t.getters.hiddenSections})},updateSection:function(t,e){t.commit("UPDATE_SECTION_REQUEST",e.id),LP.Request({type:"update-section",section:JSON.stringify(e)}).then((function(){t.commit("UPDATE_SECTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_SECTION_FAILURE",e.id)}))},removeSection:function(t,e){t.commit("REMOVE_SECTION",e.index),LP.Request({type:"remove-section",section_id:e.section.id}).then((function(t){t.body}),(function(t){console.error(t)}))},newSection:function(t,e){var n={type:"new-section",section_name:e,temp_id:LP.uniqueId()};t.commit("ADD_NEW_SECTION",{id:n.temp_id,items:[],open:!1,title:n.section_name}),LP.Request(n).then((function(e){var n=e.body;if(n.success){var i=d.extend({},n.data,{open:!0});t.commit("ADD_NEW_SECTION",i)}}),(function(t){console.error(t)}))},updateSectionItem:function(t,e){t.commit("UPDATE_SECTION_ITEM_REQUEST",e.item.id),LP.Request({type:"update-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){t.commit("UPDATE_SECTION_ITEM_SUCCESS",e.item.id);var i=n.body;if(i.success){var o=i.data;t.commit("UPDATE_SECTION_ITEM",{section_id:e.section_id,item:o})}}),(function(n){t.commit("UPDATE_SECTION_ITEM_FAILURE",e.item.id),console.error(n)}))},removeSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"remove-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},deleteSectionItem:function(t,e){var n=e.item.id;t.commit("REMOVE_SECTION_ITEM",e),e.item.temp_id=0,LP.Request({type:"delete-section-item",section_id:e.section_id,item_id:n}).then((function(){t.commit("REMOVE_SECTION_ITEM",e)}))},newSectionItem:function(t,e){t.commit("APPEND_EMPTY_ITEM_TO_SECTION",e),LP.Request({type:"new-section-item",section_id:e.section_id,item:JSON.stringify(e.item)}).then((function(n){var i=n.body;if(i.success){var o={};d.each(i.data,(function(t,e){o[e.old_id?e.old_id:e.id]=e})),t.commit("UPDATE_ITEM_SECTION_BY_ID",{section_id:e.section_id,items:o})}}),(function(t){console.error(t)}))},updateSectionItems:function(t,e){var n=t.state;LP.Request({type:"update-section-items",section_id:e.section_id,items:JSON.stringify(e.items),last_section:n.sections[n.sections.length-1]===e.section_id}).then((function(t){t.body.success}),(function(t){console.error(t)}))}},E={SORT_SECTION:function(t,e){t.sections=t.sections.map((function(t){return t.order=e[t.id],t}))},SET_SECTIONS:function(t,e){t.sections=e},ADD_NEW_SECTION:function(t,e){var n;void 0===e.open&&(e.open=!0),e.temp_id&&t.sections.map((function(t,i){if(e.temp_id==t.id)return n=i,!1})),void 0!==n?$Vue.set(t.sections,n,e):t.sections.push(e)},ADD_EMPTY_SECTION:function(t,e){e.open=!0,t.sections.push(e)},REMOVE_SECTION:function(t,e){t.sections.splice(e,1)},REMOVE_SECTION_ITEM:function(t,e){var n=t.sections.find((function(t){return t.id===e.section_id})).items||[],i=e.item,o=-1;n.forEach((function(t,e){t.id===i.id&&(o=e)})),-1!==o&&(i.temp_id?n[o].id=i.temp_id:n.splice(o,1))},UPDATE_SECTION_ITEMS:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&(n.items=e.items)},UPDATE_SECTION_ITEM:function(t,e){},CLOSE_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!1)}))},OPEN_SECTION:function(t,e){t.sections.forEach((function(n,i){e.id===n.id&&(t.sections[i].open=!0)}))},OPEN_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!0,t}))},CLOSE_ALL_SECTIONS:function(t){t.sections=t.sections.map((function(t){return t.open=!1,t}))},UPDATE_SECTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateSection,e,"updating")},UPDATE_SECTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSection,e,"successful")},UPDATE_SECTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateSection,e,"failed")},UPDATE_SECTION_ITEM_REQUEST:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"updating")},UPDATE_SECTION_ITEM_SUCCESS:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"successful")},UPDATE_SECTION_ITEM_FAILURE:function(t,e){$Vue.set(t.statusUpdateSectionItem,e,"failed")},APPEND_EMPTY_ITEM_TO_SECTION:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));n&&n.items.push({id:e.item.id,title:e.item.title,type:"empty-item"})},UPDATE_ITEM_SECTION_BY_ID:function(t,e){var n=t.sections.find((function(t){return parseInt(t.id)===parseInt(e.section_id)}));if(n)for(var i=0;i<n.items.length;i++)try{if(!n.items[i])continue;var o=n.items[i].id;o&&e.items[o]&&$Vue.set(n.items,i,e.items[o])}catch(t){console.log(t)}}},m={sections:function(t){return t.sections||[]},urlEdit:function(t){return t.urlEdit},hiddenSections:function(t){return t.sections.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenAllSections:function(t,e){var n=e.sections;return e.hiddenSections.length===n.length},statusUpdateSection:function(t){return t.statusUpdateSection},statusUpdateSectionItem:function(t){return t.statusUpdateSectionItem}},f=window.jQuery,_=function(t){var e=f.extend({},t.sections);return e.statusUpdateSection={},e.statusUpdateSectionItem={},e.sections=e.sections.map((function(t){var n=e.hidden_sections.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t})),{namespaced:!0,state:e,getters:m,mutations:E,actions:a}},S=n(1),T={heartbeat:function(t){return t.heartbeat},action:function(t){return t.action},id:function(t){return t.course_id},autoDraft:function(t){return t.auto_draft},disable_curriculum:function(t){return t.disable_curriculum},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},urlAjax:function(t){return t.ajax},nonce:function(t){return t.nonce}},p={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_AUTO_DRAFT_STATUS:function(t,e){t.auto_draft=e},UPDATE_STATUS:function(t,e){t.status=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},I={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},draftCourse:function(t,e){t.getters.autoDraft&&LP.Request({type:"draft-course",course:JSON.stringify(e)}).then((function(e){e.body.success&&t.commit("UPDATE_AUTO_DRAFT_STATUS",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},l=window.jQuery,O=function(t){var e=l.extend({},t.root);return e.status="success",e.heartbeat=!0,e.countCurrentRequest=0,{state:e,getters:T,mutations:p,actions:I,modules:{ci:r(t),i18n:Object(S.a)(t.i18n),ss:_(t)}}};window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,(0,window.jQuery)(document).ready((function(){window.LP_Curriculum_Store=new $Vuex.Store(O(lpAdminCourseEditorSettings)),Object(i.a)({ns:"LPCurriculumRequest",store:LP_Curriculum_Store}),setTimeout((function(){window.LP_Course_Editor=new $Vue({el:"#admin-editor-lp_course",template:"<lp-course-editor></lp-course-editor>"})}),100)}))}});
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=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")}))}))}))}});
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")}))}))}))}});
assets/js/dist/admin/editor/quiz.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=12)}({0:function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},1:function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},12:function(t,e,n){"use strict";n.r(e);var i={heartbeat:function(t){return t.heartbeat},questionTypes:function(t){return t.types},defaultNewQuestionType:function(t){return t.default_new},action:function(t){return t.action},id:function(t){return t.quiz_id},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},nonce:function(t){return t.nonce}},o={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_STATUS:function(t,e){t.status=e},UPDATE_NEW_QUESTION_TYPE:function(t,e){t.default_new=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},s={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},u={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},code:function(t){return Date.now()},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},quiz:function(t){return t.quizId}},r={TOGGLE:function(t){t.open=!t.open},SET_QUIZ:function(t,e){t.quizId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEM_REQUEST:function(t){t.status="loading"},SEARCH_ITEM_SUCCESS:function(t){t.status="successful"},SEARCH_ITEM_FAIL:function(t){t.status="fail"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_QUIZ",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEM_REQUEST"),LP.Request({type:"search-items",query:e.query,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEM_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAIL"),console.log(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addQuestionsToQuiz:function(t,e){var n=t.getters.addedItems;n.length>0&&LP.Request({type:"add-questions-to-quiz",items:JSON.stringify(n),draft_quiz:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("lqs/SET_QUESTIONS",i,{root:!0}),t.commit("TOGGLE")}}),(function(t){console.log(t)}))}},d=window.jQuery||jQuery,a=function(t){return{namespaced:!0,state:d.extend({quizId:!1,pagination:"",status:""},t.chooseItems),getters:u,mutations:r,actions:c}},E=n(1),_={listQuestions:function(t){return t.questions||[]},questionsOrder:function(t){return t.order||[]},externalComponent:function(t){return t.externalComponent||[]},supportAnswerOptions:function(t){return t.supportAnswerOptions||[]},hiddenQuestionsSettings:function(t){return t.hidden_questions_settings||[]},hiddenQuestions:function(t){return t.questions.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenListQuestions:function(t,e){var n=e.listQuestions,i=e.hiddenQuestions;return n.length===i.length},disableUpdateList:function(t){return t.disableUpdateList},statusUpdateQuestions:function(t){return t.statusUpdateQuestions},statusUpdateQuestionItem:function(t){return t.statusUpdateQuestionItem},statusUpdateQuestionAnswer:function(t){return t.statusUpdateQuestionAnswer}},f=window.jQuery,m={SORT_QUESTIONS:function(t,e){t.questions=t.questions.map((function(t){return t.order=e[t.id],t}))},SORT_QUESTION_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return t.answers.answer_order=e[t.answers.question_answer_id],t}))},ADD_QUESTION_ANSWER:function(t,e){t.questions=t.questions.map((function(t){if(t.id===e.question_id){var n=!1;if(e.answer.temp_id)for(var i=0,o=t.answers.length;i<o;i++)t.answers[i].question_answer_id==e.answer.temp_id&&(n=!0,$Vue.set(t.answers,i,e.answer));return!n&&t.answers.push(e.answer),t}return t}))},CHANGE_QUESTION_CORRECT_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers),t}))},SET_QUESTIONS:function(t,e){t.questions=e},ADD_NEW_QUESTION:function(t,e){var n=!1;if(e.temp_id)for(var i=0,o=t.questions.length;i<o;i++)if(t.questions[i].id===e.temp_id){$Vue.set(t.questions,i,e),n=!0;break}if(!n){var s=f(".lp-list-questions .main > div:last-child");if(s.length){var u=s.offset().top;f("html,body").animate({scrollTop:u})}t.questions.push(e)}},CHANGE_QUESTION_TYPE:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers,t.type=e.type,t.open=!0),t}))},REMOVE_QUESTION:function(t,e){var n=t.questions.indexOf(e);e.temp_id?t.questions[n].id=e.temp_id:t.questions.splice(n,1)},DELETE_QUESTION_ANSWER:function(t,e){var n=e.question_id,i=e.answer_id;t.questions=t.questions.map((function(t){if(t.id===n){var e=t.answers;e.forEach((function(t){if(t.question_answer_id===i){var n=e.indexOf(t);e.splice(n,1)}}))}return t}))},REMOVE_QUESTIONS:function(){},CLOSE_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!1)}))},OPEN_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!0)}))},CLOSE_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!1,t}))},OPEN_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!0,t}))},UPDATE_QUESTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"updating")},UPDATE_QUESTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"successful")},UPDATE_QUESTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"failed")},UPDATE_QUESTION_ANSWER_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"updating")},UPDATE_QUESTION_ANSWER_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"successful")},UPDATE_QUESTION_ANSWER_FAIL:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"failed")},DELETE_ANSWER:function(t,e){t.questions.map((function(t,n){if(t.id==e.question_id){for(var i=0,o=t.answers.length;i<o;i++)if(t.answers[i].question_answer_id==e.answer_id){t.answers[i].question_answer_id=e.temp_id;break}return!1}}))}},S=window.jQuery,T={toggleAll:function(t){t.getters.isHiddenListQuestions?t.commit("OPEN_LIST_QUESTIONS"):t.commit("CLOSE_LIST_QUESTIONS"),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuizQuestionsHidden:function(t,e){LP.Request(S.extend({},e,{type:"update-quiz-questions-hidden"}))},newQuestion:function(t,e){var n=JSON.parse(JSON.stringify(e.question));n.settings={},t.commit("ADD_NEW_QUESTION",n),LP.Request({type:"new-question",question:JSON.stringify(e.question),draft_quiz:JSON.stringify(e.quiz)}).then((function(n){var i=n.body;i.success&&(t.commit("UPDATE_NEW_QUESTION_TYPE",e.question.type,{root:!0}),t.commit("ADD_NEW_QUESTION",i.data),t.commit("CLOSE_LIST_QUESTIONS"),t.commit("OPEN_QUESTION",i.data))}),(function(t){console.log(t)}))},updateQuestionsOrder:function(t,e){LP.Request({type:"sort-questions",order:JSON.stringify(e)}).then((function(n){t.commit("SORT_QUESTIONS",e)}),(function(t){console.log(t)}))},updateQuestionTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-title",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},changeQuestionType:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-type",question_id:e.question_id,question_type:e.type}).then((function(n){var i=n.body;if(i.success){var o=i.data;t.commit("CHANGE_QUESTION_TYPE",o),t.commit("UPDATE_NEW_QUESTION_TYPE",o.type.key,{root:!0}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},isHiddenQuestionsSettings:function(t,e){},cloneQuestion:function(t,e){LP.Request({type:"clone-question",question:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("ADD_NEW_QUESTION",n.data),t.commit("UPDATE_NEW_QUESTION_TYPE",i.type.key,{root:!0})}}),(function(t){console.log(t)}))},removeQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"remove-question",question_id:n}).then((function(n){n.body.success&&(e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e))}),(function(t){console.error(t)}))},deleteQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"delete-question",question_id:n}).then((function(){e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e),t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},toggleQuestion:function(t,e){e.open?t.commit("CLOSE_QUESTION",e):t.commit("OPEN_QUESTION",e),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuestionAnswersOrder:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"sort-question-answers",question_id:e.question_id,order:JSON.stringify(e.order)}).then((function(n){var i=n.body.data;t.commit("SORT_QUESTION_ANSWERS",i),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},updateQuestionAnswerTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"update-question-answer-title",question_id:parseInt(e.question_id),answer:JSON.stringify(e.answer)}).then((function(){t.commit("UPDATE_QUESTION_ANSWER_SUCCESS",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)})).catch((function(){t.commit("UPDATE_QUESTION_ANSWER_FAILURE",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},updateQuestionCorrectAnswer:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-correct-answer",question_id:e.question_id,correct:JSON.stringify(e.correct)}).then((function(n){var i=n.body;i.success&&(t.commit("CHANGE_QUESTION_CORRECT_ANSWERS",i.data),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},deleteQuestionAnswer:function(t,e){e.temp_id=LP.uniqueId(),t.commit("DELETE_ANSWER",e),t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"delete-question-answer",question_id:e.question_id,answer_id:e.answer_id}).then((function(n){n.body.success&&(t.commit("DELETE_QUESTION_ANSWER",{question_id:e.question_id,answer_id:e.temp_id}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},newQuestionAnswer:function(t,e){var n=LP.uniqueId(),i=e.question_id;t.commit("UPDATE_QUESTION_REQUEST",i),t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:{text:LP_Quiz_Store.getters["i18n/all"].new_option,question_answer_id:n}}),LP.Request({type:"new-question-answer",question_id:i,question_answer_id:n}).then((function(n){var o=n.body;if(o.success){var s=o.data;t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:s}),t.commit("UPDATE_QUESTION_SUCCESS",i),e.success&&setTimeout((function(){e.success.apply(e.context,[s])}),300)}}),(function(e){t.commit("UPDATE_QUESTION_FAILURE",i),console.error(e)}))},updateQuestionContent:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-content",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},updateQuestionMeta:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question.id),LP.Request({type:"update-question-meta",question:JSON.stringify(e.question),meta_key:e.meta_key}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.question.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question.id)}))}},p=window.jQuery||jQuery,U=function(t){var e=t.listQuestions;return{namespaced:!0,state:p.extend({statusUpdateQuestions:{},statusUpdateQuestionItem:{},statusUpdateQuestionAnswer:{},questions:e.questions.map((function(t){var n=e.hidden_questions.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t}))},e),getters:_,mutations:m,actions:T}},l=window.jQuery||jQuery,q=function(t){return{state:l.extend({status:"success",heartbeat:!0,countCurrentRequest:0},t.root),getters:i,mutations:o,actions:s,modules:{cqi:a(t),i18n:Object(E.a)(t.i18n),lqs:U(t)}}},Q=n(0);n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,window.jQuery(document).ready((function(){window.LP_Quiz_Store=new $Vuex.Store(q(lp_quiz_editor)),Object(Q.a)({ns:"LPListQuizQuestionsRequest",store:LP_Quiz_Store}),setTimeout((function(){window.LP_Quiz_Editor=new $Vue({el:"#admin-editor-lp_quiz",template:"<lp-quiz-editor></lp-quiz-editor>"})}),100)}))},2:function(t,e){var n;n=jQuery,window.FIB={getSelectedText:function(){var t="";if(void 0!==window.getSelection){var e=window.getSelection();if(e.rangeCount){for(var n=document.createElement("div"),i=0,o=e.rangeCount;i<o;++i)n.appendChild(e.getRangeAt(i).cloneContents());t=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(t=document.selection.createRange().htmlText);return t},createTextNode:function(t){return document.createTextNode(t)},isContainHtml:function(t){var e=n(t),i="b.fib-blank";return e.is(i)||e.find(i).length||e.parent().is(i)},getSelectionRange:function(){var t="";return window.getSelection?t=window.getSelection():document.getSelection?t=document.getSelection():document.selection&&(t=document.selection.createRange().text),t},outerHTML:function(t){return n("<div>").append(n(t).clone()).html()},doUpgrade:function(t){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(e){console.log(e),t&&t.call(e)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var t=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){t.prop("disabled",!1).removeClass("ajaxloading")}))}))}))}});
1
+ !function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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=11)}([function(t,e,n){"use strict";function i(t){var e=window.jQuery||jQuery,n=Vue.http;t=e.extend({ns:"LPRequest",store:!1},t||{});var i=null;LP.Request=function(o){return i=e("#publishing-action"),o.id=t.store.getters.id,o.nonce=t.store.getters.nonce,o["lp-ajax"]=t.store.getters.action,o.code=t.store.getters.code,i.find("#publish").addClass("disabled"),i.find(".spinner").addClass("is-active"),i.addClass("code-"+o.code),n.post(t.store.getters.urlAjax,o,{emulateJSON:!0,params:{namespace:t.ns,code:o.code}})},n.interceptors.push((function(e,n){e.params.namespace===t.ns?(t.store.dispatch("newRequest"),n((function(n){jQuery.isPlainObject(n.body)||(n.body=LP.parseJSON(n.body)),n.body.success||!1?t.store.dispatch("requestCompleted","successful"):t.store.dispatch("requestCompleted","failed"),i.removeClass("code-"+e.params.code),i.attr("class")||(i.find("#publish").removeClass("disabled"),i.find(".spinner").removeClass("is-active"))}))):n()}))}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=window.jQuery||jQuery;e.a=function(t){return{namespaced:!0,state:i.extend({},t),getters:{all:function(t){return t}}}}},function(t,e){var n;n=jQuery,window.FIB={getSelectedText:function(){var t="";if(void 0!==window.getSelection){var e=window.getSelection();if(e.rangeCount){for(var n=document.createElement("div"),i=0,o=e.rangeCount;i<o;++i)n.appendChild(e.getRangeAt(i).cloneContents());t=n.innerHTML}}else void 0!==document.selection&&"Text"===document.selection.type&&(t=document.selection.createRange().htmlText);return t},createTextNode:function(t){return document.createTextNode(t)},isContainHtml:function(t){var e=n(t),i="b.fib-blank";return e.is(i)||e.find(i).length||e.parent().is(i)},getSelectionRange:function(){var t="";return window.getSelection?t=window.getSelection():document.getSelection?t=document.getSelection():document.selection&&(t=document.selection.createRange().text),t},outerHTML:function(t){return n("<div>").append(n(t).clone()).html()},doUpgrade:function(t){n.ajax({url:"",data:{"lp-ajax":"fib-upgrade"},success:function(e){console.log(e),t&&t.call(e)}})}},n(document).ready((function(){n("#do-upgrade-fib").on("click",(function(){var t=n(this).prop("disabled",!0).addClass("ajaxloading");FIB.doUpgrade((function(){t.prop("disabled",!1).removeClass("ajaxloading")}))}))}))},,,,,,,,,function(t,e,n){"use strict";n.r(e);var i={heartbeat:function(t){return t.heartbeat},questionTypes:function(t){return t.types},defaultNewQuestionType:function(t){return t.default_new},action:function(t){return t.action},id:function(t){return t.quiz_id},status:function(t){return t.status||"error"},currentRequest:function(t){return t.countCurrentRequest||0},nonce:function(t){return t.nonce}},o={UPDATE_HEART_BEAT:function(t,e){t.heartbeat=!!e},UPDATE_STATUS:function(t,e){t.status=e},UPDATE_NEW_QUESTION_TYPE:function(t,e){t.default_new=e},INCREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest++},DECREASE_NUMBER_REQUEST:function(t){t.countCurrentRequest--}},s={heartbeat:function(t){LP.Request({type:"heartbeat"}).then((function(e){var n=e.body;t.commit("UPDATE_HEART_BEAT",!!n.success)}),(function(e){t.commit("UPDATE_HEART_BEAT",!1)}))},newRequest:function(t){t.commit("INCREASE_NUMBER_REQUEST"),t.commit("UPDATE_STATUS","loading"),window.onbeforeunload=function(){return""}},requestCompleted:function(t,e){t.commit("DECREASE_NUMBER_REQUEST"),0===t.getters.currentRequest&&(t.commit("UPDATE_STATUS",e),window.onbeforeunload=null)}},u={status:function(t){return t.status},pagination:function(t){return t.pagination},items:function(t,e){return t.items.map((function(t){var n=e.addedItems.find((function(e){return t.id===e.id}));return t.added=!!n,t}))},code:function(t){return Date.now()},addedItems:function(t){return t.addedItems},isOpen:function(t){return t.open},quiz:function(t){return t.quizId}},r={TOGGLE:function(t){t.open=!t.open},SET_QUIZ:function(t,e){t.quizId=e},SET_LIST_ITEMS:function(t,e){t.items=e},ADD_ITEM:function(t,e){t.addedItems.push(e)},REMOVE_ADDED_ITEM:function(t,e){t.addedItems.forEach((function(n,i){n.id===e.id&&t.addedItems.splice(i,1)}))},RESET:function(t){t.addedItems=[],t.items=[]},UPDATE_PAGINATION:function(t,e){t.pagination=e},SEARCH_ITEM_REQUEST:function(t){t.status="loading"},SEARCH_ITEM_SUCCESS:function(t){t.status="successful"},SEARCH_ITEM_FAIL:function(t){t.status="fail"}},c={toggle:function(t){t.commit("TOGGLE")},open:function(t,e){t.commit("SET_QUIZ",e),t.commit("RESET"),t.commit("TOGGLE")},searchItems:function(t,e){t.commit("SEARCH_ITEM_REQUEST"),LP.Request({type:"search-items",query:e.query,page:e.page,exclude:JSON.stringify([])}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("SET_LIST_ITEMS",i.items),t.commit("UPDATE_PAGINATION",i.pagination),t.commit("SEARCH_ITEM_SUCCESS")}}),(function(e){t.commit("SEARCH_ITEMS_FAIL"),console.log(e)}))},addItem:function(t,e){t.commit("ADD_ITEM",e)},removeItem:function(t,e){t.commit("REMOVE_ADDED_ITEM",e)},addQuestionsToQuiz:function(t,e){var n=t.getters.addedItems;n.length>0&&LP.Request({type:"add-questions-to-quiz",items:JSON.stringify(n),draft_quiz:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("lqs/SET_QUESTIONS",i,{root:!0}),t.commit("TOGGLE")}}),(function(t){console.log(t)}))}},d=window.jQuery||jQuery,a=function(t){return{namespaced:!0,state:d.extend({quizId:!1,pagination:"",status:""},t.chooseItems),getters:u,mutations:r,actions:c}},E=n(1),_={listQuestions:function(t){return t.questions||[]},questionsOrder:function(t){return t.order||[]},externalComponent:function(t){return t.externalComponent||[]},supportAnswerOptions:function(t){return t.supportAnswerOptions||[]},hiddenQuestionsSettings:function(t){return t.hidden_questions_settings||[]},hiddenQuestions:function(t){return t.questions.filter((function(t){return!t.open})).map((function(t){return parseInt(t.id)}))},isHiddenListQuestions:function(t,e){var n=e.listQuestions,i=e.hiddenQuestions;return n.length===i.length},disableUpdateList:function(t){return t.disableUpdateList},statusUpdateQuestions:function(t){return t.statusUpdateQuestions},statusUpdateQuestionItem:function(t){return t.statusUpdateQuestionItem},statusUpdateQuestionAnswer:function(t){return t.statusUpdateQuestionAnswer}},f=window.jQuery,m={SORT_QUESTIONS:function(t,e){t.questions=t.questions.map((function(t){return t.order=e[t.id],t}))},SORT_QUESTION_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return t.answers.answer_order=e[t.answers.question_answer_id],t}))},ADD_QUESTION_ANSWER:function(t,e){t.questions=t.questions.map((function(t){if(t.id===e.question_id){var n=!1;if(e.answer.temp_id)for(var i=0,o=t.answers.length;i<o;i++)t.answers[i].question_answer_id==e.answer.temp_id&&(n=!0,$Vue.set(t.answers,i,e.answer));return!n&&t.answers.push(e.answer),t}return t}))},CHANGE_QUESTION_CORRECT_ANSWERS:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers),t}))},SET_QUESTIONS:function(t,e){t.questions=e},ADD_NEW_QUESTION:function(t,e){var n=!1;if(e.temp_id)for(var i=0,o=t.questions.length;i<o;i++)if(t.questions[i].id===e.temp_id){$Vue.set(t.questions,i,e),n=!0;break}if(!n){var s=f(".lp-list-questions .main > div:last-child");if(s.length){var u=s.offset().top;f("html,body").animate({scrollTop:u})}t.questions.push(e)}},CHANGE_QUESTION_TYPE:function(t,e){t.questions=t.questions.map((function(t){return parseInt(t.id)===e.id&&(t.answers=e.answers,t.type=e.type,t.open=!0),t}))},REMOVE_QUESTION:function(t,e){var n=t.questions.indexOf(e);e.temp_id?t.questions[n].id=e.temp_id:t.questions.splice(n,1)},DELETE_QUESTION_ANSWER:function(t,e){var n=e.question_id,i=e.answer_id;t.questions=t.questions.map((function(t){if(t.id===n){var e=t.answers;e.forEach((function(t){if(t.question_answer_id===i){var n=e.indexOf(t);e.splice(n,1)}}))}return t}))},REMOVE_QUESTIONS:function(){},CLOSE_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!1)}))},OPEN_QUESTION:function(t,e){t.questions.forEach((function(n,i){e.id===n.id&&(t.questions[i].open=!0)}))},CLOSE_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!1,t}))},OPEN_LIST_QUESTIONS:function(t){t.questions=t.questions.map((function(t){return t.open=!0,t}))},UPDATE_QUESTION_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"updating")},UPDATE_QUESTION_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"successful")},UPDATE_QUESTION_FAILURE:function(t,e){$Vue.set(t.statusUpdateQuestionItem,e,"failed")},UPDATE_QUESTION_ANSWER_REQUEST:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"updating")},UPDATE_QUESTION_ANSWER_SUCCESS:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"successful")},UPDATE_QUESTION_ANSWER_FAIL:function(t,e){$Vue.set(t.statusUpdateQuestionAnswer,e,"failed")},DELETE_ANSWER:function(t,e){t.questions.map((function(t,n){if(t.id==e.question_id){for(var i=0,o=t.answers.length;i<o;i++)if(t.answers[i].question_answer_id==e.answer_id){t.answers[i].question_answer_id=e.temp_id;break}return!1}}))}},S=window.jQuery,T={toggleAll:function(t){t.getters.isHiddenListQuestions?t.commit("OPEN_LIST_QUESTIONS"):t.commit("CLOSE_LIST_QUESTIONS"),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuizQuestionsHidden:function(t,e){LP.Request(S.extend({},e,{type:"update-quiz-questions-hidden"}))},newQuestion:function(t,e){var n=JSON.parse(JSON.stringify(e.question));n.settings={},t.commit("ADD_NEW_QUESTION",n),LP.Request({type:"new-question",question:JSON.stringify(e.question),draft_quiz:JSON.stringify(e.quiz)}).then((function(n){var i=n.body;i.success&&(t.commit("UPDATE_NEW_QUESTION_TYPE",e.question.type,{root:!0}),t.commit("ADD_NEW_QUESTION",i.data),t.commit("CLOSE_LIST_QUESTIONS"),t.commit("OPEN_QUESTION",i.data))}),(function(t){console.log(t)}))},updateQuestionsOrder:function(t,e){LP.Request({type:"sort-questions",order:JSON.stringify(e)}).then((function(n){t.commit("SORT_QUESTIONS",e)}),(function(t){console.log(t)}))},updateQuestionTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-title",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},changeQuestionType:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-type",question_id:e.question_id,question_type:e.type}).then((function(n){var i=n.body;if(i.success){var o=i.data;t.commit("CHANGE_QUESTION_TYPE",o),t.commit("UPDATE_NEW_QUESTION_TYPE",o.type.key,{root:!0}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},isHiddenQuestionsSettings:function(t,e){},cloneQuestion:function(t,e){LP.Request({type:"clone-question",question:JSON.stringify(e)}).then((function(e){var n=e.body;if(n.success){var i=n.data;t.commit("ADD_NEW_QUESTION",n.data),t.commit("UPDATE_NEW_QUESTION_TYPE",i.type.key,{root:!0})}}),(function(t){console.log(t)}))},removeQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"remove-question",question_id:n}).then((function(n){n.body.success&&(e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e))}),(function(t){console.error(t)}))},deleteQuestion:function(t,e){var n=e.id;e.temp_id=LP.uniqueId(),t.commit("REMOVE_QUESTION",e),LP.Request({type:"delete-question",question_id:n}).then((function(){e.id=e.temp_id,e.temp_id=0,t.commit("REMOVE_QUESTION",e),t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},toggleQuestion:function(t,e){e.open?t.commit("CLOSE_QUESTION",e):t.commit("OPEN_QUESTION",e),LP.Request({type:"hidden-questions",hidden:t.getters.hiddenQuestions})},updateQuestionAnswersOrder:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"sort-question-answers",question_id:e.question_id,order:JSON.stringify(e.order)}).then((function(n){var i=n.body.data;t.commit("SORT_QUESTION_ANSWERS",i),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},updateQuestionAnswerTitle:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"update-question-answer-title",question_id:parseInt(e.question_id),answer:JSON.stringify(e.answer)}).then((function(){t.commit("UPDATE_QUESTION_ANSWER_SUCCESS",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id)})).catch((function(){t.commit("UPDATE_QUESTION_ANSWER_FAILURE",parseInt(e.question_id)),t.commit("UPDATE_QUESTION_FAILURE",e.question_id)}))},updateQuestionCorrectAnswer:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"change-question-correct-answer",question_id:e.question_id,correct:JSON.stringify(e.correct)}).then((function(n){var i=n.body;i.success&&(t.commit("CHANGE_QUESTION_CORRECT_ANSWERS",i.data),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},deleteQuestionAnswer:function(t,e){e.temp_id=LP.uniqueId(),t.commit("DELETE_ANSWER",e),t.commit("UPDATE_QUESTION_REQUEST",e.question_id),LP.Request({type:"delete-question-answer",question_id:e.question_id,answer_id:e.answer_id}).then((function(n){n.body.success&&(t.commit("DELETE_QUESTION_ANSWER",{question_id:e.question_id,answer_id:e.temp_id}),t.commit("UPDATE_QUESTION_SUCCESS",e.question_id))}),(function(n){t.commit("UPDATE_QUESTION_FAILURE",e.question_id),console.log(n)}))},newQuestionAnswer:function(t,e){var n=LP.uniqueId(),i=e.question_id;t.commit("UPDATE_QUESTION_REQUEST",i),t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:{text:LP_Quiz_Store.getters["i18n/all"].new_option,question_answer_id:n}}),LP.Request({type:"new-question-answer",question_id:i,question_answer_id:n}).then((function(n){var o=n.body;if(o.success){var s=o.data;t.commit("ADD_QUESTION_ANSWER",{question_id:i,answer:s}),t.commit("UPDATE_QUESTION_SUCCESS",i),e.success&&setTimeout((function(){e.success.apply(e.context,[s])}),300)}}),(function(e){t.commit("UPDATE_QUESTION_FAILURE",i),console.error(e)}))},updateQuestionContent:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.id),LP.Request({type:"update-question-content",question:JSON.stringify(e)}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.id)}))},updateQuestionMeta:function(t,e){t.commit("UPDATE_QUESTION_REQUEST",e.question.id),LP.Request({type:"update-question-meta",question:JSON.stringify(e.question),meta_key:e.meta_key}).then((function(){t.commit("UPDATE_QUESTION_SUCCESS",e.question.id)})).catch((function(){t.commit("UPDATE_QUESTION_FAILURE",e.question.id)}))}},p=window.jQuery||jQuery,U=function(t){var e=t.listQuestions;return{namespaced:!0,state:p.extend({statusUpdateQuestions:{},statusUpdateQuestionItem:{},statusUpdateQuestionAnswer:{},questions:e.questions.map((function(t){var n=e.hidden_questions.find((function(e){return parseInt(t.id)===parseInt(e)}));return t.open=!n,t}))},e),getters:_,mutations:m,actions:T}},l=window.jQuery||jQuery,q=function(t){return{state:l.extend({status:"success",heartbeat:!0,countCurrentRequest:0},t.root),getters:i,mutations:o,actions:s,modules:{cqi:a(t),i18n:Object(E.a)(t.i18n),lqs:U(t)}}},Q=n(0);n(2);window.$Vue=window.$Vue||Vue,window.$Vuex=window.$Vuex||Vuex,window.jQuery(document).ready((function(){window.LP_Quiz_Store=new $Vuex.Store(q(lp_quiz_editor)),Object(Q.a)({ns:"LPListQuizQuestionsRequest",store:LP_Quiz_Store}),setTimeout((function(){window.LP_Quiz_Editor=new $Vue({el:"#admin-editor-lp_quiz",template:"<lp-quiz-editor></lp-quiz-editor>"})}),100)}))}]);
assets/js/dist/admin/pages/search-lp-addons-themes.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=9)}({9:function(e,n){var t,r,o,i,u;t=jQuery,r=null,o=null,i=null,u=function(e){i||(i=o.clone());var n=e.toLowerCase().split(/\s+/).filter((function(e,n){return e.length>=3}));o.each((function(e){var r,o,u=t(this).html(""),l=(r=i.eq(e),o=u,r.find(".plugin-card").each((function(){var e,r=t(this),i=r.find(".item-title").text().toLowerCase(),u=r.find(".column-description, .theme-description").text();if(n.length){if(e=new RegExp(n.join("|"),"ig"),i.match(e)||u.match(e)){var l=r.clone();o.append(l)}}else o.append(r.clone())})),u.children().length);u.prev("h2").find("span").html(l)}))},t(document).on("keyup",".lp-search-addon",(function(e){r&&clearTimeout(r),r=setTimeout(u,300,e.target.value)})),jQuery((function(){o=t(".addons-browse")}))}});
1
+ !function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=8)}({8:function(e,n){var t,r,o,i,u;t=jQuery,r=null,o=null,i=null,u=function(e){i||(i=o.clone());var n=e.toLowerCase().split(/\s+/).filter((function(e,n){return e.length>=3}));o.each((function(e){var r,o,u=t(this).html(""),l=(r=i.eq(e),o=u,r.find(".plugin-card").each((function(){var e,r=t(this),i=r.find(".item-title").text().toLowerCase(),u=r.find(".column-description, .theme-description").text();if(n.length){if(e=new RegExp(n.join("|"),"ig"),i.match(e)||u.match(e)){var l=r.clone();o.append(l)}}else o.append(r.clone())})),u.children().length);u.prev("h2").find("span").html(l)}))},t(document).on("keyup",".lp-search-addon",(function(e){r&&clearTimeout(r),r=setTimeout(u,300,e.target.value)})),jQuery((function(){o=t(".addons-browse")}))}});
assets/js/dist/admin/pages/setup.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}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 a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));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=6)}({6:function(e,t){!function(e){"use strict";var t,r,n=function(e){t.toggleClass("loading",void 0===e||e)},a=function(t){var n=(r=e("#learn-press-setup-form")).serializeJSON();return e.extend(n,t||{})},s=function(r){var n=e(r);t.replaceWith(n),t=n},c=function(n){if(n.preventDefault(),c=r.find('input[type="email"]'),o=!0,c.each((function(){var t,r=e(this);switch(r.css("border-color",""),r.attr("name")){case"settings[paypal][paypal_email]":case"settings[paypal][paypal_sandbox_email]":if(!r.closest("tr").prev().find('input[type="checkbox"]').is(":checked"))return}t=this.value,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)||(o=!1,r.css("border-color","#FF0000"))})),o){var c,o,i=e(this).attr("href");t.addClass("loading"),e.post({url:i,data:a(),success:function(r){var n=e(r);s(n.contents().filter("#main")),LP.setUrl(i),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-tip").LP("QuickTip"),t.removeClass("loading")}})}},o=function(){var t=e(this).children(":selected").html().match(/\((.*)\)/),r=t?t[1]:"";e("#currency-pos").children().each((function(){var t=e(this),n=t.html();switch(t.val()){case"left":n=n.replace(/\( (.*)69/,"( "+r+"69");break;case"right":n=n.replace(/9([^0-9]*) \)/,"9"+r+" )");break;case"left_with_space":n=n.replace(/\( (.*) 6/,"( "+r+" 6");break;case"right_with_space":n=n.replace(/9 (.*) \)/,"9 "+r+" )")}t.html(n)}))},i=function(){e.post({url:"",dataType:"html",data:a({"lp-ajax":"get-price-format"}),success:function(t){e("#preview-price").html(t)}})},l=function(t){t.preventDefault(),n(),e.post({url:e(this).attr("href"),dataType:"html",data:a({"lp-ajax":"setup-create-pages"}),success:function(t){s(e(t).contents().filter("#main")),e(".learn-press-dropdown-pages").LP("DropdownPages"),n(!1)}})},u=function(t){t.preventDefault();var r=e(this);n(),e.post({url:e(this).attr("href"),dataType:"html",data:{},success:function(t){n(!1),r.replaceWith(e(t).find("a:first").addClass("button button-primary"))}})};e((function(){t=e("#main"),r=e("#learn-press-setup-form"),e(".learn-press-select2").select2(),e(document).on("click",".buttons .button",c).on("change","#currency",o).on("change","input, select",i).on("click","#create-pages",l).on("click","#install-sample-course",u)}))}(jQuery)}});
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}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 a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));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=5)}({5:function(e,t){!function(e){"use strict";var t,r,n=function(e){t.toggleClass("loading",void 0===e||e)},a=function(t){var n=(r=e("#learn-press-setup-form")).serializeJSON();return e.extend(n,t||{})},s=function(r){var n=e(r);t.replaceWith(n),t=n},c=function(n){if(n.preventDefault(),c=r.find('input[type="email"]'),o=!0,c.each((function(){var t,r=e(this);switch(r.css("border-color",""),r.attr("name")){case"settings[paypal][paypal_email]":case"settings[paypal][paypal_sandbox_email]":if(!r.closest("tr").prev().find('input[type="checkbox"]').is(":checked"))return}t=this.value,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)||(o=!1,r.css("border-color","#FF0000"))})),o){var c,o,i=e(this).attr("href");t.addClass("loading"),e.post({url:i,data:a(),success:function(r){var n=e(r);s(n.contents().filter("#main")),LP.setUrl(i),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-tip").LP("QuickTip"),t.removeClass("loading")}})}},o=function(){var t=e(this).children(":selected").html().match(/\((.*)\)/),r=t?t[1]:"";e("#currency-pos").children().each((function(){var t=e(this),n=t.html();switch(t.val()){case"left":n=n.replace(/\( (.*)69/,"( "+r+"69");break;case"right":n=n.replace(/9([^0-9]*) \)/,"9"+r+" )");break;case"left_with_space":n=n.replace(/\( (.*) 6/,"( "+r+" 6");break;case"right_with_space":n=n.replace(/9 (.*) \)/,"9 "+r+" )")}t.html(n)}))},i=function(){e.post({url:"",dataType:"html",data:a({"lp-ajax":"get-price-format"}),success:function(t){e("#preview-price").html(t)}})},l=function(t){t.preventDefault(),n(),e.post({url:e(this).attr("href"),dataType:"html",data:a({"lp-ajax":"setup-create-pages"}),success:function(t){s(e(t).contents().filter("#main")),e(".learn-press-dropdown-pages").LP("DropdownPages"),n(!1)}})},u=function(t){t.preventDefault();var r=e(this);n(),e.post({url:e(this).attr("href"),dataType:"html",data:{},success:function(t){n(!1),r.replaceWith(e(t).find("a:first").addClass("button button-primary"))}})};e((function(){t=e("#main"),r=e("#learn-press-setup-form"),e(".learn-press-select2").select2(),e(document).on("click",".buttons .button",c).on("change","#currency",o).on("change","input, select",i).on("click","#create-pages",l).on("click","#install-sample-course",u)}))}(jQuery)}});
assets/js/dist/admin/pages/statistic.min.js CHANGED
@@ -1 +1 @@
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()}))}});
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=6)}({6: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/sync-data.min.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=8)}({8:function(e,t){var s,n,i,c,r,o,l,a;s=jQuery,n={id:"sync-base",syncing:!1,items:!1,completed:!1,callback:null,methodGetItems:"",itemsKey:"",chunkSize:50,sync:function(e){if(!this.syncing){if(this.callback=e,!1===this.items)this.get_items();else if(!this.dispatch())return this.completed=!0,void this.callToCallback();this.syncing=!0}},init:function(){this.syncing=!1,this.items=!1,this.completed=!1},is_completed:function(){return this.completed},dispatch:function(){var e=this,t=!!this.items&&this.items.splice(0,this.chunkSize);return!(!t||0===t.length||(s.ajax({url:"",data:{"lp-ajax":this.id,sync:t},method:"post",success:function(t){t=LP.parseJSON(t),e.syncing=!1,"success"!==t.result&&(e.completed=!0),e.callToCallback(),e.is_completed()||e.sync(e.callback)}}),0))},callToCallback:function(){this.callback&&this.callback.call(this)},get_items:function(){var e=this;s.ajax({url:"",data:{"lp-ajax":this.id,sync:this.methodGetItems},success:function(t){e.syncing=!1,(t=LP.parseJSON(t))[e.itemsKey]?(e.items=t[e.itemsKey],e.sync(e.callback)):(e.completed=!0,e.items=[],e.callToCallback())}})}},i=s.extend({},n,{id:"sync-course-orders",methodGetItems:"get-courses",itemsKey:"courses"}),c=s.extend({},n,{id:"sync-user-courses",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),r=s.extend({},n,{id:"sync-user-orders",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),o=s.extend({},n,{id:"sync-course-final-quiz",methodGetItems:"get-courses",itemsKey:"courses",chunkSize:500}),l=s.extend({},n,{id:"sync-remove-older-data",methodGetItems:"remove-older-data",itemsKey:"_nothing_here",chunkSize:500}),a=s.extend({},n,{id:"sync-calculate-course-results",methodGetItems:"get-users",itemsKey:"users",chunkSize:1}),window.LP_Sync_Data={syncs:[],syncing:0,options:{},start:function(e){if(this.syncs=[],this.options=s.extend({onInit:function(){},onStart:function(){},onCompleted:function(){},onCompletedAll:function(){}},e||{}),this.get_syncs()){this.reset(),this.options.onInit.call(this);var t=this,n=0,i=this.syncs.length;this.sync(n,(function e(s){if(s.is_completed()){if(n++,t.options.onCompleted.call(t,s),n>=i)return void t.options.onCompletedAll.call(t);t.sync(n,e)}}))}},reset:function(){for(var e in this.syncs)try{this[this.syncs[e]].init()}catch(e){}},sync:function(e,t){var s=this,n=this[this.syncs[e]];s.options.onStart.call(s,n),n.sync((function(){t.call(s,n)}))},get_syncs:function(){var e=s('input[name^="lp-repair"]:checked').serializeJSON()["lp-repair"];if(!e)return!1;for(var t in e)"yes"===e[t]&&this[t=t.replace(/[-]+/g,"_")]&&this.syncs.push(t);return this.syncs},get_sync:function(e){return this[e=e.replace(/[-]+/g,"_")]},sync_course_orders:i,sync_user_orders:r,sync_user_courses:c,sync_course_final_quiz:o,sync_remove_older_data:l,sync_calculate_course_results:a},s(document).ready((function(){var e,t;e=s("#learn-press-check-all-syncs"),t=s("#learn-press-syncs").find('[name^="lp-repair"]'),e.on("click",(function(){t.prop("checked",this.checked)})),t.on("click",(function(){e.prop("checked",t.filter(":checked").length===t.length)}))})).on("click",".lp-button-repair",(function(){function e(e){return s("ul#learn-press-syncs").find('input[name*="'+e+'"]')}LP_Sync_Data.start({onInit:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!0)},onStart:function(t){e(t.id).closest("li").addClass("syncing")},onCompleted:function(t){e(t.id).closest("li").removeClass("syncing").addClass("synced")},onCompletedAll:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!1)}})}))}});
1
+ !function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=7)}({7:function(e,t){var s,n,i,c,r,o,l,a;s=jQuery,n={id:"sync-base",syncing:!1,items:!1,completed:!1,callback:null,methodGetItems:"",itemsKey:"",chunkSize:50,sync:function(e){if(!this.syncing){if(this.callback=e,!1===this.items)this.get_items();else if(!this.dispatch())return this.completed=!0,void this.callToCallback();this.syncing=!0}},init:function(){this.syncing=!1,this.items=!1,this.completed=!1},is_completed:function(){return this.completed},dispatch:function(){var e=this,t=!!this.items&&this.items.splice(0,this.chunkSize);return!(!t||0===t.length||(s.ajax({url:"",data:{"lp-ajax":this.id,sync:t},method:"post",success:function(t){t=LP.parseJSON(t),e.syncing=!1,"success"!==t.result&&(e.completed=!0),e.callToCallback(),e.is_completed()||e.sync(e.callback)}}),0))},callToCallback:function(){this.callback&&this.callback.call(this)},get_items:function(){var e=this;s.ajax({url:"",data:{"lp-ajax":this.id,sync:this.methodGetItems},success:function(t){e.syncing=!1,(t=LP.parseJSON(t))[e.itemsKey]?(e.items=t[e.itemsKey],e.sync(e.callback)):(e.completed=!0,e.items=[],e.callToCallback())}})}},i=s.extend({},n,{id:"sync-course-orders",methodGetItems:"get-courses",itemsKey:"courses"}),c=s.extend({},n,{id:"sync-user-courses",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),r=s.extend({},n,{id:"sync-user-orders",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),o=s.extend({},n,{id:"sync-course-final-quiz",methodGetItems:"get-courses",itemsKey:"courses",chunkSize:500}),l=s.extend({},n,{id:"sync-remove-older-data",methodGetItems:"remove-older-data",itemsKey:"_nothing_here",chunkSize:500}),a=s.extend({},n,{id:"sync-calculate-course-results",methodGetItems:"get-users",itemsKey:"users",chunkSize:1}),window.LP_Sync_Data={syncs:[],syncing:0,options:{},start:function(e){if(this.syncs=[],this.options=s.extend({onInit:function(){},onStart:function(){},onCompleted:function(){},onCompletedAll:function(){}},e||{}),this.get_syncs()){this.reset(),this.options.onInit.call(this);var t=this,n=0,i=this.syncs.length;this.sync(n,(function e(s){if(s.is_completed()){if(n++,t.options.onCompleted.call(t,s),n>=i)return void t.options.onCompletedAll.call(t);t.sync(n,e)}}))}},reset:function(){for(var e in this.syncs)try{this[this.syncs[e]].init()}catch(e){}},sync:function(e,t){var s=this,n=this[this.syncs[e]];s.options.onStart.call(s,n),n.sync((function(){t.call(s,n)}))},get_syncs:function(){var e=s('input[name^="lp-repair"]:checked').serializeJSON()["lp-repair"];if(!e)return!1;for(var t in e)"yes"===e[t]&&this[t=t.replace(/[-]+/g,"_")]&&this.syncs.push(t);return this.syncs},get_sync:function(e){return this[e=e.replace(/[-]+/g,"_")]},sync_course_orders:i,sync_user_orders:r,sync_user_courses:c,sync_course_final_quiz:o,sync_remove_older_data:l,sync_calculate_course_results:a},s(document).ready((function(){var e,t;e=s("#learn-press-check-all-syncs"),t=s("#learn-press-syncs").find('[name^="lp-repair"]'),e.on("click",(function(){t.prop("checked",this.checked)})),t.on("click",(function(){e.prop("checked",t.filter(":checked").length===t.length)}))})).on("click",".lp-button-repair",(function(){function e(e){return s("ul#learn-press-syncs").find('input[name*="'+e+'"]')}LP_Sync_Data.start({onInit:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!0)},onStart:function(t){e(t.id).closest("li").addClass("syncing")},onCompleted:function(t){e(t.id).closest("li").removeClass("syncing").addClass("synced")},onCompletedAll:function(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!1)}})}))}});
assets/js/dist/admin/pages/tools.js CHANGED
@@ -98,6 +98,8 @@ __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
 
@@ -207,6 +209,7 @@ __webpack_require__.r(__webpack_exports__);
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);
@@ -249,7 +252,7 @@ var createIndexes = function createIndexes() {
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) {
@@ -295,7 +298,7 @@ var createIndexes = function createIndexes() {
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
@@ -701,6 +704,422 @@ var getStepsUpgradeStatus = function getStepsUpgradeStatus() {
701
 
702
  /***/ }),
703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
704
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js":
705
  /*!********************************************************************************************************************************************************************!*\
706
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js ***!
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
+ /* harmony import */ var _tools_reset_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/reset-data */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/index.js");
102
+
103
 
104
 
105
 
209
  Object(_tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__["default"])();
210
  Object(_tools_database_create_indexs__WEBPACK_IMPORTED_MODULE_1__["default"])();
211
  Object(_tools_database_re_upgrade_db__WEBPACK_IMPORTED_MODULE_2__["default"])();
212
+ Object(_tools_reset_data__WEBPACK_IMPORTED_MODULE_3__["default"])();
213
  $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);
214
  });
215
  })(jQuery);
252
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes[0].style.display = 'inline-block';
253
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnYes[0].textContent = 'Run';
254
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elBtnNo[0].textContent = 'Close';
255
+ var url = '/lp/v1/admin/tools/list-tables-indexs';
256
  var params = {};
257
  var functions = {
258
  success: function success(res) {
298
  }
299
 
300
  _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = function () {
301
+ var url = '/lp/v1/tools/admin/create-indexs';
302
  var params = {
303
  tables: tables,
304
  table: table
704
 
705
  /***/ }),
706
 
707
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/course.js":
708
+ /*!**********************************************************************************************************************************************************************************!*\
709
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/course.js ***!
710
+ \**********************************************************************************************************************************************************************************/
711
+ /*! exports provided: default */
712
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
713
+
714
+ "use strict";
715
+ __webpack_require__.r(__webpack_exports__);
716
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
717
+
718
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
719
+
720
+ 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."); }
721
+
722
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
723
+
724
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
725
+
726
+ 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); } }
727
+
728
+ 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); }); }; }
729
+
730
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
731
+
732
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
733
+
734
+ 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); }
735
+
736
+ 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; }
737
+
738
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
739
+
740
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
741
+
742
+ /**
743
+ * Reset course progress.
744
+ *
745
+ * @since 4.0.5.
746
+ * @author Nhamdv - Code choi choi in Physcode.
747
+ */
748
+ var __ = wp.i18n.__;
749
+ var _wp$components = wp.components,
750
+ TextControl = _wp$components.TextControl,
751
+ Button = _wp$components.Button,
752
+ Spinner = _wp$components.Spinner,
753
+ CheckboxControl = _wp$components.CheckboxControl,
754
+ Notice = _wp$components.Notice;
755
+ var _wp$element = wp.element,
756
+ useState = _wp$element.useState,
757
+ useEffect = _wp$element.useEffect;
758
+ var addQueryArgs = wp.url.addQueryArgs;
759
+
760
+ var ResetCourse = function ResetCourse() {
761
+ var _useState = useState(false),
762
+ _useState2 = _slicedToArray(_useState, 2),
763
+ loading = _useState2[0],
764
+ setLoading = _useState2[1];
765
+
766
+ var _useState3 = useState(''),
767
+ _useState4 = _slicedToArray(_useState3, 2),
768
+ search = _useState4[0],
769
+ setSearch = _useState4[1];
770
+
771
+ var _useState5 = useState([]),
772
+ _useState6 = _slicedToArray(_useState5, 2),
773
+ data = _useState6[0],
774
+ setData = _useState6[1];
775
+
776
+ var _useState7 = useState([]),
777
+ _useState8 = _slicedToArray(_useState7, 2),
778
+ checkData = _useState8[0],
779
+ setCheckData = _useState8[1];
780
+
781
+ var _useState9 = useState([]),
782
+ _useState10 = _slicedToArray(_useState9, 2),
783
+ message = _useState10[0],
784
+ setMessage = _useState10[1];
785
+
786
+ var _useState11 = useState(false),
787
+ _useState12 = _slicedToArray(_useState11, 2),
788
+ loadingReset = _useState12[0],
789
+ setLoadingReset = _useState12[1];
790
+
791
+ useEffect(function () {
792
+ responsiveData(search);
793
+ }, [search]);
794
+
795
+ var responsiveData = /*#__PURE__*/function () {
796
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(s) {
797
+ var response, status, _data;
798
+
799
+ return regeneratorRuntime.wrap(function _callee$(_context) {
800
+ while (1) {
801
+ switch (_context.prev = _context.next) {
802
+ case 0:
803
+ _context.prev = 0;
804
+
805
+ if (!(!s || loading)) {
806
+ _context.next = 5;
807
+ break;
808
+ }
809
+
810
+ setMessage([]);
811
+ setData([]);
812
+ return _context.abrupt("return");
813
+
814
+ case 5:
815
+ if (!(s.length < 3)) {
816
+ _context.next = 9;
817
+ break;
818
+ }
819
+
820
+ setMessage([{
821
+ status: 'error',
822
+ message: 'Please enter at least 3 characters to searching course.'
823
+ }]);
824
+ setData([]);
825
+ return _context.abrupt("return");
826
+
827
+ case 9:
828
+ setLoading(true);
829
+ _context.next = 12;
830
+ return wp.apiFetch({
831
+ path: addQueryArgs('lp/v1/admin/tools/reset-data/search-courses', {
832
+ s: s
833
+ }),
834
+ method: 'GET'
835
+ });
836
+
837
+ case 12:
838
+ response = _context.sent;
839
+ status = response.status, _data = response.data;
840
+ setLoading(false);
841
+
842
+ if (status === 'success') {
843
+ setData(_data);
844
+ setMessage([]);
845
+ } else {
846
+ setMessage([{
847
+ status: 'error',
848
+ message: response.message || 'LearnPress: Search Course Fail!'
849
+ }]);
850
+ setData([]);
851
+ }
852
+
853
+ _context.next = 21;
854
+ break;
855
+
856
+ case 18:
857
+ _context.prev = 18;
858
+ _context.t0 = _context["catch"](0);
859
+ console.log(_context.t0.message);
860
+
861
+ case 21:
862
+ case "end":
863
+ return _context.stop();
864
+ }
865
+ }
866
+ }, _callee, null, [[0, 18]]);
867
+ }));
868
+
869
+ return function responsiveData(_x) {
870
+ return _ref.apply(this, arguments);
871
+ };
872
+ }();
873
+
874
+ function checkItems(id) {
875
+ var datas = _toConsumableArray(checkData);
876
+
877
+ if (datas.includes(id)) {
878
+ var index = datas.indexOf(id);
879
+
880
+ if (index > -1) {
881
+ datas.splice(index, 1);
882
+ }
883
+ } else {
884
+ datas.push(id);
885
+ }
886
+
887
+ setCheckData(datas);
888
+ }
889
+
890
+ var resetCourse = /*#__PURE__*/function () {
891
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
892
+ var notice, _iterator, _step, courseId, response, status, _data2, _message;
893
+
894
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
895
+ while (1) {
896
+ switch (_context2.prev = _context2.next) {
897
+ case 0:
898
+ if (!(checkData.length === 0)) {
899
+ _context2.next = 3;
900
+ break;
901
+ }
902
+
903
+ setMessage([{
904
+ status: 'error',
905
+ message: 'Please chooce Course for reset data!'
906
+ }]);
907
+ return _context2.abrupt("return");
908
+
909
+ case 3:
910
+ if (confirm('Are you sure to reset course progress of all users enrolled this course?')) {
911
+ _context2.next = 5;
912
+ break;
913
+ }
914
+
915
+ return _context2.abrupt("return");
916
+
917
+ case 5:
918
+ notice = [];
919
+ _context2.prev = 6;
920
+ setLoadingReset(true);
921
+ _iterator = _createForOfIteratorHelper(checkData);
922
+ _context2.prev = 9;
923
+
924
+ _iterator.s();
925
+
926
+ case 11:
927
+ if ((_step = _iterator.n()).done) {
928
+ _context2.next = 20;
929
+ break;
930
+ }
931
+
932
+ courseId = _step.value;
933
+ _context2.next = 15;
934
+ return wp.apiFetch({
935
+ path: addQueryArgs('lp/v1/admin/tools/reset-data/reset-courses', {
936
+ courseId: courseId
937
+ }),
938
+ method: 'GET'
939
+ });
940
+
941
+ case 15:
942
+ response = _context2.sent;
943
+ status = response.status, _data2 = response.data, _message = response.message;
944
+ notice.push({
945
+ status: status,
946
+ message: _message || "Course #".concat(courseId, " reset successfully!")
947
+ });
948
+
949
+ case 18:
950
+ _context2.next = 11;
951
+ break;
952
+
953
+ case 20:
954
+ _context2.next = 25;
955
+ break;
956
+
957
+ case 22:
958
+ _context2.prev = 22;
959
+ _context2.t0 = _context2["catch"](9);
960
+
961
+ _iterator.e(_context2.t0);
962
+
963
+ case 25:
964
+ _context2.prev = 25;
965
+
966
+ _iterator.f();
967
+
968
+ return _context2.finish(25);
969
+
970
+ case 28:
971
+ setLoadingReset(false);
972
+ _context2.next = 34;
973
+ break;
974
+
975
+ case 31:
976
+ _context2.prev = 31;
977
+ _context2.t1 = _context2["catch"](6);
978
+ notice.push({
979
+ status: 'error',
980
+ message: _context2.t1.message || "LearnPress Error: Reset Course Data."
981
+ });
982
+
983
+ case 34:
984
+ setMessage(notice);
985
+
986
+ case 35:
987
+ case "end":
988
+ return _context2.stop();
989
+ }
990
+ }
991
+ }, _callee2, null, [[6, 31], [9, 22, 25, 28]]);
992
+ }));
993
+
994
+ return function resetCourse() {
995
+ return _ref2.apply(this, arguments);
996
+ };
997
+ }();
998
+
999
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", null, __('Reset course progress', 'learnpress')), /*#__PURE__*/React.createElement("div", {
1000
+ className: "description"
1001
+ }, /*#__PURE__*/React.createElement("p", null, __('This action will reset progress of a course for all users have enrolled.', 'learnpress')), /*#__PURE__*/React.createElement("p", null, __('Search results only show course have user data.', 'learnpress')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextControl, {
1002
+ placeholder: __('Search course by name', 'learnpress'),
1003
+ value: search,
1004
+ onChange: function onChange(value) {
1005
+ return setSearch(value);
1006
+ },
1007
+ style: {
1008
+ width: 300
1009
+ }
1010
+ }))), loading && /*#__PURE__*/React.createElement(Spinner, null), data.length > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
1011
+ className: "lp-reset-course_progress",
1012
+ style: {
1013
+ border: '1px solid #eee'
1014
+ }
1015
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1016
+ style: {
1017
+ background: '#eee'
1018
+ }
1019
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CheckboxControl, {
1020
+ checked: checkData.length === data.length,
1021
+ onChange: function onChange() {
1022
+ if (checkData.length === data.length) {
1023
+ setCheckData([]);
1024
+ } else {
1025
+ setCheckData(data.map(function (dt) {
1026
+ return dt.id;
1027
+ }));
1028
+ }
1029
+ },
1030
+ style: {
1031
+ margin: 0
1032
+ }
1033
+ })), /*#__PURE__*/React.createElement("div", null, __('ID', 'learnpress')), /*#__PURE__*/React.createElement("div", null, __('Name', 'learnpress')), /*#__PURE__*/React.createElement("div", null, __('Students', 'learnpress')))), /*#__PURE__*/React.createElement("div", {
1034
+ style: {
1035
+ height: '100%',
1036
+ maxHeight: 200,
1037
+ overflow: 'auto'
1038
+ }
1039
+ }, data.map(function (dt) {
1040
+ return /*#__PURE__*/React.createElement("div", {
1041
+ style: {
1042
+ borderTop: '1px solid #eee'
1043
+ },
1044
+ key: dt.id
1045
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CheckboxControl, {
1046
+ checked: checkData.includes(dt.id),
1047
+ onChange: function onChange() {
1048
+ return checkItems(dt.id);
1049
+ }
1050
+ })), /*#__PURE__*/React.createElement("div", null, "#", dt.id), /*#__PURE__*/React.createElement("div", null, dt.title), /*#__PURE__*/React.createElement("div", null, dt.students));
1051
+ }))), loadingReset ? /*#__PURE__*/React.createElement(Spinner, null) : /*#__PURE__*/React.createElement(Button, {
1052
+ isPrimary: true,
1053
+ onClick: function onClick() {
1054
+ return resetCourse();
1055
+ },
1056
+ style: {
1057
+ marginTop: 10,
1058
+ height: 30
1059
+ }
1060
+ }, __('Reset now', 'learnpress'))), message.length > 0 && message.map(function (mess, index) {
1061
+ return /*#__PURE__*/React.createElement(Notice, {
1062
+ status: mess.status,
1063
+ key: index,
1064
+ isDismissible: false
1065
+ }, mess.message);
1066
+ }), /*#__PURE__*/React.createElement("style", null, '\
1067
+ .lp-reset-course_progress .components-base-control__field {\
1068
+ margin: 0;\
1069
+ }\
1070
+ .components-notice{\
1071
+ margin-left: 0;\
1072
+ }\
1073
+ .lp-reset-course_progress > div > div{\
1074
+ display: grid;\
1075
+ grid-template-columns: 80px 50px 1fr 80px;\
1076
+ align-items: center;\
1077
+ }\
1078
+ .lp-reset-course_progress > div > div > div{\
1079
+ maegin: 0;\
1080
+ padding: 8px 10px;\
1081
+ }\
1082
+ '));
1083
+ };
1084
+
1085
+ /* harmony default export */ __webpack_exports__["default"] = (ResetCourse);
1086
+
1087
+ /***/ }),
1088
+
1089
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/index.js":
1090
+ /*!*********************************************************************************************************************************************************************************!*\
1091
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/index.js ***!
1092
+ \*********************************************************************************************************************************************************************************/
1093
+ /*! exports provided: default */
1094
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
1095
+
1096
+ "use strict";
1097
+ __webpack_require__.r(__webpack_exports__);
1098
+ /* harmony import */ var _course__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./course */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/admin/pages/tools/reset-data/course.js");
1099
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1100
+
1101
+ 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."); }
1102
+
1103
+ 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); }
1104
+
1105
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1106
+
1107
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1108
+
1109
+ 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; }
1110
+
1111
+
1112
+
1113
+ var resetData = function resetData() {
1114
+ if (document.querySelectorAll('#learn-press-reset-course-users').length > 0) {
1115
+ wp.element.render( /*#__PURE__*/React.createElement(_course__WEBPACK_IMPORTED_MODULE_0__["default"], null), _toConsumableArray(document.querySelectorAll('#learn-press-reset-course-users'))[0]);
1116
+ }
1117
+ };
1118
+
1119
+ /* harmony default export */ __webpack_exports__["default"] = (resetData);
1120
+
1121
+ /***/ }),
1122
+
1123
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js":
1124
  /*!********************************************************************************************************************************************************************!*\
1125
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/handle-ajax-api.js ***!
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=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)}))}});
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}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 a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));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=13)}({13:function(e,t,n){"use strict";n.r(t);var r=jQuery,a=null,l={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&&(a=this.elLPOverlay,this.elMainContent=a.find(".main-content"),this.elTitle=a.find(".modal-title"),this.elBtnYes=a.find(".btn-yes"),this.elBtnNo=a.find(".btn-no"),this.elFooter=a.find(".lp-modal-footer"),r(document).on("click",".close, .btn-no",(function(){a.hide()})),r(document).on("click",".btn-yes",(function(e){e.preventDefault(),e.stopPropagation(),"function"==typeof l.callBackYes&&l.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)}},s=l,o=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()}))},i=jQuery,c=i("#lp-tool-upgrade-db"),u=function(){var e=0,t=c.find(".wrapper-terms-upgrade"),n=c.find(".wrapper-lp-status-upgrade"),r=c.find(".wrapper-lp-upgrade-message"),a=null;if(t.length){s.setContentModal(t.html());var l=s.elLPOverlay.find(".terms-upgrade"),u=l.find("input[name=lp-agree-term]"),d=l.find(".error"),p=i("input[name=message-when-upgrading]").val();a=function(){return d.hide(),d.removeClass("learn-press-message"),u.is(":checked")?(o("/lp/v1/database/agree_terms",{agree_terms:1},{}),s.elFooter.find(".learn-press-notice").remove(),s.elFooter.prepend('<span class="learn-press-notice">'+p+"</span>"),s.setContentModal(n.html()),!0):(d.show(),d.addClass("learn-press-message"),s.elMainContent.animate({scrollTop:d.offset().top}),!1)}}else s.setContentModal(n.html()),a=function(){return!0};s.setTitleModal(c.find("h2").html()),s.elBtnYes.text("Upgrade"),s.elBtnYes.show(),s.elBtnNo.text("close"),s.callBackYes=function(){if(a()){e=1,s.elBtnYes.hide(),s.elBtnNo.hide();var t=s.elLPOverlay.find(".lp-group-step"),n=c.find(".lp-item-step"),l=[];i.each(n,(function(e,t){var n=i(t);if(!n.hasClass("completed")){var r=n.find("input").val();l.push(r)}}));var u={steps:l,step:l[0]},d=null,p=function(e,n){(d=t.find("input[value="+e+"]").closest(".lp-item-step")).addClass("running"),100===n&&d.removeClass("running").addClass("completed"),d.find(".progress-bar").css("width",n+"%"),d.find(".percent").text(n+"%")};p(l[0],.1);var f={success:function(n){var a,l;p(u.step,n.percent),u.step!==n.name&&p(n.name,.1),a=u.step,l=(d=t.find("input[value="+a+"]").closest(".lp-item-step")).offset().top-s.elMainContent.offset().top+s.elMainContent.scrollTop(),s.elMainContent.stop().animate({scrollTop:l},600),"success"===n.status?(u.step=n.name,u.data=n.data,setTimeout((function(){o("/lp/v1/database/upgrade",u,f)}),800)):"finished"===n.status?(e=0,d.removeClass("running").addClass("completed"),setTimeout((function(){s.setContentModal(r.html())}),1e3),s.elFooter.find(".learn-press-notice").remove(),s.elBtnNo.show(),s.elBtnNo.on("click",(function(){window.location.reload()}))):(e=0,s.elFooter.find(".learn-press-notice").remove(),d.removeClass("running").addClass("error"),s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.href="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),n.message||(n.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(n.message)})))},error:function(t){e=0,s.setContentModal(r.html(),(function(){s.elBtnYes.text("Retry").show(),s.callBackYes=function(){window.location.location="wp-admin/admin.php?page=learn-press-tools&tab=database&action=upgrade-db"},s.elBtnNo.show(),t.message||(t.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),s.elMainContent.find(".learn-press-message").addClass("error").html(t.message)}))},completed:function(){}};o("/lp/v1/database/upgrade",u,f)}},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?"}},d=function(){if(c.length&&s.init()){var e=i(".wrapper-lp-status-upgrade"),t=window.location.search,n=new URLSearchParams(t).get("action");"upgrade-db"===n&&(s.elLPOverlay.show(),s.setTitleModal(c.find("h2").html()),s.setContentModal(i(".wrapper-lp-loading").html())),o("/lp/v1/database/get_steps",{},{success:function(t){var r=t.steps_completed,a=t.steps_default;if(void 0===r||void 0===a)return console.log("invalid steps_completed and steps_default"),!1;var l="";for(var o in a){var c=a[o],d=c.steps;for(var p in l='<div class="lp-group-step">',l+="<h3>"+c.label+"</h3>",d){var f=d[p],m="";void 0!==r[p]&&(m="completed"),l+='<div class="lp-item-step '+m+'">',l+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+f.name+'" /></div>',l+='<div class="lp-item-step-right">',l+='<label for=""><strong></strong>'+f.label+"</label>",l+='<div class="description">'+f.description+"</div>",l+='<div class="percent"></div>',l+='<span class="progress-bar"></span>',l+="</div>",l+="</div>"}l+="</div>",e.append(l);var v=i(".lp-btn-upgrade-db");"upgrade-db"===n&&u(),v.on("click",(function(){s.elLPOverlay.show(),u()}))}},error:function(e){},completed:function(){}})}},p=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(s.init()){s.elLPOverlay.show(),s.setContentModal(n.innerHTML),s.setTitleModal(e.querySelector("h2").textContent),s.elBtnYes[0].style.display="inline-block",s.elBtnYes[0].textContent="Run",s.elBtnNo[0].textContent="Close";var r={success:function(e){e.status,e.message;var t=e.data,n=t.tables,r=t.table,a=document.querySelector(".example-lp-group-step");s.setContentModal(a.innerHTML);var l=s.elLPOverlay[0].querySelector(".lp-group-step "),i=function(e,t){var n=l.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 c in n){var u=s.elLPOverlay[0].querySelector(".lp-item-step").cloneNode(!0),d=u.querySelector("input");u.querySelector("label").textContent="Table: ".concat(c),d.value=c,l.append(u)}s.callBackYes=function(){var e="/lp/v1/tools/admin/create-indexs",t={tables:n,table:r};s.elBtnNo[0].style.display="none",s.elBtnYes[0].style.display="none",i(r,.1);var a={success:function(n){var r=n.status,c=n.message,u=n.data,d=u.table,p=u.percent;i(t.table,p),void 0!==d&&(t.table!==d&&(i(d,.1),function(e){var t=l.querySelector("input[value="+e+"]").closest(".lp-item-step");console.log(t.offsetTop,s.elMainContent[0].offsetTop);var n=t.offsetTop-s.elMainContent[0].offsetTop+s.elMainContent[0].scrollTop;s.elMainContent.stop().animate({scrollTop:n},600)}(d)),t.table=d),"success"===r?o(e,t,a):"finished"===r?(console.log("finished"),s.elBtnNo[0].style.display="inline-block",s.elBtnNo[0].textContent="Finish"):console.log(c)},error:function(e){console.log(e)},completed:function(){}};o(e,t,a)}},error:function(e){},completed:function(){}};o("/lp/v1/admin/tools/list-tables-indexs",{},r)}}))},f=function(){var e=document.querySelector("#lp-tool-re-upgrade-db");if(e){var t="lp/v1/database/check-db-valid-re-upgrade";o(t,{},{success:function(n){if(n.data.can_re_upgrade){e.style.display="block";var r=e.querySelector(".lp-btn-re-upgrade-db"),a=e.querySelector(".learn-press-message");r.addEventListener("click",(function(){confirm("Are want Re Upgrade!")&&o(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){}})}};function m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,l=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw l}}}}function v(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(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 h(e,t,n,r,a,l,s){try{var o=e[l](s),i=o.value}catch(e){return void n(e)}o.done?t(i):Promise.resolve(i).then(r,a)}function g(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function s(e){h(l,r,a,s,o,"next",e)}function o(e){h(l,r,a,s,o,"throw",e)}s(void 0)}))}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,a,l=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw a}}return l}(e,t)||b(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 b(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(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 C=wp.i18n.__,x=wp.components,S=x.TextControl,_=x.Button,k=x.Spinner,R=x.CheckboxControl,E=x.Notice,M=wp.element,B=M.useState,T=M.useEffect,P=wp.url.addQueryArgs,L=function(){var e=y(B(!1),2),t=e[0],n=e[1],r=y(B(""),2),a=r[0],l=r[1],s=y(B([]),2),o=s[0],i=s[1],c=y(B([]),2),u=c[0],d=c[1],p=y(B([]),2),f=p[0],h=p[1],b=y(B(!1),2),w=b[0],x=b[1];T((function(){M(a)}),[a]);var M=function(){var e=g(regeneratorRuntime.mark((function e(r){var a,l,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,r&&!t){e.next=5;break}return h([]),i([]),e.abrupt("return");case 5:if(!(r.length<3)){e.next=9;break}return h([{status:"error",message:"Please enter at least 3 characters to searching course."}]),i([]),e.abrupt("return");case 9:return n(!0),e.next=12,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/search-courses",{s:r}),method:"GET"});case 12:a=e.sent,l=a.status,s=a.data,n(!1),"success"===l?(i(s),h([])):(h([{status:"error",message:a.message||"LearnPress: Search Course Fail!"}]),i([])),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.log(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})));return function(t){return e.apply(this,arguments)}}();var L=function(){var e=g(regeneratorRuntime.mark((function e(){var t,n,r,a,l,s,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==u.length){e.next=3;break}return h([{status:"error",message:"Please chooce Course for reset data!"}]),e.abrupt("return");case 3:if(confirm("Are you sure to reset course progress of all users enrolled this course?")){e.next=5;break}return e.abrupt("return");case 5:t=[],e.prev=6,x(!0),n=m(u),e.prev=9,n.s();case 11:if((r=n.n()).done){e.next=20;break}return a=r.value,e.next=15,wp.apiFetch({path:P("lp/v1/admin/tools/reset-data/reset-courses",{courseId:a}),method:"GET"});case 15:l=e.sent,s=l.status,l.data,o=l.message,t.push({status:s,message:o||"Course #".concat(a," reset successfully!")});case 18:e.next=11;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(9),n.e(e.t0);case 25:return e.prev=25,n.f(),e.finish(25);case 28:x(!1),e.next=34;break;case 31:e.prev=31,e.t1=e.catch(6),t.push({status:"error",message:e.t1.message||"LearnPress Error: Reset Course Data."});case 34:h(t);case 35:case"end":return e.stop()}}),e,null,[[6,31],[9,22,25,28]])})));return function(){return e.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement("h2",null,C("Reset course progress","learnpress")),React.createElement("div",{className:"description"},React.createElement("p",null,C("This action will reset progress of a course for all users have enrolled.","learnpress")),React.createElement("p",null,C("Search results only show course have user data.","learnpress")),React.createElement("div",null,React.createElement(S,{placeholder:C("Search course by name","learnpress"),value:a,onChange:function(e){return l(e)},style:{width:300}}))),t&&React.createElement(k,null),o.length>0&&React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-reset-course_progress",style:{border:"1px solid #eee"}},React.createElement("div",null,React.createElement("div",{style:{background:"#eee"}},React.createElement("div",null,React.createElement(R,{checked:u.length===o.length,onChange:function(){u.length===o.length?d([]):d(o.map((function(e){return e.id})))},style:{margin:0}})),React.createElement("div",null,C("ID","learnpress")),React.createElement("div",null,C("Name","learnpress")),React.createElement("div",null,C("Students","learnpress")))),React.createElement("div",{style:{height:"100%",maxHeight:200,overflow:"auto"}},o.map((function(e){return React.createElement("div",{style:{borderTop:"1px solid #eee"},key:e.id},React.createElement("div",null,React.createElement(R,{checked:u.includes(e.id),onChange:function(){return function(e){var t=v(u);if(t.includes(e)){var n=t.indexOf(e);n>-1&&t.splice(n,1)}else t.push(e);d(t)}(e.id)}})),React.createElement("div",null,"#",e.id),React.createElement("div",null,e.title),React.createElement("div",null,e.students))})))),w?React.createElement(k,null):React.createElement(_,{isPrimary:!0,onClick:function(){return L()},style:{marginTop:10,height:30}},C("Reset now","learnpress"))),f.length>0&&f.map((function(e,t){return React.createElement(E,{status:e.status,key:t,isDismissible:!1},e.message)})),React.createElement("style",null,"\t\t\t\t.lp-reset-course_progress .components-base-control__field {\t\t\t\t\tmargin: 0;\t\t\t\t}\t\t\t\t.components-notice{\t\t\t\t\tmargin-left: 0;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div{\t\t\t\t\tdisplay: grid;\t\t\t\t\tgrid-template-columns: 80px 50px 1fr 80px;\t\t\t\t\talign-items: center;\t\t\t\t}\t\t\t\t.lp-reset-course_progress > div > div > div{\t\t\t\t\tmaegin: 0;\t\t\t\t\tpadding: 8px 10px;\t\t\t\t}\t\t\t\t"))};function A(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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}var j,N,q,Y,F,I,D,U,G=function(){document.querySelectorAll("#learn-press-reset-course-users").length>0&&wp.element.render(React.createElement(L,null),A(document.querySelectorAll("#learn-press-reset-course-users"))[0])};j=jQuery,N=j(document),q=!1,Y=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(t.addClass("disabled").html(t.data("installing-text")),j(".lp-install-sample__response").remove(),q=!0,j.ajax({url:t.attr("href"),data:j(".lp-install-sample__options").serializeJSON(),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},F=function(e){e.preventDefault();var t=j(this);q||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(t.addClass("disabled").html(t.data("uninstalling-text")),q=!0,j.ajax({url:t.attr("href"),success:function(e){t.removeClass("disabled").html(t.data("text")),q=!1,j(e).insertBefore(t.parent())},error:function(){t.removeClass("disabled").html(t.data("text")),q=!1,j(response).insertBefore(t.parent())}}))},I=function(e){e.preventDefault();var t=j(this);t.hasClass("disabled")||(t.addClass("disabled").html(t.data("cleaning-text")),j.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(){j.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success:function(e){},error:function(){}})},U=function(e){e.preventDefault(),j(".lp-install-sample__options").toggleClass("hide-if-js")},j((function(){d(),p(),f(),G(),N.on("click",".lp-install-sample__install",Y).on("click",".lp-install-sample__uninstall",F).on("click","#learn-press-clear-cache",I).on("click",'input[name="enable_hard_cache"]',D).on("click",".lp-install-sample__toggle-options",U)}))}});
assets/js/dist/frontend/modal.js CHANGED
@@ -226,7 +226,7 @@ __webpack_require__.r(__webpack_exports__);
226
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/actions.js");
227
  /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/selectors.js");
228
  /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/middlewares.js");
229
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
230
 
231
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
232
 
@@ -309,7 +309,7 @@ function applyMiddlewares(store) {
309
  "use strict";
310
  __webpack_require__.r(__webpack_exports__);
311
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modal", function() { return Modal; });
312
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
313
 
314
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
315
 
226
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/actions.js");
227
  /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/selectors.js");
228
  /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/modal/store/middlewares.js");
229
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
230
 
231
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
232
 
309
  "use strict";
310
  __webpack_require__.r(__webpack_exports__);
311
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modal", function() { return Modal; });
312
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
313
 
314
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
315
 
assets/js/dist/frontend/question-types.js CHANGED
@@ -469,7 +469,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
469
 
470
  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); }
471
 
472
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
473
 
474
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
475
 
@@ -637,7 +637,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
637
 
638
  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); }
639
 
640
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
641
 
642
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
643
 
@@ -757,7 +757,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
757
 
758
  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); }
759
 
760
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
761
 
762
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
763
 
@@ -852,7 +852,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
852
 
853
  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); }
854
 
855
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
856
 
857
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
858
 
@@ -1064,7 +1064,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
1064
 
1065
  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); }
1066
 
1067
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1068
 
1069
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1070
 
@@ -1170,7 +1170,7 @@ __webpack_require__.r(__webpack_exports__);
1170
 
1171
  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); }
1172
 
1173
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1174
 
1175
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1176
 
469
 
470
  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); }
471
 
472
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
473
 
474
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
475
 
637
 
638
  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); }
639
 
640
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
641
 
642
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
643
 
757
 
758
  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); }
759
 
760
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
761
 
762
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
763
 
852
 
853
  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); }
854
 
855
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
856
 
857
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
858
 
1064
 
1065
  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); }
1066
 
1067
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1068
 
1069
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1070
 
1170
 
1171
  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); }
1172
 
1173
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1174
 
1175
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1176
 
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=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}});
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 g(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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}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=g(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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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=ge(e);if(t){var o=ge(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 ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(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 Oe(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})),Oe(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))))})),Oe(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
@@ -106,7 +106,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
106
 
107
  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); }
108
 
109
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
110
 
111
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
112
 
@@ -442,13 +442,13 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
442
 
443
  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); }
444
 
445
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
446
 
447
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
448
 
449
  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; }
450
 
451
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
452
 
453
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
454
 
@@ -1359,7 +1359,7 @@ __webpack_require__.r(__webpack_exports__);
1359
  /* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../buttons/button-hint */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js");
1360
  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); }
1361
 
1362
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1363
 
1364
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1365
 
@@ -1644,7 +1644,7 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
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."); }
1646
 
1647
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1648
 
1649
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1650
 
@@ -1656,7 +1656,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
1656
 
1657
  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; }
1658
 
1659
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1660
 
1661
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1662
 
@@ -1732,7 +1732,7 @@ var Result = function Result() {
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
  };
@@ -2036,7 +2036,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
2036
 
2037
  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; }
2038
 
2039
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2040
 
2041
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2042
 
@@ -2293,7 +2293,7 @@ __webpack_require__.r(__webpack_exports__);
2293
  /* harmony import */ var _learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0__);
2294
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
2295
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
2296
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2297
 
2298
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2299
 
@@ -2309,7 +2309,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
2309
 
2310
  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); }
2311
 
2312
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
2313
 
2314
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2315
 
@@ -2599,7 +2599,7 @@ __webpack_require__.r(__webpack_exports__);
2599
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/actions.js");
2600
  /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/selectors.js");
2601
  /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/middlewares.js");
2602
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2603
 
2604
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2605
 
@@ -2697,13 +2697,13 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
2697
 
2698
  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); }
2699
 
2700
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
2701
 
2702
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2703
 
2704
  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; }
2705
 
2706
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2707
 
2708
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2709
 
@@ -3291,7 +3291,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
3291
 
3292
  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); }
3293
 
3294
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
3295
 
3296
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3297
 
@@ -3394,7 +3394,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
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
 
106
 
107
  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); }
108
 
109
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
110
 
111
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
112
 
442
 
443
  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); }
444
 
445
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
446
 
447
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
448
 
449
  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; }
450
 
451
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
452
 
453
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
454
 
1359
  /* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../buttons/button-hint */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js");
1360
  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); }
1361
 
1362
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1363
 
1364
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1365
 
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."); }
1646
 
1647
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1648
 
1649
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1650
 
1656
 
1657
  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; }
1658
 
1659
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1660
 
1661
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1662
 
1732
  var updateItemsProgress = function updateItemsProgress() {
1733
  var elements = document.querySelectorAll('.popup-header__inner');
1734
 
1735
+ if (elements.length > 0 && 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
  };
2036
 
2037
  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; }
2038
 
2039
+ function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
2040
 
2041
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2042
 
2293
  /* harmony import */ var _learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0__);
2294
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
2295
  /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
2296
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2297
 
2298
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2299
 
2309
 
2310
  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); }
2311
 
2312
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2313
 
2314
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2315
 
2599
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/actions.js");
2600
  /* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/selectors.js");
2601
  /* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/quiz/store/middlewares.js");
2602
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2603
 
2604
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2605
 
2697
 
2698
  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); }
2699
 
2700
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2701
 
2702
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2703
 
2704
  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; }
2705
 
2706
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2707
 
2708
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2709
 
3291
 
3292
  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); }
3293
 
3294
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3295
 
3296
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3297
 
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" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3398
 
3399
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
3400
 
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=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,con