import e from"@babel/runtime/helpers/defineProperty";import o from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{memo as r,useState as i,useRef as n,useEffect as a}from"react";import l from"classnames";import{makeStyles as c,List as p}from"@material-ui/core";import{throttle as d}from"lodash";import s from"../context/index.js";import{jsxs as b,jsx as u}from"react/jsx-runtime";var m=["children"];function f(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable}))),t.push.apply(t,r)}return t}function h(o){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){e(o,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(r,e))}))}return o}var g=c((function(e){var o=e.palette,t=e.spacing;return{list:{height:"100%",padding:t(1,0),fontSize:16,"& .MuiAutocomplete-option":{display:"block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.16)"}},'& .MuiAutocomplete-option[aria-selected="true"]':{backgroundColor:"initial"},"& .MuiAutocomplete-option:active":{backgroundColor:"initial"}},noTopPadding:{paddingTop:0,"& $topShadow::before":{top:0}},shadow:{position:"sticky",display:"none",width:"100%",zIndex:1,"&::before":{content:"''",position:"absolute",width:"100%",height:t(1),zIndex:1}},bottomShadow:{bottom:0,"&::before":{bottom:t(-1),backgroundImage:"linear-gradient(180deg, rgba(65, 65, 65, 0) 0%, ".concat(o.background.b9," 100%)")}},topShadow:{top:0,"&::before":{top:t(-1),backgroundImage:"linear-gradient(0deg, rgba(65, 65, 65, 0) 0%, ".concat(o.background.b9," 100%)")}},visibleShadow:{display:"block"}}})),v=r((function(e){var r=e.children,c=t(e,m),f=i(!1),v=o(f,2),w=v[0],O=v[1],y=i(!1),j=o(y,2),S=j[0],P=j[1],k=n(),x=g(),T=s().AllSelectComponent;return a((function(){var e=k.current,o=d((function(){O((null==e?void 0:e.scrollTop)>0),P((null==e?void 0:e.clientHeight)+(null==e?void 0:e.scrollTop)<(null==e?void 0:e.scrollHeight))}),100,{leading:!0});return o(),null==e||e.addEventListener("scroll",o),function(){null==e||e.removeEventListener("scroll",o)}})),b(p,h(h({},c),{},{className:l(c.className,x.list,!!T&&x.noTopPadding),ref:k,role:"listbox",children:[u("div",{className:l(x.shadow,x.topShadow,w&&x.visibleShadow)}),r,u("div",{className:l(x.shadow,x.bottomShadow,S&&x.visibleShadow)})]}))}));export{v as default};
//# sourceMappingURL=Listbox.js.map
