import { useGlobalListeners as le, isVirtualPointerEvent as Te, focusWithoutScrolling as W, isVirtualClick as q, mergeProps as ee, isIOS as de, runAfterTransition as me, useSyncRef as he, useLayoutEffect as Ee, useDescription as Le, isMac as Se } from "../../utils/dist/module.es.js";
import Ke, { useRef as D, useState as te, useMemo as pe, useEffect as C, useCallback as k, useContext as De } from "react";
let F = "default", z = "", R = /* @__PURE__ */ new WeakMap();
function oe(e) {
  de() ? (F === "default" && (z = document.documentElement.style.webkitUserSelect, document.documentElement.style.webkitUserSelect = "none"), F = "disabled") : (e instanceof HTMLElement || e instanceof SVGElement) && (R.set(e, e.style.userSelect), e.style.userSelect = "none");
}
function A(e) {
  if (de()) {
    if (F !== "disabled")
      return;
    F = "restoring", setTimeout(() => {
      me(() => {
        F === "restoring" && (document.documentElement.style.webkitUserSelect === "none" && (document.documentElement.style.webkitUserSelect = z || ""), z = "", F = "default");
      });
    }, 300);
  } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && R.has(e)) {
    let r = R.get(e);
    e.style.userSelect === "none" && (e.style.userSelect = r), e.getAttribute("style") === "" && e.removeAttribute("style"), R.delete(e);
  }
}
const ge = Ke.createContext(null);
ge.displayName = "PressResponderContext";
function Me(e) {
  let r = De(ge);
  if (r) {
    let { register: n, ...c } = r;
    e = ee(c, e), n();
  }
  return he(r, e.ref), e;
}
function Oe(e) {
  let {
    onPress: r,
    onPressChange: n,
    onPressStart: c,
    onPressEnd: a,
    onPressUp: p,
    isDisabled: u,
    isPressed: f,
    preventFocusOnPress: d,
    shouldCancelOnPointerExit: b,
    allowTextSelectionOnPress: v,
    ref: O,
    ...g
  } = Me(e), l = D(null);
  l.current = {
    onPress: r,
    onPressChange: n,
    onPressStart: c,
    onPressEnd: a,
    onPressUp: p,
    isDisabled: u,
    shouldCancelOnPointerExit: b
  };
  let [T, S] = te(!1), re = D({
    isPressed: !1,
    ignoreEmulatedMouseEvents: !1,
    ignoreClickAfterPress: !1,
    didFirePressStart: !1,
    activePointerId: null,
    target: null,
    isOverTarget: !1,
    pointerType: null
  }), { addGlobalListener: K, removeAllGlobalListeners: w } = le(), $e = pe(() => {
    let t = re.current, E = (s, P) => {
      let { onPressStart: o, onPressChange: i, isDisabled: B } = l.current;
      B || t.didFirePressStart || (o && o({
        type: "pressstart",
        pointerType: P,
        target: s.currentTarget,
        shiftKey: s.shiftKey,
        metaKey: s.metaKey,
        ctrlKey: s.ctrlKey,
        altKey: s.altKey
      }), i && i(!0), t.didFirePressStart = !0, S(!0));
    }, y = (s, P, o = !0) => {
      let { onPressEnd: i, onPressChange: B, onPress: ne, isDisabled: ye } = l.current;
      !t.didFirePressStart || (t.ignoreClickAfterPress = !0, t.didFirePressStart = !1, i && i({
        type: "pressend",
        pointerType: P,
        target: s.currentTarget,
        shiftKey: s.shiftKey,
        metaKey: s.metaKey,
        ctrlKey: s.ctrlKey,
        altKey: s.altKey
      }), B && B(!1), S(!1), ne && o && !ye && ne({
        type: "press",
        pointerType: P,
        target: s.currentTarget,
        shiftKey: s.shiftKey,
        metaKey: s.metaKey,
        ctrlKey: s.ctrlKey,
        altKey: s.altKey
      }));
    }, H = (s, P) => {
      let { onPressUp: o, isDisabled: i } = l.current;
      i || o && o({
        type: "pressup",
        pointerType: P,
        target: s.currentTarget,
        shiftKey: s.shiftKey,
        metaKey: s.metaKey,
        ctrlKey: s.ctrlKey,
        altKey: s.altKey
      });
    }, L = (s) => {
      t.isPressed && (t.isOverTarget && y(m(t.target, s), t.pointerType, !1), t.isPressed = !1, t.isOverTarget = !1, t.activePointerId = null, t.pointerType = null, w(), v || A(t.target));
    }, $ = {
      onKeyDown(s) {
        X(s.nativeEvent, s.currentTarget) && s.currentTarget.contains(s.target) ? (ie(s.target, s.key) && s.preventDefault(), s.stopPropagation(), !t.isPressed && !s.repeat && (t.target = s.currentTarget, t.isPressed = !0, E(s, "keyboard"), K(document, "keyup", Pe, !1))) : s.key === "Enter" && J(s.currentTarget) && s.stopPropagation();
      },
      onKeyUp(s) {
        X(s.nativeEvent, s.currentTarget) && !s.repeat && s.currentTarget.contains(s.target) && H(m(t.target, s), "keyboard");
      },
      onClick(s) {
        s && !s.currentTarget.contains(s.target) || s && s.button === 0 && (s.stopPropagation(), u && s.preventDefault(), !t.ignoreClickAfterPress && !t.ignoreEmulatedMouseEvents && (t.pointerType === "virtual" || q(s.nativeEvent)) && (!u && !d && W(s.currentTarget), E(s, "virtual"), H(s, "virtual"), y(s, "virtual")), t.ignoreEmulatedMouseEvents = !1, t.ignoreClickAfterPress = !1);
      }
    }, Pe = (s) => {
      if (t.isPressed && X(s, t.target)) {
        ie(s.target, s.key) && s.preventDefault(), s.stopPropagation(), t.isPressed = !1;
        let P = s.target;
        y(m(t.target, s), "keyboard", t.target.contains(P)), w(), t.target instanceof HTMLElement && t.target.contains(P) && (J(t.target) || t.target.getAttribute("role") === "link") && t.target.click();
      }
    };
    if (typeof PointerEvent < "u") {
      $.onPointerDown = (i) => {
        if (!(i.button !== 0 || !i.currentTarget.contains(i.target))) {
          if (Te(i.nativeEvent)) {
            t.pointerType = "virtual";
            return;
          }
          N(i.currentTarget) && i.preventDefault(), t.pointerType = i.pointerType, i.stopPropagation(), t.isPressed || (t.isPressed = !0, t.isOverTarget = !0, t.activePointerId = i.pointerId, t.target = i.currentTarget, !u && !d && W(i.currentTarget), v || oe(t.target), E(i, t.pointerType), K(document, "pointermove", s, !1), K(document, "pointerup", P, !1), K(document, "pointercancel", o, !1));
        }
      }, $.onMouseDown = (i) => {
        !i.currentTarget.contains(i.target) || i.button === 0 && (N(i.currentTarget) && i.preventDefault(), i.stopPropagation());
      }, $.onPointerUp = (i) => {
        !i.currentTarget.contains(i.target) || t.pointerType === "virtual" || i.button === 0 && x(i, i.currentTarget) && H(i, t.pointerType || i.pointerType);
      };
      let s = (i) => {
        i.pointerId === t.activePointerId && (x(i, t.target) ? t.isOverTarget || (t.isOverTarget = !0, E(m(t.target, i), t.pointerType)) : t.isOverTarget && (t.isOverTarget = !1, y(m(t.target, i), t.pointerType, !1), l.current.shouldCancelOnPointerExit && L(i)));
      }, P = (i) => {
        i.pointerId === t.activePointerId && t.isPressed && i.button === 0 && (x(i, t.target) ? y(m(t.target, i), t.pointerType) : t.isOverTarget && y(m(t.target, i), t.pointerType, !1), t.isPressed = !1, t.isOverTarget = !1, t.activePointerId = null, t.pointerType = null, w(), v || A(t.target));
      }, o = (i) => {
        L(i);
      };
      $.onDragStart = (i) => {
        !i.currentTarget.contains(i.target) || L(i);
      };
    } else {
      $.onMouseDown = (o) => {
        o.button !== 0 || !o.currentTarget.contains(o.target) || (N(o.currentTarget) && o.preventDefault(), o.stopPropagation(), !t.ignoreEmulatedMouseEvents && (t.isPressed = !0, t.isOverTarget = !0, t.target = o.currentTarget, t.pointerType = q(o.nativeEvent) ? "virtual" : "mouse", !u && !d && W(o.currentTarget), E(o, t.pointerType), K(document, "mouseup", s, !1)));
      }, $.onMouseEnter = (o) => {
        !o.currentTarget.contains(o.target) || (o.stopPropagation(), t.isPressed && !t.ignoreEmulatedMouseEvents && (t.isOverTarget = !0, E(o, t.pointerType)));
      }, $.onMouseLeave = (o) => {
        !o.currentTarget.contains(o.target) || (o.stopPropagation(), t.isPressed && !t.ignoreEmulatedMouseEvents && (t.isOverTarget = !1, y(o, t.pointerType, !1), l.current.shouldCancelOnPointerExit && L(o)));
      }, $.onMouseUp = (o) => {
        !o.currentTarget.contains(o.target) || !t.ignoreEmulatedMouseEvents && o.button === 0 && H(o, t.pointerType);
      };
      let s = (o) => {
        if (o.button === 0) {
          if (t.isPressed = !1, w(), t.ignoreEmulatedMouseEvents) {
            t.ignoreEmulatedMouseEvents = !1;
            return;
          }
          x(o, t.target) ? y(m(t.target, o), t.pointerType) : t.isOverTarget && y(m(t.target, o), t.pointerType, !1), t.isOverTarget = !1;
        }
      };
      $.onTouchStart = (o) => {
        if (!o.currentTarget.contains(o.target))
          return;
        o.stopPropagation();
        let i = we(o.nativeEvent);
        !i || (t.activePointerId = i.identifier, t.ignoreEmulatedMouseEvents = !0, t.isOverTarget = !0, t.isPressed = !0, t.target = o.currentTarget, t.pointerType = "touch", !u && !d && W(o.currentTarget), v || oe(t.target), E(o, t.pointerType), K(window, "scroll", P, !0));
      }, $.onTouchMove = (o) => {
        if (!o.currentTarget.contains(o.target) || (o.stopPropagation(), !t.isPressed))
          return;
        let i = se(o.nativeEvent, t.activePointerId);
        i && x(i, o.currentTarget) ? t.isOverTarget || (t.isOverTarget = !0, E(o, t.pointerType)) : t.isOverTarget && (t.isOverTarget = !1, y(o, t.pointerType, !1), l.current.shouldCancelOnPointerExit && L(o));
      }, $.onTouchEnd = (o) => {
        if (!o.currentTarget.contains(o.target) || (o.stopPropagation(), !t.isPressed))
          return;
        let i = se(o.nativeEvent, t.activePointerId);
        i && x(i, o.currentTarget) ? (H(o, t.pointerType), y(o, t.pointerType)) : t.isOverTarget && y(o, t.pointerType, !1), t.isPressed = !1, t.activePointerId = null, t.isOverTarget = !1, t.ignoreEmulatedMouseEvents = !0, v || A(t.target), w();
      }, $.onTouchCancel = (o) => {
        !o.currentTarget.contains(o.target) || (o.stopPropagation(), t.isPressed && L(o));
      };
      let P = (o) => {
        t.isPressed && o.target.contains(t.target) && L({
          currentTarget: t.target,
          shiftKey: !1,
          ctrlKey: !1,
          metaKey: !1,
          altKey: !1
        });
      };
      $.onDragStart = (o) => {
        !o.currentTarget.contains(o.target) || L(o);
      };
    }
    return $;
  }, [
    K,
    u,
    d,
    w,
    v
  ]);
  return C(() => () => {
    v || A(re.current.target);
  }, [
    v
  ]), {
    isPressed: f || T,
    pressProps: ee(g, $e)
  };
}
function J(e) {
  return e.tagName === "A" && e.hasAttribute("href");
}
function X(e, r) {
  const { key: n, code: c } = e, a = r, p = a.getAttribute("role");
  return (n === "Enter" || n === " " || n === "Spacebar" || c === "Space") && !(a instanceof HTMLInputElement && !ve(a, n) || a instanceof HTMLTextAreaElement || a.isContentEditable) && (!J(a) || p === "button" && n !== "Enter") && !(p === "link" && n !== "Enter");
}
function we(e) {
  const { targetTouches: r } = e;
  return r.length > 0 ? r[0] : null;
}
function se(e, r) {
  const n = e.changedTouches;
  for (let c = 0; c < n.length; c++) {
    const a = n[c];
    if (a.identifier === r)
      return a;
  }
  return null;
}
function m(e, r) {
  return {
    currentTarget: e,
    shiftKey: r.shiftKey,
    ctrlKey: r.ctrlKey,
    metaKey: r.metaKey,
    altKey: r.altKey
  };
}
function xe(e) {
  let r = e.width / 2 || e.radiusX || 0, n = e.height / 2 || e.radiusY || 0;
  return {
    top: e.clientY - n,
    right: e.clientX + r,
    bottom: e.clientY + n,
    left: e.clientX - r
  };
}
function Ie(e, r) {
  return !(e.left > r.right || r.left > e.right || e.top > r.bottom || r.top > e.bottom);
}
function x(e, r) {
  let n = r.getBoundingClientRect(), c = xe(e);
  return Ie(n, c);
}
function N(e) {
  return !(e instanceof HTMLElement) || !e.draggable;
}
function ie(e, r) {
  return e instanceof HTMLInputElement ? !ve(e, r) : e instanceof HTMLButtonElement ? e.type !== "submit" : !0;
}
const Fe = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function ve(e, r) {
  return e.type === "checkbox" || e.type === "radio" ? r === " " : Fe.has(e.type);
}
class Ce {
  isDefaultPrevented() {
    return this.nativeEvent.defaultPrevented;
  }
  preventDefault() {
    this.defaultPrevented = !0, this.nativeEvent.preventDefault();
  }
  stopPropagation() {
    this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
  }
  isPropagationStopped() {
    return !1;
  }
  persist() {
  }
  constructor(r, n) {
    this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = r;
  }
}
function be(e) {
  let r = D({
    isFocused: !1,
    onBlur: e,
    observer: null
  });
  return r.current.onBlur = e, Ee(() => {
    const n = r.current;
    return () => {
      n.observer && (n.observer.disconnect(), n.observer = null);
    };
  }, []), k((n) => {
    if (n.target instanceof HTMLButtonElement || n.target instanceof HTMLInputElement || n.target instanceof HTMLTextAreaElement || n.target instanceof HTMLSelectElement) {
      r.current.isFocused = !0;
      let c = n.target, a = (p) => {
        var u, f;
        r.current.isFocused = !1, c.disabled && ((f = (u = r.current).onBlur) === null || f === void 0 || f.call(u, new Ce("blur", p))), r.current.observer && (r.current.observer.disconnect(), r.current.observer = null);
      };
      c.addEventListener("focusout", a, {
        once: !0
      }), r.current.observer = new MutationObserver(() => {
        r.current.isFocused && c.disabled && (r.current.observer.disconnect(), c.dispatchEvent(new FocusEvent("blur")), c.dispatchEvent(new FocusEvent("focusout", {
          bubbles: !0
        })));
      }), r.current.observer.observe(c, {
        attributes: !0,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, []);
}
function Xe(e) {
  let { isDisabled: r, onFocus: n, onBlur: c, onFocusChange: a } = e;
  const p = k((d) => {
    if (d.target === d.currentTarget)
      return c && c(d), a && a(!1), !0;
  }, [
    c,
    a
  ]), u = be(p), f = k((d) => {
    d.target === d.currentTarget && (n && n(d), a && a(!0), u(d));
  }, [
    a,
    n,
    u
  ]);
  return {
    focusProps: {
      onFocus: !r && (n || a || c) ? f : void 0,
      onBlur: !r && (c || a) ? p : null
    }
  };
}
let h = null, U = /* @__PURE__ */ new Set(), ae = !1, M = !1, Q = !1;
const He = {
  Tab: !0,
  Escape: !0
};
function Y(e, r) {
  for (let n of U)
    n(e, r);
}
function ke(e) {
  return !(e.metaKey || !Se() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
}
function ue(e) {
  M = !0, ke(e) && (h = "keyboard", Y("keyboard", e));
}
function I(e) {
  h = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (M = !0, Y("pointer", e));
}
function Ue(e) {
  q(e) && (M = !0, h = "virtual");
}
function Be(e) {
  e.target === window || e.target === document || (!M && !Q && (h = "virtual", Y("virtual", e)), M = !1, Q = !1);
}
function We() {
  M = !1, Q = !0;
}
function V() {
  if (typeof window > "u" || ae)
    return;
  let e = HTMLElement.prototype.focus;
  HTMLElement.prototype.focus = function() {
    M = !0, e.apply(this, arguments);
  }, document.addEventListener("keydown", ue, !0), document.addEventListener("keyup", ue, !0), document.addEventListener("click", Ue, !0), window.addEventListener("focus", Be, !0), window.addEventListener("blur", We, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", I, !0), document.addEventListener("pointermove", I, !0), document.addEventListener("pointerup", I, !0)) : (document.addEventListener("mousedown", I, !0), document.addEventListener("mousemove", I, !0), document.addEventListener("mouseup", I, !0)), ae = !0;
}
typeof document < "u" && (document.readyState !== "loading" ? V() : document.addEventListener("DOMContentLoaded", V));
function Ae() {
  return h !== "pointer";
}
function Ne() {
  return h;
}
function je(e) {
  h = e, Y(e, null);
}
function qe() {
  V();
  let [e, r] = te(h);
  return C(() => {
    let n = () => {
      r(h);
    };
    return U.add(n), () => {
      U.delete(n);
    };
  }, []), e;
}
function Ge(e, r, n) {
  return !(e && r === "keyboard" && n instanceof KeyboardEvent && !He[n.key]);
}
function ze(e, r, n) {
  V(), C(() => {
    let c = (a, p) => {
      !Ge(n == null ? void 0 : n.isTextInput, a, p) || e(Ae());
    };
    return U.add(c), () => {
      U.delete(c);
    };
  }, r);
}
function Je(e) {
  let { isDisabled: r, onBlurWithin: n, onFocusWithin: c, onFocusWithinChange: a } = e, p = D({
    isFocusWithin: !1
  }), u = k((b) => {
    p.current.isFocusWithin && !b.currentTarget.contains(b.relatedTarget) && (p.current.isFocusWithin = !1, n && n(b), a && a(!1));
  }, [
    n,
    a,
    p
  ]), f = be(u), d = k((b) => {
    p.current.isFocusWithin || (c && c(b), a && a(!0), p.current.isFocusWithin = !0, f(b));
  }, [
    c,
    a,
    f
  ]);
  return r ? {
    focusWithinProps: {
      onFocus: null,
      onBlur: null
    }
  } : {
    focusWithinProps: {
      onFocus: d,
      onBlur: u
    }
  };
}
let _ = !1, j = 0;
function Z() {
  _ = !0, setTimeout(() => {
    _ = !1;
  }, 50);
}
function ce(e) {
  e.pointerType === "touch" && Z();
}
function Re() {
  if (!(typeof document > "u"))
    return typeof PointerEvent < "u" ? document.addEventListener("pointerup", ce) : document.addEventListener("touchend", Z), j++, () => {
      j--, !(j > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", ce) : document.removeEventListener("touchend", Z));
    };
}
function Qe(e) {
  let { onHoverStart: r, onHoverChange: n, onHoverEnd: c, isDisabled: a } = e, [p, u] = te(!1), f = D({
    isHovered: !1,
    ignoreEmulatedMouseEvents: !1,
    pointerType: "",
    target: null
  }).current;
  C(Re, []);
  let { hoverProps: d, triggerHoverEnd: b } = pe(() => {
    let v = (l, T) => {
      if (f.pointerType = T, a || T === "touch" || f.isHovered || !l.currentTarget.contains(l.target))
        return;
      f.isHovered = !0;
      let S = l.currentTarget;
      f.target = S, r && r({
        type: "hoverstart",
        target: S,
        pointerType: T
      }), n && n(!0), u(!0);
    }, O = (l, T) => {
      if (f.pointerType = "", f.target = null, T === "touch" || !f.isHovered)
        return;
      f.isHovered = !1;
      let S = l.currentTarget;
      c && c({
        type: "hoverend",
        target: S,
        pointerType: T
      }), n && n(!1), u(!1);
    }, g = {};
    return typeof PointerEvent < "u" ? (g.onPointerEnter = (l) => {
      _ && l.pointerType === "mouse" || v(l, l.pointerType);
    }, g.onPointerLeave = (l) => {
      !a && l.currentTarget.contains(l.target) && O(l, l.pointerType);
    }) : (g.onTouchStart = () => {
      f.ignoreEmulatedMouseEvents = !0;
    }, g.onMouseEnter = (l) => {
      !f.ignoreEmulatedMouseEvents && !_ && v(l, "mouse"), f.ignoreEmulatedMouseEvents = !1;
    }, g.onMouseLeave = (l) => {
      !a && l.currentTarget.contains(l.target) && O(l, "mouse");
    }), {
      hoverProps: g,
      triggerHoverEnd: O
    };
  }, [
    r,
    n,
    c,
    a,
    f
  ]);
  return C(() => {
    a && b({
      currentTarget: f.target
    }, f.pointerType);
  }, [
    a
  ]), {
    hoverProps: d,
    isHovered: p
  };
}
function Ze(e) {
  let { ref: r, onInteractOutside: n, isDisabled: c, onInteractOutsideStart: a } = e, u = D({
    isPointerDown: !1,
    ignoreEmulatedMouseEvents: !1,
    onInteractOutside: n,
    onInteractOutsideStart: a
  }).current;
  u.onInteractOutside = n, u.onInteractOutsideStart = a, C(() => {
    if (c)
      return;
    let f = (d) => {
      G(d, r) && u.onInteractOutside && (u.onInteractOutsideStart && u.onInteractOutsideStart(d), u.isPointerDown = !0);
    };
    if (typeof PointerEvent < "u") {
      let d = (b) => {
        u.isPointerDown && u.onInteractOutside && G(b, r) && (u.isPointerDown = !1, u.onInteractOutside(b));
      };
      return document.addEventListener("pointerdown", f, !0), document.addEventListener("pointerup", d, !0), () => {
        document.removeEventListener("pointerdown", f, !0), document.removeEventListener("pointerup", d, !0);
      };
    } else {
      let d = (v) => {
        u.ignoreEmulatedMouseEvents ? u.ignoreEmulatedMouseEvents = !1 : u.isPointerDown && u.onInteractOutside && G(v, r) && (u.isPointerDown = !1, u.onInteractOutside(v));
      }, b = (v) => {
        u.ignoreEmulatedMouseEvents = !0, u.onInteractOutside && u.isPointerDown && G(v, r) && (u.isPointerDown = !1, u.onInteractOutside(v));
      };
      return document.addEventListener("mousedown", f, !0), document.addEventListener("mouseup", d, !0), document.addEventListener("touchstart", f, !0), document.addEventListener("touchend", b, !0), () => {
        document.removeEventListener("mousedown", f, !0), document.removeEventListener("mouseup", d, !0), document.removeEventListener("touchstart", f, !0), document.removeEventListener("touchend", b, !0);
      };
    }
  }, [
    r,
    u,
    c
  ]);
}
function G(e, r) {
  if (e.button > 0)
    return !1;
  if (e.target) {
    const n = e.target.ownerDocument;
    if (!n || !n.documentElement.contains(e.target))
      return !1;
  }
  return r.current && !r.current.contains(e.target);
}
function fe(e) {
  if (!e)
    return;
  let r = !0;
  return (n) => {
    let c = {
      ...n,
      preventDefault() {
        n.preventDefault();
      },
      isDefaultPrevented() {
        return n.isDefaultPrevented();
      },
      stopPropagation() {
        console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
      },
      continuePropagation() {
        r = !1;
      }
    };
    e(c), r && n.stopPropagation();
  };
}
function et(e) {
  return {
    keyboardProps: e.isDisabled ? {} : {
      onKeyDown: fe(e.onKeyDown),
      onKeyUp: fe(e.onKeyUp)
    }
  };
}
const Ve = 500;
function tt(e) {
  let { isDisabled: r, onLongPressStart: n, onLongPressEnd: c, onLongPress: a, threshold: p = Ve, accessibilityDescription: u } = e;
  const f = D(null);
  let { addGlobalListener: d, removeGlobalListener: b } = le(), { pressProps: v } = Oe({
    isDisabled: r,
    onPressStart(g) {
      if ((g.pointerType === "mouse" || g.pointerType === "touch") && (n && n({
        ...g,
        type: "longpressstart"
      }), f.current = setTimeout(() => {
        g.target.dispatchEvent(new PointerEvent("pointercancel", {
          bubbles: !0
        })), a && a({
          ...g,
          type: "longpress"
        }), f.current = null;
      }, p), g.pointerType === "touch")) {
        let l = (T) => {
          T.preventDefault();
        };
        d(g.target, "contextmenu", l, {
          once: !0
        }), d(window, "pointerup", () => {
          setTimeout(() => {
            b(g.target, "contextmenu", l);
          }, 30);
        }, {
          once: !0
        });
      }
    },
    onPressEnd(g) {
      f.current && clearTimeout(f.current), c && (g.pointerType === "mouse" || g.pointerType === "touch") && c({
        ...g,
        type: "longpressend"
      });
    }
  }), O = Le(a && !r ? u : null);
  return {
    longPressProps: ee(v, O)
  };
}
export {
  Ne as getInteractionModality,
  Ae as isFocusVisible,
  je as setInteractionModality,
  Xe as useFocus,
  ze as useFocusVisibleListener,
  Je as useFocusWithin,
  Qe as useHover,
  Ze as useInteractOutside,
  qe as useInteractionModality,
  et as useKeyboard,
  tt as useLongPress,
  Oe as usePress
};
//# sourceMappingURL=module.es.js.map
