"use strict";var appstleInit=function appstleInit(){var _RS3,_window50,_window51,_RS12,head=document.getElementsByTagName("head")[0],startingTime=(new Date).getTime();function logger(e){var n;null!=(n=RS)&&null!=(n=n.Config)&&n.debugLogsEnabled&&(n="- "+e,console.group("%c Appstle Subscription Widget Log.","display:inline-block; font-size: 14px; padding: 5px; background: linear-gradient(to right, #141B32, #00D9CC); color:#FFFFFF; border-radius: 5px;"),console.log("%c ".concat(n),"font-size: 13px;"),console.groupEnd())}window.appstleLoadScript=function(e,n,t){var i,l,a=document.createElement("script");a.type=n||"text/javascript",a.readyState?a.onreadystatechange=function(){"loaded"!=a.readyState&&"complete"!=a.readyState||(a.onreadystatechange=null,t&&t())}:a.onload=function(){t&&t()};try{null!=(i=RS)&&null!=(i=i.Config)&&i.debugLogsEnabled&&2===(null==(l=document.querySelectorAll("#subscription-helper"))?void 0:l.length)&&logger("There might be a V1 script available. Please check the view page source. If it exists (#subscription-helper), then remove it from the theme file.")}catch(e){}a.src=e,a.defer=!0,head.appendChild(a)},null!=(_RS3=RS)&&null!=(_RS3=_RS3.Config)&&_RS3.disableLoadingJquery||appstleLoadScript("https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js","text/javascript",function(){window.appstle_jQuery=jQuery.noConflict(!0)}),appstleLoadScript("https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js","module"),window.DOMPurify||appstleLoadScript("https://cdn.jsdelivr.net/npm/dompurify/dist/purify.min.js","text/javascript",function(){console.log("DOM Purify Loaded")});var purifyConfig={ALLOWED_TAGS:["style"],ALLOWED_ATTR:["style"]},mustacheScript,checkReady=("undefined"==typeof Mustache&&(mustacheScript=document.createElement("script"),mustacheScript.src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.1.0/mustache.js",mustacheScript.type="text/javascript",head.appendChild(mustacheScript)),function e(n){var t;(null!=(t=RS)&&null!=(t=t.Config)&&t.disableLoadingJquery?window.jQuery:window.appstle_jQuery)&&window.Mustache&&window.Shopify&&window.DOMPurify?n(null!=(t=RS)&&null!=(t=t.Config)&&t.disableLoadingJquery?window.jQuery:window.appstle_jQuery):window.setTimeout(function(){e(n)},20)}),urlParams=new URLSearchParams(window.location.search),globalUrlParameter=urlParams.get("variant"),destination,message;function getOrderSellingPlanIds(){return Shopify.checkout.line_items.map(function(e){return e.selling_plan_id})}function isOrderEligibleForThankyouBox(){var e=getOrderSellingPlanIds(),t=!1;return e.length&&e.forEach(function(n){var e;null!=(e=RS)&&null!=(e=e.Config)&&e.sellingPlansJson.filter(function(e){e.id.includes(n)&&(t=!0)})}),t}checkReady(function($){var jQuery=$;$(function(){var _RSConfig2,_window21,_RSConfig91,_jQuery8,_window30,_RSConfig$product$sel,_RSConfig102,_RSConfig103,_RSConfig104,_RSConfig105,_RSConfig106,_window32,_window33,_window34,_window35,endingTime=(new Date).getTime(),tookTime=endingTime-startingTime,_RSConfig88,_RSConfig89;function renderWidget(standAloneProduct,standAloneElement,widgetId){var _RSConfig77,product,localVariantsByTitle,localVariantsById,localWindowVariant,widgetLabels,Selling_Plan_Variants_Global,appstleSubscriptionFunction,_RSConfig78,_jQuery$parents3,_RSConfig79,_RSConfig80,_RSConfig81,atcButtonSelector,atcButton,_targetNode,config1,callback,_observer;function processProductVariants(e){if(e){for(var n=e.variants,t={},i={},l=0;l<n.length;l++){var a=n[l];t[a.title]=Object.assign({},a),i[a.id]=Object.assign({},a)}RSConfig.variantsByTitle=t,RSConfig.variantsById=i}}function detectVariant(e,n,t){var i=urlParam("variant");if(!urlIsProductPage()&&null!=(l=RSConfig)&&l.detectVariantFromURLParams&&logger("If widget is not working properly, try turning off 'Detect variant from URL params'."),i&&null!=(l=RSConfig)&&l.detectVariantFromURLParams)return localVariantsById[i];var l,a=n.closest('form[action$="/cart/add"]').find("[name=id]");if(0<a.length)for(var s=0;s<a.length;s++)if(a[s].value&&jQuery(a[s]).is(":checked"))return i=a[s].value,localVariantsById[i];return 0<n.closest('form[action$="/cart/add"]').find("[name=id]").length&&n.closest('form[action$="/cart/add"]').find("[name=id]").val()?(i=n.closest('form[action$="/cart/add"]').find("[name=id]").val(),localVariantsById[i]):null!=(l=jQuery("[name=id][form=".concat(n.closest('form[action$="/cart/add"]').attr("id"),"]")))&&l.val()?(i=null==(l=jQuery("[name=id][form=".concat(n.closest('form[action$="/cart/add"]').attr("id"),"]")))?void 0:l.val(),localVariantsById[i]):null!=(l=RSConfig)&&l.widgetParentSelector&&0<n.closest(null==(l=RSConfig)?void 0:l.widgetParentSelector).find("[name=id]").length&&n.closest(null==(l=RSConfig)?void 0:l.widgetParentSelector).find("[name=id]").val()||n.parents("html").find('form[action$="/cart/add"]').find("[name=id]").length&&null!=(l=n.parents("html").find('form[action$="/cart/add"]').find("[name=id]")[0])&&l.value?(i=n.closest(null==(l=RSConfig)?void 0:l.widgetParentSelector).find("[name=id]").val()||(null==(l=n.parents("html").find('form[action$="/cart/add"]').find("[name=id]")[0])?void 0:l.value),localVariantsById[i]):i?localVariantsById[i]:Object.values(localVariantsById).some(function(e){return(null==e?void 0:e.title)==(null==(e=$("form select[name='options[Bundle]']"))?void 0:e.val())})?Object.values(localVariantsById).find(function(e){return(null==e?void 0:e.title)==$("select[name='options[Bundle]']").val()}):(l=[],null!=(n=n.closest('form[action$="/cart/add"]').find("select.single-option-selector"))&&null!=n.selectedIndex&&-1!==n.selectedIndex?l.push(n[n.selectedIndex].value):l.push(void 0),localVariantsByTitle[l.join(" / ")]||t.variants[0])}function getSellingPlanAllocation(e,n){var e=localVariantsById[e];return null==e||null==(e=e.selling_plan_allocations)?void 0:e.find(function(e){return(null==e?void 0:e.selling_plan_id)===n})}function compareCustomerTags(e,n){return e.filter(function(e){return-1!=n.indexOf(e)})}function isSellingPlanVisible(e){var n=null==(n=RSConfig)?void 0:n.customerId,t=RSConfig.customer_tags||[],i=!0;return!n&&RSConfig.memberOnlySellingPlansJson&&RSConfig.memberOnlySellingPlansJson[e]&&RSConfig.memberOnlySellingPlansJson[e].enableMemberInclusiveTag&&(i=!1),(i=(i=n&&RSConfig.nonMemberOnlySellingPlansJson&&RSConfig.nonMemberOnlySellingPlansJson[e]?!1:i)&&n&&RSConfig.memberOnlySellingPlansJson&&RSConfig.memberOnlySellingPlansJson[e]&&(RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags&&RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags.trim()&&(i=0<compareCustomerTags(t,RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags.split(",")).length),RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags)&&RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags.trim()?!(0<compareCustomerTags(t,RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags.split(",").map(function(e){return e.trim()})).length):i)||logger("There is specific tag configured for this product page(Like,Gold Members.) because of that the widget will be only visible to that specific user"),i}function buildSellingPlantText(e){var n=e.totalPrice==e.formattedPrice?{sellingPlanName:e.name,sellingPlanPrice:'<span class="transcy-money">'.concat(e.formattedPrice,"</span>"),secondSellingPlanPrice:'<span class="transcy-money">'.concat(e.secondFormattedPrice||e.secondSellingPlanPrice,"</span>"),discountText:null==e?void 0:e.discountText,totalPrice:'<span class="transcy-money">'.concat(null==e?void 0:e.totalPrice,"</span>")}:{sellingPlanName:e.name,totalPrice:'<span class="transcy-money">'.concat(null==e?void 0:e.totalPrice,"</span>"),sellingPlanPrice:'<span class="transcy-money">'.concat(e.formattedPrice,"</span>"),secondSellingPlanPrice:'<span class="transcy-money">'.concat(e.secondFormattedPrice,"</span>"),discountText:e.discountText};return wrapPriceWithSpanTag(Mustache.render((null==e||!e.prepaidFlag)&&widgetLabels["appstle.subscription.wg.sellingPlanTitleTextNonPrepaid"]||RS.Config.sellingPlanTitleText,n))}function buildAtcButtonSelector(){var e=RSConfig.atcButtonSelector||"form[action$='/cart/add'] [type='submit']",n={productId:product.id},e=Mustache.render(e,n);return DOMPurify.sanitize(e)}function buildOneTimePriceText(e){e={price:e,showOneTimeComparePrice:RS.Config.showOneTimeComparePrice};return wrapPriceWithSpanTag(Mustache.render(RS.Config.oneTimePriceText,e))}function buildSubscriptionOptionText(e,n,t,i,l){return wrapPriceWithSpanTag(Mustache.render(RS.Config.subscriptionOptionText,{discountValue:n,frequency:t,price:i,groupName:l}))}function buildSelectedPriceText(e,n,t,i,l){var a=n?RS.Config.selectedPrepaidSellingPlanPriceText:RS.Config.selectedPayAsYouGoSellingPlanPriceText;return wrapPriceWithSpanTag(Mustache.render(a,n?{pricePerDelivery:e,totalPrice:t}:{price:e,secondPrice:l?i:e}))}function buildPrepaidPerDeliveryPriceText(e){return wrapPriceWithSpanTag(Mustache.render(RS.Config.totalPricePerDeliveryText,{prepaidPerDeliveryPrice:e}))}function buildPayAsYouGoPriceText(e){return wrapPriceWithSpanTag(Mustache.render(RS.Config.selectedPayAsYouGoSellingPlanPriceText,{price:e}))}function buildSelectedTooltipPrePaidText(e,n){var t=RS.Config.tooltipDescriptionOnPrepaidPlan;return wrapPriceWithSpanTag(Mustache.render(t,{pricePerDelivery:e,totalPrice:n}))}function buildSelectedTooltipDiscountText(e,n){var t;if(2==(null==e||null==(t=e.price_adjustments)?void 0:t.length))return e={firstPrice:formatPriceWithQuantity(null==e||null==(t=e.price_adjustments[0])?void 0:t.price),secondPrice:formatPriceWithQuantity(null==e||null==(t=e.price_adjustments[1])?void 0:t.price),discountOne:0<(null==n?void 0:n.length)?n[0]:"",discountTwo:2==(null==n?void 0:n.length)?n[1]:""},wrapPriceWithSpanTag(Mustache.render(RS.Config.tooltipDescriptionOnMultipleDiscount,e))}function buildTooltipDetailsText(e,n,t){n=n?{prepaidDetails:e,discountDetails:t,defaultTooltipDescription:RS.Config.tooltipDesctiption}:{defaultTooltipDescription:RS.Config.tooltipDesctiption,discountDetails:t},e=RS.Config.tooltipDescriptionCustomization;return wrapPriceWithSpanTag(Mustache.render(e,n))}function populateDropdown(purchaseOptions,variant,isPrepaidDropdown,selectedSellingPlan,selectedPayAsYouGoPlan,selectedPrepaidPlan){var sellingPlanVariants=[],validSellingPlanCounter=0,_sellingPlanVariants,_RSConfig11,_RSConfig12,_RSConfig13,_RSConfig14,_RSConfig15,_RSConfig17,_sellingPlanVariants$,_sellingPlanVariants$2,singleSellingPlanDisplayText,planText,_sellingPlanVariants$3,_sellingPlanVariants$4,_sellingPlanVariants$5,_sellingPlanVariants$6,_sellingPlanVariants2;if(jQuery.each(product.selling_plan_groups,function(index,sellingPlanGroup){"appstle"===sellingPlanGroup.app_id&&jQuery.each(sellingPlanGroup.selling_plans,function(subIndex,sellingPlan){var visible=isSellingPlanVisible(sellingPlan.id),_RS6,_sellingPlanDetails$f,sellingPlanAllocation,price,totalPrice,formattedPrice,compareAtPrice,formattedCompareAtPrice,secondPrice,secondFormattedPrice,discountText,secondFormattedPrice,priceAdjustment,discountText,jsonOfSellingPlans,sellingPlanFrequency,sellingPlanFrequencyText,sellingPlanDetails,details,daysInBillingFrequency,totalDaysInBillingFrequency,sellingPlanFrequencyType;visible&&(sellingPlanAllocation=getSellingPlanAllocation(variant.id,sellingPlan.id),sellingPlanAllocation)&&(validSellingPlanCounter++,price=sellingPlanAllocation.per_delivery_price,totalPrice=formatPrice(null==sellingPlanAllocation?void 0:sellingPlanAllocation.price),formattedPrice=formatPrice(price),compareAtPrice=sellingPlanAllocation.compare_at_price,formattedCompareAtPrice="",compareAtPrice&&(formattedCompareAtPrice=formatPrice(compareAtPrice)),secondPrice=null,secondFormattedPrice=null,secondFormattedPrice=sellingPlanAllocation&&sellingPlanAllocation.price_adjustments&&2===sellingPlanAllocation.price_adjustments.length?(secondPrice=sellingPlanAllocation.price_adjustments[1].price,formatPrice(secondPrice)):(secondPrice=price,formattedPrice),priceAdjustment=null==sellingPlan?void 0:sellingPlan.price_adjustments[0],discountText="percentage"!==(null==priceAdjustment?void 0:priceAdjustment.value_type)?formatPrice(null==priceAdjustment?void 0:priceAdjustment.value):(null==priceAdjustment?void 0:priceAdjustment.value)+"%",jsonOfSellingPlans=null==(_RS6=RS)||null==(_RS6=_RS6.Config)?void 0:_RS6.sellingPlansJson,null!=jsonOfSellingPlans&&jsonOfSellingPlans.length&&(sellingPlanFrequency=null==jsonOfSellingPlans?void 0:jsonOfSellingPlans.find(function(e){return(null==e||null==(e=e.id)||null==(e=e.split("/"))?void 0:e.pop())==sellingPlan.id}),"MONTH"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1<(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)+" "+DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.monthsFrequencyTextV2"])),"MONTH"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.monthlyLabelTextV2"])),"WEEK"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1<(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)+" "+DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.weeksFrequencyTextV2"])),"WEEK"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.weeklyLabelTextV2"])),"DAY"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1<(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)+" "+DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.daysFrequencyTextV2"])),"DAY"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.dayFrequencyTextV2"])),"YEAR"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval)&&1<(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)+" "+DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.yearsFrequencyTextV2"])),"YEAR"===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.frequencyInterval))&&1===(null==sellingPlanFrequency?void 0:sellingPlanFrequency.billingFrequencyCount)&&(sellingPlanFrequencyText=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.yearlyLabelTextV2"])),sellingPlanDetails={name:sellingPlan.name,description:sellingPlan.description,sellingPlanId:sellingPlan.id,formattedPrice:buildPayAsYouGoPriceText(formattedPrice),compareAtPrice:compareAtPrice,formattedCompareAtPrice:formattedCompareAtPrice,price:price,isFreeTrial:!price,totalPrice:totalPrice,secondPrice:secondPrice,secondSellingPlanPrice:secondFormattedPrice,sellingPlanFrequencyText:DOMPurify.sanitize(sellingPlanFrequencyText),discountText:null!=priceAdjustment&&priceAdjustment.value?discountText:null,formattedDiscountText:null!=priceAdjustment&&priceAdjustment.value?buildDiscountText(discountText):"",showFormattedDiscountText:!(null==priceAdjustment||!priceAdjustment.value),isChecked:!1,formattedPrepaidPerDeliveryPriceText:buildPrepaidPerDeliveryPriceText(formattedPrice)},details=getSellingPlanDetailsById(sellingPlan.id),details&&jQuery.extend(sellingPlanDetails,JSON.parse(JSON.stringify(details))),sellingPlanDetails.id=sellingPlan.id,sellingPlanDetails.isFrequencySubsequent=1<sellingPlanDetails.frequencyCount,sellingPlanDetails.frequencyIntervalLowerCase=(null==sellingPlanDetails||null==(_sellingPlanDetails$f=sellingPlanDetails.frequencyInterval)?void 0:_sellingPlanDetails$f.toLowerCase())||"",null===sellingPlanDetails.discountText?(sellingPlanDetails.secondFormattedDiscountText="",sellingPlanDetails.showSecondFormattedDiscountText=!1):(sellingPlanDetails.secondFormattedDiscountText=discountText+" ".concat(DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.offFrequencyTextV2"]||"off")),sellingPlanDetails.showSecondFormattedDiscountText=!0),sellingPlanDetails.prepaidFlag=eval(sellingPlanDetails.prepaidFlag),daysInBillingFrequency=1,totalDaysInBillingFrequency=0,sellingPlanFrequencyType="","WEEK"===sellingPlanDetails.billingFrequencyInterval?(daysInBillingFrequency=7,sellingPlanFrequencyType=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.weeklyLabelTextV2"]||"Weekly")):"MONTH"===sellingPlanDetails.billingFrequencyInterval?(daysInBillingFrequency=30,sellingPlanFrequencyType=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.monthlyLabelTextV2"]||"Monthly")):"YEAR"===sellingPlanDetails.billingFrequencyInterval&&(daysInBillingFrequency=365,sellingPlanFrequencyType=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.yearlyLabelTextV2"]||"Yearly")),sellingPlanDetails.prepaidFlag&&(sellingPlanFrequencyType=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.prepayLabelTextV2"]||"Prepay")),totalDaysInBillingFrequency=sellingPlanDetails.billingFrequencyCount*daysInBillingFrequency,sellingPlanDetails.pricePerDay=formatPrice(sellingPlanDetails.price*sellingPlanDetails.billingFrequencyCount/totalDaysInBillingFrequency)+"/".concat(DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.dayFrequencyTextV2"])),sellingPlanDetails.sellingPlanFrequencyType=sellingPlanFrequencyType,0<sellingPlanDetails.price*sellingPlanDetails.billingFrequencyCount/totalDaysInBillingFrequency?sellingPlanDetails.showPricePerDay=!0:sellingPlanDetails.showPricePerDay=!1,sellingPlanVariants.push(sellingPlanDetails))})}),0<sellingPlanVariants.length){sellingPlanVariants.length<2?(Selling_Plan_Variants_Global.multipleSellingPlan=!1,jQuery(purchaseOptions).find(".appstle_subscribe_option").children().hide(),singleSellingPlanDisplayText=buildSellingPlantText(sellingPlanVariants[0]),Selling_Plan_Variants_Global.singleSellingPlanDisplayText=singleSellingPlanDisplayText,planText=jQuery(DOMPurify.sanitize('<div class="appstle_single_option_text">'.concat(singleSellingPlanDisplayText,"</div>"))),planText.appendTo(purchaseOptions.find(".appstle_subscribe_option")),null!=(_sellingPlanVariants$=sellingPlanVariants[0])&&_sellingPlanVariants$.description&&null!=(_sellingPlanVariants$2=sellingPlanVariants[0])&&_sellingPlanVariants$2.description.includes("{{sellingPlanName}}")?jQuery('<div class="appstleSellingPlanDescription">'.concat(null==(_sellingPlanVariants$3=sellingPlanVariants[0])||null==(_sellingPlanVariants$3=_sellingPlanVariants$3.description)?void 0:_sellingPlanVariants$3.replace("{{sellingPlanName}}",null==(_sellingPlanVariants$4=sellingPlanVariants[0])?void 0:_sellingPlanVariants$4.name),"</div>")).appendTo(purchaseOptions.find(".appstle_subscribe_option")):null!=(_sellingPlanVariants$5=sellingPlanVariants[0])&&_sellingPlanVariants$5.description&&jQuery(DOMPurify.sanitize('<div class="appstleSellingPlanDescription">'.concat(null==(_sellingPlanVariants$6=sellingPlanVariants[0])?void 0:_sellingPlanVariants$6.description,"</div>"))).appendTo(purchaseOptions.find(".appstle_subscribe_option"))):Selling_Plan_Variants_Global.multipleSellingPlan=!0,sellingPlanVariants=null==(_sellingPlanVariants=sellingPlanVariants)?void 0:_sellingPlanVariants.map(function(n){var e=null==(e=RSConfig)||null==(e=e.sellingPlansJson)?void 0:e.find(function(e){return e.idNew==n.idNew});return n.frequencySequence=(null==e?void 0:e.frequencySequence)||0,n}),sellingPlanVariants.sort(function(e,n){return e.frequencySequence-n.frequencySequence}),null!=(_RSConfig11=RSConfig)&&_RSConfig11.sortByDefaultSequence||sellingPlanVariants.sort(function(e,n){return e.price-n.price}),null!=(_RSConfig12=RSConfig)&&_RSConfig12.sortAlphabetically&&null!=(_sellingPlanVariants2=sellingPlanVariants)&&_sellingPlanVariants2.sort(function(e,n){return null==e||null==(e=e.name)?void 0:e.localeCompare(n.name)}),(null!=(_RSConfig13=RSConfig)&&_RSConfig13.subscriptionOptionSelectedByDefault||product.requires_selling_plan)&&(sellingPlanVariants[0].isChecked=!0),null!=(_RSConfig14=RSConfig)&&_RSConfig14.showPrepaidPlanSeparately&&!isPrepaidDropdown&&(sellingPlanVariants=sellingPlanVariants.filter(function(e){return!(null!=e&&e.prepaidFlag)})),null!=(_RSConfig15=RSConfig)&&_RSConfig15.showPrepaidPlanSeparately&&isPrepaidDropdown&&(sellingPlanVariants=sellingPlanVariants.filter(function(e){return null==e?void 0:e.prepaidFlag})),jQuery(sellingPlanVariants).each(function(e,n){var t,i=buildSellingPlantText(n);n.sellingPlanDisplayText=i,null!=(t=RSConfig)&&t.switchRadioButtonWidget?jQuery(DOMPurify.sanitize('<div class="appstle-radio-wrapper">\n                        <div class="appstle-radio-input-wrapper">\n                        <input type="radio" id="appstle_subscription_widget'.concat(widgetId,"-").concat(n.id,'" value="').concat(n.id,'" ').concat(e?"":"checked",' name="selling_plan_radio').concat(isPrepaidDropdown?"_prepaid":"",'" style="display: inline;"></input>\n                <label for="appstle_subscription_widget').concat(widgetId,"-").concat(n.id,'" ').concat(sellingPlanVariants.length<2?"display: none;":"",'">\n                    <span class="sellingplan">').concat(i,"</span>\n                  </label>\n                  </div>\n                  ").concat(null!=n&&n.description&&null!=n&&n.description.includes("{{sellingPlanName}}")?'<div class="appstleSellingPlanDescription">'.concat(null==n?void 0:n.description.replace("{{sellingPlanName}}",null==n?void 0:n.name),"</div>"):null!=n&&n.description?'<div class="appstleSellingPlanDescription">'.concat(null==n?void 0:n.description,"</div>"):"","\n                </div>"))).appendTo(purchaseOptions.find(".appstleRadioSellingPlanWrapper")):jQuery("<option />",{value:n.id,html:DOMPurify.sanitize(i)}).appendTo(purchaseOptions.find("select"))}),null!=(_RSConfig17=RSConfig)&&_RSConfig17.switchRadioButtonWidget?(!isPrepaidDropdown&&selectedPayAsYouGoPlan&&purchaseOptions.find("input[name=selling_plan_radio][value=".concat(selectedPayAsYouGoPlan,"]")).length&&purchaseOptions.find("input[name=selling_plan_radio][value=".concat(selectedPayAsYouGoPlan,"]")).prop("checked",!0),isPrepaidDropdown&&selectedPrepaidPlan&&purchaseOptions.find("input[name=selling_plan_radio_prepaid][value=".concat(selectedPrepaidPlan,"]")).length&&purchaseOptions.find("input[name=selling_plan_radio_prepaid][value=".concat(selectedPrepaidPlan,"]")).prop("checked",!0)):(!isPrepaidDropdown&&selectedPayAsYouGoPlan&&purchaseOptions.find("select option[value=".concat(selectedPayAsYouGoPlan,"]")).length&&purchaseOptions.find("select").val(selectedPayAsYouGoPlan),isPrepaidDropdown&&selectedPrepaidPlan&&purchaseOptions.find("select option[value=".concat(selectedPrepaidPlan,"]")).length&&purchaseOptions.find("select").val(selectedPrepaidPlan)),Selling_Plan_Variants_Global.sellingPlanVariants=sellingPlanVariants}else{Selling_Plan_Variants_Global.sellingPlanVariants=[];try{jQuery("#appstle_subscription_widget"+widgetId).remove();var timer=setTimeout(function(){jQuery("#appstle_subscription_widget"+widgetId).remove(),clearTimeout(timer)})}catch(e){}}return sellingPlanVariants}function hidePaymentButtons(){jQuery(DOMPurify.sanitize(RSConfig.selectors.payment_button_selectors)).hide()}function showPaymentButtons(){jQuery(DOMPurify.sanitize(RSConfig.selectors.payment_button_selectors)).show()}function deferJquery(e){var n;null!=(n=RS)&&null!=(n=n.Config)&&n.disableLoadingJquery&&logger("APpstle jQuery is disabled"),(null!=(n=RS)&&null!=(n=n.Config)&&n.disableLoadingJquery?window.jQuery:window.appstle_jQuery)?e():setTimeout(function(){deferJquery(e)},50)}function hasPrepaidPlan(e){var n=!1;return null!=e&&null!=(e=e.selling_plan_allocations)&&null!=(e=e.filter(function(e){var n=null==e?void 0:e.selling_plan_group_id,e=product.selling_plan_groups.find(function(e){return(null==e?void 0:e.id)==n});return"appstle"==(null==e?void 0:e.app_id)}))&&e.forEach(function(e){(null==e?void 0:e.per_delivery_price)!==(null==e?void 0:e.price)&&(n=!0)}),n}function hasOnlyPrepaid(e){var n,t=0;return null!=e&&null!=(n=e.selling_plan_allocations)&&null!=(n=n.filter(function(e){var n=null==e?void 0:e.selling_plan_group_id,e=product.selling_plan_groups.find(function(e){return(null==e?void 0:e.id)==n});return"appstle"==(null==e?void 0:e.app_id)}))&&n.forEach(function(e){(null==e?void 0:e.per_delivery_price)!==(null==e?void 0:e.price)&&t++}),(null==e||null==(n=e.selling_plan_allocations)?void 0:n.length)===t&&0<t}function addSubscriptionItems(e,n,t,i,l){var a=!0,s=(t&&isSellingPlanPrepaid(t)&&RSConfig.showPrepaidPlanSeparately&&(a=!1),product.requires_selling_plan||jQuery(DOMPurify.sanitize('<div class="appstle_subscription_wrapper_option '.concat(""!==t&&(product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault)?"":"appstle_selected_background",'">\n              <div class="appstle_one_time_details_wrapper">\n              <input type="radio" ').concat(""!==t&&RS.Config.subscriptionOptionSelectedByDefault?"":"checked",' id="appstle_selling_plan_label_1').concat(widgetId,'" name="selling_plan" value="" ').concat(RS.Config.formMappingAttributeName&&RS.Config.formMappingAttributeSelector&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).length&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")?"".concat(RS.Config.formMappingAttributeName,"=").concat(jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")):"",'>\n          <label for="appstle_selling_plan_label_1').concat(widgetId,'" class="appstle_radio_label" >\n            <span class="appstle_circle" ><span class="appstle_dot"></span></span>\n              <span class="appstle_one_time_text">').concat(RS.Config.oneTimePurchaseText,'</span>\n             </label>\n             <div class="appstle_one_time_price_wrapper ').concat(null!=n&&n.compare_at_price?"has-compare-price":"",'">\n             <span class="appstle_subscription_amount transcy-money"></span>\n             <span class="appstle_subscription_amount_compare_at_price transcy-money">').concat(RS.Config.showOneTimeComparePrice&&null!=n&&n.compare_at_price?wrapPriceWithSpanTag(formatPrice(null==n?void 0:n.compare_at_price)):"",'</span>\n             <div class="appstle_one_time_unit_price">').concat(null!=n&&n.unit_price&&null!=n&&null!=(s=n.unit_price_measurement)&&s.reference_unit?"".concat(wrapPriceWithSpanTag(formatPrice(null==n?void 0:n.unit_price)),"/").concat(1<(null==n||null==(s=n.unit_price_measurement)?void 0:s.reference_value)?null==n||null==(s=n.unit_price_measurement)?void 0:s.reference_value:"").concat(null==n||null==(s=n.unit_price_measurement)?void 0:s.reference_unit):"",'</div>\n\n             </div>\n          </div>\n          <div class="appstle_one_time_description_text">').concat(widgetLabels["appstle.subscription.wg.onetimeDescriptionTextV2"]||"","</div>\n          ").concat("","\n          </div>"))).appendTo(e),jQuery(DOMPurify.sanitize('<div class="appstle-active-option appstle_subscription_wrapper_option appstle_include_dropdown '.concat(t&&a||""!==t&&(product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault)?"appstle_selected_background":"",' payAsYouGoPlansDropdownWrapper">\n            <div class="appstle_subscription_radio_wrapper">\n            <input type="radio" id="appstle_selling_plan_label_2').concat(widgetId,'" name="selling_plan" value="Subscribe and save" ').concat(t&&a||""!==t&&(product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault)?"checked":""," ").concat(RS.Config.formMappingAttributeName&&RS.Config.formMappingAttributeSelector&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).length&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")?"".concat(RS.Config.formMappingAttributeName,"=").concat(jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")):"",'>\n                <label for="appstle_selling_plan_label_2').concat(widgetId,'" class="appstle_radio_label" >\n                    <span class="appstle_circle" ><span class="appstle_dot"></span></span>\n                    <span class="appstle-text-and-badge-wrapper">\n                      <span class="appstle_subscribe_save_text">').concat(RS.Config.subscriptionOptionText,'</span>\n                      <span class="appstle-save-badge"></span>\n                    </span>\n                </label>\n                <div class="appstle_subscription_amount_wrapper">\n                  <span class="appstle_subscription_amount transcy-money"></span>\n                  <span class="appstle_subscription_compare_amount transcy-money"></span>\n                </div>\n            </div>\n            <div class="appstle_subscribe_option ').concat(t&&a||product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault?"":"appstle_hide_subsOption",'">\n            <div class="appstle_subscribe_option_grid">\n                ').concat(RS.Config.sellingPlanSelectTitle?'<label for="appstle_selling_plan'.concat(widgetId,'" class="appstle_select_label">').concat(RS.Config.sellingPlanSelectTitle,"</label>"):"","\n                ").concat(null!=(s=RSConfig)&&s.switchRadioButtonWidget?'<div class="appstleRadioSellingPlanWrapper"></div>':' <div class="appstle_custom_select"><select id="appstle_selling_plan'.concat(widgetId,'" class="appstle_select">\n                </select></div><div class="appstleSelectedSellingPlanOptionDescription"></div>'),"\n                ").concat("","\n            </div>\n            <div>\n        </div>")))),a=jQuery(DOMPurify.sanitize('<div class="appstle_subscription_wrapper_option appstle_include_dropdown '.concat(t&&!a||""!==t&&hasOnlyPrepaid(n)&&(product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault)?"appstle_selected_background":"",' prepaidPlansDropdownWrapper">\n            <div class="appstle_subscription_radio_wrapper">\n            <input type="radio" id="appstle_selling_plan_label_3').concat(widgetId,'" name="selling_plan" value="Prepaid" ').concat(t&&!a||""!==t&&hasOnlyPrepaid(n)&&(product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault)?"checked":""," ").concat(RS.Config.formMappingAttributeName&&RS.Config.formMappingAttributeSelector&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).length&&jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")?"".concat(RS.Config.formMappingAttributeName,"=").concat(jQuery(DOMPurify.sanitize(RS.Config.formMappingAttributeSelector)).attr("id")):"",'>\n                <label for="appstle_selling_plan_label_3').concat(widgetId,'" class="appstle_radio_label" >\n                    <span class="appstle_circle" ><span class="appstle_dot"></span></span>\n                    <span class="appstle-text-and-badge-wrapper">\n                      <span class="appstle_subscribe_save_text">').concat(widgetLabels["appstle.subscription.wg.prepaidLabelTextV2"]||"Prepaid",'</span>\n                      <span class="appstle-save-badge"></span>\n                    </span>\n                </label>\n                <div class="appstle_subscription_amount_wrapper">\n                  <span class="appstle_subscription_amount transcy-money"></span>\n                  <span class="appstle_subscription_compare_amount transcy-money"></span>\n                </div>\n            </div>\n            <div class="appstle_subscribe_option ').concat(t&&!a||!hasOnlyPrepaid(n)||product.requires_selling_plan||RS.Config.subscriptionOptionSelectedByDefault?"":"appstle_hide_subsOption",'">\n            <div class="appstle_subscribe_option_grid">\n                ').concat(RS.Config.sellingPlanSelectTitle?'<label for="appstle_selling_plan'.concat(widgetId,'" class="appstle_select_label">').concat(RS.Config.sellingPlanSelectTitle,"</label>"):"","\n                ").concat(null!=(a=RSConfig)&&a.switchRadioButtonWidget?'<div class="appstleRadioSellingPlanWrapper"></div>':' <div class="appstle_custom_select"><select id="appstle_selling_plan'.concat(widgetId,'" class="appstle_select">\n                </select></div> <div class="appstleSelectedSellingPlanOptionDescription"></div>'),"\n                ").concat("","\n            </div>\n            </div>\n        </div>"))),o=populateDropdown(s,n,!1,t,i,l);o&&0<o.length&&(null!=(o=RSConfig)&&o.showSubOptionBeforeOneTime?s.prependTo(e):s.appendTo(e)),RSConfig.showPrepaidPlanSeparately&&hasPrepaidPlan(n)&&(populateDropdown(a,n,RSConfig.showPrepaidPlanSeparately,t,i,l),hasOnlyPrepaid(n)?null!=(o=RSConfig)&&o.showSubOptionBeforeOneTime?a.prependTo(e):a.appendTo(e):a.insertAfter(s)),addStyle(widgetId)}function isSellingPlanPrepaid(e){e=getSellingPlanAllocation(getVariantId(),parseInt(e));return!!e&&e.per_delivery_price!==e.price}function changeEventHandlerForRadio(){var e=getCurrentWidgetType();(e&&"WIDGET_TYPE_1"!==e&&"WIDGET_TYPE_2"!==e?handleChangeRadioEventForWidget4:handleChangeRadioEventForOtherWidget)()}function getCurrentWidgetType(){var e,n=null;return-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_1"))?n="WIDGET_TYPE_1":-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_2"))?n="WIDGET_TYPE_2":-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_3"))?n="WIDGET_TYPE_3":-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_4"))?n="WIDGET_TYPE_4":-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_5"))?n="WIDGET_TYPE_5":-1!==(null==(e=product)||null==(e=e.tags)?void 0:e.indexOf("WIDGET_TYPE_6"))&&(n="WIDGET_TYPE_6"),n||(null==(e=RSConfig)?void 0:e.widgetType)}function handleChangeRadioEventForWidget4(){jQuery("#appstle_subscription_widget"+widgetId).find(".widgetSellingPlanWrapper input[type=radio]").on("change",function(e){var n,t;null!=e&&null!=(n=e.target)&&n.checked&&(n=jQuery("#appstle_subscription_widget"+widgetId+" .appstleLoyaltyTable"),0<(t=jQuery(e.target).parents(".appstle_input_wrapper")).length?checkIfSellingPlanGroupIsSelected(t)?(n.show(),dispatchAppstleEvent("SellingPlanSelected",widgetId)):(n.hide(),dispatchAppstleEvent("SellingPlanRemoved",widgetId),dispatchAppstleEvent("SellingPlanDeSelected",widgetId)):(dispatchAppstleEvent("SellingPlanRemoved",widgetId),dispatchAppstleEvent("SellingPlanDeSelected",widgetId),n.remove()),null!=e&&null!=(t=e.target)&&t.checked&&(jQuery(".appstle_input_wrapper").removeClass("appstle-active-option"),jQuery(e.target).parents(".appstle_input_wrapper").addClass("appstle-active-option")),updateStateOfWidget(e),window.appstleSelectedSellingPlan=e.target.value,jQuery("#appstle_subscription_widget"+widgetId).removeAttr("data-selected-selling-plan"),e.target.value)&&jQuery("#appstle_subscription_widget"+widgetId).attr("data-selected-selling-plan",e.target.value)})}function handleChangeRadioEventForOtherWidget(){jQuery(document).on("change","#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper input[type=radio]",function(e){var n,t,i;jQuery(e.target).is(":checked")&&(n=jQuery(e.target).parents(".appstle_include_dropdown").find(".appstle_subscribe_option"),t=jQuery("#appstle_subscription_widget"+widgetId+" .appstleLoyaltyTable"),i=jQuery(e.target).parents(".appstle_subscription_wrapper_option"),0<n.length?checkIfSellingPlanGroupIsSelected(i)?(jQuery("#appstle_subscription_widget"+widgetId).find(".appstle_subscribe_option").addClass("appstle_hide_subsOption"),n.removeClass("appstle_hide_subsOption"),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper_option.appstle_include_dropdown").addClass("appstle_selected_background"),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper_option:not(.appstle_include_dropdown)").removeClass("appstle_selected_background"),t.show(),dispatchAppstleEvent("SellingPlanSelected",widgetId)):(jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper_option.appstle_include_dropdown").removeClass("appstle_selected_background"),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper_option:not(.appstle_include_dropdown)").first().addClass("appstle_selected_background"),n.addClass("appstle_hide_subsOption",widgetId),t.hide(),dispatchAppstleEvent("SellingPlanRemoved",widgetId),dispatchAppstleEvent("SellingPlanDeSelected",widgetId)):(jQuery("#appstle_subscription_widget"+widgetId).find(".appstle_subscribe_option").addClass("appstle_hide_subsOption"),dispatchAppstleEvent("SellingPlanRemoved",widgetId),dispatchAppstleEvent("SellingPlanDeSelected",widgetId),t.remove()),jQuery(e.target).is(":checked")&&(jQuery(".appstle_subscription_wrapper_option").removeClass("appstle-active-option"),jQuery(e.target).parents(".appstle_subscription_wrapper_option").addClass("appstle-active-option")),updateStateOfWidget(e),window.appstleSelectedSellingPlan=e.target.value,jQuery("#appstle_subscription_widget"+widgetId).removeAttr("data-selected-selling-plan"),e.target.value)&&jQuery("#appstle_subscription_widget"+widgetId).attr("data-selected-selling-plan",e.target.value)})}function updateFormFields(n){var i,e,t;jQuery(".appstle_fields_wrapper"+widgetId).remove(),jQuery(DOMPurify.sanitize(RSConfig.atcButtonSelector)).parents("form").removeAttr("novalidate"),n&&(e=RSConfig.sellingPlansJson)&&((i=jQuery(DOMPurify.sanitize('<div class="appstle_fields_wrapper appstle_fields_wrapper'.concat(widgetId,'"></div>')))).insertBefore("#appstle_subscription_widget"+widgetId+" .appstle_widget_title"),e=null==e?void 0:e.find(function(e){return e.id=="gid://shopify/SellingPlan/".concat(n)}),null!=(t=jQuery("#appstle_subscription_widget"+widgetId+" .appstle_widget_title"))&&t.length||logger("If you have added form field and it looks like you have not added Purchase option text label. So in this case please add an empty space in purchage option text field in MP."),e)&&((t=JSON.parse((null==e?void 0:e.formFieldJson)||null))&&0<t.length&&(t.forEach(function(e,n){var t;e.required&&logger("Form field is set to REQUIRED, please make sure it is visible."),"date"===e.type?(i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleOrderDatePicker" '.concat(e.visible?"":'style="display: none;"','>\n                      <label class="appstleFormFieldLabel appstleOrderDatePickerLabel" for="properties[_order-date]">').concat(e.label,'</label>\n                      <div class="as-date-input-wrapper">\n                        <input class="appstle_form_field_input" type="text">\n                        <input class="appstle_form_field_input_alternate" type="hidden">\n                        <input name="properties[_order-date]" value="" class="appstle_form_field_input_iso" type="hidden">\n                      </div>\n                    </div>')))),getJqueryUIFromCDN(),attatchDatePicker(e.config,e.enabledDays,e.nextOrderMinimumThreshold)):"datepicker"===e.type?(i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleOrderDatePicker" '.concat(e.visible?"":'style="display: none;"','>\n                      <label class="appstleFormFieldLabel appstleOrderDatePickerLabel" for="properties[').concat(e.name,']">').concat(e.label,'</label>\n                      <div class="as-date-input-wrapper">\n                        <input class="appstle_form_field_datepicker appstle_form_field_input_').concat(n,'" type="text">\n                        <input class="appstle_form_field_input_alternate_').concat(n,'" type="hidden">\n                        <input name="properties[').concat(e.name,']" value="" class="appstle_form_field_input_iso_').concat(n,'" type="hidden">\n                      </div>\n                    </div>')))),getJqueryUIFromCDN(),attatchGenericDatePicker(e.config,n),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_alternate_"+n).on("change",function(e){e.target.value&&(e=e.target.value+"T"+(new Date).toISOString().split("T")[1],jQuery(".appstle_form_field_input_iso_"+n).attr("value",new Date(e).toISOString().split(".")[0]+"Z"),jQuery(".appstle_form_field_input_iso_"+n).val(new Date(e).toISOString().split(".")[0]+"Z"))}),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_"+n).parents(".as-date-input-wrapper").find("input").each(function(e,n){$(n).trigger("change")})):"text"===e.type?i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleCustomTextField" '.concat(e.visible?"":'style="display: none;"','>\n                      <label class="appstleFormFieldLabel appstleCustomTextFieldLabel" for="properties[').concat(e.name,']">').concat(e.label,'</label>\n                      <div class="as-customTextField-wrapper">\n                        <input name="properties[').concat(e.name,']" ').concat(null!=e&&e.required?"required":"",' value="" type="text" class="appstle_form_field_text_input">\n                      </div>\n                    </div>')))):"textarea"===e.type?i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleCustomTextField" '.concat(e.visible?"":'style="display: none;"','>\n                      <label class="appstleFormFieldLabel appstleCustomTextFieldLabel" for="properties[').concat(e.name,']">').concat(e.label,'</label>\n                      <div class="as-customTextField-wrapper">\n                      <textarea rows="4" name="properties[').concat(e.name,']" ').concat(null!=e&&e.required?"required":"",' value="" class="appstle_form_field_text_input"></textarea>\n                      </div>\n                    </div>')))):"select"===e.type?(t=(null==e||null==(t=e.selectOptions)?void 0:t.split(","))||[],i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleCustomSelectField" '.concat(e.visible?"":'style="display: none;"','>\n                      <label class="appstleFormFieldLabel appstleCustomSelectFieldLabel" for="properties[').concat(e.name,']">').concat(e.label,'</label>\n                      <div class="as-customTextField-wrapper">\n                        <select name="properties[').concat(e.name,']" ').concat(null!=e&&e.required?"required":"",' value="" type="select" class="appstle_form_field_text_input">\n                          ').concat(null==t?void 0:t.map(function(e){return'<option value="'.concat(e,'">').concat(e,"</option>")}).join(""),"\n                        </select>\n                      </div>\n                    </div>"))))):"checkbox"===e.type&&i.append(jQuery(DOMPurify.sanitize('\n                    <div class="appstleCustomTextField" '.concat(e.visible?"":'style="display: none;"','>\n                      <div class="as-customCheckboxField-wrapper">\n                        <input name="properties[').concat(e.name,']" ').concat(null!=e&&e.required?"required":"",' value="" type="checkbox" class="appstle_form_field_checkbox_input">\n                        <label class="appstleFormFieldLabel appstleCustomCheckboxFieldLabel" for="properties[').concat(e.name,']">').concat(e.label,"</label>\n                      </div>\n                    </div>"))))}),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_alternate").on("change",function(e){e.target.value&&(e=e.target.value+"T"+(new Date).toISOString().split("T")[1],jQuery(".appstle_form_field_input_iso").attr("value",new Date(e).toISOString().split(".")[0]+"Z"),jQuery(".appstle_form_field_input_iso").val(new Date(e).toISOString().split(".")[0]+"Z"))}),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input").parents(".as-date-input-wrapper").find("input").each(function(e,n){$(n).trigger("change")})),null!=(e=RSConfig)&&e.disablePassingSellingPlanAsLineProperties||i.append(jQuery(DOMPurify.sanitize('\n                <input name="properties[__appstle-selected-selling-plan]" value="'.concat(n,'" type="text" class="appstle_form_field_text_input appstle-selectedSellingPlan" style="display: none !important; opacity: 0 !important; visibility: hidden !important; height: 0 !important; width: 0 !important;">')))))}function getJqueryUIFromCDN(){var e;window.jQuery||(window.jQuery=window.appstle_jQuery,window.$=window.appstle_jQuery),jQuery(".jqueryUIFetched").length||void 0===(null==(e=window.jQuery)?void 0:e.datepicker)&&((e=document.createElement("script")).src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js",e.type="text/javascript",head.appendChild(e),(e=document.createElement("link")).href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css",e.rel="stylesheet",head.appendChild(e),jQuery("html").addClass("jqueryUIFetched"))}function getJqueryi18(){var e;"Object"==getClassOf(jQuery.ui)?"Function"==getClassOf(jQuery.ui.tabs)&&((e=document.createElement("script")).src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/i18n/jquery-ui-i18n.min.js",e.type="text/javascript",head.appendChild(e)):setTimeout(getJqueryi18,30)}function attatchDatePicker(e,i,n){var l=new Date,a=!1,t=[];n=n&&parseInt(n)?parseInt(n):0;for(var s=0;s<=7;s++){var o=new Date;o.setDate((new Date).getDate()+s+n),t.push(o)}var r;t.forEach(function(e){var n,t;e=e,i&&null!=(t=i)&&t.length?(t=new Date(e),-1===(null==(n=i="string"==typeof i?JSON.parse(i):i)?void 0:n.map(function(e){return parseInt(null==e?void 0:e.value)})).indexOf(t.getDay())||a||(l=new Date(e),a=!0)):a||(l=new Date(e),a=!0)}),null!=(r=window.jQuery)&&r.datepicker?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_iso").length&&(r={altField:"#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_alternate",altFormat:"yy-mm-dd",autoSize:!0,minDate:l,showOn:"both",buttonImage:"https://subscription-admin.appstle.com/content/images/calendar-month.webp",defaultDate:l,currentText:"Now",beforeShowDay:function(e){var n;return!i||null==(n=i)||!n.length||(n=new Date(e),-1!==(null==(e=i="string"==typeof i?JSON.parse(i):i)?void 0:e.map(function(e){return parseInt(null==e?void 0:e.value)})).indexOf(n.getDay()))?[!0]:[!1]},onSelect:function(){$(this).parents(".as-date-input-wrapper").find("input").trigger("change")}},e=e?JSON.parse(e):{},r=jQuery.extend({},r,e),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input").datepicker(r),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input").datepicker("setDate",l),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input").parents(".as-date-input-wrapper").find("input").each(function(e,n){return $(n).trigger("change")})):setTimeout(function(){return attatchDatePicker(e,i,n)},30)}function attatchGenericDatePicker(e,n){var t,i=new Date;null!=(t=window.jQuery)&&t.datepicker?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_iso_"+n).length&&(t={altField:"#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_alternate_"+n,altFormat:"yy-mm-dd",autoSize:!0,minDate:i,showOn:"both",buttonImage:"https://subscription-admin.appstle.com/content/images/calendar-month.webp",defaultDate:i,currentText:"Now",onSelect:function(){$(this).parents(".as-date-input-wrapper").find("input").trigger("change")}},e=e?JSON.parse(e):{},t=jQuery.extend({},t,e),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_"+n).datepicker(t),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_"+n).datepicker("setDate",i),window.jQuery("#appstle_subscription_widget"+widgetId+" .appstle_form_field_input_"+n).parents(".as-date-input-wrapper").find("input").each(function(e,n){return $(n).trigger("change")})):setTimeout(function(){return attatchGenericDatePicker(e,n)},30)}function changeHandlerForSelect(){var e;null!=(e=RSConfig)&&e.switchRadioButtonWidget?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscribe_option input").on("change",function(e){updateStateOfWidget(e),updateFormFields(getCurrentSellingPlanId())}):jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper select").on("change",function(e){updateStateOfWidget(e),updateFormFields(getCurrentSellingPlanId())}),jQuery("#appstle_subscription_widget"+widgetId+' input[name="selling_plan"]').on("change",function(e){updateStateOfWidget(e),updateFormFields(getCurrentSellingPlanId())}),updateFormFields(getCurrentSellingPlanId())}function triggerChangeEvent(e){jQuery(DOMPurify.sanitize(e)).change()}function registerAndTriggerEventsForFormFields(){changeEventHandlerForRadio(),changeHandlerForSelect(),triggerEventsFromInput()}function triggerEventsFromInput(){jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscribe_option select").trigger("change"),jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscribe_option input").trigger("change"),jQuery("#appstle_subscription_widget"+widgetId+" input[name=selling_plan]").trigger("change")}function unbindEventListeners(){jQuery(".appstle_subscription_wrapper input[type=radio], .appstle_subscription_wrapper select").off("change")}function getSelectedSellingPlanPrice(){var e=getSelectedSellingPlanId();return e?formatPriceWithQuantity(getSellingPlanAllocation(localWindowVariant.id,parseInt(e)).per_delivery_price):null}function getCurrentQuantity(){var e=jQuery(buildAtcButtonSelector()).first();return standAloneElement&&(e=standAloneElement),Array.prototype.slice.call(e.parents(null==(e=RSConfig)?void 0:e.widgetParentSelector).find(null==(e=RSConfig)?void 0:e.quantitySelector)).map(function(e){return Number($(e).val())}).reduce(function(e,n){return Math.max(e,n)},-1/0)}function getCurrentQuantityPrice(e){return e*("true"===(null==(e=RSConfig)?void 0:e.updatePriceOnQuantityChange)&&parseInt(getCurrentQuantity())||1)}function formatPriceWithQuantity(e){return formatPrice(getCurrentQuantityPrice(e))}function getSelectedSellingPlanId(){var e,n=null;try{n=(n=(null!=(e=RSConfig)&&e.switchRadioButtonWidget?jQuery("#appstle_subscription_widget"+widgetId).find(".appstle_subscribe_option input:checked"):jQuery("#appstle_subscription_widget"+widgetId).find(".appstle_subscription_wrapper_option.appstle_include_dropdown.appstle-active-option select")).val())||jQuery("#appstle_subscription_widget"+widgetId).find('input[name="selling_plan"]:checked').val()}catch(e){}return n}function getCurrentSellingPlanId(){var e=null;try{e=jQuery("#appstle_subscription_widget"+widgetId).find("input[name=selling_plan]:checked").val()}catch(e){}return e}function getVariantId(){var e=buildAtcButtonSelector(),e=jQuery(e).first();return detectVariant(null,e=standAloneElement?standAloneElement:e,product).id}function updateOneTimePurchaseValueToRadio(){var e,n=getVariantId(),t=null;t=standAloneElement?(null==standAloneProduct?void 0:standAloneProduct.variants.filter(function(e){return String(null==e?void 0:e.id)===String(n)})).pop().price:null==(e=RSConfig)||null==(e=e.variantsById[n])?void 0:e.price,jQuery("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper_option:not(.appstle_include_dropdown) .appstle_subscription_amount").html(DOMPurify.sanitize(wrapPriceWithSpanTag(buildOneTimePriceText(formatPriceWithQuantity(t)))))}function appendSellingPlanDescription(e,n){jQuery("#appstle_subscription_widget"+widgetId+" .appstleSellingPlanDescription").length||e&&0===n.find(".appstleSelectedSellingPlanOptionDescription").length&&checkIfSellingPlanGroupIsSelected()&&(jQuery(DOMPurify.sanitize("#appstle_subscription_widget".concat(widgetId," .widgetSellingPlanWrapper"))).length?$("<div class='appstleSelectedSellingPlanOptionDescription'>".concat(e,"</div>")).insertAfter("#appstle_subscription_widget".concat(widgetId," .widgetSellingPlanWrapper")):n.find(".appstle_subscribe_option_grid").append(DOMPurify.sanitize("<div class='appstleSelectedSellingPlanOptionDescription'>".concat(e,"</div>"))))}function getVariantUnitPriceUnit(e){var n,e=localVariantsById[e];return"".concat(1<(null==e||null==(n=e.unit_price_measurement)?void 0:n.reference_value)?"".concat(null==e||null==(n=e.unit_price_measurement)?void 0:n.reference_value):"").concat(null==e||null==(n=e.unit_price_measurement)?void 0:n.reference_unit)}function getSelectedFrequencyName(n){var e=null==(e=RSConfig)||null==(e=e.sellingPlansJson)?void 0:e.filter(function(e){return e.id.includes(n)}).pop(),t="";return 1<(null==e?void 0:e.billingFrequencyCount)&&(t=(null==e?void 0:e.billingFrequencyCount)+" "),e=getIntervalName(null==e?void 0:e.billingFrequencyInterval,null==e?void 0:e.billingFrequencyCount),"".concat(t).concat(e)}function getIntervalName(e,n){var t="";return"MONTH"===e&&1<n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.monthsFrequencyTextV2"])),"MONTH"===e&&1===n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.monthFrequencyTextV2"])),"WEEK"===e&&1<n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.weeksFrequencyTextV2"])),"WEEK"===e&&1===n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.weekFrequencyTextV2"])),"DAY"===e&&1<n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.daysFrequencyTextV2"])),"DAY"===e&&1===n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.dayFrequencyTextV2"])),"YEAR"===e&&1<n&&(t=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.yearsFrequencyTextV2"])),t="YEAR"===e&&1===n?DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.yearFrequencyTextV2"]):t}function updateSelectValueToRadio(e){var n,t,i,l,a,s,o,r,p,c,d,u,g=e.target.value||"";jQuery(e.target).is("input")&&!jQuery(e.target).is(":checked")||(manageAddToCartText(),(RS.Config.showStaticTooltip&&RS.Config.tooltipDesctiption&&RS.Config.tooltipDesctiption.trim()?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper_static"):jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper .appstle_tooltip .appstle_tooltip_content")).html(DOMPurify.sanitize(RS.Config.tooltipDesctiption)),parseInt(g)?jQuery(e.target).is("input")&&!jQuery(e.target).is(":checked")||(g=e.target.value||"",(n=jQuery(e.target).parents(".appstle_subscription_wrapper_option")).find(".appstleSelectedSellingPlanOptionDescription").remove(),jQuery("#appstle_subscription_widget".concat(widgetId)).find('[name="properties[_appstle_fulfillments-count]"]').remove(),e.target.value&&jQuery("#appstle_subscription_widget"+widgetId).attr("data-selected-selling-plan",e.target.value),g&&(e=getVariantId(),getLoyaltyProductData(g,checkIfSellingPlanGroupIsSelected()),(t=getSellingPlanAllocation(e,parseInt(g)))?(r=formatPriceWithQuantity(t.per_delivery_price),u="",!(i=t.per_delivery_price!==t.price)&&localVariantsById[e].price?u=wrapPriceWithSpanTag(formatPriceWithQuantity(localVariantsById[e].price)):i&&null!=t&&t.compare_at_price&&(null==t?void 0:t.compare_at_price)!==(null==t?void 0:t.price)&&(u=wrapPriceWithSpanTag(formatPriceWithQuantity(null==t?void 0:t.compare_at_price))),a=(null==(l=getSellingPlanDetails(null==t?void 0:t.selling_plan_group_id,null==t?void 0:t.selling_plan_id))?void 0:l.description)||"",n.find("input[name=selling_plan]").attr("value",g),d=wrapPriceWithSpanTag(buildSelectedPriceText(r,i,formatPriceWithQuantity(t.price),formatPriceWithQuantity((null==t||null==(d=t.price_adjustments[1])?void 0:d.price)||0),null==t||null==(d=t.price_adjustments[1])?void 0:d.price)),o=getSellingPlanDiscountPercentage(g,!1),s=getSellingPlanDiscountPercentage(g,!0),s=buildTooltipDetailsText(buildSelectedTooltipPrePaidText(r,formatPriceWithQuantity(t.price)),i,buildSelectedTooltipDiscountText(t,s)),o=buildSubscriptionOptionText(i,o,getSelectedFrequencyName(g),r,(null==(o=product)||null==(o=o.selling_plan_groups)||null==(o=o.filter(function(e){return(null==e?void 0:e.id)===(null==t?void 0:t.selling_plan_group_id)}))||null==(o=o.pop())?void 0:o.name)||""),r=buildPrepaidPerDeliveryPriceText(r),p=buildDiscountText(getSellingPlanDiscountPercentage(g,!1)),i&&null!=(c=RSConfig)&&c.showPrepaidPlanSeparately&&(p=buildPrepaidDiscountText(getSellingPlanDiscountPercentage(g,!1))),n.find(".appstle_prepaid_description").remove(),n.find(".appstle_selling_plan_unit_price").remove(),n.find(".appstle_subscription_amount").html(DOMPurify.sanitize(d)),localVariantsById[e].price!==t.price?(n.find(".appstle_subscription_compare_amount ").html(DOMPurify.sanitize(u)),u?"price"!==(null==l||null==(c=l.price_adjustments[0])?void 0:c.value_type)&&n.find(".appstle-save-badge").html(DOMPurify.sanitize(p)):n.find(".appstle-save-badge").html(DOMPurify.sanitize(""))):(n.find(".appstle_subscription_compare_amount ").html(DOMPurify.sanitize("")),n.find(".appstle-save-badge").html(DOMPurify.sanitize(""))),null!=t&&t.unit_price&&n.find(".appstle_subscription_amount_wrapper").append(DOMPurify.sanitize('<div class="appstle_selling_plan_unit_price transcy-money">'.concat(wrapPriceWithSpanTag(formatPrice(null==t?void 0:t.unit_price)),"/").concat(getVariantUnitPriceUnit(e),"</div>"))),i&&r&&n.find(".appstle_subscription_amount_wrapper").append(DOMPurify.sanitize('<div class="appstle_prepaid_description transcy-money">'.concat(wrapPriceWithSpanTag(r)||wrapPriceWithSpanTag(formatPriceWithQuantity(t.price))+"/delivery","</div>"))),!i&&n.hasClass("payAsYouGoPlansDropdownWrapper")&&n.find(".appstle_subscribe_save_text").html(DOMPurify.sanitize(o)),checkIfSellingPlanGroupIsSelected()&&s&&s.trim()?(RS.Config.showStaticTooltip?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper_static"):jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper .appstle_tooltip .appstle_tooltip_content")).html(DOMPurify.sanitize(s)):(n.find(".appstleSelectedSellingPlanOptionDescription").remove(),(RS.Config.showStaticTooltip&&RS.Config.tooltipDesctiption&&RS.Config.tooltipDesctiption.trim()?jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper_static"):jQuery("#appstle_subscription_widget"+widgetId+" .appstle_tooltip_wrapper .appstle_tooltip .appstle_tooltip_content")).html(DOMPurify.sanitize(RS.Config.tooltipDesctiption))),jQuery("#appstle_subscription_widget".concat(widgetId," .widgetSellingPlanWrapper")).siblings(".appstleSelectedSellingPlanOptionDescription").remove(),d=a.includes("{{sellingPlanName}}")?a.replace("{{sellingPlanName}}",null==l?void 0:l.name):a,a&&appendSellingPlanDescription(a,n),n.find(".appstleSelectedSellingPlanOptionDescription").html(DOMPurify.sanitize(d)),n.find('[name="selling_plan"]:checked').val()&&"true"===widgetLabels["appstle.subscription.wg.allowFulfilmentCountViaPropertiesV2"]&&(u=l.options[0].value.match(/(\d+)/g)[1]/l.options[0].value.match(/(\d+)/g)[0],jQuery(DOMPurify.sanitize("#appstle_subscription_widget".concat(widgetId))).append('<input type=hidden name="properties[_appstle_fulfillments-count]" value="'.concat(u,'">')))):logger("".concat(g," Selling Plan Not Found.")))):(jQuery("#appstle_subscription_widget"+widgetId+" .appstleSelectedSellingPlanOptionDescription").remove(),jQuery("#appstle_subscription_widget"+widgetId).removeAttr("data-selected-selling-plan")))}function manageAddToCartText(){var e;(null!=(e=RSConfig)&&e.atcButtonTextSelector||widgetLabels["appstle.subscription.wg.atcButtonTextSelectorV2"])&&((e=jQuery(DOMPurify.sanitize((null==(e=RSConfig)?void 0:e.atcButtonTextSelector)||widgetLabels["appstle.subscription.wg.atcButtonTextSelectorV2"]))).attr("data-atc-original-text")||e.attr("data-atc-original-text",e.val()||e.text()),checkIfSellingPlanGroupIsSelected()?(e.text(DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.atcButtonTextV2"])),e.val(DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.atcButtonTextV2"]))):(e.text(e.attr("data-atc-original-text")),e.val(e.attr("data-atc-original-text"))))}function getLoyaltyProductData(n,e){var t,i=null==(i=RSConfig)||null==(i=i.sellingPlansJson)?void 0:i.find(function(e){return(null==e?void 0:e.id.split("/").pop())===String(n)}),l=[];null!=i&&null!=(t=i.appstleCycles)&&t.length&&null!=i&&null!=(t=i.appstleCycles)&&t.forEach(function(e){l.push(null==e?void 0:e.freeProductHandle)}),getAllProductData(l,n,e)}function getAllProductData(n,t,i){var e,l=n.shift();!l||null!=(e=window)&&null!=(e=e.products)&&e[l]?n.length?getAllProductData(n,t,i):createLoyaltyTableData(t,i):fetch("/products/".concat(l,".js")).then(function(e){if(e.ok)return e.json()}).then(function(e){window.products||(window.products={}),window.products[l]=e,n.length?getAllProductData(n,t,i):createLoyaltyTableData(t,i)})}function createLoyaltyTableData(n,e){var t,i,l,a=[];e=checkIfSellingPlanGroupIsSelected(),n=getSelectedSellingPlanId(),jQuery("#appstle_subscription_widget"+widgetId+" .appstleLoyaltyTable").remove(),!1!==(null==(l=RSConfig)||null==(l=l.appstlePlanFeatures)?void 0:l.accessSubscriberLoyaltyFeatures)&&((l=null)!=(i=null==(i=RSConfig)||null==(i=i.sellingPlansJson)?void 0:i.find(function(e){return(null==e?void 0:e.id.split("/").pop())===String(n)}))&&i.freeTrialEnabled&&a.push({perkText:getPerkText(0,i.freeTrialCount,i.freeTrialInterval,null==i?void 0:i.freeTrialEnabled,null==i?void 0:i.discount)}),null!=i&&i.afterCycle2&&0<=parseFloat(i.discountOffer2)&&a.push({perkText:getPerkText(getBillingCycleText(i.afterCycle2),i.discountOffer2,i.discountType2,!1)}),null!=i&&null!=(t=i.appstleCycles)&&t.length&&null!=(t=null==i?void 0:i.appstleCycles.sort(function(e,n){return e.afterCycle-n.afterCycle}))&&t.forEach(function(n){var e,t="",i="",l="";"FREE_PRODUCT"===n.discountType&&(t=null==(e=window)||null==(e=e.products)||null==(e=e[n.freeProductHandle])?void 0:e.title,1<(null==(e=window)||null==(e=e.products)||null==(e=e[n.freeProductHandle])?void 0:e.variants.length)&&(t+=(e=null==(e=(null==(e=window)||null==(e=e.products)||null==(e=e[n.freeProductHandle])?void 0:e.variants.filter(function(e){return e.id===parseInt(null==n?void 0:n.freeVariantId)})).pop())?void 0:e.title)?" - "+e:""),l=null==(e=window)||null==(e=e.products)||null==(e=e[n.freeProductHandle])?void 0:e.featured_image,i=formatPrice(null==(e=window)||null==(e=e.products)||null==(e=e[n.freeProductHandle])?void 0:e.price)),(parseFloat(n.value)||0===parseFloat(n.value)||t||"SHIPPING"===n.discountType)&&a.push({perkText:getPerkText(getBillingCycleText(n.afterCycle),n.value,n.discountType,!1,t,l,i)})}),t=(null==(i=RSConfig)?void 0:i.loyaltyDetailsLabelText)||"Subscriber Rewards",(a=null==(i=a)?void 0:i.filter(function(e){return null==e?void 0:e.perkText})).length)&&(i='<div class="appstleLoyaltyTable" '.concat(e?"":'style="display: none;"','><table width="100%">\n                        <div class="appstle_loyalty_title">').concat(t,"</div>\n                        <tbody>\n                          {{#items}}\n                            <tr>\n                              <td>{{{perkText}}}</td>\n                            </tr>\n                           {{/items}}\n                        </tbody>\n                      </table></div>"),a={items:a},l=Mustache.render(i,a),"WIDGET_TYPE_1"!==(null==(e=RSConfig)?void 0:e.widgetType)&&"WIDGET_TYPE_2"!==(null==(t=RSConfig)?void 0:t.widgetType)?0<(null==(i=document.querySelectorAll("#appstle_subscription_widget"+widgetId+" .appstleSelectedSellingPlanOptionDescription"))?void 0:i.length)?jQuery(l).insertAfter("#appstle_subscription_widget"+widgetId+" .appstleSelectedSellingPlanOptionDescription"):jQuery(l).insertAfter("#appstle_subscription_widget"+widgetId+" .widgetSellingPlanWrapper"):jQuery(l).insertAfter("#appstle_subscription_widget"+widgetId+" .appstle_subscription_wrapper"))}function getPerkText(e,n,t,i,l,a,s,o){var r="",p="",c=RSConfig.variantsById[getVariantId()];return c&&"PERCENTAGE"===t?(r=(null==c?void 0:c.price)*(n/100),p=(null==c?void 0:c.price)-r):"FIXED"===t&&(p=(null==c?void 0:c.price)-(r=100*n)),JSON.parse(RS.Config.labels)["appstle.subscription.wg.loyaltyPerkDescriptionTextV2"]?(c={discount:n,discountType:t,formatDiscountedPrice:formatPrice(100*n),freeProductName:l,isDiscountTypePercentage:"PERCENTAGE"===t,isDiscountTypeShipping:"SHIPPING"===t,isDiscountTypeFreeProduct:"FREE_PRODUCT"===t,isDiscountTypeFixed:"FIXED"===t,isDiscountTypeFixedPrice:"PRICE"===t,isFreeTrial:i,isCartPage:!1,featured_image:a,productPrice:s,billingCycleBlock:'<span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,"</span>"),freeTrailDiscount:o,discountAmount:formatPrice(r),finalDiscountedPrice:formatPrice(p),orderCycleBlock:'<span class="appstle-loyalty-billing-cycle"><span class="order-cycle-block">'.concat(getBillingCycleText(parseInt(e)+1),"</span></span>")},Mustache.render(JSON.parse(RS.Config.labels)["appstle.subscription.wg.loyaltyPerkDescriptionTextV2"],c)):"PERCENTAGE"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(n+"% off","</span></span>."):"SHIPPING"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">',"shipping at ".concat(formatPrice(100*n)),"</span></span>."):"FREE_PRODUCT"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">FREE PRODUCT (').concat(l,")</span></span>."):"FIXED"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n)+" off","</span></span>."):"PRICE"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get at <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n),"</span></span>."):i?'Get <span class="appstle-loyalty-free-trial-discount">'.concat(n,' <span class="appstle-loyalty-free-trial-discount-count" style="text-transform: lowercase;">').concat(t).concat(1<n?"s":"",'</span></span> <span class="appstle-loyalty-free-trial-text">free trial.</span>'):"PERCENTAGE"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(n+"% off","</span></span>."):"SHIPPING"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">',"shipping at ".concat(formatPrice(100*n)),"</span></span>."):"FREE_PRODUCT"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">FREE PRODUCT (').concat(l,")</span></span>."):"FIXED"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n)+" off","</span></span>."):"PRICE"===t?'After <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> order</span>, <span class="appstle-loyalty-discount">get at <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n),"</span></span>."):void 0}function getSellingPlanDetails(n,t){var e=(null==(e=product)?void 0:e.selling_plan_groups.filter(function(e){return(null==e?void 0:e.id)===n})).pop();return(null==e||null==(e=e.selling_plans)?void 0:e.filter(function(e){return(null==e?void 0:e.id)===t})).pop()}function getSellingPlanDetailsById(n){var e;return null==(e=RSConfig)||null==(e=e.sellingPlansJson)?void 0:e.find(function(e){return(null==e?void 0:e.id.split("/").pop())===String(n)})}function checkIfSellingPlanGroupIsSelected(e){if(e){var n=!1;try{n=e.find("[name=selling_plan]:checked").val()}catch(e){}}else{n=!1;try{n=jQuery("#appstle_subscription_widget"+widgetId).find("[name=selling_plan]:checked").val()}catch(e){}}return n}function buildDiscountText(e){return wrapPriceWithSpanTag(Mustache.render(RS.Config.selectedDiscountFormat,{selectedDiscountPercentage:e}))}function buildPrepaidDiscountText(e){e={selectedDiscountPercentage:e};return wrapPriceWithSpanTag(Mustache.render(DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.prepaidSaveBadgeTextV2"]),e))}function updateSellingPlanValueToFinalPrice(){var n,i,l,t,e={regular:{sellingPrice:DOMPurify.sanitize(RSConfig.priceSelector)||".appstle-preview-format-price",saleBadgeTop:DOMPurify.sanitize(RSConfig.badgeTop)}}.regular,a=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.productPageUnitPriceSelectorV2"]||".f-price__unit"),s=((null!=(s=RSConfig)&&s.widgetParentSelector?(jQuery("#appstle_subscription_widget"+widgetId).parents(null==(s=RSConfig)?void 0:s.widgetParentSelector).find(".appstle_subscription_final_price").remove(),jQuery("#appstle_subscription_widget"+widgetId).parents(null==(s=RSConfig)?void 0:s.widgetParentSelector).find(".appstle_subscription_element").remove(),jQuery("#appstle_subscription_widget"+widgetId).parents(null==(s=RSConfig)?void 0:s.widgetParentSelector).find(".appstle_subscription_compare_price")):(jQuery(".appstle_subscription_final_price").remove(),jQuery(".appstle_subscription_element").remove(),jQuery(".appstle_subscription_compare_price"))).remove(),jQuery(".appstle_subscription_unit_price").remove(),getSelectedSellingPlanPrice()),o=getSellingPlanDiscountPercentage(),r=null!=(r=RSConfig)&&r.widgetParentSelector?null==(r=jQuery("#appstle_subscription_widget"+widgetId).parents(null==(r=RSConfig)?void 0:r.widgetParentSelector))?void 0:r.find(e.sellingPrice):jQuery(e.sellingPrice),p=null!=(p=RSConfig)&&p.widgetParentSelector?null==(p=jQuery("#appstle_subscription_widget"+widgetId).parents(null==(p=RSConfig)?void 0:p.widgetParentSelector))?void 0:p.find(a+":not(.appstle_subscription_unit_price)"):jQuery(a+":not(.appstle_subscription_unit_price)");1<(null==(a=r=null!=(a=RSConfig)&&a.widgetParentSelector?jQuery("#appstle_subscription_widget"+widgetId).parents(null==(a=RSConfig)?void 0:a.widgetParentSelector).find(e.sellingPrice):r)?void 0:a.length)&&logger("".concat(null==(a=r)?void 0:a.length," elements of price selector found. Use more specific selector or use widget parent selector.")),null==(a=RSConfig)||!a.widgetParentSelector||null!=(a=r)&&a.length||logger("Price update will not work, widgetParentSelector or priceSelector is set wrong."),(null!=(a=RSConfig)&&a.widgetParentSelector?(jQuery("#appstle_subscription_widget"+widgetId).parents(null==(a=RSConfig)?void 0:a.widgetParentSelector).find("[data-appstle-price-modified]").css("text-decoration",""),jQuery("#appstle_subscription_widget"+widgetId).parents(null==(a=RSConfig)?void 0:a.widgetParentSelector).find("[data-appstle-price-modified]")):(jQuery("[data-appstle-price-modified]").css("text-decoration",""),jQuery("[data-appstle-price-modified]"))).removeAttr("data-appstle-price-modified"),r.css("text-decoration",""),r.removeAttr("data-appstle-price-modified"),p.show(),e.sellingPrice&&o&&checkIfSellingPlanGroupIsSelected()&&(a=buildDiscountText(o))&&((o=jQuery(DOMPurify.sanitize('<span class="appstle_subscription_element appstle_subscription_save"> '.concat(a," </span>"))))&&o.css("top",e.saleBadgeTop),(n=r.first().clone()).addClass("appstle_subscription_final_price"),n.html(DOMPurify.sanitize(s)),a=getAttributes(n),Object.keys(a).forEach(function(e){"class"!==e&&"style"!==e&&n.removeAttr(e)}),null!=(e=RSConfig)&&e.removeClassFromPriceElement&&n.removeClass((null==(s=RSConfig)?void 0:s.removeClassFromPriceElement)||"price__container"),r.css("text-decoration","line-through"),0<n.length&&n.insertBefore(r),null!=p&&p.length?(t=getSelectedSellingPlanId(),i=getVariantId(),l=getSellingPlanAllocation(i,parseInt(t)),!widgetLabels["appstle.subscription.wg.productPageUnitPriceSelectorV2"]||null!=l&&l.unit_price||logger("Seems like unit price selector is added but the product data is not configured in Shopify to have unit price"),p.each(function(e,n){var t=jQuery(n).clone();t.text("".concat(wrapPriceWithSpanTag(formatPrice(null==l?void 0:l.unit_price)),"/").concat(getVariantUnitPriceUnit(i))),t.addClass("appstle_subscription_unit_price"),t.insertAfter(n)}),p.hide()):widgetLabels["appstle.subscription.wg.productPageUnitPriceSelectorV2"]&&logger("Unit price selector is not added correctly."),t="gid://shopify/SellingPlan/"+(t=getSelectedSellingPlanId()),"PRICE"!=((a=RSConfig.sellingPlansJson.find(function(e){return e.id==t}))?a.discountType:void 0)?o.insertAfter(r):$(n).addClass("fixedDiscount")),r.attr("data-appstle-price-modified",!0)}function getAttributes(e){var t={};return e&&0<e.length&&$.each(null==(e=e[0])?void 0:e.attributes,function(e,n){t[n.name]=n.value}),t}function getSellingPlanDiscountPercentage(e,n){var t,i,l=e?parseInt(e):parseInt(getSelectedSellingPlanId());return l?(product.selling_plan_groups.forEach(function(n){"appstle"===n.app_id&&n.selling_plans.forEach(function(e){isSellingPlanVisible(e.id)&&e.id===l&&(t=n)})}),t.selling_plans.forEach(function(e){e.id===l&&(l=e)}),n&&2==(null==(e=l)||null==(e=e.price_adjustments)?void 0:e.length)?(i=[],null!=(n=l)&&null!=(n=n.price_adjustments)&&n.forEach(function(e){"percentage"!==(null==e?void 0:e.value_type)?i.push(formatPriceWithQuantity(null==e?void 0:e.value)):i.push((null==e?void 0:e.value)+"%")}),i):null==(n=null==(e=l)?void 0:e.price_adjustments[0])||null==n.value||0==n.value?null:"percentage"!==(null==n?void 0:n.value_type)?formatPriceWithQuantity(null==n?void 0:n.value):(null==n?void 0:n.value)+"%"):null}function updateWidgetElements(e){registerAndTriggerEventsForFormFields()}function updateStateOfWidget(e){updateSelectValueToRadio(e),updateOneTimePurchaseValueToRadio(),updateSellingPlanValueToFinalPrice(),setTimeout(function(){return updateFormFields(getCurrentSellingPlanId())},30),dispatchAppstleEvent("SubscriptionWidgetUpdated",widgetId),setTimeout(function(){jQuery(".appstle-hidden").removeClass("appstle-hidden")},30)}function createJsonformat(){var e,n={},t=getVariantId(),i=null,l=product.variants.filter(function(e){return e.id==t}).pop();return i=standAloneElement?(null==standAloneProduct?void 0:standAloneProduct.variants.filter(function(e){return String(null==e?void 0:e.id)===String(t)})).pop().price:null==(e=RSConfig)||null==(e=e.variantsById[t])?void 0:e.price,n.requires_selling_plan=null==(e=product)?void 0:e.requires_selling_plan,n.oneTimePuchaseText=RS.Config.oneTimePurchaseText,n.oneTimePuchaseAmount=buildOneTimePriceText(formatPriceWithQuantity(i)),n.oneTimePuchaseComparePriceAmount=null!=l&&l.compare_at_price?buildOneTimePriceText(formatPriceWithQuantity(null==l?void 0:l.compare_at_price)):"",n.subscribeText=RS.Config.subscriptionOptionText,n.widgetId=widgetId,(n=Object.assign(Selling_Plan_Variants_Global,n)).tooltipTitle=RS.Config.tooltipTitle,n.toolTipDescription=RS.Config.tooltipDesctiption,n.companyWebsite="https://appstle.com/",n.companyName="POWERED BY APPSTLE",n.showStaticTooltip=RS.Config.showStaticTooltip,n.purchaseOptionsText=RS.Config.purchaseOptionsText,n.deliveryFrequencyText=RS.Config.sellingPlanSelectTitle,n.showAppstleLink=RS.Config.showAppstleLink,n.subscriptionOptionSelectedDefault=RS.Config.subscriptionOptionSelectedByDefault,n.showSubOptionBeforeOneTime=RS.Config.showSubOptionBeforeOneTime,n.showTooltip=RS.Config.showTooltip,n.showOneTimeComparePrice=null==(e=RS.Config)?void 0:e.showOneTimeComparePrice,n.oneTimeFrequencyText=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.oneTimeFrequencyTextV2"]),n.cancelAnytimeLabelTextV2=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.cancelAnytimeLabelTextV2"]),n.noSubscriptionLabelTextV2=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.noSubscriptionLabelTextV2"]),n}function getCssAsString(n){var t={};return n?(Object.keys(n).forEach(function(e){n[e]&&(t[e]=n[e])}),JSON.stringify(t).split('"').join("").split("{").join("").split("}").join("").split(",").join(";")):""}function updateHistoryState(){setTimeout(updateHistory,30)}function updateHistory(){var e,n,t,i;null!=(e=RSConfig)&&e.disableQueryParamsUpdate||localWindowVariant&&(e=localWindowVariant.id,history.replaceState)&&e&&(n=window.location.protocol+"//"+window.location.host+window.location.pathname+"?",t=Object.fromEntries(new URLSearchParams(location.search)),checkIfSellingPlanGroupIsSelected()?(i=getSelectedSellingPlanId())&&(t.selling_plan=i):t.selling_plan="",t.variant=e,(n+=serializeQueryParams(t))!==location.href)&&urlIsProductPage()&&window.history.replaceState({path:n},"",n)}function serializeQueryParams(e){var n,t=[];for(n in e)e.hasOwnProperty(n)&&e[n]&&t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.join("&")}function updateWidgetUIBasedOnQueryParams(){var t,e,n,i;0!==jQuery("#appstle_subscription_widget"+widgetId).length&&(t=urlParamsToObject(),0<(e=jQuery("#appstle_subscription_widget"+widgetId).closest('form[action$="/cart/add"]')).find("input[value="+t.variant+"]").length||0<e.find("option[value="+t.variant+"]").length)&&(0<e.find("option[value="+t.selling_plan+"]").length||0<e.find("input[value="+t.selling_plan+"]").length)&&t.selling_plan&&((e=jQuery(Array.prototype.slice.call(jQuery("#appstle_subscription_widget"+widgetId+" input[name=selling_plan]")).filter(function(e){return jQuery(e).val()===t.selling_plan||!!jQuery(e).parents(".appstle_subscription_wrapper_option").find("option[value=".concat(t.selling_plan,"]")).length||!!jQuery(e).parents(".appstle_subscription_wrapper_option").find("input[value=".concat(t.selling_plan,"]")).length}).pop())).length&&(e[0].checked=!0),i=(i=null)!=(n=RSConfig)&&n.switchRadioButtonWidget?e.parents(".appstle_subscription_wrapper_option").find(".appstle_subscribe_option"):e.parents(".appstle_subscription_wrapper_option").find("select"),null!=(n=RSConfig)&&n.switchRadioButtonWidget?null!=(n=i)&&n.length?i.find("input[type=radio]").each(function(e,n){$(n).removeAttr("checked"),jQuery(n).attr("value")===t.selling_plan&&$(n).attr("checked",!0)}):jQuery("#appstle_subscription_widget"+widgetId).find("input[type=radio]").each(function(e,n){$(n).removeAttr("checked"),jQuery(n).attr("value")===t.selling_plan&&$(n).attr("checked",!0)}):i.find("option").each(function(e,n){jQuery(n).attr("value")===t.selling_plan&&(i[0].selectedIndex=e)}),e.change(),i.change(),jQuery("#appstle_subscription_widget"+widgetId).find("input[type=radio]").change())}function accountPageStyle(){var e=RSConfig.css;jQuery("".concat(parseElementCSS(),"<style>").concat(DOMPurify.sanitize(e.customCSS,purifyConfig),"</style>")).appendTo(jQuery("head"))}function parseElementCSS(){var e="";try{var n,t=JSON.parse(null==(n=RS)||null==(n=n.Config)||null==(n=n.css)?void 0:n.elementCSS);if(t)for(var i=0;i<(null==t?void 0:t.length);i++)e+="<style>".concat(t[i],"</style>")}catch(e){}return e}function addStyle(e){var n=RSConfig.css;jQuery("<style>\n\n     #appstle_subscription_widget".concat(e,"{\n            width: 100%;\n            text-align: left;\n            margin-top: 17px;\n            clear: both;\n            // max-width: 400px;\n            ").concat(getCssAsString(n.appstle_subscription_widget),"\n        }\n\n        #appstle_subscription_widget").concat(e,"{\n          ").concat(getCssAsString(n.appstle_widget_text_color),"\n        }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper {\n               border: 1.5px solid #cccccc;\n              // box-shadow: 0 0 0 1px #c4cdd5;\n              border-radius: 5px;\n              margin-bottom: 5px;\n              overflow: hidden;\n              ").concat(getCssAsString(n.appstle_subscription_wrapper),"\n          }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper_option {\n              display: flex;\n              position: relative;\n              padding: 16px 16px;\n              flex-direction: column;\n          }\n          #appstle_subscription_widget").concat(e," .appstle_selected_background {\n            ").concat(getCssAsString(n.appstle_selected_background),"\n          }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper_option:first-child {\n             // box-shadow: 0 1px 0 0 #c4cdd5;\n             // border-bottom: inherit;\n          }\n            #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper_option:first-child:last-child {\n             border-bottom: none;\n          }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper_option:not(.appstle_include_dropdown) {\n            justify-content: center;\n          }\n\n          #appstle_subscription_widget").concat(e,' .appstle_subscription_wrapper_option.appstle_include_dropdown {\n            flex-direction: column;\n            justify-content: center;\n          }\n\n          .appstle_circle {\n            position: relative;\n          }\n\n\n\n        [name="selling_plan"] {\n          position: absolute;\n          opacity: 0;\n      }\n\n\n          #appstle_subscription_widget').concat(e," .appstle_subscribe_option {\n              margin-left: 29px;\n              margin-top: 5px;\n              display: flex;\n              flex-direction: column;\n              align-items: flex-start;\n              text-align: left;\n          }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_amount {\n              margin-left: auto;\n          }\n\n          #appstle_subscription_widget").concat(e," .appstle_circle {\n              display: flex;\n              height: 18px;\n              width: 18px;\n              border: 2px solid #3a3a3a;\n              border-radius: 50%;\n              margin-right: 10px;\n              justify-content: center;\n              align-items: center;\n              flex-shrink: 0;\n              ").concat(getCssAsString(n.appstle_circle),"\n            }\n\n\n            span.appstle_dot {\n              height: 10px;\n              width: 10px;\n              transform: scale(0);\n              background-color: #3a3a3a;\n              border-radius: 50%;\n              flex-shrink: 0;\n              transition: transform 0.2s;\n            }\n\n          #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper_option input[type=radio]:checked + label .appstle_circle .appstle_dot {\n            transform: scale(1);\n              ").concat(getCssAsString(n.appstle_dot),"\n            }\n\n\n        #appstle_subscription_widget").concat(e," .appstle_radio_label {\n          display: flex !important;\n          align-items: center;\n          margin: 0;\n          padding: 0;\n          background: none;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_select_label {\n          display: flex !important;\n          align-items: center;\n          margin: 0;\n          padding: 0;\n          background: none;\n          font-size: 13px;\n\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_form_field_input, #appstle_subscription_widget").concat(e," .appstle_form_field_datepicker, #appstle_subscription_widget").concat(e," .appstle_form_field_text_input {\n          width: 100%;\n          padding-left: 20px;\n          padding-right: 20px;\n          height: 43px !important;\n          border-radius: 12px;\n          border: 1px solid #0000003d!important;\n          font-size: 1.5rem;\n          color: #495057;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_tooltip {\n          -webkit-backface-visibility: hidden;\n          backface-visibility: hidden;\n          box-shadow: 0 2px 4px rgb(0 0 0 / 15%);\n          background-color: #3a3a3a;\n          border-radius: 5px;\n          left: 0;\n          color: #fff;\n          transition: transform .2s cubic-bezier(.215,.61,.355,1);\n          -ms-transform: translateY(0);\n          transform: translateY(100%) scaleY(0);\n          transform-origin: center top;\n          opacity: 0;\n          position: absolute;\n          bottom: 1px;\n          // border-bottom-left-radius: 0;\n          min-width: 250px;\n          ").concat(getCssAsString(n.appstle_tooltip),"\n        }\n\n\n\n        #appstle_subscription_widget").concat(e," [data-appstle-icon] {\n            -ms-flex-item-align: end;\n            backface-visibility: hidden;\n        }\n\n        #appstle_subscription_widget").concat(e," [data-appstle-icon]:after {\n              border: solid transparent;\n              border-top-color: #3a3a3a;\n              border-width: 9px;\n              content: '';\n              position: absolute;\n              pointer-events: none;\n              opacity: 0;\n              left: 2px;\n              bottom: 0;\n              -ms-transform: translateX(-50%) translateY(10px) rotate(180deg);\n              transform: translateY(10px) rotate(180deg);\n              transition-delay: 0;\n              visibility: hidden;\n              transition: transform .2s cubic-bezier(.215,.61,.355,1);\n              z-index: 99999999;\n              background: none;\n              padding: 0;\n              ").concat(getCssAsString(n.appstle_tooltip_border_top_color),"\n        }\n\t\t@media screen and (max-width: 1024px) {\n\n\t\t\t#appstle_subscription_widget").concat(e," [data-appstle-icon].appstle-tooltip-show .appstle_tooltip {\n\t\t\t\t  opacity: 1;\n\t\t\t\t  visibility: visible;\n\t\t\t\t  transform: translateY(100%) scaleY(1);\n\t\t\t\t  bottom: 1px;\n\t\t\t\t  z-index: 99999999;\n\t\t\t}\n\n\t\t\t#appstle_subscription_widget").concat(e," [data-appstle-icon].appstle-tooltip-show:after {\n\t\t\t  opacity: 1;\n\t\t\t  visibility: visible;\n\t\t\t  -ms-transform: translateX(-50%) translateY(0) rotate(180deg);\n\t\t\t  transform: translateY(0) rotate(180deg);\n\t\t\t}\n\t\t}\n        @media screen and (min-width: 1025px) {\n\t\t\t#appstle_subscription_widget").concat(e," [data-appstle-icon]:hover .appstle_tooltip {\n\t\t\t\t  opacity: 1;\n\t\t\t\t  visibility: visible;\n\t\t\t\t  transform: translateY(100%) scaleY(1);\n\t\t\t\t  bottom: 1px;\n\t\t\t\t  z-index: 99999999;\n\t\t\t}\n\n\t\t\t#appstle_subscription_widget").concat(e," [data-appstle-icon]:hover:after {\n\t\t\t  opacity: 1;\n\t\t\t  visibility: visible;\n\t\t\t  -ms-transform: translateX(-50%) translateY(0) rotate(180deg);\n\t\t\t  transform: translateY(0) rotate(180deg);\n\t\t\t}\n\t\t}\n\n        #appstle_subscription_widget").concat(e," .appstle_tooltip_wrapper {\n\n          display: inline-flex;\n          align-items: center;\n          position: unset;\n          box-sizing: border-box\n          position: relative;\n\n\n        }\n\n        .appstle-tootltip-parent {\n          position: relative;\n          margin-top: 8px;\n          margin-bottom: 16px;\n          margin-left: 0px;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_tooltip_wrapper_static {\n          font-size: 13px;\n          background-color: beige;\n          border-radius: 6px;\n          padding: 23px;\n          margin-bottom: 10px;\n          ").concat(getCssAsString(n.appstle_tooltip),"\n        }\n\n        #appstle_subscription_widget").concat(e," .tooltip_subscription_svg {\n             height: 22px;\n            width: 22px;\n            margin-right: 10px;\n            fill: black;\n            ").concat(getCssAsString(n.tooltip_subscription_svg),"\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_subscription_radio_wrapper {\n            display: flex;\n            align-items: flex-start;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_subscription_amount_wrapper {\n          margin-left: auto;\n          text-align: right;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_subscription_amount_wrapper .appstle_prepaid_description, #appstle_subscription_widget").concat(e," .appstle_subscription_amount_wrapper .appstle_selling_plan_unit_price, .appstle_one_time_unit_price {\n          font-size: 13px;\n          opacity: 0.8;\n        }\n\n        .appstle_prepaid_description {\n          word-wrap: break-word;\n        }\n\n        .appstle_subscription_final_price {\n            margin-right: 10px;\n            text-decoration: none;\n            color: #da4f49;\n            ").concat(getCssAsString(n.appstle_subscription_final_price),"\n        }\n\n        .appstle_subscription_save {\n            margin-left: 10px;\n              padding: 2px 6px;\n              border: 1px solid #da4f49;\n              border-radius: 3px;\n              font-size: 10px;\n              color: #da4f49;\n              font-weight: bold;\n              display: inline;\n              position: relative;\n              top: 0px;\n              letter-spacing: 1px;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_subscription_wrapper .appstle_select {\n            width: 100%;\n            margin: 0;\n            ").concat(getCssAsString(n.appstle_select),"\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_hide_subsOption {\n          opacity: 0;\n          margin-top: 0;\n        }\n\n        #appstle_subscription_widget").concat(e," .appstle_tooltip_content {\n          padding: 16px;\n        }\n\n        body #appstle_subscription_widget").concat(e," .appstle_tooltip_wrapper .appstle_tooltip .appstle_tooltip_appstle {\n          padding: 12px !important;\n          font-size: 8px !important;\n          letter-spacing: 2px !important;\n          text-align: right !important;\n          background: #13b5ea !important;\n          border-bottom-left-radius: 4px !important;\n          border-bottom-right-radius: 4px !important;\n          display: block !important;\n        }\n\n        .appstle_link {\n          color: inherit !important;\n          text-decoration: none !important;\n          cursor: pointer !important;\n        }\n\n        .appstleRadioSellingPlanWrapper {\n          display: flex;\n          flex-direction: column;\n        }\n\n        .appstle-radio-input-wrapper{\n          display: flex;\n          align-items: center;\n        }\n        .appstleLoyaltyTable {\n          margin-top: 20px;\n        }\n\n        .appstle_loyalty_title {\n          margin-bottom: 10px;\n        }\n\n        .appstle-loyalty-billing-cycle-count, .appstle-loyalty-discount-amount, .appstle-loyalty-free-trial-discount {\n          color: #198946;\n          font-weight: bold;\n        }\n\n        .appstle_fields_wrapper {\n          margin-bottom: 20px;\n        }\n\n        .as-date-input-wrapper {\n          position: relative;\n        }\n\n        .as-date-input-wrapper .ui-datepicker-trigger {\n          position: absolute;\n          height: 100%;\n          width: 40px;\n          right: 0;\n          top: 0;\n        }\n\n        .as-date-input-wrapper .ui-datepicker-trigger img {\n          position: absolute;\n          top: 50%;\n          left: 50%;\n          width: 28px;\n          transform: translate(-50%, -50%);\n        }\n\n        .appstle_subscription_compare_amount  {\n          text-decoration: line-through;\n        }\n\n        #ui-datepicker-div {\n          z-index: 1000000 !important;\n        }\n\n        .appstle_one_time_details_wrapper {\n          display: flex;\n          flex-grow: 1;\n          align-items: flex-start;\n      }\n\n      .appstle_one_time_description_text {\n        margin-left: 28px;\n        font-size: 13px;\n        word-wrap: break-word;\n      }\n\n      .appstle_one_time_price_wrapper {\n        margin-left: auto;\n        text-align: right;\n      }\n\n      .appstle_one_time_unit_price {\n        text-align: right;\n      }\n\n      .appstle_sub_widget input[name=selling_plan_radio], .appstle_sub_widget input[name=selling_plan_radio_prepaid] {\n        appearance: auto;\n        height: auto;\n        overflow: unset;\n        position: relative;\n        width: unset;\n        margin: 0 !important;\n    }\n    .appstle_sub_widget *:empty {\n      display: block !important;\n  }\n  .prepaidPlansDropdownWrapper, .appstle_subscription_wrapper_option+.payAsYouGoPlansDropdownWrapper {\n    border-top: 1.5px solid #cccccc;\n}\n.appstleSelectedSellingPlanOptionDescription {\n    font-size: 13px;\n    margin-top: 4px;\n    word-wrap: break-word;\n}\n\n.appstleSellingPlanDescription {\n        font-size: 13px;\n        word-wrap: break-word;\n}\n\n.appstleRadioSellingPlanWrapper label {\nmargin-left: 10px;\nline-height: 1;\n}\n\n.appstleRadioSellingPlanWrapper input {\nmin-height: auto !important;\n}\n\n.appstle-radio-wrapper {\nmargin-top: 10px;\n}\n\n.appstle_subscribe_option {\n    display: grid !important;\n    grid-template-rows: 1fr;\n    transition: grid-template-rows 500ms, opacity 300ms 300ms;\n}\n\n.appstle_onetime_option {\n  display: grid !important;\n  transition: grid-template-rows 500ms, opacity 300ms 300ms;\n  grid-template-rows: 0fr;\n}\n\n.appstle-active-option .appstle_onetime_option {\n  grid-template-rows: 1fr;\n}\n\n\n.appstle_subscribe_option.appstle_hide_subsOption > div {\n    overflow: hidden;\n}\n\n.appstle_subscribe_option.appstle_hide_subsOption {\n    grid-template-rows: 0fr;\n}\n\n.appstle_subscribe_option.appstle_hide_subsOption {\n    height: auto !important;\n    visibility: unset !important;\n    overflow: hidden;\n}\n\n.appstle_subscribe_option_grid {\n    overflow: hidden;\n}\n.appstle_onetime_option_grid {\n  overflow: hidden;\n}\n\n.appstle-atc-button {\n    display: block;\n    width: 100%;\n    background: #3a3a3a;\n    color: #fff;\n    border: none;\n    padding: 15px 30px;\n    margin-top: 20px;\n}\n\nspan.appstle_dot {\n    transition: all 0.2s;\n}.\n\nspan.appstle_dot {\n    height: 10px;\n    width: 10px;\n    transform: scale(0);\n    background-color: #3a3a3a;\n    border-radius: 50%;\n    flex-shrink: 0;\n}\n\n.appstle-atc-button-hide {\n    display: none;\n}\n.appstle-icon {\n    display: inline-block;\n    width: 20px;\n    height: 20px;\n    vertical-align: middle;\n    fill: currentColor;\n}\n\n.appstle_sub_widget input[name=selling_plan] {\n  display: block !important;\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n  opacity: 0;\n  top: 0;\n  left: 0;\n}\n\n.appstle_subscription_radio_wrapper {\n  position: relative;\n}\n.appstle_subscription_amount_compare_at_price {\n  text-decoration: line-through;\n  font-size: 14px;\n}\n\n.appstle-icon-spinner {\n  width: 20px;\n  -moz-animation: appstle-spin 500ms infinite linear;\n  -o-animation: appstle-spin 500ms infinite linear;\n  -webkit-animation: appstle-spin 500ms infinite linear;\n  animation: appstle-spin 500ms infinite linear; }\n\n@-webkit-keyframes appstle-spin {\n  0% {\n    -ms-transform: rotate(0deg);\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg); }\n  100% {\n    -ms-transform: rotate(360deg);\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg); } }\n\n@-moz-keyframes appstle-spin {\n  0% {\n    -ms-transform: rotate(0deg);\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg); }\n  100% {\n    -ms-transform: rotate(360deg);\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg); } }\n\n@-ms-keyframes appstle-spin {\n  0% {\n    -ms-transform: rotate(0deg);\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg); }\n  100% {\n    -ms-transform: rotate(360deg);\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg); } }\n\n@keyframes appstle-spin {\n  0% {\n    -ms-transform: rotate(0deg);\n    -webkit-transform: rotate(0deg);\n    transform: rotate(0deg); }\n  100% {\n    -ms-transform: rotate(360deg);\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg); } }\n\n    .appstle_subscribe_option.appstle_hide_subsOption .appstleSellingPlanDescription {\n      display: none !important;\n      }\n\n      .appstle_shipment_tooltip_wrapper {\n        position: relative;\n        margin-bottom: 6px;\n        display: inline-flex;\n        align-items: center;\n        padding-top: 11px;\n        box-sizing: border-box;\n        margin-left: 0px;\n        padding-bottom: 11px;\n      }\n      .appstle_shipment_tooltip_wrapper .appstle_shipment_tooltip {\n        -webkit-backface-visibility: hidden;\n        backface-visibility: hidden;\n        box-shadow: 0 2px 4px rgb(0 0 0 / 15%);\n        background-color: #3a3a3a;\n        border-radius: 5px;\n        left: 0;\n        color: #fff;\n        transition: transform .2s cubic-bezier(.215,.61,.355,1);\n        -ms-transform: translateY(0);\n        transform: translateY(100%) scaleY(0);\n        transform-origin: center top;\n        opacity: 0;\n        position: absolute;\n        bottom: 1px;\n        min-width: 215px;\n      }\n      .appstle_shipment_tooltip_wrapper:hover .appstle_shipment_tooltip {\n        opacity: 1;\n        visibility: visible;\n        transform: translateY(105%) scaleY(1);\n        bottom: 1px;\n        z-index: 99999999;\n      }\n      .appstle-add-to-shipment-loader, .appstle-add-to-shipment-success, .appstle-add-to-shipment-error {\n        display: none;\n      }\n      .appstle_shipment_tooltip .appstle_shipment_tooltip_content {\n        padding: 16px;\n      }\n      button.appstle-add-to-shipment {\n        margin-top: 5px;\n        width: 100%;\n        padding: 15px 40px;\n        border-radius: 100rem;\n        background: #000;\n        color: white;\n        border: none;\n        cursor: pointer;\n    }\n    button.appstle-add-to-shipment-disabled {\n      width: 100%;\n      padding: 15px 40px;\n      border-radius: 100rem;\n      background: #000;\n      color: white;\n      border: none;\n      cursor: pointer;\n      opacity: 0.8;\n      cursor: not-allowed;\n  }\n    .as-hidden {\n      display: none;\n    }\n\n    .appstle-save-badge {\n      background-color: #fed83f;\n      color: #3b3b3b;\n      width: auto;\n      border-radius: 2px;\n      border-top-right-radius: 3px;\n      border-bottom-right-radius: 3px;\n      text-transform: uppercase;\n      font-size: .5em;\n      letter-spacing: 1px;\n      line-height: 2;\n      padding: 0 0.5em;\n      margin-left: 1em;\n      position: relative;\n      display: inline-block;\n      transform: rotate(5deg) translate(0, 2px);\n      font-weight: bold;\n  }\n  .appstle-save-badge::before {\n    content: \"\";\n    display: block;\n    position: absolute;\n    top: 0;\n    height: 100%;\n    width: 2em;\n    left: calc(-2em + 1px);\n    background: linear-gradient(to bottom right, transparent 49.4%, rgb(254, 216, 63) 50%) top, linear-gradient(to top right, transparent 49.4%, rgb(254, 216, 63) 50%) bottom;\n    background: conic-gradient(transparent 45deg, rgb(254, 216, 63) 45deg 135deg, transparent 125deg 360deg);\n    background: linear-gradient(to bottom right, transparent 50%, rgb(254, 216, 63) 50%) top, linear-gradient(to top right, transparent 50%, rgb(254, 216, 63) 50%) bottom;\n    background: conic-gradient(transparent 45deg, rgb(254, 216, 63) 45deg 135deg, transparent 125deg 360deg);\n    background-size: 100% 51%;\n    background-size: 100% 100%;\n    background-repeat: no-repeat;\n}\n\n  .appstle-save-badge:empty {\n    display: none;\n  }\n\n  product-info .appstle_stand_alone_price_display_selector {\n    display: none !important;\n}\n\n.appstle_select {\n  padding: 12px 20px !important;\n  border: 1px solid #ccc !important;\n  border-radius: 4px !important;\n}\n\n.appstle_one_time_text, .appstle_subscribe_save_text {\n  font-weight: bold !important;\n}\n\n.appstle_one_time_text, .appstle_subscribe_save_text {\n  font-weight: var(--font-body-weight-bold) !important;\n}\n\n.appstle_widget_title {\n  margin-bottom: 6px;\n}\n\n.as-customCheckboxField-wrapper { display: flex; align-items: center;}\n\nspan.appstle_stand_alone_price_display_selector:empty {display:none !important;}\n\n.appstle_tooltip_wrapper {\n  position: relative;\n  z-index: 2;\n}\n\n.appstle_select:focus-visible {\n    outline: none !important;\n    outline-offset: 0 !important;\n    box-shadow: none !important;\n}\n\n.appstle_sub_widget{\nposition:relative\n}\n\n.appstle_subscription_wrapper_option.appstle_include_dropdown {\n     border: 1.5px solid #cccccc;\n\n}\n\n.appstle_subscription_wrapper_option {\n     border: 1.5px solid #cccccc;\n}\nselect {\n  -webkit-appearance: none;\n  -moz-appearance: none;\n  appearance: none;\n}\n      \n.appstle_custom_select {\n  position: relative;\n}\n.appstle_custom_select:before {\n  position: absolute;\n  content: '';\n  width: 8px;\n  height: 8px;\n  background-repeat: no-repeat;\n  z-index: 1;\n  border-right: 1.5px solid #666;\n  border-bottom: 1.5px solid #666;\n  right:10px;\n  top: calc(50% - 3px);\n  transform: translateY(-50%) rotate(45deg);\n  pointer-events:none;\n}\n      </style>\n      ").concat(parseElementCSS(),"\n        <style>").concat(DOMPurify.sanitize(n.customCSS,purifyConfig),"</style>")).appendTo(jQuery("head"))}window.Shopify&&(product=RSConfig.product,standAloneProduct&&(product=standAloneProduct),processProductVariants(product),localVariantsByTitle=RSConfig.variantsByTitle,localVariantsById=RSConfig.variantsById,widgetLabels=JSON.parse(RS.Config.labels),Selling_Plan_Variants_Global={},appstleSubscriptionFunction=function(){var x,T,R,O,j,D,I,Q,t,e,n,i,l,a;!0!==urlIsProductPage()&&!appstleStandAloneSelectorExists()||(x=buildAtcButtonSelector(),T=jQuery(x).first(),standAloneElement&&(T=standAloneElement),Q="#appstle-subscription-widget-placeholder",null==(n=RSConfig)||!n.quantitySelector||null!=(n=RSConfig)&&n.widgetParentSelector||logger("Update price on quantity change will not work because WIDGET PARENT SELECTOR is missing."),null!=(n=RSConfig)&&n.quantitySelector||logger("Update price on quantity change will not work because QUANTITY SELECTOR is missing."),T.parents(null==(n=RSConfig)?void 0:n.widgetParentSelector).find(null==(n=RSConfig)?void 0:n.quantitySelector).on("change",function(){setTimeout(triggerEventsFromInput,100)}).on("click",function(){setTimeout(triggerEventsFromInput,100)}).on("blur",function(){setTimeout(triggerEventsFromInput,100)}),$(document).on("click","#appstle_subscription_widget".concat(widgetId," [data-appstle-icon]"),function(){$(this).toggleClass("appstle-tooltip-show")}),t=function(){var e=null;try{T=jQuery(x).first(),null!=(n=T=standAloneElement?standAloneElement:T)&&n.length||(T=jQuery("#appstle-subscription-widget-placeholder"));var n,t=detectVariant(O,T,product);if(t){var i,l,a=t.id;if(!O||O!==a){if(product.selling_plan_groups&&0<product.selling_plan_groups.length&&(l=product.selling_plan_groups.filter(function(e){return"appstle"===e.app_id})),RS.Config.widgetEnabled||logger("Widget is disabled in the settings. Please enable it"),null!=(i=l)&&i.length||(logger("There is no selling plan configured with this product. Thus Widget won't appear."),logger("If selling plans are configured in MP and those are not coming in RSConfig.product.selling_plan_groups, then try Europe in Opera Browser VPN and check.")),l&&0<l.length&&RS.Config.widgetEnabled){localWindowVariant=t;var s,o,r,p,c,d,u,g,f,_,y=RS.Config.selectors.atcButtonPlacement;if(!D||null!=(s=$(document).find(D))&&s.length||(j=null,$("#appstle_subscription_widget"+widgetId).remove()),j?(u=getCurrentSellingPlanId(),g=j.find(".payAsYouGoPlansDropdownWrapper .appstle_select").val()||j.find(".payAsYouGoPlansDropdownWrapper input[name=selling_plan_radio]:checked").val(),f=j.find(".prepaidPlansDropdownWrapper .appstle_select").val()||j.find(".prepaidPlansDropdownWrapper input[name=selling_plan_radio_prepaid]:checked").val(),unbindEventListeners(),j.children().remove(),addSubscriptionItems(j,t,u,g,f),e=createJsonformat(),I?j.insertBefore(I):j.appendTo(D)):(D=jQuery('<div class="appstle_sub_widget appstle-hidden" id="appstle_subscription_widget'+widgetId+'"></div>'),R=RS.Config.purchaseOptionsText?jQuery(DOMPurify.sanitize('<div class="appstle_widget_title">'+RS.Config.purchaseOptionsText+"</div>")):"",j=jQuery('<div class="appstle_subscription_wrapper"></div>'),I=RS.Config.tooltipTitle&&RS.Config.showTooltip&&!RS.Config.showStaticTooltip?jQuery(DOMPurify.sanitize('<div class="appstle-tootltip-parent"><div data-appstle-icon="" class="appstle_tooltip_wrapper">\n                        <svg width="90" height="90" viewBox="0 0 90 90" xmlns="http://www.w3.org/2000/svg" class="tooltip_subscription_svg">\n                          <path d="M45 0C20.1827 0 0 20.1827 0 45C0 69.8173 20.1827 90 45 90C69.8173 90 90 69.8174 90 45C90.0056 44.6025 89.9322 44.2078 89.7839 43.8389C89.6357 43.47 89.4156 43.1342 89.1365 42.8511C88.8573 42.568 88.5247 42.3432 88.158 42.1897C87.7912 42.0363 87.3976 41.9573 87 41.9573C86.6024 41.9573 86.2088 42.0363 85.842 42.1897C85.4753 42.3432 85.1427 42.568 84.8635 42.8511C84.5844 43.1342 84.3643 43.47 84.2161 43.8389C84.0678 44.2078 83.9944 44.6025 84 45C84 66.5748 66.5747 84 45 84C23.4253 84 6 66.5747 6 45C6 23.4254 23.4253 6 45 6C56.1538 6 66.3012 10.5882 73.4375 18H65.4062C65.0087 17.9944 64.614 18.0678 64.2451 18.2161C63.8762 18.3643 63.5405 18.5844 63.2573 18.8635C62.9742 19.1427 62.7494 19.4753 62.596 19.842C62.4425 20.2088 62.3635 20.6024 62.3635 21C62.3635 21.3976 62.4425 21.7912 62.596 22.158C62.7494 22.5247 62.9742 22.8573 63.2573 23.1365C63.5405 23.4156 63.8762 23.6357 64.2451 23.7839C64.614 23.9322 65.0087 24.0056 65.4062 24H79.8125C80.6081 23.9999 81.3711 23.6838 81.9337 23.1212C82.4963 22.5586 82.8124 21.7956 82.8125 21V6.59375C82.821 6.18925 82.7476 5.78722 82.5966 5.41183C82.4457 5.03644 82.2205 4.69545 81.9344 4.40936C81.6483 4.12327 81.3073 3.898 80.9319 3.7471C80.5565 3.5962 80.1545 3.52277 79.75 3.53125C79.356 3.53941 78.9675 3.62511 78.6067 3.78344C78.2458 3.94177 77.9197 4.16963 77.6469 4.45402C77.3741 4.73841 77.16 5.07375 77.0168 5.44089C76.8737 5.80803 76.8042 6.19977 76.8125 6.59375V12.875C68.6156 4.86282 57.3081 0 45 0ZM43.75 20.75C43.356 20.7582 42.9675 20.8439 42.6067 21.0022C42.2458 21.1605 41.9197 21.3884 41.6469 21.6728C41.3741 21.9572 41.16 22.2925 41.0168 22.6596C40.8737 23.0268 40.8042 23.4185 40.8125 23.8125V47.375C40.8116 47.7693 40.8883 48.16 41.0385 48.5246C41.1886 48.8892 41.4092 49.2207 41.6875 49.5L54.0938 61.9375C54.6573 62.5011 55.4217 62.8177 56.2188 62.8177C57.0158 62.8177 57.7802 62.5011 58.3438 61.9375C58.9073 61.3739 59.224 60.6095 59.224 59.8125C59.224 59.0155 58.9073 58.2511 58.3438 57.6875L46.8125 46.1875V23.8125C46.821 23.408 46.7476 23.006 46.5966 22.6306C46.4457 22.2552 46.2205 21.9142 45.9344 21.6281C45.6483 21.342 45.3073 21.1168 44.9319 20.9658C44.5565 20.8149 44.1545 20.7415 43.75 20.75Z">\n                          </path>\n                        </svg>\n                        <span class="appstle_tooltip_title">'.concat(RS.Config.tooltipTitle,'</span>\n                        <div class="appstle_tooltip">\n                          <div class="appstle_tooltip_content">\n                              ').concat(RS.Config.tooltipDesctiption,"\n                          </div>\n                          ").concat(RS.Config.showAppstleLink?'<div class="appstle_tooltip_appstle">\n                            <a href="https://appstle.com/" class="appstle_link" target="_blank">\n                              POWERED BY APPSTLE\n                            </a>\n                          </div></div>':"<span></span>","\n                                        </div>\n                                      </div>"))):RS.Config.showTooltip&&RS.Config.showStaticTooltip&&jQuery(DOMPurify.sanitize('<div class="appstle_tooltip_wrapper_static">'.concat(RS.Config.tooltipDesctiption,"</div>"))),R&&R.appendTo(D),addSubscriptionItems(j,t),e=createJsonformat(),j.appendTo(D),I&&I.appendTo(D)),null==(o=product)||!o.available)if("false"==(null==(_=RS.Config)?void 0:_.widgetEnabledOnSoldVariant))return void logger("Product is SOLD OUT (INVENTORY NOT AVL), that's why widget is not visible. Please enable 'widget enabled on Sold out variants'");jQuery(Q).length&&0<$(Q).closest('form[action$="/cart/add"]').length&&(logger("Please remove app block from theme section, if widget is not visible."),T=jQuery(Q).first());var m,b,h,w,v,P,S,C=null;RSConfig.allWidgetTemplateHtml&&(S=JSON.parse(RSConfig.allWidgetTemplateHtml),-1!==(null==(m=product)||null==(m=m.tags)?void 0:m.indexOf("WIDGET_TYPE_1"))?C=S.WIDGET_TYPE_1:-1!==(null==(b=product)||null==(b=b.tags)?void 0:b.indexOf("WIDGET_TYPE_2"))?C=S.WIDGET_TYPE_2:-1!==(null==(h=product)||null==(h=h.tags)?void 0:h.indexOf("WIDGET_TYPE_3"))?C=S.WIDGET_TYPE_3:-1!==(null==(w=product)||null==(w=w.tags)?void 0:w.indexOf("WIDGET_TYPE_4"))?C=S.WIDGET_TYPE_4:-1!==(null==(v=product)||null==(v=v.tags)?void 0:v.indexOf("WIDGET_TYPE_5"))?C=S.WIDGET_TYPE_5:-1!==(null==(P=product)||null==(P=P.tags)?void 0:P.indexOf("WIDGET_TYPE_6"))&&(C=S.WIDGET_TYPE_6)),(C=null==(p=C=C||(null==(r=RSConfig)?void 0:r.widgetTemplateHtml))||null==(p=p.replace("{% raw %}",""))?void 0:p.replace("{% endraw %}",""))&&(D&&jQuery(D).remove(),D=jQuery(Mustache.render(C,e))),T&&0!=(null==(c=T)?void 0:c.length)||logger("No element found for given widget selector. Please check widget selector value in Theme Integration/Theme Settings."),1<(null==(d=T)?void 0:d.length)&&logger("ATC button selector is not unique. Please check widget selector value in Theme Integration/Theme Settings."),"BEFORE"===y?D.insertBefore(T):"AFTER"===y?D.insertAfter(T):"FIRST_CHILD"===y?D.prependTo(T):"LAST_CHILD"===y&&D.appendTo(T),updateWidgetElements(),jQuery(document).trigger("appstle_widget_updated"),jQuery("#appstle_subscription_widget"+widgetId).find("[name=selling_plan]").length!==jQuery("#appstle_subscription_widget"+widgetId).parents("form").find("[name=selling_plan]").length&&logger("There are other elements named selling_plan present from other app like Preorder which might impact Appstle's app compatibility."),window.DashPreorders&&logger("Store is using Dash pre-order app which might impact Appstle's app compatibility.")}O=a}}}catch(e){console.error(e)}},setTimeout(function(){t(),updateWidgetUIBasedOnQueryParams()},13),attachMutationObserver('[name="id"]',t),null!=(n=RSConfig)&&n.forceReloadWidgetSelector&&attachMutationObserver(null==(n=RSConfig)?void 0:n.forceReloadWidgetSelector,t),standAloneElement?(standAloneElement.closest('form[action$="/cart/add"]').on("change",function(){var e;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay)?parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay):30)}),standAloneElement.closest('form[action$="/cart/add"]').on("click",function(){var e;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay)?parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay):30)}),standAloneElement.closest('form[action$="/cart/add"]').find("*").on("click",function(){var e;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay)?parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay):30)})):(jQuery(document).on("change",function(e){var n;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(n=RSConfig)?void 0:n.scriptLoadDelay)?parseInt(null==(n=RSConfig)?void 0:n.scriptLoadDelay):30)}),jQuery("[name=id]").on("change",function(){var e;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay)?parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay):30)}),jQuery(document).on("click",function(){var e;setTimeout(function(){var e;t(),updateHistoryState(),null!=(e=window)&&e._transcy&&null!=(e=window)&&null!=(e=e._transcy)&&null!=(e=e.methods)&&e.reConvertCurrency()},0<parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay)?parseInt(null==(e=RSConfig)?void 0:e.scriptLoadDelay):30)}))),!0===urlIsAccountPage()&&(n=DOMPurify.sanitize(RSConfig.selectors.subscriptionLinkSelector),null!=(i=jQuery("#appstle-subscription-manage-subscription-button-placeholder"))&&i.length&&(n="#appstle-subscription-manage-subscription-button-placeholder"),0===jQuery(n).length&&(n=".customer.account div:nth-child(2) div:nth-child(2), #customer_orders, div.orders-history, ul.breadcrumbs.colored-links, aside > span.desktop, header.section-header.text-center, div.page-width > h1, div.grid__item.lg--up--one-third > h1, header.account-header.clearfix, div.section>h2, header.page-header, div.account-details> h2, div.grid-item.two-thirds.medium-down--one-whole > header.page-header, div .container.tc > .wrap_cat, article > div.account-page--column-large.account-order-history, account-page> h1.large-title, #customer_sidebar, #customer-wrapper, .section.section__wrapper.is-width-standard > header, header.section-header, div.order-form > div:nth-child(1), div.logged-in-as, #account-page-template > div.grid--full, div.section-header.section-header--large, div.account-title.row.row-lg, #MainContent > div > header, #MainContent > div > div > div.grid__item.medium-up--four-fifths, .order-history, div.grid__item.two-thirds.medium-down--one-whole > p.h4--body, .active  > .tabs__content, #content > div > div:nth-child(3) > div.col-sm-8 > div, #MainContent > h2.small--text-center, .customer__orders >h2, .o-layout > div:first-child > h2:first-child, .content-block > h2, #tt-pageContent > div > div > div > div:nth-child(2) > h3, #main > section > div > div.layout > div:nth-child(2) > div, .grid__item.large-up--two-thirds >h3, div.grid__item.two-thirds.medium-down--one-whole > h4, div.twelve > h1, div.section-header, .section-header, #site-main > section > header, #content > div.page-content > header:nth-child(1) > div > h1, #MainContent .customer.account > div:nth-child(2) > div:nth-child(2) > h2, #MainContent > div > div:nth-child(2) > div:nth-child(2) > h2, .product-form__buttons.product__add-container, a.m-button.m-button--primary, #MainContent .f-customer.f-customer__account > div:nth-child(2) > div:nth-child(2) > h2, .customer > div:nth-child(2) > div:nth-child(2) > h2:nth-child(1)"),i=RSConfig.selectors.subscriptionLinkPlacement,l=DOMPurify.sanitize(RSConfig.manageSubscriptionBtnFormat),a=DOMPurify.sanitize(widgetLabels["appstle.subscription.wg.manageSubscriptionButtonTextV2"]||"Manage Subscription"),null!=(e=window)&&null!=(e=e.__st)&&e.cid||RSConfig.customerId)&&window.location.pathname.endsWith("/account")&&(l=Mustache.render(l,{manageSubscriptionButtonText:a}),1<jQuery(n).length&&(n=jQuery(n).last()),"after"===i.toLowerCase()?jQuery(n).after(l):"first_child"===i.toLowerCase()?jQuery(l).prependTo(n):"last_child"===i.toLowerCase()?jQuery(l).appendTo(n):jQuery(n).before(l),accountPageStyle())},deferJquery(appstleSubscriptionFunction),null!=(_RSConfig77=RSConfig)&&_RSConfig77.reloadPriceSelector&&jQuery(DOMPurify.sanitize(RSConfig.priceSelector)).length&&(atcButtonSelector=buildAtcButtonSelector(),atcButton=jQuery(atcButtonSelector).first(),standAloneElement&&(atcButton=standAloneElement),_targetNode=null!=(_RSConfig78=RSConfig)&&_RSConfig78.widgetParentSelector?null==(_jQuery$parents3=jQuery(atcButton).parents(null==(_RSConfig79=RSConfig)?void 0:_RSConfig79.widgetParentSelector))?void 0:_jQuery$parents3.find(null==(_RSConfig80=RSConfig)?void 0:_RSConfig80.reloadPriceSelector)[0]:jQuery(DOMPurify.sanitize(null==(_RSConfig81=RSConfig)?void 0:_RSConfig81.reloadPriceSelector))[0],config1={attributes:!0,childList:!0,subtree:!0},callback=function(e,n){var t;(null!=(t=RSConfig)&&t.widgetParentSelector?jQuery(atcButton).parents(null==(t=RSConfig)?void 0:t.widgetParentSelector).find(RSConfig.priceSelector+'[data-appstle-price-modified="true"]'):jQuery(DOMPurify.sanitize(RSConfig.priceSelector+'[data-appstle-price-modified="true"]'))).length||updateSellingPlanValueToFinalPrice()},_observer=new MutationObserver(callback),_targetNode)&&config1&&_observer.observe(_targetNode,config1),dispatchAppstleEvent("widgetInitialised",widgetId))}function getBillingCycleText(e){var n=e%10,t=e%100;return 1==n&&11!=t?e+"<sup>st</sup>":2==n&&12!=t?e+"<sup>nd</sup>":3==n&&13!=t?e+"<sup>rd</sup>":e+"<sup>th</sup>"}function renderStandAloneWidget(){var e,i=Array.prototype.slice.call(jQuery(".appstle_stand_alone_selector:not(.appstle_stand_alone_selector_processed)")),l=-1+(null==(e=jQuery(".appstle_stand_alone_selector.appstle_stand_alone_selector_processed"))?void 0:e.length);!function n(){var t,e;null!=i&&i.length&&(t=i.shift(),jQuery(t).addClass("appstle_stand_alone_selector_processed"),e=$(t).data("product-data"),l+=1,jQuery(t).parents("form").find(".appstle_sub_widget").length?n():e?(forceRenderWithProductHandle(e,$(t),l),n()):0<(null==(e=jQuery(t).data("product-handle"))?void 0:e.length)?fetch(((null==(e=Shopify)||null==(e=e.routes)?void 0:e.root)||"/")+"products/".concat(jQuery(t).data("product-handle"),".js")).then(function(e){if(e.ok)return e.json();throw new Error("HTTP error! Status: ".concat(e.status))}).then(function(e){jQuery(t).attr("data-product-data",e),renderWidget(e,$(t),l),n()}).catch(function(e){console.error(e)}):logger("The product-handle property is not available in stand-alone feature."))}()}function urlIsProductPage(){var e;return decodeURIComponent(window.location.pathname).includes("/products/")||decodeURIComponent(window.location.pathname).includes("/products_preview")||(null==(e=window)?void 0:e.appstlePreview)}function urlIsAccountPage(){var e;return"/account"===window.location.pathname||(null==(e=window.location.pathname)?void 0:e.endsWith("/account"))||(null==(e=window.location.pathname)?void 0:e.includes("/account"))}function forceRenderWithProductHandle(e,n,t){var i;!e&&urlIsProductPage()||(null!=e&&null!=(i=e.selling_plan_groups)&&i.length?renderWidget(e,n,t):null!=e&&e.handle&&fetch(((null==(i=Shopify)||null==(i=i.routes)?void 0:i.root)||"/")+"products/".concat(null==e?void 0:e.handle,".js")).then(function(e){if(e.ok)return e.json();throw new Error("HTTP error! Status: ".concat(e.status))}).then(function(e){renderWidget(e,n,t)}).catch(function(e){console.error(e)}),urlIsAccountPage()&&renderWidget(e,n,t))}function wrapPriceWithSpanTag(e){var n=document.createElement("textarea");return n.innerHTML=decodeURI(encodeURI(e)),DOMPurify.sanitize(n.value)}function formatPrice(e){var n=RS.Config.moneyFormat,t=n,i=(n&&(t=null==n||null==(n=n.replace("{% raw %}",""))?void 0:n.replace("{% endraw %}","")),"string"==typeof e&&(e=e.replace(".","")),""),n=/\{\{\s*(\w+)\s*\}\}/,l="undefined"!=typeof Shopify&&Shopify.money_format&&1<Shopify.money_format.length?Shopify.money_format:"";var a,s="undefined"!=typeof theme?theme.moneyFormat||theme.money_format||(theme.settings&&theme.settings.moneyFormat?theme.settings.moneyFormat:theme.strings?theme.strings.moneyFormat:""):"",o="";function r(e,n,t,i){return t=t||",",i=i||".",isNaN(e)||null===e?0:(n=(e=(e/100).toFixed(n)).split("."))[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+t)+(n[1]?i+n[1]:"")}switch((o="true"===(null==(a=RS.Config)?void 0:a.formatMoneyOverride)?RS.Config.moneyFormat:(null==(a=window)?void 0:a.shopifyCurrencyFormat)||(null==(a=window)||null==(a=a.Currency)?void 0:a.money_format_no_currency)||s||(null==(a=RSConfig)?void 0:a.shopMoneyFormat)||t||l||(s=RSConfig.shopMoneyFormatWithCurrencyFormat,(new DOMParser).parseFromString(s,"text/html").documentElement.textContent)||(null==(a=window)?void 0:a.moneyFormat)).match(n)[1]){case"amount":i=r(e,2);break;case"amount_no_decimals":i=r(e,0);break;case"amount_with_comma_separator":i=r(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":i=r(e,0,".",",");break;case"amount_no_decimals_with_space_separator":i=r(e,0," ");break;case"amount_with_apostrophe_separator":i=r(e,2,"'")}return wrapPriceWithSpanTag(o.replace(n,i))}function displaySubscriptionPrice(){appstlePriceDisplaySelectorExists()&&(addFeaturePageCSS(),jQuery(".appstle_stand_alone_price_display_selector:not(.appstle_stand_alone_price_display_selector_processed)").each(function(e){var n,t=this,i=$(t).data("product-data");i?processSubscriptionPrice(t,i):(i=$(t).data("product-handle"),fetch(((null==(n=Shopify)||null==(n=n.routes)?void 0:n.root)||"/")+"products/".concat(i,".js")).then(function(e){if(e.ok)return e.json();throw new Error("HTTP error! Status: ".concat(e.status))}).then(function(e){processSubscriptionPrice(t,e)}))}))}function processSubscriptionPrice(e,n){var t=Number.MAX_SAFE_INTEGER,i=!1;null!=n&&null!=(n=n.variants)&&n.forEach(function(e){null!=e&&null!=(e=e.selling_plan_allocations)&&e.forEach(function(e){var n;(null==e||null==(n=e.price_adjustments[0])?void 0:n.price)<t&&(t=null==e||null==(n=e.price_adjustments[0])?void 0:n.price,i=!0)})}),i&&($(e).siblings((null==(n=RSConfig)?void 0:n.landingPagePriceSelector)||(null==(n=RS)||null==(n=n.Config)?void 0:n.landingPagePriceSelector)||"span.price, span.appstle_hide_old_price, .price").hide(),$(e).html(DOMPurify.sanitize(wrapPriceWithSpanTag(buildSubscribeSaveSelector(t))))),$(e).show(),$(e).addClass("appstle_stand_alone_price_display_selector_processed")}console.log("jQuery is loaded, after "+tookTime+" milliseconds!"),RS.Config=Object.assign(RS.Config,"undefined"!=typeof _RSConfig&&null!==_RSConfig?_RSConfig:{}),window.RSConfig=RS.Config,"WIDGET_TYPE_1"===(null==(_RSConfig2=RSConfig)?void 0:_RSConfig2.widgetType)?RSConfig.switchRadioButtonWidget=!0:RSConfig.switchRadioButtonWidget=!1,window.getCurrentSellingPlanId=function(){return jQuery("[name=selling_plan]:checked").val()||""},appstleStandAloneSelectorExists()?!1===(null==(_RSConfig88=RSConfig)||null==(_RSConfig88=_RSConfig88.appstlePlanFeatures)?void 0:_RSConfig88.enableWidgetPlacement)&&!urlIsProductPage()||renderStandAloneWidget():forceRenderWithProductHandle(null==(_RSConfig89=RSConfig)?void 0:_RSConfig89.product,void 0,0),jQuery(document).on("click","".concat(null==(_window21=window)||null==(_window21=_window21.RS)||null==(_window21=_window21.Config)?void 0:_window21.quickViewClickSelector)||"a.grid-product__link",function(){var e,t;0<jQuery(DOMPurify.sanitize("".concat(null==(e=window)||null==(e=e.RS)||null==(e=e.Config)?void 0:e.quickViewClickSelector)||"a.grid-product__link")).length&&(t=function(){var e;appstleStandAloneSelectorExists()?renderStandAloneWidget():0==(null==(e=jQuery("#appstle_subscription_widget0"))?void 0:e.length)&&renderWidget(void 0,void 0,0)},"".concat(null==(e=window)||null==(e=e.RS)||null==(e=e.Config)?void 0:e.quickViewModalPollingSelector)||"mahalia-coffee.myshopify.com"==(null==(e=window)||null==(e=e.Shopify)?void 0:e.shop)?function e(){var n;jQuery(".quickshop.quickshop-visible.quickshop-loaded").length||jQuery(DOMPurify.sanitize("".concat(null==(n=window)||null==(n=n.RS)||null==(n=n.Config)?void 0:n.quickViewModalPollingSelector))).length?t():setTimeout(function(){e()},200)}():setTimeout(function(){t()},1e3))}),!1!==(null==(_RSConfig91=RSConfig)||null==(_RSConfig91=_RSConfig91.appstlePlanFeatures)?void 0:_RSConfig91.enableWidgetPlacement)&&setTimeout(displaySubscriptionPrice,30);var targetNode=document.querySelector("body"),config={attributes:!0,childList:!0,subtree:!0},observer=new MutationObserver(displaySubscriptionPrice),isSellingPlanPresent;function addFeaturePageCSS(){var e=null==(e=RSConfig)?void 0:e.css;jQuery("<style>.appstle_subscribesavetext{\n                  background-color:#c00303;\n                  color:#fff;\n                  padding:4px 8px;\n                  font-size:13px;\n                }</style>\n                  <style>".concat(DOMPurify.sanitize(null==e?void 0:e.customCSS,purifyConfig),"</style>")).appendTo(jQuery("head"))}function buildSubscribeSaveSelector(e){var n,e={subscriptionPrice:formatPrice(e)};return null!=(n=RSConfig)&&n.subscriptionPriceDisplayText?-1===(null==(n=RSConfig)?void 0:n.subscriptionPriceDisplayText.indexOf("{{subscriptionPrice}}"))&&logger("Collection page price text field seems incorrect. Please add {{subscriptionPrice}} as value."):logger("Collection page price text field seems empty. Please add {{subscriptionPrice}} as value."),wrapPriceWithSpanTag(Mustache.render(null==(n=RSConfig)?void 0:n.subscriptionPriceDisplayText,e))}function appstleStandAloneSelectorExists(){return jQuery(".appstle_stand_alone_selector").length&&urlIsProductPage()&&logger("If widget is not visible then use standalone selector for product pages."),0<jQuery(".appstle_stand_alone_selector").length}function appstlePriceDisplaySelectorExists(){return 0<jQuery(".appstle_stand_alone_price_display_selector").length}function appstleSubscriptionCustomerPortalInit(n){var e;if(n=n||"#AppstleCustomerPortal",document.querySelector(n))return jQuery.get("/".concat(null==(e=RSConfig)?void 0:e.manageSubscriptionUrl,"?renderType=html")).then(function(e){jQuery(n).html(e),document.dispatchEvent(new Event("AppstleSubscription:CustomerPortal:Embedded")),window.dispatchEvent(new Event("AppstleSubscription:CustomerPortal:Embedded"))}).catch(function(e){return console.error("error",e)})}function appstleSubscriptionBabInit(e,n){var t;if(null!=(t=jQuery(n=n||"#AppstleBabMain"))&&t.length){if(!1!==(null==(t=RSConfig)||null==(t=t.appstlePlanFeatures)?void 0:t.enableWidgetPlacement))return jQuery.get("/".concat(null==(t=RSConfig)?void 0:t.manageSubscriptionUrl,"/bb/").concat(e,"?renderType=html")).then(function(e){jQuery(n).html(e),document.dispatchEvent(new Event("AppstleSubscription:Bab:Embedded")),window.dispatchEvent(new Event("AppstleSubscription:Bab:Embedded"))}).catch(function(e){return console.error("error",e)})}else logger("BaB selector passed is wrong. Please recheck the Bab selector for custom loading BAB to any page.")}function fetchAddJsSellingPlanInterCeptor(){var m,s=window.fetch,o=JSON.parse(RS.Config.labels);jQuery.ajaxSetup({beforeSend:function(e,n){console.log(e),console.log(n.data),console.log(n.url),"/cart/add.js"===(null==n?void 0:n.url)&&(e=$(".appstle_sub_widget input[name=selling_plan]:checked").val())&&(n.data=n.data+"&selling_plan=".concat(e))}}),m=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(n){if(-1!==this._url.indexOf("/cart/add")){var e,t,i,l,a,s,o,r,p,c,d,u,g,f,_=null,y=$(".appstle_sub_widget input[name=selling_plan]:checked").val();if(y)try{"{"===n.substr(0,1)&&"}"===n.substr(-1)?(_=JSON.parse(n),t=new URLSearchParams(window.location.search).get("variant"),i={},"Object"===getClassOf(_)&&"Array"==getClassOf(null==(e=_)?void 0:e.items)?0<=(a=null==(l=_)||null==(l=l.items)?void 0:l.findIndex(function(e){return e.id==t}))?(r=null==(s=_)||null==(s=s.items)?void 0:s.filter(function(e){return e.id!=t}),(p=JSON.parse(JSON.stringify(null==(o=_)?void 0:o.items[a]))).selling_plan=$(".appstle_sub_widget input[name=selling_plan]:checked").val(),r.push(p),i.items=JSON.parse(JSON.stringify(r)),m.call(this,JSON.stringify(i))):m.call(this,JSON.stringify(_)):(_.selling_plan=y,m.call(this,JSON.stringify(_)))):"{"!==n.substr(0,1)&&"}"!==n.substr(-1)&&-1!==n.indexOf("&")?m.call(this,n+"&selling_plan=".concat(y)):m.call(this,n)}catch(e){m.call(this,n)}else try{"FormData"===getClassOf(n)?(n.set("selling_plan",$(".appstle_sub_widget input[name=selling_plan]:checked").val()||""),m.call(this,n)):"{"===(null==(c=n)?void 0:c.substr(0,1))&&"}"===(null==(d=n)?void 0:d.substr(-1))?((_=JSON.parse(n)).selling_plan="",m.call(this,JSON.stringify(_))):("{"!==(null==(u=n)?void 0:u.substr(0,1))&&"}"!==(null==(g=n)?void 0:g.substr(-1))&&-1!==(null==(f=n)?void 0:f.indexOf("&"))&&(n=n.split(/&selling_plan=\d+/).join("")),m.call(this,n))}catch(e){m.call(this,n)}}else m.call(this,n)},window.fetch=function(){var n,e,t,i,l=arguments[0],a=arguments[1];return l&&void 0!==l.indexOf&&-1!==l.indexOf("/cart/add")||l&&void 0!==l.indexOf&&-1!==l.indexOf("/wallets/checkouts.json")?jQuery(DOMPurify.sanitize(o["appstle.subscription.wg.valdiateFormSelectorV2"])).length&&!jQuery(DOMPurify.sanitize(o["appstle.subscription.wg.valdiateFormSelectorV2"]))[0].checkValidity()?(alert("Please provide the required details."),!1):(n=new URLSearchParams(window.location.search).get("variant"),"FormData"!==getClassOf(a.body)&&"Object"!==getClassOf(a.body)?isJsonString(null==a?void 0:a.body)?(l={},"Object"===getClassOf(e=JSON.parse(null==a?void 0:a.body))&&"Array"==getClassOf(null==e?void 0:e.items)?(0<=(t=null==e||null==(t=e.items)?void 0:t.findIndex(function(e){return e.id==n}))&&(i=null==e||null==(i=e.items)?void 0:i.filter(function(e){return e.id!=n}),(t=JSON.parse(JSON.stringify(null==e?void 0:e.items[t]))).selling_plan=$(".appstle_sub_widget input[name=selling_plan]:checked").val(),i.push(t),l.items=JSON.parse(JSON.stringify(i)),a.body=JSON.stringify(l)),s.apply(this,arguments)):"Object"===getClassOf(e)?((t=JSON.parse(null==a?void 0:a.body)).selling_plan=$(".appstle_sub_widget input[name=selling_plan]:checked").val(),a.body=JSON.stringify(t),s.apply(this,arguments)):void 0):((i=$(".appstle_sub_widget input[name=selling_plan]:checked").val())&&(a.body=a.body+"&selling_plan="+i),s.apply(this,arguments)):"FormData"===getClassOf(a.body)?(a.body.set("selling_plan",$(".appstle_sub_widget input[name=selling_plan]:checked").val()||""),s.apply(this,arguments)):void 0):s.apply(this,arguments)}}function isJsonString(e){try{JSON.parse(e)}catch(e){return}return 1}function getClassOf(e){return Object.prototype.toString.call(e).slice(8,-1)}function dispatchAppstleEvent(e,n){document.dispatchEvent(new CustomEvent("AppstleSubscription:SubscriptionWidget:".concat(e),{detail:n})),window.dispatchEvent(new CustomEvent("AppstleSubscription:SubscriptionWidget:".concat(e),{detail:n}))}function urlParamsToObject(e){for(var n=(null==e||null==(e=e.substr(1))?void 0:e.split("&"))||location.search.substr(1).split("&"),t={},i=0;i<n.length;i++){var l=n[i].split("=");t[l[0]]=l[1]}return t}function urlParam(e,n){return urlParamsToObject(n)[e]||null}function attachMutationObserver(e,n){var e=document.querySelector(e),t={attributes:!0,childList:!0,subtree:!0},n=new MutationObserver(n);e&&n.observe(e,t)}function detectSwapAction(){"swap"==urlParam("action")&&(attatchHandlerToSwapButtons(),addSwapButton(),attachMutationObserver("main",function(){return addSwapButton()}),jQuery("<style>.appstle-swap-product .appstle-swap-product-loader, .appstle-swap-product .appstle-swap-product-success, .appstle-swap-product .appstle-swap-product-error,\n              .appstle-swap-product.inProgress .appstle-swap-product-text, .appstle-swap-product.inProgress .appstle-swap-product-success, .appstle-swap-product.inProgress .appstle-swap-product-error,\n              .appstle-swap-product.success .appstle-swap-product-text, .appstle-swap-product.success .appstle-swap-product-loader, .appstle-swap-product.success .appstle-swap-product-error ,\n              .appstle-swap-product.error .appstle-swap-product-text, .appstle-swap-product.error .appstle-swap-product-success, .appstle-swap-product.error .appstle-swap-product-loader {\n                display: none;\n              }\n\n              .appstle-swap-product .appstle-swap-product-text,\n              .appstle-swap-product.inProgress .appstle-swap-product-loader,\n              .appstle-swap-product.success .appstle-swap-product-success,\n              .appstle-swap-product.error .appstle-swap-product-error {\n                display: block;\n              }</style>").appendTo("head"))}function addSwapButton(e){$(e||".product-block:not(.sold-out) ").each(function(e,n){$(n).find(".appstle-swap-product").length||$(n).append('<button class="appstle-swap-product"><span class="appstle-swap-product-text">SWAP</span><span class="appstle-swap-product-loader">Swapping</span><span class="appstle-swap-product-success">Swapped</span><span class="appstle-swap-product-error">Error</span></button>')})}function attatchHandlerToSwapButtons(){$(document).on("click",".appstle-swap-product",function(){var n=$(this),e=(n.addClass("inProgress"),getTargetVariantId(this)),t=urlParam("lineId"),i=urlParam("contractId"),i="/apps/subscriptions/cp/api/subscription-contract-details/replace-variants-v2?contractId=".concat(i,"&newVariantId=").concat(e,"&quantity=","1","&oldLineId=").concat(t);fetch(i,{method:"POST"}).then(function(e){n.removeClass("inProgress"),e.ok?(n.addClass("success"),location.href="/account"):n.addClass("error"),setTimeout(function(){return resetButton(n)},2500)}).catch(function(e){n.removeClass("inProgress"),n.addClass("error"),setTimeout(function(){return resetButton(n)},2500)})})}function resetButton(e){e.removeClass("inProgress"),e.removeClass("success"),e.removeClass("error")}function getTargetVariantId(e){var e=$(e),n=null;return n||(e=e.parent().find("a").attr("href"),n=urlParam("variant",null==(e=new URL(location.origin+e))?void 0:e.search)),n}function addToShipmentButton(){var t=JSON.parse(RS.Config.labels);$("[appstle-add-to-shipment-selector]").each(function(e,n){$(n).find(".appstle-add-to-shipment").length||($(n).find(".appstle-add-to-shipment-disabled").remove(),$(n).append(DOMPurify.sanitize('<button class="appstle-add-to-shipment" type="button"><span class="appstle-add-to-shipment-text">'.concat(t["appstle.subscription.wg.addToShipmentButtonTextV2"]||"Add to Subscription",'</span><span class="appstle-add-to-shipment-loader">').concat(t["appstle.subscription.wg.addToShipmentProcessingV2"]||"Processing...",'</span><span class="appstle-add-to-shipment-success">').concat(t["appstle.subscription.wg.addToShipmentSuccessTextV2"]||"Added",'</span><span class="appstle-add-to-shipment-error">').concat(t["appstle.subscription.wg.addToShipmentErrorTextV2"]||"Error","</span></button>"))))})}function addToShipmentButtonDisabled(){var t=JSON.parse(RS.Config.labels);"true"!==t["appstle.subscription.wg.displayAddToExistingSubscriptionButtonForNotLoggedInV2"]&&!0!==t["appstle.subscription.wg.displayAddToExistingSubscriptionButtonForNotLoggedInV2"]||$("[appstle-add-to-shipment-selector]").each(function(e,n){$(n).find(".appstle-add-to-shipment-disabled").length||$(n).append(DOMPurify.sanitize('<button class="appstle-add-to-shipment-disabled appstle_shipment_tooltip_wrapper" disabled><span class="appstle-add-to-shipment-text">'.concat(t["appstle.subscription.wg.addToShipmentButtonTextV2"]||"Add to Subscription",'</span>\n              <div class="appstle_shipment_tooltip">\n                <div class="appstle_shipment_tooltip_content">\n                  ').concat(t["appstle.subscription.wg.addToShipmentTooltipTextV2"]||"Please avoid double delivery charges! Login to add this product to an upcoming delivery.","\n                </div>\n              </div>\n              </button>")))})}function detectVariantForAddToShipment(e){var e=$(e.target),n=urlParam("variant");if(n&&null!=(l=RSConfig)&&l.detectVariantFromURLParams)return n;var t=e.closest('form[action$="/cart/add"]').find("[name=id]");if(0<t.length)for(var i=0;i<t.length;i++)if(t[i].value&&jQuery(t[i]).is(":checked"))return t[i].value;var l=jQuery("[name=id][form=".concat(e.closest('form[action$="/cart/add"]').attr("id"),"]"));return null!=l&&l.length?l.val():null!=e&&e.length?(null==jQuery(e).closest('form[action$="/cart/add"]').find("[name=id]")[0]?null:jQuery(e).closest('form[action$="/cart/add"]').find("[name=id]")[0].value)||(null==(n=jQuery(e).parents("html").find('form[action$="/cart/add"]').find("[name=id]")[0])?void 0:n.value):void 0}function initiateAppstleAddToShipmentWidget(){var e;null!=(e=RSConfig)&&e.customerId?jQuery.get("/".concat(RSConfig.appstle_app_proxy_path_prefix,"/cp/api/subscription-customers-detail/valid/").concat(RSConfig.customerId,"?token=").concat(RSConfig.customerId),function(e){e=e.filter(function(e){return"active"===(null==e?void 0:e.status)});null!=e&&e.length&&(window.appstleContractData=e,addToShipmentButton(),attachMutationObserver("main",function(){return addToShipmentButton()}),$(document).on("click",".appstle-add-to-shipment",function(e){window.top.appstleCurrentVariant=detectVariantForAddToShipment(e),document.dispatchEvent(new CustomEvent("OpenAppstleContracts"))}))}):addToShipmentButtonDisabled()}observer.observe(targetNode,config),jQuery(".appstle-bab").each(function(e,n){appstleSubscriptionBabInit(jQuery(n).attr("data-bab-id"),n)}),window.appstleSubscriptionCustomerPortalInit=appstleSubscriptionCustomerPortalInit,window.appstleSubscriptionBabInit=appstleSubscriptionBabInit,appstleSubscriptionCustomerPortalInit(),document.dispatchEvent(new Event("AppstleSubscription:CustomerPortal:ReadyToEmbed")),window.dispatchEvent(new Event("AppstleSubscription:CustomerPortal:ReadyToEmbed")),1!==(null==(_jQuery8=jQuery(".appstle_stand_alone_selector"))?void 0:_jQuery8.length)&&!0!==urlIsProductPage()||"true"!==(null==(_window30=window)||null==(_window30=_window30.RS)||null==(_window30=_window30.Config)?void 0:_window30.enableAddJSInterceptor)||(isSellingPlanPresent=!1,jQuery.each(RSConfig.product.selling_plan_groups,function(e,n){"appstle"===n.app_id&&(isSellingPlanPresent=!0)}),isSellingPlanPresent&&fetchAddJsSellingPlanInterCeptor());var addToShipment=function(e,n){var t;if(e)return t=e=null==(t=window)?void 0:t.appstleCurrentVariant,n.removeClass("error"),n.removeClass("success"),n.addClass("inProgress"),e="/apps/subscriptions/cp/api/v2/subscription-contracts-add-line-item?contractId=".concat(null==(e=window.appstleContractData[0])?void 0:e.subscriptionContractId,"&quantity=",1,"&variantId=gid://shopify/ProductVariant/").concat(t),jQuery.ajax({url:e,type:"PUT"}).done(function(e){n.removeClass("inProgress"),n.addClass("success")}).fail(function(e){n.removeClass("inProgress"),n.addClass("error")})};function loggerForCartWidget(e,n,t){e.find(n).length?1<e.find(n).length&&logger('Cart widget "'.concat(t,'" is wrong as the selector should be unique and for the current selector there are more than one element.')):logger('Cart widget "'.concat(t,'" is missing/wrong.'))}detectSwapAction(),null!=(_RSConfig$product$sel=RSConfig.product.selling_plan_groups)&&_RSConfig$product$sel.length&&null!=(_RSConfig102=RSConfig)&&null!=(_RSConfig102=_RSConfig102.product)&&_RSConfig102.available&&!1!==(null==(_RSConfig103=RSConfig)||null==(_RSConfig103=_RSConfig103.appstlePlanFeatures)?void 0:_RSConfig103.enableAddToExistingSubscription)&&("true"===(null==(_RSConfig104=RSConfig)?void 0:_RSConfig104.enableAddToExistingSubscriptionFeature)||!0===(null==(_RSConfig105=RSConfig)?void 0:_RSConfig105.enableAddToExistingSubscriptionFeature))&&initiateAppstleAddToShipmentWidget(),window.appstleAddToCart=function(e){var n=jQuery(e).parents("form")[0],n={items:[Object.fromEntries(new FormData(n))]},t=jQuery(e).find("[data-add-to-cart-text]"),i=jQuery(e).find("[data-loader]");t.hide(),i.show(),fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(function(e){e.ok?window.location.href="/cart":(t.show(),i.hide())}).catch(function(e){t.show(),i.hide()})},jQuery(DOMPurify.sanitize(RSConfig.selectors.cartHiddenAttributesSelector)).each(function(e,n){jQuery(n).text().includes("_appstle")&&jQuery(n).hide()}),null!=(_RSConfig106=RSConfig)&&null!=(_RSConfig106=_RSConfig106.selectors)&&_RSConfig106.BuildABoxDiscountSelector&&jQuery(DOMPurify.sanitize(RSConfig.selectors.BuildABoxDiscountSelector)).each(function(e,n){jQuery(n).text().includes("BUILD_A_BOX_DISCOUNT")&&jQuery(n).hide()}),!1!==(null==(_window32=window)||null==(_window32=_window32.RS)||null==(_window32=_window32.Config)||null==(_window32=_window32.appstlePlanFeatures)?void 0:_window32.enableCartWidget)&&"true"===(null==(_window33=window)||null==(_window33=_window33.RS)||null==(_window33=_window33.Config)?void 0:_window33.enableCartWidgetFeature)&&null!=(_window34=window)&&null!=(_window34=_window34.RS)&&null!=(_window34=_window34.Config)&&_window34.selectors.cartRowSelector&&jQuery(null==(_window35=window)||null==(_window35=_window35.RS)||null==(_window35=_window35.Config)?void 0:_window35.selectors.cartRowSelector).length&&!function(e,n,t,i,l,a,s,o,r){var p,c,b=DOMPurify.sanitize(null==(e=window)||null==(e=e.RS)||null==(e=e.Config)?void 0:e.selectors.cartRowSelector),h=DOMPurify.sanitize(null==(n=window)||null==(n=n.RS)||null==(n=n.Config)?void 0:n.selectors.cartLineItemSelector),w="[data-appstle-selector]",v=DOMPurify.sanitize(null==(t=window)||null==(t=t.RS)||null==(t=t.Config)?void 0:t.selectors.cartLineItemPerQuantityPriceSelector),P=DOMPurify.sanitize(null==(i=window)||null==(i=i.RS)||null==(i=i.Config)?void 0:i.selectors.cartLineItemTotalPriceSelector),S=DOMPurify.sanitize(null==(l=window)||null==(l=l.RS)||null==(l=l.Config)?void 0:l.selectors.cartLineItemSellingPlanNameSelector),d=DOMPurify.sanitize(null==(a=window)||null==(a=a.RS)||null==(a=a.Config)?void 0:a.selectors.cartSubTotalSelector),C=DOMPurify.sanitize(null==(s=window)||null==(s=s.RS)||null==(s=s.Config)?void 0:s.selectors.cartLineItemPriceSelector),x=DOMPurify.sanitize(null==(o=RSConfig)?void 0:o.showCombinedSellingPlanCartWidget),u=DOMPurify.sanitize(null==(r=RSConfig)?void 0:r.combinedCartWidgetSelector),T=JSON.parse(RS.Config.labels),g="",R=!1;function f(){jQuery("#appstle_overlay").length||_(),jQuery(".appstle_subscription_cart_wrapper select").each(function(e,n){jQuery(n).off()}),jQuery(".appstle_subscribe_selected input").each(function(e,n){jQuery(n).off()}),jQuery(".appstle_subscribe_title").each(function(e,n){jQuery(n).off()}),jQuery(".appstle_selected_frequency").each(function(e,n){jQuery(n).off()}),fetch("/cart.js").then(function(e){return e.json()}).then(function(y){var t=[],m=[];if(null!=(e=RSConfig)&&e.disableCartWidgetOnVariants){var n=RSConfig.disableCartWidgetOnVariants.split(","),e=null==y||null==(e=y.items)?void 0:e.filter(function(e){return n.includes(null==e?void 0:e.id.toString())});if(null!=e&&e.length)return void jQuery("#appstle_overlay").remove()}function i(){var e;x&&(jQuery(".appstle-cartItem-wrapper").length&&jQuery(".appstle-cartItem-wrapper").remove(),e='<div class="appstle-cartItem-wrapper">\n            <span class="appstle-combined-cart-widget-text">Frequency</span>\n            <select class="appstle-combined-cart-widget-select"><option value="">'.concat(T["appstle.subscription.wg.selectDeliverOptionV2"]||"Select Delivery Option","</option></select>\n            </div>"),jQuery(e).insertBefore(u),jQuery(".appstle_progress-wrapper").length||jQuery('<div class="appstle_progress-wrapper">\n              <p class="appstle_progress_title"></p>\n              <div class="appstle_progress">\n                <div class="appstle_progress_bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>\n              </div>\n            </div>').insertBefore(".item-wrap.cart-item-wrap"),l(),jQuery(".appstle-cartItem-wrapper").find("select").on("change",function(e){!function n(t,i,l,a){if(!l)return;"appstle_unsubscribe"===l&&(a=!0);_();i=t.shift();var e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:null==(e=i)?void 0:e.key,quantity:(null==(e=i)?void 0:e.quantity)||1,selling_plan:a?"":l})};fetch("/cart/change.js?appstleUpdateAllLineItems=true",e).then(function(e){return e.json()}).then(function(e){setTimeout(function(){null!=t&&t.length?n(t,i,l,a):(location.reload(),f())},200)}).catch(function(e){return console.error(e)})}(null==y?void 0:y.items,null,e.target.value,!1)})),y.items.forEach(function(n,e){var t=m.filter(function(e){return e.handle===n.handle}).pop(),i=function(e,n){e=(null==e?void 0:e.variants.filter(function(e){return e.id===n})).pop();if(e&&null!=e&&e.selling_plan_allocations&&null!=e&&e.selling_plan_allocations.length)return!0;return!1}(JSON.parse(JSON.stringify(t)),null==n?void 0:n.variant_id),l=null==n||null==(l=n.selling_plan_allocation)||null==(l=l.selling_plan)?void 0:l.id,a=!!t.selling_plan_groups.find(function(e){return"appstle"===e.app_id});if(i&&a&&(null!=(i=RSConfig)&&i.showcartWidgetOnBundleItems||null==n||!n.properties["_appstle-bb-id"])){var s=jQuery(DOMPurify.sanitize('<div class="appstle_subscription_cart_wrapper">\n                  <div class="appstle_subscribe_title">\n                      <input type="checkbox"></input>\n                      <span class="appstle_discount_text"><span class="appstle_highest_discount">'.concat(T["appstle.subscription.wg.subscribeAndSaveInitalV2"],'</span></span>\n                  </div>\n                  <div class="appstle_subscribe_selected_wrapper" style="display: none;">\n                      <div class="appstle_subscribe_selected">\n                        <input type="checkbox" checked ').concat(null!=t&&t.requires_selling_plan?"disabled":"",'></input>\n                        <div class="appstle_subscribe_selected_text">').concat(T["appstle.subscription.wg.subscribeAndSaveSuccessV2"],'</div>\n                      </div>\n                      <div class="appstle_selected_frequency">\n                          <span class="appstle_deliveryText">{{deliveryText}}</span>&nbsp;\n                          <span class="appstle_applied_sellingPlanName">{{appliedSellingPlanName}}</span>\n                          <p class="appstle_applied_discountText"></p>\n                      </div>\n                  </div>\n                  <div class="appstle_radio_section" style="display: none">\n\n                      <select id="appstle_selling_plan_cart" data-product-select-id="').concat(JSON.parse(JSON.stringify(t)).id,"-").concat(l,'" class="appstle_select_cart" ').concat(R?'style="display: none !important;"':"","></select>\n                      ").concat(R?'<div class="appstle-cart-custom-select-wrapper" data-product-custom-select-id="'.concat(JSON.parse(JSON.stringify(t)).id,"-").concat(l,'">\n                    <div class="select_wrap">\n                      <ul class="default_option">\n                        <div class="appstle-icon">\n                          <ion-icon name="chevron-down-outline"></ion-icon>\n                        </div>\n                      </ul>\n                      <ul class="select_ul"></ul>\n                    </div>\n                  </div>'):"","\n                  </div>\n              </div>"))),a=JSON.parse(JSON.stringify(t)),o=s,r=l,p=JSON.parse(JSON.stringify(t.variants.filter(function(e){return e.id===n.id}).pop())),c=[],d=[];if(jQuery.each(a.selling_plan_groups,function(e,n){"appstle"===n.app_id&&jQuery.each(n.selling_plans,function(e,n){var t,i,l,a,s,o=function(e){var n=null==(n=RSConfig)?void 0:n.customerId,t=RSConfig.customer_tags||[],i=!0;!n&&RSConfig.memberOnlySellingPlansJson&&RSConfig.memberOnlySellingPlansJson[e]&&RSConfig.memberOnlySellingPlansJson[e].enableMemberInclusiveTag&&(i=!1);n&&RSConfig.nonMemberOnlySellingPlansJson&&RSConfig.nonMemberOnlySellingPlansJson[e]&&(i=!1);i&&n&&RSConfig.memberOnlySellingPlansJson&&RSConfig.memberOnlySellingPlansJson[e]&&(RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags&&RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags.trim()&&(n=RSConfig.memberOnlySellingPlansJson[e].memberInclusiveTags.split(","),n=D(t,n),i=0<n.length),RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags)&&RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags.trim()&&(n=RSConfig.memberOnlySellingPlansJson[e].memberExclusiveTags.split(",").map(function(e){return e.trim()}),e=D(t,n),i=!(0<e.length));return i}(n.id),r=p.selling_plan_allocations.find(function(e){return e.selling_plan_id===n.id});r&&(t=r.per_delivery_price,i=formatPrice(null==r?void 0:r.price),l=formatPrice(t),s=a=null,s=r&&r.price_adjustments&&2===r.price_adjustments.length?formatPrice(a=r.price_adjustments[1].price):(a=t,l),r=n.price_adjustments.shift(),o&&c.push({name:n.name,id:n.id,formattedPrice:l,price:t,totalPrice:i,secondPrice:a,secondFormattedPrice:s,discount:r?"percentage"===r.value_type?"".concat(r.value,"%"):formatPrice(r.value):"",deliveryText:n.options[0].name}),d.push({name:n.name,id:n.id,formattedPrice:l,price:t,totalPrice:i,secondPrice:a,secondFormattedPrice:s,discount:r?"percentage"===r.value_type?"".concat(r.value,"%"):formatPrice(r.value):"",deliveryText:n.options[0].name}))})}),0<c.length){c.sort(function(e,n){return e.price-n.price}),(c=null==(i=c)?void 0:i.map(function(n){var e=null==(e=RSConfig)||null==(e=e.sellingPlansJson)?void 0:e.find(function(e){return e.idNew==(n.idNew||"gid://shopify/SellingPlan/".concat(n.id))});return n.frequencySequence=(null==e?void 0:e.frequencySequence)||0,n})).sort(function(e,n){return e.frequencySequence-n.frequencySequence}),jQuery("<option />",{html:DOMPurify.sanitize(T["appstle.subscription.wg.selectDeliverOptionV2"]||"Select Delivery Option"),value:""}).appendTo(o.find("select")),R&&(jQuery(DOMPurify.sanitize('<li class="'.concat(r?"":"active",'" value="">\n          <div class="option">\n            <p>').concat(T["appstle.subscription.wg.selectDeliverOptionV2"]||"Select Delivery Option","</p>\n          </div>\n        </li>"))).appendTo(o.find(".appstle-cart-custom-select-wrapper .select_ul")),jQuery(DOMPurify.sanitize('<li data-selected-selling-plan="">\n                  <div class="option">\n                    <p>'.concat(T["appstle.subscription.wg.selectDeliverOptionV2"]||"Select Delivery Option","</p>\n                  </div>\n                </li>"))).appendTo(o.find(".appstle-cart-custom-select-wrapper .default_option"))),jQuery(c).each(function(e,n){var t=function(e){e=e.totalPrice==e.formattedPrice?{sellingPlanName:e.name,sellingPlanPrice:'<span class="transcy-money">'.concat(e.formattedPrice,"</span>"),secondSellingPlanPrice:'<span class="transcy-money">'.concat(e.secondFormattedPrice||e.secondSellingPlanPrice,"</span>"),discountText:null==e?void 0:e.discount,totalPrice:'<span class="transcy-money">'.concat(null==e?void 0:e.totalPrice,"</span>")}:{sellingPlanName:e.name,totalPrice:'<span class="transcy-money">'.concat(null==e?void 0:e.totalPrice,"</span>"),sellingPlanPrice:'<span class="transcy-money">'.concat(e.formattedPrice,"</span>"),secondSellingPlanPrice:'<span class="transcy-money">'.concat(e.secondFormattedPrice||e.secondSellingPlanPrice,"</span>"),discountText:e.discount};return wrapPriceWithSpanTag(Mustache.render(RS.Config.sellingPlanTitleText,e))}(n),i=(l(o.find("select")),jQuery(".appstle-cartItem-wrapper select"));function l(e){jQuery("<option />",{value:n.id,html:DOMPurify.sanitize(t),selected:r===(null==n?void 0:n.id)}).appendTo(jQuery(e))}x&&null!=i&&i.length&&!i.find("option[value=".concat(n.id,"]")).length&&l(i),R&&(jQuery(DOMPurify.sanitize('<li class="'.concat(r===(null==n?void 0:n.id)?"active":"",'" value="').concat(n.id,'">\n          <div class="option">\n            <p>').concat(t,"</p>\n          </div>\n        </li>"))).appendTo(o.find(".appstle-cart-custom-select-wrapper .select_ul")),r===(null==n?void 0:n.id))&&jQuery(o).find(".appstle-cart-custom-select-wrapper .default_option [data-selected-selling-plan] p").html(DOMPurify.sanitize(t))}),null!=a&&a.requires_selling_plan||null!=(i=RSConfig)&&i.removeUnsubscribeOption||jQuery("<option />",{value:"appstle_unsubscribe",html:DOMPurify.sanitize(T["appstle.subscription.wg.unsubscribeFrequencyTextV2"]||"Unsubscribe")}).appendTo(o.find("select"));if(a=d.filter(function(e){return(null==e?void 0:e.id)===r}).pop()){i=o.find(".appstle_selected_frequency .appstle_deliveryText").text().split("{{deliveryText}}").join(T["appstle.subscription.wg.deliveryEveryFrequencyTextV2"]||""),o.find(".appstle_deliveryText").html(DOMPurify.sanitize(i)),i=o.find(".appstle_selected_frequency .appstle_applied_sellingPlanName").text().split("{{appliedSellingPlanName}}").join(a.name),o.find(".appstle_applied_sellingPlanName").html(DOMPurify.sanitize(i)),i=o.find(".appstle_subscribe_selected_text").text().split("{{{discountValue}}}").join(a.discount),o.find(".appstle_subscribe_selected_text").html(DOMPurify.sanitize(i));{var u=a.id;a=o;var g=null==(g=RSConfig)||null==(g=g.sellingPlansJson)?void 0:g.find(function(e){return(null==e?void 0:e.id.split("/").pop())===String(u)}),f=[];null!=g&&null!=(_=g.appstleCycles)&&_.length&&null!=g&&null!=(_=g.appstleCycles)&&_.forEach(function(e){f.push(null==e?void 0:e.freeProductHandle)});(function n(t,i,l){var e;var a=t.shift();return!a||null!=(e=window)&&null!=(e=e.products)&&e[a]?t.length?n(t,i,l):O(i,l):fetch("/products/".concat(a,".js")).then(function(e){if(e.ok)return e.json()}).then(function(e){return window.products||(window.products={}),window.products[a]=e,t.length?n(t,i,l):O(i,l)})})(f,u,a)}}else i=o.find(".appstle_highest_discount").text().split("{{{discountValue}}}").join(c[0].discount),o.find(".appstle_highest_discount").html(DOMPurify.sanitize(i))}jQuery(s).find("select").on("change",function(e){j(null!=y&&y.items,n,t.id,e.target.value,!1)}),jQuery(s).find(".appstle_subscribe_selected input").on("change",function(e){j(null!=y&&y.items,n,t.id,"unsubscribe",!0)}),jQuery(s).find(".appstle_subscribe_title, .appstle_selected_frequency").on("click",function(){if(!R)return 1===jQuery(s).find("select option").length?(jQuery(s).find("select").val(jQuery(s).find("select option").attr("value")),jQuery(s).find("select").trigger("change")):$(this).parents(".appstle_subscription_cart_wrapper").find(".appstle_radio_section").show(),jQuery(this).hide(),!1;$(this).parents(".appstle_subscription_cart_wrapper").find(".appstle_radio_section").toggle(),$(this).find("input[type=checkbox]").length&&($(this).find("input[type=checkbox]").is(":checked")?($(this).find("input[type=checkbox]").prop("checked",!0),$(this).parents(".appstle_subscription_cart_wrapper").find(".appstle_radio_section").show()):($(this).find("input[type=checkbox]").prop("checked",!1),$(this).parents(".appstle_subscription_cart_wrapper").find(".appstle_radio_section").hide()))});var _,g=jQuery(jQuery(b)[e]);l&&(s.find(".appstle_subscribe_title").hide(),s.find(".appstle_subscribe_selected_wrapper").show(),R&&s.find(".appstle_radio_section").show(),loggerForCartWidget(g,S,"Cart Line Item Selling Plan Name Selector"),g.find(S).text(null==n||null==(_=n.selling_plan_allocation)||null==(_=_.selling_plan)?void 0:_.name),x)?g.find(S).show():g.find(S).hide(),g.find(".appstle_subscription_cart_wrapper").remove(),1===g.find(h).length?s.insertBefore(g.find(h)):s.insertBefore(g.find(w)),loggerForCartWidget(g,v,"Cart Line Item Per Quantity Price Selector"),loggerForCartWidget(g,P,"Cart Line Item Total Price Selector"),loggerForCartWidget(g,C,"Cart Line Item Price Selector"),loggerForCartWidget(g,h,"Cart Line Selector"),g.find(v).html(DOMPurify.sanitize(formatPrice(n.final_price))),g.find(P).html(DOMPurify.sanitize(formatPrice(n.final_line_price))),l&&n.selling_plan_allocation.compare_at_price&&(g.find(C).html(DOMPurify.sanitize("")),a='<span class="appstle_cart_sellingPlan_price">'.concat(formatPrice(n.final_price),'</span><span  class="appstle_cart_compare_price">').concat(formatPrice(n.selling_plan_allocation.compare_at_price),"</span>"),g.find(C).html(DOMPurify.sanitize(a)))}jQuery(jQuery(b)[e]).find(h).addClass("appstleCartWidgetProcessed")}),!x||m.filter(function(e){return e.requires_selling_plan}).length||null!=(e=RSConfig)&&e.removeUnsubscribeOption||jQuery("<option />",{value:"appstle_unsubscribe",html:DOMPurify.sanitize(T["appstle.subscription.wg.unsubscribeFrequencyTextV2"]||"Unsubscribe"),class:"sellingPlanOption"}).appendTo(jQuery(".appstle-cartItem-wrapper select")),jQuery(d).html(DOMPurify.sanitize(formatPrice(null==y?void 0:y.total_price))),jQuery("#appstle_overlay").remove()}function l(){var e="",e=(null==y?void 0:y.total_price)<9900?"You are ".concat(formatPrice(9900-(null==y?void 0:y.total_price))," away from checkout."):"Yay! you are eligible for checkout.",e=(jQuery(".appstle_progress_title").text(e),0),e=(null==y?void 0:y.total_price)<9900?100*(null==y?void 0:y.total_price)/9900:100;jQuery(".appstle_progress_bar").css("width","".concat(e,"%")),jQuery(".proceed-to-checkout, .proceed-to-checkout-error-text").remove(),jQuery(100===e?' <div class="proceed-to-checkout appstle-proceed-to-checkout">\n                          <a href="/checkout" class= "btn-style1 center">Proceed to Checkout</a>\n                      </div>':'<div class="proceed-to-checkout-error-text">please purcase atleast $99</div>').insertAfter(".cart-total")}0<(null==y||null==(e=y.items)?void 0:e.length)?((null==y||null==(e=y.items)?void 0:e.length)===jQuery(b).length?null!=y&&y.items.forEach(function(e){-1===t.indexOf(null==e?void 0:e.handle)&&t.push(null==e?void 0:e.handle)}):null!=(e=window)&&null!=(e=e.RS)&&null!=(e=e.Config)&&null!=(e=e.selectors)&&e.cartRowSelector&&null!=b&&b.length&&jQuery(b).length&&location.reload(),function n(){var e;t.length?(e=t.shift())?fetch("/products/".concat(e,".js")).then(function(e){return e.json()}).then(function(e){m.push(e),n()}):n():(i(),document.dispatchEvent(new Event("AppstleSubscription:CartWidget:Updated")),window.dispatchEvent(new Event("AppstleSubscription:CartWidget:Updated")))}()):jQuery("#appstle_overlay").remove()})}function _(e){jQuery("#appstle_overlay").length||jQuery("body").append(DOMPurify.sanitize("<div id='appstle_overlay'><div class='appstle_loader'></div><div class='appstle_loader_text'>"+(e||" ")+"</div></div></div>"))}function y(e,n,t,i,l,a,s,o){return JSON.parse(RS.Config.labels)["appstle.subscription.wg.loyaltyPerkDescriptionTextV2"]?(s={discount:n,discountType:t,formatDiscountedPrice:formatPrice(100*n),freeProductName:a,isDiscountTypePercentage:"PERCENTAGE"===t,isDiscountTypeFixedPrice:"PRICE"===t,isDiscountTypeShipping:"SHIPPING"===t,isDiscountTypeFreeProduct:"FREE_PRODUCT"===t,isFreeTrial:i,isCartPage:!0,featured_image:s,productPrice:o,billingCycleBlock:'<span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,"</span>"),orderCycleBlock:'<span class="appstle-loyalty-billing-cycle"><span class="order-cycle-block">'.concat(getBillingCycleText(parseInt(e)+1),"</span></span>")},Mustache.render(JSON.parse(RS.Config.labels)["appstle.subscription.wg.loyaltyPerkDescriptionTextV2"],s)):i?'Get <span class="appstle-loyalty-free-trial-discount">'.concat(n,' <span class="appstle-loyalty-free-trial-discount-count" style="text-transform: lowercase;">').concat(t).concat(1<n?"s":"",'</span></span> <span class="appstle-loyalty-free-trial-text">free trial.</span>'):"PERCENTAGE"===t?l?'<span class="appstle-loyalty-discount">Get <span class="appstle-loyalty-discount-amount">'.concat(n+"% off",'</span></span><span class="appstle-loyalty-billing-cycle"> after <span class="appstle-loyalty-billing-cycle-count">').concat(e,"</span> recurring order</span>."):'Thereafter <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> recurring order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(n+"% off","</span></span>."):"SHIPPING"===t?l?'<span class="appstle-loyalty-discount">Get <span class="appstle-loyalty-discount-amount">'.concat("shipping at ".concat(formatPrice(100*n)),'</span></span><span class="appstle-loyalty-billing-cycle"> after <span class="appstle-loyalty-billing-cycle-count">',e,"</span> recurring order</span>."):'Thereafter <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> recurring order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">',"shipping at ".concat(formatPrice(100*n)),"</span></span>."):"FREE_PRODUCT"===t?l?'<span class="appstle-loyalty-discount">Get a<span class="appstle-loyalty-discount-amount"> FREE PRODUCT ('.concat(a,')</span></span><span class="appstle-loyalty-billing-cycle"> after <span class="appstle-loyalty-billing-cycle-count">').concat(e,"</span> recurring order</span>."):'Thereafter <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> recurring order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">FREE PRODUCT (').concat(a,")</span></span>."):"FIXED"===t?l?'<span class="appstle-loyalty-discount">Get <span class="appstle-loyalty-discount-amount">'.concat(formatPrice(100*n)+" off",'</span></span><span class="appstle-loyalty-billing-cycle"> after <span class="appstle-loyalty-billing-cycle-count">').concat(e,"</span> recurring order</span>."):'Thereafter <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> recurring order</span>, <span class="appstle-loyalty-discount">get <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n)+" off","</span></span>."):"PRICE"===t?l?'<span class="appstle-loyalty-discount">Get at <span class="appstle-loyalty-discount-amount">'.concat(formatPrice(100*n),'</span></span><span class="appstle-loyalty-billing-cycle"> after <span class="appstle-loyalty-billing-cycle-count">').concat(e,"</span> recurring order</span>."):'Thereafter <span class="appstle-loyalty-billing-cycle"><span class="appstle-loyalty-billing-cycle-count">'.concat(e,'</span> recurring order</span>, <span class="appstle-loyalty-discount">get at <span class="appstle-loyalty-discount-amount">').concat(formatPrice(100*n),"</span></span>."):void 0}function O(n,e){var t,s=null==(t=RSConfig)||null==(t=t.sellingPlansJson)?void 0:t.find(function(e){return(null==e?void 0:e.id.split("/").pop())===String(n)}),o="";null!=s&&s.freeTrialEnabled&&(o=y(0,s.freeTrialCount,s.freeTrialInterval,null==s?void 0:s.freeTrialEnabled,!0)),null!=s&&s.afterCycle2&&(o=o+"".concat(null!=s&&s.freeTrialEnabled?" ":"")+y(getBillingCycleText(s.afterCycle2),s.discountOffer2,s.discountType2,!1,!(null!=s&&s.freeTrialEnabled))),null==s||null==(t=s.appstleCycles)||!t.length||null!=s&&s.freeTrialEnabled||null!=s&&null!=(t=s.appstleCycles)&&t.forEach(function(n,e){var t,i="",l="",a="";"FREE_PRODUCT"===(null==n?void 0:n.discountType)&&(i=null==(t=window)||null==(t=t.products)||null==(t=t[n.freeProductHandle])?void 0:t.title,1<(null==(t=window)||null==(t=t.products)||null==(t=t[null==n?void 0:n.freeProductHandle])?void 0:t.variants.length)&&(i=i+" - "+(null==(t=(null==(t=window)||null==(t=t.products)||null==(t=t[null==n?void 0:n.freeProductHandle])?void 0:t.variants.filter(function(e){return(null==e?void 0:e.id)===parseInt(null==n?void 0:n.freeVariantId)})).pop())?void 0:t.title)),l=null==(t=window)||null==(t=t.products)||null==(t=t[n.freeProductHandle])?void 0:t.featured_image,a=formatPrice(null==(t=window)||null==(t=t.products)||null==(t=t[n.freeProductHandle])?void 0:t.price)),null!=s&&s.afterCycle2&&e<1?o=o+" "+y(getBillingCycleText(n.afterCycle),n.value,n.discountType,!1,!1,i):null!=s&&s.afterCycle2||e<2&&(o=0==e?y(getBillingCycleText(n.afterCycle),n.value,n.discountType,!1,!0,i,l,a):o+" "+y(getBillingCycleText(n.afterCycle),n.value,n.discountType,!1,!1,i,l,a))}),e.find(".appstle_applied_discountText").html(DOMPurify.sanitize(o))}function j(e,n,t,i,l){var a,s;i&&(dispatchAppstleEvent((l="appstle_unsubscribe"===i?!0:l)?"SwitchedToOneTime":"SwitchedToSubscription",n.key),_(),s=RSConfig.sellingPlansJson.filter(function(e){return e.id==="gid://shopify/SellingPlan/".concat(i)}).pop(),a=!1,null!=s&&s.formFieldJson&&"null"!==(null==s?void 0:s.formFieldJson)&&JSON.parse(null==s?void 0:s.formFieldJson).forEach(function(e){"date"===(null==e?void 0:e.type)&&(a=!0)}),s={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:null==n?void 0:n.key,quantity:(null==n?void 0:n.quantity)||1,selling_plan:l?"":i,properties:Object.assign((null==n?void 0:n.properties)||{},a?{"_order-date":a?null==n?void 0:n.properties["_order-date"]:""}:{})})},fetch("/cart/change.js",s).then(function(e){return e.json()}).then(function(e){location.reload(),setTimeout(function(){f()},200)}).catch(function(e){return console.error(e)}))}function D(e,n){return e.filter(function(e){return-1!=n.indexOf(e)})}-1!==location.pathname.indexOf("/cart")&&(p=window.XMLHttpRequest.prototype.open,window.XMLHttpRequest.prototype.open=function(){this.addEventListener("load",function(){var e=this.responseURL;-1===e.indexOf("cart/change")&&-1===e.indexOf("cart/add")||-1!==e.indexOf("appstleUpdateAllLineItems=true")||g!==JSON.stringify(this.response)&&(jQuery("#appstle_overlay").length||_(),setTimeout(f,100),g=JSON.stringify(this.response))}),p.apply(this,arguments)},c=window.fetch,window.fetch=function(){var n=arguments,i=this;return new Promise(function(t,e){c.apply(i,n).then(function(e){var n=e.url;-1===n.indexOf("cart/change")&&-1===n.indexOf("cart/add")||-1!==n.indexOf("appstleUpdateAllLineItems=true")||(jQuery("#appstle_overlay").length||_(),setTimeout(f,100)),t(e)}).catch(function(e){console.error(e)})})},f(),e=null==(e=RSConfig)?void 0:e.css,jQuery("<style>\n           .appstle-subsccribe-cart-discount{\n                 margin-left: 2px;\n           }\n\n          .appstle_cart_radio_selected .appstle_cart_selling_plan_dropdown{\n              display: block;\n          }\n      .appstle_cart_radio_selected {\n            background-color: #eee;\n           border-radius: 6px;\n      }\n      .appstle-cart-radio-label{\n        margin-left: 10px;\n      }\n      .appstle_subscription_cart_wrapper{\n        max-width: 100%;\n        justify-content: flex-start;\n        flex-direction: column;\n        font-size: 13px;\n      }\n        .appstle_cart_radio_label {\n          margin-left: 10px;\n          font-weight: bold;\n        }\n\n        .appstle_radio_section{\n        }\n        .appstle_subscribe_title {\n                cursor: pointer;\n                font-size: 13px;\n                display: flex;\n                align-items: center;\n                line-height: 1.5;\n                margin-bottom: 0.2rem;\n\n        }\n        .appstle_subscribe_title .appstle_highest_discount, .appstle_applied_sellingPlanName {\n                border-bottom: 1px solid currentColor;\n        }\n\n        .appstle_subscribe_title input {\n                margin-right: 5px;\n        }\n\n        .appstle_subscribe_selected {\n                display: flex;\n                align-items: center;\n                margin-bottom: 0.2rem;\n\n        }\n\n        .appstle_subscribe_selected input {\n                margin-right: 5px;\n        }\n\n        .appstle_selected_frequency  {\n               display: inline;\n               margin-bottom: 0.2rem;\n               cursor: pointer;\n        }\n\n        .appstle_selected_frequency .appstle_applied_sellingPlanName {\n                 border-bottom: 1px solid currentColor;\n        }\n\n        .appstle_highest_discount, .appstle_applied_sellingPlanName {\n                color: #198946;\n        }\n\n#appstle_overlay {\nwidth: 100%;\nheight: 100%;\nposition: fixed;\ntop: 0;\nleft: 0;\nbackground: rgba(0, 0, 0, 0.7);\nz-index: 999999;\ntext-align: center;\n}\n\n.appstle_loader {\nborder: 6px solid rgba(255, 255, 255, 0.2);\nposition: absolute;\nleft: 50%;\ntop: 50%;\nmargin-top: -36px;\nmargin-left: -36px;\nborder-top: 6px solid #fff;\nborder-radius: 50%;\nwidth: 60px;\nheight: 60px;\nanimation: appstle_loading_spin 0.7s linear infinite; }\n\n.appstle_loader:empty {\n  display: block;\n}\n\n.appstle_loader_text {\nposition: absolute;\nleft: 50%;\ntop: calc(50% + 60px);\ntransform: translate(-50%, -50%);\ncolor: white;\n}\n\n.appstle_subscribe_selected input[type=checkbox] {\nheight: inherit;\n}\n\n.appstle_cart_compare_price {\ntext-decoration: line-through;\nfont-size: 13px;\nmargin-left: 5px;\nopacity: 0.85;\n}\n.appstle-loyalty-billing-cycle-count, .appstle-loyalty-discount-amount, .appstle-loyalty-free-trial-discount {\ncolor: #198946;\nfont-weight: bold;\n}\n\n\n.appstle-combined-cart-widget-select {\nwidth: 100%;\n}\n\n.appstle_progress-wrapper {\nmargin: 30px 0;\n}\n\n.appstle_progress {\ndisplay: flex;\nheight: 10px;\noverflow: hidden;\nline-height: 0;\nfont-size: 7.5px;\nbackground-color: #e9ecef;\nborder-radius: 2.5px;\n}\n\n.appstle_progress_bar {\ndisplay: flex;\nflex-direction: column;\njustify-content: center;\noverflow: hidden;\ncolor: #fff;\ntext-align: center;\nwhite-space: nowrap;\nbackground-color: #4cb849;\ntransition: width .6s ease;\n}\n\n.appstle-cartItem-wrapper {\nmargin: 20px 0;\n}\n.appstle-proceed-to-checkout {\ntext-align: center;\nmargin: 15px 0;\n}\n\n\n@keyframes appstle_loading_spin {\n0% {\ntransform: rotate(0deg); }\n\n100% {\ntransform: rotate(360deg); } }\n\n@-webkit-keyframes spin {\n0% {\ntransform: rotate(0deg); }\n\n100% {\ntransform: rotate(360deg); } }\n\n".concat(R?".appstle_subscribe_title input:before, .appstle_subscribe_selected input:before {\ncontent: '';\nposition: absolute;\nwidth: 22px;\nheight: 22px;\nbackground: white;\nborder-radius: 50%;\ntransform: translate(-50%, -50%);\ntop: 50%;\nleft: 50%;\nborder: 1px solid #c2bfbf;\nopacity: 1;\n\n}\n.appstle_subscribe_title input:checked:before, .appstle_subscribe_selected input:checked:before {\nbackground: #000;\nborder: 1px solid #000;\nbackground-size: cover;\nbackground-image: url(https://ik.imagekit.io/mdclzmx6brh/checkmark-outline_sKMJp3BD0.svg?updatedAt=1688306310408);\n}\n\n.appstle_subscribe_title input, .appstle_subscribe_selected input {\nposition: relative;\n}\n\n.appstle_discount_text {\npadding-left: 30px !important;\n}\n\nbody td.cart-item__details {\nborder: none !important;\n}\n\n.appstle_selected_frequency {\ndisplay: none;\n}\n\n:root {\n--bg-clr: #8681ce;\n--white: #fff;\n--dd-list-hvr: #f6f6f7;\n--text-clr: #2c3e50;\n}\n\n.appstle-cart-custom-select-wrapper * {\nlist-style: none;\nmargin: 0;\npadding: 0;\nbox-sizing: border-box;\nlist-style: none;\nfont-family: 'Helvetica';\nfont-size: 13px;\ncolor: #000;\nfont-size: 13px;\nuser-select: none;\n}\n\n.appstle-cart-custom-select-wrapper .title {\nfont-size: 14px;\ncolor: var(--white);\n}\n\n.select_wrap {\n\nposition: relative;\n}\n\n.select_wrap .default_option {\nbackground: var(--white);\nborder-radius: 3px;\nposition: relative;\ncursor: pointer;\n}\n\n.select_wrap .default_option .icon {\nposition: absolute;\ntop: 50%;\nright: 20px;\nfont-size: 13px;\nheight: 12px;\ntransition: all 0.5s ease;\ntransform-origin: center;\nwidth: 12px;\ntransform: translateY(-50%);\nright: 6px;\n}\n\n.select_wrap .default_option li {\npadding: 12px 24px;\nfont-weight: 700;\n}\n\n.select_wrap .select_ul {\nposition: absolute;\ntop: 45px;\nleft: 0;\nwidth: 100%;\npadding: 10px;\nbackground: var(--white);\nborder-radius: 3px;\ndisplay: none;\nborder: 1px solid #c2bfbf;\nz-index: 1;\n}\n\n.select_wrap .select_ul li {\npadding: 10px 20px;\ncursor: pointer;\nborder-radius: 3px;\nmargin-bottom: 1px;\n}\n\n.select_wrap .select_ul li:last-child {\nmargin-bottom: 0;\n}\n\n.select_wrap .select_ul li:hover,\n.select_wrap .select_ul li.active {\nbackground: var(--dd-list-hvr);\n}\n\n.select_wrap .option {\ndisplay: flex;\nalign-items: center;\n}\n\n.select_wrap.active .select_ul {\ndisplay: block;\n}\n\n.select_wrap.active .default_option .icon {\ntop: 13px;\ntransform: rotate(180deg);\n}\n.appstle_subscription_cart_wrapper {\npadding: 0 !important;\n}\n.appstle_subscribe_title, .appstle_subscribe_selected {padding: 9px;}\n\n.select#appstle_selling_plan_cart {display: none !important;}\n.appstle-cart-custom-select-wrapper {border-top: 1px solid #c2bfbf;}\n.appstle_subscribe_title {margin-bottom: 0 !important;}\nul.default_option .option {\npadding-left: 22px;\n}\n\nul.default_option .option:before {\ncontent: \"\";\nposition: absolute;\nbackground: url(https://cdn.shopify.com/s/files/1/0727/4908/9081/files/Screenshot_4.png?v=1686315491);\nbackground-size: 100%;\nwidth: 40px;\nheight: 28px;\nleft: 0px;\nbackground-repeat: no-repeat;\n}\n\n.appstle_subscribe_selected_text {padding-left: 20px;}\n.appstle_subscription_cart_wrapper {\nborder: 1px solid #c2bfbf;\nborder-radius: 3px;\n}\n\n.appstle_subscribe_selected input[type=checkbox] {left: 4px;}\n.appstle_subscribe_title .appstle_highest_discount, .appstle_applied_sellingPlanName {border: none; color: currentColor;}\n.appstle_discount_text {\npadding-left: 18px !important;\n}":"","\n\n        </style>\n    <style>").concat(DOMPurify.sanitize(null==e?void 0:e.customCSS,purifyConfig),"</style>")).appendTo(jQuery("head"))),R&&(jQuery(document).on("click",".default_option",function(){jQuery(this).parent().toggleClass("active")}),jQuery(document).on("click",".select_ul li",function(){var e=jQuery(this).html();jQuery(this).parents(".appstle_radio_section").find(".default_option li").html(DOMPurify.sanitize(e)),jQuery(this).parents(".appstle_radio_section").find(".select_ul li").removeClass("active"),jQuery(this).addClass("active"),jQuery(this).parents(".select_wrap").removeClass("active"),jQuery(this).parents(".appstle_radio_section").find("select").val(jQuery(this).attr("value")),jQuery(this).parents(".appstle_radio_section").find("select").trigger("change")}))}()})}),null!=(_window50=window)&&_window50.Shopify&&null!=(_window51=window)&&null!=(_window51=_window51.Shopify)&&_window51.checkout&&isOrderEligibleForThankyouBox()&&null!=(_RS12=RS)&&null!=(_RS12=_RS12.Config)&&_RS12.showCheckoutSubscriptionBtn?(destination="/"+RS.Config.manageSubscriptionUrl,message=RS.Config.orderStatusManageSubscriptionDescription||"Continue to your account to view and manage your subscriptions.",Shopify.checkout&&Shopify.checkout.order_id?(console.log("orderId="+Shopify.checkout.order_id),fetch(location.origin+"/apps/subscriptions?action=customer_payment_token&order_id="+Shopify.checkout.order_id).then(function(e){return e.json()}).then(function(e){destination=destination+"?token="+e.token,Shopify.Checkout.OrderStatus.addContentBox('<h2 class="heading-2 os-step__title">'+(RS.Config.orderStatusManageSubscriptionTitle||"Subscription")+'</h2><div class="os-step__info--item"><p class="os-step__description" style="margin-top: 0.5714285714em;">'+message+'</p></div><a class="ui-button btn btn--subdued btn--size-small shown-if-js os-step__info" href="'+destination+'"> '+(RS.Config.orderStatusManageSubscriptionButtonText||"Manage your subscription")+"</a>")})):Shopify.Checkout.OrderStatus.addContentBox('<h2 class="heading-2 os-step__title">'+(RS.Config.orderStatusManageSubscriptionTitle||"Subscription")+'</h2><div class="os-step__info--item"><p class="os-step__description" style="margin-top: 0.5714285714em;">'+message+'</p></div><a class="ui-button btn btn--subdued btn--size-small shown-if-js os-step__info" href="'+destination+'"> '+(RS.Config.orderStatusManageSubscriptionButtonText||"Manage your subscription")+"</a>")):logger("Shopify object is not present here");var processFreeProduct=function(e){console.log("cart response",e);var t=[],i={};null!=e&&null!=(e=e.items)&&e.forEach(function(n){var e;null!=n&&null!=(e=n.selling_plan_allocation)&&null!=(e=e.selling_plan)&&e.id&&null!=(e=null==(e=null==(e=RSConfig)||null==(e=e.sellingPlansJson)?void 0:e.filter(function(e){return-1!==(null==e?void 0:e.id.indexOf(null==n||null==(e=n.selling_plan_allocation)||null==(e=e.selling_plan)?void 0:e.id))}).pop())||null==(e=e.appstleCycles)?void 0:e.filter(function(e){return 0==(null==e?void 0:e.afterCycle)&&"FREE_PRODUCT"==(null==e?void 0:e.discountType)}).pop())&&e.freeVariantId&&t.push({id:null==e?void 0:e.freeVariantId,quantity:null==n?void 0:n.quantity,properties:{_appstle_parent_product:null==n?void 0:n.id,_appstle_parent_selling_plan:null==n||null==(e=n.selling_plan_allocation)||null==(e=e.selling_plan)?void 0:e.id}}),null!=n&&null!=(e=n.properties)&&e._appstle_parent_product&&(i[null==n?void 0:n.key]=0)}),null!=(e=Object.keys(i))&&e.length?fetch(window.Shopify.routes.root+"cart/update.js?appstle=true",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:i})}).then(function(e){return e.json()}).then(function(e){console.log(e),null!=t&&t.length&&addFreeProducts(t)}):null!=t&&t.length&&addFreeProducts(t)},addFreeProducts=function(e){fetch(window.Shopify.routes.root+"cart/add.js?appstle=true",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e})}).then(function(e){}).catch(function(e){console.error("Error:",e)})},getCartData=function(){fetch("/cart.js").then(function(e){if(e.ok)return e.json()}).then(function(e){var n;!1!==(null==(n=RS)||null==(n=n.Config)||null==(n=n.appstlePlanFeatures)?void 0:n.accessSubscriberLoyaltyFeatures)&&processFreeProduct(e),processBaB(e)})},processBaB=function(e){var n,t=null;null!=e&&null!=(n=e.items)&&n.forEach(function(e){null!=e&&e.properties["_appstle-bb-id"]&&(t=null==e?void 0:e.properties["_appstle-bb-id"])}),processBaBItems(e,t)},processBaBItems=function(e,n){n&&fetch("/".concat(_RSConfig.appstle_app_proxy_path_prefix,"/bb/api/subscription-bundlings/discount/").concat(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cart:e})}).then(function(e){if(e.ok)return e.json()}).then(function(e){var n,e=null==e?void 0:e.discountCode;e&&fetch((null==(n=Shopify)||null==(n=n.routes)?void 0:n.root)+"discount/"+e)})},urlEligibleToIntercept=function(e){var n=["/add","/change"],t=!1;if(-1===e.indexOf("?appstle=true"))for(var i=0;i<n.length;i++)if(-1!==e.indexOf(n[i])){t=!0;break}return t},listenToCartChanges=function(){var e=window.XMLHttpRequest.prototype.open,l=(window.XMLHttpRequest.prototype.open=function(){this.addEventListener("load",function(){var e=this.responseURL;urlEligibleToIntercept(e)&&prevChangeResponse!==JSON.stringify(this.response)&&(setTimeout(getCartData,100),prevChangeResponse=JSON.stringify(this.response))}),e.apply(this,arguments)},window.fetch);window.fetch=function(){var n=arguments,i=this;return new Promise(function(t,e){l.apply(i,n).then(function(e){var n=e.url;urlEligibleToIntercept(n)&&setTimeout(getCartData,100),t(e)}).catch(function(e){console.error(e)})})}},prevChangeResponse="";listenToCartChanges(),getCartData()};appstleInit();