import { r as ref, w as watch, s as shallowRef, b as watchEffect, e as readonly, g as getCurrentScope, f as onScopeDispose, h as customRef, i as getCurrentInstance, j as onMounted, n as nextTick, u as unref } from "./js-@vue.js";
var __defProp$9 = Object.defineProperty;
var __defProps$6 = Object.defineProperties;
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, {
  enumerable: true,
  configurable: true,
  writable: true,
  value
}) : obj[key] = value;
var __spreadValues$9 = (a, b) => {
  for (var prop in b || (b = {})) if (__hasOwnProp$b.call(b, prop)) __defNormalProp$9(a, prop, b[prop]);
  if (__getOwnPropSymbols$b) for (var prop of __getOwnPropSymbols$b(b)) {
    if (__propIsEnum$b.call(b, prop)) __defNormalProp$9(a, prop, b[prop]);
  }
  return a;
};
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
function computedEager(fn, options) {
  var _a2;
  const result = shallowRef();
  watchEffect(() => {
    result.value = fn();
  }, __spreadProps$6(__spreadValues$9({}, options), {
    flush: (_a2 = void 0) != null ? _a2 : `\u0073\u0079\u006e\u0063`
  }));
  return readonly(result);
}
var _a;
const isClient = typeof window !== `\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064`;
const isFunction = val => typeof val === `\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e`;
const isString = val => typeof val === `\u0073\u0074\u0072\u0069\u006e\u0067`;
const noop = () => {};
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function resolveUnref(r) {
  return typeof r === `\u0066\u0075\u006e\u0063\u0074\u0069\u006f\u006e` ? r() : unref(r);
}
function createFilterWrapper(filter, fn) {
  function wrapper(...args) {
    return new Promise((resolve, reject) => {
      Promise.resolve(filter(() => fn.apply(this, args), {
        fn,
        thisArg: this,
        args
      })).then(resolve).catch(reject);
    });
  }
  return wrapper;
}
function debounceFilter(ms, options = {}) {
  let timer;
  let maxTimer;
  let lastRejector = noop;
  const _clearTimeout = timer2 => {
    clearTimeout(timer2);
    lastRejector();
    lastRejector = noop;
  };
  const filter = invoke => {
    const duration = resolveUnref(ms);
    const maxDuration = resolveUnref(options.maxWait);
    if (timer) _clearTimeout(timer);
    if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
      if (maxTimer) {
        _clearTimeout(maxTimer);
        maxTimer = null;
      }
      return Promise.resolve(invoke());
    }
    return new Promise((resolve, reject) => {
      lastRejector = options.rejectOnCancel ? reject : resolve;
      if (maxDuration && !maxTimer) {
        maxTimer = setTimeout(() => {
          if (timer) _clearTimeout(timer);
          maxTimer = null;
          resolve(invoke());
        }, maxDuration);
      }
      timer = setTimeout(() => {
        if (maxTimer) _clearTimeout(maxTimer);
        maxTimer = null;
        resolve(invoke());
      }, duration);
    });
  };
  return filter;
}
function identity(arg) {
  return arg;
}
function computedWithControl(source, fn) {
  let v = void 0;
  let track;
  let trigger;
  const dirty = ref(true);
  const update = () => {
    dirty.value = true;
    trigger();
  };
  watch(source, update, {
    flush: `\u0073\u0079\u006e\u0063`
  });
  const get = isFunction(fn) ? fn : fn.get;
  const set = isFunction(fn) ? void 0 : fn.set;
  const result = customRef((_track, _trigger) => {
    track = _track;
    trigger = _trigger;
    return {
      get() {
        if (dirty.value) {
          v = get();
          dirty.value = false;
        }
        track();
        return v;
      },
      set(v2) {
        set == null ? void 0 : set(v2);
      }
    };
  });
  if (Object.isExtensible(result)) result.trigger = update;
  return result;
}
function tryOnScopeDispose(fn) {
  if (getCurrentScope()) {
    onScopeDispose(fn);
    return true;
  }
  return false;
}
function useDebounceFn(fn, ms = 200, options = {}) {
  return createFilterWrapper(debounceFilter(ms, options), fn);
}
function refDebounced(value, ms = 200, options = {}) {
  const debounced = ref(value.value);
  const updater = useDebounceFn(() => {
    debounced.value = value.value;
  }, ms, options);
  watch(value, () => updater());
  return debounced;
}
function tryOnMounted(fn, sync = true) {
  if (getCurrentInstance()) onMounted(fn);else if (sync) fn();else nextTick(fn);
}
function useTimeoutFn(cb, interval, options = {}) {
  const {
    immediate = true
  } = options;
  const isPending = ref(false);
  let timer = null;
  function clear() {
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }
  }
  function stop() {
    isPending.value = false;
    clear();
  }
  function start(...args) {
    clear();
    isPending.value = true;
    timer = setTimeout(() => {
      isPending.value = false;
      timer = null;
      cb(...args);
    }, resolveUnref(interval));
  }
  if (immediate) {
    isPending.value = true;
    if (isClient) start();
  }
  tryOnScopeDispose(stop);
  return {
    isPending: readonly(isPending),
    start,
    stop
  };
}
function unrefElement(elRef) {
  var _a2;
  const plain = resolveUnref(elRef);
  return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
}
const defaultWindow = isClient ? window : void 0;
function useEventListener(...args) {
  let target;
  let events;
  let listeners;
  let options;
  if (isString(args[0]) || Array.isArray(args[0])) {
    [events, listeners, options] = args;
    target = defaultWindow;
  } else {
    [target, events, listeners, options] = args;
  }
  if (!target) return noop;
  if (!Array.isArray(events)) events = [events];
  if (!Array.isArray(listeners)) listeners = [listeners];
  const cleanups = [];
  const cleanup = () => {
    cleanups.forEach(fn => fn());
    cleanups.length = 0;
  };
  const register = (el, event, listener, options2) => {
    el.addEventListener(event, listener, options2);
    return () => el.removeEventListener(event, listener, options2);
  };
  const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
    cleanup();
    if (!el) return;
    cleanups.push(...events.flatMap(event => {
      return listeners.map(listener => register(el, event, listener, options2));
    }));
  }, {
    immediate: true,
    flush: `\u0070\u006f\u0073\u0074`
  });
  const stop = () => {
    stopWatch();
    cleanup();
  };
  tryOnScopeDispose(stop);
  return stop;
}
let _iOSWorkaround = false;
function onClickOutside(target, handler, options = {}) {
  const {
    window: window2 = defaultWindow,
    ignore = [],
    capture = true,
    detectIframe = false
  } = options;
  if (!window2) return;
  if (isIOS && !_iOSWorkaround) {
    _iOSWorkaround = true;
    Array.from(window2.document.body.children).forEach(el => el.addEventListener(`\u0063\u006c\u0069\u0063\u006b`, noop));
  }
  let shouldListen = true;
  const shouldIgnore = event => {
    return ignore.some(target2 => {
      if (typeof target2 === `\u0073\u0074\u0072\u0069\u006e\u0067`) {
        return Array.from(window2.document.querySelectorAll(target2)).some(el => el === event.target || event.composedPath().includes(el));
      } else {
        const el = unrefElement(target2);
        return el && (event.target === el || event.composedPath().includes(el));
      }
    });
  };
  const listener = event => {
    const el = unrefElement(target);
    if (!el || el === event.target || event.composedPath().includes(el)) return;
    if (event.detail === 0) shouldListen = !shouldIgnore(event);
    if (!shouldListen) {
      shouldListen = true;
      return;
    }
    handler(event);
  };
  const cleanup = [useEventListener(window2, `\u0063\u006c\u0069\u0063\u006b`, listener, {
    passive: true,
    capture
  }), useEventListener(window2, `\u0070\u006f\u0069\u006e\u0074\u0065\u0072\u0064\u006f\u0077\u006e`, e => {
    const el = unrefElement(target);
    if (el) shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  }, {
    passive: true
  }), detectIframe && useEventListener(window2, `\u0062\u006c\u0075\u0072`, event => {
    var _a2;
    const el = unrefElement(target);
    if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === `\u0049\u0046\u0052\u0041\u004d\u0045` && !(el == null ? void 0 : el.contains(window2.document.activeElement))) handler(event);
  })].filter(Boolean);
  const stop = () => cleanup.forEach(fn => fn());
  return stop;
}
function useActiveElement(options = {}) {
  var _a2;
  const {
    window: window2 = defaultWindow
  } = options;
  const document = (_a2 = options.document) != null ? _a2 : window2 == null ? void 0 : window2.document;
  const activeElement = computedWithControl(() => null, () => document == null ? void 0 : document.activeElement);
  if (window2) {
    useEventListener(window2, `\u0062\u006c\u0075\u0072`, event => {
      if (event.relatedTarget !== null) return;
      activeElement.trigger();
    }, true);
    useEventListener(window2, `\u0066\u006f\u0063\u0075\u0073`, activeElement.trigger, true);
  }
  return activeElement;
}
function useSupported(callback, sync = false) {
  const isSupported = ref();
  const update = () => isSupported.value = Boolean(callback());
  update();
  tryOnMounted(update, sync);
  return isSupported;
}
const _global = typeof globalThis !== `\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064` ? globalThis : typeof window !== `\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064` ? window : typeof global !== `\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064` ? global : typeof self !== `\u0075\u006e\u0064\u0065\u0066\u0069\u006e\u0065\u0064` ? self : {};
const globalKey = `\u005f\u005f\u0076\u0075\u0065\u0075\u0073\u0065\u005f\u0073\u0073\u0072\u005f\u0068\u0061\u006e\u0064\u006c\u0065\u0072\u0073\u005f\u005f`;
_global[globalKey] = _global[globalKey] || {};
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
var __objRest$2 = (source, exclude) => {
  var target = {};
  for (var prop in source) if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols$g) for (var prop of __getOwnPropSymbols$g(source)) {
    if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop)) target[prop] = source[prop];
  }
  return target;
};
function useResizeObserver(target, callback, options = {}) {
  const _a2 = options,
    {
      window: window2 = defaultWindow
    } = _a2,
    observerOptions = __objRest$2(_a2, [`\u0077\u0069\u006e\u0064\u006f\u0077`]);
  let observer;
  const isSupported = useSupported(() => window2 && `\u0052\u0065\u0073\u0069\u007a\u0065\u004f\u0062\u0073\u0065\u0072\u0076\u0065\u0072` in window2);
  const cleanup = () => {
    if (observer) {
      observer.disconnect();
      observer = void 0;
    }
  };
  const stopWatch = watch(() => unrefElement(target), el => {
    cleanup();
    if (isSupported.value && window2 && el) {
      observer = new ResizeObserver(callback);
      observer.observe(el, observerOptions);
    }
  }, {
    immediate: true,
    flush: `\u0070\u006f\u0073\u0074`
  });
  const stop = () => {
    cleanup();
    stopWatch();
  };
  tryOnScopeDispose(stop);
  return {
    isSupported,
    stop
  };
}
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
var __objRest$1 = (source, exclude) => {
  var target = {};
  for (var prop in source) if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols$8) for (var prop of __getOwnPropSymbols$8(source)) {
    if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop)) target[prop] = source[prop];
  }
  return target;
};
function useMutationObserver(target, callback, options = {}) {
  const _a2 = options,
    {
      window: window2 = defaultWindow
    } = _a2,
    mutationOptions = __objRest$1(_a2, [`\u0077\u0069\u006e\u0064\u006f\u0077`]);
  let observer;
  const isSupported = useSupported(() => window2 && `\u004d\u0075\u0074\u0061\u0074\u0069\u006f\u006e\u004f\u0062\u0073\u0065\u0072\u0076\u0065\u0072` in window2);
  const cleanup = () => {
    if (observer) {
      observer.disconnect();
      observer = void 0;
    }
  };
  const stopWatch = watch(() => unrefElement(target), el => {
    cleanup();
    if (isSupported.value && window2 && el) {
      observer = new MutationObserver(callback);
      observer.observe(el, mutationOptions);
    }
  }, {
    immediate: true
  });
  const stop = () => {
    cleanup();
    stopWatch();
  };
  tryOnScopeDispose(stop);
  return {
    isSupported,
    stop
  };
}
var SwipeDirection;
(function (SwipeDirection2) {
  SwipeDirection2[`\u0055\u0050`] = `\u0055\u0050`;
  SwipeDirection2[`\u0052\u0049\u0047\u0048\u0054`] = `\u0052\u0049\u0047\u0048\u0054`;
  SwipeDirection2[`\u0044\u004f\u0057\u004e`] = `\u0044\u004f\u0057\u004e`;
  SwipeDirection2[`\u004c\u0045\u0046\u0054`] = `\u004c\u0045\u0046\u0054`;
  SwipeDirection2[`\u004e\u004f\u004e\u0045`] = `\u004e\u004f\u004e\u0045`;
})(SwipeDirection || (SwipeDirection = {}));
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
  enumerable: true,
  configurable: true,
  writable: true,
  value
}) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
    if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
  }
  return a;
};
const _TransitionPresets = {
  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]
};
__spreadValues({
  linear: identity
}, _TransitionPresets);
export { useResizeObserver as a, unrefElement as b, computedEager as c, useTimeoutFn as d, isIOS as e, useMutationObserver as f, useActiveElement as g, isClient as i, onClickOutside as o, refDebounced as r, tryOnScopeDispose as t, useEventListener as u };