(this["webpackJsonp6th-street"]=this["webpackJsonp6th-street"]||[]).push([[102],{1069:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s}));var r=n(147);const a=e=>r.a.get("brands"+"?name=".concat(encodeURIComponent(e)))||{},s=()=>r.a.get("brands")||{}},1624:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(11);const a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=t?"#":"0-9";return e.reduce((e,a)=>{const{name:s,name_ar:o}=a;let i="";var d,c;Object(r.h)()&&!t?i=Number.isNaN(+o[0])?null===(d=o[0])||void 0===d?void 0:d.toUpperCase():n:i=Number.isNaN(+s[0])?null===(c=s[0])||void 0===c?void 0:c.toUpperCase():n;return e[i]||(e[i]=[]),e[i].push(a),e},{})}},1956:function(e,t,n){"use strict";(function(e,r){var a=n(1),s=n(14),o=n(21),i=n(1957),d=(n(71),n(145)),c=n(72),l=n(50),u=n(43),p=n(15),h=n(26),b=n(1624),m=n(42),y=n(11),g=n(25),B=n(16),v=n(90),f=n(1069),C=n(143),k=n(79),O=n(2346);const L=n.e(5).then(n.bind(null,444));var R=n(13).checkBEMProps;class S extends a.PureComponent{constructor(){super(...arguments),this.state={brands:[],isLoading:!0,brandMapping:[],isArabic:Object(y.h)(),type:"",brandWidgetData:[]},this.containerFunctions={changeBrandType:this.changeBrandType.bind(this)},this.getGenderInAR=e=>{switch(e){case"men":return"\u0631\u062c\u0627\u0644";case"women":return"\u0646\u0633\u0627\u0621";case"kids":return"\u0623\u0637\u0641\u0627\u0644";case"Girl":return"\u0628\u0646\u0627\u062a";case"Boy":return"\u0623\u0648\u0644\u0627\u062f"}},this.getGenderInEn=e=>{switch(e){case"\u0631\u062c\u0627\u0644":return"men";case"\u0646\u0633\u0627\u0621":return"women";case"\u0623\u0637\u0641\u0627\u0644":return"kids";case"\u0628\u0646\u0627\u062a":return"Girl";case"\u0623\u0648\u0644\u0627\u062f":return"Boy"}},this.setLastTapItem=e=>{this.props.setLastTapItemOnHome(e)},this.containerProps=()=>{const{brands:e,isLoading:t,brandMapping:n,type:r,brandWidgetData:a=[]}=this.state;return{brands:e,isLoading:t,brandMapping:n,type:r,brandWidgetData:a}}}componentDidMount(){const{isArabic:e}=this.state,{location:t,history:n}=this.props;let r="";r="/shop-by-brands"==t.pathname?"":t.pathname.split("/")[1];const a=e?this.getGenderInAR(r):r,s=e?"".concat(this.getGenderInAR("Boy"),",").concat(this.getGenderInAR("Girl")):"Boy,Girl";this.setState({type:a}),this.requestShopByBrandWidgetData(r),this.requestShopbyBrands("kids"===r?s:a),this.updateBreadcrumbs(),this.updateHeaderState(),this.setMetaData()}getDevicePrefix(){return B.a.any()?"m/":"d/"}async requestShopByBrandWidgetData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{isArabic:t}=this.state;let n=e;""==e&&(n="all");const r=this.getDevicePrefix();if(n)try{const e=await Object(v.a)(d.b,{$FILE_NAME:"".concat(r).concat(n,"_shop_by_brand.json")});Array.isArray(e)?this.setState({brandWidgetData:e||[]}):this.setState({brandWidgetData:[]})}catch(a){this.setState({brandWidgetData:[]}),console.error(a)}else this.setState({brandWidgetData:[]})}updateHeaderState(){const{changeHeaderState:e}=this.props;e({name:k.a,isHiddenOnMobile:!0})}updateBreadcrumbs(){const{updateBreadcrumbs:t}=this.props;t([{url:"",name:e("Shop by Brands")},{url:"/",name:e("Home")}])}changeBrandType(e){const{location:t,history:n}=this.props,{isArabic:r}=this.state,a=i.c.includes(e)?e:"";let s=r?this.getGenderInEn(a):a;const o=r?"".concat(this.getGenderInAR("Boy"),",").concat(this.getGenderInAR("Girl")):"Boy,Girl";s?n.push("/".concat(s,"/shop-by-brands")):n.push("/shop-by-brands"),this.requestShopByBrandWidgetData(s),this.requestShopbyBrands("kids"===e||"\u0623\u0637\u0641\u0627\u0644"===e?o:a),this.setState({type:a})}async requestShopbyBrands(e){try{const t=await this.requestBrands(e);Object(f.a)().then(e=>{const n=Object(b.a)(e.result)||{},r=Object.entries(n).sort((e,t)=>{let[n]=e,[r]=t;return"0-9"===n?1:"0-9"===r?-1:n!==r?n<r?-1:1:void 0}),a=[];r.map(e=>{let n=[],r=[];Object.values(e[1]).filter(e=>{const{name:r,name_ar:a}=e;(t.includes(r)||t.includes(a))&&n.push(e)}),n.length>0&&(r.push(e[0]),r.push(n),a.push(r))}),this.setState({brands:a,isLoading:!1})})}catch(t){this.setState({brands:[]}),console.error(t)}}async requestBrands(e){const{showErrorNotification:t}=this.props;return this.setState({isLoading:!0}),(new m.a).getBrands(e).then(e=>e).catch(e=>t(e))}setMetaData(){const{setMeta:t}=this.props;t({title:e("Brands | %s",C.a.displayName),keywords:e("brands"),description:"QA"===Object(g.g)()?e("Buy & Explore your favourite brands \u272f Free Receiving \u272f Cash On Receiving \u272f 100% original brands | %s.",C.a.displayName):e("Buy & Explore your favourite brands \u272f Free delivery \u272f Cash On Delivery \u272f 100% original brands | %s.",C.a.displayName),twitter_title:e("Brands | %s",C.a.displayName),twitter_desc:"QA"===Object(g.g)()?e("Buy & Explore your favourite brands \u272f Free Receiving \u272f Cash On Receiving \u272f 100% original brands | %s.",C.a.displayName):e("Buy & Explore your favourite brands \u272f Free delivery \u272f Cash On Delivery \u272f 100% original brands | %s.",C.a.displayName),og_title:e("Brands | %s",C.a.displayName),og_desc:"QA"===Object(g.g)()?e("Buy & Explore your favourite brands \u272f Free Receiving \u272f Cash On Receiving \u272f 100% original brands | %s.",C.a.displayName):e("Buy & Explore your favourite brands \u272f Free delivery \u272f Cash On Delivery \u272f 100% original brands | %s.",C.a.displayName)})}render(){return R(r,O.a,Object.assign({},this.containerFunctions,this.containerProps(),{setLastTapItem:this.setLastTapItem}))}}t.a=Object(o.j)(Object(s.b)(()=>({}),e=>({showErrorNotification:t=>e(Object(p.d)("error",t)),updateBreadcrumbs:t=>{L.then(n=>{let{default:r}=n;return r.update(t,e)})},changeHeaderState:t=>e(Object(l.c)(u.b,t)),setMeta:t=>e(Object(c.b)(t)),setLastTapItemOnHome:t=>e(Object(h.t)(t))}))(S))}).call(this,n(28),n(1))},1957:function(e,t,n){"use strict";(function(e){n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return o}));const r=e("men"),a=e("women"),s=e("kids"),o=[a,r,s]}).call(this,n(28))},1958:function(e,t,n){"use strict";(function(e){var r=n(2348),a=n(1),s=(n(1960),n(2350),n(13).checkBEMProps);class o extends a.PureComponent{constructor(){super(...arguments),this.renderBrand=t=>{const{type:n}=this.props,{name:a}=t;return s(e,r.a,{key:a,brand:t,type:n})}}renderBrands(){const{brands:e=[]}=this.props;return e.map(this.renderBrand)}render(){const{letter:t,isFiltered:n}=this.props;return s(e,"div",{block:"BrandGroup"},!n&&s(e,"h4",{block:"BrandGroup",elem:"Letter"},t),s(e,"div",{block:"BrandGroup",elem:"Group",mods:{isFiltered:n}},this.renderBrands()))}}o.defaultProps={isFiltered:!1},t.a=o}).call(this,n(1))},1959:function(e,t,n){"use strict";(function(e){var r=n(77),a=n(1),s=(n(1960),n(89),n(11)),o=(n(2349),n(0)),i=n(9),d=n(3),c=n(39),l=n(13).checkBEMProps;class u extends a.PureComponent{constructor(){super(...arguments),this.state={isArabic:Object(s.h)()}}capitalizeFirstLetter(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.charAt(0).toUpperCase()+e.slice(1)}renderName(){const{brand:{name:e}}=this.props;return e}sendMoeEvent(e){const t=d.a.getItem(c.a);Object(o.Ni)(o.bf,{country:Object(i.f)().toUpperCase(),language:Object(i.i)().toUpperCase(),brand_name:e||"",app6thstreet_platform:"Web",category:t.gender?t.gender.toUpperCase():""})}render(){const{brand:{name:t="",name_ar:n="",url_path:a=""},type:s}=this.props,{isArabic:o}=this.state;let i,d,c=o?n:t;return s?(d="kids"===s?o?"\u0623\u0648\u0644\u0627\u062f,\u0628\u0646\u0627\u062a":"Boy,Girl":"\u0646\u0633\u0627\u0621"===s?"\u0646\u0633\u0627\u0621":"\u0631\u062c\u0627\u0644"===s?"\u0631\u062c\u0627\u0644":"\u0623\u0637\u0641\u0627\u0644"===s?"\u0623\u0648\u0644\u0627\u062f,\u0628\u0646\u0627\u062a":s,i=a?"/".concat(a,".html?q=").concat(encodeURIComponent(c),"&p=0&dFR[brand_name][0]=").concat(encodeURIComponent(c),"&dFR[gender][0]=").concat(this.capitalizeFirstLetter(d),"&dFR[in_stock][0]=",1):"/catalogsearch/result/?q=".concat(encodeURIComponent(c),"&p=0&dFR[brand_name][0]=").concat(encodeURIComponent(c),"&dFR[gender][0]=").concat(this.capitalizeFirstLetter(d),"&dFR[in_stock][0]=",1)):i=a?"/".concat(a,".html?q=").concat(encodeURIComponent(c),"&p=0&dFR[brand_name][0]=").concat(encodeURIComponent(c),"&dFR[in_stock][0]=",1):"/catalogsearch/result/?q=".concat(encodeURIComponent(c),"&p=0&dFR[brand_name][0]=").concat(encodeURIComponent(c),"&dFR[in_stock][0]=",1),l(e,"div",{block:"Brand"},l(e,r.default,{to:i,block:"BrandLink",title:c,onClick:()=>{this.sendMoeEvent(c)}},c))}}t.a=u}).call(this,n(1))},1960:function(e,t,n){"use strict";var r=n(7),a=n.n(r);const s=a.a.shape({name:a.a.string.isRequired,count:a.a.number.isRequired}),o=a.a.arrayOf(s);a.a.objectOf(o)},2346:function(e,t,n){"use strict";(function(e,r){var a=n(1),s=n(2347),o=n(113),i=n(1957);n(2351);const d=Object(a.lazy)(()=>n.e(16).then(n.bind(null,445)));var c=n(13).checkBEMProps;class l extends a.PureComponent{constructor(){var t;super(...arguments),t=this,this.state={filteredLetter:null},this.onBrandCategoryClick=e=>()=>{const{changeBrandType:t}=this.props;t(e)},this.onBrandLetterClick=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return()=>{t.setState({filteredLetter:e})}},this.renderBrandGroup=t=>{let[n,r]=t;const{type:a,brandMapping:o}=this.props,{filteredLetter:i}=this.state,d=r.map(e=>{const t=o.find(t=>{var n,r;return(null===t||void 0===t||null===(n=t.en)||void 0===n?void 0:n.toUpperCase())===(null===e||void 0===e||null===(r=e.name)||void 0===r?void 0:r.toUpperCase())});return Object.assign({},t,e)});return c(e,s.a,{key:n,letter:n,brands:d,isFiltered:!!i,type:a})}}renderCategorySelector(){let{type:t,brandWidgetData:n}=this.props;return t&&(t=decodeURIComponent(t)),c(e,"div",{block:"Brands",elem:"Categories",mods:{topContentAvaiableOnGenderSelect:n.length<=0&&!!t}},c(e,"button",{block:"Brands",elem:"CategoryButton",mods:{isSelected:!t},onClick:this.onBrandCategoryClick("")},r("All")),c(e,"button",{block:"Brands",elem:"CategoryButton",mods:{isSelected:t===i.d},onClick:this.onBrandCategoryClick(i.d)},r("Women")),c(e,"button",{block:"Brands",elem:"CategoryButton",mods:{isSelected:t===i.b},onClick:this.onBrandCategoryClick(i.b)},r("Men")),c(e,"button",{block:"Brands",elem:"CategoryButton",mods:{isSelected:t===i.a},onClick:this.onBrandCategoryClick(i.a)},r("Kids")))}renderLetterSelector(){const{brands:t=[]}=this.props,{filteredLetter:n}=this.state;return c(e,"div",{block:"Brands",elem:"LetterFilter"},c(e,"button",{block:"Brands",elem:"LetterButton",mods:{isSelected:!n},onClick:this.onBrandLetterClick()},"#"),t.map(t=>{let[r]=t;return c(e,"button",{key:r,block:"Brands",elem:"LetterButton",mods:{isSelected:n===r},onClick:this.onBrandLetterClick(r)},r)}))}renderBrandGroups(){const{brands:e=[]}=this.props,{filteredLetter:t}=this.state;return t?e.filter(e=>{let[n]=e;return n===t}).map(this.renderBrandGroup):e.map(this.renderBrandGroup)}renderDynamicBanners(){const{type:t,brandWidgetData:n=[],setLastTapItem:s}=this.props;return n.length?c(e,a.Suspense,{fallback:null},c(e,"h2",{block:"Brands",elem:"Title"},r("Top Brands on AIVI")),c(e,d,{gender:t,content:n,setLastTapItemOnHome:s})):null}renderDynamicTextContent(){var t,n,r,a,s,o;const{brandWidgetData:i=[]}=this.props;let d;return(null===i||void 0===i?void 0:i.length)&&(d=null===i||void 0===i?void 0:i.find((function(e){return"text"==e.type}))),c(e,"div",{block:"brands-bottom-content"},c(e,"h3",null,null===(t=d)||void 0===t||null===(n=t.header)||void 0===n?void 0:n.text),c(e,"p",null,null===(r=d)||void 0===r||null===(a=r.content)||void 0===a?void 0:a.text),c(e,"p",null,null===(s=d)||void 0===s||null===(o=s.footer)||void 0===o?void 0:o.text))}render(){const{isLoading:t}=this.props,{filteredLetter:n}=this.state;return c(e,"div",{block:"Brands"},c(e,o.a,{isLoading:t}),c(e,"h1",{block:"Brands",elem:"Title"},r("Shop by Brands")),this.renderDynamicBanners(),c(e,"h2",{block:"Brands",elem:"Heading"},r("Brands A-Z")),this.renderCategorySelector(),this.renderLetterSelector(),c(e,"div",{block:"Brands",elem:"Groups",mods:{isFiltered:!!n}},this.renderBrandGroups()),this.renderDynamicTextContent())}}l.defaultProps={type:null},t.a=l}).call(this,n(1),n(28))},2347:function(e,t,n){"use strict";var r=n(1958);n.d(t,"a",(function(){return r.a}))},2348:function(e,t,n){"use strict";var r=n(1959);n.d(t,"a",(function(){return r.a}))},2349:function(e,t,n){},2350:function(e,t,n){},2351:function(e,t,n){},2873:function(e,t,n){"use strict";n.r(t);var r=n(1956);n.d(t,"default",(function(){return r.a}))}}]);