'+imagifyPricingModal.labels.errorPriceAPI+"
");else{if((k.imagify_discount_datas=a).is_active){if(a.applies_to instanceof Array){for(var d=[],g=[],y=0;yBest Value!')},100)),0===e.ot.length?(b(".imagify-pre-checkout-offers .imagify-offer-onetime").remove(),b(".imagify-tabs").remove(),b(".imagify-pricing-tab-onetime").remove()):b.each(e.ot,function(i,a){var e="";i===u.ot.index&&(i=b(".imagify-pre-checkout-offers .imagify-offer-onetime"),u.ot.selected&&(e=" imagify-offer-selected",i.addClass("imagify-offer-selected").find(".imagify-checkbox").prop("checked",!0)),_.populateOffer(i,a,"onetime")),i=b(n).clone(),i=_.populateOffer(i,a,"onetime",e),m+=i[0].outerHTML}),a&&(((p=_.getPromoAppliesTo(a)).includes(u.mo.plan_label)||p.includes(u.ot.plan_label)||"all"===p[0])&&b("#imagify-coupon-code").val(a.label),a.is_active)&&_.checkCoupon(),t.parent().find(".imagify-offer-line")&&t.parent().find(".imagify-offer-line").remove(),t.before(r),o.parent().find(".imagify-offer-line")&&o.parent().find(".imagify-offer-line").remove(),o.before(m)}_.$modal.find(".imagify-modal-loader").fadeOut(300),_.$modal.removeClass("imagify-modal-loading")}})}),_.populatePayBtn()})},getSuggestedOffers:function(i,e,t){var o,n,a,l,s,f,c=e.total+e.month,m={quota:0},r={mo:!1,ot:!1};return i.ot.length<0&&(a=i.ot[i.ot.length-1].id,l=i.ot[i.ot.length-1].label),i.ot.length<0&&(s=i.mo[i.mo.length-1].id,f=i.mo[i.mo.length-1].label),b.each(i.mo,function(i,a){return a.quota<0&&(n={index:i,selected:1,plan_id:a.id,plan_label:a.label}),a.quota>m.quota&&(m={index:i,selected:1,quota:a.quota,plan_id:a.id,plan_label:a.label}),0===a.monthly_cost&&0===a.annual_cost||a.quota<=0&&e.month>a.quota||e.total>a.quota||0<=a.quota&&e.montha.quota)&&(o=a,r.mo={index:i,selected:t>e.month&&t>e.total?0:1,plan_id:a.id,plan_label:a.label}),!0}),!1===r.mo&&(r.mo=void 0!==n?n:m),c-=i.mo[r.mo.index].quota,0!==i.ot.length&&(c<=0?(b.each(i.ot,function(i,a){return a.quota'+e.find(".imagify-price-by").text()+"",c=e.find(".imagify-price-discount").html(),m=e.find(".imagify-approx-nb").text(),r=e.find(".imagify-offer-size").text(),d=b("#imagify-coupon-code");i.preventDefault(),_.switchToView(_.$preView),l.find(".imagify-number-block").html(s+f),c?(l.find(".imagify-price-discount").length<=0&&l.find(".imagify-col-price").prepend(''),l.find(".imagify-price-discount").html(c),l.find(".imagify-price-discount").show()):l.find(".imagify-price-discount").hide(),l.find(".imagify-approx-nb").text(m),l.find(".imagify-offer-size").text(r),l.attr("data-offer",o),n||(l.find(".imagify-price-add-data").text(e.find(".imagify-price-add-data").text()),("monthly"===a?l.find("#imagify-subscription-monthly"):l.find("#imagify-subscription-yearly")).trigger("click.imagify"),l.find(".imagify-inline-options").find("input:radio:checked").trigger("change.imagify")),(d=b("#imagify-coupon-code")).val(""),k.imagify_discount_datas&&((i=_.getPromoAppliesTo(k.imagify_discount_datas)).includes(t[Object.keys(t)[0]].label)||"all"===i[0])&&d.val(k.imagify_discount_datas.label),_.checkCoupon(),_.populatePayBtn()}),b("#imagify-modal-checkout-btn").on("click.imagify",function(i){var a,e;i.preventDefault(),b(this).hasClass("imagify-button-disabled")||(i=b(".imagify-offer-monthly"),a=b(".imagify-offer-onetime"),e={},i.hasClass("imagify-offer-selected")&&(e.monthly=JSON.parse(i.attr("data-offer"))),a.hasClass("imagify-offer-selected")&&(e.onetime=JSON.parse(a.attr("data-offer"))),imagifyPricingModal.userDataCache&&b.post(ajaxurl,{action:imagifyPricingModal.userDataCache.deleteAction,_wpnonce:imagifyPricingModal.userDataCache.deleteNonce}),_.switchToView(_.$paymentView),e.period=_.getPeriod(),_.iframeSetSrc(e))}),b(".imagify-back-to-plans").on("click.imagify",function(i){var a=b(this).closest(".imagify-cart-item").hasClass("imagify-cart-item-onetime");i.preventDefault(),b(a?".imagify-offer-onetime":".imagify-offer-monthly").find(".imagify-choose-another-plan").trigger("click.imagify")}),k.addEventListener("message",_.checkPluginMessage,!0))})(jQuery,document,window);