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,CAAA,UAAU,CAAE,CAAA,OAAO,aAAa,IAAI,WAAW,QAAQ,AAAD,IAAK,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QAC7G,OAAO,WAAW,IAAI,CAAC,KAAK;QAC5B,QAAQ,WAAW,IAAI,CAAC,MAAM;IAChC;IAEA,sEAAsE;IACtE,OAAO,OAAO,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAC9C,IAAI,CAAC,OAAO,QAAQ,CAAC,QACnB,UAAU,CAAC,IAAI,GAAG;IAEtB;IAEA,IAAI,QAAuB;QACzB,UAAU,WAAW,QAAQ,GAAG,WAAW;QAC3C,qJAAqJ;QACrJ,SAAS,WAAW,QAAQ,GAAG,iBAAiB;QAChD,UAAU,WAAW,aAAa,GAAG,YAAY;QACjD,SAAS,WAAW,OAAO;QAC3B,QAAQ,WAAW,MAAM;QACzB,WAAW,WAAW,SAAS,IAAI;QACnC,SAAS;QACT,GAAG,UAAU;IACf;IAEA,4BAAM,GAAG,CAAC,YAAY;IACtB,OAAO;AACT","sources":["packages/react-aria/src/virtualizer/VirtualizerItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from 'react-stately/useVirtualizerState';\nimport React, {CSSProperties, JSX, ReactNode, useRef} from 'react';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n  layoutInfo: LayoutInfo,\n  parent?: LayoutInfo | null,\n  style?: CSSProperties,\n  className?: string,\n  children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps): JSX.Element {\n  let {style, className, layoutInfo, virtualizer, parent, children} = props;\n  let {direction} = useLocale();\n  let ref = useRef<HTMLDivElement | null>(null);\n  useVirtualizerItem({\n    layoutInfo,\n    virtualizer,\n    ref\n  });\n\n  return (\n    <div role=\"presentation\" ref={ref} className={className} style={{...layoutInfoToStyle(layoutInfo, direction, parent), ...style}}>\n      {children}\n    </div>\n  );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n  let xProperty = dir === 'rtl' ? 'right' : 'left';\n  let cached = cache.get(layoutInfo);\n  if (cached && cached[xProperty] != null) {\n    if (!parent) {\n      return cached;\n    }\n\n    // Invalidate if the parent position changed.\n    let top = layoutInfo.rect.y - parent.rect.y;\n    let x = layoutInfo.rect.x - parent.rect.x;\n    if (cached.top === top && cached[xProperty] === x) {\n      return cached;\n    }\n  }\n\n  let rectStyles: Record<string, number | undefined> = {\n    // TODO: For layoutInfos that are sticky that have parents with overflow visible, their \"top\" will be relative to the to the nearest scrolling container\n    // which WON'T be the parent since the parent has overflow visible. This means we shouldn't offset the height by the parent's position\n    // Not 100% about this change here since it is quite ambigious what the scrolling container maybe and how its top is positioned with respect to the\n    // calculated layoutInfo.y here\n    top: layoutInfo.rect.y - (parent && !(parent.allowOverflow && layoutInfo.isSticky) ? parent.rect.y : 0),\n    [xProperty]: layoutInfo.rect.x - (parent && !(parent.allowOverflow && layoutInfo.isSticky) ? parent.rect.x : 0),\n    width: layoutInfo.rect.width,\n    height: layoutInfo.rect.height\n  };\n\n  // Get rid of any non finite values since they aren't valid css values\n  Object.entries(rectStyles).forEach(([key, value]) => {\n    if (!Number.isFinite(value)) {\n      rectStyles[key] = undefined;\n    }\n  });\n\n  let style: CSSProperties = {\n    position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n    // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n    display: layoutInfo.isSticky ? 'inline-block' : undefined,\n    overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n    opacity: layoutInfo.opacity,\n    zIndex: layoutInfo.zIndex,\n    transform: layoutInfo.transform ?? undefined,\n    contain: 'size layout style',\n    ...rectStyles\n  };\n\n  cache.set(layoutInfo, style);\n  return style;\n}\n"],"names":[],"version":3,"file":"VirtualizerItem.cjs.map"}