"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2315],{24738:function(e,t,r){r.d(t,{T:function(){return p}});var o=r(35944);r(67294);var i=r(82248),a=r(48189),n=r(92525),l=r(90531),d=r(87379);let c=d.ZP.div.withConfig({componentId:"sc-80df87f3-0"})(["overflow:hidden;&[data-is-sidebar='true'][data-is-bottom-mobile='true']{","{order:2;}}"],l.M.tdDown),s=d.ZP.div.withConfig({componentId:"sc-80df87f3-1"})(["overflow:hidden;&[data-is-sidebar='true'][data-is-bottom-mobile='false']{","{order:-1;}}"],l.M.tdDown),u=d.ZP.div.withConfig({componentId:"sc-80df87f3-2"})(["position:relative;overflow:visible;"]),p=e=>{let{leftColumn:t,rightColumn:r,type:l="sidebar-left",sidebarWidth:d="320px",gapDesktop:p,gap:g="16px",isSidebarBottomMobile:v=!1,wrapperProps:h,customDataProps:m}=e,{isDesktop:f}=n.v.useDevice(),b="sidebar-left"===l?"".concat(d," 1fr"):"1fr ".concat(d),y=f?b:"1fr";return(0,o.tZ)(a.xu,{...h,children:r&&t?(0,o.BX)(i.G,{gridTemplateColumns:y,gridTemplateColumnsDesktop:b,gap:f&&p||g,...m,children:[(0,o.tZ)(c,{"data-is-bottom-mobile":v,"data-is-sidebar":"sidebar-left"===l,children:t}),(0,o.tZ)(s,{"data-is-bottom-mobile":v,"data-is-sidebar":"sidebar-right"===l,children:r})]}):(0,o.tZ)(u,{...m,children:r||t||(0,o.tZ)(o.HY,{})})})}},79512:function(e,t,r){r.d(t,{O:function(){return d},W:function(){return c}});var o=r(35944);r(67294);var i=r(43967),a=r(48189),n=r(76318);let l=r(87379).ZP.div.withConfig({componentId:"sc-ee959cfc-0"})([""]),d=e=>{let{customDataProps:t,wrapperProps:r,pages:n=[],...d}=e,s=c(n);return(0,o.tZ)(a.xu,{...r,children:(0,o.tZ)(l,{...t,children:(0,o.tZ)(i.B,{...d,pages:s})})})},c=e=>{let t=(0,n.U)();return e.map(e=>({dataEventCategory:"Ecommerce",dataEventAction:"Breadcrumb Click",dataEventLabel:t,...e}))}},36289:function(e,t,r){r.d(t,{Di:function(){return l},JZ:function(){return v},K3:function(){return s},LC:function(){return u},LY:function(){return c},pS:function(){return g},vZ:function(){return p},wy:function(){return d}});var o=r(90531),i=r(6888),a=r(87379),n=r(58370);let l=a.ZP.div.withConfig({componentId:"sc-d1ed113f-0"})(["padding-bottom:40px;background:#f8f9fc;","{padding-bottom:24px;}","{background:",";}.category-page-banners{margin-bottom:16px;background:white;","{padding:16px;}}.category-page-best-sellers{margin-bottom:16px;","{margin-bottom:0;}}.category-page-product-list{margin-bottom:16px;","{padding:16px;}","{margin-bottom:8px;}","{padding:16px 24px;}}"],o.M.tdDown,o.M.tdUp,e=>{let{theme:t}=e;return t.colors.neutral50},o.M.tdDown,o.M.tdDown,o.M.mbDown,o.M.tdDown,o.M.tdOnly),d=a.ZP.div.withConfig({componentId:"sc-d1ed113f-1"})(["background:white;border-radius:4px;padding:20px;margin-bottom:16px;","{margin-bottom:8px;}&[data-top-bar]{display:flex;padding:16px 20px;justify-content:space-between;align-items:center;.brand-top-bar-image{margin:-16px 16px -16px 0;height:64px;object-fit:contain;width:unset;}}"],o.M.tdDown),c=a.ZP.div.withConfig({componentId:"sc-d1ed113f-2"})(["padding:0 16px;margin-bottom:16px;display:flex;align-items:center;img{height:64px;object-fit:contain;width:unset;margin-right:16px;}"]);a.ZP.div.withConfig({componentId:"sc-d1ed113f-3"})(["display:flex;margin-top:16px;flex-wrap:wrap;gap:8px;"]);let s=a.ZP.div.withConfig({componentId:"sc-d1ed113f-4"})(["line-height:1.7;"]),u=(0,a.ZP)(i.D).withConfig({componentId:"sc-d1ed113f-5"})(["z-index:"," !important;border:none !important;background-position:right 0 center !important;display:flex;align-items:center;> div{padding-top:0;padding-bottom:0;padding-left:0;font-weight:600;font-size:14px;line-height:24px;color:",";}> ul{font-size:14px;line-height:24px;width:max-content;max-width:300px;left:unset;right:0;li[data-selected='true']{font-weight:600;}li{display:flex;align-items:center;gap:8px;}","{left:0;}}"],n.v3.zIndexes.dropdown,e=>{let{theme:t}=e;return t.colors.gray600},o.M.tdDown),p=a.ZP.div.withConfig({componentId:"sc-d1ed113f-6"})(["display:flex;justify-content:space-between;margin-top:8px;background:",";.category-page-filter-button{&[data-color='ghost']{color:",";}}padding:12px 24px 0;","{padding:12px 16px;}"],e=>{let{theme:t}=e;return t.colors.neutral50},e=>{let{theme:t}=e;return t.colors.gray600},o.M.mbDown),g=a.ZP.div.withConfig({componentId:"sc-d1ed113f-7"})(["display:flex;justify-content:space-between;padding:12px 24px;background:",";","{padding:12px 16px;}"],e=>{let{theme:t}=e;return t.colors.neutral50},o.M.mbDown),v=a.ZP.div.withConfig({componentId:"sc-d1ed113f-8"})(["padding:16px;","{background:transparent;padding-left:0;padding-right:0;}","{padding:0 24px 16px;}"],o.M.tdUp,o.M.tdOnly)},4176:function(e,t,r){r.d(t,{N:function(){return k}});var o=r(35944),i=r(67294),a=r(48189),n=r(24738),l=r(78160),d=r(79512),c=r(34461);let s=(0,r(87379).ZP)(a.xu).withConfig({componentId:"sc-579700-0"})(["width:100%;padding:16px 0;top:48px;left:0;border-radius:8px;background-color:",";transform:appears 0.5s;box-shadow:0px 8px 40px rgba(0,0,0,0.1);"],e=>e.theme.colors.white),u=e=>{let{wrapperProps:t,categories:r,onSelect:n,defaultSelectedCategory:d}=e,[u,p]=(0,i.useState)(d),g=c.D.useTranslation(),v=e=>{p(e),n(e)},h=e=>{e.id===(null==u?void 0:u.id)?p(void 0):p(e)};return(0,o.BX)(s,{...t,children:[(0,o.tZ)(a.xv,{size:"s3",colour:"gray400",customDataProps:{style:{display:"block",padding:"0 16px 8px 16px",textTransform:"uppercase"}},children:g({id:"navigation.bottom.categories",defaultMessage:"DANH MỤC"})}),(0,o.tZ)(a.xu,{children:r.map((e,t)=>{var r;return(0,o.BX)(i.Fragment,{children:[(0,o.tZ)(l.pB,{category:e,isParentCategory:!0,isSelected:(null==u?void 0:u.id)===e.id,isExpanded:(null==u?void 0:u.parentId)===e.id,onSelect:v,onExpanding:h}),(0,o.tZ)(a.xu,{customDataProps:{style:{maxHeight:(null==u?void 0:u.id)===e.id||(null==u?void 0:u.parentId)===e.id?"100vh":"0",overflow:"hidden",transition:"max-height .5s ease-in-out",paddingRight:8}},children:null===(r=e.children)||void 0===r?void 0:r.map((e,t)=>(0,o.tZ)(l.pB,{category:e,isParentCategory:!1,isExpanded:!1,isSelected:(null==u?void 0:u.id)===e.id,onSelect:v},"product-child-category-"+e.id+"-"+t))})]},"product-category-"+e.id+"-"+t)})})]})};var p=r(54015),g=r(30074),v=r(85934),h=r(76318),m=r(40776),f=r(37280),b=r(15038),y=r(90143),w=r(92525),x=r(330),P=r(48119),Z=r(30409),S=r(36289),D=r(29419);let C={discount:{type:"discount_percent",order:"desc"},priceIncrease:{type:"price",order:"asc"},priceDecrease:{type:"price",order:"desc"},dateDecrease:{type:"updated_at",order:"desc"},dateIncrease:{type:"updated_at",order:"asc"}},_={page:"1",sort_type:"discount_percent",sort_order:"desc"},k=e=>{var t,r,s,k;let{categoryPage:I,brandPage:B,defaultProductFilter:M,defaultProductsListing:E,defaultProductsListingPagination:T,defaultProductsSort:N}=e,R=(0,i.useRef)(null),L=(0,h.U)(),{slug:A,description:z,banners:q,image:X,name:O}=I?{...I,image:""}:B,{categories:H=[]}=b.f.useNavigationContext(),{isMobile:U,isMobileCsr:j,isDesktop:F}=w.v.useDevice(),G=y.z.useRouter(),K=c.D.useTranslation(),[V,Y]=(0,i.useState)((null==I?void 0:I.id)||0),[W,$]=(0,i.useState)([]);(0,i.useEffect)(()=>{A&&(null==I?void 0:I.id)?v.lu.getCategoryBestsellerProducts(A).then(e=>{var t,r;$((null==e?void 0:null===(r=e.data)||void 0===r?void 0:null===(t=r.items)||void 0===t?void 0:t.map(f.l.formatProduct).filter(x.$K))||[])}):A&&(null==B?void 0:B.id)&&v.lu.getBrandBestsellerProducts(A).then(e=>{var t,r;$((null==e?void 0:null===(r=e.data)||void 0===r?void 0:null===(t=r.items)||void 0===t?void 0:t.map(f.l.formatProduct).filter(x.$K))||[])})},[A,null==I?void 0:I.id,null==B?void 0:B.id]);let J=I?(0,D.G)(H,I.id):[],Q=I?[{label:K({id:"breadcrumb.home",defaultMessage:"Trang chủ"}),value:y.z.getNewRelativeURL("","shop").toString()},...J.map(e=>({label:e.name,value:y.z.getLocalisedUrl(e.fullSlug||e.slug,"CATEGORY").toString()}))]:[{label:K({id:"breadcrumb.home",defaultMessage:"Trang chủ"}),value:y.z.getNewRelativeURL("","shop").toString()},{label:K({id:"breadcrumb.brands",defaultMessage:"Thương hiệu"}),value:y.z.getLocalisedUrl("","BRAND").toString()},{label:O,value:y.z.getLocalisedUrl("".concat(A),"BRAND").toString()}],ee=J.slice(-1)[0],et=J.slice(-2)[0],er=J[0],eo=null!==(k=(null==ee?void 0:null===(t=ee.children)||void 0===t?void 0:t.length)?ee.children:null==et?void 0:et.children)&&void 0!==k?k:[],ei=[{label:K({id:"categoryPage.sort.discount",defaultMessage:"Giảm gi\xe1 nhiều nhất"}),value:"discount"},{label:K({id:"categoryPage.sort.priceIncrease",defaultMessage:"Gi\xe1 tăng dần"}),value:"priceIncrease"},{label:K({id:"categoryPage.sort.priceDecrease",defaultMessage:"Gi\xe1 giảm dần"}),value:"priceDecrease"},{label:K({id:"categoryPage.sort.newest",defaultMessage:"Mới nhất"}),value:"dateDecrease"},{label:K({id:"categoryPage.sort.oldest",defaultMessage:"Cũ nhất"}),value:"dateIncrease"}],[ea,en]=(0,i.useState)(()=>(null==N?void 0:N.type)?ei.find(e=>C[e.value].type===(null==N?void 0:N.type)&&(!N.order||C[e.value].order===N.order))||ei[0]:ei.find(e=>C[e.value].type===(null==_?void 0:_.sort_type)&&C[e.value].order===(null==_?void 0:_.sort_order))||ei[0]),[el,ed]=(0,i.useState)(!1),[ec,es]=(0,i.useState)(M||{priceRange:["",""],brandIds:[],ratings:[],categoryIds:[],affiliates:[]}),[eu,ep]=(0,i.useState)((null==T?void 0:T.current)&&(null==E?void 0:E.length)?Array(T.current).fill(null).map((e,t)=>t===((null==T?void 0:T.current)||1)-1&&E||[]):E?[E]:[]),[eg,ev]=(0,i.useState)(T||{prev:0,current:0,next:1,last:1,itemsPerPage:16}),[eh,em]=(0,i.useState)(!1),ef=async e=>{let{filterData:t,sortData:r,page:o=1,perPage:i=48,forceCategory:a}=e;em(!0);try{var n,l,d,c,s,u,p;let e=await v.AP.getProductsList({page:o,perPage:i,sortBy:(null==r?void 0:r.type)||_.sort_type,sortOrder:(null==r?void 0:r.order)||_.sort_order,categoryIds:I&&!a?[V]:null==t?void 0:t.categoryIds,brandIds:B?[B.id]:null==t?void 0:t.brandIds,minPrice:null==t?void 0:null===(n=t.priceRange)||void 0===n?void 0:n[0],maxPrice:null==t?void 0:null===(l=t.priceRange)||void 0===l?void 0:l[1],channel:null==t?void 0:t.affiliates}),g=(null==e?void 0:null===(c=e.data)||void 0===c?void 0:null===(d=c.products)||void 0===d?void 0:d.map(f.l.formatProduct).filter(x.$K))||[];o<=1?(null==e?void 0:null===(u=e.data)||void 0===u?void 0:u.products)&&ep([g]):(null==e?void 0:null===(p=e.data)||void 0===p?void 0:p.products)&&ep(t=>{var r,o,i;return(null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.products)&&(t[((null==e?void 0:null===(i=e.data)||void 0===i?void 0:null===(o=i.pagination)||void 0===o?void 0:o.current)||1)-1]=g),t.slice()});let h=(null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.pagination)?f.l.formatPagination(e.data.pagination):null;return h&&ev(h),null==e?void 0:e.data}catch(e){}finally{em(!1)}};(0,i.useEffect)(()=>{eu.length||0!==eg.current||ef({page:1,filterData:ec,sortData:C[ea.value]})},[]);let eb=(0,i.useRef)(U),ey=(0,i.useRef)(!1);(0,i.useEffect)(()=>{(!eb.current&&U||!F===j&&!ey.current&&U)&&(1!==eg.current&&ef({page:1,filterData:ec,sortData:C[ea.value]}),ey.current=!0),eb.current=U},[U,j]),(0,i.useEffect)(()=>{var e,t,r,o,i;ex({page:eg.current,sort_type:C[ea.value].type,sort_order:C[ea.value].order,category_ids:(null==ec?void 0:null===(e=ec.categoryIds)||void 0===e?void 0:e.join(","))||"",brand_ids:(null==ec?void 0:null===(t=ec.brandIds)||void 0===t?void 0:t.join(","))||"",min_price:(null==ec?void 0:null===(r=ec.priceRange)||void 0===r?void 0:r[0])||"",max_price:(null==ec?void 0:null===(o=ec.priceRange)||void 0===o?void 0:o[1])||"",channel:(null==ec?void 0:null===(i=ec.affiliates)||void 0===i?void 0:i.join(","))||""})},[ea,ec,eg.current]);let ew=(0,i.useRef)(!0);(0,i.useEffect)(()=>{ew.current?ew.current=!1:ef({page:1,filterData:ec,sortData:C[ea.value]})},[ea,ec]);let ex=e=>{let t=e=>(Object.keys(e).forEach(t=>{e[t]||delete e[t]}),e),r=t({page:G.query.page?String(G.query.page):_.page,sort_type:G.query.sort_type?String(G.query.sort_type):_.sort_type,sort_order:G.query.sort_order?String(G.query.sort_order):_.sort_order,category_ids:G.query.category_ids?String(G.query.category_ids):"",brand_ids:G.query.brand_ids?String(G.query.brand_ids):"",min_price:G.query.min_price?String(G.query.min_price):"",max_price:G.query.max_price?String(G.query.max_price):"",channel:G.query.channel?String(G.query.channel):""}),o=t({page:e.page?String(e.page):_.page,sort_type:e.sort_type||_.sort_type,sort_order:e.sort_order||_.sort_order,category_ids:e.category_ids||"",brand_ids:e.brand_ids||"",min_price:e.min_price||"",max_price:e.max_price||"",channel:e.channel||""});(Object.keys(o).some(e=>o[e]!==r[e])||Object.keys(r).some(e=>r[e]!==o[e]))&&G.replace({pathname:G.pathname,query:{slug:G.query.slug,...o}},void 0,{shallow:!0})};return(0,m.g)(),(0,i.useEffect)(()=>{if((null==I?void 0:I.id)&&(null==E?void 0:E.length)===0){var e,t;let r=null===(t=J[J.length-1])||void 0===t?void 0:null===(e=t.children)||void 0===e?void 0:e[0];(null==r?void 0:r.id)&&(async()=>{var e,t,o,i;let a=await ef({page:1,filterData:{...ec,categoryIds:[r.id]},sortData:C[ea.value],forceCategory:!0});if(null==a?void 0:null===(e=a.products)||void 0===e?void 0:e.length)Y(r.id);else if(null===(o=r.children)||void 0===o?void 0:null===(t=o[0])||void 0===t?void 0:t.id){let e=await ef({page:1,filterData:{...ec,categoryIds:[r.children[0].id]},sortData:C[ea.value],forceCategory:!0});(null==e?void 0:null===(i=e.products)||void 0===i?void 0:i.length)&&Y(r.children[0].id)}})()}},[I,E]),(0,o.BX)(S.Di,{children:[(0,o.tZ)("div",{className:"page-breadcrumbs-wrapper",children:(0,o.tZ)(a.EW,{isDesktopPadding:!0,children:(0,o.tZ)(d.O,{size:"md",pages:Q})})}),(0,o.tZ)(a.EW,{isDesktopPadding:!0,noGutter:!F,children:(0,o.tZ)(n.T,{leftColumn:F?(0,o.BX)(o.HY,{children:[I&&(0,o.tZ)(u,{wrapperProps:{display:{margin:"0 0 12px"}},categories:(null==er?void 0:er.children)||[],onSelect:e=>{G.push(y.z.getLocalisedUrl(e.fullSlug,"CATEGORY"))},defaultSelectedCategory:ee},I.id),(0,o.tZ)(p.k7,{brands:B?void 0:(null==I?void 0:null===(r=I.brands)||void 0===r?void 0:r.map(e=>({name:e.name,id:Number(e.id)})))||[],categories:B?H:void 0,defaultFilterData:M,onApplyFilter:e=>{var t;null===(t=R.current)||void 0===t||t.scrollIntoView({behavior:"smooth"}),es(e),ed(!1)},hideAffiliates:!0})]}):void 0,rightColumn:(0,o.BX)(o.HY,{children:[F&&I&&(0,o.BX)(S.wy,{"data-top-bar":!0,children:[(0,o.tZ)(a.xv,{size:"s2",as:"h1",weight:"semi-bold",colour:"secondaryBase",children:O}),(0,o.tZ)(S.LC,{options:ei,placeholder:" ",id:"sort-dropdown",value:ea,onChange:e=>{var t;null===(t=R.current)||void 0===t||t.scrollIntoView({behavior:"smooth"}),en({label:String(e.label),value:String(e.value)})},dropdownLabelTrackingAttributes:{"data-event-category":"Ecommerce","data-event-action":"Filter Shortcut Click","data-event-label":L,"data-event-keyword":ea.label}})]}),!F&&B&&(0,o.BX)(S.LY,{children:[X&&(0,o.tZ)(a.E9,{src:X,alt:O}),(0,o.tZ)(a.X6,{tag:"h1",weight:"bold",colour:"secondaryDark",children:O})]}),!F&&I&&(0,o.tZ)(S.pS,{children:(0,o.tZ)(S.LC,{options:[{label:K({id:"categoryPage.category.all",defaultMessage:"Tất cả danh mục"}),value:null==et?void 0:et.fullSlug},...(null==eo?void 0:eo.map(e=>({label:e.name||"",value:e.fullSlug||"",icon:e.logo?(0,o.tZ)(a.E9,{style:{width:24,height:24,objectFit:"cover"},src:e.logo,alt:e.name}):void 0})))||[]],placeholder:" ",id:"category-dropdown",value:{label:"Xem th\xeam ".concat(eo.length," danh mục"),value:(null==ee?void 0:ee.fullSlug)||""},onChange:e=>{G.push(y.z.getLocalisedUrl(String(null==e?void 0:e.value),"CATEGORY"))},dropdownLabelTrackingAttributes:{"data-event-category":"Ecommerce","data-event-action":"Category Navigation Click","data-event-label":L},style:{zIndex:17}})}),!!(null==q?void 0:q.length)&&(0,o.tZ)(l.qh,{wrapperProps:{className:"category-page-banners"},items:q.map((e,t)=>({image:(U?e.mobileImage||e.featuredImage:e.featuredImage||e.mobileImage)||"",alt:e.alt||"category banner ".concat(t+1),link:e.url})),autoScrollTime:6e3,showEdgeArrow:!0},U?"mobile":"desktop"),!!(null==W?void 0:W.length)&&(0,o.tZ)(S.JZ,{children:(0,o.tZ)(g.N,{customDataProps:{className:"category-page-best-sellers"},productRegion:"Best Seller",background:{colour:"red50"},heading:(0,o.tZ)(g.N.Header,{colour:"red700",children:K({id:"category.bestSellers.title",defaultMessage:"\uD83D\uDD25 B\xc1N CHẠY NHẤT"})}),slideButton:{colour:"red700"},itemsPerPage:U?2:4,showSlideArrow:!U,children:W.map((e,t)=>(0,o.tZ)(g.A,{product:e,customDataProps:{"data-product-region":"Best Seller"}},t))})}),!F&&(0,o.BX)(S.vZ,{children:[(0,o.tZ)(S.LC,{options:ei,placeholder:" ",id:"sort-dropdown",value:ea,onChange:e=>{var t;null===(t=R.current)||void 0===t||t.scrollIntoView({behavior:"smooth"}),en({label:String(e.label),value:String(e.value)})},dropdownLabelTrackingAttributes:{"data-event-category":"Ecommerce","data-event-action":"Filter Shortcut Click","data-event-label":L,"data-event-keyword":ea.label}}),(0,o.tZ)(a.zx,{size:"sm",color:"ghost",icon:(0,o.tZ)(Z.Z,{style:{width:18,height:18}}),customDataProps:{className:"category-page-filter-button"},onClick:()=>ed(!0),children:K({id:"categoryPage.sort.filter",defaultMessage:"Bộ Lọc"})})]}),F&&B&&(0,o.BX)(S.wy,{"data-top-bar":!0,children:[(0,o.BX)("div",{style:{display:"flex"},children:[X&&(0,o.tZ)(a.E9,{className:"brand-top-bar-image",src:X,alt:O}),(0,o.tZ)(a.xv,{size:"s2",as:"h1",weight:"semi-bold",colour:"secondaryBase",children:O})]}),(0,o.tZ)(S.LC,{options:ei,placeholder:" ",id:"sort-dropdown",value:ea,onChange:e=>en({label:String(e.label),value:String(e.value)}),dropdownLabelTrackingAttributes:{"data-event-category":"Ecommerce","data-event-action":"Filter Shortcut Click","data-event-label":L,"data-event-keyword":ea.label}})]}),(0,o.tZ)("div",{ref:R,style:{scrollMarginTop:U?120:210}}),(0,o.tZ)(P.K,{customDataProps:{className:"category-page-product-list"},items:(U?eu.reduce((e,t)=>e.concat(t),[]):eu[(eg.current||1)-1])||[],pagination:eg,onPageChange:e=>{if(e!==eg.current){var t;eb.current||null===(t=R.current)||void 0===t||t.scrollIntoView({behavior:"smooth"}),ef({page:e,filterData:ec,sortData:C[ea.value]})}},isInfinityScroll:U,isLoading:eh}),z&&(0,o.tZ)(S.wy,{children:(0,o.tZ)(S.K3,{dangerouslySetInnerHTML:{__html:z}})})]})})}),(0,o.tZ)(p.TS,{isOpen:el,onClose:()=>ed(!1),brands:B?void 0:(null==I?void 0:null===(s=I.brands)||void 0===s?void 0:s.map(e=>({name:e.name,id:Number(e.id)})))||[],categories:B?H:void 0,defaultFilterData:M,onApplyFilter:e=>{var t;null===(t=R.current)||void 0===t||t.scrollIntoView({behavior:"smooth"}),es(e),ed(!1)},hideAffiliates:!0})]})}},29419:function(e,t,r){r.d(t,{G:function(){return o},H:function(){return i}});let o=(e,t)=>{let r=e.find(e=>e.id===t);if(r)return[r];{let r=[];return e.some(e=>{var i;if(null===(i=e.children)||void 0===i?void 0:i.length){let i=o(e.children,t);if(null==i?void 0:i.length)return r=[e,...i],!0}return!1}),r}},i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(3===t)return[e];{var r;let o=[];return null===(r=e.children)||void 0===r||r.forEach(e=>{let r=i(e,t+1);(null==r?void 0:r.length)&&(o=[...o,...r])}),o}}},48119:function(e,t,r){r.d(t,{K:function(){return p}});var o=r(35944);r(67294);var i=r(37065),a=r(48189),n=r(98911),l=r(58370),d=r(90531),c=r(87379);let s=c.ZP.div.withConfig({componentId:"sc-d8488ade-0"})(["display:flex;flex-direction:column;align-items:center;border-top-left-radius:12px;border-top-right-radius:12px;background:",";","{padding:16px;}","{border-radius:0;}.category-product-seemore{margin-top:16px;}.category-product-pagination{margin-top:16px;","{width:100%;}}&[data-loading='true']{.category-product-seemore{pointer-events:none;}.category-product-pagination{pointer-events:none;}}"],e=>{let{theme:t}=e;return t.colors.neutral50},d.M.mbDown,d.M.tdUp,d.M.mbDown),u=c.ZP.div.withConfig({componentId:"sc-d8488ade-1"})(["display:grid;grid-gap:16px;grid-template-columns:repeat(5,1fr);justify-content:space-between;overflow:hidden;width:100%;position:relative;&[data-loading='true']{opacity:0.7;}.category-product-loading{position:absolute;top:min(50%,800px);left:50%;transform:translate(-50%,-50%);}","{grid-template-columns:repeat(2,1fr);}"],d.M.mbDown),p=e=>{let{customDataProps:t,items:r,pagination:d,onPageChange:c,isInfinityScroll:p,isLoading:g}=e,v=l.D1.useTranslation(),h=(null==d?void 0:d.current)||1,m=p?r:r.slice(0,(null==d?void 0:d.itemsPerPage)||16);return(0,o.BX)(s,{"data-loading":!!g,...t,children:[(0,o.BX)(u,{"data-loading":!!g,children:[m.map((e,t)=>(0,o.tZ)(n.I,{size:"100%",product:e,customDataProps:{"data-product-region":"Product Listing",style:{height:"100%"}}},e.slug+"-"+t)),g&&(0,o.tZ)(a.zx,{className:"category-product-loading",size:"lg",isLoading:!0,color:"ghost"})]}),p?h<((null==d?void 0:d.last)||0)&&(0,o.tZ)(a.zx,{className:"category-product-seemore",size:"md",color:"secondary",onClick:()=>!g&&(null==c?void 0:c(h+1)),children:v({id:"common.seeMore",defaultMessage:"Xem th\xeam"})}):d?(0,o.tZ)(i.t,{className:"category-product-pagination",total:(null==d?void 0:d.last)||1,value:h,onChange:e=>!g&&(null==c?void 0:c(e))}):null]})}},75713:function(e,t,r){r.d(t,{o:function(){return d}});var o=r(35944);r(67294);var i=r(11163),a=r(3527),n=r(58370),l=r(9268);let d=e=>{let{children:t,pageTitle:r,SEOData:d,customHead:c}=e,{locale:s="vi-VN"}=(0,i.useRouter)(),{isDesktop:u}=n.v3.useDevice(),p=(0,a.x)();return(0,o.tZ)(l._,{locale:s,showStickyBottomMenu:!1,headerProps:{topBarProps:{backProps:{visible:!0,onClick:p},titleProps:{visible:!0,content:r},cartProps:{visible:!0},searchProps:{visible:!0},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:u},SEOData:d,customHead:c,children:t})}},804:function(e,t,r){r.d(t,{ql:function(){return s},o2:function(){return a.o},_2:function(){return o._},Xg:function(){return i.X},oc:function(){return u}});var o=r(9268),i=r(10877),a=r(75713),n=r(35944);r(67294);var l=r(11163),d=r(3527),c=r(58370);let s=e=>{let{children:t,pageTitle:r,SEOData:i,customHead:a}=e,{locale:s="vi-VN"}=(0,l.useRouter)(),{isDesktop:u}=c.v3.useDevice(),p=(0,d.x)();return(0,n.tZ)(o._,{locale:s,showStickyBottomMenu:!1,headerProps:{topBarProps:{backProps:{visible:!0,onClick:p},titleProps:{visible:!0,content:r},cartProps:{visible:!0},searchProps:{visible:!0},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:u},SEOData:i,customHead:a,children:t})},u=e=>{let{children:t,pageTitle:r,SEOData:i,customHead:a,onBack:d}=e,{locale:s="vi-VN"}=(0,l.useRouter)(),{isDesktop:u}=c.v3.useDevice();return(0,n.tZ)(o._,{locale:s,headerProps:{topBarProps:{backProps:{visible:!0,onClick:d},titleProps:{visible:!0,content:r},cartProps:{visible:!1},searchProps:{visible:!1},rightKebabProps:{visible:!0},hasBorder:!0},showSearchBar:u},SEOData:i,customHead:a,showStickyBottomMenu:!0,bottomBarProps:{defaultMenuItemType:"profile"},children:t})}},10877:function(e,t,r){r.d(t,{X:function(){return d}});var o=r(35944);r(67294);var i=r(11163),a=r(48189),n=r(58370),l=r(9268);let d=e=>{let{children:t,pageTitle:r,SEOData:d,customHead:c,bottomMenuDefault:s}=e,{locale:u="vi-VN"}=(0,i.useRouter)(),{isMobile:p}=n.v3.useDevice();return(0,o.tZ)(l._,{locale:u,showStickyBottomMenu:!0,headerProps:{logoComponent:p&&r?(0,o.tZ)(a.X6,{tag:"h5",as:"h1",weight:"bold",wordWrap:"none",children:r}):void 0},bottomBarProps:{defaultMenuItemType:s},SEOData:d,customHead:c,children:t})}},3527:function(e,t,r){r.d(t,{x:function(){return n}});var o=r(67294),i=r(11163),a=r(58370);let n=()=>{let e=(0,i.useRouter)(),{back:t}=e,r=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{let e=()=>{r.current=!0};return window.addEventListener("beforeunload",e),()=>{r.current=!0,window.removeEventListener("beforeunload",e)}},[]),(0,o.useEffect)(()=>{r.current=!0,setTimeout(()=>{r.current=!1},700)},[e.asPath]),()=>{t(),setTimeout(()=>{r.current||e.push(a.zM.getNewRelativeURL("","shop").toString())},500)}}},40776:function(e,t,r){r.d(t,{g:function(){return a}});var o=r(67294),i=r(76318);let a=()=>{let e=(0,i.U)();(0,o.useEffect)(()=>{let t=null,r=()=>{let o=document.querySelector("#sort-dropdown");if(!o){t=setTimeout(()=>{r()},2e3);return}o.querySelectorAll("li").forEach(t=>{var r;t.hasAttribute("data-event-category")||(t.setAttribute("data-event-category","Ecommerce"),t.setAttribute("data-event-action","Filter Shortcut Click"),t.setAttribute("data-event-label",e),t.setAttribute("data-event-keyword",(null===(r=t.textContent)||void 0===r?void 0:r.replace(/\s/g,""))||""))}),t=setTimeout(()=>{r()},2e3)};return r(),()=>{t&&clearTimeout(t)}},[])}}}]);