"use strict";(self.__ox=self.__ox||[]).push([[577],{577:function(t,e,r){r.r(e),r.d(e,{default:function(){return L}});var n=r(881),o=r(506),i=r(60),c=r(844);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var l=function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];0!==Object.keys(t[0].events?t[0].events:[]).length?t.forEach((t=>{var o;if(null!==(o=t.events)&&void 0!==o&&null!==(o=o[e])&&void 0!==o&&o.enable){if(i){var l="ProductID"===t.events[e].id_type?i.product_id:i.variant_id;c?r.contents=l:r.content_id=l.toString()}window.ttq.instance(t.pixel_id).track(e,function(t){for(var e=1;e1&&void 0!==arguments[1]&&arguments[1],u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",{eventViewContentIdTikTok:a}=(0,d.Q)(),p=parseInt(null===(e=document.querySelector(c.KI))||void 0===e?void 0:e.value),{currency:v,product_id:s,product_title:f,variants:y,variants_info:_}=c.YY,m=y?y.split(",").map(Number).filter((t=>0!==t)):[],h="";document.querySelectorAll(c.KI).length>0?h=null===(n=document.querySelector(c.KI))||void 0===n?void 0:n.value:h=null===(o=document.querySelector('form select[class="shp_form"]'))||void 0===o?void 0:o.value;var b=_.find((t=>t.id==p)),g=null!==(r=null==b?void 0:b.price)&&void 0!==r?r:"",O={content_id:h||m[0],content_type:m&&m.length>1?"product_group":"product",content_name:f,quantity:1,price:parseInt(g)/100||0,currency:v,value:parseInt(g)/100||0};l(t,"ViewContent",O,i?u:a,{product_id:s,variant_id:h})},v=r(936),s=r(316),f=r(818),y=r(370),_=(0,f.i)(y.b);function m(t,e,r,n,o,i,c){try{var u=t[i](c),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}var h=function(){var t,e=(t=function*(t,e,r){var o,{shop_name:i,template_id:c,shop_id:u,tags:a,collections:l}=n.YY,d=a?a.split(",").map(String).filter((t=>""!==t)):[],p=l?l.split(",").map(String).filter((t=>""!==t)):[],v={shop_id:u,event:t,event_time:(new Date).getTime(),event_id:e,properties:r,tags:d,event_source_url:window.location.href,collections:p,context:{page:{url:window.location.href,referrer:window.location.origin}}};if(window.sessionStorage.getItem("tt_adInfo")&&v.context&&(v.context.ad=null!==(o=window.sessionStorage.getItem("tt_adInfo"))&&void 0!==o?o:""),"thank-you"===c){var s=Shopify.checkout,f=s.billing_address,y=s.email||"",m=f.phone;v.context&&(v.context.user={external_id:s.customer_id,phone_number:m,email:y})}try{yield _(v)}catch(t){}},function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){m(i,n,o,c,u,"next",t)}function u(t){m(i,n,o,c,u,"throw",t)}c(void 0)}))});return function(t,r,n){return e.apply(this,arguments)}}();function b(t,e,r,n,o,i,c){try{var u=t[i](c),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function g(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){b(i,n,o,c,u,"next",t)}function u(t){b(i,n,o,c,u,"throw",t)}c(void 0)}))}}var O=t=>{var{eventCheckoutTikTok:e}=(0,d.Q)(),{fetchProductCart:r}=(0,s.A)(),n="_ox_tt_init_checkout",{currency:o,template_id:i,product_id:u,product_title:a,variants_info:p}=c.YY,f=function(){var d=g((function*(){var d,s=[],f=[],y=1,_=document.querySelector('input[name="quantity"]');_&&_.addEventListener("change",(t=>{var e;y=parseInt(null==t||null===(e=t.target)||void 0===e?void 0:e.value)}));var m=parseInt(null===(d=document.querySelector(c.KI))||void 0===d?void 0:d.value),b=0;if("cart"===i){var g=yield r();g&&(g.items.forEach((t=>{s.push({content_id:t.id.toString(),content_type:"product",content_name:t.product_title,price:parseFloat(t.price.toString())/100,quantity:t.quantity}),f.push({content_id:t.product_id.toString(),content_type:"product",content_name:t.product_title,price:parseFloat(t.price.toString())/100,quantity:t.quantity})})),b=parseFloat(String(g.total_price))/100)}else{var O,w,S=p.find((t=>t.id==m)),j=null!==(O=null==S?void 0:S.price)&&void 0!==O?O:"";b=j*(null!==(w=y)&&void 0!==w?w:1)/100,s=m&&y?[{content_id:m.toString(),content_type:"product",content_name:a,price:parseFloat(j)/100,quantity:y}]:[],f=u&&y?[{content_id:u,content_type:"product",content_name:null!=a?a:"",price:parseFloat(j)/100,quantity:y}]:[]}l(t,"InitiateCheckout",{contents:s,currency:o,value:b},e,{product_id:f,variant_id:s},!0),h("InitiateCheckout",e,{contents:s,product_ids:f,currency:o,value:b}),v.A.setItem(n,JSON.stringify({web_pixel_track:!1}))}));return function(){return d.apply(this,arguments)}}();(()=>{if(v.A.setItem(n,JSON.stringify({web_pixel_track:!0})),document.querySelectorAll(".shp_custom_theme").length>0)document.body.addEventListener("click",function(){var t=g((function*(t){document.querySelectorAll(".shp_checkout_btn, .shp_checkout_btn *").forEach((function(e){t.target===e&&f()}))}));return function(e){return t.apply(this,arguments)}}(),!0);else{var t=c.qy.split(",").find((t=>document.querySelector(t)));if(t){var e=document.querySelector(t);null==e||e.addEventListener("click",(()=>{f()}),!0)}}})()},w=r(44),S=t=>{var e,r,n,{currency:o}=c.YY,i=Shopify.checkout,u=null===(e=Shopify)||void 0===e||null===(e=e.Checkout)||void 0===e||null===(e=e.shop)||void 0===e?void 0:e.id,a=[],d=[],p=(0,w.n)(i.order_id.toString());i.line_items.forEach((t=>{a.push({content_id:t.variant_id.toString(),content_type:"product",content_name:t.title,price:t.price,quantity:t.quantity}),d.push({content_id:t.product_id.toString(),content_type:"product",content_name:t.title,price:t.price,quantity:t.quantity})})),n=parseFloat(i.total_price);var v=i.billing_address||{},s=i.email||"",f=v.phone||"";null===(r=window.ttq)||void 0===r||r.identify({external_id:i.customer_id,email:s,phone_number:f});var y={contents:a,currency:o,value:n};l(t,"PlaceAnOrder",y,p,{product_id:d,variant_id:a},!0),l(t,"Purchase",y,p,{product_id:d,variant_id:a},!0),[27630600330,77424492862].includes(u)||l(t,"CompletePayment",y,p,{product_id:d,variant_id:a},!0)};function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e{var e="_ox_tt_add_to_cart",{currency:r,product_id:i,product_title:c,variants:u,variants_info:a}=n.YY,d=document.querySelector(n.dv),p=u?u.split(",").map(Number).filter((t=>0!==t)):[],s=p&&p.length>1?"product_group":"product";v.A.setItem(e,JSON.stringify({web_pixel_track:!0,content_type:s}));var f=1,y=document.querySelector('input[name="quantity"]');y&&y.addEventListener("change",(t=>{var e;f=parseInt(null==t||null===(e=t.target)||void 0===e?void 0:e.value)})),d&&(null==d||d.addEventListener("click",(()=>{var u,d,s,y=parseInt(null===(u=document.querySelector(n.KI))||void 0===u?void 0:u.value),_=a.find((t=>t.id==y)),m=null!==(d=null==_?void 0:_.price)&&void 0!==d?d:"",b="".concat((0,o.sX)(),"_").concat((0,o.hw)(1,999)),g={content_id:y.toString(),content_type:p&&p.length>1?"product_group":"product",content_name:c,quantity:null!==(s=f)&&void 0!==s?s:0,price:m?parseInt(m)/100:0,currency:r,value:m&&f?parseInt(m)/100*f:0};l(t,"AddToCart",g,b,{product_id:i,variant_id:y}),h("AddToCart",b,{contents:[P({},g)],product_ids:[P(P({},g),{},{content_id:i})],currency:r,value:m&&f?parseInt(m)/100*f:0}),v.A.setItem(e,JSON.stringify({web_pixel_track:!1}))}),!0))};function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var e=1;e{var{currency:e,template_id:r,product_id:n,product_title:i,variants_info:u,variants:a}=c.YY,l=a?a.split(",").map(Number).filter((t=>0!==t)):[],d=()=>{var a,d,v,s="".concat((0,o.sX)(),"_").concat((0,o.hw)(1,999)),f=null===(a=document.querySelector(c.KI))||void 0===a?void 0:a.value,y="";document.querySelectorAll(c.KI).length>0?y=null===(d=document.querySelector(c.KI))||void 0===d?void 0:d.value:y=null===(v=document.querySelector('form select[class="shp_form"]'))||void 0===v?void 0:v.value;var _=null;_&&clearTimeout(_),_=setTimeout((()=>{if(p(t,!0,s),"product"===r){var o,c=u.find((t=>t.id==f)),a=null!==(o=null==c?void 0:c.price)&&void 0!==o?o:"",d={content_type:l&&l.length>1?"product_group":"product",content_name:i,quantity:1,price:parseInt(a)/100,currency:e,value:parseInt(a)/100};h("ViewContent",s,{contents:[E({content_id:y||l[0].toString()},d)],product_ids:[E({content_id:n},d)],currency:e,value:parseInt(a)/100})}}),1e3)},v=()=>{var t=!1;if(document.querySelectorAll(c.KI+", form select.shp_form").length>0){t=!0;var e=(c.KI+", form select.shp_form").split(",").find((t=>document.querySelector(t)));if(e){var r=document.querySelector(e);null==r||r.addEventListener("change",(()=>{d()}),!0)}}if(document.querySelectorAll(c.DV).length>0){var n=document.querySelectorAll(c.DV),o=function(t){setTimeout((()=>{t.addEventListener("change",(()=>{d()}))}),50)};for(var i of n)o(i)}t||(t=!0,setTimeout((()=>{v()}),2e3))};v()};function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function A(t){for(var e=1;e{var e,r,n,{eventSearchIdTikTok:o,eventViewContentIdTikTok:i}=(0,d.Q)(),u=parseInt(null===(e=document.querySelector(c.KI))||void 0===e?void 0:e.value),{currency:a,template_id:p,product_id:v,product_title:s,variants:f,variants_info:y}=c.YY,_=f?f.split(",").map(Number).filter((t=>0!==t)):[],m="";document.querySelectorAll(c.KI).length>0?m=null===(r=document.querySelector(c.KI))||void 0===r?void 0:r.value:m=null===(n=document.querySelector('form select[class="shp_form"]'))||void 0===n?void 0:n.value;if("search"===p){var b=new URL(window.location.href).searchParams.get("q");h("Search",o,{query:null!=b?b:""}),l(t,"Search",{query:b},o)}if("product"===p){var g,O=y.find((t=>t.id==u)),w=null!==(g=null==O?void 0:O.price)&&void 0!==g?g:"",S={content_type:_&&_.length>1?"product_group":"product",content_name:s,quantity:1,price:parseInt(w)/100||0,currency:a,value:parseInt(w)/100||0};h("ViewContent",i,{contents:[A({content_id:m||_[0].toString()},S)],product_ids:[A({content_id:v},S)],currency:a,value:parseInt(w)/100})}};function K(t,e,r,n,o,i,c){try{var u=t[i](c),a=u.value}catch(t){return void r(t)}u.done?e(a):Promise.resolve(a).then(n,o)}function N(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function c(t){K(i,n,o,c,u,"next",t)}function u(t){K(i,n,o,c,u,"throw",t)}c(void 0)}))}}function L(t){var{template_id:e}=n.YY,r=!0,c=function(){var n=N((function*(){var n;r&&(t.forEach((t=>{var e;t.events=(0,o.Sf)(t.events),null===(e=window.ttq)||void 0===e||e.load(t.pixel_id)})),null===(n=window.ttq)||void 0===n||n.page(),"product"==e&&p(t),O(t),I(t),D(t),"thank-you"==e&&S(t),C(t),r=!1)}));return function(){return n.apply(this,arguments)}}(),u=function(){var t=N((function*(){try{yield(0,i.O4)().then((()=>{c()})).catch((t=>{c()}))}catch(t){}}));return function(){return t.apply(this,arguments)}}();u()}}}]);