"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5385],{ezJP:function(o,i,l){l.d(i,{O:function(){return CarouselAffiliate}});var e=l("BGKE"),n=l("q1tI"),t=l("DEkF"),d=l("iBNF"),a=l("NMBh"),r=l("qQsD"),c=l("Wgwc"),u=l.n(c),v=l("20a2"),s=l("dDsW"),p=l("/tR3"),h=l("oQBk"),g=l("xIXX"),m=l("CJtR"),f=l("rIrU"),b=l("xSvo"),w=l("Dr2f");let CarouselAffiliate=o=>{var i,l,c,Z,x,C,y,k,B,N,M,P,D,S,T,z,X,A,I,E,_,R,F,L,H,U,V;let{isMobile:W,injectAffiliate:G,openNewTab:O,noFollow:Q,sponsored:J}=o,[K,q]=(0,n.useState)([]),[j,$]=(0,n.useState)(0),{locale:Y="en-PH"}=(0,v.useRouter)(),{formatMessage:oo}=(0,s.Z)(),[oi,ol]=(0,n.useState)(!1),[oe,on]=(0,n.useState)(!0),[ot,od]=(0,n.useState)(-1),[oa,or]=(0,n.useState)(-1),isOverEndDate=o=>{if(!o)return!1;{let i=new Date;i.setHours(0,0,0,0);let l=u()(o,f.yJ).toDate();return l{var i;return null!=o&&!!o.promotion&&!isOverEndDate(null==o?void 0:null===(i=o.promotion)||void 0===i?void 0:i.end_date)},oc=null==G?void 0:null===(i=G.productId)||void 0===i?void 0:i.split(","),fetchProductDetail=async o=>{var i,l;let e=await (0,g.t9)((0,m.cN)(h.y.COMMON.GET_AFFILIATE_PRODUCT,{productId:o}),"get");if(null==e?void 0:null===(i=e.data)||void 0===i?void 0:i[0]){let o=(0,p.nx)(null==e?void 0:null===(l=e.data)||void 0===l?void 0:l[0],Y);return o}};(0,n.useEffect)(()=>{Promise.all(null==oc?void 0:oc.map(async o=>{let i=await fetchProductDetail(o);return i})).then(o=>q(o))},[]);let ou=(0,n.useRef)(null),ov=(0,n.useRef)(0);return(0,n.useEffect)(()=>{var o;let i=null===(o=ou.current)||void 0===o?void 0:o.previousElementSibling;for(;i;)"P"===i.tagName&&ov.current++,i=i.previousElementSibling;console.log("Number of
:",ov.current)},[ou.current]),(0,e.BX)(e.HY,{children:[!W&&(0,e.tZ)(w.gw,{ref:ou,children:(0,e.tZ)(w.Qr,{"data-is-collapse":oe,"data-is-carousel":!0,"data-is-shown-description":oi,"data-is-single-vendor":(null==K?void 0:null===(c=K[j])||void 0===c?void 0:null===(l=c.channel)||void 0===l?void 0:l.length)===1,children:null==K?void 0:null===(x=K[j])||void 0===x?void 0:null===(Z=x.channel)||void 0===Z?void 0:Z.map((o,i)=>{var l,r,c,u,v,s,p,h,g,m,f,Z,x,C,y,k,B,N,M,P,D,S;return(0,e.BX)(n.Fragment,{children:[(0,e.BX)(w.GF,{"data-event-category":"Affiliates","data-event-action":"Click Shop Now","data-product-position":"p".concat(ov.current),"data-product-ui":"Carousel","data-event-label":null==o?void 0:o.url,"data-product-channel":null==o?void 0:o.name,"data-product-sku":null==K?void 0:null===(l=K[j])||void 0===l?void 0:l.sku,"data-product-brand":null==K?void 0:null===(u=K[j])||void 0===u?void 0:null===(c=u.brand)||void 0===c?void 0:null===(r=c[0])||void 0===r?void 0:r.name,"data-product-name":null==K?void 0:null===(v=K[j])||void 0===v?void 0:v.postName,"data-product-price":null==o?void 0:o.price,className:"no-replace-url",href:null==o?void 0:o.url,...O?{target:"_blank"}:{},rel:"".concat(null==o?void 0:o.url," ").concat(Q?" nofollow":"").concat(J?" sponsored":""),children:[(0,e.BX)(w.pI,{className:"event",children:[(0,e.tZ)(w.$v,{src:null==o?void 0:o.icon,alt:"logo",className:"logo"}),(0,e.BX)("div",{children:[(0,e.tZ)(t.H,{tag:"h5",children:null==o?void 0:o.name}),(null==o?void 0:o.price)&&(0,e.tZ)(w.iN,{size:"p3",color:d.r.colors.green700,children:null==o?void 0:o.price})]})]}),(0,e.tZ)(w.Cv,{className:"event",children:oo({id:"affiliate.vendors.showNow",defaultMessage:"Shop Now"})})]}),hasPromotion(o)&&(0,e.tZ)(b.T,{vendor:o,shownDescription:o=>ol(o),isMobile:W,isCopied:oa===i,idxPromotion:i,setCopied:o=>or(o),dataProductChannel:null==K?void 0:null===(h=K[j])||void 0===h?void 0:null===(p=h.channel)||void 0===p?void 0:null===(s=p[0])||void 0===s?void 0:s.name,dataProductSku:null==K?void 0:null===(g=K[j])||void 0===g?void 0:g.sku,dataProductBrand:null==K?void 0:null===(Z=K[j])||void 0===Z?void 0:null===(f=Z.brand)||void 0===f?void 0:null===(m=f[0])||void 0===m?void 0:m.name,dataProductName:null==K?void 0:null===(x=K[j])||void 0===x?void 0:x.postName,dataProductPrice:(null==K?void 0:null===(C=K[j])||void 0===C?void 0:C.priceRange)?null==K?void 0:null===(y=K[j])||void 0===y?void 0:y.priceRange:null==K?void 0:null===(N=K[j])||void 0===N?void 0:null===(B=N.channel)||void 0===B?void 0:null===(k=B[0])||void 0===k?void 0:k.price,dataProductCategory:null==K?void 0:null===(D=K[j])||void 0===D?void 0:null===(P=D.productCat)||void 0===P?void 0:null===(M=P[0])||void 0===M?void 0:M.name}),i<(null==K?void 0:null===(S=K[j])||void 0===S?void 0:S.channel.length)-1?(0,e.tZ)(a.D,{type:"dashed"}):null]},i)})})}),!W&&hasPromotion(null==K?void 0:null===(y=K[j])||void 0===y?void 0:null===(C=y.channel)||void 0===C?void 0:C[0])&&(0,e.tZ)(w.go,{"data-is-hidden":(null==K?void 0:null===(B=K[j])||void 0===B?void 0:null===(k=B.channel)||void 0===k?void 0:k.length)!==1,children:(0,e.tZ)(b.T,{vendor:null==K?void 0:null===(M=K[j])||void 0===M?void 0:null===(N=M.channel)||void 0===N?void 0:N[0],shownDescription:o=>ol(o),isMobile:W,isCopied:0===oa,idxPromotion:0,setCopied:o=>or(o),isSingleVendor:!0,dataProductChannel:null==K?void 0:null===(S=K[j])||void 0===S?void 0:null===(D=S.channel)||void 0===D?void 0:null===(P=D[0])||void 0===P?void 0:P.name,dataProductSku:null==K?void 0:null===(T=K[j])||void 0===T?void 0:T.sku,dataProductBrand:null==K?void 0:null===(A=K[j])||void 0===A?void 0:null===(X=A.brand)||void 0===X?void 0:null===(z=X[0])||void 0===z?void 0:z.name,dataProductName:null==K?void 0:null===(I=K[j])||void 0===I?void 0:I.postName,dataProductPrice:(null==K?void 0:null===(E=K[j])||void 0===E?void 0:E.priceRange)?null==K?void 0:null===(_=K[j])||void 0===_?void 0:_.priceRange:null==K?void 0:null===(L=K[j])||void 0===L?void 0:null===(F=L.channel)||void 0===F?void 0:null===(R=F[0])||void 0===R?void 0:R.price,dataProductCategory:null==K?void 0:null===(V=K[j])||void 0===V?void 0:null===(U=V.productCat)||void 0===U?void 0:null===(H=U[0])||void 0===H?void 0:H.name})}),(0,e.tZ)(r.S,{className:"affiliate-scroll-list",column:1,row:1,distanceOverlappedLeft:{amount:16,unit:"pixel"},isDotsShown:!W&&oc.length>1,mode:"infinity",type:"separated",isArrowShown:!0,onChangePage:o=>{$(o),on(!0),or(-1)},arrowType:"Care",children:null==oc?void 0:oc.map((o,i)=>(0,e.tZ)(b.V,{isCarousel:!0,isMobile:W,productId:o,openNewTab:null==G?void 0:G.openNewTab,noFollow:null==G?void 0:G.noFollow,sponsored:null==G?void 0:G.sponsored,changeCollapseCarousel:o=>on(o),isCarouselCollapse:oe,isFocus:ot===i,setFocus:o=>od(o),idxAffiliate:i},i))})]})}},Dr2f:function(o,i,l){l.d(i,{$R:function(){return P},$v:function(){return B},B_:function(){return p},CW:function(){return h},Cv:function(){return D},DC:function(){return A},GF:function(){return y},I:function(){return _},I3:function(){return L},IC:function(){return u},Im:function(){return F},Iw:function(){return v},JG:function(){return w},ME:function(){return H},OU:function(){return E},PQ:function(){return c},Qr:function(){return C},Xb:function(){return f},Zw:function(){return I},_N:function(){return m},bf:function(){return s},bp:function(){return W},cE:function(){return M},f0:function(){return x},go:function(){return V},gw:function(){return U},iG:function(){return z},iN:function(){return N},mr:function(){return S},pI:function(){return k},qR:function(){return T},sF:function(){return g},wZ:function(){return X},xU:function(){return R},xq:function(){return Z},zv:function(){return b}});var e=l("rBCA"),n=l("uuQu"),t=l("iBNF"),d=l("MmHG"),a=l("LgdP"),r=l("qQsD");let c=(0,e.Z)("div",{target:"evw5lgk0"})(n.M.mbDown,"{margin:32px 0 8px 0;}",n.M.mbUp,"{margin:48px 0 32px 0;}padding:16px;border-radius:",t.r.borderRadius,";box-shadow:0px 10px 16px rgba(0,0,0,0.04),0px 2px 8px rgba(0,0,0,0.04),0px 0px 1px rgba(0,0,0,0.04);.divider{border-top:8px solid #f7f9fc;border-bottom:none;margin:0;margin-left:-1rem;}"),u=(0,e.Z)("div",{target:"evw5lgk1"})(n.M.mbUp,"{display:flex;justify-content:space-between;}",n.M.mbDown,"{padding-bottom:24px;}.collapse-button{width:100%;margin-top:16px;",n.M.mbUp,"{margin-top:8px;}.down-icon{width:18px;height:18px;margin-left:8px;vertical-align:middle;}.up-icon{width:18px;height:18px;margin-left:8px;vertical-align:text-top;}}&[data-is-carousel='true']{.container{padding:0;.section{",n.M.mbDown,"{padding:0 16px;}}.item-grid{padding:0;}}}"),v=(0,e.Z)("div",{target:"evw5lgk2"})("display:flex;height:36px;align-items:center;margin-top:8px;"),s=(0,e.Z)(d.T,{target:"evw5lgk3"})("margin-right:16px;font-size:18px;font-weight:600;line-height:26px;&[data-is-single-vendor='true']{overflow:hidden;width:35%;margin:0;}"),p=(0,e.Z)(d.T,{target:"evw5lgk4"})(n.M.mbUp,"{min-height:51px;}margin-top:4px;font-size:18px;font-weight:600;line-height:26px;"),h=(0,e.Z)("div",{target:"evw5lgk5"})(n.M.mbUp,"{width:calc(50% - 16px);}"),g=(0,e.Z)("div",{target:"evw5lgk6"})(n.M.mbUp,"{width:50%;}"),m=(0,e.Z)("div",{target:"evw5lgk7"})("position:relative;"),f=(0,e.Z)("div",{target:"evw5lgk8"})("position:absolute;z-index:10;top:5px;right:5px;height:26px;padding:4px 6px;background-color:",t.r.colors.red500,";border-radius:",t.r.borderRadius,";color:white;"),b=(0,e.Z)(d.T,{target:"evw5lgk9"})("min-height:18px;",n.M.mbUp,"{min-height:25px;}"),w=(0,e.Z)("a",{target:"evw5lgk10"})("color:",t.r.colors.gray400,";text-decoration:none;"),Z=(0,e.Z)("div",{target:"evw5lgk11"})("text-align:center;"),x=(0,e.Z)("img",{target:"evw5lgk12"})("width:auto;max-width:100%;height:230px;",n.M.mbUp,"{height:208px;}"),C=(0,e.Z)("div",{target:"evw5lgk13"})(n.M.mbUp,"{position:absolute;background:white;z-index:10;top:60px;width:100%;&[data-is-single-vendor='false']{&[data-is-shown-description='true']{overflow:visible;}}}transition:all 0.5s linear;overflow:hidden;box-sizing:border-box;&[data-is-collapse='true']{max-height:0;padding:0 16px;border:0px solid transparent;",n.M.mbDown,"{margin-top:0;}border-radius:",t.r.borderRadius,";}.event{pointer-events:none;align-items:center;}&[data-is-collapse='false']{max-height:310px;padding:8px 16px;border:1px solid #e4e8ec;",n.M.mbDown,"{margin-top:16px;}border-radius:",t.r.borderRadius,";}"),y=(0,e.Z)("a",{target:"evw5lgk14"})("display:flex;align-items:center;justify-content:space-between;margin:8px 0;text-decoration:none;"),k=(0,e.Z)("div",{target:"evw5lgk15"})("display:flex;align-items:center;gap:8px;"),B=(0,e.Z)("img",{target:"evw5lgk16"})("max-width:32px;"),N=(0,e.Z)(d.T,{target:"evw5lgk17"})("font-size:14px;font-weight:600;line-height:22px;"),M=(0,e.Z)("div",{target:"evw5lgk18"})("margin-top:16px;",n.M.mbUp,"{position:relative;}a{text-decoration:none;}"),P=(0,e.Z)("div",{target:"evw5lgk19"})("margin:16px 0;&[data-is-single-vendor='true']{flex-grow:1;margin:0;}"),D=(0,e.Z)("div",{target:"evw5lgk20"})("color:",t.r.colors.primaryActive,";font-size:14px;font-weight:bold;line-height:22px;"),S=(0,e.Z)("div",{target:"evw5lgk21"})("display:flex;align-items:center;"),T=(0,e.Z)("div",{target:"evw5lgk22"})("width:28px;height:28px;cursor:pointer;"),z=(0,e.Z)("div",{target:"evw5lgk23"})("width:calc(100% - 68px);box-sizing:border-box;padding:5px 8px;border:1px solid ",t.r.colors.gray400,";margin-right:8px;border-radius:",t.r.borderRadius,";"),X=(0,e.Z)("div",{target:"evw5lgk24"})("position:relative;display:flex;width:16px;align-items:center;margin-right:8px;&[data-is-shown-description='false']{&::before{display:none;}}"),A=(0,e.Z)("img",{target:"evw5lgk25"})("width:16px;height:16px;margin-right:4px;&:hover{cursor:pointer;}"),I=(0,e.Z)("div",{target:"evw5lgk26"})(n.M.mbUp,"{&::before{position:absolute;z-index:9;top:-3%;left:117px;content:' ';width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:8px solid ",t.r.colors.gray100,";}}&[data-is-shown-description='false']{display:none;}",n.M.mbUp,"{position:absolute;width:330px;z-index:10;top:130%;left:-116px;}box-sizing:border-box;border:1px solid ",t.r.colors.gray100,";background:",t.r.colors.neutral50,";border-radius:",t.r.borderRadius,";"),E=(0,e.Z)("div",{target:"evw5lgk27"})("margin:16px;.promotion-condition{.condition-content{ul{list-style:inside;}}}"),_=(0,e.Z)("div",{target:"evw5lgk28"})("margin-bottom:17px;color:red;"),R=(0,e.Z)("div",{target:"evw5lgk29"})("display:flex;align-items:center;justify-content:space-between;"),F=(0,e.Z)(a.B,{target:"evw5lgk30"})("width:100%;margin-top:16px;"),L=(0,e.Z)("div",{target:"evw5lgk31"})(n.M.mbDown,"{position:fixed;left:50%;left:0;bottom:0;width:100%;background-color:",t.r.colors.white,";border-radius:",t.r.borderRadius,";transition:all 5s ease-in-out;box-shadow:0px 0px 4px ",t.r.colors.gray200,";&[data-open='true']{transition:all 5s ease-in-out;z-index:200;bottom:0;opacity:1;visibility:visible;width:100%;}}"),H=(0,e.Z)("div",{target:"evw5lgk32"})("position:fixed;z-index:110;top:0;left:0;width:100%;height:100%;align-items:center;background:rgba(38,38,38,0.3);&[data-open='false']{display:none;}"),U=(0,e.Z)("div",{target:"evw5lgk33"})("position:absolute;z-index:10;top:210px;right:28px;width:calc(50% - 28px);.affiliate-scroll-list > .container{overflow-y:hidden;}"),V=(0,e.Z)("div",{target:"evw5lgk34"})("position:absolute;z-index:10;top:118px;right:28px;width:210px;transition-delay:0.4s;&[data-is-hidden='true']{opacity:0;transition:0s;visibility:hidden;}"),W=(0,e.Z)(r.S,{target:"evw5lgk35"})(".image-gallery-wrapper .image-block{width:initial;}")},xSvo:function(o,i,l){l.d(i,{V:function(){return Affiliate},T:function(){return AffiliatePromotion}});var e=l("BGKE"),n=l("q1tI"),t=l("MmHG"),d=l("NMBh"),a=l("DEkF"),r=l("iBNF"),c=l("LgdP"),u=l("Wgwc"),v=l.n(u),s=l("dDsW"),p=l("/tR3"),h=l("oQBk"),g=l("xIXX"),m=l("CJtR"),f=l("iv2E"),b=l("P5LW"),w=l("rIrU"),Z=l("Dr2f"),x=l("ECoa"),C=l("11qe"),y=l("hXNO");let AffiliateSkeleton=()=>{let o=(0,y.d)();return(0,e.BX)(Z.PQ,{children:[o?(0,e.tZ)(C.IW,{type:"solid",className:"divider"}):null,(0,e.BX)(Z.IC,{children:[(0,e.tZ)(Z.CW,{children:(0,e.tZ)(Z._N,{children:(0,e.tZ)(x.Z,{height:o?306:277})})}),(0,e.BX)(Z.sF,{children:[(0,e.tZ)(x.Z,{width:100,height:21,style:{marginBottom:8}}),(0,e.tZ)(x.Z,{className:"product-title",height:51,style:{marginBottom:8}}),(0,e.tZ)(x.Z,{height:30,width:200,style:{marginBottom:8}}),(0,e.tZ)(x.Z,{height:45,className:"collapse-button collapse"})]})]}),o?(0,e.tZ)(C.IW,{type:"solid",className:"divider"}):null]})};var k=l("hVZB");let AffiliatePromotion=o=>{var i,l,a,r,c;let{vendor:u,shownDescription:p,isMobile:h,isSingleVendor:g,isCopied:m,idxPromotion:f,setCopied:b,dataProductChannel:x,dataProductSku:C,dataProductBrand:y,dataProductName:k,dataProductPrice:B,dataProductCategory:N}=o,{formatMessage:M}=(0,s.Z)(),[P,D]=(0,n.useState)(!1);(0,n.useEffect)(()=>{p(P)},[P]);let copyToClipboard=async o=>{try{b(-1),await navigator.clipboard.writeText(o),b(f)}catch(o){console.error("Failed to copy: ",o)}},DescriptionPromotion=()=>{var o,i,l,n,a;return(0,e.tZ)(Z.Zw,{"data-is-shown-description":P,"data-is-single-vendor":g,children:(0,e.BX)(Z.OU,{children:[(0,e.tZ)(Z.I,{children:(0,e.tZ)(t.T,{size:"p4",type:"bold",color:"#262626",style:{display:"inline"},children:null==u?void 0:null===(o=u.promotion)||void 0===o?void 0:o.name})}),(0,e.BX)(Z.xU,{children:[(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#595959",style:{fontWeight:600},children:M({id:"affiliate.promotion.discountCode",defaultMessage:"Discount Code"})}),(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#2685F1",children:null==u?void 0:null===(i=u.promotion)||void 0===i?void 0:i.code}),(0,e.tZ)(Z.qR,{onClick:()=>{var o;return copyToClipboard(null==u?void 0:null===(o=u.promotion)||void 0===o?void 0:o.code)},children:(0,e.tZ)("img",{loading:"lazy",src:m?"".concat(w.uQ,"/copy-success.svg"):"".concat(w.uQ,"/copy-blue.svg"),alt:"Copy Button","data-event-category":"Affiliates","data-event-action":"Copy Promotion Code","data-event-label":"".concat(null==u?void 0:null===(l=u.promotion)||void 0===l?void 0:l.name,": ").concat(null==u?void 0:null===(n=u.promotion)||void 0===n?void 0:n.code),"data-product-channel":x,"data-product-sku":C,"data-product-brand":y,"data-product-name":k,"data-product-price":B,"data-product-category":N})})]}),(0,e.tZ)(d.D,{type:"solid"}),(0,e.BX)("div",{className:"promotion-end-date",children:[(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#595959",style:{fontWeight:600},children:M({id:"affiliate.promotion.endDate",defaultMessage:"End Date"})}),(0,e.tZ)(t.T,{size:"n1",color:"#737373",children:v()().format(w.tD)})]}),(0,e.tZ)(d.D,{type:"solid"}),(0,e.BX)("div",{className:"promotion-condition",children:[(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#595959",style:{fontWeight:600},children:M({id:"affiliate.promotion.condition",defaultMessage:"Condition"})}),(0,e.tZ)(t.T,{size:"n1",color:"#737373",children:(0,e.tZ)("span",{className:"condition-content",dangerouslySetInnerHTML:{__html:null==u?void 0:null===(a=u.promotion)||void 0===a?void 0:a.description}})})]}),h&&(0,e.tZ)(Z.Im,{color:"secondary",size:"md",onClick:()=>D(!1),children:M({id:"affiliate.promotion.close",defaultMessage:"Close"})})]})})};return(0,e.tZ)(Z.$R,{"data-is-single-vendor":g,children:(0,e.BX)(Z.mr,{children:[(null==u?void 0:null===(i=u.promotion)||void 0===i?void 0:i.description)&&(0,e.BX)(Z.wZ,{"data-is-shown-description":P,onMouseEnter:()=>!h&&D(!0),onMouseLeave:()=>!h&&D(!1),onClick:()=>h&&D(!0),children:[(0,e.tZ)(Z.DC,{src:"".concat(w.uQ,"/info-dark.svg"),alt:"Description Info"}),h?(0,e.BX)(e.HY,{children:[(0,e.tZ)(Z.I3,{"data-open":P,onClick:o=>o.stopPropagation(),children:(0,e.tZ)(DescriptionPromotion,{})}),(0,e.tZ)(Z.ME,{"data-open":P,onClick:o=>{o.stopPropagation(),D(!1)}})]}):(0,e.tZ)(DescriptionPromotion,{})]}),(0,e.BX)(Z.iG,{children:[(0,e.tZ)(t.T,{size:"n1",style:{display:"inline"},children:"".concat(null==u?void 0:null===(l=u.promotion)||void 0===l?void 0:l.name,": ")}),(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#737373",style:{display:"inline"},children:null==u?void 0:null===(a=u.promotion)||void 0===a?void 0:a.code})]}),(0,e.tZ)(Z.qR,{onClick:()=>{var o;return copyToClipboard(null==u?void 0:null===(o=u.promotion)||void 0===o?void 0:o.code)},children:(0,e.tZ)("img",{loading:"lazy",src:m?"".concat(w.uQ,"/copy-success.svg"):"".concat(w.uQ,"/copy.svg"),alt:"Copy Button","data-event-category":"Affiliates","data-event-action":"Copy Promotion Code","data-event-label":"".concat(null==u?void 0:null===(r=u.promotion)||void 0===r?void 0:r.name,": ").concat(null==u?void 0:null===(c=u.promotion)||void 0===c?void 0:c.code),"data-product-channel":x,"data-product-sku":C,"data-product-brand":y,"data-product-name":k,"data-product-price":B,"data-product-category":N})})]})})},Affiliate=o=>{var i,l,u,x,C,y,B,N,M,P,D,S,T,z,X,A,I,E,_,R,F,L,H,U,V,W,G,O,Q,J,K,q,j,$,Y,oo,oi,ol,oe,on,ot,od,oa,or,oc,ou,ov,os,op,oh,og,om,of,ob,ow;let{productId:oZ,isCarousel:ox,isMobile:oC,noFollow:oy,sponsored:ok,openNewTab:oB,changeCollapseCarousel:oN,isCarouselCollapse:oM,idxAffiliate:oP,isFocus:oD,setFocus:oS,title:oT=""}=o,[oz,oX]=(0,n.useState)(!0),[oA,oI]=(0,n.useState)(null),[oE,o_]=(0,n.useState)(!1),[oR,oF]=(0,n.useState)(-1),[oL,oH]=(0,n.useState)(!1),{locale:oU,router:{asPath:oV}}=(0,b.h)(),{formatMessage:oW}=(0,s.Z)();(0,n.useEffect)(()=>{oC||oX(!!oM)},[oM]),(0,n.useEffect)(()=>{oF(-1)},[oD]),(0,n.useEffect)(()=>{let fetchProductDetail=async()=>{var o,i;oH(!1);let l=await (0,g.t9)((0,m.cN)(h.y.COMMON.GET_AFFILIATE_PRODUCT,{productId:oZ}),"get");if(null==l?void 0:null===(o=l.data)||void 0===o?void 0:o[0]){let o=(0,p.nx)(null==l?void 0:null===(i=l.data)||void 0===i?void 0:i[0],oU);oI(o)}oH(!0)};fetchProductDetail()},[]);let oG=(0,n.useRef)(null),oO=(0,n.useRef)(0);if((0,n.useEffect)(()=>{var o;let i=null===(o=oG.current)||void 0===o?void 0:o.previousElementSibling;for(;i;)"P"===i.tagName&&oO.current++,i=i.previousElementSibling;console.log("Number of
tags above the
:",oO.current)},[oG.current]),!oL)return(0,e.tZ)(AffiliateSkeleton,{});if(!oA)return null;let isOverEndDate=o=>{if(!o)return!1;{let i=new Date;i.setHours(0,0,0,0);let l=v()(o,w.yJ).toDate();return l{var i;return null!=o&&!!o.promotion&&!isOverEndDate(null==o?void 0:null===(i=o.promotion)||void 0===i?void 0:i.end_date)},getTheBestDiscount=o=>{let i=null==o?void 0:o.some(o=>hasPromotion(o));if(!i)return null;{let i=null==o?void 0:o.some(o=>{var i;return(null==o?void 0:o.promotion)&&(null==o?void 0:null===(i=o.promotion)||void 0===i?void 0:i.discount)!==""});if(!i)return"no-discount";{let i=null==o?void 0:o.map(o=>{var i,l;return(null==o?void 0:null===(i=o.promotion)||void 0===i?void 0:i.discount)?parseInt(null==o?void 0:null===(l=o.promotion.discount)||void 0===l?void 0:l.replace("%","")):0});return Math.max(...i)}}};return(0,e.BX)(Z.PQ,{onClick:()=>{void 0!==oP&&oS&&oS(oP)},children:[oT&&(0,e.BX)(k.X0,{style:{marginBottom:16},children:[(0,e.tZ)("div",{className:"line"}),(0,e.tZ)(a.H,{tag:"h5",color:r.r.colors.secondaryBase,children:oT})]}),(0,e.BX)(Z.IC,{"data-is-carousel":ox,"data-event-category":"Affiliates","data-event-action":"Impression","data-event-label":"https://".concat(f.domainLocales[oU]).concat(oV),"data-product-sku":null==oA?void 0:oA.sku,"data-product-brand":null==oA?void 0:null===(l=oA.brand)||void 0===l?void 0:null===(i=l[0])||void 0===i?void 0:i.name,"data-product-name":null==oA?void 0:oA.postName,"data-product-price":null==oA?void 0:null===(x=oA.channel)||void 0===x?void 0:null===(u=x[0])||void 0===u?void 0:u.price,children:[(0,e.tZ)(Z.CW,{children:(0,e.BX)(Z._N,{children:[getTheBestDiscount(null==oA?void 0:oA.channel)&&(0,e.tZ)(Z.Xb,{children:"no-discount"===getTheBestDiscount(null==oA?void 0:oA.channel)?(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#fffff",children:null==oA?void 0:null===(B=oA.channel)||void 0===B?void 0:null===(y=B.find(o=>hasPromotion(o)))||void 0===y?void 0:null===(C=y.promotion)||void 0===C?void 0:C.name}):(0,e.tZ)(t.T,{size:"n1",type:"bold",color:"#fffff",children:oW({id:"affiliate.promotion.bestDiscount",defaultMessage:"Up to {promotionDiscount}"},{promotionDiscount:"".concat(getTheBestDiscount(null==oA?void 0:oA.channel),"%")})})}),Array.isArray(null==oA?void 0:oA.gallery)&&(null==oA?void 0:null===(N=oA.gallery)||void 0===N?void 0:N.length)>0&&(0,e.tZ)(Z.bp,{column:1,row:1,isDotsShown:oC&&(null==oA?void 0:null===(M=oA.gallery)||void 0===M?void 0:M.length)>1,mode:"snapped",type:"separated",arrowType:"Care",isImageGalleryShown:!oC&&(null==oA?void 0:null===(P=oA.gallery)||void 0===P?void 0:P.length)>1,children:null==oA?void 0:oA.gallery.map(o=>(0,e.tZ)(Z.xq,{children:(0,e.tZ)(Z.f0,{src:o,alt:"Image"},o)},o))})]})}),(0,e.BX)(Z.sF,{children:[(0,e.tZ)(Z.zv,{size:"c2",color:r.r.colors.gray400,type:"bold",children:null==oA?void 0:oA.brand.map((o,i)=>{var l;return(0,e.BX)(n.Fragment,{children:[(null==o?void 0:o.permalink)?(0,e.tZ)(Z.JG,{href:null==o?void 0:o.permalink,className:"no-replace-click",target:"_blank",children:null==o?void 0:o.name},i):null==o?void 0:o.name,i<(null==oA?void 0:null===(l=oA.brand)||void 0===l?void 0:l.length)-1?", ":""]},i)})}),(0,e.tZ)(Z.B_,{size:"p1",color:r.r.colors.gray800,children:null==oA?void 0:oA.postTitle}),(0,e.BX)(Z.Iw,{children:[(0,e.tZ)(Z.bf,{"data-is-single-vendor":!oC&&(null==oA?void 0:null===(D=oA.channel)||void 0===D?void 0:D.length)===1&&hasPromotion(null==oA?void 0:null===(S=oA.channel)||void 0===S?void 0:S[0]),as:"div",size:"sm",children:(0,e.tZ)(t.T,{size:"p3",color:r.r.colors.green700,children:null==oA?void 0:oA.priceRange})}),(null==oA?void 0:null===(T=oA.channel)||void 0===T?void 0:T.length)===1&&oC&&hasPromotion(null==oA?void 0:null===(z=oA.channel)||void 0===z?void 0:z[0])&&(0,e.tZ)(AffiliatePromotion,{vendor:null==oA?void 0:null===(X=oA.channel)||void 0===X?void 0:X[0],shownDescription:o=>o_(o),isMobile:oC,isSingleVendor:!0,isCopied:oD&&0===oR,idxPromotion:0,setCopied:o=>oF(o),dataProductChannel:null==oA?void 0:null===(I=oA.channel)||void 0===I?void 0:null===(A=I[0])||void 0===A?void 0:A.name,dataProductSku:null==oA?void 0:oA.sku,dataProductBrand:null==oA?void 0:null===(_=oA.brand)||void 0===_?void 0:null===(E=_[0])||void 0===E?void 0:E.name,dataProductName:null==oA?void 0:oA.postName,dataProductPrice:(null==oA?void 0:oA.priceRange)?null==oA?void 0:oA.priceRange:null==oA?void 0:null===(F=oA.channel)||void 0===F?void 0:null===(R=F[0])||void 0===R?void 0:R.price,dataProductCategory:null==oA?void 0:null===(H=oA.productCat)||void 0===H?void 0:null===(L=H[0])||void 0===L?void 0:L.name})]}),(0,e.BX)(Z.cE,{ref:oG,children:[(null==oA?void 0:null===(U=oA.channel)||void 0===U?void 0:U.length)===1?(0,e.tZ)("a",{"data-event-category":"Affiliates","data-event-action":"Click Shop Now","data-product-position":"p".concat(oO.current),"data-product-ui":"Slide","data-event-label":null==oA?void 0:null===(W=oA.channel)||void 0===W?void 0:null===(V=W[0])||void 0===V?void 0:V.url,"data-product-channel":null==oA?void 0:null===(O=oA.channel)||void 0===O?void 0:null===(G=O[0])||void 0===G?void 0:G.name,"data-product-sku":null==oA?void 0:oA.sku,"data-product-brand":null==oA?void 0:null===(J=oA.brand)||void 0===J?void 0:null===(Q=J[0])||void 0===Q?void 0:Q.name,"data-product-name":null==oA?void 0:oA.postName,"data-product-price":(null==oA?void 0:oA.priceRange)?null==oA?void 0:oA.priceRange:null==oA?void 0:null===(q=oA.channel)||void 0===q?void 0:null===(K=q[0])||void 0===K?void 0:K.price,"data-product-category":null==oA?void 0:null===($=oA.productCat)||void 0===$?void 0:null===(j=$[0])||void 0===j?void 0:j.name,href:null==oA?void 0:null===(oo=oA.channel)||void 0===oo?void 0:null===(Y=oo[0])||void 0===Y?void 0:Y.url,className:"no-replace-click",...oB?{target:"_blank"}:{},rel:"".concat(null==oA?void 0:null===(ol=oA.channel)||void 0===ol?void 0:null===(oi=ol[0])||void 0===oi?void 0:oi.url).concat(oy?" nofollow":"").concat(ok?" sponsored":""),children:(0,e.tZ)(c.B,{dataEventCategory:"Affiliates",dataEventAction:"Click Shop Now","data-product-position":"p".concat(oO.current),"data-product-ui":"Slide",dataEventLabel:null==oA?void 0:null===(on=oA.channel)||void 0===on?void 0:null===(oe=on[0])||void 0===oe?void 0:oe.url,dataProductChannel:null==oA?void 0:null===(od=oA.channel)||void 0===od?void 0:null===(ot=od[0])||void 0===ot?void 0:ot.name,dataProductSku:null==oA?void 0:oA.sku,dataProductBrand:null==oA?void 0:null===(or=oA.brand)||void 0===or?void 0:null===(oa=or[0])||void 0===oa?void 0:oa.name,dataProductName:null==oA?void 0:oA.postName,dataProductPrice:null==oA?void 0:null===(ou=oA.channel)||void 0===ou?void 0:null===(oc=ou[0])||void 0===oc?void 0:oc.price,color:"primary",size:"md",className:"collapse-button collapse",children:oW({id:"affiliate.collapseButton.shopAtVendor",defaultMessage:"Shop now at {vendor}"},{vendor:null==oA?void 0:null===(os=oA.channel)||void 0===os?void 0:null===(ov=os[0])||void 0===ov?void 0:ov.name})})}):oz?(0,e.BX)(c.B,{dataEventCategory:"Affiliates",dataEventAction:"Click To Expand",dataEventLabel:null==oA?void 0:null===(oh=oA.channel)||void 0===oh?void 0:null===(op=oh[0])||void 0===op?void 0:op.url,dataProductSku:null==oA?void 0:oA.sku,dataProductName:null==oA?void 0:oA.postName,dataProductPrice:null==oA?void 0:null===(om=oA.channel)||void 0===om?void 0:null===(og=om[0])||void 0===og?void 0:og.price,color:"primary",size:"md",className:"collapse-button collapse",onClick:()=>{oX(!1),ox&&oN(!1)},children:[oW({id:"affiliate.collapseButton.showNow",defaultMessage:"Shop Now ({number} vendors)"},{number:null==oA?void 0:null===(of=oA.channel)||void 0===of?void 0:of.length}),(0,e.tZ)("div",{className:"down-icon",children:(0,e.tZ)("img",{loading:"lazy",src:"".concat(w.Nr,"/chevronDownWhite.svg"),alt:"chevron-down"})})]}):(0,e.BX)(c.B,{color:"secondary",size:"md",className:"collapse-button collapse",onClick:()=>{oX(!0),ox&&oN(!0)},children:[oW({id:"affiliate.collapseButton.collapse",defaultMessage:"Collapse"}),(0,e.tZ)("img",{loading:"lazy",src:"".concat(w.Nr,"/chevronUpBlue.svg"),alt:"chevron-down",className:"up-icon"})]}),(oC||!ox)&&(0,e.tZ)(Z.Qr,{"data-is-collapse":oz,"data-is-carousel":ox,"data-is-shown-description":oE,"data-is-single-vendor":(null==oA?void 0:null===(ob=oA.channel)||void 0===ob?void 0:ob.length)===1,children:null==oA?void 0:null===(ow=oA.channel)||void 0===ow?void 0:ow.map((o,i)=>{var l,t,c,u,v,s,p,h,g,m;return(0,e.BX)(n.Fragment,{children:[(0,e.BX)(Z.GF,{"data-event-category":"Affiliates","data-event-action":"Click Shop Now","data-product-position":"p".concat(oO.current),"data-product-ui":"Slide","data-event-label":null==o?void 0:o.url,"data-product-channel":null==o?void 0:o.name,"data-product-sku":null==oA?void 0:oA.sku,"data-product-brand":null==oA?void 0:null===(t=oA.brand)||void 0===t?void 0:null===(l=t[0])||void 0===l?void 0:l.name,"data-product-name":null==oA?void 0:oA.postName,"data-product-price":null==o?void 0:o.price,className:"no-replace-url",href:null==o?void 0:o.url,...oB?{target:"_blank"}:{},rel:"".concat(null==o?void 0:o.url).concat(oy?" nofollow":"").concat(ok?" sponsored":""),children:[(0,e.BX)(Z.pI,{className:"event",children:[(0,e.tZ)(Z.$v,{src:null==o?void 0:o.icon,alt:"logo",className:"logo"}),(0,e.BX)("div",{children:[(0,e.tZ)(a.H,{tag:"h5",children:null==o?void 0:o.name}),(null==o?void 0:o.price)&&(0,e.tZ)(Z.iN,{size:"p3",color:r.r.colors.green700,children:null==o?void 0:o.price})]})]}),(0,e.tZ)(Z.Cv,{className:"event",children:oW({id:"affiliate.vendors.showNow",defaultMessage:"Shop Now"})})]}),hasPromotion(o)&&(0,e.tZ)(AffiliatePromotion,{vendor:o,shownDescription:o=>o_(o),isMobile:oC,isCopied:oD&&oR===i,idxPromotion:i,setCopied:o=>oF(o),dataProductChannel:null==oA?void 0:null===(u=oA.channel)||void 0===u?void 0:null===(c=u[0])||void 0===c?void 0:c.name,dataProductSku:null==oA?void 0:oA.sku,dataProductBrand:null==oA?void 0:null===(s=oA.brand)||void 0===s?void 0:null===(v=s[0])||void 0===v?void 0:v.name,dataProductName:null==oA?void 0:oA.postName,dataProductPrice:(null==oA?void 0:oA.priceRange)?null==oA?void 0:oA.priceRange:null==oA?void 0:null===(h=oA.channel)||void 0===h?void 0:null===(p=h[0])||void 0===p?void 0:p.price,dataProductCategory:null==oA?void 0:null===(m=oA.productCat)||void 0===m?void 0:null===(g=m[0])||void 0===g?void 0:g.name}),i<(null==oA?void 0:oA.channel.length)-1?(0,e.tZ)(d.D,{type:"dashed"}):null]},i)})})]})]})]})]})}},"3kCk":function(o,i,l){l.d(i,{j:function(){return t}});var e=l("BGKE"),n=l("q1tI");let t=(0,n.memo)(()=>(0,e.tZ)("div",{className:"shoppable",children:(0,e.BX)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,e.tZ)("rect",{width:"24",height:"24",rx:"12",fill:"#1B3250"}),(0,e.tZ)("path",{d:"M16.6667 8.00033H15.3333C15.3333 6.16033 13.84 4.66699 12 4.66699C10.16 4.66699 8.66667 6.16033 8.66667 8.00033H7.33333C6.6 8.00033 6 8.60033 6 9.33366V17.3337C6 18.067 6.6 18.667 7.33333 18.667H16.6667C17.4 18.667 18 18.067 18 17.3337V9.33366C18 8.60033 17.4 8.00033 16.6667 8.00033ZM12 6.00033C13.1067 6.00033 14 6.89366 14 8.00033H10C10 6.89366 10.8933 6.00033 12 6.00033ZM12 12.667C10.4467 12.667 9.14 11.607 8.77333 10.167C8.66 9.74699 8.98667 9.33366 9.42 9.33366C9.73333 9.33366 9.98667 9.56033 10.0733 9.86699C10.3067 10.7137 11.08 11.3337 12 11.3337C12.92 11.3337 13.6933 10.7137 13.9267 9.86699C14.0133 9.56033 14.2667 9.33366 14.58 9.33366C15.0133 9.33366 15.3333 9.74699 15.2267 10.167C14.86 11.607 13.5533 12.667 12 12.667Z",fill:"white"})]})}))},fwTn:function(o,i,l){l.d(i,{V:function(){return Affiliate}});var e=l("BGKE"),n=l("q1tI"),t=l("MmHG"),d=l("iBNF"),a=l("KeOA"),r=l("OAL+"),c=l("0Pj/"),u=l("zLsJ"),v=l("dDsW"),s=l("raAP"),p=l("hXNO"),h=l("P5LW"),g=l("rEaw"),m=l("DEkF"),f=l("eosF"),b=l("mAfZ"),w=l("SPK5"),Z=l("Eso5"),x=l("LES+"),C=l("NEaA"),y=l("wp0n");let k=n.memo(o=>{let{hasPromotion:i,originalPrice:l,promotionPrice:n}=o;return(0,e.BX)(w.k,{gap:8,align:"center",children:[(0,e.tZ)(y.T,{...i?{size:"p4",color:d.r.colors.gray400,style:{textDecoration:"line-through"}}:{size:"s2",color:d.r.colors.red600,type:"semiBold"},weight:"semiBold",children:l}),i&&n&&(0,e.tZ)(y.T,{size:"s2",color:d.r.colors.red600,weight:"semiBold",children:n})]})}),_NormalButton=o=>{var i,l,n,t,d,a,r,c,u,s,p,h;let{product:g,position:m=0,...f}=o,{formatMessage:w}=(0,v.Z)();return(0,e.tZ)(b.z,{fullWidth:!0,variant:"filled",size:"md",color:"#2D87F3",onClick:()=>{var o,i;return window.open(null==g?void 0:null===(i=g.channel)||void 0===i?void 0:null===(o=i[0])||void 0===o?void 0:o.url,"_blank")},"data-event-category":"Affiliates","data-event-action":"Click Shop Now","data-product-position":"p".concat(m),"data-product-ui":"Slide","data-event-label":null==g?void 0:null===(l=g.channel)||void 0===l?void 0:null===(i=l[0])||void 0===i?void 0:i.url,"data-product-channel":null==g?void 0:null===(t=g.channel)||void 0===t?void 0:null===(n=t[0])||void 0===n?void 0:n.name,"data-product-sku":null==g?void 0:g.sku,"data-product-brand":null==g?void 0:null===(a=g.brand)||void 0===a?void 0:null===(d=a[0])||void 0===d?void 0:d.name,"data-product-name":null==g?void 0:g.postName,"data-product-price":(null==g?void 0:g.priceRange)||(null==g?void 0:null===(c=g.channel)||void 0===c?void 0:null===(r=c[0])||void 0===r?void 0:r.price),"data-product-category":null==g?void 0:null===(s=g.productCat)||void 0===s?void 0:null===(u=s[0])||void 0===u?void 0:u.name,className:"pointer-event-child-none",styles:{root:{paddingBlock:"10px",minHeight:42,height:"unset"},label:{whiteSpace:"initial",textAlign:"center",overflow:"initial",lineHeight:1.2}},...f,children:w({id:"affiliate.collapseButton.shopAtVendor",defaultMessage:"{customText} at {vendor}"},{vendor:null==g?void 0:null===(h=g.channel)||void 0===h?void 0:null===(p=h[0])||void 0===p?void 0:p.name,customText:(null==g?void 0:g.ctaButton)||w({id:"affiliate.vendors.showNow",defaultMessage:"Shop Now"})})})},B=[f.L.Vietnam,f.L.Indonesia],_DropdownItem=o=>{var i,l,a;let{channel:c,product:u}=o,{locale:s}=(0,h.h)(),{formatMessage:p}=(0,v.Z)(),g=(0,n.useMemo)(()=>!!(null==c?void 0:c.discount_price),[null==c?void 0:c.discount_price]),f=(0,n.useMemo)(()=>new Intl.NumberFormat(s,{style:"currency",currency:u.currencyUnit.code||"VND",...B.includes(s)?{minimumFractionDigits:0,maximumFractionDigits:0}:{}}),[s,null==u?void 0:null===(i=u.currencyUnit)||void 0===i?void 0:i.code]),b=(0,n.useMemo)(()=>{if(g){let o=parseInt(null==c?void 0:c.discount_price);return f.format(o)}return null},[g]);return(0,e.BX)(w.k,{gap:16,justify:"stretch",children:[!!(null==c?void 0:c.icon)&&(0,e.tZ)(Z.x,{sx:{width:40,height:40,flexShrink:0},children:(0,e.tZ)("img",{loading:"lazy",src:null==c?void 0:c.icon,alt:""})}),(0,e.BX)(r.K,{spacing:4,w:"100%",children:[(0,e.BX)(w.k,{justify:"space-between",children:[(0,e.tZ)(m.H,{tag:"h6",fontWeight:"bold",color:d.r.colors.gray800,children:null==c?void 0:c.name}),(0,e.tZ)("a",{href:c.url,target:"_blank","data-event-category":"Affiliates","data-event-action":"Click Shop Now","data-product-ui":"Slide","data-event-label":null==c?void 0:c.url,"data-product-channel":null==c?void 0:c.name,"data-product-sku":null==u?void 0:u.sku,"data-product-brand":null==u?void 0:null===(a=u.brand)||void 0===a?void 0:null===(l=a[0])||void 0===l?void 0:l.name,"data-product-name":null==u?void 0:u.postName,"data-product-price":null==c?void 0:c.price,className:"pointer-event-child-none",children:(0,e.tZ)(t.T,{size:"s4",color:d.r.colors.primaryBase,type:"semiBold",children:p({id:"affiliate.vendors.showNow",defaultMessage:"Shop Now"})})})]}),!!(null==c?void 0:c.price)&&(0,e.tZ)(k,{hasPromotion:g,originalPrice:f.format(Number(null==c?void 0:c.price)),promotionPrice:b})]})]})},_DropdownButton=o=>{var i,l,t,a,c,u,s,p,h,g,m;let{product:f,position:w=0,...Z}=o,{formatMessage:y}=(0,v.Z)(),[k,B]=(0,n.useState)(!1),N=(null===(i=f.channel)||void 0===i?void 0:i.filter(o=>!o["non-available"]))||[];return(0,e.BX)(x.J,{opened:k,onChange:B,width:"target",position:"bottom",withArrow:!0,shadow:"md",radius:8,withinPortal:!0,styles:{dropdown:{border:"1px solid ".concat(d.r.colors.neutral100)}},children:[(0,e.tZ)(x.J.Target,{children:(0,e.tZ)(b.z,{variant:"filled",fullWidth:!0,size:"md",color:"#2D87F3",onClick:()=>{B(o=>!o)},rightIcon:(0,e.tZ)("svg",{width:"19",height:"18",viewBox:"0 0 19 18",fill:"none",children:(0,e.tZ)("path",{d:"M9.49975 10.5532L6.634 7.68746C6.3235 7.37696 5.8195 7.37696 5.509 7.68746C5.1985 7.99796 5.1985 8.50196 5.509 8.81246L8.9695 12.273C9.26275 12.5662 9.7375 12.5662 10.03 12.273L13.4905 8.81246C13.801 8.50196 13.801 7.99796 13.4905 7.68746C13.18 7.37696 12.676 7.37696 12.3655 7.68746L9.49975 10.5532Z",fill:"white"})}),"data-event-category":"Affiliates","data-event-action":"Click To Expand","data-product-position":"p".concat(w),"data-product-ui":"Slide","data-event-label":null==f?void 0:null===(t=f.channel)||void 0===t?void 0:null===(l=t[0])||void 0===l?void 0:l.url,"data-product-channel":null==f?void 0:null===(c=f.channel)||void 0===c?void 0:null===(a=c[0])||void 0===a?void 0:a.name,"data-product-sku":null==f?void 0:f.sku,"data-product-brand":null==f?void 0:null===(s=f.brand)||void 0===s?void 0:null===(u=s[0])||void 0===u?void 0:u.name,"data-product-name":null==f?void 0:f.postName,"data-product-price":(null==f?void 0:f.priceRange)||(null==f?void 0:null===(h=f.channel)||void 0===h?void 0:null===(p=h[0])||void 0===p?void 0:p.price),"data-product-category":null==f?void 0:null===(m=f.productCat)||void 0===m?void 0:null===(g=m[0])||void 0===g?void 0:g.name,className:"pointer-event-child-none",styles:{root:{paddingBlock:"10px",minHeight:42,height:"unset",pointerEvents:"initial"},label:{whiteSpace:"initial",textAlign:"center",overflow:"initial",lineHeight:1.2},rightIcon:{...k&&{transform:"rotate(180deg)"}}},...Z,children:k?y({id:"affiliate.collapseButton.collapse",defaultMessage:"Collapse"}):y({id:"affiliate.vendors.shopNumberOfVendors",defaultMessage:"Buy now at ({number} vendors)"},{number:N.length})})}),(0,e.tZ)(x.J.Dropdown,{children:(0,e.tZ)(r.K,{children:N.map((o,i)=>(0,e.BX)(n.Fragment,{children:[i>0&&(0,e.tZ)(C.i,{variant:"dashed"}),(0,e.tZ)(_DropdownItem,{channel:o,product:f})]},o.name))})})]})},AffiliateButton=o=>{let{product:i,...l}=o,n=(null==i?void 0:i.channel)||[],t=n.filter(o=>o.name&&o.url),d=t.length>1,a={...i,channel:t};return d?(0,e.tZ)(_DropdownButton,{product:a,...l}):(0,e.tZ)(_NormalButton,{product:a,...l})};var N=l("fdQd"),M=l("rBCA");let P=(0,M.Z)("div",{target:"en6yxg30"})("&.active{border:2px solid #2685f1;}border-radius:4px;height:48px;overflow:hidden;background-color:#ffffff;"),D=(0,M.Z)("div",{target:"en6yxg31"})("display:flex;flex-direction:column;gap:24px;img{width:100%;object-fit:contain;}.carousel-main{img{min-height:210px;display:flex;height:210px;background-color:#ffffff;}}.carousel-thumb{height:48px;}"),S=(0,M.Z)("div",{target:"en6yxg32"})("padding:5px 8px;/* Gray/Gray-200 */\n border:1px solid ",d.r.colors.gray200,";border-radius:",d.r.borderRadius,";color:",d.r.colors.gray500,";"),T=(0,M.Z)("div",{target:"en6yxg33"})("width:100%;.pros-cons{ul{list-style-type:disc;list-style-position:inside;padding-left:8px;color:",d.r.colors.gray700,";}}"),z=(0,M.Z)("div",{target:"en6yxg34"})("padding:4px 6px;position:absolute;right:0px;top:0px;background:",d.r.colors.red500,";border-radius:",d.r.borderRadius,";"),AffiliateDiscountBadge=o=>{let{discount:i,multiple:l}=o,{formatMessage:d}=(0,v.Z)(),a=(0,n.useMemo)(()=>Number.isInteger(i)?i:null==i?void 0:i.toFixed(0),[i]);return i?(0,e.tZ)(z,{children:(0,e.tZ)(t.T,{size:"label2",type:"bold",color:"#ffffff",children:l?d({id:"affiliate.promotion.bestDiscount",defaultMessage:"Up to {promotionDiscount}"},{promotionDiscount:"- ".concat(a," %")}):"- ".concat(a," %")})}):null},AffiliateThumbnail=o=>{let{index:i,image:l,selected:n,onClick:t}=o;return(0,e.tZ)(P,{className:n?"active":"",onClick:()=>t(i),children:(0,e.tZ)("img",{loading:"lazy",src:l,alt:""})})},AffiliateCarousel=o=>{let{product:i,discount:l}=o,t=i.gallery||[],[d,a]=(0,n.useState)(0),[r,c]=(0,n.useState)(null),[u,v]=(0,n.useState)(null),s=(0,p.d)(),h=(0,n.useCallback)(o=>{r&&u&&u.clickAllowed()&&r.scrollTo(o)},[r,u]),g=(0,n.useCallback)(()=>{r&&u&&(a(r.selectedScrollSnap()),u.scrollTo(r.selectedScrollSnap()))},[r,u,a]);return(0,n.useEffect)(()=>{r&&(g(),r.on("select",g),r.on("reInit",g))},[r,g]),(0,e.BX)(D,{children:[(0,e.tZ)("div",{className:"carousel-main",children:(0,e.tZ)(N.a,{getEmblaApi:c,slidesToShow:1,withControls:!1,initialSlide:d,height:"100%",sx:{flex:1},draggable:t.length>1&&!s,children:t.map(o=>(0,e.tZ)(N.a.Slide,{children:(0,e.BX)("div",{style:{position:"relative"},children:[!!l&&(0,e.tZ)(AffiliateDiscountBadge,{discount:l,multiple:(null==i?void 0:i.channel.length)>1}),(0,e.tZ)("img",{loading:"lazy",src:o,alt:""})]})},o))},String(s))}),t.length>1&&(0,e.tZ)("div",{className:"carousel-thumb",children:(0,e.tZ)(N.a,{getEmblaApi:v,dragFree:!s,draggable:!s,slidesToShow:4,slideGap:8,mx:"auto",withControls:!1,children:t.map((o,i)=>(0,e.tZ)(N.a.Slide,{children:(0,e.tZ)(AffiliateThumbnail,{image:o,selected:i===d,index:i,onClick:h})},o))},String(s))})]})};var X=l("LgdP"),A=l("7Ci/"),I=l("Wgwc"),E=l.n(I),_=l("0VOb"),R=l("vnrr"),F=l("rIrU");let _DiscountInformation=o=>{var i,l,n,a,c,u;let{product:s}=o,{formatMessage:p}=(0,v.Z)();return(0,e.tZ)(A.W,{fluid:!0,p:0,children:(0,e.BX)(r.K,{spacing:16,children:[(0,e.tZ)(m.H,{tag:"h6",children:null==s?void 0:null===(n=s.channel)||void 0===n?void 0:null===(l=n[0])||void 0===l?void 0:null===(i=l.promotion)||void 0===i?void 0:i.name}),(0,e.BX)(r.K,{spacing:8,children:[(0,e.BX)(r.K,{spacing:2,children:[(0,e.tZ)(t.T,{size:"s5",type:"semiBold",color:d.r.colors.gray600,children:p({id:"affiliate.promotion.endDate",defaultMessage:"End Date"})}),(0,e.tZ)(t.T,{size:"n1",color:d.r.colors.gray500,children:E()().format(F.tD)})]}),(0,e.tZ)(C.i,{color:d.r.colors.neutral100}),(0,e.BX)(r.K,{spacing:2,children:[(0,e.tZ)(t.T,{size:"s5",type:"semiBold",color:d.r.colors.gray600,children:p({id:"affiliate.promotion.condition",defaultMessage:"Condition"})}),(0,e.tZ)(t.T,{size:"n1",color:d.r.colors.gray500,dangerouslySetInnerHTML:{__html:null==s?void 0:null===(u=s.channel)||void 0===u?void 0:null===(c=u[0])||void 0===c?void 0:null===(a=c.promotion)||void 0===a?void 0:a.description}})]})]})]})})},AffiliateDiscount=o=>{var i,l,a,r,c,u,s,p,h,g,m,f,b,Z,C;let{product:y}=o,{formatMessage:k}=(0,v.Z)(),[B,N]=(0,n.useState)(!1);return(0,e.BX)(w.k,{gap:12,mt:8,mb:16,align:"center",children:[(0,e.BX)(x.J,{opened:B,onChange:N,withinPortal:!0,offset:10,withArrow:!0,styles:{dropdown:{border:"1px solid ".concat(d.r.colors.neutral100),borderRadius:"6px",padding:"16px",paddingBottom:"24px",backgroundColor:d.r.colors.neutral50,boxShadow:"0px 16px 24px rgba(0, 0, 0, 0.06), 0px 2px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.04)"}},children:[(0,e.tZ)(x.J.Target,{children:(0,e.BX)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",onClick:()=>N(o=>!o),children:[(0,e.tZ)("path",{d:"M1.83337 8.00004C1.83337 4.59618 4.59618 1.83337 8.00004 1.83337C11.4039 1.83337 14.1667 4.59618 14.1667 8.00004C14.1667 11.4039 11.4039 14.1667 8.00004 14.1667C4.59618 14.1667 1.83337 11.4039 1.83337 8.00004Z",stroke:"#8C8C8C"}),(0,e.tZ)("path",{d:"M8.00004 11.3334C7.63337 11.3334 7.33337 11.0334 7.33337 10.6667V8.00004C7.33337 7.63337 7.63337 7.33337 8.00004 7.33337C8.36671 7.33337 8.66671 7.63337 8.66671 8.00004V10.6667C8.66671 11.0334 8.36671 11.3334 8.00004 11.3334Z",fill:"#8C8C8C"}),(0,e.tZ)("path",{d:"M8.66671 5.99996H7.33337V4.66663H8.66671V5.99996Z",fill:"#8C8C8C"})]})}),(0,e.tZ)(x.J.Dropdown,{children:(0,e.tZ)(_DiscountInformation,{product:y})})]}),(0,e.BX)(S,{children:[(0,e.BX)(t.T,{as:"span",size:"label2",color:d.r.colors.gray500,children:[k({id:"affiliate.promotion.discountCode",defaultMessage:"Discount Code"}),":"," "]}),(0,e.tZ)(t.T,{as:"span",size:"n1",color:d.r.colors.gray500,type:"bold",children:null==y?void 0:null===(a=y.channel)||void 0===a?void 0:null===(l=a[0])||void 0===l?void 0:null===(i=l.promotion)||void 0===i?void 0:i.code})]}),(0,e.tZ)(X.B,{size:"sm",color:"transparent",onClick:()=>{var o,i,l;(0,R.v)(null==y?void 0:null===(l=y.channel)||void 0===l?void 0:null===(i=l[0])||void 0===i?void 0:null===(o=i.promotion)||void 0===o?void 0:o.code,()=>{(0,_.c)({type:"success",title:"Success",message:k({id:"common.copySuccess",defaultMessage:"Link copied successfully"})}),o=>{(0,_.c)({type:"danger",message:(null==o?void 0:o.message)||"",title:k({id:"notification.comment.somethingWrong",defaultMessage:"Something went wrong."})})}})},"data-event-category":"Affiliates","data-event-action":"Copy Promotion Code","data-event-label":"".concat(null==y?void 0:null===(u=y.channel)||void 0===u?void 0:null===(c=u[0])||void 0===c?void 0:null===(r=c.promotion)||void 0===r?void 0:r.name,": ").concat(null==y?void 0:null===(h=y.channel)||void 0===h?void 0:null===(p=h[0])||void 0===p?void 0:null===(s=p.promotion)||void 0===s?void 0:s.code),"data-product-channel":null==y?void 0:null===(m=y.channel)||void 0===m?void 0:null===(g=m[0])||void 0===g?void 0:g.name,"data-product-sku":null==y?void 0:y.sku,"data-product-brand":null==y?void 0:y.brand,"data-product-name":null==y?void 0:y.postName,"data-product-price":(null==y?void 0:y.priceRange)||(null===(b=y.channel)||void 0===b?void 0:null===(f=b[0])||void 0===f?void 0:f.price),"data-product-category":null==y?void 0:null===(C=y.productCat)||void 0===C?void 0:null===(Z=C[0])||void 0===Z?void 0:Z.name,className:"pointer-event-child-none",icon:(0,e.tZ)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,e.tZ)("path",{d:"M4 2.5C3.17125 2.5 2.5 3.17125 2.5 4V13.75C2.5 14.164 2.836 14.5 3.25 14.5C3.664 14.5 4 14.164 4 13.75V4H13.75C14.164 4 14.5 3.664 14.5 3.25C14.5 2.836 14.164 2.5 13.75 2.5H4ZM7 5.5C6.17125 5.5 5.5 6.17125 5.5 7V16C5.5 16.8287 6.17125 17.5 7 17.5H16C16.8287 17.5 17.5 16.8287 17.5 16V7C17.5 6.17125 16.8287 5.5 16 5.5H7ZM7 7H16V16H7V7Z",fill:"#262626"})})})]})},_BrandName=o=>{let{brand:i}=o;return(0,e.tZ)(t.T,{size:"c2",color:d.r.colors.gray400,type:"bold",children:null==i?void 0:i.map((o,i)=>(0,e.BX)(n.Fragment,{children:[i>0&&", ",(0,e.tZ)("a",{href:null==o?void 0:o.permalink,className:"no-replace-click",target:"_blank",children:null==o?void 0:o.name},i)]},o.termId))})},L=[g.MV.Vietnam,g.MV.Indonesia],Affiliate=o=>{var i,l,g,m,f,b,w,Z,x,C,y,B,N,M,P,D,S;let{product:z,showProsCons:X=!1,position:A=0}=o,{formatMessage:I}=(0,v.Z)(),E=(0,p.d)(),{locale:_}=(0,h.h)(),R=(0,s.U)(),F=(0,n.useMemo)(()=>new Intl.NumberFormat(_,{style:"currency",currency:z.currencyUnit.code||"VND",...L.includes(_)?{minimumFractionDigits:0,maximumFractionDigits:0}:{}}),[_,null==z?void 0:null===(i=z.currencyUnit)||void 0===i?void 0:i.code]),H=Number(null==z?void 0:null===(g=z.channel)||void 0===g?void 0:null===(l=g[0])||void 0===l?void 0:l.price.replace(/[^\d]/g,"")),U=Number(null==z?void 0:null===(f=z.channel)||void 0===f?void 0:null===(m=f[0])||void 0===m?void 0:m.discount_price.replace(/[^\d]/g,"")),V=(0,n.useMemo)(()=>{var o,i;return!!(null==z?void 0:null===(i=z.channel)||void 0===i?void 0:null===(o=i[0])||void 0===o?void 0:o.discount_price)&&H>U},[null==z?void 0:null===(w=z.channel)||void 0===w?void 0:null===(b=w[0])||void 0===b?void 0:b.discount_price,H]),W=(0,n.useMemo)(()=>{if(!V||null===H)return 0;let o=z.channel.map(o=>(Number(o.price.replace(/[^\d]/g,""))-Number(o.discount_price.replace(/[^\d]/g,"")))/Number(o.price.replace(/[^\d]/g,""))*100);return Math.max(...o)},[V]),G=(0,n.useMemo)(()=>{if(W){var o,i;let l=Number(null==z?void 0:null===(i=z.channel)||void 0===i?void 0:null===(o=i[0])||void 0===o?void 0:o.discount_price);return F.format(l)}return null},[W]),O=(0,n.useMemo)(()=>{var o,i;if(!(null==z?void 0:z.priceRange.includes("~")))return null==z?void 0:z.priceRange;let l=[...null==z?void 0:null===(o=z.channel)||void 0===o?void 0:o.map(o=>Number(o.discount_price)),...null==z?void 0:null===(i=z.channel)||void 0===i?void 0:i.map(o=>Number(o.price))].filter(o=>0!==o);return"".concat(F.format(Math.min(...l))," - ").concat(F.format(Math.max(...l)))},[null==z?void 0:z.channel]);return(0,e.BX)(T,{children:[(0,e.BX)(a.M,{cols:2,"data-event-category":"Affiliates","data-event-action":"Impression","data-event-label":R,"data-product-sku":null==z?void 0:z.sku,"data-product-brand":null==z?void 0:null===(x=z.brand)||void 0===x?void 0:null===(Z=x[0])||void 0===Z?void 0:Z.name,"data-product-name":null==z?void 0:z.postName,"data-product-price":null==z?void 0:null===(y=z.channel)||void 0===y?void 0:null===(C=y[0])||void 0===C?void 0:C.price,breakpoints:[{maxWidth:"md",cols:1}],children:[(0,e.tZ)(AffiliateCarousel,{discount:W,product:z}),(0,e.BX)(r.K,{mt:E?16:0,justify:"center",children:[(0,e.BX)(r.K,{spacing:4,children:[(0,e.tZ)(_BrandName,{brand:z.brand}),(0,e.tZ)(t.T,{size:"s2",type:"semiBold",children:null==z?void 0:z.postTitle}),O&&(0,e.tZ)(k,{hasPromotion:V&&!O.includes("-"),originalPrice:O,promotionPrice:O.includes("-")?void 0:G})]}),V&&(null==z?void 0:null===(M=z.channel)||void 0===M?void 0:null===(N=M[0])||void 0===N?void 0:null===(B=N.promotion)||void 0===B?void 0:B.code)&&(0,e.tZ)(AffiliateDiscount,{product:z}),(null==z?void 0:z.channel)&&(0,e.tZ)(AffiliateButton,{product:z,mt:V&&(null==z?void 0:null===(S=z.channel)||void 0===S?void 0:null===(D=S[0])||void 0===D?void 0:null===(P=D.promotion)||void 0===P?void 0:P.code)?0:16,position:A})]})]}),X&&z.pros&&z.cons&&(0,e.tZ)(c.X,{mt:E?"md":"xl",className:"pros-cons",w:"100%",radius:"md",p:E?"md":"xl",withBorder:!0,styles:{borderColor:"#E4E8EC"},children:(0,e.BX)(u.a,{spacing:"sm",center:!0,children:[(0,e.tZ)(u.a.Item,{icon:(0,e.BX)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,e.tZ)("path",{d:"M9.99996 18.3333C14.6023 18.3333 18.3333 14.6023 18.3333 9.99996C18.3333 5.39759 14.6023 1.66663 9.99996 1.66663C5.39759 1.66663 1.66663 5.39759 1.66663 9.99996C1.66663 14.6023 5.39759 18.3333 9.99996 18.3333Z",fill:"#00B16A"}),(0,e.tZ)("path",{d:"M9.58582 12.6672C9.22968 12.6678 8.87693 12.5981 8.54776 12.4621C8.2186 12.3261 7.91949 12.1265 7.66757 11.8748L6.68611 10.8929C6.55631 10.7585 6.48449 10.5785 6.48611 10.3917C6.48773 10.2048 6.56268 10.0261 6.69479 9.89398C6.82691 9.76186 7.00563 9.68692 7.19247 9.68529C7.3793 9.68367 7.5593 9.75549 7.6937 9.8853L8.67515 10.8672C8.79368 10.9858 8.9344 11.0798 9.08927 11.1439C9.24413 11.2081 9.41012 11.2411 9.57774 11.2411C9.74537 11.2411 9.91136 11.2081 10.0662 11.1439C10.2211 11.0798 10.3618 10.9858 10.4803 10.8672L16.7035 5.2431C16.8445 5.1216 17.0274 5.06008 17.2132 5.07171C17.399 5.08334 17.5728 5.16719 17.6976 5.30534C17.8223 5.44348 17.888 5.62495 17.8807 5.81094C17.8734 5.99692 17.7936 6.17266 17.6584 6.30057L11.4594 11.8995C11.2131 12.1445 10.9207 12.3385 10.5992 12.4702C10.2777 12.602 9.93329 12.6689 9.58582 12.6672Z",fill:"white"})]}),children:(0,e.tZ)(t.T,{size:"s2",type:"semiBold",children:I({id:"affiliate.pros",defaultMessage:"Pros"})})}),(0,e.tZ)(t.T,{size:"p3",color:d.r.colors.gray700,dangerouslySetInnerHTML:{__html:z.pros||""},className:"pros-cons"}),(0,e.tZ)(u.a.Item,{icon:(0,e.BX)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[(0,e.tZ)("path",{d:"M9.99996 18.3333C14.6023 18.3333 18.3333 14.6023 18.3333 9.99996C18.3333 5.39759 14.6023 1.66663 9.99996 1.66663C5.39759 1.66663 1.66663 5.39759 1.66663 9.99996C1.66663 14.6023 5.39759 18.3333 9.99996 18.3333Z",fill:"#F44D2C"}),(0,e.tZ)("path",{d:"M13.1088 13.7501C12.9445 13.7501 12.7806 13.6875 12.6551 13.5623L6.43827 7.34524C6.18757 7.09454 6.18757 6.68861 6.43827 6.43817C6.68896 6.18773 7.0949 6.18747 7.34533 6.43817L13.5624 12.6552C13.8131 12.9059 13.8131 13.3119 13.5624 13.5623C13.4369 13.6875 13.273 13.7501 13.1088 13.7501Z",fill:"white"}),(0,e.tZ)("path",{d:"M6.89168 13.75C6.72746 13.75 6.5635 13.6874 6.43802 13.5622C6.18733 13.3115 6.18733 12.9055 6.43802 12.6551L12.6551 6.43802C12.9058 6.18733 13.3117 6.18733 13.5622 6.43802C13.8126 6.68872 13.8129 7.09465 13.5622 7.34509L7.34535 13.5622C7.22013 13.6874 7.05591 13.75 6.89168 13.75Z",fill:"white"})]}),children:(0,e.tZ)(t.T,{size:"s2",type:"semiBold",children:I({id:"affiliate.cons",defaultMessage:"Cons"})})}),(0,e.tZ)(t.T,{size:"p3",color:d.r.colors.gray700,dangerouslySetInnerHTML:{__html:z.cons||""},className:"pros-cons"})]})})]})}}}]);