(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[4],{241:function(t,e,o){"use strict";var i=o(4),a=o.n(i),n=(o(8),o(50)),s=o(14),r=o(44),l=o(45),c=o(46),d=o(242),p=o(243),h=o(244),u=o(65),m=o.n(u),f=o(73),g=o.n(f),I=o(71),C=o.n(I),b=o(43),v=o.n(b),y=o(26),w=o.n(y);s.b.add(r.faHeart);class T extends a.a.Component{constructor(t){super(t)}render(){const{classes:t}=this.props;let e,o,i,a,s="0.9",u=!1,f="14px";this.props.buttonFontSize&&(f=this.props.buttonFontSize),this.props.heartStateToggle&&(u=this.props.heartStateToggle);let I,b="";this.props.buttonClasses&&this.props.buttonClasses.forEach((function(t){b+=" "+t})),I=this.props.iconSelected==v.a.HEART?!this.props.existingInWishlist&&u?d.faHeart:r.faHeart:this.props.iconSelected==v.a.STAR?!this.props.existingInWishlist&&u?p.faStar:l.faStar:this.props.iconSelected==v.a.BOOKMARK?!this.props.existingInWishlist&&u?h.faBookmark:c.faBookmark:!this.props.existingInWishlist&&u?d.faHeart:r.faHeart;let y=WHReact.createElement(n.a,{icon:I,size:"1x",color:null!=this.props.storeConfig&&null!=this.props.storeConfig&&void 0!==this.props.storeConfig.Ico_Color&&this.props.storeConfig.Ico_Color?this.props.storeConfig.Ico_Color:"#fff"}),T=this.props.backgroundColor;this.props.buttonView==w.a.COLLECTION&&null!=this.props.storeConfig&&null!=this.props.storeConfig&&null!=this.props.storeConfig.CollectionViewIconColor&&""!=this.props.storeConfig.CollectionViewIconColor&&null!=this.props.storeConfig.CollectionViewIconColor&&!this.props.existingInWishlist&&u&&(T=this.props.storeConfig.CollectionViewIconColor),this.props.buttonView!=w.a.COLLECTION||null==this.props.storeConfig||null==this.props.storeConfig||null==this.props.storeConfig.CollectionViewAddedToWishlistIconColor||""==this.props.storeConfig.CollectionViewAddedToWishlistIconColor||null==this.props.storeConfig.CollectionViewAddedToWishlistIconColor||!this.props.existingInWishlist&&u||(T=this.props.storeConfig.CollectionViewAddedToWishlistIconColor);let x=WHReact.createElement(n.a,{icon:I,size:"1x",color:T});a=this.props.animationAfterAddition==g.a.shake_side_to_side?C.a.shakehorizontal:this.props.animationAfterAddition==g.a.shake_up_and_down?C.a.shakevertical:this.props.animationAfterAddition==g.a.flip_and_rotate?C.a.rotatecenter:this.props.animationAfterAddition==g.a.fade_in?C.a.fadein:this.props.animationAfterAddition==g.a.blink?C.a.blink:"",this.props.existingInWishlist&&(s="0.65",b+=" wishlisthero-product-in-wishlist"),e=null!==this.props.position&&null!=this.props.position?this.props.position:"relative",o=null!==this.props.top&&null!=this.props.top?this.props.top:"",i=null!==this.props.right&&null!=this.props.right?this.props.right:"";let k="center";null!=this.props.contentAlign&&null!=this.props.contentAlign&&(k=this.props.contentAlign);let L="20";null!=this.props.horizontalPadding&&null!=this.props.horizontalPadding&&""!==this.props.horizontalPadding&&(L=this.props.horizontalPadding);let S=0;null!=this.props.buttonTopMargin&&null!=this.props.buttonTopMargin&&""!==this.props.buttonTopMargin&&(S=this.props.buttonTopMargin);let E=0;null!=this.props.buttonBottomMargin&&null!=this.props.buttonBottomMargin&&""!==this.props.buttonBottomMargin&&(E=this.props.buttonBottomMargin);let _,N=40;if(null!=this.props.buttonHeight&&null!=this.props.buttonHeight&&""!==this.props.buttonHeight&&(N=this.props.buttonHeight),this.props.buttonType==m.a.button_with_icon)_=WHReact.createElement("button",{"aria-label":this.props.buttonText,style:{backgroundColor:this.props.backgroundColor,marginLeft:"0",opacity:s,color:this.props.buttonTextColor?this.props.buttonTextColor:"#fff",margin:S+"px 0 "+E+"px 0 ",border:"none",lineHeight:"normal",height:N+"px",display:"block",padding:"0 "+L+"px",fontSize:f,textAlign:k,overflow:"hidden",outline:"none",position:e,cursor:"pointer",top:o,right:i},className:a+b,onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.onClick||this.props.onClick())},WHReact.createElement("span",null,y,"   ",this.props.buttonText," "));else if(this.props.buttonType==m.a.button_only)_=WHReact.createElement("button",{"aria-label":this.props.buttonText,style:{backgroundColor:this.props.backgroundColor,marginLeft:"0",opacity:s,color:this.props.buttonTextColor,margin:S+"px 0 "+E+"px 0 ",border:"none",lineHeight:"normal",height:N+"px",display:"block",padding:"0 "+L+"px",fontSize:f,textAlign:k,overflow:"hidden",outline:"none",position:e,cursor:"pointer",top:o,right:i},className:a+b,onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.onClick||this.props.onClick())},WHReact.createElement("span",null," ",this.props.buttonText," "));else if(this.props.buttonType==m.a.text_only)_=WHReact.createElement("button",{"aria-label":this.props.buttonText,style:{color:this.props.backgroundColor,background:"none",marginLeft:"0",opacity:s,margin:S+"px 0 "+E+"px 0 ",border:"none",lineHeight:"normal",height:N+"px",display:"block",padding:"0 "+L+"px",fontSize:f,textAlign:k,overflow:"hidden",outline:"none",position:e,cursor:"pointer",top:o,right:i},className:a+b,onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.onClick||this.props.onClick())},WHReact.createElement("span",null," ",this.props.buttonText," "));else if(this.props.buttonType==m.a.icon_only){let t="none";null!=this.props.storeConfig&&null!=this.props.storeConfig&&this.props.buttonView==w.a.COLLECTION&&(null!=this.props.storeConfig.CollectionViewIconBackgroundColor&&""!=this.props.storeConfig.CollectionViewIconBackgroundColor&&!this.props.existingInWishlist&&u&&(t=this.props.storeConfig.CollectionViewIconBackgroundColor),null==this.props.storeConfig.CollectionViewAddedToWishlistIconBackgroundColor||""==this.props.storeConfig.CollectionViewAddedToWishlistIconBackgroundColor||!this.props.existingInWishlist&&u||(t=this.props.storeConfig.CollectionViewAddedToWishlistIconBackgroundColor));(new Date).getTime();_=WHReact.createElement("div",null,WHReact.createElement("button",{"aria-label":this.props.buttonText,title:this.props.buttonText,style:{color:this.props.backgroundColor,background:t,borderRadius:"100%",marginLeft:"0",opacity:s,margin:S+"px 0 "+E+"px 0 ",border:"none",lineHeight:"normal",height:N+"px",display:"block",padding:"0 "+L+"px",fontSize:f,textAlign:k,overflow:"hidden",outline:"none",position:e,cursor:"pointer",top:o,right:i},className:a+b,onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.onClick||this.props.onClick())},x))}else this.props.buttonType==m.a.text_with_icon&&(_=WHReact.createElement("button",{"aria-label":this.props.buttonText,style:{color:this.props.backgroundColor,background:"none",marginLeft:"0",opacity:s,margin:S+"px 0 "+E+"px 0 ",border:"none",lineHeight:"normal",height:N+"px",display:"block",padding:"0 "+L+"px",fontSize:f,textAlign:k,overflow:"hidden",outline:"none",position:e,cursor:"pointer",top:o,right:i},className:a+b,onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.onClick||this.props.onClick())},WHReact.createElement("span",null,x,"   ",this.props.buttonText," ")));return _}}e.a=T},242:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=[],a="M458.4 64.3C400.6 15.7 311.3 23 256 79.3 200.7 23 111.4 15.6 53.6 64.3-21.6 127.6-10.6 230.8 43 285.5l175.4 178.7c10 10.2 23.4 15.9 37.6 15.9 14.3 0 27.6-5.6 37.6-15.8L469 285.6c53.5-54.7 64.7-157.9-10.6-221.3zm-23.6 187.5L259.4 430.5c-2.4 2.4-4.4 2.4-6.8 0L77.2 251.8c-36.5-37.2-43.9-107.6 7.3-150.7 38.9-32.7 98.9-27.8 136.5 10.5l35 35.7 35-35.7c37.8-38.5 97.8-43.2 136.5-10.6 51.1 43.1 43.5 113.9 7.3 150.8z";e.definition={prefix:"far",iconName:"heart",icon:[512,512,i,"f004",a]},e.faHeart=e.definition,e.prefix="far",e.iconName="heart",e.width=512,e.height=512,e.ligatures=i,e.unicode="f004",e.svgPathData=a},243:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=[],a="M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM388.6 312.3l23.7 138.4L288 385.4l-124.3 65.3 23.7-138.4-100.6-98 139-20.2 62.2-126 62.2 126 139 20.2-100.6 98z";e.definition={prefix:"far",iconName:"star",icon:[576,512,i,"f005",a]},e.faStar=e.definition,e.prefix="far",e.iconName="star",e.width=576,e.height=512,e.ligatures=i,e.unicode="f005",e.svgPathData=a},244:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=[],a="M336 0H48C21.49 0 0 21.49 0 48v464l192-112 192 112V48c0-26.51-21.49-48-48-48zm0 428.43l-144-84-144 84V54a6 6 0 0 1 6-6h276c3.314 0 6 2.683 6 5.996V428.43z";e.definition={prefix:"far",iconName:"bookmark",icon:[384,512,i,"f02e",a]},e.faBookmark=e.definition,e.prefix="far",e.iconName="bookmark",e.width=384,e.height=512,e.ligatures=i,e.unicode="f02e",e.svgPathData=a},245:function(t,e,o){"use strict";var i=o(4),a=o.n(i),n=o(434),s=o(375),r=o(141),l=o.n(r),c=o(378),d=o(49),p=o(246),h=o(247),u=o(249),m=o(250),f=o(0);class g extends a.a.Component{render(){if(!document.querySelector("style#wishlist-hero-notification-style")){var t=" #wishlist-hero-add-notification .MuiSnackbarContent-message{padding: 0px !important; width:100%;} #wishlist-hero-add-notification .MuiCardContent-root{padding-bottom: 0px !important;display: flex;align-items: center;} #snackbarWishlistHeroNotification .MuiSnackbarContent-root{display: block;}",e=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.id="wishlist-hero-notification-style",e.appendChild(o),o.type="text/css",o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}const{classes:i}=this.props;let a="";this.props.removePowerBy||(a=WHReact.createElement("div",null,WHReact.createElement("text",{style:{float:"right",fontSize:"xx-small",paddingTop:"10px",color:"#999"},className:"wishlist-hero-dyna-translate"},"Powered By"," ",WHReact.createElement("a",{href:this.props.appLink,target:"_blank"},"Wishlist Hero"))));let r,d=this.props.productImage;try{d&&null!=d&&void 0!==d&&0!=d.indexOf("http")&&(d="https:"+d)}catch(t){}return r=WHReact.createElement(n.a,{className:"wishlist-hero-add-prod-to-wishlist-notification",id:"wishlist-hero-add-prod-to-wishlist-notification",anchorOrigin:{vertical:"bottom",horizontal:this.props.possition?this.props.possition:"right"},open:this.props.openSnackbar&&!this.props.disabled,autoHideDuration:4e3,onClose:t=>!this.props.handleNotificationSnackbarClose||this.props.handleNotificationSnackbarClose(),ContentProps:{"aria-describedby":"message-id"}},WHReact.createElement(s.a,{style:{padding:"0px"},id:"wishlist-hero-add-notification",className:i.snackbarContentWishListHero,message:WHReact.createElement(p.a,{className:i.root},WHReact.createElement(h.a,{className:i.cardHeaderModified,style:{backgroundColor:this.props.backgroundColor},action:WHReact.createElement(c.a,{key:"close","aria-label":"close",color:"inherit",onClick:t=>(t.preventDefault(),t.stopPropagation(),!this.props.handleNotificationSnackbarClose||this.props.handleNotificationSnackbarClose()),className:i.close},WHReact.createElement(l.a,null)),title:WHReact.createElement("span",{className:i.spanFont+" wishlist-hero-dyna-translate"},this.props.headerText||"Product successfully added to your wishlist")}),WHReact.createElement(u.a,{className:" "+(null!=typeof window&&window.wishlisthero_AddedItemProductNameLinkContainerClass?window.wishlisthero_AddedItemProductNameLinkContainerClass:"")},WHReact.createElement("div",{className:i.cardImage,style:{backgroundImage:"url('"+d+"')",backgroundPosition:"center",backgroundSize:"contain",backgroundRepeat:"no-repeat"}}),WHReact.createElement("a",{xs:8,href:this.props.productLink,className:`${i.productName} wishlist-hero-dyna-translate ${null!=typeof window&&window.wishlisthero_AddedItemProductNameLinkClass?window.wishlisthero_AddedItemProductNameLinkClass:""}`},this.props.productName)),WHReact.createElement(m.a,{disableSpacing:!0},a,WHReact.createElement("a",{className:i.goToWishlist+" wishlist-hero-dyna-translate",onClick:t=>(document.dispatchEvent(new Event(f.default.EVENTS_WISHTLIST_SHOW)),!1)},this.props.viewWishlistText||"View your Wishlist")))})),r}}e.a=Object(d.a)(t=>({root:{maxWidth:300,maxHeight:140,width:"100%"},close:{padding:t.spacing(.5),paddingTop:"10px"},cardHeaderModified:{fontSize:"12px",color:"white",padding:"0px",paddingRight:"8px",paddingLeft:"8px"},goToWishlist:{fontSize:"12px",textDecorationLine:"underline",marginLeft:"auto"},powerByLink:{fontSize:"12px"},spanFont:{fontSize:"12px",display:"inline-block",verticalAlign:"middle",lineHeight:"1.4em",color:"white",fontWeight:"normal"},cardImage:{flex:1,maxWidth:55,maxHeight:50,width:55,height:55,display:"block"},snackbarContentWishListHero:{maxWidth:300,maxHeight:140,padding:"0px"},productName:{paddingLeft:"5px"}}))(g)},246:function(t,e,o){"use strict";var i=o(1),a=o(5),n=o(4),s=o(40),r=o(376),l=o(49),c=n.forwardRef((function(t,e){var o=t.classes,l=t.className,c=t.raised,d=void 0!==c&&c,p=Object(a.a)(t,["classes","className","raised"]);return n.createElement(r.a,Object(i.a)({className:Object(s.a)(o.root,l),elevation:d?8:1,ref:e},p))}));e.a=Object(l.a)({root:{overflow:"hidden"}},{name:"MuiCard"})(c)},247:function(t,e,o){"use strict";var i=o(1),a=o(5),n=o(4),s=o(40),r=o(49),l=o(377),c=n.forwardRef((function(t,e){var o=t.action,r=t.avatar,c=t.classes,d=t.className,p=t.component,h=void 0===p?"div":p,u=t.disableTypography,m=void 0!==u&&u,f=t.subheader,g=t.subheaderTypographyProps,I=t.title,C=t.titleTypographyProps,b=Object(a.a)(t,["action","avatar","classes","className","component","disableTypography","subheader","subheaderTypographyProps","title","titleTypographyProps"]),v=I;null==v||v.type===l.a||m||(v=n.createElement(l.a,Object(i.a)({variant:r?"body2":"h5",className:c.title,component:"span",display:"block"},C),v));var y=f;return null==y||y.type===l.a||m||(y=n.createElement(l.a,Object(i.a)({variant:r?"body2":"body1",className:c.subheader,color:"textSecondary",component:"span",display:"block"},g),y)),n.createElement(h,Object(i.a)({className:Object(s.a)(c.root,d),ref:e},b),r&&n.createElement("div",{className:c.avatar},r),n.createElement("div",{className:c.content},v,y),o&&n.createElement("div",{className:c.action},o))}));e.a=Object(r.a)({root:{display:"flex",alignItems:"center",padding:16},avatar:{flex:"0 0 auto",marginRight:16},action:{flex:"0 0 auto",alignSelf:"flex-start",marginTop:-8,marginRight:-8},content:{flex:"1 1 auto"},title:{},subheader:{}},{name:"MuiCardHeader"})(c)},249:function(t,e,o){"use strict";var i=o(1),a=o(5),n=o(4),s=o(40),r=o(49),l=n.forwardRef((function(t,e){var o=t.classes,r=t.className,l=t.component,c=void 0===l?"div":l,d=Object(a.a)(t,["classes","className","component"]);return n.createElement(c,Object(i.a)({className:Object(s.a)(o.root,r),ref:e},d))}));e.a=Object(r.a)({root:{padding:16,"&:last-child":{paddingBottom:24}}},{name:"MuiCardContent"})(l)},250:function(t,e,o){"use strict";var i=o(1),a=o(5),n=o(4),s=o(40),r=o(49),l=n.forwardRef((function(t,e){var o=t.disableSpacing,r=void 0!==o&&o,l=t.classes,c=t.className,d=Object(a.a)(t,["disableSpacing","classes","className"]);return n.createElement("div",Object(i.a)({className:Object(s.a)(l.root,c,!r&&l.spacing),ref:e},d))}));e.a=Object(r.a)({root:{display:"flex",alignItems:"center",padding:8},spacing:{"& > :not(:first-child)":{marginLeft:8}}},{name:"MuiCardActions"})(l)},373:function(t,e,o){"use strict";o.r(e),function(t){var i=o(51),a=o(4),n=o.n(a),s=o(379),r=o(241),l=o(245),c=o(6),d=o(2),p=o(11),h=o.n(p),u=o(0),m=o(434),f=o(378),g=o(141),I=o.n(g),C=o(19);class b extends n.a.Component{constructor(t){super(t),this.handleAddToWishList=this.handleAddToWishList.bind(this),this.handleRemoveFromWishList=this.handleRemoveFromWishList.bind(this),this.handleCloseRemove=this.handleCloseRemove.bind(this),this.state={appConfig:t.appConfig,storeConfig:t.storeConfig,existingforCustomer:!1,animationAfterAddition:"",customerId:t.customerId,wishListHash:t.wishListHash,productInfo:t.productInfo,variantListenerType:t.variantListenerType,buttonReady:!1,addingItem:!1,removingItem:!1,openNotification:!1,showRemovedSnackBar:!1,buttonTxtInList:t.buttonTextInList,buttonTxtRemoveFromList:t.buttonTextRemoveFromList,buttonTxtNotInList:t.buttonTextNotInList};let e=this;t.wishListHash||(this.state.buttonReady=!0),this.state.variantListenerType==u.default.VARIANT_LISTENER_PRODUCT_PAGE&&c.a.ListenForProductVariantChangeInPage(()=>{var t=e.state.productInfo,o=c.a.loadProductInfoFromPage();e.setState({productInfo:o}),JSON.stringify(t)!=JSON.stringify(o)&&e._checkItemExistanceInWishtList(e.state.appConfig.STOREFRONT_API_BASE_URL,e.state.storeConfig.shop,e.state.wishListHash,e.state.productInfo.variantId,e.state.productInfo.handle)}),this.state.variantListenerType==u.default.VARIANT_LISTENER_SCA_QUICKVIEW&&c.a.ListenForSCAVariantChangeInPage(()=>{e.setState({productInfo:Object.assign({},e.state.productInfo,c.a.loadProductInfoFromSCA())}),e._checkItemExistanceInWishtList(e.state.appConfig.STOREFRONT_API_BASE_URL,e.state.storeConfig.shop,e.state.wishListHash,e.state.productInfo.variantId,e.state.productInfo.handle)}),document.addEventListener(u.default.EVENTS_WISHTLIST_UPDATED,(function(t){t.detail&&t.detail.removed&&t.detail.removed==e.state.productInfo.variantId&&e.setState({existingforCustomer:!1,animationAfterAddition:""})}))}async handleTranslation(t){return await Weglot.translate({words:[{t:1,w:t}],languageTo:Weglot.getCurrentLang()}).then(t=>t[0]).catch(t=>console.log(t))}weglotTranslation(){let t=this;Promise.all([t.handleTranslation(t.state.buttonTxtInList),t.handleTranslation(t.state.buttonTxtRemoveFromList),t.handleTranslation(t.state.buttonTxtNotInList)]).then(e=>{t.setState({buttonTxtInList:e[0],buttonTxtRemoveFromList:e[1],buttonTxtNotInList:e[2]})})}componentDidMount(){let t=this;this.state.wishListHash&&this._checkItemExistanceInWishtList(this.state.appConfig.STOREFRONT_API_BASE_URL,this.state.storeConfig.shop,this.state.wishListHash,this.state.productInfo.variantId,t.state.productInfo.handle),"undefined"==typeof window||void 0===window.Weglot||window.WH_DisableWeglot||(t.weglotTranslation(),Weglot.on("languageChanged",(function(e,o){t.weglotTranslation()})))}async _checkItemExistanceInWishtList(t,e,o,i,a){try{var n=!i&&a;let r=(await h.a.get(t+"/store/"+e+"/wishlist/"+o+(n?"/has-handle/"+a:"/has/"+i))).data;var s={existingforCustomer:r.exists,buttonReady:!0,animationAfterAddition:""};n&&!this.state.productInfo.variantId&&r.variantId&&(s.productInfo={...this.state.productInfo,variantId:r.variantId}),this.setState(s)}catch(t){console.error(t),this.setState({existingforCustomer:!1,buttonReady:!0})}}_addItemToLocalWishList(t,e){e&&d.a.addWishListItem(e),t&&d.a.setWishListHash(t)}handleNotificationSnackbarClose(){this.setState({openNotification:!1})}handleCloseRemove(){this.setState({showRemovedSnackBar:!1})}handleAddToWishList(){if(!this.state.storeConfig.DisableGuestCustomer||null!=this.state.customerId&&null!=this.state.customerId&&""!=this.state.customerId){if(this.state.addingItem||this.state.removingItem)return!1;this.setState({addingItem:!0});let t=this;this.state.variantListenerType==u.default.VARIANT_LISTENER_PRODUCT_PAGE&&this.setState({productInfo:c.a.loadProductInfoFromPage()}),new Promise((e,o)=>{t.state.wishListHash||d.a.getWishListHash()?d.a.getWishListHash()?e({Hash:d.a.getWishListHash()}):e({Hash:t.state.wishListHash}):C.a.CreateWishlistForCustomer(t.state.storeConfig,t.state.appConfig,t.state.customerId).then((function(t){e(t)})).catch((function(t){o(t)}))}).then((async function(e){var o={...t.state.productInfo};let i=null;if((t.state.storeConfig.EnableKlaviyoOnsiteTracking||t.state.storeConfig.EnableGTagIntegration||t.state.storeConfig.EnableTikTokPixelIntegration)&&!o.vendor){var a=o.link.substr(o.link.lastIndexOf("/")+1);a.lastIndexOf("?")>0&&(a=a.substr(0,a.lastIndexOf("?"))),i=a}if(!o.id&&o.handle||i)try{var n="https://"+(window.location&&window.location.host?window.location.host:window.Shopify.shop)+window.Shopify.routes.root,s=await C.a.loadProductFromStore(n+"products/"+(o.handle?o.handle:i)+".json"+(o.variantId?"?variant="+o.variantId:""));let e=(await s.json()).product;var r=null;o.variantId?e.variants.forEach((function(t){t.id==e.variantId&&(r=t)})):r=e.variants[0],r||(r=e.variants[0]);var l=e.featured_image?e.featured_image:null;!l&&e.images.length>0&&(l=e.images[0]),r.featured_image&&(l=r.featured_image),o.id=e.id,o.link=n+"products/"+e.handle+(r.id?"?variant="+r.id:""),o.variantId=r.id,o.price=r.price,o.image=l.src,o.name=e.title,o.tags=e.tags,o.vendor=e.vendor,o.sku=r.sku,o.product_type=e.product_type,t.setState({productInfo:o})}catch(t){console.error(t)}return{wishlist:e,loadedProductInfo:o}})).then((async function({wishlist:e,loadedProductInfo:o}){let i=e.Hash,a=c.a.getStoreCurrencyRate(),n=c.a.getStoreCurrency(),s=o.price,r=o.price;if("1.0"!==a){var l=o.link;if(l&&l.indexOf("?")>0){var d=l.split("?");l=d[0]+".js?"+d[1]}else l+=".js";var p=null;try{p=await C.a.loadProductFromStore(l,!1,!0)}catch(t){console.error(t)}if(p&&p.redirected)r=Math.round(s/a);else try{r=(await p.json()).price/100}catch(t){console.error(t),r=Math.round(s/a)}}if(i){let e={customerId:t.state.customerId,productId:o.id,productName:o.name,productPrice:r,DisplayPrice:s,DisplayCurrency:n,productLink:o.link,productVariantId:o.variantId,productImage:o.image,productHandle:o.handle};console.log(o);let a={productTags:o.tags?Array.isArray(o.tags)?o.tags:[o.tags]:[],productVendor:o.vendor,productSKU:o.sku,productType:o.product_type};return h.a.post(t.state.appConfig.STOREFRONT_API_BASE_URL+"/store/"+t.state.storeConfig.shop+"/wishlist/"+i,e).then((function(t){return!(!t.data.ok||t.data.error)&&{hash:i,item:e,extraItemInfo:a,added:t.data.added}})).catch((function(t){return console.error(t),!1}))}})).then((function(e){if(null!=e){if(t.setState({existingforCustomer:!0,animationAfterAddition:t.state.storeConfig.AnimationAfterAddition,wishListHash:e.hash,openNotification:!0}),t._addItemToLocalWishList(e.hash,e.item),t.state.appConfig.VIBRATION_AFTER_ADDITION)try{window.navigator.vibrate(200),window.navigator.webkit}catch(t){}var o=c.a.getCurrentProductCategory();if(!o&&e.extraItemInfo&&e.extraItemInfo.productType&&(o=e.extraItemInfo.productType),t.state.storeConfig.EnableFBPixel&&"undefined"!=typeof window&&void 0!==window.fbq){var i={content_name:e.item.productName,content_category:o,content_ids:[e.item.productId],contents:[{id:e.item.productId,quantity:1}],currency:c.a.getStoreCurrency(),value:e.item.productPrice,content_type:"product"};fbq("track","AddToWishlist",i)}if(t.state.storeConfig.EnableKlaviyoOnsiteTracking&&"undefined"!=typeof window&&void 0!==window.klaviyo){var a=d.a.getWishListItems().map((t,e)=>t.productId?Number(t.productId):Number(t.ProductId)).filter(t=>!!t);a=a||[],a=Array.isArray(a)?a:string.split(",",a);var n=c.a.getCurrentStoreLink(),s={Vendor:e.extraItemInfo.productVendor,CurrencyCode:e.item.DisplayCurrency?e.item.DisplayCurrency:c.a.getStoreCurrency(),ImageURL:(e.item.productImage.indexOf("https:")<0?"https:":"")+e.item.productImage,Name:e.item.productName,Price:e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice,PriceFormatted:c.a.FormatAsCurrency(e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice),ProductID:e.item.productId,VariantID:e.item.productVariantId,Quantity:1,SKU:e.extraItemInfo.productSKU,Tags:e.extraItemInfo.productTags,URL:e.item.productLink.indexOf("https:")<0?n+e.item.productLink:e.item.productLink,WishlistProductIDs:a||[],WishlistUrl:n+t.state.appConfig.WISHLIST_LINK};o&&(s.CategoryViewed=o),klaviyo.track("Added To Wishlist (WH)",s),klaviyo.identify({MyWishlistProductIDs:a||[],MyWishlistLink:c.a.getCurrentStoreLink()+t.state.appConfig.WISHLIST_LINK})}if(t.state.storeConfig.EnableGTagIntegration&&"undefined"!=typeof window&&void 0!==window.gtag){let t={currency:e.item.DisplayCurrency?e.item.DisplayCurrency:c.a.getStoreCurrency(),value:Number(e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice),items:[{item_id:e.item.productId,item_name:e.item.productName,index:0,item_brand:e.extraItemInfo.productVendor,item_category:o,item_variant:e.item.productVariantId,price:Number(e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice),quantity:1}]};gtag("event","add_to_wishlist",t)}if(t.state.storeConfig.EnableTikTokPixelIntegration&&"undefined"!=typeof window&&void 0!==window.ttq)try{let t={content_type:"product",currency:e.item.DisplayCurrency?e.item.DisplayCurrency:c.a.getStoreCurrency(),value:Number(e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice),contents:[{content_id:e.item.productId,content_name:e.item.productName,content_brand:e.extraItemInfo.productVendor,content_category:o,content_variant_id:e.item.productVariantId,price:Number(e.item.DisplayPrice?e.item.DisplayPrice:e.item.productPrice),quantity:1}]};ttq.track("AddToWishlist",t)}catch(t){console.warn("[WH] TikTok Pixel Integration Error ..",t)}}})).catch((function(t){console.trace(t)})).finally(()=>{this.setState({addingItem:!1});let t=new Event(u.default.EVENTS_WISHTLIST_UPDATED);document.dispatchEvent(t)})}else{var t=new Event(u.default.EVENTS_LOGIN_OPEN_POPUP);document.dispatchEvent(t)}}handleRemoveFromWishList(){let t=this;if(!this.state.storeConfig.DisableGuestCustomer||null!=this.state.customerId&&null!=this.state.customerId&&""!=this.state.customerId){if(this.state.removingItem||this.state.addingItem)return!1;this.setState({removingItem:!0}),h.a.post(t.state.appConfig.STOREFRONT_API_BASE_URL+"/store/"+t.state.storeConfig.shop+"/wishlist/"+t.state.wishListHash+"/delete/"+t.state.productInfo.variantId).then((function(e){if(t.setState({showRemovedSnackBar:!0}),e.data.deleted){if(d.a.removeWishListItem(t.state.productInfo.variantId),t.state.storeConfig.EnableKlaviyoOnsiteTracking&&"undefined"!=typeof window&&void 0!==window.klaviyo){var o=d.a.getWishListItems().map((t,e)=>t.productId?Number(t.productId):Number(t.ProductId)).filter(t=>!!t);o=o||[],o=Array.isArray(o)?o:string.split(",",o);var i=t.state.productInfo.link;if(i&&i.indexOf("?")>0){var a=i.split("?");i=a[0]+".js?"+a[1]}else i+=".js";C.a.loadProductFromStore(i,t.state.storeConfig.shop).then((async function(e){var i={vendor:null,sku:null,tags:null},a=null,n=null;if(200==e.status){i=await e.json();var s=0;i.variants&&i.variants.forEach((function(e,o){e.id==t.state.productInfo.variantId&&(s=o)})),i.variants[s].featured_image?a=i.variants[s].featured_image.src:i.featured_image?a=i.featured_image:i.images.length>0&&(a=i.images[0]),n=i.variants[s].price?i.variants[s].price:i.price;var r=c.a.getCurrentStoreLink(),l={Vendor:i.vendor,CurrencyCode:c.a.getStoreCurrency(),ImageURL:a,Name:t.state.productInfo.name,Price:n,PriceFormatted:c.a.FormatAsCurrency(n),ProductID:Number(t.state.productInfo.id),VariantID:Number(t.state.productInfo.variantId),Quantity:1,SKU:i.variants[s].sku,Tags:i.tags,URL:t.state.productInfo.link.indexOf("https:")<0?r+t.state.productInfo.link:t.state.productInfo.link,WishlistProductIDs:o||[],WishlistUrl:c.a.getCurrentStoreLink()+t.state.appConfig.WISHLIST_LINK};klaviyo.track("Removed From Wishlist (WH)",l),klaviyo.identify({MyWishlistProductIDs:o||[],MyWishlistLink:c.a.getCurrentStoreLink()+t.state.appConfig.WISHLIST_LINK})}}))}return t.state.productInfo.variantId}return null})).then((function(t){t&&document.dispatchEvent(new CustomEvent(u.default.EVENTS_WISHTLIST_UPDATED,{detail:{removed:t}}))})).catch((function(t){console.log("error when try to DELETE wishlistITEMS from DB"),console.log(t)})).finally((function(){let e=new Event(u.default.EVENTS_WISHTLIST_UPDATED);document.dispatchEvent(e),t.setState({removingItem:!1})}))}else{var e=new Event(u.default.EVENTS_LOGIN_OPEN_POPUP);document.dispatchEvent(e)}}render(){const{buttonType:t,buttonTextNotInList:e,buttonTextInList:o,iconColor:i,selectedIcons:c,backgroundColor:d,heartStateToggle:p,NotificationPopupPosition:h,disabled:u,WishlistButtonTextColor:g,EnableRemoveFromWishlistAfterAdd:C,buttonTextRemoveFromList:b}=this.props;var v=Object(a.createRef)();let y=this.state.buttonTxtNotInList||e;return this.state.existingforCustomer&&C?y=this.state.buttonTxtRemoveFromList||b:this.state.existingforCustomer&&(y=this.state.buttonTxtInList||o),WHReact.createElement(n.a.Fragment,null,WHReact.createElement(r.a,{buttonType:t,buttonView:this.props.buttonView,buttonText:y,buttonClasses:this.props.buttonClasses,buttonFontSize:this.props.buttonFontSize,contentAlign:this.props.contentAlign,horizontalPadding:this.props.horizontalPadding,buttonTopMargin:this.props.buttonTopMargin,buttonBottomMargin:this.props.buttonBottomMargin,buttonHeight:this.props.buttonHeight,buttonTextColor:g,existingInWishlist:this.state.existingforCustomer||this.state.addingItem,animationAfterAddition:this.state.animationAfterAddition,heartStateToggle:p,iconColor:i,backgroundColor:d,storeConfig:this.props.storeConfig,iconSelected:c,productId:this.state.productInfo.id,onClick:t=>(this.state.existingforCustomer?this.state.existingforCustomer&&C?this.handleRemoveFromWishList():console.log("Already exists .. "+this.state.existingforCustomer):this.handleAddToWishList(),!1)}),WHReact.createElement(s.a,{container:v.current},WHReact.createElement(l.a,{snackbarText:"Product added successfully to your wishlist",possition:h,disabled:u,customerId:this.state.customerId,productId:this.state.productInfo.id,productName:this.state.productInfo.name,productLink:this.state.productInfo.link,productImage:this.state.productInfo.image,backgroundColor:d,wishListHash:this.state.wishListHash,openSnackbar:this.state.openNotification,removePowerBy:this.state.storeConfig.RemovePowerBy,appLink:this.state.appConfig.APP_LINK,handleNotificationSnackbarClose:t=>{this.handleNotificationSnackbarClose()},headerText:this.state.storeConfig.AddedProductNotificationText,viewWishlistText:this.state.storeConfig.ViewWishlistText}),WHReact.createElement(m.a,{className:"wishlist-hero-removed-product-notification wishlist-hero-dyna-translate",anchorOrigin:{vertical:"bottom",horizontal:"center"},open:this.state.showRemovedSnackBar,autoHideDuration:3e3,onClose:t=>{this.handleCloseRemove()},ContentProps:{"aria-describedby":"message-id"},message:WHReact.createElement("span",{id:"message-id"},this.state.storeConfig.RemovedProductNotificationText||"Product successfully removed from wishlist"),action:[WHReact.createElement(f.a,{key:"close","aria-label":"close",color:"inherit",onClick:t=>{this.handleCloseRemove()}},WHReact.createElement(I.a,null))]})))}}e.default=Object(i.hot)(t)(b)}.call(this,o(72)(t))}}]);