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B,IAChD,oBAAE,GAAwB,EAKhC,OAJA,EAAA,+BAAA,iBAAgB,KACd,EAAqB,GAAU,EAAQ,GAChC,IAAM,EAAqB,GAAU,EAAQ,IACnD,CAAC,KACG,EAAA,mBAAA,KAAC,uBAAA,UAAU,EAAV,CAAY,GAAI,EAAQ,iBAAmB,EAAkB,IAAK,GAC5E,EATA,sBAgBI,WAAa,cAKb,YAAoC,MAAA,WACxC,OAAA,SAAqB,EAAsC,GACzD,MAAM,cAAE,KAAkB,GAAe,EACnC,EAAU,iBAAiB,WAAY,GAC7C,OACE,EAAA,mBAAA,KAAC,uBAAA,UAAU,OAAV,CACC,KAAK,YACD,EACJ,IAAK,EACL,SAAA,EAAS,iBAAA,sBAAqB,EAAM,QAAS,IAAM,EAAQ,cAAa,KAG9E,EAXA,gBAeW,gBAOT,OAAC,GACI,EAAM,SADX,mBAOJ,SAAS,yBAAyB,GAChC,MAAM,EAAM,IAAI,IAChB,UAAW,KAAS,EAClB,GAAqB,iBAAV,EACX,UAAW,KAAM,OAAO,GAAO,OAAO,MAAM,OACtC,GAAI,EAAI,IAAI,GAIpB,OAAO,EAAI,KAAO,EAAI,MAAM,KAAK,GAAK,KAAK,UAAO,CACpD,CAEA,SAAS,SAAS,GAChB,OAAO,EAAO,OAAS,QACzB,CAdS,OAAA,sBAAA,yBAYA,OAAA,SAAA","file":"/npm/@radix-ui/react-dialog@1.3.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/@radix-ui/react-dialog@1.3.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use client';\nexport {\n  createDialogScope,\n  //\n  Dialog,\n  DialogTrigger,\n  DialogPortal,\n  DialogOverlay,\n  DialogContent,\n  DialogTitle,\n  DialogDescription,\n  DialogClose,\n  //\n  Root,\n  Trigger,\n  Portal,\n  Overlay,\n  Content,\n  Title,\n  Description,\n  Close,\n  /** @deprecated Noop component to avoid breaking changes. */\n  WarningProvider,\n} from './dialog';\nexport type {\n  DialogProps,\n  DialogTriggerProps,\n  DialogPortalProps,\n  DialogOverlayProps,\n  DialogContentProps,\n  DialogTitleProps,\n  DialogDescriptionProps,\n  DialogCloseProps,\n} from './dialog';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useId } from '@radix-ui/react-id';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { DismissableLayer, useDismissableLayerSurface } from '@radix-ui/react-dismissable-layer';\nimport {\n  FocusScope,\n  FocusScopeBranchProvider,\n  useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { RemoveScroll } from 'react-remove-scroll';\nimport { hideOthers } from 'aria-hidden';\nimport { createSlot } from '@radix-ui/react-slot';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\n\n/* -------------------------------------------------------------------------------------------------\n * Dialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst DIALOG_NAME = 'Dialog';\n\ntype ScopedProps<P> = P & { __scopeDialog?: Scope | undefined };\nconst [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);\n\ntype DialogContextValue = {\n  triggerRef: React.RefObject<HTMLButtonElement | null>;\n  contentRef: React.RefObject<DialogContentElement | null>;\n  contentId: string;\n  titleId: string;\n  descriptionId: string;\n  titlePresent: boolean;\n  descriptionPresent: boolean;\n  setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n  setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n  open: boolean;\n  onOpenChange(open: boolean): void;\n  onOpenToggle(): void;\n  modal: boolean;\n  // Nodes of nested, portalled layers (eg. a non-modal `Popover`) that should\n  // be treated as part of this Dialog for focus trapping and scroll locking.\n  // See https://github.com/radix-ui/primitives/issues/3423\n  branchNodes: HTMLElement[];\n  branchRegistry: FocusScopeBranchRegistry;\n};\n\nconst [DialogProvider, useDialogContext] = createDialogContext<DialogContextValue>(DIALOG_NAME);\n\ninterface DialogProps {\n  children?: React.ReactNode | undefined;\n  open?: boolean | undefined;\n  defaultOpen?: boolean | undefined;\n  onOpenChange?: { bivarianceHack(open: boolean): void }['bivarianceHack'] | undefined;\n  modal?: boolean | undefined;\n}\n\nconst Dialog: React.FC<DialogProps> = (props: ScopedProps<DialogProps>) => {\n  const {\n    __scopeDialog,\n    children,\n    open: openProp,\n    defaultOpen,\n    onOpenChange,\n    modal = true,\n  } = props;\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const contentRef = React.useRef<DialogContentElement>(null);\n  const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n  const [open, setOpen] = useControllableState({\n    prop: openProp,\n    defaultProp: defaultOpen ?? false,\n    onChange: onOpenChange,\n    caller: DIALOG_NAME,\n  });\n\n  const [titleCount, setTitleCount] = React.useState(0);\n  const [descriptionCount, setDescriptionCount] = React.useState(0);\n\n  return (\n    <DialogProvider\n      scope={__scopeDialog}\n      triggerRef={triggerRef}\n      contentRef={contentRef}\n      contentId={useId()}\n      titleId={useId()}\n      descriptionId={useId()}\n      titlePresent={titleCount > 0}\n      descriptionPresent={descriptionCount > 0}\n      setTitleCount={setTitleCount}\n      setDescriptionCount={setDescriptionCount}\n      open={open}\n      onOpenChange={setOpen}\n      onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n      modal={modal}\n      branchNodes={branchNodes}\n      branchRegistry={branchRegistry}\n    >\n      {children}\n    </DialogProvider>\n  );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DialogTrigger';\n\ntype DialogTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DialogTriggerProps extends PrimitiveButtonProps {}\n\nconst DialogTrigger = /* @__PURE__ */ React.forwardRef<DialogTriggerElement, DialogTriggerProps>(\n  function DialogTrigger(props: ScopedProps<DialogTriggerProps>, forwardedRef) {\n    const { __scopeDialog, ...triggerProps } = props;\n    const context = useDialogContext(TRIGGER_NAME, __scopeDialog);\n    const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n    return (\n      <Primitive.button\n        type=\"button\"\n        aria-haspopup=\"dialog\"\n        aria-expanded={context.open}\n        aria-controls={context.open ? context.contentId : undefined}\n        data-state={getState(context.open)}\n        {...triggerProps}\n        ref={composedTriggerRef}\n        onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n      />\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DialogPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createDialogContext<PortalContextValue>(PORTAL_NAME, {\n  forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface DialogPortalProps {\n  children?: React.ReactNode | undefined;\n  /**\n   * Specify a container element to portal the content into.\n   */\n  container?: PortalProps['container'] | undefined;\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true | undefined;\n}\n\nconst DialogPortal: React.FC<DialogPortalProps> = (props: ScopedProps<DialogPortalProps>) => {\n  const { __scopeDialog, forceMount, children, container } = props;\n  const context = useDialogContext(PORTAL_NAME, __scopeDialog);\n  return (\n    <PortalProvider scope={__scopeDialog} forceMount={forceMount}>\n      {React.Children.map(children, (child) => (\n        <Presence present={forceMount || context.open}>\n          <PortalPrimitive asChild container={container}>\n            {child}\n          </PortalPrimitive>\n        </Presence>\n      ))}\n    </PortalProvider>\n  );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'DialogOverlay';\n\ntype DialogOverlayElement = DialogOverlayImplElement;\ninterface DialogOverlayProps extends DialogOverlayImplProps {\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true | undefined;\n}\n\nconst DialogOverlay = /* @__PURE__ */ React.forwardRef<DialogOverlayElement, DialogOverlayProps>(\n  function DialogOverlay(props: ScopedProps<DialogOverlayProps>, forwardedRef) {\n    const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);\n    const { forceMount = portalContext.forceMount, ...overlayProps } = props;\n    const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);\n    return context.modal ? (\n      <Presence present={forceMount || context.open}>\n        <DialogOverlayImpl {...overlayProps} ref={forwardedRef} />\n      </Presence>\n    ) : null;\n  },\n);\n\ntype DialogOverlayImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DialogOverlayImplProps extends PrimitiveDivProps {}\n\nconst Slot = createSlot('DialogOverlay.RemoveScroll');\n\nconst DialogOverlayImpl = /* @__PURE__ */ React.forwardRef<\n  DialogOverlayImplElement,\n  DialogOverlayImplProps\n>(\n  // blank line to reduce diff noise\n  function DialogOverlayImpl(props: ScopedProps<DialogOverlayImplProps>, forwardedRef) {\n    const { __scopeDialog, ...overlayProps } = props;\n    const context = useDialogContext(OVERLAY_NAME, __scopeDialog);\n\n    // Register the overlay as a dismiss surface so a consumer calling\n    // `stopPropagation` on it (eg. to avoid triggering parent handlers) does not\n    // prevent the dialog from closing. See: https://github.com/radix-ui/primitives/issues/3346\n    const registerDismissableSurface = useDismissableLayerSurface();\n    const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);\n\n    return (\n      // Make sure `Content` is scrollable even when it doesn't live inside\n      // `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested\n      // layers are registered as branches and added as shards so they remain\n      // scrollable too. See https://github.com/radix-ui/primitives/issues/3423\n      <RemoveScroll\n        as={Slot}\n        allowPinchZoom\n        shards={React.useMemo(\n          () => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))],\n          [context.contentRef, context.branchNodes],\n        )}\n      >\n        <Primitive.div\n          data-state={getState(context.open)}\n          {...overlayProps}\n          ref={composedRefs}\n          // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.\n          style={{ pointerEvents: 'auto', ...overlayProps.style }}\n        />\n      </RemoveScroll>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DialogContent';\n\ntype DialogContentElement = DialogContentTypeElement;\ninterface DialogContentProps extends DialogContentTypeProps {\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true | undefined;\n}\n\nconst DialogContent = /* @__PURE__ */ React.forwardRef<DialogContentElement, DialogContentProps>(\n  function DialogContent(props: ScopedProps<DialogContentProps>, forwardedRef) {\n    const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);\n    const { forceMount = portalContext.forceMount, ...contentProps } = props;\n    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n    return (\n      <Presence present={forceMount || context.open}>\n        {context.modal ? (\n          <DialogContentModal {...contentProps} ref={forwardedRef} />\n        ) : (\n          <DialogContentNonModal {...contentProps} ref={forwardedRef} />\n        )}\n      </Presence>\n    );\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentTypeElement = DialogContentImplElement;\ninterface DialogContentTypeProps extends Omit<\n  DialogContentImplProps,\n  'trapFocus' | 'disableOutsidePointerEvents'\n> {}\n\nconst DialogContentModal = /* @__PURE__ */ React.forwardRef<\n  DialogContentTypeElement,\n  DialogContentTypeProps\n>(\n  // blank line to reduce diff noise\n  function DialogContentModal(props: ScopedProps<DialogContentTypeProps>, forwardedRef) {\n    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n    const contentRef = React.useRef<HTMLDivElement>(null);\n    const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);\n\n    // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n    React.useEffect(() => {\n      const content = contentRef.current;\n      if (content) return hideOthers(content);\n    }, []);\n\n    return (\n      <DialogContentImpl\n        {...props}\n        ref={composedRefs}\n        // we make sure focus isn't trapped once `DialogContent` has been closed\n        // (closed !== unmounted when animating out)\n        trapFocus={context.open}\n        disableOutsidePointerEvents={context.open}\n        onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n          event.preventDefault();\n          context.triggerRef.current?.focus();\n        })}\n        onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {\n          const originalEvent = event.detail.originalEvent;\n          const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n          const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n          // If the event is a right-click, we shouldn't close because\n          // it is effectively as if we right-clicked the `Overlay`.\n          if (isRightClick) event.preventDefault();\n        })}\n        // When focus is trapped, a `focusout` event may still happen.\n        // We make sure we don't trigger our `onDismiss` in such case.\n        onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) =>\n          event.preventDefault(),\n        )}\n      />\n    );\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst DialogContentNonModal = /* @__PURE__ */ React.forwardRef<\n  DialogContentTypeElement,\n  DialogContentTypeProps\n>(\n  // blank line to reduce diff noise\n  function DialogContentNonModal(props: ScopedProps<DialogContentTypeProps>, forwardedRef) {\n    const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);\n    const hasInteractedOutsideRef = React.useRef(false);\n    const hasPointerDownOutsideRef = React.useRef(false);\n\n    return (\n      <DialogContentImpl\n        {...props}\n        ref={forwardedRef}\n        trapFocus={false}\n        disableOutsidePointerEvents={false}\n        onCloseAutoFocus={(event) => {\n          props.onCloseAutoFocus?.(event);\n\n          if (!event.defaultPrevented) {\n            if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n            // Always prevent auto focus because we either focus manually or want user agent focus\n            event.preventDefault();\n          }\n\n          hasInteractedOutsideRef.current = false;\n          hasPointerDownOutsideRef.current = false;\n        }}\n        onInteractOutside={(event) => {\n          props.onInteractOutside?.(event);\n\n          if (!event.defaultPrevented) {\n            hasInteractedOutsideRef.current = true;\n            if (event.detail.originalEvent.type === 'pointerdown') {\n              hasPointerDownOutsideRef.current = true;\n            }\n          }\n\n          // Prevent dismissing when clicking the trigger.\n          // As the trigger is already setup to close, without doing so would\n          // cause it to close and immediately open.\n          const target = event.target as HTMLElement;\n          const targetIsTrigger = context.triggerRef.current?.contains(target);\n          if (targetIsTrigger) event.preventDefault();\n\n          // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n          // we will get the pointer down outside event on the trigger, but then a subsequent\n          // focus outside event on the container, we ignore any focus outside event when we've\n          // already had a pointer down outside event.\n          if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n            event.preventDefault();\n          }\n        }}\n      />\n    );\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype DialogContentImplElement = React.ComponentRef<typeof DismissableLayer>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ninterface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {\n  /**\n   * When `true`, focus cannot escape the `Content` via keyboard,\n   * pointer, or a programmatic focus.\n   * @defaultValue false\n   */\n  trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n  /**\n   * Event handler called when auto-focusing on open.\n   * Can be prevented.\n   */\n  onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n  /**\n   * Event handler called when auto-focusing on close.\n   * Can be prevented.\n   */\n  onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n}\n\nconst DialogContentImpl = /* @__PURE__ */ React.forwardRef<\n  DialogContentImplElement,\n  DialogContentImplProps\n>(\n  // blank line to reduce diff noise\n  function DialogContentImpl(props: ScopedProps<DialogContentImplProps>, forwardedRef) {\n    const {\n      __scopeDialog,\n      trapFocus,\n      onOpenAutoFocus,\n      onCloseAutoFocus,\n      'aria-describedby': ariaDescribedby,\n      children,\n      ...contentProps\n    } = props;\n    const context = useDialogContext(CONTENT_NAME, __scopeDialog);\n\n    // Make sure the whole tree has focus guards as our `Dialog` will be\n    // the last element in the DOM (because of the `Portal`)\n    useFocusGuards();\n\n    return (\n      <FocusScopeBranchProvider registry={context.branchRegistry}>\n        <FocusScope\n          asChild\n          loop\n          trapped={trapFocus}\n          branches={context.branchNodes}\n          onMountAutoFocus={onOpenAutoFocus}\n          onUnmountAutoFocus={onCloseAutoFocus}\n        >\n          <DismissableLayer\n            role=\"dialog\"\n            id={context.contentId}\n            aria-labelledby={context.titlePresent ? context.titleId : undefined}\n            aria-describedby={\n              context.descriptionPresent\n                ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n                : ariaDescribedby\n            }\n            data-state={getState(context.open)}\n            {...contentProps}\n            ref={forwardedRef}\n            deferPointerDownOutside\n            onDismiss={() => context.onOpenChange(false)}\n          >\n            {children}\n          </DismissableLayer>\n        </FocusScope>\n      </FocusScopeBranchProvider>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface DialogTitleProps extends PrimitiveHeading2Props {}\n\nconst DialogTitle = /* @__PURE__ */ React.forwardRef<DialogTitleElement, DialogTitleProps>(\n  function DialogTitle(props: ScopedProps<DialogTitleProps>, forwardedRef) {\n    const { __scopeDialog, ...titleProps } = props;\n    const context = useDialogContext('DialogTitle', __scopeDialog);\n    const { setTitleCount } = context;\n    useLayoutEffect(() => {\n      setTitleCount((count) => count + 1);\n      return () => setTitleCount((count) => count - 1);\n    }, [setTitleCount]);\n    return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype DialogDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface DialogDescriptionProps extends PrimitiveParagraphProps {}\n\nconst DialogDescription = /* @__PURE__ */ React.forwardRef<\n  DialogDescriptionElement,\n  DialogDescriptionProps\n>(\n  // blank line to reduce diff noise\n  function DialogDescription(props: ScopedProps<DialogDescriptionProps>, forwardedRef) {\n    const { __scopeDialog, ...descriptionProps } = props;\n    const context = useDialogContext('DialogDescription', __scopeDialog);\n    const { setDescriptionCount } = context;\n    useLayoutEffect(() => {\n      setDescriptionCount((count) => count + 1);\n      return () => setDescriptionCount((count) => count - 1);\n    }, [setDescriptionCount]);\n    return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * DialogClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'DialogClose';\n\ntype DialogCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface DialogCloseProps extends PrimitiveButtonProps {}\n\nconst DialogClose = /* @__PURE__ */ React.forwardRef<DialogCloseElement, DialogCloseProps>(\n  function DialogClose(props: ScopedProps<DialogCloseProps>, forwardedRef) {\n    const { __scopeDialog, ...closeProps } = props;\n    const context = useDialogContext(CLOSE_NAME, __scopeDialog);\n    return (\n      <Primitive.button\n        type=\"button\"\n        {...closeProps}\n        ref={forwardedRef}\n        onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n      />\n    );\n  },\n);\n\n/** @deprecated Noop component to avoid breaking changes. */\nexport const WarningProvider: React.FC<\n  ScopedProps<{\n    children?: React.ReactNode | undefined;\n    contentName: string;\n    titleName: string;\n    docsSlug: 'dialog';\n  }>\n> = (props) => {\n  return props.children;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n  const ids = new Set<string>();\n  for (const value of values) {\n    if (typeof value !== 'string') continue;\n    for (const id of String(value).trim().split(/\\s+/)) {\n      if (id) ids.add(id);\n    }\n  }\n\n  return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nfunction getState(open: boolean) {\n  return open ? 'open' : 'closed';\n}\n\nexport {\n  createDialogScope,\n  //\n  Dialog,\n  DialogTrigger,\n  DialogPortal,\n  DialogOverlay,\n  DialogContent,\n  DialogTitle,\n  DialogDescription,\n  DialogClose,\n  //\n  Dialog as Root,\n  DialogTrigger as Trigger,\n  DialogPortal as Portal,\n  DialogOverlay as Overlay,\n  DialogContent as Content,\n  DialogTitle as Title,\n  DialogDescription as Description,\n  DialogClose as Close,\n};\nexport type {\n  DialogProps,\n  DialogTriggerProps,\n  DialogPortalProps,\n  DialogOverlayProps,\n  DialogContentProps,\n  DialogTitleProps,\n  DialogDescriptionProps,\n  DialogCloseProps,\n};\n"]}