{
  "version": 3,
  "sources": ["../src/dismissable-layer.tsx"],
  "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useEscapeKeydown } from '@radix-ui/react-use-escape-keydown';\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayer\n * -----------------------------------------------------------------------------------------------*/\n\nconst DISMISSABLE_LAYER_NAME = 'DismissableLayer';\nconst CONTEXT_UPDATE = 'dismissableLayer.update';\nconst POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';\nconst FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';\n\nlet originalBodyPointerEvents: string;\n\nconst DismissableLayerContext = React.createContext({\n  layers: new Set<DismissableLayerElement>(),\n  layersWithOutsidePointerEventsDisabled: new Set<DismissableLayerElement>(),\n  branches: new Set<DismissableLayerBranchElement>(),\n\n  // Outside elements that belong to a layer's own dismiss affordance (eg, a\n  // dialog overlay). Pressing them should dismiss the layer regardless of\n  // whether or not they stop propagation.\n  //\n  // See https://github.com/radix-ui/primitives/issues/3346\n  dismissableSurfaces: new Set<DismissableLayerBranchElement>(),\n});\n\ntype DismissableLayerElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface DismissableLayerProps extends PrimitiveDivProps {\n  /**\n   * When `true`, hover/focus/click interactions will be disabled on elements outside\n   * the `DismissableLayer`. Users will need to click twice on outside elements to\n   * interact with them: once to close the `DismissableLayer`, and again to trigger the element.\n   */\n  disableOutsidePointerEvents?: boolean;\n  /**\n   * When `true`, a `'pointerdown'` event outside of the layered element will\n   * wait for the interaction's click event before dispatching, allowing\n   * third-party code to stop propagation of later events and cancel dismissal.\n   */\n  deferPointerDownOutside?: boolean;\n  /**\n   * Event handler called when the escape key is down.\n   * Can be prevented.\n   */\n  onEscapeKeyDown?: (event: KeyboardEvent) => void;\n  /**\n   * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n   * Can be prevented.\n   */\n  onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;\n  /**\n   * Event handler called when the focus moves outside of the `DismissableLayer`.\n   * Can be prevented.\n   */\n  onFocusOutside?: (event: FocusOutsideEvent) => void;\n  /**\n   * Event handler called when an interaction happens outside the `DismissableLayer`.\n   * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n   * Can be prevented.\n   */\n  onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;\n  /**\n   * Handler called when the `DismissableLayer` should be dismissed\n   */\n  onDismiss?: () => void;\n}\n\nconst DismissableLayer = React.forwardRef<DismissableLayerElement, DismissableLayerProps>(\n  (props, forwardedRef) => {\n    const {\n      disableOutsidePointerEvents = false,\n      deferPointerDownOutside = false,\n      onEscapeKeyDown,\n      onPointerDownOutside,\n      onFocusOutside,\n      onInteractOutside,\n      onDismiss,\n      ...layerProps\n    } = props;\n    const context = React.useContext(DismissableLayerContext);\n    const [node, setNode] = React.useState<DismissableLayerElement | null>(null);\n    const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n    const [, force] = React.useState({});\n    const composedRefs = useComposedRefs(forwardedRef, (node) => setNode(node));\n    const layers = Array.from(context.layers);\n    const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1); // prettier-ignore\n    const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled!); // prettier-ignore\n    const index = node ? layers.indexOf(node) : -1;\n    const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n    const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n    const isDeferredPointerDownOutsideRef = React.useRef(false);\n\n    const pointerDownOutside = usePointerDownOutside(\n      (event) => {\n        const target = event.target;\n        if (!(target instanceof Node)) {\n          return;\n        }\n\n        const isPointerDownOnBranch = [...context.branches].some((branch) =>\n          branch.contains(target),\n        );\n        if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n        onPointerDownOutside?.(event);\n        onInteractOutside?.(event);\n        if (!event.defaultPrevented) onDismiss?.();\n      },\n      {\n        ownerDocument,\n        deferPointerDownOutside,\n        isDeferredPointerDownOutsideRef,\n        dismissableSurfaces: context.dismissableSurfaces,\n      },\n    );\n\n    const focusOutside = useFocusOutside((event) => {\n      if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {\n        return;\n      }\n\n      const target = event.target as HTMLElement;\n      const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n      if (isFocusInBranch) return;\n      onFocusOutside?.(event);\n      onInteractOutside?.(event);\n      if (!event.defaultPrevented) onDismiss?.();\n    }, ownerDocument);\n\n    useEscapeKeydown((event) => {\n      const isHighestLayer = index === context.layers.size - 1;\n      if (!isHighestLayer) return;\n      onEscapeKeyDown?.(event);\n      if (!event.defaultPrevented && onDismiss) {\n        event.preventDefault();\n        onDismiss();\n      }\n    }, ownerDocument);\n\n    React.useEffect(() => {\n      if (!node) return;\n      if (disableOutsidePointerEvents) {\n        if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n          originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n          ownerDocument.body.style.pointerEvents = 'none';\n        }\n        context.layersWithOutsidePointerEventsDisabled.add(node);\n      }\n      context.layers.add(node);\n      dispatchUpdate();\n      return () => {\n        // We must remove this layer from the disabled set whenever\n        // `disableOutsidePointerEvents` becomes `false` (eg, when a modal\n        // closes but stays mounted during an exit animation) and not only on\n        // unmount. Otherwise the `body` `pointer-events` could be left as\n        // `none` when multiple layers overlap.\n        // See: https://github.com/radix-ui/primitives/issues/3645\n        if (disableOutsidePointerEvents) {\n          context.layersWithOutsidePointerEventsDisabled.delete(node);\n          if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n            ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n          }\n        }\n      };\n    }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n\n    /**\n     * We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect\n     * because a change to `disableOutsidePointerEvents` would remove this layer from the stack\n     * and add it to the end again so the layering order wouldn't be _creation order_.\n     * We only want them to be removed from context stacks when unmounted.\n     */\n    React.useEffect(() => {\n      return () => {\n        if (!node) return;\n        context.layers.delete(node);\n        context.layersWithOutsidePointerEventsDisabled.delete(node);\n        dispatchUpdate();\n      };\n    }, [node, context]);\n\n    React.useEffect(() => {\n      const handleUpdate = () => force({});\n      document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n      return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n    }, []);\n\n    return (\n      <Primitive.div\n        {...layerProps}\n        ref={composedRefs}\n        style={{\n          pointerEvents: isBodyPointerEventsDisabled\n            ? isPointerEventsEnabled\n              ? 'auto'\n              : 'none'\n            : undefined,\n          ...props.style,\n        }}\n        onFocusCapture={composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture)}\n        onBlurCapture={composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture)}\n        onPointerDownCapture={composeEventHandlers(\n          props.onPointerDownCapture,\n          pointerDownOutside.onPointerDownCapture,\n        )}\n      />\n    );\n  },\n);\n\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DismissableLayerBranch\n * -----------------------------------------------------------------------------------------------*/\n\nconst BRANCH_NAME = 'DismissableLayerBranch';\n\ntype DismissableLayerBranchElement = React.ComponentRef<typeof Primitive.div>;\ninterface DismissableLayerBranchProps extends PrimitiveDivProps {}\n\nconst DismissableLayerBranch = React.forwardRef<\n  DismissableLayerBranchElement,\n  DismissableLayerBranchProps\n>((props, forwardedRef) => {\n  const context = React.useContext(DismissableLayerContext);\n  const ref = React.useRef<DismissableLayerBranchElement>(null);\n  const composedRefs = useComposedRefs(forwardedRef, ref);\n\n  React.useEffect(() => {\n    const node = ref.current;\n    if (node) {\n      context.branches.add(node);\n      return () => {\n        context.branches.delete(node);\n      };\n    }\n  }, [context.branches]);\n\n  return <Primitive.div {...props} ref={composedRefs} />;\n});\n\nDismissableLayerBranch.displayName = BRANCH_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\n/**\n * Registers a node as a \"dismiss surface\" for the enclosing DismissableLayer\n */\nfunction useDismissableLayerSurface(): React.RefCallback<DismissableLayerBranchElement> {\n  const context = React.useContext(DismissableLayerContext);\n  const [node, setNode] = React.useState<DismissableLayerBranchElement | null>(null);\n\n  React.useEffect(() => {\n    if (!node) {\n      return;\n    }\n    context.dismissableSurfaces.add(node);\n    return () => {\n      context.dismissableSurfaces.delete(node);\n    };\n  }, [node, context.dismissableSurfaces]);\n\n  return setNode;\n}\n\ntype PointerDownOutsideEvent = CustomEvent<{ originalEvent: PointerEvent }>;\ntype FocusOutsideEvent = CustomEvent<{ originalEvent: FocusEvent }>;\n\n/**\n * Listens for `pointerdown` outside a react subtree. We detect the start of the interaction on\n * `pointerdown`, then wait for `click` so external code can intercept later mouse events.\n * Returns props to pass to the node we want to check for outside events.\n */\nfunction usePointerDownOutside(\n  onPointerDownOutside: ((event: PointerDownOutsideEvent) => void) | undefined,\n  args: {\n    ownerDocument: Document | undefined;\n    deferPointerDownOutside: boolean;\n    isDeferredPointerDownOutsideRef: React.RefObject<boolean>;\n    dismissableSurfaces: Set<DismissableLayerBranchElement>;\n  },\n) {\n  const {\n    ownerDocument = globalThis?.document,\n    deferPointerDownOutside = false,\n    isDeferredPointerDownOutsideRef,\n    dismissableSurfaces,\n  } = args;\n  const handlePointerDownOutside = useCallbackRef(onPointerDownOutside) as EventListener;\n  const isPointerInsideReactTreeRef = React.useRef(false);\n  const isPointerDownOutsideRef = React.useRef(false);\n  const interceptedOutsideInteractionEventsRef = React.useRef<Map<string, boolean>>(new Map());\n  const handleClickRef = React.useRef(() => {});\n\n  React.useEffect(() => {\n    function resetOutsideInteraction() {\n      isPointerDownOutsideRef.current = false;\n      isDeferredPointerDownOutsideRef.current = false;\n      interceptedOutsideInteractionEventsRef.current.clear();\n    }\n\n    function isOutsideInteractionIntercepted() {\n      return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);\n    }\n\n    function handleInteractionCapture(event: Event) {\n      if (!isPointerDownOutsideRef.current) {\n        return;\n      }\n\n      const target = event.target;\n      const isDismissableSurface =\n        target instanceof Node &&\n        [...dismissableSurfaces].some((surface) => surface.contains(target as Node));\n\n      if (!isDismissableSurface) {\n        interceptedOutsideInteractionEventsRef.current.set(event.type, true);\n      }\n\n      if (event.type === 'click') {\n        window.setTimeout(() => {\n          if (isPointerDownOutsideRef.current) {\n            handleClickRef.current();\n          }\n        }, 0);\n      }\n    }\n\n    function handleInteractionBubble(event: Event) {\n      if (isPointerDownOutsideRef.current) {\n        interceptedOutsideInteractionEventsRef.current.set(event.type, false);\n      }\n    }\n\n    const handlePointerDown = (event: PointerEvent) => {\n      if (event.target && !isPointerInsideReactTreeRef.current) {\n        const eventDetail = { originalEvent: event };\n        isPointerDownOutsideRef.current = true;\n        isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;\n        interceptedOutsideInteractionEventsRef.current.clear();\n\n        function handleAndDispatchPointerDownOutsideEvent() {\n          ownerDocument.removeEventListener('click', handleClickRef.current);\n          const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();\n          resetOutsideInteraction();\n\n          if (!wasOutsideInteractionIntercepted) {\n            handleAndDispatchCustomEvent(\n              POINTER_DOWN_OUTSIDE,\n              handlePointerDownOutside,\n              eventDetail,\n              { discrete: true },\n            );\n          }\n        }\n\n        /**\n         * When deferring, we need to wait for a click event because:\n         *\n         * 1. On touch devices, browsers implement a ~350ms delay between the\n         *    time the user stops touching the display and when the browser\n         *    executes events. We need to ensure we don't reactivate\n         *    pointer-events within this timeframe otherwise the browser may\n         *    execute events that should have been prevented.\n         *\n         * 2. Browser extensions and other third-party code may call\n         *    `stopPropagation` on later mouse events like `mousedown`,\n         *    `mouseup`, or `click`. Waiting lets those intercepted events\n         *    cancel the outside interaction before we dismiss the layer. See\n         *    https://github.com/radix-ui/primitives/issues/2055\n         *\n         * Additionally, this also lets us deal automatically with cancellations\n         * when a click event isn't raised because the page was considered\n         * scrolled/drag-scrolled, long-pressed, etc.\n         *\n         * This is why we also continuously remove the previous listener,\n         * because we cannot be certain that it was raised, and therefore\n         * cleaned-up.\n         *\n         * For non-primary buttons, we dispatch the event immediately because we\n         * cannot be certain that the event was canceled.\n         */\n        if (!deferPointerDownOutside || event.button !== 0) {\n          handleAndDispatchPointerDownOutsideEvent();\n        } else {\n          ownerDocument.removeEventListener('click', handleClickRef.current);\n          handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;\n          ownerDocument.addEventListener('click', handleClickRef.current, { once: true });\n        }\n      } else {\n        // We need to remove the event listener in case the outside click has been canceled.\n        // See: https://github.com/radix-ui/primitives/issues/2171\n        ownerDocument.removeEventListener('click', handleClickRef.current);\n        resetOutsideInteraction();\n      }\n      isPointerInsideReactTreeRef.current = false;\n    };\n\n    const outsideInteractionEvents = [\n      'pointerup',\n      'mousedown',\n      'mouseup',\n      'touchstart',\n      'touchend',\n      'click',\n    ];\n\n    for (const eventName of outsideInteractionEvents) {\n      ownerDocument.addEventListener(eventName, handleInteractionCapture, true);\n      ownerDocument.addEventListener(eventName, handleInteractionBubble);\n    }\n\n    /**\n     * if this hook executes in a component that mounts via a `pointerdown` event, the event\n     * would bubble up to the document and trigger a `pointerDownOutside` event. We avoid\n     * this by delaying the event listener registration on the document.\n     * This is not React specific, but rather how the DOM works, ie:\n     * ```\n     * button.addEventListener('pointerdown', () => {\n     *   console.log('I will log');\n     *   document.addEventListener('pointerdown', () => {\n     *     console.log('I will also log');\n     *   })\n     * });\n     */\n    const timerId = window.setTimeout(() => {\n      ownerDocument.addEventListener('pointerdown', handlePointerDown);\n    }, 0);\n    return () => {\n      window.clearTimeout(timerId);\n      ownerDocument.removeEventListener('pointerdown', handlePointerDown);\n      ownerDocument.removeEventListener('click', handleClickRef.current);\n      for (const eventName of outsideInteractionEvents) {\n        ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);\n        ownerDocument.removeEventListener(eventName, handleInteractionBubble);\n      }\n    };\n  }, [\n    ownerDocument,\n    handlePointerDownOutside,\n    deferPointerDownOutside,\n    isDeferredPointerDownOutsideRef,\n    dismissableSurfaces,\n  ]);\n\n  return {\n    // ensures we check React component tree (not just DOM tree)\n    onPointerDownCapture: () => (isPointerInsideReactTreeRef.current = true),\n  };\n}\n\n/**\n * Listens for when focus happens outside a react subtree.\n * Returns props to pass to the root (node) of the subtree we want to check.\n */\nfunction useFocusOutside(\n  onFocusOutside?: (event: FocusOutsideEvent) => void,\n  ownerDocument: Document = globalThis?.document,\n) {\n  const handleFocusOutside = useCallbackRef(onFocusOutside) as EventListener;\n  const isFocusInsideReactTreeRef = React.useRef(false);\n\n  React.useEffect(() => {\n    const handleFocus = (event: FocusEvent) => {\n      if (event.target && !isFocusInsideReactTreeRef.current) {\n        const eventDetail = { originalEvent: event };\n        handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n          discrete: false,\n        });\n      }\n    };\n    ownerDocument.addEventListener('focusin', handleFocus);\n    return () => ownerDocument.removeEventListener('focusin', handleFocus);\n  }, [ownerDocument, handleFocusOutside]);\n\n  return {\n    onFocusCapture: () => (isFocusInsideReactTreeRef.current = true),\n    onBlurCapture: () => (isFocusInsideReactTreeRef.current = false),\n  };\n}\n\nfunction dispatchUpdate() {\n  const event = new CustomEvent(CONTEXT_UPDATE);\n  document.dispatchEvent(event);\n}\n\nfunction handleAndDispatchCustomEvent<E extends CustomEvent, OriginalEvent extends Event>(\n  name: string,\n  handler: ((event: E) => void) | undefined,\n  detail: { originalEvent: OriginalEvent } & (E extends CustomEvent<infer D> ? D : never),\n  { discrete }: { discrete: boolean },\n) {\n  const target = detail.originalEvent.target;\n  const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n  if (handler) target.addEventListener(name, handler as EventListener, { once: true });\n\n  if (discrete) {\n    dispatchDiscreteCustomEvent(target, event);\n  } else {\n    target.dispatchEvent(event);\n  }\n}\n\nconst Root = DismissableLayer;\nconst Branch = DismissableLayerBranch;\n\nexport {\n  DismissableLayer,\n  DismissableLayerBranch,\n  useDismissableLayerSurface,\n  //\n  Root,\n  Branch,\n};\nexport type { DismissableLayerProps };\n"],
  "mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,WAAW,mCAAmC;AACvD,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AA4L3B;AAtLN,IAAM,yBAAyB;AAC/B,IAAM,iBAAiB;AACvB,IAAM,uBAAuB;AAC7B,IAAM,gBAAgB;AAEtB,IAAI;AAEJ,IAAM,0BAAgC,oBAAc;AAAA,EAClD,QAAQ,oBAAI,IAA6B;AAAA,EACzC,wCAAwC,oBAAI,IAA6B;AAAA,EACzE,UAAU,oBAAI,IAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjD,qBAAqB,oBAAI,IAAmC;AAC9D,CAAC;AA4CD,IAAM,mBAAyB;AAAA,EAC7B,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ,8BAA8B;AAAA,MAC9B,0BAA0B;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,UAAgB,iBAAW,uBAAuB;AACxD,UAAM,CAAC,MAAM,OAAO,IAAU,eAAyC,IAAI;AAC3E,UAAM,gBAAgB,MAAM,iBAAiB,YAAY;AACzD,UAAM,CAAC,EAAE,KAAK,IAAU,eAAS,CAAC,CAAC;AACnC,UAAM,eAAe,gBAAgB,cAAc,CAACA,UAAS,QAAQA,KAAI,CAAC;AAC1E,UAAM,SAA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