import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/objectWithoutProperties";import{jsxs as o,jsx as i}from"react/jsx-runtime";import{forwardRef as n,useRef as l,useState as c,Children as s,useCallback as a,isValidElement as u}from"react";import{AutoSizer as p,List as m}from"react-virtualized";import f from"classnames";import{useContainerMaxHeight as d}from"./hooks/useContainerMaxHeight.js";import h from"./VirtualizedListBox.module.css.js";import v from"../../../../../../componentsV2/Autocomplete/Autocomplete.scss.js";var b=["children","className"];function y(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,o)}return t}function O(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?y(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var j=n((function(r,n){var y=r.children,j=r.className,g=t(r,b),w=l(null),P=c(!1),x=e(P,2),N=x[0],k=x[1],z=c(null),A=e(z,2),D=A[0],M=A[1],S=d(D),B=s.toArray(y),C=B.length>0&&function(r){var e,t,o,i=null===(e=r.props)||void 0===e?void 0:e.children;if(!u(i))return!1;var n=null===(t=i.props)||void 0===t?void 0:t.children;if(!u(n))return!1;var l=null===(o=n.props)||void 0===o?void 0:o.className;return"string"==typeof l&&l.includes("sticky")}(B[0])?B[0]:null,H=C?B.slice(1):B,L=H.length,V=36*Math.min(L,16),E=S-(C?36:0),R=Math.min(V,Math.max(E,36)),T=function(r){var e=r.index,t=r.key,o=r.style,n=H[e];return u(n)?i("div",{style:o,className:h.row,children:n},t):null},W=a((function(r){var e=r.scrollTop;k(e>0)}),[]),q=a((function(r){M(r),"function"==typeof n?n(r):n&&(n.current=r)}),[n]);return o("div",O(O({ref:q,className:f(j,h.listBox,N&&v.listboxScrolled)},g),{},{children:[C,L>0&&i(p,{disableHeight:!0,children:function(r){var e=r.width;return i(m,{ref:w,width:e,height:R,rowCount:L,rowHeight:36,rowRenderer:T,overscanRowCount:5,onScroll:W,className:h.virtualizedList})}})]}))}));j.displayName="VirtualizedListBox";export{j as VirtualizedListBox};
//# sourceMappingURL=VirtualizedListBox.js.map
