(window.webpackJsonpbraindw_brain_recommendation_0_0_29=window.webpackJsonpbraindw_brain_recommendation_0_0_29||[]).push([["Images"],{0:function(e,t){e.exports=React},11:function(e,t,n){"use strict";var a;n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return r})),function(e){e.USER="USER",e.CATEGORY="CATEGORY",e.PRODUCT="PRODUCT",e.TAG_GROUP="TAG_GROUP",e.CAMPAIGN="CAMPAIGN",e.GROUP="GROUP",e.ANONYMOUS_USER="ANONYMOUS_USER",e.BRAND="BRAND",e.STORE="STORE",e.NO_SEARCH="NO_SEARCH",e.SEARCH="SEARCH"}(a||(a={}));var r=function(e,t,n,r,o){return r?{type:{primary:a.ANONYMOUS_USER},values:["collection/".concat(r)]}:t&&t.length>0?{type:{primary:a.CATEGORY},values:t}:o?{type:{primary:a.ANONYMOUS_USER},values:["search/".concat(o)]}:e&&e.length>0?{type:{primary:a.PRODUCT},values:e}:n?{type:{primary:a.ANONYMOUS_USER},values:["nosearch/".concat(n)]}:{type:{primary:a.STORE}}}},12:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.search-page-context@0.x/SearchPageContext"]},13:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.product-context@0.x/useProduct"]},17:function(e,t,n){e.exports={shelfTitle:"braindw-brain-recommendation-0-x-shelfTitle",debugContent:"braindw-brain-recommendation-0-x-debugContent",bdwShelfId:"braindw-brain-recommendation-0-x-bdwShelfId"}},18:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.device-detector@0.x/useDevice"]},2:function(e,t){e.exports=__RENDER_8_RUNTIME__},21:function(e,t){e.exports=regeneratorRuntime},22:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.pixel-manager@1.x/PixelContext"]},25:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var a,r=n(0);!function(e){e.ProductClick="productClick",e.AddToCart="addToCart",e.View="shelfView",e.BannerClick="bannerClick"}(a||(a={}));var o=function(e,t,n,o,c){var i=Object(r.useMemo)((function(){return null==e?void 0:e.shouldSendEvents}),[e]);return{onView:i?function(e,t){return function(n){e({page:t,event:"shelf",eventType:a.View,shelf:n})}}(t,n):function(){},onProductClick:i?function(e,t,n,r){return function(o){e({page:t,event:"bdwshelf",eventType:a.ProductClick,product:o,shelfId:n,panelEvent:r})}}(t,n,o,c):function(){},onBannerClick:function(e,t,n){return function(r){e({page:t,img:r,event:"bannerbdw",eventType:a.BannerClick,shelfId:n})}}(t,n,o)}}},49:function(e,t,n){"use strict";n.r(t),function(e){var t=n(4);n.p=Object(t.getPublicPath)("braindw.brain-recommendation@0.0.29");var a=Object(t.register)((function(){return n(70)}),e,"braindw.brain-recommendation@0.0.29","braindw.brain-recommendation@0.x","Images");a.renderHotReload,a.setupHMR}.call(this,n(14)(e))},7:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(2),r=n(6),o=n(9),c=function(){if(Object(a.useSSR)())return{};var e=JSON.parse(localStorage.getItem("bdw_last_products")||"[]"),t=JSON.parse(localStorage.getItem("bdw_last_sku")||"[]"),n=localStorage.getItem("bdw_last_category"),c=JSON.parse(localStorage.getItem("bdw_user")||"{}"),i=window.bdwClientKey,l=window.bdwOff,s=localStorage.getItem("enable_script"),u=Object(r.a)(o.a),d=window.location.pathname,f=JSON.parse(localStorage.getItem("bdw_cart_products")||"[]"),p=localStorage.getItem("bdw_search_term"),g=JSON.parse(localStorage.getItem("bdw_last_products_home")||"[]"),v=JSON.parse(localStorage.getItem("bdw_last_products_mercado")||"[]"),m=JSON.parse(localStorage.getItem("bdw_user")||"[]");return i?{email:m,lastProducts:e,lastSku:t,lastCategory:n,bdwHash:i,isDebug:s,user:c,vtexCookie:u||"",path:d,bdwOff:l,cartProducts:f,queryTerm:p,lastProductsExito:g,lastProductsMercado:v}:{}}},70:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),o=n(2),c=n(8),i=n.n(c),l=n(12),s=n(13),u=n.n(s),d=n(1),f=n.n(d),p=n(3),g=n(5),v=n(7),m=n(11),b=function(e){var t=e.id,n=e.productIds,r=e.categories,o=e.nosearch,c=e.collection,i=e.search,l=Object(v.a)(),s=l.bdwHash,u=l.isDebug,d=Object(a.useState)(),b=Object(g.a)(d,2),S=b[0],h=b[1],_=Object(a.useState)(!1),O=Object(g.a)(_,2),E=O[0],w=O[1],R=Object(m.b)(n,r,o,c,i),N=Object(a.useCallback)(Object(p.a)(f.a.mark((function e(){var n,a,o,c,i,l,u,d,p,g,v;return f.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=localStorage.getItem("bdw_email")||function(){var e=localStorage.getItem("bdw_user");if(e)try{return JSON.parse(e).email}catch(e){console.error("Error parsing bdw_user:",e)}return null}(),e.prev=1,!s||!t){e.next=15;break}return w(!0),d=null,localStorage.getItem("bdwRegionId")&&(d=localStorage.getItem("bdwRegionId")),(null!==localStorage.getItem("orderform")||void 0!==localStorage.getItem("orderform")&&JSON.parse(localStorage.getItem("orderform")||"{}").length>100)&&(p=JSON.parse(localStorage.getItem("orderform")||"{}"),(null===(a=null===(n=null==p?void 0:p.shipping)||void 0===n?void 0:n.selectedAddress)||void 0===a?void 0:a.state)&&(d=null===(c=null===(o=null==p?void 0:p.shipping)||void 0===o?void 0:o.selectedAddress)||void 0===c?void 0:c.state.normalize("NFD").replace(/[\u0300-\u036f]/g,""))),e.next=9,fetch("https://s2.braindw.com/tracking/SmartImage?HASH=".concat(s,"&email=").concat(u,"&branchOffice=").concat(null!==(i=localStorage.getItem("bdw_channel"))&&void 0!==i?i:"1","&whitelabel=").concat(d,"§ionid=").concat(t,"&idcategory=").concat(r));case 9:return g=e.sent,e.next=12,g.json();case 12:v=e.sent,h(null===(l=v[0])||void 0===l?void 0:l.Images.map((function(e){return{title:v[0].Title,image:e.UrlDesktop,link:{newTab:!1,url:e.Link},mobileImage:e.UrlMobile}}))),w(!1);case 15:e.next=21;break;case 17:throw e.prev=17,e.t0=e.catch(1),w(!1),new Error(e.t0.message);case 21:case"end":return e.stop()}}),e,null,[[1,17]])}))),[s,u,t,r]);return Object(a.useEffect)((function(){var e,n;if(u&&console.log("[BDW DEBUG MESSAGE] from ".concat(t,"\n"),R),s&&t){var a=t.split("-")[1];"HOME"===a&&R.type.primary===m.a.STORE&&N(),"PDP"===a&&R.type.primary===m.a.PRODUCT&&N(),"PLP"===a&&R.type.primary===m.a.CATEGORY&&N(),"SEARCH"===a&&R.type.primary===m.a.ANONYMOUS_USER&&R.values&&"search"===(null===(e=R.values[0])||void 0===e?void 0:e.split("/")[0])&&N(),"SEARCHNORESULT"===a&&R.type.primary===m.a.ANONYMOUS_USER&&R.values&&"nosearch"===(null===(n=R.values[0])||void 0===n?void 0:n.split("/")[0])&&N()}}),[t,s,r]),{photos:S,loading:E}},S=n(29),h=n(17),_=n.n(h),O=n(10),E=n(22),w=n(25);var R=["shelfTitleContainer","shelfTitle","shelfContainer"],N=function(e){var t,n,c,s,d,f,p,g,m=e.id,h=e.showLazyLoading,N=void 0!==h&&h,C=e.lazyLoadingHeight,y=void 0===C?400:C,x=Object(o.useSSR)(),I=Object(a.useRef)(null),T=i()(R),A=u()(),P=Object(l.useSearchPage)(),U=P.searchQuery,k=P.params,j=Object(v.a)().isDebug;if(A){var D=A.product;D&&(s=[D.productId])}if(U){var M,H=null==k?void 0:k.id;H&&!isNaN(H)||(H=function(e){var t;if(!e)return null;var n=null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.find((function(e){return e.selected}));return n?n.id:e.id}(null===(n=null===(t=null==U?void 0:U.facets)||void 0===t?void 0:t.categoriesTrees)||void 0===n?void 0:n[0])),d=H,U.facets&&U.facets.queryArgs&&U.facets.queryArgs.map&&"productClusterIds"===U.facets.queryArgs.map&&(p=U.facets.queryArgs.query),U.data.productSearch&&0===U.data.productSearch.products.length&&k?f=k.term:U.data.productSearch&&U.data.productSearch.products.length>=1&&k&&U.variables&&"ft"===U.variables.map&&(g=k.term),s=null===(c=null==U?void 0:U.products)||void 0===c?void 0:c.slice(0,5).map((function(e){return e.productId}));var G=0;null!==U&&null!==U.variables&&null!==U.variables.selectedFacets&&U.variables.selectedFacets.length>0&&U.variables.selectedFacets.forEach((function(e){if(null!=e&&null!=e.key&&e.key.startsWith("category-")){var t=e.key.replace("category-","");!isNaN(t)&&Number.isInteger(parseFloat(t))&&(G0&&U.facets.specificationFilters.forEach((function(t){null!=t.facets&&null!=t.facets&&t.facets.length>0&&t.facets.forEach((function(t){t.key==e.key&&t.value==e.value&&(M=t.id)}))})),G=parseFloat(t))}})),null!=M&&M.length>0&&(d=M)}var J=Object(o.useRuntime)().page,F=Object(E.usePixel)().push,Y=Object(w.a)({shouldSendEvents:!0},F,J,m,m).onBannerClick,B=b({id:m,productIds:s,categories:d,nosearch:f,collection:p,search:g}),q=B.photos,L=B.loading,V=window.bdwClientKey;return Object(a.useEffect)((function(){if((null==q?void 0:q.length)>0){var e=new O.a;e.init().then((function(){e.postEventBanner(q,m,V)}))}}),[q]),x||L?N?r.a.createElement(S.a,{height:y,withTitle:!1}):null:(null==q?void 0:q.length)?r.a.createElement("div",{className:"flex-none tc ".concat(j?_.a.debugContent:""," ").concat(T.shelfContainer),ref:I,onClick:function(){Y(q)}},r.a.createElement("div",{className:_.a.bdwShelfId},m),r.a.createElement(o.ExtensionPoint,{id:"list-context.image-list",height:400,images:q})):r.a.createElement(a.Fragment,null)};N.getSchema=function(e){return{title:e.id}};t.default=N},8:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.css-handles@0.x/useCssHandles"]}},[[49,"common",0,4]]]);