/*!For license information please see widget.js.LICENSE.txt*/var lsNetvisioGTM;(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(){r=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function d(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(t){d=function(t,e,n){return t[e]=n}}function s(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),l=new L(r||[]);return o(a,"_invoke",{value:k(t,n,l)}),a}function v(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var m={};function p(){}function f(){}function _(){}var h={};d(h,l,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(I([])));y&&y!==e&&i.call(y,l)&&(h=y);var w=_.prototype=p.prototype=Object.create(h);function b(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function r(o,a,l,c){var u=v(t[o],t,a);if("throw"!==u.type){var d=u.arg,s=d.value;return s&&"object"==n(s)&&i.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,l,c)}),(function(t){r("throw",t,l,c)})):e.resolve(s).then((function(t){d.value=t,l(d)}),(function(t){return r("throw",t,l,c)}))}c(u.arg)}var a;o(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function k(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=j(a,n);if(l){if(l===m)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=v(t,e,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function j(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=v(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function I(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(i.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:D}}function D(){return{value:void 0,done:!0}}return f.prototype=_,o(w,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:f,configurable:!0}),f.displayName=d(_,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,d(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},b(S.prototype),d(S.prototype,c,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new S(s(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(w),d(w,u,"Generator"),d(w,l,(function(){return this})),d(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=I,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(l&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:I(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),m}},t}function i(t,e,n,r,i,o,a){try{var l=t[o](a),c=l.value}catch(t){return void n(t)}l.done?e(c):Promise.resolve(c).then(r,i)}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function l(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!==n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}t.r(e),t.d(e,{setCustomer:()=>d});function u(t){var e="; ".concat(document.cookie).split("; ".concat(t,"="));if(2===e.length)return e.pop().split(";").shift()}function d(t){console.log("🚀 ~ file: index.js:42 ~ setCustomer ~ customer:",t)}Promise.all([fetch("".concat("https://sp.stape.io","/widget/setting?shop=").concat("bastillecycles.com","&shop_id=").concat("72739946827"),{method:"GET"}).then((function(t){return t.json()})),fetch("/cart.js").then((function(t){return t.json()}))]).then((function(t){var e,n,o,l,d,s=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,l=[],c=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(t){u=!0,i=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(t,e)||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,2),v=s[0],m=s[1],p=v.generate,f=v.data_layer,_=v.webhook;function h(t){try{if(["purchase_stape","begin_checkout_plus_stape"].includes(null==t?void 0:t.event)&&(window.dataLayer||[]).some((function(e){return(null==e?void 0:e.event)==(null==t?void 0:t.event)})))return void console.log("Not creted event");window.dataLayer.push(t)}catch(e){window.dataLayer.push(t)}}window.dataLayer=window.dataLayer||[];var g=location.pathname;if(localStorage.getItem("cartToken")!=m.token&&g.indexOf("/checkouts")<0&&localStorage.setItem("cartToken",m.token),null!=v&&null!==(e=v.generate)&&void 0!==e&&e.insert_gtm_snipper){var y=document.createElement("script"),w=(null==p?void 0:p.is_custom_domain)&&(null==p?void 0:p.custom_domain)||"https://www.googletagmanager.com",b=(null==p?void 0:p.gtm_id)||"",S=(null==p?void 0:p.is_custom_loaded)&&(null==p?void 0:p.custom_loaded)||"gtm";if(p.is_cookie_keeper&&null!=p&&p.is_custom_loaded){var k='!function(){"use strict";function e(e){return function(e){for(var t=0,r=document.cookie.split(";");t<r.length;t++){var n=r[t].split("=");if(n[0].trim()===e)return n[1]}}(e)}function t(e){return localStorage.getItem(e)}function r(e){return window[e]}function n(e,t){var r=document.querySelector(e);return t?null==r?void 0:r.getAttribute(t):null==r?void 0:r.textContent}!function(o,i,a,c,u,l,s,v,d,f,g){var m,p,y,w;try{p=d&&(y=navigator.userAgent,(w=new RegExp("Version/([0-9._]+)(.*Mobile)?.*Safari.*").exec(y))&&parseFloat(w[1])>=16.4)?function(o,i,a){void 0===i&&(i="");var c={cookie:e,localStorage:t,jsVariable:r,cssSelector:n},u=Array.isArray(i)?i:[i];if(o&&c[o])for(var l=c[o],s=0,v=u;s<v.length;s++){var d=v[s],f=l(d);if(f)return f}else console.warn("invalid uid source",o)}(d,["_y","_shopify_y"]):void 0}catch(e){console.error(e)}var _=o;_[c]=_[c]||[],_[c].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var A=i.getElementsByTagName(a)[0],I=p?"&bi="+encodeURIComponent(p):"",h=i.createElement(a),E=p?"kp"+v:v;h.async=!0,h.src="{{DOMAIN}}/"+E+".js?id={{WEB_GTM_ID}}"+I,null===(m=A.parentNode)||void 0===m||m.insertBefore(h,A)}(window,document,"script","dataLayer",0,0,0,"{{CONTAINER_ID}}","cookie")}();'.replace("{{DOMAIN}}",w).replace("{{WEB_GTM_ID}}",b).replace("{{CONTAINER_ID}}",S);y.innerHTML=k}else y.innerHTML="\n            (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n            new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n            j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n            '".concat((null==p?void 0:p.is_custom_domain)&&(null==p?void 0:p.custom_domain)||"https://www.googletagmanager.com","/").concat((null==p?void 0:p.is_custom_loaded)&&(null==p?void 0:p.custom_loaded)||"gtm",".js?id='+i+dl;f.parentNode.insertBefore(j,f);\n            })(window,document,'script','dataLayer','").concat((null==p?void 0:p.gtm_id)||"","');\n          ");document.head.appendChild(y)}console.log("+++++++++++lsNet_1.0.3+++++++++++++",window.lsData),window.lsData||(window.lsData={});var j,O,x,L={};if(null!==(n=window)&&void 0!==n&&null!==(o=n.lsData)&&void 0!==o&&o.customer&&null!==(l=window)&&void 0!==l&&null!==(d=l.lsData)&&void 0!==d&&d.customer.email&&null!=f&&f.user_data){var I=window.lsData.customer||{};L.user_data={email:I.email,first_name:I.first_name,last_name:I.last_name,customer_id:I.customer_id},localStorage.getItem("customerLoginId")||(localStorage.setItem("customerLoginId",I.customer_id),localStorage.getItem("customerRegisterId")&&localStorage.getItem("customerRegisterId")==I.customer_id?h({event:"login",user_data:L.user_data}):(localStorage.setItem("customerRegisterId",I.customer_id),h({event:"sign_up",user_data:L.user_data})))}else g.indexOf("/checkouts/")<0&&localStorage.removeItem("customerLoginId");if(f.ecommerce||f.user_data){var D=function(){var t,e,n,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"begin_checkout_stape";if(null!==(t=window)&&void 0!==t&&null!==(e=t.lsData)&&void 0!==e&&e.cart||null!==(n=window)&&void 0!==n&&null!==(r=n.lsData)&&void 0!==r&&r.checkout){f.ecommerce&&h({ecommerce:null});var o=void 0;if(f.ecommerce){var l,c,u,d,s,v,m,p,_,g=(null===(l=window)||void 0===l||null===(c=l.lsData)||void 0===c?void 0:c.cart)||(null===(u=window)||void 0===u||null===(d=u.lsData)||void 0===d?void 0:d.checkout)||{},y=[];if(null!==(s=window)&&void 0!==s&&null!==(v=s.lsData)&&void 0!==v&&v.cart)y=((null===(_=window.lsData.cart)||void 0===_?void 0:_.items)||[]).map((function(t){return{item_id:t.product_id+"",item_sku:t.sku,item_name:t.product_title,item_brand:t.vendor,item_category:t.product_type,item_variant:t.variant_id+"",price:t.price/100,quantity:t.quantity}}));else if(null!==(m=window)&&void 0!==m&&null!==(p=m.lsData)&&void 0!==p&&p.checkout){var w;y=((null===(w=window.lsData.checkout)||void 0===w?void 0:w.line_items)||[]).map((function(t){return{item_id:t.item_id+"",item_sku:t.item_sku,item_name:t.item_name,item_brand:t.item_brand,item_category:t.item_category,item_variant:t.item_variant+"",price:t.price,quantity:t.quantity}}))}o={cart_total:g.total_price/100,currency:window.lsData.currency||g.currency,cart_quantity:g.item_count,items:y}}h(a(a({},L),{},{ecommerce:o,event:i})),console.log("🚀 ~ file: index.js:302 ~ beginCheckoutStape ~ window.dataLayer:",a(a({},L),{},{ecommerce:o,event:i}))}},E=function(){var t,e=(t=r().mark((function t(e){var n,i,o,l,c,u;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch(window.Shopify.routes.root+"cart.js").then((function(t){return t.json()})).then((function(t){return t}));case 3:n=t.sent,window.lsData.cart=n||{},localStorage.getItem("cartToken")!=n.token&&localStorage.setItem("cartToken",n.token),i=(n&&n.items||[]).find((function(t){return((null==e?void 0:e.items)||[]).some((function(e){return e.quantity!=t.quantity}))||!((null==e?void 0:e.items)||[]).some((function(e){return e.id==t.id}))})),o=(e&&e.items||[]).find((function(t){return(n&&(null==n?void 0:n.items)||[]).some((function(e){return e.quantity!=t.quantity}))||!((null==n?void 0:n.items)||[]).some((function(e){return e.id==t.id}))})),i||o?(f.ecommerce&&h({ecommerce:null}),l=i||o,c=void 0,f.ecommerce&&(c={currency:window.lsData.currency,items:[{item_id:l.product_id,item_sku:l.sku,item_name:l.product_title,item_brand:l.vendor,item_category:l.product_type,item_variant:l.variant_id+"",price:l.price/100,quantity:l.quantity}]}),u="add_to_cart_stape",(null==i?void 0:i.id)==(null==o?void 0:o.id)&&(u=i.quantity<o.quantity?"remove_from_cart_stape":"add_to_cart_stape"),!i&&o&&(u="remove_from_cart_stape"),h(a(a({},L),{},{ecommerce:c,event:u})),console.log("🚀 ~ file: index.js:450 ~ equelCart ~ event:",u)):setTimeout((function(){E(e)}),500),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),console.log("🚀 ~ file: index.js:418 ~ equelCart ~ error:",t.t0);case 14:case"end":return t.stop()}}),t,null,[[0,11]])})),function(){var e=this,n=arguments;return new Promise((function(r,o){var a=t.apply(e,n);function l(t){i(a,r,o,l,c,"next",t)}function c(t){i(a,r,o,l,c,"throw",t)}l(void 0)}))});return function(t){return e.apply(this,arguments)}}();if(g.indexOf("/cart")>-1){f.ecommerce&&h({ecommerce:null});var q=void 0;if(f.ecommerce){var P,T,N=(null===(P=window)||void 0===P||null===(T=P.lsData)||void 0===T?void 0:T.cart)||{};q={cart_total:N.total_price/100,currency:window.lsData.currency,cart_quantity:N.item_count,items:((null==N?void 0:N.items)||[]).map((function(t){return{item_id:t.product_id+"",item_sku:t.sku,item_name:t.product_title,item_brand:t.vendor,item_category:t.product_type,item_variant:t.variant_id+"",price:t.price/100,quantity:t.quantity}}))}}h(a(a({},L),{},{ecommerce:q,event:"view_cart_stape"}))}if(g.indexOf("/collections/")>-1){var M,A;f.ecommerce&&h({ecommerce:null});var R,C=(null===(M=window.lsData)||void 0===M?void 0:M.collection)||[],G=(null===(A=window.lsData)||void 0===A?void 0:A.collection_title)||"",H=void 0;f.ecommerce&&(H={currency:null===(R=window.lsData)||void 0===R?void 0:R.currency,item_list_name:G,items:(C||[]).map((function(t){return{item_name:t.title,item_id:t.id,item_sku:t.variants&&t.variants[0]&&t.variants[0].sku?t.variants[0].sku:"",price:(t.price/100).toFixed(2),item_variant:t.variants[0].id+""}}))}),h(a(a({},L),{},{ecommerce:H,event:"view_collection_stape"}))}if(g.indexOf("/products/")>-1){var F;f.ecommerce&&h({ecommerce:null});var X,z,B,J=(null===(F=window.lsData)||void 0===F?void 0:F.product)||{},U=void 0;f.ecommerce&&(U={currency:null===(X=window.lsData)||void 0===X||null===(z=X.cart)||void 0===z?void 0:z.currency,items:[{item_name:J.title,item_id:null==J||null===(B=J.id)||void 0===B?void 0:B.toString(),item_sku:J.variants&&J.variants[0]&&J.variants[0].sku?J.variants[0].sku:"",item_brand:J.vendor,item_category:J.type,price:(J.price/100).toFixed(2),item_variant:J.variants&&J.variants[0]?J.variants[0].id+"":""}]}),h(a(a({},L),{},{ecommerce:U,event:"view_item_stape"}))}if(g.indexOf("/checkouts")>-1&&location.href.indexOf("step=payment_method")>-1){var W,V,Y,$,K,Q,Z,tt,et,nt,rt,it,ot,at,lt,ct,ut,dt,st,vt,mt,pt=(null===(W=window)||void 0===W||null===(V=W.lsData)||void 0===V?void 0:V.checkout)||{},ft=(null===(Y=window)||void 0===Y||null===($=Y.lsData)||void 0===$?void 0:$.customer)||{};L.event="payment_info_stape",f.ecommerce&&h({ecommerce:null}),f.user_data&&(L.user_data={email:pt.email,first_name:(null==pt||null===(K=pt.shipping_address)||void 0===K?void 0:K.first_name)||(null==pt||null===(Q=pt.billing_address)||void 0===Q?void 0:Q.first_name)||"",last_name:(null==pt||null===(Z=pt.shipping_address)||void 0===Z?void 0:Z.last_name)||(null==pt||null===(tt=pt.billing_address)||void 0===tt?void 0:tt.last_name)||"",phone:(null==pt||null===(et=pt.shipping_address)||void 0===et?void 0:et.phone)||(null==pt||null===(nt=pt.billing_address)||void 0===nt?void 0:nt.phone)||"",country:(null==pt||null===(rt=pt.shipping_address)||void 0===rt?void 0:rt.country_code)||(null==pt||null===(it=pt.billing_address)||void 0===it?void 0:it.country_code)||"",region:(null==pt||null===(ot=pt.shipping_address)||void 0===ot?void 0:ot.province)||(null==pt||null===(at=pt.billing_address)||void 0===at?void 0:at.province)||"",city:(null==pt||null===(lt=pt.shipping_address)||void 0===lt?void 0:lt.city)||(null==pt||null===(ct=pt.billing_address)||void 0===ct?void 0:ct.city)||"",street:(null==pt||null===(ut=pt.shipping_address)||void 0===ut?void 0:ut.street)||(null==pt||null===(dt=pt.shipping_address)||void 0===dt?void 0:dt.address1)||(null==pt||null===(st=pt.billing_address)||void 0===st?void 0:st.address1)||"",zip:(null==pt||null===(vt=pt.shipping_address)||void 0===vt?void 0:vt.zip)||(null==pt||null===(mt=pt.billing_address)||void 0===mt?void 0:mt.zip)||"",customer_id:(null==ft?void 0:ft.id)||(null==pt?void 0:pt.customer_id)||""}),f.ecommerce&&(L.ecommerce={currency:null==pt?void 0:pt.currency,cart_total:(null==pt?void 0:pt.total_price)/100,cart_quantity:pt.item_count,items:(null==pt?void 0:pt.line_items)||[]}),h(a({},L))}var _t=window.fetch;window.fetch=function(t,e){console.log("🚀 ~ file: index.js:372 ~ fetch ~ url:",t);try{if("/cart/add"==t||"/cart/change"==t||"/cart/add.js"==t||"/cart/change.js"==t||0==t.indexOf("/cart/update.js")){var n,r,i=(null===(n=window)||void 0===n||null===(r=n.lsData)||void 0===r?void 0:r.cart)||{};localStorage.setItem("oldCartStape",JSON.stringify(i))}}catch(t){console.log("🚀 ~ file: index.js:356 ~ .then ~ error:",t)}return _t(t,e)},j=function(t){if(console.log("🚀 ~ file: index.js:462 ~ addXMLRequestCallback ~ xhr:",t._url),"/cart/add.js"==t._url||"/cart/change.js"==t._url){var e=window.lsData.cart||{};localStorage.setItem("oldCartStape",JSON.stringify(e))}},XMLHttpRequest.callbacks?XMLHttpRequest.callbacks.push(j):(XMLHttpRequest.callbacks=[j],O=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){var t;if(null!==(t=XMLHttpRequest)&&void 0!==t&&t.callbacks&&XMLHttpRequest.callbacks.length)for(x=0;x<XMLHttpRequest.callbacks.length;x++)XMLHttpRequest.callbacks[x](this);O.apply(this,arguments)}),document.addEventListener("submit",(function(t){if(t.target.action.indexOf("/cart/add")>-1){var e=window.lsData.cart||{};localStorage.setItem("oldCartStape",JSON.stringify(e))}else t.target.action.indexOf("/cart")>-1&&D()})),window.location.href.includes("/checkout")&&!localStorage.getItem("begin_checkout_plus_stape")?(localStorage.setItem("begin_checkout_plus_stape","true"),D("begin_checkout_plus_stape")):localStorage.removeItem("begin_checkout_plus_stape"),setInterval((function(){var t=localStorage.getItem("oldCartStape");if(t)try{t=JSON.parse(t),localStorage.removeItem("oldCartStape"),E(t)}catch(t){}}),500)}if(g.indexOf("/thank_you")>-1){var ht,gt,yt,wt,bt=(null===(ht=window)||void 0===ht||null===(gt=ht.Shopify)||void 0===gt?void 0:gt.checkout)||{},St=(null===(yt=window)||void 0===yt||null===(wt=yt.lsData)||void 0===wt?void 0:wt.customer)||{};f.ecommerce&&h({ecommerce:null});var kt,jt,Ot,xt,Lt,It,Dt,Et,qt,Pt,Tt,Nt,Mt,At,Rt,Ct,Gt,Ht,Ft={event:"purchase_stape"};if(f.user_data&&(Ft.user_data={email:bt.email||(null==bt||null===(kt=bt.billing_address)||void 0===kt?void 0:kt.email)||(null==bt||null===(jt=bt.shipping_address)||void 0===jt?void 0:jt.email),first_name:(null==St?void 0:St.first_name)||(null==bt||null===(Ot=bt.billing_address)||void 0===Ot?void 0:Ot.first_name)||(null==bt||null===(xt=bt.shipping_address)||void 0===xt?void 0:xt.first_name),last_name:(null==St?void 0:St.last_name)||(null==bt||null===(Lt=bt.billing_address)||void 0===Lt?void 0:Lt.last_name)||(null==bt||null===(It=bt.shipping_address)||void 0===It?void 0:It.last_name),phone:(null==St?void 0:St.phone)||(null==bt||null===(Dt=bt.billing_address)||void 0===Dt?void 0:Dt.phone)||(null==bt||null===(Et=bt.shipping_address)||void 0===Et?void 0:Et.phone),country:(null==bt||null===(qt=bt.billing_address)||void 0===qt?void 0:qt.country_code)||(null==bt||null===(Pt=bt.shipping_address)||void 0===Pt?void 0:Pt.country_code),region:"US"==bt.billing_address.country_code?null==bt||null===(Tt=bt.billing_address)||void 0===Tt?void 0:Tt.province_code:null==bt||null===(Nt=bt.billing_address)||void 0===Nt?void 0:Nt.province,city:(null==bt||null===(Mt=bt.billing_address)||void 0===Mt?void 0:Mt.city)||(null==bt||null===(At=bt.shipping_address)||void 0===At?void 0:At.city),street:(null==bt||null===(Rt=bt.billing_address)||void 0===Rt?void 0:Rt.address1)||(null==bt||null===(Ct=bt.shipping_address)||void 0===Ct?void 0:Ct.address1),zip:(null==bt||null===(Gt=bt.billing_address)||void 0===Gt?void 0:Gt.zip)||(null==bt||null===(Ht=bt.shipping_address)||void 0===Ht?void 0:Ht.zip),customer_id:(null==St?void 0:St.id)||(null==bt?void 0:bt.customer_id)}),f.ecommerce){var Xt,zt,Bt,Jt,Ut,Wt,Vt=null===(Xt=window)||void 0===Xt||null===(zt=Xt.Shopify)||void 0===zt?void 0:zt.shop;Ft.ecommerce={transaction_id:null==bt?void 0:bt.order_id,affiliation:Vt,value:null==bt?void 0:bt.total_price,tax:null==bt?void 0:bt.total_tax,shipping:(null==bt||null===(Bt=bt.shipping)||void 0===Bt?void 0:Bt.price)||(null==bt||null===(Jt=bt.shipping_rate)||void 0===Jt?void 0:Jt.price),discount_amount:null==bt||null===(Ut=bt.discount)||void 0===Ut?void 0:Ut.amount,discount:null==bt||null===(Wt=bt.discount)||void 0===Wt?void 0:Wt.code,currency:null==bt?void 0:bt.currency,items:((null==bt?void 0:bt.line_items)||[]).map((function(t){return{item_id:t.product_id,item_sku:t.sku,item_name:t.title,item_brand:t.vendor,item_variant:t.variant_id+"",price:t.price,quantity:t.quantity}}))}}(f.ecommerce||f.user_data)&&h(a({},Ft));try{var Yt=Ft.user_data.customer_id;!localStorage.getItem("customerLoginId")&&Yt&&(localStorage.setItem("customerLoginId",Yt),localStorage.getItem("customerRegisterId")&&localStorage.getItem("customerRegisterId")==Yt?h({event:"login",user_data:Ft.user_data}):(localStorage.setItem("customerRegisterId",Yt),h({event:"sign_up",user_data:Ft.user_data})))}catch(t){}if(_.send_webhook&&_.url&&_.purchase_webhook){var $t={fbc:u("fbc"),fbp:u("fbp"),FPGCLAW:u("FPGCLAW"),_gcl_aw:u("_gcl_aw"),ttclid:u("ttclid")};fetch(_.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a(a({},Ft),{},{cookies:$t,cart_id:localStorage.getItem("cartToken")}))})}}})).catch((function(t){console.log("🚀 ~ file: index.js ~ line 184 ~ ]).then ~ err",t)})),lsNetvisioGTM=e})();