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,IAAM,CAAA,GAAA,mCAAQ,EAAE,cAAc,aAAa;QAAC;QAAc;KAAW;IAEvF,CAAA,GAAA,2DAAc,EAAE;QACd,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,QAAQ;YACnD,IAAI,CAAC,WAAW,OAAO,EACrB,QAAQ,IAAI,CACV;iBAEG,IAAI,WAAW,OAAO,CAAC,SAAS,KAAK,aAC1C,QAAQ,IAAI,CACV,CAAC,yEAAyE,EAAE,YAAY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,0DAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,uBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaLabelingProps, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n  AllHTMLAttributes,\n  AnchorHTMLAttributes,\n  Context,\n  CSSProperties,\n  DetailedHTMLProps,\n  ForwardedRef,\n  forwardRef,\n  JSX,\n  ReactElement,\n  ReactNode,\n  RefCallback,\n  useCallback,\n  useContext,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n  slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n  | [ProviderValue<A>]\n  | [ProviderValue<A>, ProviderValue<B>]\n  | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n  | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n  | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>,\n      ProviderValue<H>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>,\n      ProviderValue<H>,\n      ProviderValue<I>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>,\n      ProviderValue<H>,\n      ProviderValue<I>,\n      ProviderValue<J>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>,\n      ProviderValue<H>,\n      ProviderValue<I>,\n      ProviderValue<J>,\n      ProviderValue<K>\n    ]\n  | [\n      ProviderValue<A>,\n      ProviderValue<B>,\n      ProviderValue<C>,\n      ProviderValue<D>,\n      ProviderValue<E>,\n      ProviderValue<F>,\n      ProviderValue<G>,\n      ProviderValue<H>,\n      ProviderValue<I>,\n      ProviderValue<J>,\n      ProviderValue<K>,\n      ProviderValue<L>\n    ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n  values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n  children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n  values,\n  children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n  for (let [Context, value] of values) {\n    // @ts-ignore\n    children = <Context.Provider value={value}>{children}</Context.Provider>;\n  }\n\n  return children as JSX.Element;\n}\n\nexport interface StyleProps {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element.\n   */\n  className?: string;\n  /**\n   * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n   * element.\n   */\n  style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n  /** The children of the component. */\n  children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n  | string\n  | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n  | CSSProperties\n  | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n  T,\n  E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   */\n  className?: ClassNameOrFunction<T>;\n  /**\n   * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n   * element. A function may be provided to compute the style based on component state.\n   */\n  style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n  | ReactNode\n  | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n  T,\n  E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n  /**\n   * The children of the component. A function may be provided to alter the children based on\n   * component state.\n   */\n  children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n  extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n  values: T;\n  defaultChildren?: ReactNode;\n  defaultClassName?: string;\n  defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n  className?: string;\n  style?: CSSProperties;\n  children?: ReactNode;\n  'data-rac': string;\n  render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n  props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n  let {\n    className,\n    style,\n    children,\n    defaultClassName = undefined,\n    defaultChildren = undefined,\n    defaultStyle,\n    values,\n    render\n  } = props;\n\n  return useMemo(() => {\n    let computedClassName: string | undefined;\n    let computedStyle: React.CSSProperties | undefined;\n    let computedChildren: React.ReactNode | undefined;\n\n    if (typeof className === 'function') {\n      computedClassName = className({...values, defaultClassName});\n    } else {\n      computedClassName = className;\n    }\n\n    if (typeof style === 'function') {\n      computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n    } else {\n      computedStyle = style;\n    }\n\n    if (typeof children === 'function') {\n      computedChildren = children({...values, defaultChildren});\n    } else if (children == null) {\n      computedChildren = defaultChildren;\n    } else {\n      computedChildren = children;\n    }\n\n    return {\n      className: computedClassName ?? defaultClassName,\n      style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n      children: computedChildren ?? defaultChildren,\n      'data-rac': '',\n      render: render ? props => render(props, values) : undefined\n    };\n  }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n  // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n  value: T extends any ? T | ((renderProps: U) => V) : never,\n  wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n  return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n  /**\n   * A slot name for the component. Slots allow the component to receive props from a parent\n   * component. An explicit `null` value indicates that the local props completely override all\n   * props received from a parent.\n   */\n  slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n  context: Context<SlottedContextValue<T>>,\n  slot?: string | null\n): T | null | undefined {\n  let ctx = useContext(context);\n  if (slot === null) {\n    // An explicit `null` slot means don't use context.\n    return null;\n  }\n  if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n    let slotKey = slot || DEFAULT_SLOT;\n    if (!ctx.slots[slotKey]) {\n      let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n      let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n      throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n    }\n    return ctx.slots[slotKey];\n  }\n  // @ts-ignore\n  return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n  props: T & SlotProps,\n  ref: ForwardedRef<E> | undefined,\n  context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n  let ctx = useSlottedContext(context, props.slot) || {};\n  let {ref: contextRef, ...contextProps} = ctx as any;\n  let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n  let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n  // mergeProps does not merge `style`. Adding this there might be a breaking change.\n  if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n    if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n      // @ts-ignore\n      mergedProps.style = renderProps => {\n        let contextStyle =\n          typeof contextProps.style === 'function'\n            ? contextProps.style(renderProps)\n            : contextProps.style;\n        let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n        let style =\n          typeof props.style === 'function'\n            ? props.style({...renderProps, defaultStyle})\n            : props.style;\n        return {...defaultStyle, ...style};\n      };\n    } else {\n      // @ts-ignore\n      mergedProps.style = {...contextProps.style, ...props.style};\n    }\n  }\n\n  return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n  initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n  // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n  // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n  let [hasSlot, setHasSlot] = useState(initialState);\n  let hasRun = useRef(false);\n\n  // A callback ref which will run when the slotted element mounts.\n  // This should happen before the useLayoutEffect below.\n  let ref = useCallback(el => {\n    hasRun.current = true;\n    setHasSlot(!!el);\n  }, []);\n\n  // If the callback hasn't been called, then reset to false.\n  useLayoutEffect(() => {\n    if (!hasRun.current) {\n      setHasSlot(false);\n    }\n  }, []);\n\n  return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n  const prefix = /^(data-.*)$/;\n  let filteredProps = {} as T;\n\n  for (const prop in props) {\n    if (!prefix.test(prop)) {\n      filteredProps[prop] = props[prop];\n    }\n  }\n\n  return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n  /**\n   * Whether to use native HTML form validation to prevent form submission\n   * when the value is missing or invalid, or mark the field as required\n   * or invalid via ARIA.\n   *\n   * @default 'native'\n   */\n  validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n  props: React.JSX.IntrinsicElements[E],\n  renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n  /**\n   * Overrides the default DOM element with a custom render function.\n   * This allows rendering existing components with built-in styles and behaviors\n   * such as router links, animation libraries, and pre-styled components.\n   *\n   * Requirements:\n   *\n   * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n   *   `<a>`).\n   * - Only a single root DOM element can be rendered (no fragments).\n   * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n   *   as appropriate.\n   */\n  render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n  Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n  /**\n   * Overrides the default DOM element with a custom render function.\n   * This allows rendering existing components with built-in styles and behaviors\n   * such as router links, animation libraries, and pre-styled components.\n   *\n   * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n   *\n   * Requirements:\n   *\n   * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n   *   `<button>`).\n   * - Only a single root DOM element can be rendered (no fragments).\n   * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n   *   as appropriate.\n   */\n  render?: (\n    props:\n      | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n      | React.JSX.IntrinsicElements[Fallback],\n    renderProps: T\n  ) => ReactElement;\n}\n\nfunction DOMElement(\n  ElementType: string,\n  props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n  forwardedRef: ForwardedRef<HTMLElement>\n) {\n  let {render, ...otherProps} = props;\n  let elementRef = useRef<HTMLElement | null>(null);\n  let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n  useLayoutEffect(() => {\n    if (process.env.NODE_ENV !== 'production' && render) {\n      if (!elementRef.current) {\n        console.warn(\n          'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n        );\n      } else if (elementRef.current.localName !== ElementType) {\n        console.warn(\n          `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n        );\n      }\n    }\n  }, [ElementType, render]);\n\n  let domProps: any = {...otherProps, ref};\n  if (render) {\n    return render(domProps, undefined);\n  }\n\n  return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n  [E in keyof React.JSX.IntrinsicElements]: (\n    props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n  ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n  {},\n  {\n    get(target, elementType) {\n      if (typeof elementType !== 'string') {\n        return undefined;\n      }\n\n      let res = domComponentCache[elementType];\n      if (!res) {\n        res = forwardRef(DOMElement.bind(null, elementType));\n        domComponentCache[elementType] = res;\n      }\n\n      return res;\n    }\n  }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.cjs.map"}