/*!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 I(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 y=Object.getPrototypeOf,g=y&&y(y(x([])));g&&g!==e&&i.call(g,l)&&(h=g);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=L(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 L(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,L(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function x(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=x,I.prototype={constructor:I,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(j),!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),j(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;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(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("www.mykeyport.com","&shop_id=").concat("27153367137"),{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;window.dataLayer=window.dataLayer||[];var h=location.pathname;if(localStorage.getItem("cartToken")!=m.token&&h.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"),g=(null==p?void 0:p.is_custom_domain)&&(null==p?void 0:p.custom_domain)||"https://www.googletagmanager.com",w=(null==p?void 0:p.gtm_id)||"",b=(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 S='!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,s,u,l,d,v,f){var g,m,y,p;try{m=d&&(y=navigator.userAgent,(p=/Version\\/([0-9._]+)(.*Mobile)?.*Safari.*/.exec(y))&&parseFloat(p[1])>=16.4)?function(o,i,a){void 0===i&&(i="");var c={cookie:e,localStorage:t,jsVariable:r,cssSelector:n},s=Array.isArray(i)?i:[i];if(o&&c[o])for(var u=c[o],l=0,d=s;l<d.length;l++){var v=d[l],f=u(v);if(f)return f}else console.warn("invalid uid source",o)}(d,["_y","_shopify_y"]):void 0}catch(e){console.error(e)}var h=o;h[c]=h[c]||[],h[c].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var w=i.getElementsByTagName(a)[0],S=m?"&bi="+encodeURIComponent(m):"",b=i.createElement(a),k=m?"kp"+l:l;b.async=!0,b.src="{{DOMAIN}}/"+k+".js?id={{WEB_GTM_ID}}"+S,null===(g=w.parentNode)||void 0===g||g.insertBefore(b,w)}(window,document,"script","dataLayer",0,0,"{{CONTAINER_ID}}","cookie")}();'.replace("{{DOMAIN}}",g).replace("{{WEB_GTM_ID}}",w).replace("{{CONTAINER_ID}}",b);y.innerHTML=S}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+++++++++++++",window.lsData);var k,L,O,j={};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||{};j.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?window.dataLayer.push({event:"login",user_data:j.user_data}):(localStorage.setItem("customerRegisterId",I.customer_id),window.dataLayer.push({event:"sign_up",user_data:j.user_data})))}else h.indexOf("/checkouts/")<0&&localStorage.removeItem("customerLoginId");if(f.ecommerce||f.user_data){var x=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&&window.dataLayer.push({ecommerce:null});var o=void 0;if(f.ecommerce){var l,c,u,d,s,v,m,p,_,h=(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 g;y=((null===(g=window.lsData.checkout)||void 0===g?void 0:g.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:h.total_price/100,currency:window.lsData.currency||h.currency,cart_quantity:h.item_count,items:y}}window.dataLayer.push(a(a({},j),{},{ecommerce:o,event:i})),console.log("🚀 ~ file: index.js:302 ~ beginCheckoutStape ~ window.dataLayer:",a(a({},j),{},{ecommerce:o,event:i}))}},D=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&&window.dataLayer.push({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?"add_to_cart_stape":"remove_from_cart_stape"),!i&&o&&(u="remove_from_cart_stape"),window.dataLayer.push(a(a({},j),{},{ecommerce:c,event:u}))):setTimeout((function(){D(e)}),1e3),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(h.indexOf("/cart")>-1){f.ecommerce&&window.dataLayer.push({ecommerce:null});var E=void 0;if(f.ecommerce){var P=window.lsData.cart||{};E={cart_total:P.total_price/100,currency:window.lsData.currency,cart_quantity:P.item_count,items:((null==P?void 0:P.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}}))}}window.dataLayer.push(a(a({},j),{},{ecommerce:E,event:"view_cart_stape"}))}if(h.indexOf("/collections/")>-1){var T,q;f.ecommerce&&window.dataLayer.push({ecommerce:null});var N,M=(null===(T=window.lsData)||void 0===T?void 0:T.collection)||[],A=(null===(q=window.lsData)||void 0===q?void 0:q.collection_title)||"",C=void 0;f.ecommerce&&(C={currency:null===(N=window.lsData)||void 0===N?void 0:N.currency,item_list_name:A,items:(M||[]).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+""}}))}),window.dataLayer.push(a(a({},j),{},{ecommerce:C,event:"view_collection_stape"}))}if(h.indexOf("/products/")>-1){var R;f.ecommerce&&window.dataLayer.push({ecommerce:null});var G,H,F=(null===(R=window.lsData)||void 0===R?void 0:R.product)||{},X=void 0;f.ecommerce&&(X={currency:null===(G=window.lsData)||void 0===G||null===(H=G.cart)||void 0===H?void 0:H.currency,items:[{item_name:F.title,item_id:F.id.toString(),item_sku:F.variants&&F.variants[0]&&F.variants[0].sku?F.variants[0].sku:"",item_brand:F.vendor,item_category:F.type,price:(F.price/100).toFixed(2),item_variant:F.variants[0].id+""}]}),window.dataLayer.push(a(a({},j),{},{ecommerce:X,event:"view_item_stape"}))}if(h.indexOf("/checkouts")>-1&&location.href.indexOf("step=payment_method")>-1){var z,B,J,U,W,V,Y,$,K,Q,Z,tt,et,nt,rt,it,ot,at,lt,ct,ut,dt=(null===(z=window)||void 0===z||null===(B=z.lsData)||void 0===B?void 0:B.checkout)||{},st=(null===(J=window)||void 0===J||null===(U=J.lsData)||void 0===U?void 0:U.customer)||{};j.event="payment_info_stape",f.ecommerce&&window.dataLayer.push({ecommerce:null}),f.user_data&&(j.user_data={email:dt.email,first_name:(null==dt||null===(W=dt.shipping_address)||void 0===W?void 0:W.first_name)||(null==dt||null===(V=dt.billing_address)||void 0===V?void 0:V.first_name)||"",last_name:(null==dt||null===(Y=dt.shipping_address)||void 0===Y?void 0:Y.last_name)||(null==dt||null===($=dt.billing_address)||void 0===$?void 0:$.last_name)||"",phone:(null==dt||null===(K=dt.shipping_address)||void 0===K?void 0:K.phone)||(null==dt||null===(Q=dt.billing_address)||void 0===Q?void 0:Q.phone)||"",country:(null==dt||null===(Z=dt.shipping_address)||void 0===Z?void 0:Z.country_code)||(null==dt||null===(tt=dt.billing_address)||void 0===tt?void 0:tt.country_code)||"",region:(null==dt||null===(et=dt.shipping_address)||void 0===et?void 0:et.province)||(null==dt||null===(nt=dt.billing_address)||void 0===nt?void 0:nt.province)||"",city:(null==dt||null===(rt=dt.shipping_address)||void 0===rt?void 0:rt.city)||(null==dt||null===(it=dt.billing_address)||void 0===it?void 0:it.city)||"",street:(null==dt||null===(ot=dt.shipping_address)||void 0===ot?void 0:ot.street)||(null==dt||null===(at=dt.shipping_address)||void 0===at?void 0:at.address1)||(null==dt||null===(lt=dt.billing_address)||void 0===lt?void 0:lt.address1)||"",zip:(null==dt||null===(ct=dt.shipping_address)||void 0===ct?void 0:ct.zip)||(null==dt||null===(ut=dt.billing_address)||void 0===ut?void 0:ut.zip)||"",customer_id:(null==st?void 0:st.id)||(null==dt?void 0:dt.customer_id)||""}),f.ecommerce&&(j.ecommerce={currency:null==dt?void 0:dt.currency,cart_total:(null==dt?void 0:dt.total_price)/100,cart_quantity:dt.item_count,items:(null==dt?void 0:dt.line_items)||[]}),window.dataLayer.push(a({},j))}var vt=window.fetch;window.fetch=function(t,e){if("/cart/add"==t||"/cart/change"==t||"/cart/add.js"==t||"/cart/change.js"==t){var n=window.lsData.cart||{};localStorage.setItem("oldCartStape",JSON.stringify(n))}return vt(t,e)},k=function(t){if("/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(k):(XMLHttpRequest.callbacks=[k],L=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.send=function(){for(O=0;O<XMLHttpRequest.callbacks.length;O++)XMLHttpRequest.callbacks[O](this);L.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&&x()})),window.location.href.includes("/checkout")&&!localStorage.getItem("begin_checkout_plus_stape")?(localStorage.setItem("begin_checkout_plus_stape","true"),x("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"),D(t)}catch(t){}}),5e3)}if(h.indexOf("/thank_you")>-1){var mt,pt,ft,_t,ht=(null===(mt=window)||void 0===mt||null===(pt=mt.Shopify)||void 0===pt?void 0:pt.checkout)||{},yt=(null===(ft=window)||void 0===ft||null===(_t=ft.lsData)||void 0===_t?void 0:_t.customer)||{};f.ecommerce&&window.dataLayer.push({ecommerce:null});var gt,wt,bt,St,kt,Lt,Ot,jt,It,xt,Dt,Et,Pt,Tt,qt,Nt,Mt,At,Ct={event:"purchase_stape"};if(f.user_data&&(Ct.user_data={email:ht.email||(null==ht||null===(gt=ht.billing_address)||void 0===gt?void 0:gt.email)||(null==ht||null===(wt=ht.shipping_address)||void 0===wt?void 0:wt.email),first_name:(null==yt?void 0:yt.first_name)||(null==ht||null===(bt=ht.billing_address)||void 0===bt?void 0:bt.first_name)||(null==ht||null===(St=ht.shipping_address)||void 0===St?void 0:St.first_name),last_name:(null==yt?void 0:yt.last_name)||(null==ht||null===(kt=ht.billing_address)||void 0===kt?void 0:kt.last_name)||(null==ht||null===(Lt=ht.shipping_address)||void 0===Lt?void 0:Lt.last_name),phone:(null==yt?void 0:yt.phone)||(null==ht||null===(Ot=ht.billing_address)||void 0===Ot?void 0:Ot.phone)||(null==ht||null===(jt=ht.shipping_address)||void 0===jt?void 0:jt.phone),country:(null==ht||null===(It=ht.billing_address)||void 0===It?void 0:It.country_code)||(null==ht||null===(xt=ht.shipping_address)||void 0===xt?void 0:xt.country_code),region:"US"==ht.billing_address.country_code?null==ht||null===(Dt=ht.billing_address)||void 0===Dt?void 0:Dt.province_code:null==ht||null===(Et=ht.billing_address)||void 0===Et?void 0:Et.province,city:(null==ht||null===(Pt=ht.billing_address)||void 0===Pt?void 0:Pt.city)||(null==ht||null===(Tt=ht.shipping_address)||void 0===Tt?void 0:Tt.city),street:(null==ht||null===(qt=ht.billing_address)||void 0===qt?void 0:qt.address1)||(null==ht||null===(Nt=ht.shipping_address)||void 0===Nt?void 0:Nt.address1),zip:(null==ht||null===(Mt=ht.billing_address)||void 0===Mt?void 0:Mt.zip)||(null==ht||null===(At=ht.shipping_address)||void 0===At?void 0:At.zip),customer_id:(null==yt?void 0:yt.id)||(null==ht?void 0:ht.customer_id)}),f.ecommerce){var Rt,Gt,Ht,Ft,Xt,zt=null===(Rt=window)||void 0===Rt||null===(Gt=Rt.Shopify)||void 0===Gt?void 0:Gt.shop;Ct.ecommerce={transaction_id:null==ht?void 0:ht.order_id,affiliation:zt,value:null==ht?void 0:ht.total_price,tax:null==ht?void 0:ht.total_tax,shipping:null==ht||null===(Ht=ht.shipping)||void 0===Ht?void 0:Ht.price,discount_amount:null==ht||null===(Ft=ht.discount)||void 0===Ft?void 0:Ft.amount,discount:null==ht||null===(Xt=ht.discount)||void 0===Xt?void 0:Xt.code,currency:null==ht?void 0:ht.currency,items:((null==ht?void 0:ht.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)&&window.dataLayer.push(a({},Ct));try{var Bt=Ct.user_data.customer_id;!localStorage.getItem("customerLoginId")&&Bt&&(localStorage.setItem("customerLoginId",Bt),localStorage.getItem("customerRegisterId")&&localStorage.getItem("customerRegisterId")==Bt?window.dataLayer.push({event:"login",user_data:Ct.user_data}):(localStorage.setItem("customerRegisterId",Bt),window.dataLayer.push({event:"sign_up",user_data:Ct.user_data})))}catch(t){}if(_.send_webhook&&_.url&&_.purchase_webhook){var Jt={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({},Ct),{},{cookies:Jt,cart_id:localStorage.getItem("cartToken")}))})}}})).catch((function(t){console.log("🚀 ~ file: index.js ~ line 184 ~ ]).then ~ err",t)})),lsNetvisioGTM=e})();