var LLMS=window.LLMS||{};!function(t){"use strict";LLMS.Achievements={init:function(){if(t(".llms-achievement").length){var e=this;t(function(){e.bind(),e.maybe_open()})}},bind:function(){var e=this;t(".llms-achievement").each(function(){e.create_modal(t(this))}),t(".llms-achievement").on("click",function(){var n=t(this),i="achievement-"+n.attr("data-id"),s=t("#"+i);s.length||e.create_modal(n),s.iziModal("open")})},create_modal:function(e){var n="achievement-"+e.attr("data-id"),i=t("#"+n);i.length||(i=t('
'),t("body").append(i)),i.iziModal({headerColor:"#3a3a3a",group:"achievements",history:!0,loop:!0,overlayColor:"rgba( 0, 0, 0, 0.6 )",transitionIn:"fadeInDown",transitionOut:"fadeOutDown",width:340,onOpening:function(t){t.setTitle(e.find(".llms-achievement-title").html()),t.setSubtitle(e.find(".llms-achievement-date").html()),t.setContent('
'+e.html()+"
")},onClosing:function(){window.history.pushState("",document.title,window.location.pathname+window.location.search)}})},maybe_open:function(){var e=window.location.hash;e&&-1!==e.indexOf("achievement-")&&t('a[href="'+e+'"]').first().trigger("click")}},LLMS.Ajax={url:window.ajaxurl||window.llms.ajaxurl,type:"post",data:[],cache:!1,dataType:"json",async:!0,response:[],init:function(e){if(null===e||"object"!=typeof e)return!1;e.url="url"in e?e.url:this.url,e.type="type"in e?e.type:this.type,e.data="data"in e?e.data:this.data,e.cache="cache"in e?e.cache:this.cache,e.dataType="dataType"in e?e.dataType:this.dataType,e.async="async"in e?e.async:this.async,e.data._ajax_nonce=window.llms.ajax_nonce||wp_ajax_data.nonce;var n=LLMS.Rest,i=n.get_query_vars();return e.data.post_id="post"in i?i.post:null,!e.data.post_id&&t("input#post_ID").length&&(e.data.post_id=t("input#post_ID").val()),e},call:function(t){var e=this.init(t);return!!e&&(this.request(e),this)},request:function(e){return t.ajax(e),this}},LLMS.Donut=function(e){function n(e){this.settings=t.extend({element:e.element,percent:100},e),this.circle=this.settings.element.find("path"),this.settings.stroke_width=parseInt(this.circle.css("stroke-width")),this.radius=(parseInt(this.settings.element.css("width"))-this.settings.stroke_width)/2,this.angle=t("body").hasClass("rtl")?82.5:97.5,this.i=Math.round(.75*this.settings.percent),this.first=!0,this.increment=t("body").hasClass("rtl")?-5:5,this.animate=function(){this.timer=setInterval(this.loop.bind(this),10)},this.loop=function(){this.angle+=this.increment,this.angle%=360;var t,e=this.angle/180*Math.PI,n=this.radius+this.settings.stroke_width/2+Math.cos(e)*this.radius,i=this.radius+this.settings.stroke_width/2+Math.sin(e)*this.radius;this.first===!0?(t=this.circle.attr("d")+" M "+n+" "+i,this.first=!1):t=this.circle.attr("d")+" L "+n+" "+i,this.circle.attr("d",t),this.i--,this.i<=0&&clearInterval(this.timer)}}function i(t){var e='';t.append(''+e+"");var i=new n({element:t,percent:t.attr("data-perc")});i.animate()}i(e)},LLMS.Instructors={init:function(){var e=this;t("body").hasClass("wp-admin")||t(".llms-instructors").length&&LLMS.wait_for_matchHeight(function(){e.bind()})},bind:function(){t(".llms-instructors .llms-author").matchHeight()}},LLMS.l10n=LLMS.l10n||{},LLMS.l10n.translate=function(t){var e=this;return e.strings[t]?e.strings[t]:t},LLMS.l10n.replace=function(e,n){var i=this.translate(e);return t.each(n,function(t,e){-1!==t.indexOf("s")?e=e.toString():-1!==t.indexOf("d")&&(e=1*e),i=i.replace(t,e)}),i},LLMS.LessonPreview={$els:null,init:function(){var e=this;this.$locked=t('a[href="#llms-lesson-locked"]'),this.$locked.length&&e.bind(),t(".llms-course-navigation").length&&LLMS.wait_for_matchHeight(function(){e.match_height()})},bind:function(){var e=this;this.$locked.on("click",function(){return!1}),this.$locked.on("mouseenter",function(){var n=t(this).find(".llms-tooltip");if(!n.length){var i=t(this).attr("data-tooltip-msg");i||(i=LLMS.l10n.translate("You do not have permission to access this content")),n=e.get_tooltip(i),t(this).append(n)}setTimeout(function(){n.addClass("show")},10)}),this.$locked.on("mouseleave",function(){var e=t(this).find(".llms-tooltip");e.removeClass("show")})},match_height:function(){t(".llms-course-navigation .llms-lesson-link").matchHeight()},get_tooltip:function(e){var n=t('
');return n.append('
'+e+"
"),n}},LLMS.Loops={init:function(){var e=this;t(".llms-loop").length&&LLMS.wait_for_matchHeight(function(){e.match_height()})},match_height:function(){t(".llms-loop-item .llms-loop-item-content").matchHeight(),t(".llms-achievement-loop-item .llms-achievement").matchHeight(),t(".llms-certificate-loop-item .llms-certificate").matchHeight()}},LLMS.OutlineCollapse={$outlines:null,init:function(){this.$outlines=t(".llms-widget-syllabus--collapsible"),this.$outlines.length&&this.bind()},bind:function(){var e=this;this.$outlines.each(function(){var n=t(this),i=n.find(".llms-section .section-header");i.on("click",function(n){n.preventDefault();var i=t(this),s=i.closest(".llms-section"),o=e.get_section_state(s);switch(o){case"closed":e.open_section(s);break;case"opened":e.close_section(s)}}),n.find(".llms-collapse-toggle").on("click",function(n){n.preventDefault();var s=t(this),o=s.attr("data-action"),r="close"===o?"opened":"closed";i.each(function(){var n=t(this).closest(".llms-section"),i=e.get_section_state(n);if(r!==i)return!0;switch(i){case"closed":e.close_section(n);break;case"opened":e.open_section(n)}t(this).trigger("click")})})})},close_section:function(t){t.removeClass("llms-section--opened").addClass("llms-section--closed")},open_section:function(t){t.removeClass("llms-section--closed").addClass("llms-section--opened")},get_section_state:function(t){return t.hasClass("llms-section--opened")?"opened":"closed"}},t.extend(LLMS.PasswordStrength,{$pass:t(".llms-password"),$conf:t(".llms-password-confirm"),$meter:t(".llms-password-strength-meter"),$form:null,init:function(){if(!t("body").hasClass("wp-admin")&&this.$meter.length){this.$form=this.$pass.closest("form");var e,n=this,i=0;e=setInterval(function(){if(i>=300)console.log("cannot do password strength meter.");else{if("undefined"==typeof wp&&"undefined"==typeof wp.passwordStrength)return void i++;n.bind(),n.$form.trigger("llms-password-strength-ready")}clearInterval(e)},100)}},bind:function(){var t=this;this.$form.hasClass("llms-checkout")||this.$form.on("submit",t,t.submit),t.$pass.add(t.$conf).on("keyup",function(){t.check_strength()})},check_strength:function(){var t=this.$pass.closest(".llms-form-field"),e=this.$conf.closest(".llms-form-field"),n=this.$pass.val().length,i=this.$conf.val().length;return n||i?(this.get_current_strength_status()?(t.removeClass("invalid").addClass("valid"),i&&e.removeClass("invalid").addClass("valid")):(t.removeClass("valid").addClass("invalid"),i&&e.removeClass("valid").addClass("invalid")),this.$meter.removeClass("too-short very-weak weak medium strong mismatch"),this.$meter.show().addClass(this.get_current_strength("slug")),void this.$meter.html(this.get_current_strength("text"))):(t.removeClass("valid invalid"),e.removeClass("valid invalid"),void this.$meter.hide())},checkout:function(t,e){e(t.get_current_strength_status()?!0:LLMS.l10n.translate("There is an issue with your chosen password."))},get_blacklist:function(){var t=wp.passwordStrength.userInputBlacklist();return t},get_current_strength:function(t){t=t||"int";var e,n=this.$pass.val(),i=this.$conf.val();return n.length<6?e=-1:(e=wp.passwordStrength.meter(n,this.get_blacklist(),i),0===e&&(e=1)),"slug"===t?this.get_strength_slug(e):"text"===t?this.get_strength_text(e):e},get_current_strength_status:function(){var t=this.get_current_strength(),e=this.get_strength_value(this.get_minimum_strength());return 5!==t&&t>=e},get_strength_slug:function(t){var e={"-1":"too-short",1:"very-weak",2:"weak",3:"medium",4:"strong",5:"mismatch"};return e[t]?e[t]:e[5]},get_strength_text:function(t){var e={"-1":LLMS.l10n.translate("Too Short"),1:LLMS.l10n.translate("Very Weak"),2:LLMS.l10n.translate("Weak"),3:LLMS.l10n.translate("Medium"),4:LLMS.l10n.translate("Strong"),5:LLMS.l10n.translate("Mismatch")};return e[t]?e[t]:e[5]},get_strength_value:function(t){var e={"too-short":-1,"very-weak":1,weak:2,medium:3,strong:4,mismatch:5};return e[t]?e[t]:e.mismatch},submit:function(e){var n=e.data;e.preventDefault(),n.$pass.trigger("keyup"),n.get_current_strength_status()?(n.$form.off("submit",n.submit),n.$form.trigger("submit")):(t("html, body").animate({scrollTop:n.$meter.offset().top-100},200),n.$meter.hide(),setTimeout(function(){n.$meter.fadeIn(400)},220))}}),LLMS.Pricing_Tables={init:function(){var e=this;t("body").hasClass("wp-admin")||t(".llms-access-plans").length&&(LLMS.wait_for_matchHeight(function(){e.bind()}),this.$locked=t('a[href="#llms-plan-locked"]'),this.$locked.length&&LLMS.wait_for_popover(function(){e.bind_locked()}))},bind:function(){t(".llms-access-plan-content").matchHeight(),t(".llms-access-plan-pricing.trial").matchHeight()},bind_locked:function(){this.$locked.each(function(){t(this).webuiPopover({animation:"pop",closeable:!0,content:function(e){var n=t('
');return n.append(e.$element.closest(".llms-access-plan").find(".llms-access-plan-restrictions ul").clone()),n},placement:"top",style:"inverse",title:LLMS.l10n.translate("Members Only Pricing"),width:"280px"})})}},LLMS.Review={init:function(){this.bind()},bind:function(){t("#llms_review_submit_button").click(function(){""!==t("#review_title").val()&&""!==t("#review_text").val()?jQuery.ajax({type:"post",dataType:"json",url:window.llms.ajaxurl,data:{action:"LLMSSubmitReview",review_title:t("#review_title").val(),review_text:t("#review_text").val(),pageID:t("#post_ID").val()},success:function(){console.log("Review success"),t("#review_box").hide("swing"),t("#thank_you_box").show("swing")},error:function(t,e,n){console.log(t),console.log(e),console.log(n)}}):(""===t("#review_title").val()?t("#review_title_error").show("swing"):t("#review_title_error").hide("swing"),""===t("#review_text").val()?t("#review_text_error").show("swing"):t("#review_text_error").hide("swing"))}),t("#_llms_display_reviews").attr("checked")?(t(".llms-num-reviews-top").addClass("top"),t(".llms-num-reviews-bottom").show()):t(".llms-num-reviews-bottom").hide(),t("#_llms_display_reviews").change(function(){t("#_llms_display_reviews").attr("checked")?(t(".llms-num-reviews-top").addClass("top"),t(".llms-num-reviews-bottom").show()):(t(".llms-num-reviews-top").removeClass("top"),t(".llms-num-reviews-bottom").hide())})}},LLMS.Spinner={get:function(e,n){var i=e.find(".llms-spinning").first();return i.length||(n=n?n:"default",i=t('
'),e.append(i)),i},start:function(e,n){var i=this;e.each(function(){i.get(t(this),n).show()})},stop:function(e){var n=this;e.each(function(){n.get(t(this)).hide()})}},function(t){var e;if("function"==typeof define&&define.amd&&(define(t),e=!0),"object"==typeof exports&&(module.exports=t(),e=!0),!e){var n=window.Cookies,i=window.Cookies=t();i.noConflict=function(){return window.Cookies=n,i}}}(function(){function t(){for(var t=0,e={};ta.get("events",[]).length){var s=a.getAll();a.clear("events"),s.events.push(t),LLMS.Ajax.call({data:{action:"persist_tracking_events","llms-tracking":JSON.stringify(s)},error:function(t,e,n){console.log(t,e,n)},success:function(t){"error"===t.code&&console.log(t.code,t.message)}})}}},this.getSettings=function(){return e},this.makeEventObj=function(e){return t.extend(e,{url:window.location.href,time:Math.round((new Date).getTime()/1e3)})},t("body").hasClass("wp-admin")||n()},llms.tracking=new LLMS.Tracking(llms.tracking),LLMS.Rest={init:function(){this.bind()},bind:function(){},is_path:function(t){for(var e=!1,n=window.location.href,i=0;i0&&!e&&(e=!0);return e},get_query_vars:function(){for(var t,e=[],n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),i=0;i=300)console.log("could not load dependency");else{if(!t())return console.log("waiting..."),void i++;e()}clearInterval(n)},100)},LLMS.init(t)}(jQuery); //# sourceMappingURL=../maps/js/llms.min.js.map