(window.webpackJsonpvtex_store_2_142_0=window.webpackJsonpvtex_store_2_142_0||[]).push([["SearchWrapper"],{0:function(e,t){e.exports=React},1:function(e,t){e.exports=__RENDER_8_RUNTIME__},10:function(e,t,n){"use strict";n.d(t,"b",(function(){return i}));var r=n(0),a=n(1),o=n(4),i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.title,n=e.cacheKey,i=e.skip,c=Object(a.useRuntime)(),u=c.route,l=c.account,d=null!=n?n:u.routeId,s=Object(r.useMemo)((function(){return!a.canUseDOM||i?null:{event:"pageView",pageTitle:null!=t?t:document.title,pageUrl:location.href,referrer:0===document.referrer.indexOf(location.origin)?void 0:document.referrer,accountName:l,routeId:(null==u?void 0:u.routeId)?u.routeId:""}}),[l,t,a.canUseDOM,d]);Object(o.a)(i?null:s,d)},c=["store.search","store.product"];t.a=function(e){var t=e.title,n=Object(a.useRuntime)().route,r=n&&c.some((function(e){return 0===n.routeId.indexOf(e)}));return i({title:t,skip:r}),null}},11:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(1);function a(){var e=Object(r.useRuntime)(),t=e.route,n=e.rootPath,a=void 0===n?"":n,o=t.canonicalPath,i=window.__hostname__||window.location&&window.location.hostname;return i&&o?"https://".concat(i).concat(a).concat(o):null}},2:function(e,t){e.exports=R},33:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.open-graph@1.x/SearchOpenGraph"]},34:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.structured-data@0.x/ProductList"]},4:function(e,t,n){"use strict";var r=n(0),a=n(5),o=n(2);t.a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=Object(a.usePixel)(),c=i.push,u=Object(r.useRef)(null),l=u.current;Object(r.useEffect)((function(){if(t&&!n&&l!==t){if(!e||Object(o.isEmpty)(e))return;Array.isArray(e)?e.forEach(c):c(e),u.current=t}}),[e,n,t,l,c])}},5:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.pixel-manager@1.x/PixelContext"]},66:function(e,t,n){"use strict";n.r(t),function(e){var t=n(3);n.p=Object(t.getPublicPath)("vtex.store@2.142.0");var r=Object(t.register)((function(){return n(74)}),e,"vtex.store@2.142.0","vtex.store@2.x","SearchWrapper");r.renderHotReload,r.setupHMR}.call(this,n(9)(e))},74:function(e,t,n){"use strict";n.r(t),n.d(t,"getHelmetLink",(function(){return E}));var r=n(6),a=n(0),o=n.n(a),i=n(1),c=n(33),u=n.n(c),l=n(34),d=n.n(l),s=n(16),v=n.n(s),f=n(4),p=n(10),m=n(2),g=function(e){var t,n;return(null===(n=null===(t=e.facets)||void 0===t?void 0:t.categoriesTrees)||void 0===n?void 0:n.length)?e.facets.categoriesTrees.find((function(e){return e.selected})):function(e){var t,n,r;if(null===(t=null==e?void 0:e.queryArgs)||void 0===t?void 0:t.map.split(",").includes("c")){var a=null===(n=e.specificationFilters)||void 0===n?void 0:n.find((function(e){var t;return"category-1"===(null===(t=e.facets)||void 0===t?void 0:t[0].key)}));return null===(r=null==a?void 0:a.facets)||void 0===r?void 0:r.find((function(e){return e.selected}))}}(e.facets)},h=function(e){if(e&&e.facets&&e.facets.categoriesTrees){var t=g(e);if(t)return{id:t.id,name:t.name}}},_=function(e){if(e&&e.facets&&e.facets.categoriesTrees){var t=g(e);if(t){var n=function e(t,n){var r,a=t.children&&t.children.length>0&&t.children.find((function(e){return e.selected}));return a?e(a):null!==(r=function(e){var t,n,r,a;if(!((null!==(n=null===(t=null==e?void 0:e.queryArgs)||void 0===t?void 0:t.map.split(",").filter((function(e){return"c"===e})).length)&&void 0!==n?n:0)<=1)){var o=null===(r=null==e?void 0:e.specificationFilters)||void 0===r?void 0:r.find((function(e){var t;return"category-2"===(null===(t=e.facets)||void 0===t?void 0:t[0].key)}));return null===(a=null==o?void 0:o.facets)||void 0===a?void 0:a.find((function(e){return e.selected}))}}(n))&&void 0!==r?r:t}(t,e.facets);if(n!==t)return{id:n.id,name:n.name}}}},b=function(e,t,n){var r;if(e&&e.productSearch&&e.facets&&e.facets.queryArgs){var a=e.facets.queryArgs,o=a.query,i=a.map,c=Object(m.zipObj)(i.split(","),o.split("/")).ft,u="";try{u=decodeURIComponent(c||"")}catch(e){u=decodeURIComponent(encodeURIComponent(c||""))}var l=g(e),d=null===(r=null==e?void 0:e.products)||void 0===r?void 0:r.map((function(e){return{productId:e.productId}}));return{term:u||void 0,category:l?{id:l.id,name:l.name}:null,results:e.productSearch.recordsFiltered,operator:e.productSearch.operator,searchState:e.productSearch.searchState,correction:e.productSearch.correction,products:d,page:t,maxItemsPerPage:n}}},y=n(11),O={InternalSiteSearch:"internalSiteSearchView",Category:"categoryView",Department:"departmentView",EmptySearch:"emptySearchView"},x=function(e){try{return decodeURIComponent(e)}catch(t){return e}};function S(e){if(!e||"b"===e||"brand"===e)return!0;var t=e.split(",");return!(t.length>4)&&t.every((function(e){return"c"===e}))}function E(e){var t=e.canonicalLink,n=e.page,r=e.map,a=e.rel,o=e.term;if(!t)return null;var i=0;"canonical"===a?i=n:"next"===a?i=n+1:"prev"===a&&(i=n-1);var c=function(e){var t=e.canonicalLink,n=e.page,r=e.map,a=e.term;if(null!=n&&n<1)return null;var o={page:null!=n&&n>1?n:void 0,map:S(r)?void 0:r,_q:a};return v.a.stringifyUrl({url:decodeURI(t),query:o})}({canonicalLink:t,page:i,map:r,term:o});return c?{rel:a,href:c}:null}function T(e,t,n){return e&&null!=t&&null!=n?t+10?" #".concat(c):"",d=u?"":" - ".concat(r);return n?"".concat(x(n)).concat(l).concat(d):o?"".concat(x(o)).concat(l).concat(d):a?"".concat((t=x(a),t&&t.charAt(0).toUpperCase()+t.slice(1))).concat(l).concat(d):r}({titleTag:j,storeTitle:Y||X,term:t.term,pageTitle:K,pageNumber:$?Number(H):0,removeStoreNameTitle:re}),oe=Object(y.a)(),ie=E({canonicalLink:oe,page:M,map:te?"":m,term:W,rel:"canonical"}),ce={title:ae,description:N||(null==Q?void 0:Q.description),canonical:null==ie?void 0:ie.href},ue=Object(a.useMemo)((function(){var e,r;if(!c||!i.canUseDOM||!c.products||!(null===(r=null===(e=c.data)||void 0===e?void 0:e.facets)||void 0===r?void 0:r.queryArgs)||l)return null;var a=c.products,o=function(e,t){if(!e)return"otherView";var n=function(e,t){if(!e||0===e.length)return"EmptySearch";var n=t.category;return t.term?"InternalSiteSearch":n?"Category":"Department"}(e,t);return O[n]||"otherView"}(a,t);return[{event:"pageInfo",eventType:o,accountName:F,pageTitle:ae,pageUrl:window.location.href,orderBy:n,appliedFilters:null==m?void 0:m.split(",").map((function(e){return{name:e}})),page:H,category:(null==c?void 0:c.data)?_(c.data):null,department:(null==c?void 0:c.data)?h(c.data):null,search:(null==c?void 0:c.data)?b(c.data,M,L):null},{event:o,products:a}]}),[c,l,t,F,ae,n,m,H,M,L]),le=Object(a.useState)(!0),de=Object(r.a)(le,2),se=de[0],ve=de[1],fe=Object(a.useMemo)((function(){return{isParentLoading:G&&se}}),[G,se]),pe=function(e,t,n){var r=e.variables;if(r)return r.query+r.map+(null!=t?t:"")+(null!=n?n:"")}(c,n,H);Object(p.b)({title:ae,cacheKey:pe}),Object(f.a)(ue,pe,G),Object(a.useEffect)((function(){G||ve(!1)}),[G]);var me=null!=C?C:a.Fragment;return o.a.createElement(a.Fragment,null,o.a.createElement(i.Helmet,{title:ae,meta:[t.term&&{name:"robots",content:"noindex,follow"},N&&{name:"description",content:N}].filter(Boolean),link:[ie,E({canonicalLink:oe,page:M,map:m,rel:"prev"}),T(c.products,q,k)?E({canonicalLink:oe,page:M,map:m,rel:"next"}):null].filter(Boolean)}),o.a.createElement(d.a,{products:c.products}),o.a.createElement(u.a,{meta:ce}),o.a.createElement(i.LoadingContextProvider,{value:fe},o.a.createElement(me,null,o.a.cloneElement(D,e))))}}},[[66,"common",0]]]);