var loadScriptTag=function(t){return new Promise(function(e,n){var o=document.createElement("script");o.type="text/javascript",o.readyState?o.onreadystatechange=function(){"loaded"!=o.readyState&&"complete"!=o.readyState||(o.onreadystatechange=null,e())}:o.onload=function(){e()},o.onerror=function(){n(Error("Failed to load script with src: "+t))},o.src=t,document.getElementsByTagName("head")[0].appendChild(o)})},myFrontendJavascriptUN=function(t){function e(){var t=this;this.configure=function(){f.log("configuring ahoy")},this.start=function(){window.un.datastore.shop.id?f.log("starting ahoy and possibly creating a visit"):f.log("can't start analytics")},this.track=function(t,e){window.un.datastore.shop.id?f.log("track event: "+t,", with properties: "+e):f.log("can't track: "+t)}}function n(){var e=this,n=function(t){"undefined"==typeof un.debug&&(un.debug=[]),un.debug.push(t)},o=function(t){return"string"==typeof t&&""!==t},i=function(t){return void 0!==t&&null!=t&&!1!==t},r=function(t){return void 0!==t&&null!=t&&t.length>0},a=function(t,e){function n(t,e){return void 0===t?e:t}function o(t,e,o,i){if(e=n(e,2),o=n(o,","),i=n(i,"."),isNaN(t)||null==t)return 0;var r=(t=(t/100).toFixed(e)).split("."),a,c;return r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o)+(r[1]?i+r[1]:"")}if(void 0===t||null==t)return"";if("string"==typeof t&&0==t.length)return"";var i=/\{\{\s*(\w+)\s*\}\}/;"string"==typeof t&&(t=t.replace(".",""));var r="";switch(e.match(i)[1]){case"amount":r=o(t,2);break;case"amount_no_decimals":r=o(t,0);break;case"amount_no_decimals_with_comma_separator":r=o(t,0,".",",");break;case"amount_with_comma_separator":r=o(t,2,".",",")}return e.replace(i,r)},c=function(t){return Math.round(100*t)+"%"},u=function(){for(var t=document.getElementsByTagName("script"),n="",o="",i=0;i<t.length;i++)if((n=t[i].getAttribute("src"))&&(n=n.match(/^(.*)widget\/javascript(\?\s*(.+))?\s*/))){o=n[3].match(/shop=(.+).myshopify.com/)[1];break}return".myshopify.com"===(o+=".myshopify.com")&&e.objectChecker(window.Shopify)&&e.objectChecker(window.Shopify.shop)&&(o=window.Shopify.shop),".myshopify.com"===o&&console.log("UN: unable to get shop domain"),o},s=function(){return e.stringChecker(h.primary_domain)?h.primary_domain:h.shopify_domain},l=function(){var t=u(),e=/^un-(.+)-staging(.*)\.myshopify.com$/;return"un-chris-local-2.myshopify.com"===t?"https://wod.ngrok.io":"un-marc-local-pc.myshopify.com"===t?"https://wod4.ngrok.io":"un-teej-local-dev-env.myshopify.com"===t?"https://wod3.ngrok.io":"un-lem-local.myshopify.com"===t?"https://pc1.ngrok.io":t.match(e)?"https://upsell-now-staging.herokuapp.com":"https://upsell-now.herokuapp.com"},d=function(){var t=u(),e=/^un-(.+)-staging(.*)\.myshopify.com$/;return"un-chris-local-2.myshopify.com"===t?"https://wod.ngrok.io":"un-marc-local-pc.myshopify.com"===t?"https://wod4.ngrok.io":"un-teej-local-dev-env.myshopify.com"===t?"https://wod3.ngrok.io":t.match(e)?"https://upsell-now-api-staging.herokuapp.com":"https://upsell-now-api.herokuapp.com"},p=function(){return!("undefined"==typeof window.un||"undefined"==typeof window.un.datastore)},_=function(){return g()&&v().length>0},g=function(){return!(!p()||"undefined"==typeof window.un.datastore.shop)&&window.un.datastore.shop},v=function(){return p()&&"undefined"!=typeof window.un.datastore.offers?window.un.datastore.offers:[]},b=function(){return"undefined"!=typeof window.un&&"undefined"!=typeof window.un.offers?window.un.offers:[]},C=function(n){var o=!1,i=e.getOfferObjects();return f.arrayChecker(i)&&t.each(i,function(t,e){n===e.id&&(o=e)}),o},k=function(){return-1!==window.location.href.replace("https://","").indexOf("/products")},w=function(){return-1!==window.location.href.replace("https://","").indexOf("/cart")},P=function(){return-1!==window.location.href.indexOf("/collections/")&&-1===window.location.href.indexOf("/products/")},I=function(){return"/"===window.location.pathname},x=function(){return window.un.datastore.shop.enabled_on_homepage},O=function(){return window.un.datastore.shop.enabled_on_collection_pages},S=function(){return f.onHomePage()&&f.enabledOnHomePage()||f.onCollectionPage()&&f.enabledOnCollectionPage()||!f.onHomePage()&&!f.onCollectionPage()},T=function(){var e=1;return t('form[action="/cart/add"]:first').find("input[name=quantity]:visible").length>0&&(e=t('form[action="/cart/add"]:first').find("input[name=quantity]:visible").val()),Number(e)},D=function(){var n=window.un.datastore.theme_setting,i=window.un.datastore.shop,r=[["cart_subtotal_selector","cart_subtotal_selector"],["checkout_button_selector","checkout_button_selector"],["add_to_cart_form_selector","add_to_cart_form_selector"],["add_to_cart_button_selector","add_to_cart_button_selector"],["quantity_selector","quantity_selector"],["cart_form_selector","cart_form_selector"],["quantity_button_selector","quantity_button_selector"],["variant_selector","variant_selector"],["swatch_selector","swatch_selector"],["mutation_ids","mutation_ids"],["mutation_classes","mutation_classes"],["cart_bar_placement_selector","cart_bar_placement_selector"],["cart_bar_placement_position","cart_bar_placement_position"],["cart_bar_ajax_placement_selector","cart_bar_ajax_placement_selector"],["cart_bar_ajax_placement_position","cart_bar_ajax_placement_position"]];t.each(r,function(t,o){i[o[0]]=e.mergeValues(i[o[0]],n[o[1]])}),null==i.custom_css&&(i.custom_css=""),i.add_to_cart_button_selector=i.add_to_cart_button_selector+", .un-cloned-atc-btn",o(n.custom_css)&&(i.custom_css=i.custom_css+"\r\n"+n.custom_css),o(i.custom_css)&&t("head").append('<style type="text/css">'+i.custom_css+"</style>"),window.un.datastore.shop=i,window.un.addedToCart={}},A=function(t,e){return o(t)?t:e},F=function(t,e,n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);var i="expires="+o.toUTCString();document.cookie=t+"="+e+";"+i+";path=/"},j=function(t){var e=new Date;e.setTime(e.getTime()-2592e6);var n="expires="+e.toUTCString();document.cookie=t+"=;"+n+";path=/"},q=function(t){for(var e=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}return""},L=function(t){for(var e=[],n=t,o=document.cookie.split(";"),i=0;i<o.length;i++){for(var r=o[i];" "==r.charAt(0);)r=r.substring(1);0==r.indexOf(n)&&e.push(r)}return e},E=function(){var e=location.search.match(/variant=([0-9]+)/);return null!=e?e[1]:"radio"===t(h.add_to_cart_form_selector).find('select[name="id"], input[name="id"]').attr("type")?t(h.add_to_cart_form_selector).find('input[name="id"]:checked').val():t(h.add_to_cart_form_selector).find('select[name="id"], input[name="id"]').val()},Q=function(){if(!e.onProductPage())return null;if(void 0!==e.getCurrentVariantId()){var t=window.un.product.variants.find(function(t){return t.id.toString()===e.getCurrentVariantId().toString()});return void 0===t?(f.log("Unable to find current variant because current variant ID isn't matching a variant in un.product.variants object. Returning first variant in product object."),window.un.product.variants[0]):t}return f.log("Unable to find current variant because getCurrentVariantId() is returning undefined. Returning first variant in product object."),window.un.product.variants[0]},N=function(t){var n=e.getCookie("_un_discounted_line_item_"+t);return""!==n&&(n.indexOf("_")>-1?parseInt(n.split("_")[0]):parseInt(n))},M=function(t){var n=e.getCookie("_un_discounted_line_item_"+t);return""!==n&&(n.indexOf("_")>-1&&parseInt(n.split("_")[1]))},V=function(e){var n;if("function"==typeof Spinner){var o=new Spinner({top:"-50px",left:"50%",position:"relative"}).spin().el;t(e).first().after(o)}},R=function(){t(".spinner").remove()},U=function(e){t(e).css("background","#EEEEEE"),t(e).css("color","#FFFFFF"),t(e).css("border","1px solid #DDDDDD")},H=function(t){return!t.available},B=function(e,n,o){f.stringChecker(o)&&t(e).css(n,o)},K=function(){return window.location.href.indexOf("upsell-now-debug")<0},W=function(t){return t<0?0:t},z=function(t,e){return this.checkMutationIds(t,e)||this.checkMutationClasses(t,e)},G=function(e,n){var o=[],i=!1;return"ajaxCart"===n&&(o=["drawer","cart-drawer__item-list","cart-item__qty","mm-opened","cart-sidebar","opened","cart-preview","ajaxcart__inner","cart--is-visible"]),t.each(o,function(t,n){"undefined"!=typeof e.target.classList&&e.target.classList.contains(n)&&(i=!0)}),i},J=function(t,e){var n=[];return"ajaxCart"===e&&(n=["ajaxifyCart","cart-loading","AjaxifyCart","layer-addcart-modal"]),n.indexOf(t.target.id)>-1},$=function(t){if("string"==typeof t){var e=[];return e.push(t),e}return t},Y=function(){var t=f.getCookiesWithPartialName("_un_discounted_line_item_");return t=t.filter(function(t){return t.indexOf(y)<0&&t.indexOf(m)<0})},X=function(e,n){var o=["display","border","background","margin","padding","font-family","font-size","font-weight","height","width","text-transform","font-style","letter-spacing","flex","color","line-height","text-decoration","text-align","vertical-align","white-space","border-radius","cursor","position"];t.each(o,function(o,i){t(n).css(i,t(e).css(i))})};this.stringChecker=o,this.objectChecker=i,this.arrayChecker=r,this.unFormatCents=a,this.unFormatPercent=c,this.getShopifyDomain=u,this.getPrimaryDomain=s,this.getServerAddress=l,this.getAnalyticsApiUrl=d,this.checkDatastore=p,this.checkSettingsInDatastore=_,this.getShopInDatastore=g,this.getOffersInDatastore=v,this.getOfferObjects=b,this.onProductPage=k,this.onCartPage=w,this.onCollectionPage=P,this.onHomePage=I,this.enabledOnHomePage=x,this.enabledOnCollectionPage=O,this.getProductPageQuantityValue=T,this.mergeThemeAndShopSettings=D,this.mergeValues=A,this.setCookie=F,this.expireCookie=j,this.getCookie=q,this.getCookiesWithPartialName=L,this.getOfferIdForItemKeyFromCookie=N,this.getQuantityForItemKeyFromCookie=M,this.enableSpinner=V,this.disableSpinner=R,this.applyDisabledStyles=U,this.outOfStock=H,this.applyStyle=B,this.log=n,this.notInDebugMode=K,this.noNegative=W,this.enabledOnCurrentPage=S,this.getCurrentVariant=Q,this.getCurrentVariantId=E,this.checkMutations=z,this.checkMutationClasses=G,this.checkMutationIds=J,this.arrayify=$,this.getDiscountedLineItemsFromCookies=Y,this.getOfferById=C,this.cloneStyles=X}function o(e){var n=this,o=function(){n.checkBundleIntegrity()},i=function(){_.updateCart(function(){n.switchTempOriginalProductLinksToLineItemKeys(),n.clearOldLineItemKeys(),h.remove_upsell_products_if_original_product_removed&&(f.log("Checking for original products"),n.initAjaxCartMutationObserver(),n.disableRemoveButtonClickListeners(),n.createRemoveButtonClickEventListener(),n.checkIfOriginalProductStillInCart()),h.remove_upsell_products_if_trigger_products_removed&&(f.log("Checking for trigger product requirements"),n.checkTriggerProductRequirements()),h.prevent_upsell_product_qty_change&&(f.log("Checking for upsell product quantity changes"),n.checkUpsellProductQtys())})},r=function(){var e=f.getDiscountedLineItemsFromCookies(),n=[];t.each(e,function(t,e){var o=e.substring(0,e.indexOf("=")),i=o.substring(o.lastIndexOf("_")+1),r=f.getOfferIdForItemKeyFromCookie(i);if(r){var a=f.getOfferById(r);a&&(a.checkIfTriggerProductsInCart()||(f.log("Trigger products req not met for "+r+". Removing associated upsell items."),n.push(i)))}}),n.length>0&&(f.log("Removing line items:"+n),_.removeLineItemKeysFromCart(n))},a=function(){var e=f.getDiscountedLineItemsFromCookies();t.each(e,function(t,e){var n=e.substring(0,e.indexOf("=")),o=n.substring(n.lastIndexOf("_")+1);_.hasLineItemKey(o)||f.expireCookie(n)})},c=function(){var e=f.getDiscountedLineItemsFromCookies();t.each(e,function(t,e){var n=e.substring(0,e.indexOf("=")),o=n.substring(n.lastIndexOf("_")+1),i=f.getQuantityForItemKeyFromCookie(o),r;i!==_.getLineItemQuantity(o)&&(f.log("Upsell product quantity changed for: "+o+". Resetting quantity."),_.changeQuantity(o,i))})},u=function(){var e=f.getCookiesWithPartialName(m);t.each(e,function(t,e){var n=e.substring(e.lastIndexOf("_")+1,e.indexOf("=")),o=e.substring(e.indexOf("=")+1).split(",");_.hasLineItemKey(n)?f.log("Original product line item key found in cart."):(f.log("Original product line item key missing from cart. Removing upsell items."),o=f.arrayify(o),f.expireCookie(e.substring(0,e.indexOf("="))),_.removeLineItemKeysFromCart(o))})},s=function(){var t=n.generateOriginalProductVariantIdToUpsellKeyMap();n.setOriginalProductLineItemKeyToUpsellItemKeysCookie(t),n.clearTempOriginalProductLinkCookies()},l=function(){var e=f.getCookiesWithPartialName(y),n={};return t.each(e,function(t,e){var o=e.substring(y.length,e.indexOf("=")),i=e.substring(e.indexOf("=")+1,e.length);f.objectChecker(n[i])||(n[i]=[]),n[i].push(o)}),n},d=function(e){t.each(Object.keys(e),function(t,n){var o=_.getLastLineItemKeyForVariantId(n);if(o){var i=e[n].join(",");f.stringChecker(i)&&f.stringChecker(o)&&f.setCookie(m+o,i,30)}})},p=function(){var e=f.getCookiesWithPartialName(y);t.each(e,function(t,e){var n=e.substring(0,e.indexOf("="));f.expireCookie(n)})},g=function(){t(document).on("click",v,function(t){return t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation(),_.updateCart(function(){n.switchTempOriginalProductLinksToLineItemKeys(),n.handleRemoveButtonClick(t)}),!1})},b=function(){var t=!1,e=new MutationObserver(function(e){e.forEach(function(e){!t&&f.checkMutations(e,"ajaxCart")&&(setTimeout(function(){f.log("Ajax cart mutation triggered."),n.disableRemoveButtonClickListeners(),n.checkBundleIntegrity()},250),t=!0)}),setTimeout(function(){t=!1},2e3)}),o={attributes:!0,childList:!0,characterData:!0,subtree:!0},i=document.body;e.observe(i,o)},C=function(){t(".cart-item__remove, .cart-drawer__item-delete").removeAttr("data-cart-item-delete"),t.each(t(".cart-item__remove"),function(e,n){t(n).replaceWith(t(n).clone().removeClass("cart-item__remove").addClass("un-remove-btn"))})},k=function(t){var e=n.getRemovedLineItemKeyFromLink(t);if(e){var o=f.getCookie(m+e);if(f.stringChecker(o))f.log("Found upsell cookie, displaying warning"),n.showUpsellProductRemovalWarning(e,o);else{f.log("Couldn't find upsell item cookie for removed item.");var i=[];i.push(e),_.removeLineItemKeysFromCart(i)}}else f.log("Couldn't find line item key for removed item.")},w=function(e,o){var i=n.convertProductKeysToProductNames(e)[0],r=o.split(","),a=n.convertProductKeysToProductNames(r);if(a.length>0){var c=a.join(", "),u=h.removing_original_product_will_remove_upsell_products_warning.replace("{{original_product}}",i).replace("{{upsell_products}}",c),s,l;if(u=t("<div/>").html(u).text(),confirm(u))(l=[]).push(e),l=l.concat(r),f.expireCookie(m+e),_.removeLineItemKeysFromCart(l)}else{var l;f.log("No upsell items associated with line item key. Clearing cookie and removing item from cart."),(l=[]).push(e),f.expireCookie(m+e),_.removeLineItemKeysFromCart(l)}},P=function(e){var n=[];if("string"==typeof e){var o=_.getProductTitleFromLineItemKey(e);f.stringChecker(o)&&n.push(o)}else"object"==typeof e&&t.each(e,function(t,e){var o=_.getProductTitleFromLineItemKey(e);f.stringChecker(o)&&n.push(o)});return n},I=function(e){var n=!1,o=t(e.target).attr("href");if(f.stringChecker(o)||(o=t(e.target).parent().attr("href")),f.stringChecker(o)&&o.indexOf("line=")>=0){var i=/line=([0-9]+)/g.exec(o)[1]-1;n=un.cart.items[i].key}else n=t(e.target).parents(".cart-drawer__item").data("cart-item-id");return f.stringChecker(n)||(n=t(e.target).parents(".cart-row").data("id")),n};this.offers=e,this.startBundleEnforcer=o,this.switchTempOriginalProductLinksToLineItemKeys=s,this.createRemoveButtonClickEventListener=g,this.handleRemoveButtonClick=k,this.clearTempOriginalProductLinkCookies=p,this.generateOriginalProductVariantIdToUpsellKeyMap=l,this.setOriginalProductLineItemKeyToUpsellItemKeysCookie=d,this.getRemovedLineItemKeyFromLink=I,this.showUpsellProductRemovalWarning=w,this.convertProductKeysToProductNames=P,this.initAjaxCartMutationObserver=b,this.disableRemoveButtonClickListeners=C,this.checkBundleIntegrity=i,this.checkIfOriginalProductStillInCart=u,this.checkUpsellProductQtys=c,this.clearOldLineItemKeys=a,this.checkTriggerProductRequirements=r}function i(e){var n=this,o=function(){n.checkIfItemsWereAddedViaUpsellPopup(),n.updateCartPageWithDiscounts(),n.initRefreshCartPageEventHandler()},i=function(){n.updateDiscountedSubtotal(),n.updateLineItemPrices(),n.updateLineItemTotals(),h.cart_bar_enabled&&f.objectChecker(un.cart.un_total_discount)&&un.cart.un_total_discount>0&&n.showCartBar(),h.hide_express_checkout_buttons&&f.objectChecker(un.cart.un_total_discount)&&un.cart.un_total_discount>0&&(t("head").append('<style type="text/css">.additional-checkout-buttons,.google-wallet-button-holder,.amazon-payments-pay-button,.shopify-payment-button{\ndisplay:none !important;\n}</style>'),t(".additional-checkout-buttons, .google-wallet-button-holder,.amazon-payments-pay-button,.shopify-payment-button").css("display","none"))},r=function(){0===t("#un-cart-bar-page").length&&n.addBarToPage(h.cart_bar_placement_selector,h.cart_bar_placement_position,"un-cart-bar-page"),0===t("#un-cart-bar-ajax").length&&h.ajax_cart_integration_enabled&&n.addBarToPage(h.cart_bar_ajax_placement_selector,h.cart_bar_ajax_placement_position,"un-cart-bar-ajax"),n.applyBarStyles()},a=function(){f.stringChecker(h.cart_bar_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.cart_bar_font_family+'" rel="stylesheet">'),t(".un-cart-bar").css("font-family",h.cart_bar_font_family.replace(/\+/g," ")+", sans-serif")),f.applyStyle(".un-cart-bar","background-color",h.cart_bar_bg_color),f.applyStyle(".un-cart-bar","color",h.cart_bar_text_color),f.applyStyle(".un-cart-bar","padding",h.cart_bar_padding),f.applyStyle(".un-cart-bar","font-size",h.cart_bar_font_size),f.applyStyle(".un-cart-bar","border-radius",h.cart_bar_border_radius)},c=function(e,n,o){var i='<div class="un-cart-bar" style="display: none;" id="'+o+'">'+h.cart_bar_text+"</div>",r=h.cart_bar_fade_in_duration||0,a=h.cart_bar_fade_out_duration||0,c=h.cart_bar_display_duration||0;f.stringChecker(n)&&"after"!==n?"before"===n?t(e).before(i):"prepend"===n?t(e).prepend(i):"append"===n&&t(e).append(i):t(e).after(i),t(".un-cart-bar").fadeIn(1e3*r),c>0&&setTimeout(function(){t(".un-cart-bar").fadeOut(1e3*a)},1e3*c)},s=function(){f.stringChecker(h.cart_form_selector)&&(f.stringChecker(h.quantity_selector)&&t(document).on("change",h.quantity_selector,function(e){setTimeout(function(){t(h.cart_form_selector).submit()},1500)}),f.stringChecker(h.quantity_button_selector)&&t(document).on("click",h.quantity_button_selector,function(e){setTimeout(function(){t(h.cart_form_selector).submit()},1500)}))},l=function(){var e=d();t(h.cart_subtotal_selector).html(f.unFormatCents(e,h.money_with_currency_format))},d=function(){var e=0;return t.each(un.cart.items,function(t,n){f.objectChecker(n.un_total_discount_value)&&(e+=n.un_total_discount_value)}),un.cart.un_total_discount=e,un.cart.total_price-e},p=function(){var e=t(".un-line-item-unit-price");t.each(un.cart.items,function(n,o){f.objectChecker(o.un_discount_value)&&t.each(e,function(e,n){t(n).data("id")===o.key&&t(n).html(f.unFormatCents(o.un_discounted_price,h.money_format))})})},g=function(){var e=t(".un-line-item-total");t.each(un.cart.items,function(n,o){f.objectChecker(o.un_discount_value)&&t.each(e,function(e,n){if(t(n).data("id")===o.key){var i=o.line_price-o.un_total_discount_value;t(n).html(f.unFormatCents(i,h.money_format))}})})},m=function(){f.objectChecker(window.un.cart.items)&&t.each(window.un.cart.items,function(t,e){var o=f.getOfferIdForItemKeyFromCookie(e.key);if(o){var i=u.getActiveOfferById(o);f.objectChecker(i)&&n.applyOfferDiscountToItem(e,i)}})},y=function(t,e){"percentage_discount"===e.discountType?(t.appliedDiscount=n.percentageDiscountHash(t,e),t.un_discount_value=100*t.appliedDiscount.discount_amount,t.un_total_discount_value=100*t.appliedDiscount.total_discount_amount,t.un_discounted_price=t.price-t.un_discount_value):"fixed_amount_discount"===e.discountType?(t.appliedDiscount=n.fixedAmountDiscountHash(t,e),t.un_discount_value=e.discountFixedAmount,t.un_total_discount_value=t.appliedDiscount.total_discount_amount,t.un_discounted_price=t.price-e.discountFixedAmount):"set_price"===e.discountType&&(t.appliedDiscount=n.setPriceDiscountHash(t,e),t.un_discount_value=t.price-e.discountPrice,t.un_total_discount_value=t.appliedDiscount.total_discount_amount,t.un_discounted_price=e.discountPrice)},v=function(t,e){var n=Math.floor(e.discountFixedAmount),o={};return n>t.price&&(n=t.price),o.discount_amount=n,o.total_discount_amount=n*t.quantity,o.value_type="fixed_amount",o.description=h.discount_title,o.title=h.discount_title,o.value=n/100,o.amount=n*t.quantity/100,o},b=function(t,e){var n={},o=t.price/100;return n.value=Math.floor(e.discountPercent),n.discount_amount=Math.floor(o*n.value)/100,n.total_discount_amount=Math.floor(o*n.value*t.quantity)/100,n.value_type="percentage",n.description=h.discount_title,n.title=h.discount_title,n.amount=Math.floor(o*n.value*t.quantity)/100,n},C=function(t,e){var n=Math.floor(t.price-e.discountPrice),o={};return o.discount_amount=n,o.total_discount_amount=n*t.quantity,o.value_type="fixed_amount",o.description=h.discount_title,o.title=h.discount_title,o.value=n/100,o.amount=n*t.quantity/100,o},k=function(t){var e=["ajaxifyCart","cart-loading","AjaxifyCart","layer-addcart-modal"];if(f.stringChecker(h.mutation_ids)){var n,o=h.mutation_ids.replace(/ /g,"").split(",");e=e.concat(o)}return-1!==e.indexOf(t.target.id)},w=function(e){var n=["drawer","cart-drawer__item-list","ajaxcart__footer--fixed","cart-item__qty","mm-opened","cart-sidebar","opened","cart-preview","mfp-ready"];if(f.stringChecker(h.mutation_classes)){var o,i=h.mutation_classes.replace(/ /g,"").split(",");n=n.concat(i)}var r=!1;return t.each(n,function(t,n){"undefined"!=typeof e.target.classList&&e.target.classList.contains(n)&&(r=!0)}),r},P=function(t){return k(t)||w(t)},I=function(){var t=!1,e=new MutationObserver(function(e){e.forEach(function(e){!t&&P(e)&&(setTimeout(function(){_.updateCart(function(){n.applyOfferDiscountsToCart(),u.createCheckoutEventListener()})},250),t=!0)}),setTimeout(function(){t=!1},2e3)}),o={attributes:!0,childList:!0,characterData:!0,subtree:!0},i=document.body;e.observe(i,o)};this.offers=e,this.applyOfferDiscountsToCart=o,this.checkIfItemsWereAddedViaUpsellPopup=m,this.applyOfferDiscountToItem=y,this.updateDiscountedSubtotal=l,this.updateLineItemPrices=p,this.updateLineItemTotals=g,this.fixedAmountDiscountHash=v,this.percentageDiscountHash=b,this.setPriceDiscountHash=C,this.updateCartPageWithDiscounts=i,this.initRefreshCartPageEventHandler=s,this.initAjaxCartObserver=I,this.showCartBar=r,this.addBarToPage=c,this.applyBarStyles=a}function r(){var e=this,n=function(e,n,o,i){window.un.addedToCart[e]=!0;var r={quantity:n,id:e};o.length>0&&(r.properties=o[0]),t.ajax({cache:!1,type:"POST",url:"/cart/add.js",data:r,dataType:"json"}).done(function(t){i(t)})},o=function(t){return"undefined"==typeof window.un.addedToCart[t]},i=function(e){t.ajax({cache:!1,type:"GET",url:"https://"+window.location.hostname+"/cart?view=upsell-now-cart",success:function(t){window.un.cart=JSON.parse(t),e()}})},r=function(){var n={};return n.line_items=JSON.stringify(e.getLineItemsHash()),n.order_notes="",t("#CartSpecialInstructions:visible").length>0&&(n.order_notes=t("#CartSpecialInstructions:visible").val()),t("#cartSpecialInstructions:visible").length>0&&(n.order_notes+=t("#cartSpecialInstructions:visible").val()),t("#cartSpecialInstructionsFromPopup:visible").length>0&&(n.order_notes+=t("#cartSpecialInstructionsFromPopup:visible").val()),""===n.order_notes&&t("textarea[name='note']:visible:first").length>0&&(n.order_notes+=t("textarea[name='note']:visible:first").val()),n},a=function(){var n=[];return t.each(window.un.cart.items,function(t,o){n.push(e.getLineItemHash(o))}),n},c=function(t){var n={};return n.title=t.title,n.variant_id=t.variant_id,n.product_id=t.product_id,n.image=t.image,n.quantity=t.quantity,n.grams=t.grams,n.requires_shipping=t.requires_shipping,n.price=t.price/100,n.properties=e.getLineItemPropertiesArray(t),f.objectChecker(t.appliedDiscount)&&(n.applied_discount=t.appliedDiscount),n},u=function(e){var n=[];return null!=e.properties&&t.each(Object.keys(e.properties),function(t,o){var i={};i.name=o,i.value=e.properties[o],n.push(i)}),n},s=function(){var e=!1;return t.each(window.un.cart.items,function(t,n){f.objectChecker(n.appliedDiscount)&&(e=!0)}),e},l=function(e){t.ajax({cache:!1,type:"POST",url:f.getServerAddress()+"/get_checkout_url?shopify_domain="+f.getShopifyDomain(),data:JSON.stringify(e),dataType:"json",contentType:"application/json; charset=utf-8",success:function(t){t.invoice_url?window.location.href=t.invoice_url.replace("checkout.shopify.com",h.primary_domain):alert("An error occured, and we're unable to process your order at this time. Please contact customer service for assistance. ")}})},d=function(){var t=e.cloneUnCart();return e.addCurrentProductPageVariantAsLineItem(t),t},p=function(){return JSON.parse(JSON.stringify(window.un.cart))},_=function(t){if(!f.onProductPage())return t;var e=f.getCurrentVariantId(),n=t.items.find(function(t){return t.variant_id==e});return"object"==typeof n?n.quantity+=f.getProductPageQuantityValue():((n={}).quantity=f.getProductPageQuantityValue(),n.price=f.getCurrentVariant().price,n.collection_ids=window.un.product_collections,n.product_id=window.un.product.id,n.variant_id=Number(e),t.items.push(n)),t.total_price=t.items.reduce(function(t,e){return t+e.price*e.quantity},0),t.original_total_price=t.total_price,t},g=function(n){var o=!1,i=e.cloneWithCurrentProductPageVariantAsLineItem();return t.each(i.items,function(t,e){e.product_id.toString()===n.toString()&&(o=!0)}),o},m=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key===e&&(n=!0)}),n},y=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key===e&&(n=o)}),n},v=function(t){var n=e.getLineItem(t);return!!n&&n.quantity},b=function(e){var n=!1,o=un.cart.items.reverse();return t.each(o,function(t,o){o.variant_id.toString()===e.toString()&&(n=o.key)}),n},C=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key.toString()===e&&(n=o.title)}),n},k=function(n){var o=e.createUpdateQtyHash(n,0);t.ajax({cache:!1,type:"POST",url:"/cart/update.js",data:{updates:o},dataType:"json"}).done(function(t){e.redirectToCartPage()})},w=function(n,o){var i=f.arrayify(n),r=e.createUpdateQtyHash(i,o);t.ajax({cache:!1,type:"POST",url:"/cart/update.js",data:{updates:r},dataType:"json"}).done(function(t){e.redirectToCartPage()})},P=function(e,n){var o={};return t.each(e,function(t,e){o[e]=n}),o},I=function(){setTimeout(function(){window.location.href="/cart"},250)};this.updateCart=i,this.changeQuantity=w,this.addToCart=n,this.createDraftOrder=r,this.getLineItemsHash=a,this.getLineItemHash=c,this.getLineItemPropertiesArray=u,this.hasDiscounts=s,this.getAndSendToCheckoutUrl=l,this.cloneWithCurrentProductPageVariantAsLineItem=d,this.cloneUnCart=p,this.addCurrentProductPageVariantAsLineItem=_,this.inCart=g,this.notYetAddedToCart=o,this.getLastLineItemKeyForVariantId=b,this.getProductTitleFromLineItemKey=C,this.removeLineItemKeysFromCart=k,this.redirectToCartPage=I,this.createUpdateQtyHash=P,this.hasLineItemKey=m,this.getLineItem=y,this.getLineItemQuantity=v}function a(e){var n=this,o="_un_closed_offer_"+e.id.toString(),i=function(){g.start(),g.track("viewed upsell popup",{offer_id:e.id}),t("#un-modal-title").text(e.popupTitle),t("#un-modal-description").text(e.popupDescription),t("#upsell-popup-close-link").text(h.no_thanks_text),n.printProductRows(),t("#un-modal-background").addClass("un-manual-modal-container"),n.initializeAddToCartButtons(),n.initializeVariantFields(),n.initializeCloseButtons(),n.applyStyles()},a=function(){t(window).click(function(t){!n.fullsizeImageModalOpenedOnPage()&&t.target.classList.contains("un-manual-modal-container")&&n.close(),n.closeImagePopupOnClickOutside()}),t("#un-modal-close-btn, #upsell-popup-close-link").click(function(){n.close()}),n.initializeAddToCartButtons(),n.initializeVariantFields(),n.initializeQuantityFields(),n.applyStyles()},c=function(){t("#un-modal-background").removeClass("un-manual-modal-container"),window.un.atcPopupClosed||(window.un.atcPopupClosed=!0,"omorose-natural-products.myshopify.com"!==f.getShopifyDomain()&&"roadgods-dev.myshopify.com"!==f.getShopifyDomain()&&t(h.add_to_cart_button_selector).trigger("click"),"honu-au.myshopify.com"===f.getShopifyDomain()&&setTimeout(function(){window.location.href="/cart"},1250)),h.hide_offer_if_already_declined&&f.setCookie(o,e.id,h.num_days_before_showing_offer_again)},u=function(){n.fullsizeImageModalOpenedOnPage()&&(t("#un-modal-background-for-full-img").hasClass("opened")?(t("#un-modal-background-for-full-img").removeClass("opened"),t("#un-modal-background-for-full-img").removeClass("un-manual-modal-container")):t("#un-modal-background-for-full-img").addClass("opened"))},s=function(){t("#un-modal-background").removeClass("un-manual-modal-container"),window.un.checkoutPopupClosed=!0,h.hide_offer_if_already_declined&&f.setCookie(o,e.id,h.num_days_before_showing_offer_again),r.checkoutEventHandler()},l=function(){t("#upsell-product-table").html(""),t.each(e.productsForPopup,function(o,i){var r=t("#upsell-popup-product-row").html(),a=n.getPrices(i.originalPrice,i.price),c=f.outOfStock(i),u=t("<div/>").html(i.title).text(),s=t("<div/>").html(a[0]).text(),l=t("<div/>").html(a[1]).text(),d=n.getVariantFieldHTML(i),p=n.getProductLink(i),_=e.showVariantField,g=n.getUpsellProductQty(i,e),m=n.getProductImageSetting(e.productImageSetting),y=n.showFullSizeProductImage(e);i.variants.length<2&&(_=!1);var v={show_product_image:m,upsell_product_img_src:i.imgSrc,upsell_product_title:u,upsell_product_qty:g,upsell_product_original_price:s,upsell_product_price:l,upsell_product_id:i.productId,upsell_variant_id:i.variantId,upsell_product_out_of_stock:c,upsell_product_in_stock:!c,upsell_product_add_to_cart_text:h.add_to_cart_button_text,upsell_product_sold_out_text:h.sold_out_button_text,upsell_show_quantity_field:e.showQuantityField,upsell_hide_quantity_field:!e.showQuantityField,upsell_show_variant_field:_,upsell_product_variants:d,upsell_product_link:p,product_links_enabled:e.productLinksEnabled,show_full_product_image:y},b,C=unHandleBars.compile(r)(v);C=C.replace(/undefined/g," "),t("#upsell-product-table").append(C)})},d=function(t,o){var i=[];return"no_discount"!==e.discountType&&0!==e.discountType?(i[0]=f.unFormatCents(o,h.money_format),i[1]=f.unFormatCents(n.getDiscountedPrice(o),h.money_format)):("number"==typeof parseInt(t)&&parseInt(t)>parseInt(o)?i[0]=f.unFormatCents(t,h.money_format):i[0]=!1,i[1]=f.unFormatCents(o,h.money_format)),i},p=function(t){var n=0,o=e.discountType;return"percentage_discount"===o?n=Math.floor(t*(1-e.discountPercent/100)):"fixed_amount_discount"===o?n=t-e.discountFixedAmount:"set_price"===o&&(n=e.discountPrice),(n<0||""===n)&&(n=0),n},m=function(){t(document).on("click",".upsell-product-add-to-cart",function(o){var i=t(o.target).data("id"),r=t(o.target).data("product-id");if(_.notYetAddedToCart(i)){if(t(o.target).text(h.added_to_cart_button_text).val(h.added_to_cart_button_text),t(o.target).addClass("disabled"),t("#upsell-now-qty-"+i).length>0)var a=t("#upsell-now-qty-"+i).val();else if(e.showQuantityField)var a=t(".upsell-now-quantity-field[data-product-id='"+r+"']").val();else var a=t(o.target).data("quantity");var c=e.getLineItemDiscountPropertyArray();_.addToCart(i,a,c,function(t){var o=t.key,i=f.getCurrentVariantId();f.setCookie("_un_discounted_line_item_"+o,e.id.toString()+"_"+a,30),f.setCookie("_un_discounted_line_item_original_product_link_temp_"+o,i,30),e.closePopupOnATC&&n.close()}),o.stopPropagation(),o.preventDefault()}})},y=function(){f.stringChecker(h.add_to_cart_button_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.add_to_cart_button_font_family+'" rel="stylesheet">'),t("body #upsell-product-table .upsell-product-add-to-cart").css("font-family",h.add_to_cart_button_font_family.replace(/\+/g," ")+", sans-serif")),f.stringChecker(h.popup_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.popup_font_family+'" rel="stylesheet">'),t("body #un-modal-content").css("font-family",h.popup_font_family.replace(/\+/g," ")+", sans-serif")),f.applyStyle("#upsell-product-table .upsell-product-add-to-cart","background-color",h.add_to_cart_button_bg_color),f.applyStyle("#upsell-product-table .upsell-product-add-to-cart","color",h.add_to_cart_button_text_color),f.applyStyle("#upsell-popup-close-link","color",h.no_thanks_text_color),
f.applyStyle(".upsell-product-title","color",h.product_title_text_color),f.applyStyle(".upsell-product-original-price","color",h.regular_price_text_color),f.applyStyle(".upsell-product-price","color",h.sale_price_text_color),f.applyStyle("#un-modal-content","background-color",h.popup_bg_color),f.applyStyle("#un-modal-title","color",h.popup_title_text_color),f.applyStyle("#un-modal-description","color",h.popup_description_text_color)},v=function(e){var o="",i=!0,r="";return n.offer.showVariantField&&e.variants.length>1&&(o='<select class="upsell-product-variant-field" data-id="'+e.productId+'">',t.each(e.variants,function(t,e){e.available&&i?(r="SELECTED",i=!1):r="",o+='<option value="'+e.id+'" '+r+">"+e.title+"</option>"}),o+="</select>"),o},b=function(){n.offer.showVariantField&&t(document).on("change",".upsell-product-variant-field",function(e){var o=t(e.target).data("id").toString(),i=t(e.target).find(":selected").val(),r=n.offer.getPopupProductVariantData(o,i);!1!==r&&(n.swapPricesInRow(o,r),n.swapButtonIdAndStatusInRow(o,r),n.validateQuantityFieldOnChangeOfVariant(o,r)),e.preventDefault(),e.stopPropagation()})},C=function(){n.offer.showQuantityField&&t(document).on("change",".upsell-now-quantity-field",function(e){var o=t(this),i=t(this).data("product-id").toString(),r=n.getVariantId(i),a=n.offer.getPopupProductVariantData(i,r);!1!==a&&(n.variantPresentInCart(r,a)?n.cartAndInventoryStocklimitChecker(r,o,a):n.verifyIsUpsellQtyGreaterThanInventoryQty(o,a,r))})},k=function(e){var n,o=t("#upsell-product-"+e+" .upsell-product-add-to-cart").data("id");return t("#upsell-product-"+e+" .upsell-product-variant-field").length>0&&(o=t(".upsell-product-variant-field[data-id='"+e+"']").val()),o.toString()},w=function(e,o){var i=n.getPrices(o.originalPrice,o.price),r=t("<div/>").html(i[0]).text(),a=t("<div/>").html(i[1]).text();t("#upsell-product-"+e+" .upsell-product-original-price").html(r),t("#upsell-product-"+e+" .upsell-product-price").html(a)},P=function(e,n){var o=t("#upsell-product-"+e+" .upsell-product-add-to-cart");t(o).data("id",n.id),n.available?(t(o).text(h.add_to_cart_button_text),t(o).removeClass("disabled"),t(o).prop("disabled",!1)):(t(o).text(h.sold_out_button_text),t(o).addClass("disabled"),t(o).prop("disabled",!0))},I=function(e,o){var i=o.id,r=t(".upsell-now-quantity-field[data-product-id='"+e+"']");n.hideInsufficientStockWarning(r),n.variantPresentInCart(i,o)?n.cartAndInventoryStocklimitChecker(i,r,o):n.verifyIsUpsellQtyGreaterThanInventoryQty(r,o,i)},x=function(t){return"show_product_image"===t},O=function(t){return"https://"+window.Shopify.shop+"/products/"+t.handle},S=function(t){return"show_product_image_with_zoom"===t.productImageSetting&&(n.initalizeFullSizeImageModal(),!0)},T=function(e){t(document).on("click","#un-modal-background img",function(){var e=t(this).attr("src").replace("100x100","600x600");t(".upsell-product-image-for-full-img").attr("src",e),t("#un-modal-background-for-full-img").addClass("un-manual-modal-container")}),t("#un-modal-close-btn-for-full-img, #upsell-popup-close-link-for-full-img").click(function(){t("#un-modal-background-for-full-img").removeClass("un-manual-modal-container"),t("#un-modal-background-for-full-img").removeClass("opened")})},D=function(){var t=document.getElementById("un-modal-background-for-full-img");return null!==t&&t.classList.contains("un-manual-modal-container")},A=function(e,o,i){var r=parseInt(o.val());t.each(un.cart.items,function(t,a){if(a.variant_id===parseInt(e)){var c=a.quantity+r;if(n.isUpsellQtyGreaterThanInventoryAndCartQty(c,i)){var u=f.noNegative(parseInt(i.inventoryQuantity)-a.quantity);n.showInsufficientStockWarning(i,o,u,e)}else n.hideInsufficientStockWarning(o);return!1}})},F=function(t,e){return t>parseInt(e.inventoryQuantity)&&f.stringChecker(e.inventoryManagement)&&!(f.stringChecker(e.inventoryPolicy)&&"continue"===e.inventoryPolicy)},j=function(t,e,o,i){var r,a=h.insufficient_stock_message.replace("{quantity}",o);n.hideInsufficientStockWarning(e),e.after("<span class='qty-alert-popup-field upsell-now-qty-alert-"+e.data("product-id")+"'>"+a+"</span>"),e.val(o)},q=function(e,o){var i=o.upsellQty;return!o.showQuantityField||!f.stringChecker(e.inventoryManagement)||f.stringChecker(e.inventoryPolicy)&&"continue"===e.inventoryPolicy||(i>parseInt(e.inventoryQuantity)&&(i=f.noNegative(parseInt(e.inventoryQuantity))),t.each(un.cart.items,function(t,r){if(parseInt(e.variantId)===r.variant_id){var a=o.upsellQty+r.quantity;return n.isUpsellQtyGreaterThanInventoryAndCartQty(a,e)&&(i=f.noNegative(parseInt(e.inventoryQuantity)-r.quantity)),!1}})),i},L=function(e){t(".upsell-now-qty-alert-"+e.data("product-id")).remove()},E=function(e){var n=!1;return t.each(un.cart.items,function(t,o){if(o.variant_id===parseInt(e))return n=!0,!1}),n},Q=function(t,e,o){if(parseInt(t.val())>e.inventoryQuantity&&f.stringChecker(e.inventoryManagement)&&(!f.stringChecker(e.inventoryPolicy)||"continue"!==e.inventoryPolicy)){var i=f.noNegative(parseInt(e.inventoryQuantity));n.showInsufficientStockWarning(e,t,i,o)}else n.hideInsufficientStockWarning(t)};this.offer=e,this.show=i,"add_to_cart"===e.triggerEvent?this.close=c:"checkout"===e.triggerEvent&&(this.close=s),this.printProductRows=l,this.getPrices=d,this.getDiscountedPrice=p,this.initializeAddToCartButtons=m,this.applyStyles=y,this.getVariantFieldHTML=v,this.initializeVariantFields=b,this.initializeQuantityFields=C,this.swapPricesInRow=w,this.swapButtonIdAndStatusInRow=P,this.getProductImageSetting=x,this.getProductLink=O,this.cartAndInventoryStocklimitChecker=A,this.getUpsellProductQty=q,this.showInsufficientStockWarning=j,this.validateQuantityFieldOnChangeOfVariant=I,this.hideInsufficientStockWarning=L,this.variantPresentInCart=E,this.verifyIsUpsellQtyGreaterThanInventoryQty=Q,this.isUpsellQtyGreaterThanInventoryAndCartQty=F,this.getVariantId=k,this.showFullSizeProductImage=S,this.initalizeFullSizeImageModal=T,this.fullsizeImageModalOpenedOnPage=D,this.initializeCloseButtons=a,this.closeImagePopupOnClickOutside=u}function c(e,n){var o=this,i=function(t,e,n,i,r){o.productHandles=t,o.shopifyDomain=r,o.collectionHandles=e,o.maxNumberOfProducts=n,o.maxNumberOfProductsPerCollection=i,o.productsArray=[],t.length>0?(f.log("Getting upsell products for offer "+o.offer.id),o.ajaxCallToGetProduct(0)):o.getProductsFromSelectedCollections()},r=function(e){var n=o.productHandles[e];o.inProductCache(n.shopify_product_id)?o.processProductData(o.getCachedProduct(n.shopify_product_id),e):t.ajax({cache:!0,type:"GET",url:"https://"+o.shopifyDomain+"/products/"+n.handle+"?view=upsell-now-product",success:function(t){o.setCachedProduct(t,n.shopify_product_id),o.processProductData(t,e)},error:function(){o.processProductData(!1,e)}})},a=function(t,e){t=JSON.parse(t);var n=o.createNewProduct(t);n&&f.outOfStock(n)&&o.offer.hideOutOfStockProducts&&(n=!1,f.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's out of stock and hide out of stock products is enabled.")),n&&_.inCart(n.productId)&&o.offer.hideProductsAlreadyInCart&&(n=!1,f.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's in the cart and hide products in cart is enabled.")),n&&(f.log("Adding "+n.title+" to popup for offer "+o.offer.id+"."),o.productsArray.push(n)),o.productsArray.length===o.maxNumberOfProducts?o.callback(o.productsArray):e<o.productHandles.length-1?(e+=1,o.ajaxCallToGetProduct(e)):o.productsArray.length<o.maxNumberOfProducts&&e===o.productHandles.length-1&&o.getProductsFromSelectedCollections()},c=function(){o.collectionHandles.length>0?(f.log("Getting upsell products from upsell collections for offer "+o.offer.id),o.ajaxCallToGetCollection(0)):o.callback(this.productsArray)},u=function(e){var n=o.collectionHandles[e];o.inCollectionCache(n.shopify_collection_id)?o.processCollectionData(o.getCachedCollection(n.shopify_collection_id),e):t.ajax({cache:!0,type:"GET",url:"https://"+o.shopifyDomain+"/collections/"+n.handle+"?view=upsell-now-collection",success:function(t){o.setCachedCollection(t,n.shopify_collection_id),o.processCollectionData(t,e)}})},s=function(e,n){e=JSON.parse(e);var i=0;t.each(e,function(t,e){if(!o.inProductsArray(e)&&o.productsArray.length<o.maxNumberOfProducts&&i<o.maxNumberOfProductsPerCollection){var n=o.createNewProduct(e);n&&f.outOfStock(n)&&o.offer.hideOutOfStockProducts&&(n=!1,f.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's out of stock and hide out of stock products is enabled.")),n&&_.inCart(n.productId)&&o.offer.hideProductsAlreadyInCart&&(n=!1,f.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's in the cart and hide products in cart is enabled.")),n&&(f.log("Adding "+n.title+" to popup for offer "+o.offer.id+"."),o.productsArray.push(n),i+=1)}});var r=o.productsArray.length===o.maxNumberOfProducts,a=n===o.collectionHandles.length-1,c=n<o.collectionHandles.length-1;r||a?o.callback(o.productsArray):c&&u(n+=1)},l=function(e){var n=!1;return t.each(o.productsArray,function(t,o){e.handle===o.handle&&(n=!0)}),n},d=function(t){if(!1===t)return!1;var e={};return e.title=t.title,e.originalPrice=t.original_price,e.price=t.price,e.variantId=t.variant_id,e.inventoryQuantity=t.inventory_quantity,e.inventoryManagement=t.inventory_management,e.inventoryPolicy=t.inventory_policy,e.productId=t.id,e.available=t.available,e.handle=t.handle,e.variants=p(t.variants),null!=t.img?"wld-pch.myshopify.com"===f.getShopifyDomain()?e.imgSrc=t.img.replace("_100x100","_400x"):e.imgSrc=t.img:e.imgSrc=!1,e},p=function(e){var n=[];return t.each(e,function(t,e){var o={};o.originalPrice=e.original_price,o.price=e.price,o.title=e.variant_title,o.id=e.variant_id,o.inventoryQuantity=e.inventory_quantity,o.inventoryPolicy=e.inventory_policy,o.inventoryManagement=e.inventory_management,o.available=e.available,n.push(o)}),n},h=function(t){return"undefined"!=typeof window.un.cache.collections[t]},g=function(t){return window.un.cache.collections[t]},m=function(t,e){f.objectChecker(window.un.cache)&&f.objectChecker(window.un.cache.collections)&&(window.un.cache.collections[e]=t)},y=function(t){return"undefined"!=typeof window.un.cache.products[t]},v=function(t){return window.un.cache.products[t]},b=function(t,e){f.objectChecker(window.un.cache)&&f.objectChecker(window.un.cache.products)&&(window.un.cache.products[e]=t)};this.getProducts=i,this.ajaxCallToGetProduct=r,this.processProductData=a,this.getProductsFromSelectedCollections=c,this.ajaxCallToGetCollection=u,this.processCollectionData=s,this.createNewProduct=d,this.inProductsArray=l,this.createVariantArray=p,this.inCollectionCache=h,this.getCachedCollection=g,this.setCachedCollection=m,this.inProductCache=y,this.getCachedProduct=v,this.setCachedProduct=b,this.callback=e,this.offer=n}function u(e){var n=this,o=function(){var t="checkout"===n.triggerEvent||f.onProductPage(),e=n.withinStartEndDate(),o=!n.disabledForCustomers();return!t&&f.log("Offer "+n.id+" not qualified because is ATC and we're not on a product page."),!e&&f.log("Offer "+n.id+" not qualified because outside start/end date."),!o&&f.log("Offer "+n.id+" not qualified because customer is logged in and offer disabled for logged-in customers."),t&&e&&o},i=function(){return n.disableForLoggedInCustomers&&f.objectChecker(window.un.customer_id)},r=function(){return!n.beforeStartDate()&&!n.afterEndDate()},a=function(){if(f.stringChecker(n.startDate)){var t=new Date(n.startDate),e;return new Date<t}return!1},u=function(){if(f.stringChecker(n.endDate)){var t=new Date(n.endDate),e;return new Date>t}return!1},s=function(){var t=_.cloneWithCurrentProductPageVariantAsLineItem(),e=n.checkIfTriggerProductsInCart(t),o=n.checkIfRequiredCartValueMet(t),i=n.checkIfOnSelectedProductPage(),r="Upsell offer reqs failed because:";return!e&&(r+=" trigger products not in cart,"),!o&&(r+=" required cart value not met,"),!i&&(r+=" not on selected product page,"),"Upsell offer reqs failed because:"!==r&&f.log(r),e&&i&&o},l=function(t){f.objectChecker(t)||(t=_.cloneUnCart());var e=0;"undefined"!=typeof t.un_total_discount&&(Number.isNaN(t.un_total_discount)||(e=t.un_total_discount));var o=n.requiredMinimumCartValue<=t.total_price-e;return message=o?"Required cart value met: "+n.requiredMinimumCartValue+" <= "+(t.total_price-e):"Required cart value not met: "+n.requiredMinimumCartValue+" > "+(t.total_price-e),f.log(message),o},d=function(){var t=!1;if("checkout"===n.triggerEvent||f.onCartPage())t=!0;else if(0===n.productPages.length&&0===n.collectionPages.length)t=!0;else if(f.objectChecker(un.product)&&f.objectChecker(un.product_collections)){var e={};e.product_id=un.product.id,e.collection_ids=un.product_collections,t=n.itemInProductArray(e,n.productPages)||n.itemInCollectionArray(e,n.collectionPages)}return t},p=function(e){f.objectChecker(e)||(e=_.cloneUnCart());var o=!1;return 0===n.triggerProducts.length&&0===n.triggerCollections.length?o=!0:(n.triggerQty>1&&f.log("Offer "+n.id+" requires shoppers to have at least "+n.triggerQty+" of the trigger products in cart!"),t.each(e.items,function(t,e){e.quantity>=n.triggerQty&&(m(e,n.triggerProducts)||y(e,n.triggerCollections))&&(o=!0)})),o},g=function(t){return n.itemInProductArray(t,n.upsellProducts)||n.itemInCollectionArray(t,n.upsellCollections)},m=function(e,n){var o=!1;return t.each(n,function(t,n){e.product_id===n.shopify_product_id&&(o=!0)}),o},y=function(e,n){var o=!1;return t.each(e.collection_ids,function(e,i){t.each(n,function(t,e){i===e.shopify_collection_id&&(o=!0)})}),o},v=function(){var e=[],o={};if("percentage_discount"===n.discountType)o[h.line_item_message_key]=h.line_item_discount_amount_message.replace("{{discount_amount}}",f.unFormatPercent(n.discountPercent/100)),e.push(o);else if("fixed_amount_discount"===n.discountType){var i=t("<div/>").html(f.unFormatCents(n.discountFixedAmount,h.money_format)).text();o[h.line_item_message_key]=h.line_item_discount_amount_message.replace("{{discount_amount}}",i),e.push(o)}else if("set_price"===n.discountType){var r=t("<div/>").html(f.unFormatCents(n.discountPrice,h.money_format)).text();o[h.line_item_message_key]=h.line_item_set_price_message.replace("{{set_price}}",r),e.push(o)}return e},b=function(t){n.productsForPopup=t},C=function(){n.productGetter.getProducts(n.upsellProducts,n.upsellCollections,h.max_products_to_show,h.max_products_per_category_to_show,f.getPrimaryDomain())},k=function(){var t=!0;return!0===h.hide_offer_if_already_declined&&""!==n.getCookie("_un_closed_offer_"+n.id.toString())&&(t=!1),t},w=function(t){for(var e=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}return""},P=function(){return n.productsForPopup.length>0},I=function(e,o){var i=!1;return t.each(n.productsForPopup,function(n,r){r.productId===e&&t.each(r.variants,function(t,e){e.id===o&&(i=e)})}),i};this.upsellProducts=e.upsell_products||[],this.upsellCollections=e.upsell_collections||[],this.triggerProducts=e.trigger_products||[],this.triggerCollections=e.trigger_collections||[],this.productPages=e.product_pages||[],this.collectionPages=e.collection_pages||[],this.id=e.id||0,this.offerEnabled=e.offer_enabled||!1,this.productLinksEnabled=e.product_links_enabled||!1,this.offerName=e.offer_name||"",this.discountType=e.discount_type||0,this.discountFixedAmount=e.discount_fixed_amount||"",this.discountPrice=e.discount_price||"",this.discountPercent=e.discount_percent||"",this.triggerEvent=e.trigger_event||"",this.popupTitle=e.popup_title||"",this.popupDescription=e.popup_description||"",this.popupSuccessMessage=e.popup_success_message||"",this.startDate=e.start_date||"",this.endDate=e.end_date||"",this.disableForLoggedInCustomers=e.disable_for_logged_in_customers||!1,this.upsellQty=e.upsell_qty||1,this.triggerQty=e.trigger_qty||0,this.requiredMinimumCartValue=e.required_minimum_cart_value||0,this.productsForPopup=[],this.hideOutOfStockProducts=e.hide_out_of_stock_products||!1,this.hideProductsAlreadyInCart=e.hide_products_already_in_cart||!1,this.showQuantityField=e.show_quantity_field||!1,this.showVariantField=e.show_variant_field,this.closePopupOnATC=e.close_popup_on_atc||!1,this.productImageSetting=e.product_image_setting||"show_product_image",this.storeProductsCallback=b,this.triggerProductRequirementsMet=s,this.appliesToItem=g,this.getLineItemDiscountPropertyArray=v,this.getProductsForPopup=C,this.itemInProductArray=m,this.itemInCollectionArray=y,this.checkIfTriggerProductsInCart=p,this.checkIfOnSelectedProductPage=d,this.notDeclined=k,this.getCookie=w,this.beforeStartDate=a,this.afterEndDate=u,this.withinStartEndDate=r,this.disabledForCustomers=i,this.baseRequirementsMet=o,this.checkIfRequiredCartValueMet=l,this.hasEligibleUpsellProductsToShow=P,this.getPopupProductVariantData=I,this.baseRequirementsMet()&&this.notDeclined()?(f.log("Loading products for offer: "+this.id),this.productGetter=new c(n.storeProductsCallback,n),this.getProductsForPopup()):f.log("Requirements check failed. Not loading products for offer: "+this.id)}function s(){u.createOfferObjects()&&(l(),g.configure(),f.onProductPage()&&d(),_.updateCart(p))}function l(){t.getScript("https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js")}function d(){t.each(window.un.offers,function(t,e){"add_to_cart"===e.triggerEvent&&e.baseRequirementsMet()&&window.un.qualifyingATCOffers.push(e)}),window.un.qualifyingATCOffers.length>0&&u.createATCEventListener()}function p(){t.each(window.un.offers,function(t,e){"checkout"===e.triggerEvent&&e.baseRequirementsMet()&&window.un.qualifyingCheckoutOffers.push(e)}),u.createCheckoutEventListener();var e=new i(window.un.offers),n;e.applyOfferDiscountsToCart(),new o(window.un.offers).startBundleEnforcer(),h.ajax_cart_integration_enabled&&e.initAjaxCartObserver()}var f=new n,h=f.getShopInDatastore(),_=new r,g=new e,m="_un_discounted_line_item_original_product_link_perm_",y="_un_discounted_line_item_original_product_link_temp_",v=".btn-link, .remove, form a:contains(emove), .cart__remove a, .cart-drawer__item-delete, [data-cart-item-delete], .un-remove-btn";r.checkoutEventHandler=function(){_.updateCart(function(){var e,n;if(new i(window.un.offers).applyOfferDiscountsToCart(),new o(window.un.offers).startBundleEnforcer(),window.un.cartCheckedForDiscounts=!0,f.notInDebugMode())if(_.hasDiscounts()||"asoflattetest.myshopify.com"===f.getShopifyDomain()){f.enableSpinner(h.checkout_button_selector),f.stringChecker(h.redirecting_to_checkout_text)&&t(h.checkout_button_selector).after("<span id='un-checkout-redirect-msg'>"+h.redirecting_to_checkout_text+"</span>");var r=_.createDraftOrder();_.getAndSendToCheckoutUrl(r)}else"the-screen-surgery.myshopify.com"===f.getShopifyDomain()?window.location.href="/checkout":t(h.checkout_button_selector).trigger("click")})},u.createOfferObjects=function(){return window.un.offers=[],window.un.qualifyingATCOffers=[],window.un.qualifyingCheckoutOffers=[],t.each(f.getOffersInDatastore(),function(t,e){!0===e.offer_enabled?window.un.offers.push(new u(e)):f.log("One offer disabled - not creating offer object for it")}),f.arrayChecker(window.un.offers)},u.removeOtherATCEventListeners=function(){if(h.remove_add_to_cart_event_listeners){var e=t(h.add_to_cart_button_selector).clone();f.cloneStyles(t(h.add_to_cart_button_selector),e),t(h.add_to_cart_button_selector).replaceWith(e.attr("id","").attr("data-action","").attr("class","").addClass("un-cloned-atc-btn"))}},u.createATCEventListener=function(){u.removeThemeSpecificATCEventListeners(),u.removeOtherATCEventListeners(),0===t(h.add_to_cart_button_selector).length&&(f.log("WARNING: Add to cart button selector does not match any elements on page."),f.log(h.add_to_cart_button_selector)),f.notInDebugMode()||(console.log("UN found these add to cart buttons for selector: "+h.add_to_cart_button_selector),console.log(t(h.add_to_cart_button_selector))),t(document).on("click",h.add_to_cart_button_selector,function(){if("undefined"==typeof un.atcPopupClosed)return f.log("ATC event triggered"),u.atcEventHandler(),!1})},u.removeThemeSpecificATCEventListeners=function(){t.each(t(".product-single__meta .product-form #AddToCart"),function(e,n){t(n).replaceWith(t(n).clone().addClass("un-cloned-atc-btn"))})},u.createCheckoutEventListener=function(){0===t(h.checkout_button_selector).length&&(f.log("WARNING: Checkout button selector does not match any elements on page."),f.log(h.checkout_button_selector)),f.notInDebugMode()||(console.log("UN found these checkout buttons for selector: "+h.checkout_button_selector),console.log(t(h.checkout_button_selector))),t(document).on("click",h.checkout_button_selector,function(){if("undefined"==typeof un.checkingOut&&(f.log("Checkout event triggered"),un.checkingOut=!0,f.applyDisabledStyles(h.checkout_button_selector),t(h.checkout_button_selector).addClass("un-disabled-btn"),"undefined"==typeof un.checkoutPopupClosed))return u.checkoutEventHandler(),!1})},u.atcEventHandler=function(){var e=u.getFirstActiveOffer(window.un.qualifyingATCOffers),n;e?(f.log("Showing ATC popup for offer "+e.id),new a(e).show()):f.notInDebugMode()&&(window.un.atcPopupClosed||(window.un.atcPopupClosed=!0,"omorose-natural-products.myshopify.com"!==f.getShopifyDomain()&&"roadgods-dev.myshopify.com"!==f.getShopifyDomain()&&t(h.add_to_cart_button_selector).trigger("click")))},u.checkoutEventHandler=function(){var t=u.getFirstActiveOffer(window.un.qualifyingCheckoutOffers),e;t?(f.log("Showing checkout popup for offer "+t.id),new a(t).show()):f.notInDebugMode()&&(window.un.checkoutPopupClosed=!0,r.checkoutEventHandler())},u.getFirstActiveOffer=function(e){var n=!1;return t.each(e,function(t,e){f.log("Examining offer "+e.id+" ("+e.triggerEvent+").");var o=e.triggerProductRequirementsMet(),i=e.notDeclined(),r=e.hasEligibleUpsellProductsToShow();if(o&&i&&r)return n=e,f.log("Offer "+e.id+" passed."),!1;var a="Offer "+e.id+" failed because:";!o&&(a+=" upsell offer reqs not met,"),!i&&(a+=" offer has been previously declined,"),!r&&(a+=" no eligible upsell products to show in popup,"),f.log(a)}),n?f.log("Returning offer "+n.id.toString()):f.log("No valid offers"),n},u.getOfferForItem=function(e,n){var o=!1;return t.each(n,function(t,n){n.triggerProductRequirementsMet()&&n.appliesToItem(e)&&(o=n)}),o},u.getActiveOfferById=function(e){var n=!1;return t.each(un.offers,function(t,o){o.id.toString()===e.toString()&&(n=o)}),n},t(document).ready(function(){f.objectChecker(window.un)&&"undefined"==typeof window.un.running&&(window.un.running=!0,f.checkSettingsInDatastore()&&(f.mergeThemeAndShopSettings(),f.enabledOnCurrentPage()&&s()))})};window.loadjQuery321=loadScriptTag("//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js").then(function(){window.jQuery321=jQuery.noConflict(!0)}),window.loadjQuery321.then(function(){myFrontendJavascriptUN(jQuery321)});