import { tryOnScopeDispose as v$1, isString as p, noop as a, isClient as f, tryOnMounted as y$1, resolveUnref as g$1, isIOS as l, identity as w$1 } from "../shared/index.mjs";
import { watch, ref } from "vue";
function O(e) {
  var n;
  const t = g$1(e);
  return (n = t == null ? void 0 : t.$el) != null ? n : t;
}
const y = f ? window : void 0;
function v(...e) {
  let n, t, r, u;
  if (p(e[0]) || Array.isArray(e[0]) ? ([t, r, u] = e, n = y) : [n, t, r, u] = e, !n)
    return a;
  Array.isArray(t) || (t = [t]), Array.isArray(r) || (r = [r]);
  const p$1 = [], i = () => {
    p$1.forEach((a2) => a2()), p$1.length = 0;
  }, l2 = (a2, f2, o, s) => (a2.addEventListener(f2, o, s), () => a2.removeEventListener(f2, o, s)), d = watch(() => [O(n), g$1(u)], ([a2, f2]) => {
    i(), a2 && p$1.push(...t.flatMap((o) => r.map((s) => l2(a2, o, s, f2))));
  }, { immediate: true, flush: "post" }), m = () => {
    d(), i();
  };
  return v$1(m), m;
}
let _ = false;
function q(e, n, t = {}) {
  const { window: r = y, ignore: u = [], capture: p2 = true, detectIframe: i = false } = t;
  if (!r)
    return;
  l && !_ && (_ = true, Array.from(r.document.body.children).forEach((o) => o.addEventListener("click", a)));
  let l$1 = true;
  const d = (o) => u.some((s) => {
    if (typeof s == "string")
      return Array.from(r.document.querySelectorAll(s)).some((c) => c === o.target || o.composedPath().includes(c));
    {
      const c = O(s);
      return c && (o.target === c || o.composedPath().includes(c));
    }
  }), a$1 = [
    v(r, "click", (o) => {
      const s = O(e);
      if (!(!s || s === o.target || o.composedPath().includes(s))) {
        if (o.detail === 0 && (l$1 = !d(o)), !l$1) {
          l$1 = true;
          return;
        }
        n(o);
      }
    }, { passive: true, capture: p2 }),
    v(r, "pointerdown", (o) => {
      const s = O(e);
      s && (l$1 = !o.composedPath().includes(s) && !d(o));
    }, { passive: true }),
    i && v(r, "blur", (o) => {
      var s;
      const c = O(e);
      ((s = r.document.activeElement) == null ? void 0 : s.tagName) === "IFRAME" && !(c != null && c.contains(r.document.activeElement)) && n(o);
    })
  ].filter(Boolean);
  return () => a$1.forEach((o) => o());
}
function W(e, n = false) {
  const t = ref(), r = () => t.value = !!e();
  return r(), y$1(r, n), t;
}
const b = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, I = "__vueuse_ssr_handlers__";
b[I] = b[I] || {};
var h = Object.getOwnPropertySymbols, k = Object.prototype.hasOwnProperty, x = Object.prototype.propertyIsEnumerable, B = (e, n) => {
  var t = {};
  for (var r in e)
    k.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
  if (e != null && h)
    for (var r of h(e))
      n.indexOf(r) < 0 && x.call(e, r) && (t[r] = e[r]);
  return t;
};
function K(e, n, t = {}) {
  const r = t, { window: u = y } = r, p2 = B(r, ["window"]);
  let i;
  const l2 = W(() => u && "ResizeObserver" in u), d = () => {
    i && (i.disconnect(), i = void 0);
  }, m = watch(() => O(e), (f2) => {
    d(), l2.value && u && f2 && (i = new ResizeObserver(n), i.observe(f2, p2));
  }, { immediate: true, flush: "post" }), a2 = () => {
    d(), m();
  };
  return v$1(a2), {
    isSupported: l2,
    stop: a2
  };
}
var w;
(function(e) {
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
})(w || (w = {}));
var $ = Object.defineProperty, E = Object.getOwnPropertySymbols, z = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable, g = (e, n, t) => n in e ? $(e, n, { enumerable: true, configurable: true, writable: true, value: t }) : e[n] = t, M = (e, n) => {
  for (var t in n || (n = {}))
    z.call(n, t) && g(e, t, n[t]);
  if (E)
    for (var t of E(n))
      F.call(n, t) && g(e, t, n[t]);
  return e;
};
const U = {
  easeInSine: [0.12, 0, 0.39, 0],
  easeOutSine: [0.61, 1, 0.88, 1],
  easeInOutSine: [0.37, 0, 0.63, 1],
  easeInQuad: [0.11, 0, 0.5, 0],
  easeOutQuad: [0.5, 1, 0.89, 1],
  easeInOutQuad: [0.45, 0, 0.55, 1],
  easeInCubic: [0.32, 0, 0.67, 0],
  easeOutCubic: [0.33, 1, 0.68, 1],
  easeInOutCubic: [0.65, 0, 0.35, 1],
  easeInQuart: [0.5, 0, 0.75, 0],
  easeOutQuart: [0.25, 1, 0.5, 1],
  easeInOutQuart: [0.76, 0, 0.24, 1],
  easeInQuint: [0.64, 0, 0.78, 0],
  easeOutQuint: [0.22, 1, 0.36, 1],
  easeInOutQuint: [0.83, 0, 0.17, 1],
  easeInExpo: [0.7, 0, 0.84, 0],
  easeOutExpo: [0.16, 1, 0.3, 1],
  easeInOutExpo: [0.87, 0, 0.13, 1],
  easeInCirc: [0.55, 0, 1, 0.45],
  easeOutCirc: [0, 0.55, 0.45, 1],
  easeInOutCirc: [0.85, 0, 0.15, 1],
  easeInBack: [0.36, 0, 0.66, -0.56],
  easeOutBack: [0.34, 1.56, 0.64, 1],
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
M({
  linear: w$1
}, U);
export {
  w as SwipeDirection,
  y as defaultWindow,
  w$1 as identity,
  f as isClient,
  l as isIOS,
  p as isString,
  a as noop,
  q as onClickOutside,
  g$1 as resolveUnref,
  y$1 as tryOnMounted,
  v$1 as tryOnScopeDispose,
  O as unrefElement,
  v as useEventListener,
  K as useResizeObserver,
  W as useSupported
};
