"use strict";var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("react/jsx-runtime"),t=require("react"),a=require("lodash"),n=require("classnames"),i=require("@material-ui/core");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=c(e),l=c(n),s=i.makeStyles((function(e){var r=e.palette;return{recentSearchesWrapper:{paddingBottom:"8px"},option:{display:"flex",alignItems:"center",padding:"0 16px","&:hover":{cursor:"pointer",backgroundColor:"rgba(255, 255, 255, 0.16)"}},label:{lineHeight:"36px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},caption:{color:r.primary.text6,fontSize:"12px",padding:"16px 0 8px 16px"},recentSearchesIcon:{width:"16px",height:"16px",color:r.primary.text6,marginRight:"16px"}}})),u=function(e,r,t){e.setItem(r,JSON.stringify(t))};module.exports=function(e){var n=e.className,c=e.title,p=e.Icon,d=e.onInputChange,f=e.inputValue,m=e.isHidden,x=e.maxCount,h=e.dataStorageKey,g=e.dataStorage,v=e.clearable,S=function(e,r){return JSON.parse(e.getItem(r))||[]}(g,h),y=s();if(t.useEffect((function(){var e;null!=f&&f.trim()&&!S.includes(f)&&(e=f,u(g,h,a.take([e].concat(o.default(S)),x)))}),[f]),a.isEmpty(S)||m)return null;var b=null==S?void 0:S.map((function(e){return r.jsxs("div",{className:y.option,"data-testid":"".concat("RecentSearches","_").concat(e),onClick:function(){!function(e){u(g,h,v?S:S.filter((function(r){return r!==e}))),d(e)}(e)},children:[p&&r.jsx(p,{className:y.recentSearchesIcon}),r.jsx("div",{className:y.label,children:e})]},e)}));return r.jsxs("div",{className:l.default(y.recentSearchesWrapper,n),children:[c&&r.jsx(i.Typography,{className:y.caption,children:c}),b]})};
//# sourceMappingURL=RecentSearches.js.map
