!function(){"use strict";function e(e,o){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,o){if(e){if("string"==typeof e)return t(e,o);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,o):void 0}}(e))||o&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o1?t-1:0),n=1;ne.length)&&(t=e.length);for(var o=0,n=Array(t);o1&&void 0!==arguments[1]?arguments[1]:i,n=new Set;function r(o){if(u=o,((l=e)!=l?u==u:l!==u||l&&"object"==typeof l||"function"==typeof l)&&(e=o,t)){var i,r=!p.length,a=function(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=function(e,t){if(e){if("string"==typeof e)return d(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?d(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==o.return||o.return()}finally{if(s)throw r}}}}(n);try{for(a.s();!(i=a.n()).done;){var s=i.value;s[1](),p.push(s,e)}}catch(e){a.e(e)}finally{a.f()}if(r){for(var c=0;c1&&void 0!==arguments[1]?arguments[1]:i];return n.add(s),1===n.size&&(t=o(r)||i),a(e),function(){n.delete(s),0===n.size&&t&&(t(),t=null)}}}}function _(e,t,o){var n=!Array.isArray(e),r=n?[e]:e,c=t.length<2;return{subscribe:u(o,(function(e){var o=!1,l=[],d=0,p=i,u=function(){if(!d){p();var o=t(n?l[0]:l,e);c?e(o):p="function"==typeof o?o:i}},_=r.map((function(e,t){return s(e,(function(e){l[t]=e,d&=~(1<{if(i=o,s&&(r=e),!a){let n=t(e,o);if(!(t.length<2))return n;o(n)}a=!1}),n),d=!Array.isArray(e),p=t=>{d?(a=!0,e.set(t)):t.forEach(((t,o)=>{a=!0,e[o].set(t)})),a=!1};s&&(o=o.withOld);var u=o.length>=(s?3:2),f=null,m=!1;function g(e){var t,n,a,d;if(m)return d=e(c(l)),void i(d);var _=l.subscribe((e=>{m?t?n=!0:t=!0:a=e}));d=e(a),m=!0,i(d),_(),m=!1,n&&(d=c(l)),t&&function(e){if(f&&(f(),f=null),s)var t=o(e,r,p);else t=o(e,p);u?"function"==typeof t&&(f=t):p(t)}(d)}return{subscribe:l.subscribe,set(e){g((()=>e))},update:g}}function m(e,t){if(Array.isArray(t)){let o=t.concat();return f(e,(e=>{for(let t=0;te[t]),{withOld(e,o){return o[t]=e,o}})}function g(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function w(e){for(var t=1;t{const n=w({},e);return i=Reflect.set(n,t,o),n})),i},has(e,t){return Reflect.has(c(e),t)},ownKeys(e){return Reflect.ownKeys(c(e))},defineProperty(e,t,o){let n;return e.update((e=>{const i=w({},e);return n=Reflect.defineProperty(i,t,o),i})),n},deleteProperty(e,t){let o;return t in c(e)&&(e.update((e=>{const n=w({},e);return o=Reflect.deleteProperty(n,t),n})),o)},getOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(c(e),t)},getPrototypeOf(e){return Reflect.getPrototypeOf(c(e))},setPrototypeOf(e,t){return Reflect.setPrototypeOf(e,t)},isExtensible(e){return Reflect.isExtensible(c(e))},preventExtensions(e){return Reflect.preventExtensions(e)},apply(e,t,o){return Reflect.apply(c(e),t,o)},construct(e,t,o){return Reflect.construct(c(e),t,o)}})}let y;try{y=(window.Cypress?window:window.parent).Rivo}catch(e){console.error(e),y=window.Rivo}const b=u(y),x=h(b),k=m(b,"loy_config"),R=h(k);function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o
")}const o=()=>{const t=RivoProfileAlpine.store("rivo_orders");if(t?.length){const e=t.filter((e=>new Date(e.created_at)>=new Date(Date.now()-2592e6))).sort(((e,t)=>new Date(t.created_at)-new Date(e.created_at)))[0];e&&RivoProfileAlpine.store("rivo_latest_order",e)}if(RivoProfileAlpine.store("rivo_profile_customer",e.customer),window.Rivo.common.customer=e.customer,Object.assign(window.Rivo.account_profile,{visitor_token:window.Rivo.visitor_token,customer_id:e.customer.id,last_updated_at:Date.now()}),localStorage.setItem("rivo_account_profile",JSON.stringify(window.Rivo.account_profile)),RivoProfileAlpine.store("rivo_aw_settings")?.saved_cart_enabled&&window.RivoAPI.saved_cart_items("db").then((e=>{RivoProfileAlpine.store("rivo_saved_cart_items",e.products)})),localStorage.getItem("rivo_account_creation_survey_needed")){const e=(o=localStorage.getItem("rivo_account_creation_survey_needed").split("--"),n=2,function(e){if(Array.isArray(e))return e}(o)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,i,r,a,s=[],c=!0,l=!1;try{if(r=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;c=!1}else for(;!(c=(n=r.call(o)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=o.return&&(a=o.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(o,n)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?S(e,t):void 0}}(o,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),t=e[0],i=e[1];return localStorage.removeItem("rivo_account_creation_survey_needed"),void(window.location.hash=`rivo-survey--${t}--${i}`)}var o,n};!RivoProfileAlpine.store("rivo_orders")&&e.customer?.orders_count>0&&window.Rivo.loy_config.load_orders_on_login_enabled?window.RivoAPI.orders("loggedin").then((function(e){RivoProfileAlpine.store("rivo_orders",e.orders),o()})):o(),t&&document.querySelector(".rivo-full-page-overlay")?.remove(),RivoProfileAlpine.store("rivo_aw_settings")?.post_sign_in_javascript&&I(RivoProfileAlpine.store("rivo_aw_settings").post_sign_in_javascript,{Alpine:RivoProfileAlpine,store:RivoProfileAlpine.store}),["rivo-order-details","rivo-profile","rivo-favorites","rivo-update-payment-method","rivo-manage-membership","rivo-add-shipping-address"].some((e=>window.location.hash.includes(e)))&&setTimeout((()=>{window.dispatchEvent(new HashChangeEvent("hashchange"))}),1500),setTimeout((()=>{document.querySelector(".rivo-full-page-overlay")?.remove()}),2e3)}var E,P,M;_(b,(e=>e.common.shop.money_format||"{{amount_with_comma_separator}}$")),m(k,"ways_to_earn"),m(k,"referral_rewards"),m(k,"vip_tiers"),m(b,["common","customer"]),u(),u(),u(),u([]),m(k,"rewards"),u(),u({bottom:void 0}),u(),E={},window.addEventListener("click",(function(e){for(var t=e.target;t&&t.dataset&&!t.dataset.action;)t=t.parentNode;if(t&&t.dataset&&t.dataset.action&&E[t.dataset.action]){e.stopPropagation(),e.preventDefault();var o=t.dataset.data;return o=o?o.split(",").map((function(e){try{return JSON.parse(e)}catch(t){return e}})):[],o.unshift(e),E[t.dataset.action].apply(void 0,o),!1}}),!0),P={},M={on:function(e,t){if("object"!=typeof e)M._has_clb(e,t)||(P[e]||(P[e]=[]),P[e].push(t));else for(var o in e)M.on(o,e[o])},_has_clb:function(e,t){return!!P[e]&&-1!==P[e].indexOf(t)},once:function(e,t){if("object"!=typeof e)t.once=!0,M.on(e,t);else for(var o in e)M.once(o,e[o])},emit:function(e,t){t||(t=[]),P[e]&&P[e].forEach((function(o){o.apply(void 0,t),o.once&&M.remove(e,o)}))},remove:function(e,t){if("object"!=typeof e){if(P[e]){var o=P[e].indexOf(t);-1!==o&&P[e].splice(o,1)}}else for(var n in e)M.remove(n,e[n])}};const A=["inherit","Arial","Arial Black","Comic Sans MS","Brush Script MT","Courier New","Georgia","Garamond","Helvetica","Impact","Lato","Lucida Grande","Microsoft Sans Serif","Palatino","Tahoma","Trebuchet MS","Times New Roman","Verdana"];function C(){return window.location.search.substr(1).split("&").reduce((function(e,t){var o=t.split("=");return e[o[0]]=decodeURIComponent(o[1]),e}),{})}const T=async e=>{for(;null===document.querySelector(e);)await new Promise((e=>requestAnimationFrame(e)));return document.querySelector(e)};function N(e,t=!1){var o="/discount/"+e.code,n={method:"GET"};return new Promise((function(i,r){fetch(o,n).then((function(o){if(void 0===e.variant_ids||t)return i({});var n=e.variant_ids.split(",");if(0===n.length)return i({});if(1===n.length)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:n[0],quantity:1}]})}).then((function(e){return window.location="/cart",i({})}));var r=R.api_endpoint;return fetch(`${r}/products/${e.product_id}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return window.Rivo.sendMessageToWidget&&window.Rivo.sendMessageToWidget({msg_action:"app.redeem.product-options",msg_options:e}),i(e||{})}))})).catch((function(e){console.error(e),i({})}))}))}function z(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function q(e){for(var t=1;tMath.random().toString(36).substring(2,3))).join(""),R.membership_tiers&&window.Rivo.common?.product?.tags&&-1!==window.Rivo.common.product.tags.indexOf("Rivo Membership")&&R?.paid_membership_settings?.landing_path_redirect_enabled)return void(window.location=R.paid_membership_settings.landing_path||"/");if(window.location.pathname.includes("/account/login")){const e=sessionStorage.getItem("rivo_legacy_login_source");if(e)return sessionStorage.removeItem("rivo_legacy_login_source"),void(window.location.href=`${e}?login_error=true`)}if(R.account_widget_settings?.enabled&&R.account_widget_settings?.redirect_from_account_page){const e=["account/reset","account/activate"];if(/^(\/[a-z]{2}-[a-z]{2})?\/account($|\/)/.test(window.location.pathname)&&"true"!=$("skip_rivo_redirect")&&!e.some((e=>window.location.pathname.includes(e)))){const e=$("checkout_url");return void(window.location.href=e?`/?rivo_post_sign_in_redirect_url=${encodeURIComponent(e)}#rivo`:"/#rivo")}}if(R.account_widget_settings?.enabled&&R.account_widget_settings?.replace_account_links&&function(){if("true"===$("skip_rivo_redirect"))return void document.querySelectorAll('a[href*="/account/register"]').forEach((e=>{e.href.includes("skip_rivo_redirect")||(e.href=e.href+"?skip_rivo_redirect=true")}));const e=R.account_widget_settings.replace_legacy_app_links,t=window.Rivo.loy_config.account_widget_settings.replace_account_links_url?window.Rivo.loy_config.account_widget_settings.replace_account_links_url.replace("#rivo",`&return_to=${window.location.pathname}#rivo`):"#rivo",o=()=>{let o='a[href*="/account"]:not([href*="/a/account"]):not([href*="/apps/account"]):not([href*="/community/account"]), a[href*="/customer_authentication/redirect"], a[href*="/customer-identity"]';e&&(o+=', a[href*="#status"]'),document.querySelectorAll(o).forEach((e=>{"/account/logout"===e.getAttribute("href")||0!=e.getAttribute("href").includes("skip_rivo_redirect")||e.hasAttribute("data-rivo-accounts-ignore")||(e.href=t)}))};o(),e&&setTimeout(o,1e3)}(),R.account_widget_settings?.enabled&&R.account_widget_settings?.replace_legacy_app_links&&function(){const e=window.location.hash;if(e.includes("status-confirmation")){const t=e.match(/status-confirmation:(\d+)(?:\D|$)/)?.[1];t&&(window.location.hash=`#rivo-order-details--${t}`)}}(),R.cashback_program_enabled){const e=$("rivo-cashback");let t=JSON.parse(localStorage.getItem("rivo_cashback_profile")||"{}");if(e&&!t?.opt_in_id){console.log("Applying Rivo cashback offer to session:",e),t={visitor_token:window.Rivo.visitor_token,visit_token:window.Rivo.visit_token,cashback_offer:e,created_at:Date.now(),last_updated_at:Date.now()};const o=localStorage.getItem("rivo_cashback_opt_in_email");o&&(t.opt_in_email=o),localStorage.setItem("rivo_cashback_profile",JSON.stringify(t))}t&&!t?.opt_in_id&&async function(){const e=JSON.parse(localStorage.getItem("rivo_cashback_profile")||"{}");if(e?.opt_in_id)return;if(!e?.cashback_offer)return;let t;try{const o=await fetch(`${R.api_endpoint}/cashback_opt_ins`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitor_token:window.Rivo.visitor_token,visit_token:window.Rivo.visit_token,cashback_offer:e?.cashback_offer,email:e?.opt_in_email})});if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const n=await o.json();if(!n?.id)throw new Error("No opt_in_id returned from cashback_opt_ins endpoint");{t=n.id;const e=JSON.parse(localStorage.getItem("rivo_cashback_profile")||"{}");e.opt_in_id=t,localStorage.setItem("rivo_cashback_profile",JSON.stringify(e))}}catch(e){throw console.error("Failed to opt in to cashback:",e),e}const o=await fetch("/cart.js?rivo_cashback_lookup=true"),n=q(q({},(await o.json()).attributes),{},{_rivo_visitor_token:window.Rivo.visitor_token,_rivo_visit_token:window.Rivo.visit_token,_rivo_cashback_offer:e?.cashback_offer,_rivo_cashback_opt_in_id:t}),i=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:n})});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);await i.json()}()}window.Rivo.preview_mode="undefined"==typeof Shopify;let t=localStorage.getItem("rivo_advocate_profile");t&&(window.Rivo.advocate_profile=JSON.parse(t));let o=localStorage.getItem("rivo_friend_profile");o&&(window.Rivo.friend_profile=JSON.parse(o));let n,i=localStorage.getItem("rivo_referral_data")||"{}";function r(t=function(){}){R.points_program_enabled&&e.loy.profile_loyalty_js?O(e.loy.profile_loyalty_js,!0,(function(){j(e.loy.profile_js,t)})):j(e.loy.profile_js,t)}function a(){let e=localStorage.getItem("rivo_account_profile")||"{}";e&&(window.Rivo.account_profile=JSON.parse(e),R.persisted_login_enabled&&window.Rivo.common.customer&&!window.Rivo.account_profile?.visitor_token&&(Object.assign(window.Rivo.account_profile,{customer_id:window.Rivo.common.customer.id,visitor_token:window.Rivo.visitor_token,last_updated_at:Date.now()}),localStorage.setItem("rivo_account_profile",JSON.stringify(window.Rivo.account_profile))));const t=R.auto_login?.auto_login_bypass_only_mode_enabled;if(localStorage.getItem("rivo_ap_invalidated_at")&&(Date.now(),localStorage.getItem("rivo_ap_invalidated_at")),(R.persisted_login_enabled||R?.auto_login?.enabled)&&!window.Rivo.common.customer){const e=C()[R.auto_login.email_identifier];if(Object.keys(window.Rivo.account_profile).length>0||e){window.Nostra?fetch("/?skip_cache=1"):window.edgemesh?fetch("/?em-bypass=all"):Promise.resolve();const o=!window.Rivo.account_profile.visitor_token&&e||t?"/a-l":"/a-p",n=JSON.parse(localStorage.getItem("extensionStorage")||"{}"),i=Object.keys(n).find((e=>e.endsWith("rivo_thank_you_page_data"))),r=i?n[i]:{},a=baMet?.getBrowserInfo()||{},s={screen_width:window.screen.width,screen_height:window.screen.height,browser:a.browser,os:a.os};if("/a-p"===o)return;fetch(`${R.api_endpoint}${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ael_query_token:e,ael_persisted_token:window.Rivo.account_profile.ael_token,visitor_token:window.Rivo.visitor_token||("function"==typeof window.baMet?.getVisitorId?window.baMet.getVisitorId():void 0),visit_token:window.Rivo.visit_token||("function"==typeof window.baMet?.getVisitId?window.baMet.getVisitId():void 0),landing_page:window.location.href,thank_you_storage:r,browser_details:s,multipass_request_token:window.Rivo.multipass_request_token})}).then((e=>e.json())).then((n=>{n.hint&&(localStorage.setItem("rivo_profile_hint",JSON.stringify(n.hint)),document.dispatchEvent(new CustomEvent("rivo:profile-hint-identified")));const i=n.visitor_token==window.Rivo.visitor_token&&n.visit_token==window.Rivo.visit_token&&n.multipass_request_token==window.Rivo.multipass_request_token;n.url&&window.Rivo.multipass_request_token&&i?t||!0===window.Rivo.loy_config.auto_login?.auto_login_reload_enabled?window.location.href=n.url:fetch(n.url).then((()=>{L(n,!0),Object.assign(window.Rivo.account_profile,{ael_token:window.Rivo.account_profile?.ael_token||e,last_updated_at:Date.now(),visitor_token:window.Rivo.visitor_token}),localStorage.setItem("rivo_account_profile",JSON.stringify(window.Rivo.account_profile))})):"/a-p"===o&&localStorage.setItem("rivo_ap_invalidated_at",Date.now())})).catch(console.error)}}}i&&(window.Rivo.referral_data=JSON.parse(i)),window.Rivo.global_config.loy_js_api_enabled&&j(e.loy.api_js),R.pages_config&&!window.rivo_page_loader_enabled&&j(e.loy.page_init_js),R.forms&&R.forms.length>0&&j(e.forms.init_js),window.Rivo.visit_token?a():O(e.global.helper_js,!1,(function(){setTimeout(a,200)})),window.rivo_page_loader_enabled?R.account_widget_settings?.enabled?r((function(){j(e.loy.lp_js)})):j(e.loy.lp_js):R.account_widget_settings?.enabled&&r(),R.ping_enabled&&window.Rivo.common?.customer&&Rivo.visitor_token&&fetch(`${R.api_endpoint}/customers/loggedin/ping`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({visitor_token:window.Rivo.visitor_token||("function"==typeof window.baMet?.getVisitorId?window.baMet.getVisitorId():void 0),visit_token:window.Rivo.visit_token||("function"==typeof window.baMet?.getVisitId?window.baMet.getVisitId():void 0)})}).then((e=>e.json())).then((e=>{e.ping&&(fetch("/account/logout"),localStorage.removeItem("rivo_account_profile"))})),window.addEventListener("message",(function(e){if(e.origin===window.location.origin)switch(e.data.msg_action){case"widget.register":e.data.msg_options?.redirect_url?window.location.href=`${R.custom_account_register_path||"/account/register"}?checkout_url=${e.data.msg_options.redirect_url}`:window.location.href=`${R.custom_account_register_path||"/account/register"}`;break;case"widget.login":e.data.msg_options?.redirect_url?window.location.href=`${R.custom_account_login_path||"/account/login"}?checkout_url=${e.data.msg_options.redirect_url}`:window.location.href=`${R.custom_account_login_path||"/account/login"}`;break;case"widget.apply_discount_code":N(e.data.msg_options).then((function(e){if(!e.url)return;let t=document.querySelector(".rivo-visit-product.text-warning");t&&(t.style.display="",t.querySelector("a").href=e.url)}));break;case"widget.visit":window.location.href=e.data.msg_options.url;break;case"rivo_account_open":const t=new URL(window.location.href);e.data.msg_options.rivo_post_sign_in_redirect_url&&(t.searchParams.set("rivo_post_sign_in_redirect_url",e.data.msg_options.rivo_post_sign_in_redirect_url),window.history.pushState({},"",t)),window.location.hash="rivo";break;case"widget.popup":!function(e,t,o,n="right"){new Promise((function(i,r){if("right"==n)var a="960";else a="0";var s=window.open(e,t||"_blank",o||"height=500,width=700,left="+a);return window.focus&&s.focus(),i({})}))}(e.data.msg_options.url,e.data.msg_options.windowName,e.data.msg_options.windowFeatures,R.floating_widget_settings.desktop_placement);break;case"widget.new_tab":window.open(e.data.msg_options.url,"_blank");break;case"widget.open":n(!0,e.data.msg_options.page);break;case"widget.close":n(!1);break;case"widget.referral_claimed":!function({email:e,code:t}){localStorage.setItem("ba_referral_claimed",t),localStorage.removeItem("ba_referral_customer_signup")}(e.data.msg_options);break;case"widget.referral_via_email":Object.assign(document.createElement("a"),{target:"_blank",href:`mailto:?subject=${e.data.msg_options.subject}&body=${e.data.msg_options.body}`}).click();break;case"widget.go_to_url":Object.assign(document.createElement("a"),{target:"_blank",href:e.data.msg_options.url}).click()}}));const s=()=>{const e=document.createElement("script"),t="https:"==document.location.protocol?"https://":"http://";e.src=`${t}${R.domain_name}/preview_loy.js`,e.type="text/javascript",document.head.appendChild(e)},c={"#ba-loyalty-home":"index","#ba-loyalty-rewards":"my_rewards","#ba-loyalty-ways-to-earn":"ways_to_earn","#ba-loyalty-redeem":"ways_to_redeem","#ba-referral-program":"referrals","#ba-referrals":"my_referrals"},l='\n \n \n ';function d(e=[],t=null){"custom_event"!==R?.paid_membership_settings?.selling_plan_after_add_to_cart_js_method?"custom_js"===R?.paid_membership_settings?.selling_plan_after_add_to_cart_js_method&&R?.paid_membership_settings?.selling_plan_after_add_to_cart_javascript?I(R.paid_membership_settings.selling_plan_after_add_to_cart_javascript,{Rivo:window.Rivo,loyConfig:R,items:e,cartItem:t}):window.location="/cart":document.dispatchEvent(new CustomEvent("rivo:selling-plan-added-to-cart",{detail:{items:e,cartItem:t}}))}window.addRivoSellingPlanToCart=function(e,t,o=null){const n=window.Rivo.common?.cart?.items?.find((t=>t.id==e)),i=o?window.Rivo.common?.cart?.items?.find((e=>e.id==o)):null;if(n&&(!o||i)){const r=[{id:e,quantity:n.quantity}];return t&&(r[0].selling_plan=t),o&&i&&r.push({id:o,quantity:i.quantity}),void d(r,n)}const r=[];n||(r.push({id:e,quantity:1}),t&&(r[0].selling_plan=t)),o&&!i&&r.push({id:o,quantity:1}),fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:r})}).then((e=>e.json())).then((e=>{d(r,e?.items?.[0]||e)})).catch((e=>console.error("Error:",e)))},window.Rivo.deepLinks=function(){let e=C(),t={},o=e.referral_code||e.xrc;return"loyalty_points_redeemed"===e.preset_type?(t.page="reward",t.reward_id=e.record_id):"loyalty_birthday"===e.preset_type?t.page="home":o?(t.referral_code=o,window.Rivo.advocate_profile?t.page="invalid_referral":function(e){const t=void 0!==e&&""!==e.trim(),o=null==localStorage.getItem("ba_referral_claimed");return t&&o}(o)?(t.page="referral_signup",e.rci&&(t.referral_campaign_id=e.rci)):window.Rivo.friend_profile&&localStorage.getItem("ba_referral_claimed")&&(t.reward_discount_code=localStorage.getItem("ba_referral_claimed"),t.page="friend_reward")):c[window.location.hash]?t.page=window.Rivo.common?.customer?c[window.location.hash]:c["#ba-loyalty-home"]:"email"==e.utm_medium&&"rivo"==e.utm_source&&(t.page="home"),e.advocate_rdc?(t.reward_discount_code=e.advocate_rdc,t.page="advocate_reward"):e.friend_rdc?(t.reward_discount_code=e.friend_rdc,t.page="friend_reward"):e.popup_panel&&(t.popup_panel=e.popup_panel),e.fpr_pid&&e.fpr_vids&&(t.free_product_reward={product_id:e.fpr_pid,variant_id:e.fpr_vids}),t}(),window.addEventListener("ontouchstart"in window||window.navigator.msPointerEnabled?"click":"mouseup",(function(e){if(0===e.button){const t=function(e,t){let o=e;for(;null!==o&&o.tagName!=="A".toUpperCase();)o=o.parentNode;return o}(e.target||e.srcElement);if(!t)return;const o=t.hash;if(!o||!c[o])return;return event.preventDefault(),t.setAttribute("onclick","return false;"),window.Rivo.deepLinks.page=c[o],void n(!0,c[o])}}));var p={gift:'',star:''};const u="data-ba-met-app='loy' data-ba-met-name='widget_loy_panel_click'";function _(e,t,o){var n=e[t+"_layout"]||e.layout,i=e[t+"_text"]||e.text,r=e[t+"_icon"]||e.icon,a="";return"icon_with_text"!=n&&"image_only"!=n||(a+='
"+(o?``:p[r])+"
"),n.includes("text")&&(a+='
"+i+"
"),a}function f(e){fetch(`${window.Rivo.loy_config.api_endpoint}/customers/loggedin/logout`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({visitor_token:window.Rivo.visitor_token||("function"==typeof window.baMet?.getVisitorId?window.baMet.getVisitorId():void 0),visit_token:window.Rivo.visit_token||("function"==typeof window.baMet?.getVisitId?window.baMet.getVisitId():void 0),silent:!0,silent_reason:e})}).then((e=>e.json())).then((e=>{fetch("/account/logout"),window.Rivo.common.customer=void 0,localStorage.removeItem("ba_loy_customer_id"),localStorage.removeItem("rivo_account_profile"),RivoProfileAlpine&&RivoProfileAlpine.store("rivo_profile_customer",!1)}))}function m(){let e=`${R.api_endpoint}/customers/loggedin/status?verification_customer_id=${window.Rivo.common?.customer?.id}&visitor_token=${window.Rivo.visitor_token}&visit_token=${window.Rivo.visit_token}`;fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>{if(!window.Rivo.loy_config.account_widget_settings.cache_app_enabled||404!==e.status)return e.json();f("customer_id_verification_404")})).then((function(e){if(e)if(window.Rivo.loy_config.account_widget_settings.account_verification_enabled&&e.hasOwnProperty("account_enabled")&&!e.account_enabled)f("account_verification");else{if(!e.verified&&R.customer_id_verification_enabled)return fetch("/account/logout"),window.Rivo.common.customer=void 0,void localStorage.removeItem("ba_loy_customer_id");R.viewable=e.viewable,window.Rivo.common.customer.status_points_tally=e.points,window.Rivo.common.customer.status_credits_tally=e.credits,window.Rivo.common.customer.expected_completed_actions=e.expected_completed_actions,window.Rivo.common.customer.first_order_at=e.first_order_at,window.Rivo.common.customer.account_activated_at=e.account_activated_at,e.viewable&&R?.js_api_config?.emit_points_balances_on_load&&(window.RivoJS?window.parent.postMessage({msg_action:"event.points_update",msg_options:{points_tally:e.pretty_points_tally,credits_tally:e.pretty_credits_tally,entries_tally:e.pretty_entries_tally}}):document.addEventListener("rivo-js-loaded",(function(){window.parent.postMessage({msg_action:"event.points_update",msg_options:{points_tally:e.pretty_points_tally,credits_tally:e.pretty_credits_tally,entries_tally:e.pretty_entries_tally}})}))),e.viewable&&1==R?.account_embed_widget_settings?.enabled&&function(e,t){const o=window.Rivo.common?.customer,n=R.account_embed_widget_settings,i=n.target_page||"customers/account";if(window.Rivo.common.template!=i||!o)return;let r=document.createElement("style");r.id="loyalty-program-and-rewards",r.innerHTML=`#rivo-loyalty-program-and-rewards{margin-top: 30px;}\n\t\t\t.account-loyalty-wrapper{margin: 15px 0;}\n\t\t\t.account-loyalty-wrapper p{margin: 0 0 10px; text-transform: none; font-size: 15px; font-weight: 400;}\n\t\t\th2#loyalty-program-header{text-transform: none;}\n\t\t\tp#freeform-text{white-space: pre-wrap;}\n\t\t\tp#widget-click a{color: #006eff;}\n\t\t\t#see-more-on-widget{cursor:pointer}#see-more-on-widget:hover{text-decoration: underline;}\n\t\t\t${n.custom_css}`,document.head.appendChild(r);const a=window.parent.Shopify?.locale||window.Shopify?.locale||"en",s=window.Rivo.common.translations?.general?.[a]||window.Rivo.common.translations?.general?.en,c=q(q({},R.translations||{}),s||{}),l=`${function(e,t){var o=0,n="",i="";if(Number(e)===e&&e%1!=0){var r=Math.abs(e).toFixed(2).split(".");i=r[0].split("").reverse(),n="."+r[1]}else i=Math.abs(e).toString().split("").reverse();return i.forEach((function(e){3==o&&(n=","+n,o=0),n=e+n,o++})),e<0&&(n="- "+n),n}(e)}`,d=`${function(e,t=0,o=!1){if(void 0===e||null==e)return"";if("string"==typeof e&&0==e.length)return"";var n=x.global_config.base_money_format||x.common.shop.money_format,i=/\{\{\s*(\w+)\s*\}\}0?/;function r(e,t){return void 0===e?t:e}var a=e<0;function s(e,t,o,n,i){if(t=r(t,2),o=r(o,","),n=r(n,"."),isNaN(e)||null==e)return 0;var a=(e=Math.abs(e)).toString().split("."),s=a[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o),c=a[1]||"";return i||c?s+n+(c=(c+"00").slice(0,t)):s}var c="";switch(n.match(i)[1]){case"amount":case"amount_no_decimals":c=s(e,t,",",".",o);break;case"amount_with_comma_separator":case"amount_no_decimals_with_comma_separator":default:c=s(e,t,".",",");break;case"amount_no_decimals_with_space_separator":c=s(e,t,"."," ");break;case"amount_with_space_separator":case"amount_with_period_and_space_separator":c=s(e,t," ",".");break;case"amount_with_apostrophe_separator":c=s(e,t,".","'")}return(a?"- ":"")+n.replace(i,c)}(t,2)}`;let p=`
\n

${c.general_loyalty_program_and_rewards||"Loyalty Program & Rewards"}

\n\t \n\t\t
`;const u=document.querySelector(`${n.custom_placement||"main .grid > div:first-child *:first-child, main div.customer, main div"}`);u&&u.insertAdjacentHTML(`${n.custom_insert_method||"beforeend"}`,p);const _=document.getElementById("see-more-on-widget");_&&_.addEventListener("click",(function(e){if(e.preventDefault(),n.custom_link){const e=`${window.top.location.origin}${n.custom_link}`;window.postMessage({msg_action:"widget.go_to_url",msg_options:{url:e}},"*")}else{let e=document.querySelector("#launcher-wrapper");e.classList.contains("up")||e.click()}}))}(e.points,e.credits),e.viewable&&window.Rivo.common.customer&&e.auto_applied_discount_code&&(window.Rivo.common.customer.auto_applied_discount_code=e.auto_applied_discount_code,document.dispatchEvent(new CustomEvent("rivo:auto-discount-code-identified")),(t=e.auto_applied_discount_code)&&function(e){let t=document.cookie.match(RegExp("(?:^|;\\s*)"+"discount_code".replace(/([.*+?\^$(){}|\[\]\/\\])/g,"\\$1")+"=([^;]*)"));return t?t[1]:null}()!==t&&fetch(`/discount/${t}`)),T("#ba-loy-container").then((t=>{e.viewable?t.style.display="block":t.remove()}))}var t}))}let g=document.location.search.indexOf("ba-loy-preview=1")>-1,w=document.location.search.indexOf("hide-preview-popup=1")>-1;function v(e,t){if(!t)return"";let o,n="";return o="inherit"===t?`font-family: ${t} !important;`:`font-family: '${t}', sans-serif !important;`,"primary_font"==e?n=``:"secondary_font"==e&&(n=``),A.includes(t)?n:`${n}`}function h(){R.referral_campaigns&&R.referral_campaigns.forEach((function(e){y(e)}))}function y(e,t=!1){return new Promise((function(o){let n=e.display_type,i=window.Rivo.deepLinks.referral_campaign_id;if("none"==n)return void o();if(i&&parseInt(i)!=e.id)return;let r=document.getElementById(`rivo-referral-campaign-${e.id}`);const a=R?.font_settings||"",s=window.Rivo.deepLinks.referral_code||window.Rivo.deepLinks.reward_discount_code||t||function(e){const t=JSON.parse(localStorage.getItem("rivo_recent_order"));if(!e.post_order_advocate_overlay_enabled||window.Rivo.advocate_profile||!t)return!1;const o=Date.now(),n=60*e.post_order_advocate_overlay_frequency*1e3,i=t.rivo_advocate_signup_overlay_last_shown;if(i){const e=parseInt(i,10);if(0==n||!isNaN(e)&&o-e=60*e.post_order_advocate_overlay_delay*1e3&&(t.rivo_advocate_signup_overlay_last_shown=o,localStorage.setItem("rivo_recent_order",JSON.stringify(t)),!0)}(e);if(s&&(e.display_type="overlay",n="overlay",r?r.querySelector("iframe.rivo-referral.overlay")&&(r.querySelector("iframe.rivo-referral.overlay").style.display="contents"):(r=document.createElement("div"),r.id=`rivo-referral-campaign-${e.id}`,document.body.appendChild(r)),window.Rivo.deepLinks.overlay_mode=!0),!r)return void o();let c=document.createElement("style");c.id=`rivo-referral-styles-${e.id}`,c.innerHTML=`\n #rivo-referral-campaign-${e.id} { width: 100%; height: 100%; display: contents;}\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n iframe.rivo-referral{\n position: relative;\n width: 100%;\n height: ${e.design_settings.desktop_inline_height}px;\n border: none;\n animation: fadeIn 0.3s ease forwards;\n }\n\n @media (max-width: 680px){\n iframe.rivo-referral{\n height: ${e.design_settings.mobile_inline_height}px;\n }\n }\n\n iframe.rivo-referral.overlay{\n display: flex;\n position: fixed;\n z-index: 2147483644;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: rgb(0,0,0);\n background-color: rgba(0,0,0,0.4);\n opacity: 1;\n visibility: visible;\n }`,document.head.appendChild(c);let d=window.Rivo?window.Rivo.common.shop:void 0,p=window.Rivo?window.Rivo.common.customer:void 0;r.innerHTML=``;const u=`\n .background-image, .background-cover{\n background-image: url(${e.background_image_url});\n }\n .content .header{\n background-color: ${e.design_settings.header_background_color};\n color: ${e.design_settings.header_font_color};\n text-align: ${e.design_settings.header_text_align};\n }\n .content-title{\n color: ${e.design_settings.title_font_color};\n font-size: var(--title-font-size);\n text-align: ${e.design_settings.title_text_align};\n }\n .content-subtitle{\n color: ${e.design_settings.subtitle_font_color};\n font-size: var(--subtitle-font-size);\n text-align: ${e.design_settings.subtitle_text_align};\n }\n .button{\n background-color: ${e.design_settings.button_background_color};\n border-color: ${e.design_settings.button_border_color};\n color: ${e.design_settings.button_font_color};\n font-size: ${e.design_settings.button_font_size}px;\n }\n .button:hover{opacity: 0.9;}\n .footer{\n color: ${e.design_settings.footer_font_color};\n font-size: ${e.design_settings.footer_font_size}px;\n text-align: ${e.design_settings.footer_text_align};\n }\n .content .content-wrapper .section-footer{\n color: ${e.design_settings.footer_font_color};\n font-size: ${e.design_settings.footer_font_size}px;\n text-align: ${e.design_settings.footer_text_align};\n }\n @media (max-width: 680px){\n .mobile-image{\n background-image: url('${e.background_image_url}');\n }\n }\n `;let _=document.getElementById(`rivo-referral-container-${e.id}`);_.contentWindow.document.write(`\n \n \n \n ${l}\n \n \n \n ${a?.primary_font?v("primary_font",a.primary_font):""}\n ${a?.secondary_font?v("secondary_font",a.secondary_font):""}\n \n ${d?`