"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1055],{41055:function(e,n,t){t.r(n),t.d(n,{HeaderSearch:function(){return nv}});var r,o,c,a,i,s,l,h,d,u,p,m,f,g,b,v,S,x,y,w,k,j,P,T,O,I,D,C,R,F,B,Z,E,z,W,A,H,L,V,N,M=t(8529),Q=t(95235),K=t(7328),q=t(2784),U=t(53840),J=t(15792),_=t(22573),G=t(48840),X=t(81292),Y=t(31558),$=t(25237),ee=t.n($),en=t(52034),et=t(95793),er=t(51339),eo=t(87330),ec=t(52322),ea=J.zo.div(o||(o=(0,K.Z)(["\n background-color: ",";\n padding: "," "," ",";\n margin-top: 1px;\n\n "," {\n padding: "," ",";\n margin-top: 0;\n }\n"])),function(e){return e.theme.colors.palette.greys.white},(0,G.W0)(3),(0,G.W0)(2),(0,G.W0)(2),function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"md")},(0,G.W0)(3),(0,G.W0)(2)),ei=J.zo.a(c||(c=(0,K.Z)(["\n ",";\n ","\n display: flex;\n gap: ",";\n width: 100%;\n align-items: center;\n\n &:focus {\n outline: none;\n border: 2px solid ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n }\n"])),function(e){return(0,eo.xv)(e.theme.patterns.header.search.linkFont.entry,e.theme.patterns.header.search.linkFont.style)},function(e){return"\n text-decoration: ".concat(e.theme.patterns.header.search.linkFont.textDecoration||"underline",";\n text-transform: ").concat(e.theme.patterns.header.search.linkFont.transform||"none",";\n color: ").concat(e.theme.patterns.header.search.linkFont.textColor||"inherit",";\n ")},(0,G.W0)(1),function(e){return e.theme.colors.palette.brand.base},function(e){return e.theme.colors.palette.greys.lighter}),es=J.zo.p(a||(a=(0,K.Z)(["\n ",";\n"])),(0,eo.xv)("bodyText","alternate")),el=J.zo.span(i||(i=(0,K.Z)(["\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 80%;\n"]))),eh=(0,J.zo)(er.zx)(s||(s=(0,K.Z)(["\n &:hover {\n cursor: pointer;\n }\n\n &:focus {\n outline: none;\n border: 2px solid ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n }\n"])),function(e){return e.theme.colors.palette.brand.base},function(e){return e.theme.colors.palette.greys.lighter}),ed=function(e){return(0,ec.jsxs)(ea,{children:[(0,ec.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:(0,G.W0)(3),alignItems:"center"},children:[(0,ec.jsx)(es,{children:e.recentlySearchedTitle}),(0,ec.jsx)(eh,{sizing:"regular",emphasis:"low",renderedAs:"a",href:"",onClick:function(n){n.stopPropagation(),e.onClick&&e.onClick()},children:e.clearRecentSearch})]}),(0,ec.jsx)("div",{style:{display:"flex",gap:(0,G.W0)(1),flexDirection:"column"},children:e.recentlySearched&&e.recentlySearched.map(function(n,t){return n.itemName?(0,ec.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,ec.jsx)(ei,{href:"/elysium.search?search=".concat(n.itemName),children:(0,ec.jsx)(el,{children:n.itemName})},t),(0,ec.jsx)(eh,{sizing:"regular",emphasis:"low",renderedAs:"a",href:"",onClick:function(){return e.removeIndividualSearch&&e.removeIndividualSearch(n.itemName)},onKeyDown:e.recentlySearched&&t===e.recentlySearched.length-1?function(n){"Tab"===n.key&&!n.shiftKey&&e.movePastInput&&e.movePastInput()}:void 0,children:(0,ec.jsx)(U.x8P,{})})]},t):null})})]})},eu=t(80908),ep=t(41857),em=t(63940);function ef(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}var eg=J.zo.div(l||(l=(0,K.Z)(["\n background-color: ",";\n margin-top: ",";\n padding: "," 0;\n"])),function(e){return e.theme.colors.palette.greys.white},(0,G.W0)(1),(0,G.W0)(1)),eb=J.zo.li(h||(h=(0,K.Z)(["\n position: relative;\n margin: 0;\n overflow: hidden;\n\n ","\n"])),function(e){return e.isSelected&&"\n background-color: ".concat(e.theme.colors.palette.greys.lighter,";\n display: flex;\n justify-content: space-between;\n ")}),ev=J.zo.div(d||(d=(0,K.Z)(["\n display: flex;\n position: absolute;\n height: 100%;\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n padding-right: ",";\n"])),(0,G.W0)(2)),eS=J.zo.p(u||(u=(0,K.Z)(["\n ",";\n ","\n padding: ",";\n"])),function(e){return(0,eo.xv)(e.theme.patterns.header.search.dropdownHeaderFont.entry,e.theme.patterns.header.search.dropdownHeaderFont.style)},function(e){return"\n text-decoration: ".concat(e.theme.patterns.header.search.dropdownHeaderFont.textDecoration,";\n text-transform: ").concat(e.theme.patterns.header.search.dropdownHeaderFont.transform,";\n color: ").concat(e.theme.patterns.header.search.dropdownHeaderFont.textColor,";\n ")},(0,G.W0)(2)),ex=(0,J.zo)(U.rXT)(p||(p=(0,K.Z)(["\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n g {\n fill: ",";\n }\n"])),function(e){return e.theme.colors.palette.brand.base}),ey=(0,J.zo)(em.v)(m||(m=(0,K.Z)(["\n padding: ",";\n border: 2px solid transparent;\n\n &:hover,\n &:active,\n &:focus-visible {\n background-color: ",";\n }\n\n &:focus-visible {\n border: 2px solid ",";\n }\n"])),(0,G.W0)(2),function(e){return e.theme.colors.palette.greys.lighter},function(e){return e.theme.colors.palette.brand.base}),ew=function(e){var n=(0,ep.ND)().hideSearchPrice,t=(0,J.Fg)();return(0,ec.jsxs)(eg,{children:[(0,ec.jsx)(eS,{children:e.productsTitle}),(0,ec.jsx)("ul",{"aria-label":e.productsTitle,children:e.products.map(function(r,o){var c=e.currentIndex===o,a=0!==r.reviews.averageScore||0!==r.reviews.total?function(e){for(var n=1;n=1200?e.theme.patterns.header.search.width:"".concat(e.pageWidth,"px")},function(e){return e.cutBottom?"200":"100"},function(e){return(0,G.W0)(e.paddingTop)},function(e){return e.theme.colors.palette.greys.lighter},(0,G.W5)(eu.yS.Dropdown),function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"lg")},function(e){return e.slimHeader&&!e.theme.patterns.header.mobileSearch?"0":"auto"}),eU=J.zo.div(I||(I=(0,K.Z)(["\n display: flex;\n height: ",";\n\n "," {\n display: inline-block;\n height: ",";\n\n ","\n }\n\n ","\n flex-direction: column;\n flex: 1;\n"])),function(e){return e.theme.patterns.header.search.height.mobile},function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"lg")},function(e){return e.theme.patterns.header.search.height.desktop},function(e){var n,t,r,o;return"\n margin-bottom: ".concat(null!==(n=null===(t=e.theme.patterns.header.search.margin)||void 0===t?void 0:t.bottom)&&void 0!==n?n:"0",";\n margin-top: ").concat(null!==(r=null===(o=e.theme.patterns.header.search.margin)||void 0===o?void 0:o.top)&&void 0!==r?r:"0",";\n ")},function(e){return e.mobileSearch&&"width: 100%"}),eJ=J.zo.form(D||(D=(0,K.Z)(["\n display: flex;\n justify-content: center;\n height: 100%;\n &:focus {\n outline: ",";\n }\n ","\n ","\n\n "," {\n &:focus {\n outline: ",";\n }\n max-width: ",";\n width: ",";\n\n border-radius: ",";\n\n &:focus-within {\n ","\n }\n }\n"])),function(e){return e.theme.patterns.header.search.searchBarFocus},function(e){return e.inputFocused&&"".concat((0,G.W5)(eu.yS.Dropdown),";\n")},function(e){return"border-radius: ".concat(e.theme.patterns.header.search.searchBorders.inactive.radius,";\n\n border-top: ").concat(e.theme.patterns.header.search.searchBorders.inactive.top.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.top.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.searchBorders.inactive.left.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.left.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.searchBorders.inactive.right.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.right.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.display&&"".concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.width," solid ").concat(e.theme.patterns.header.search.searchBorders.inactive.bottom.color),";\n")},function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"lg")},function(e){return e.theme.patterns.header.search.searchBarFocus},function(e){return e.theme.patterns.header.search.width?e.theme.patterns.header.search.width:"458px"},function(e){return e.mobileSearch?"100%":e.theme.patterns.header.search.width},function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius},function(e){return"border-radius: ".concat(e.theme.patterns.header.search.searchBorders.active.radius,";\n \n border-top: ").concat(e.theme.patterns.header.search.searchBorders.active.top.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.top.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.searchBorders.active.left.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.left.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.searchBorders.active.right.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.right.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.searchBorders.active.bottom.display&&"".concat(e.theme.patterns.header.search.searchBorders.active.bottom.width," solid ").concat(e.theme.patterns.header.search.searchBorders.active.bottom.color),";\n \n ")}),e_=J.zo.div(C||(C=(0,K.Z)(["\n ","\n display: flex;\n width: 100%;\n background-color: ",";\n\n border-radius: ",";\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\n "," {\n background-color: ",";\n width: 410px;\n\n &:focus-within {\n outline: none;\n padding: 0;\n }\n }\n"])),function(e){return e.inputFocused&&"".concat((0,G.W5)(eu.yS.Dropdown),";")},function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive},function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius},function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"lg")},function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),eG=(0,J.iv)(R||(R=(0,K.Z)(["\n ",";\n ","\n"])),function(e){return(0,eo.xv)(e.theme.patterns.header.search.placeholderFont.entry,e.theme.patterns.header.search.placeholderFont.style)},function(e){return"\n text-transform: ".concat(e.theme.patterns.header.search.placeholderFont.transform,";\n text-decoration: ").concat(e.theme.patterns.header.search.placeholderFont.textDecoration,";\n color: ").concat(e.theme.patterns.header.search.placeholderFont.textColor,";\n")}),eX=J.zo.input(F||(F=(0,K.Z)(["\n ",";\n ","\n background-color: ",";\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: ",";\n padding: ",";\n\n ::placeholder {\n ","\n background-color: ",";\n }\n ::-webkit-input-placeholder {\n ","\n background-color: ",";\n }\n :-ms-input-placeholder {\n ","\n background-color: ",";\n }\n\n &:focus {\n outline: none;\n }\n"])),function(e){return(0,eo.xv)(e.theme.patterns.header.search.activeFont.entry,e.theme.patterns.header.search.activeFont.style)},function(e){return"\n text-transform: ".concat(e.theme.patterns.header.search.activeFont.transform,";\n text-decoration: ").concat(e.theme.patterns.header.search.activeFont.textDecoration,";\n color: ").concat(e.theme.patterns.header.search.activeFont.textColor,";\n ")},function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive},function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius},function(e){return e.theme.patterns.header.search.placeHolderPadding},eG,function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive},eG,function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive},eG,function(e){return""!==e.value?e.theme.patterns.header.search.backgroundColor.active:e.theme.patterns.header.search.backgroundColor.inactive}),eY=J.zo.label(B||(B=(0,K.Z)(["\n width: 100%;\n"]))),e$=J.zo.button(Z||(Z=(0,K.Z)(["\n ","\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: ",";\n width: ",";\n height: ",";\n flex: 0;\n height: 100%;\n background-color: ",";\n\n border-radius: ",";\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: ",";\n border-bottom-right-radius: ",";\n\n ","\n\n svg {\n fill: ",";\n }\n\n &:focus {\n outline: none;\n outline-offset: -4px;\n ",";\n }\n\n &:hover,\n &:active,\n &:focus {\n background-color: ",";\n padding: 0 ",";\n }\n\n svg {\n fill: ",";\n }\n"])),function(e){return e.inputFocused&&"".concat((0,G.W5)(eu.yS.Dropdown),";")},(0,G.W0)(6),(0,G.W0)(6),(0,G.W0)(6),function(e){return e.active?e.theme.patterns.header.search.buttonBackgroundColor.active:e.theme.patterns.header.search.buttonBackgroundColor.inactive},function(e){return e.theme.patterns.header.search.searchBorders.inactive.radius},function(e){return e.theme.patterns.header.search.buttonBorder.inactive.radius},function(e){return e.theme.patterns.header.search.buttonBorder.inactive.radius},function(e){return"\n border-top: ".concat(e.theme.patterns.header.search.buttonBorder.inactive.top.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.top.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.top.color),";\n border-left: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.left.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.left.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.left.color),";\n border-right: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.right.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.right.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.right.color),";\n border-bottom: ").concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.display&&"".concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.width," solid ").concat(e.theme.patterns.header.search.buttonBorder.inactive.bottom.color),";\n")},function(e){return e.theme.patterns.header.search.mobileIcon.color},function(e){return e.active?"outline: 2px solid ".concat(e.theme.colors.palette.greys.white):"border: 2px solid ".concat(e.theme.patterns.header.search.focusBorderColor||e.theme.colors.palette.brand.base)},function(e){return e.active?e.theme.patterns.header.search.buttonBackgroundColor.active:e.theme.patterns.header.search.buttonBackgroundColor.inactive},(0,G.W0)(1),function(e){return e.active?e.theme.patterns.header.search.iconColor.active:e.theme.patterns.header.search.iconColor.inactive}),e0=(0,J.zo)(function(e){var n,t,r,o=document.documentElement.clientWidth,c=q.useRef(null),a=q.useRef(null);q.useEffect(function(){if(a.current&&c.current){var e=c.current.offsetHeight/2,n=a.current.offsetTop;c.current.scrollTo(0,e>n?0:n-e)}},[e.correctionsIndex,e.suggestionsIndex,e.productsIndex]);var i=(null===(n=e.searchResults.corrections)||void 0===n?void 0:n.length)>0;return(0,ec.jsx)("div",{style:{position:"relative",display:"flex",justifyContent:"center"},"data-testid":"header-search-results-dropdown",children:(0,ec.jsxs)(eq,eK(eK({pageWidth:o,cutBottom:_.n,ref:c,"aria-label":e.searchI18nText.searchResultsAria,onKeyDown:function(n){return"Escape"===n.key&&e.clearInput()},paddingTop:e.isDesktop?0:2},e),{},{children:[i&&(0,ec.jsx)(eB,eK({currentIndex:e.correctionsIndex,corrections:e.searchResults.corrections,correctionsTitle:e.searchI18nText.correctionsTitle,autocompleteLink:e.autocompleteLink,selectedRef:a},e.onClickSearchSuggestions&&{onClickSearchSuggestions:e.onClickSearchSuggestions})),(null===(t=e.searchResults.suggestedSearchQueries)||void 0===t?void 0:t.length)>0&&(0,ec.jsx)(eM,eK({currentIndex:e.suggestionsIndex,showTitle:i,suggestions:e.searchResults.suggestedSearchQueries,suggestionsTitle:e.searchI18nText.suggestionsTitle,autocompleteLink:e.autocompleteLink,selectedRef:a},e.onClickSearchSuggestions&&{onClickSearchSuggestions:e.onClickSearchSuggestions})),(null===(r=e.searchResults.products)||void 0===r?void 0:r.length)>0&&(0,ec.jsx)(ew,{currentIndex:e.productsIndex,products:e.searchResults.products,productsTitle:e.searchI18nText.productsTitle,selectedRef:a,fromText:e.fromText,rrpText:e.rrpText,freeText:e.freeText,movePastInput:e.movePastInput,inputValue:e.inputValue,showPowerReview:e.showPowerReview})]}))})})(E||(E=(0,K.Z)(["\n ",";\n display: ",";\n ",";\n"])),function(e){return e.mobileSearch&&"top:15px; max-height: 500px; overflow-y: auto;"},function(e){return e.shouldDisplay?"initial":"none"},function(e){return e.mobileSearch?" width: 470px":null}),e1=J.zo.button(z||(z=(0,K.Z)(["\n ",";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: ",";\n border: 2px solid transparent;\n color: ",";\n\n &:hover,\n &:active,\n &:focus {\n opacity: 0.8;\n cursor: pointer;\n outline: none;\n }\n\n &:focus-visible {\n border-color: ",";\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n"])),function(e){return(0,eo.xv)(e.theme.formgroup.icon.scale,e.theme.formgroup.icon.style)},(0,G.W0)(1),function(e){return e.theme.colors.palette.greys.darker},function(e){return e.theme.colors.palette.brand.base},function(e){return e.theme.patterns.header.search.clearTextIcon}),e2=(0,J.zo)(et.yK)(W||(W=(0,K.Z)(["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n display: block;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n ",";\n"])),(0,G.W5)(eu.yS.Overlay));(0,J.zo)(eq)(A||(A=(0,K.Z)(["\n display: flex;\n align-items: center;\n flex-direction: column;\n width: 100%;\n min-width: 393px;\n padding: 0 ",";\n"])),(0,G.W0)(2));var e8=J.zo.div(H||(H=(0,K.Z)(["\n position: relative;\n display: flex;\n justify-content: center;\n z-index: ",";\n border-top: 1px solid ",";\n "," {\n border-top: 0;\n }\n"])),G.xU.Highest,function(e){return e.theme.colors.palette.greys.light},function(e){return(0,X.mq)(e.theme.breakpointUtils.map,"md")}),e5=((r=e5||{}).up="UP",r.down="DOWN",r),e3=function(e,n,t,r,o,c,a,i,s){!e&&(n>-1?t(n-1):a>-1?(0===a&&t(c-1),r(a-1)):s>-1&&(0===s&&r(i-1),o(s-1)))},e9=function(e,n,t,r,o,c,a,i,s){e!==n-1&&(t>-1?t===r-1?(i(0),s(-1)):o(e+1):c>-1?c===a-1?(o(0),i(-1)):i(c+1):e>-1&&o(e+1))},e4=function(e,n,t,r,o,c,a,i,s){var l,h,d,u,p,m,f,g,b;switch(u=null!=n&&null!==(l=n.corrections)&&void 0!==l&&l.length?null==n||null===(f=n.corrections)||void 0===f?void 0:f.length:0,p=null!=n&&null!==(h=n.suggestedSearchQueries)&&void 0!==h&&h.length?null==n||null===(g=n.suggestedSearchQueries)||void 0===g?void 0:g.length:0,m=null!=n&&null!==(d=n.products)&&void 0!==d&&d.length?null==n||null===(b=n.products)||void 0===b?void 0:b.length:0,e){case e5.up:e3(t,r,o,a,i,u,s,p,c);break;case e5.down:e9(c,m,r,u,i,s,p,a,o)}},e7=function(e,n,t,r,o,c,a){e&&(n>0?t(0):r>0?o(0):c>0&&a(0))},e6=function(e,n,t,r,o,c,a,i,s,l,h,d,u,p,m){var f,g,b,v,S,x=0;switch(v=null!=n&&null!==(f=n.corrections)&&void 0!==f&&f.length?n.corrections.length:0,S=null!=n&&null!==(g=n.suggestedSearchQueries)&&void 0!==g&&g.length?n.suggestedSearchQueries.length:0,null!=n&&null!==(b=n.products)&&void 0!==b&&b.length&&(x=n.products.length),e.key){case"Escape":t(),r&&o(!0,document,window);break;case"Enter":i||(e.preventDefault(),m());break;case"ArrowUp":(-1!==s||-1!==p||-1!==h)&&e.preventDefault(),e4(e5.up,n,i,s,l,h,d,u,p);break;case"ArrowDown":e7(i,v,l,S,d,x,u),e4(e5.down,n,i,s,l,h,d,u,p);break;case"Tab":e.shiftKey?(t(),a(!1)):c()}},ne=function(e,n,t,r,o,c,a,i){"Tab"===e.key&&""===n&&(c||a||i)&&(t(),r(!0),o&&o()),"Tab"!==e.key||""!==n||c&&a&&i||(t(),r(!1),o&&o())},nn=function(e,n){var t=en.getJSON("recentlySearchedProducts")||[];t.push({itemName:e,itemCategory:null!=n?n:"",timeStamp:new Date().getTime()});var r=t.slice(-5).reduce(function(e,n){return e.some(function(e){return e.itemName===n.itemName})||e.push(n),e},[]).filter(function(e){return""!==e.itemName.trim()});0!==r.length&&en.set("recentlySearchedProducts",JSON.stringify(r))},nt=function(){en.remove("recentlySearchedProducts")},nr=function(e,n){var t=JSON.parse(en.get("recentlySearchedProducts")).filter(function(n){return n.itemName!==e});en.set("recentlySearchedProducts",JSON.stringify(t)),n&&n(t)};function no(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function nc(e){for(var n=1;n=x?y:"";n({variables:{concessionCode:b,vipPriceEnabled:v,currency:f||"GBP",shippingDestination:g||"GB",query:y,limit:5}}),e||(c(null),s())}},[y,n,b,v,f,g,x,c,s]),q.useEffect(function(){n&&null!=r&&r.instantSearch&&y.length>=x&&(c(r.instantSearch),l(h))},[r,n,y,x,c,l,h]),q.useEffect(function(){o(sessionStorage.getItem("persistentSearchValue")||a)},[a,o]),n)?(0,ec.jsx)(eX,{type:"text","aria-label":t,placeholder:t,value:a,ref:i,"data-testid":"header-search-form-input",title:t,onKeyDown:d,onFocus:m,onChange:function(e){o(e.target.value),S&&sessionStorage.setItem("persistentSearchValue",e.target.value)}}):null},nl=function(e){var n,t,r,o,c,a=e.placeholder,i=e.searchButtonAriaLabel,s=e.clearAriaLabel,l=e.setScrollLock,h=e.inputRef,d=q.useState(""),u=(0,M.Z)(d,2),p=u[0],m=u[1],f=q.useState(null),g=(0,M.Z)(f,2),b=g[0],v=g[1],S=q.useState(-1),x=(0,M.Z)(S,2),y=x[0],w=x[1],k=q.useState(-1),j=(0,M.Z)(k,2),P=j[0],T=j[1],O=q.useState(-1),I=(0,M.Z)(O,2),D=I[0],C=I[1],R=q.useState(!1),F=(0,M.Z)(R,2),B=F[0],Z=F[1],E=q.useState([]),z=(0,M.Z)(E,2),W=z[0],A=z[1],H=q.createRef(),L=q.useState(null),V=(0,M.Z)(L,2),N=V[0],Q=V[1];q.useEffect(function(){var e=en.get("recentlySearchedProducts");e&&e.length>0&&A(JSON.parse(e))},[]),q.useEffect(function(){if(Q(null),-1!==y&&null!=b&&b.corrections){var n;Q("".concat(e.searchI18nText.correctionsTitle,": ").concat(null==b||null===(n=b.corrections[y])||void 0===n?void 0:n.correction))}if(-1!==P&&null!=b&&b.suggestedSearchQueries&&Q("".concat(e.searchI18nText.suggestionsTitle,": ").concat(null==b?void 0:b.suggestedSearchQueries[P])),-1!==D&&null!=b&&b.products){var t=(null==b?void 0:b.products.length)-1===D,r=null==b?void 0:b.products[D];Q(t?"".concat(e.searchI18nText.lastResult,", ").concat(e.searchI18nText.productsTitle,": ").concat(r.title):"".concat(e.searchI18nText.productsTitle,": ").concat(r.title))}},[y,P,D,null==b?void 0:b.corrections,null==b?void 0:b.suggestedSearchQueries,null==b?void 0:b.products,e.searchI18nText.correctionsTitle,e.searchI18nText.lastResult,e.searchI18nText.productsTitle,e.searchI18nText.suggestionsTitle]);var K=-1===y&&-1===P&&-1===D,J=function(){w(-1),T(-1),C(-1)};q.useEffect(function(){""!==p&&e.isDesktop&&"undefined"!=typeof document&&B&&l(!0,document,window)},[p,e.isDesktop,l,B]);var _=function(){m(""),e.isDesktop&&"undefined"!=typeof document&&l(!1,document,window),v(null),J()},G=function(n){var t;"undefined"!=typeof document&&l(!0,document,window),null!=h&&null!==(t=h.current)&&void 0!==t&&t.contains(n.currentTarget)&&(Z(!0),e.onFocus&&e.onFocus(n))};q.useEffect(function(){if(e.focusOnMount){var n;null==h||null===(n=h.current)||void 0===n||n.focus()}},[e.focusOnMount]);var X=function(){var n,t,r;-1!==y&&null!=b&&b.corrections&&(e.enableRecentSearches&&nn(null==b||null===(n=b.corrections[y])||void 0===n?void 0:n.correction),window.location.assign("".concat(e.autocompleteLink,"correction&search=").concat(null==b||null===(t=b.corrections[y])||void 0===t?void 0:t.correction))),-1!==P&&null!=b&&b.suggestedSearchQueries&&(e.enableRecentSearches&&nn(null==b?void 0:b.suggestedSearchQueries[P]),window.location.assign("".concat(e.autocompleteLink,"searchsuggestion&search=").concat(null==b?void 0:b.suggestedSearchQueries[P]))),-1!==D&&null!=b&&b.products&&window.location.assign(null==b||null===(r=b.products[D])||void 0===r?void 0:r.url)},Y=e.InstantSearchInjector;return(0,ec.jsxs)(eU,{ref:H,mobileSearch:e.mobileSearch,children:[(0,ec.jsxs)(eJ,{onSubmit:function(n){n.preventDefault(),e.onSubmit(p),e.enableRecentSearches&&nn(p)},inputFocused:!e.isDesktop&&B,mobileSearch:e.mobileSearch,tabIndex:0,children:[(0,ec.jsxs)(e_,{inputFocused:e.isDesktop&&B,value:p,children:[(0,ec.jsx)(eY,{children:(0,ec.jsx)(Y,{children:function(n){return(0,ec.jsx)(ns,{placeholder:a,setValue:m,setInstantSearchResults:v,inputValue:p,inputRef:h,restartIndexes:J,setAnnounceMessage:Q,resultsAvailable:e.searchI18nText.resultsAvailable,onKeyDown:function(n){return e6(n,b,_,e.isDesktop,l,J,Z,K,y,w,D,T,C,P,X)},data:n.data,execSearchQuery:n.execSearchQuery,onFocusDropdown:G,currency:e.currency,concessionCode:e.concessionCode,shippingDestination:e.shippingDestination,vipPriceEnabled:null==e?void 0:e.vipPriceEnabled,enablePersistentSearch:e.enablePersistentSearch})}})}),p&&(0,ec.jsx)(e1,{"data-testid":"clear-button",type:"button",onKeyPress:function(n){if("Enter"===n.key){var t;_(),null==h||null===(t=h.current)||void 0===t||t.focus(),e.enablePersistentSearch&&sessionStorage.removeItem("persistentSearchValue")}},onClick:function(){var n;_(),null==h||null===(n=h.current)||void 0===n||n.focus(),e.enablePersistentSearch&&sessionStorage.removeItem("persistentSearchValue")},"aria-label":s,title:s,children:(0,ec.jsx)(U.Fzz,{"data-testid":"input-delete-icon"})})]}),(0,ec.jsx)(e$,{type:"submit","aria-label":i,active:!!p,"data-testid":"header-search-form-submit-button",inputFocused:e.isDesktop&&B,onKeyDown:function(n){return ne(n,p,_,Z,e.externalClose,e.enableRecentSearches,e.enablePromotionalSearch,e.trendingTerms)},children:(null===(n=e.icon)||void 0===n?void 0:n.svgPath)!==""?(0,ec.jsx)("svg",{width:null===(t=e.icon)||void 0===t?void 0:t.width,height:null===(r=e.icon)||void 0===r?void 0:r.height,viewBox:null===(o=e.icon)||void 0===o?void 0:o.viewBox,xmlns:"http://www.w3.org/2000/svg",children:(0,ec.jsx)("path",{d:null===(c=e.icon)||void 0===c?void 0:c.svgPath,"fill-rule":"evenodd"})}):(0,ec.jsx)(U.olm,{})})]}),(0,ec.jsx)(nd,nc(nc(nc({},e),{},{instantSearchResults:b,movePastInput:function(){m(""),e.isDesktop&&l(!1,document,window),v(null),J(),Z(!1),e.externalClose&&e.externalClose()},inputValue:p,correctionsIndex:y,productsIndex:D,suggestionsIndex:P,clearInput:_,inputFocused:B,clickAway:function(){_(),Z(!1)}},e.enableRecentSearches&&{setRecentSearches:A,enableRecentSearches:e.enableRecentSearches,recentlySearched:W,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,onClick:nt,clearRecentSearch:e.clearRecentSearch,onClickSearchSuggestions:function(e){return nn(e)}}),{},{promotionalProducts:e.promotionalProducts,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,enableTrendingSearch:e.enableTrendingSearch,onClickSearchComponent:function(n){e.enableRecentSearches&&nn(n)},displaySocialEngagement:e.displaySocialEngagement})),N&&e.renderAnnouncer("assertive",N)]})},nh=function(e){var n="undefined"!=typeof document&&document?document.documentElement.clientWidth:0;return(0,ec.jsx)(e8,{children:(0,ec.jsxs)(eq,{pageWidth:n,cutBottom:_.n,slimHeader:e.slimHeader,style:{overflow:"auto"},paddingTop:e.isDesktop?0:2,children:[e.enableRecentSearches&&e.recentlySearched&&e.recentlySearched.length>0&&(0,ec.jsx)(ed,nc(nc({recentlySearched:e.recentlySearched,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,onClick:nt,clearRecentSearch:e.clearRecentSearch},!e.enablePromotionalSearch&&!e.trendingTerms&&{movePastInput:e.movePastInput}),{},{removeIndividualSearch:function(n){nr(n,e.setRecentSearches)}})),(0,ec.jsx)(na,{promotionalProducts:e.promotionalProducts,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,movePastInput:e.movePastInput,onClickSearchComponent:e.onClickSearchComponent,enableTrendingSearch:e.enableTrendingSearch})]})})},nd=function(e){var n,t,r,o,c,a,i=q.useState(null),s=(0,M.Z)(i,2),l=s[0],h=s[1];q.useEffect(function(){h(e.instantSearchResults)},[e.instantSearchResults]);var d=(n=e.enableTrendingSearch,t=e.enablePromotionalSearch,r=e.enableRecentSearches,o=e.inputFocused,c=e.inputValue,a=e.displaySocialEngagement,(n||t||r)&&(o||a)&&(!c||(null==c?void 0:c.length)<=2));return(0,ec.jsxs)(et.H8,{children:[(0,ec.jsx)(q.Fragment,{children:l&&!d&&(0,ec.jsx)(e0,{shouldDisplay:!!(e.inputValue&&e.instantSearchResults&&e.inputFocused),isDesktop:e.isDesktop,searchResults:l,searchI18nText:e.searchI18nText,autocompleteLink:e.autocompleteLink,inputValue:e.inputValue,correctionsIndex:e.correctionsIndex,suggestionsIndex:e.suggestionsIndex,productsIndex:e.productsIndex,clearInput:e.clearInput,movePastInput:e.movePastInput,fromText:e.searchI18nText.fromText,rrpText:e.searchI18nText.rrpText,freeText:e.searchI18nText.freeText,mobileSearch:e.mobileSearch,slimHeader:e.slimHeader,showPowerReview:e.showPowerReview,onClickSearchSuggestions:e.onClickSearchSuggestions&&e.onClickSearchSuggestions})}),d&&(0,ec.jsx)(nh,{inputFocused:e.inputFocused,inputValue:e.inputValue,isDesktop:e.isDesktop,slimHeader:e.slimHeader,movePastInput:e.movePastInput,recentlySearched:e.recentlySearched,recentlySearchedTitle:e.recentlySearchedTitle,recentlySearchedText:e.recentlySearchedText,clearRecentSearch:e.clearRecentSearch,enablePromotionalSearch:e.enablePromotionalSearch,trendingTerms:e.trendingTerms,setRecentSearches:e.setRecentSearches,promotionalProducts:e.promotionalProducts,onClickSearchComponent:e.onClickSearchComponent,enableRecentSearches:e.enableRecentSearches,enableTrendingSearch:e.enableTrendingSearch}),e.isDesktop&&e.inputFocused&&(0,ec.jsx)(e2,{onClick:e.clickAway,onTouchStart:e.clickAway,"data-testid":"search-overlay",variants:{enter:{opacity:0},center:{opacity:1},exit:{opacity:0}},initial:"enter",animate:"center",exit:"exit",transition:{ease:"easeInOut",duration:.3}},"search-overlay")]})};function nu(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function np(e){for(var n=1;n