import m, { useRef as d, useMemo as v, useState as h, useCallback as b } from "react";
import { mu as y, H as w } from "./56c67d3b.js";
function V(e, n, r, t) {
  function s(a) {
    return a instanceof r ? a : new r(function(o) {
      o(a);
    });
  }
  return new (r || (r = Promise))(function(a, o) {
    function c(i) {
      try {
        u(t.next(i));
      } catch (l) {
        o(l);
      }
    }
    function f(i) {
      try {
        u(t.throw(i));
      } catch (l) {
        o(l);
      }
    }
    function u(i) {
      i.done ? a(i.value) : s(i.value).then(c, f);
    }
    u((t = t.apply(e, n || [])).next());
  });
}
function x(e, n) {
  var r = typeof Symbol == "function" && e[Symbol.iterator];
  if (!r)
    return e;
  var t = r.call(e), s, a = [], o;
  try {
    for (; (n === void 0 || n-- > 0) && !(s = t.next()).done; )
      a.push(s.value);
  } catch (c) {
    o = { error: c };
  } finally {
    try {
      s && !s.done && (r = t.return) && r.call(t);
    } finally {
      if (o)
        throw o.error;
    }
  }
  return a;
}
function D(e, n, r) {
  if (r || arguments.length === 2)
    for (var t = 0, s = n.length, a; t < s; t++)
      (a || !(t in n)) && (a || (a = Array.prototype.slice.call(n, 0, t)), a[t] = n[t]);
  return e.concat(a || Array.prototype.slice.call(n));
}
function E(e, n) {
  const r = Object.assign({}, n.props);
  e.className && (r.className = y(n.props.className, e.className)), e.style && (r.style = Object.assign(Object.assign({}, r.style), e.style)), e.tabIndex !== void 0 && (r.tabIndex = e.tabIndex);
  for (const t in e)
    e.hasOwnProperty(t) && (t.startsWith("data-") || t.startsWith("aria-")) && (r[t] = e[t]);
  return m.cloneElement(n, r);
}
function F(...e) {
  const n = {};
  return e.forEach((r) => {
    Object.keys(r).forEach((t) => {
      r[t] !== void 0 && (n[t] = r[t]);
    });
  }), n;
}
function R(e, n) {
  const r = e;
  for (const t in n)
    n.hasOwnProperty(t) && (r[t] = n[t]);
  return r;
}
const p = "adm-safe-area", $ = (e) => E(e, /* @__PURE__ */ w("div", {
  className: y(p, `${p}-position-${e.position}`)
}));
var N = function(e) {
  return typeof e == "function";
}, g = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
const S = g;
function _(e) {
  S && (N(e) || console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));
  var n = d(e);
  n.current = v(function() {
    return e;
  }, [e]);
  var r = d();
  return r.current || (r.current = function() {
    for (var t = [], s = 0; s < arguments.length; s++)
      t[s] = arguments[s];
    return n.current.apply(this, t);
  }), r.current;
}
var O = function() {
  var e = x(h({}), 2), n = e[1];
  return b(function() {
    return n({});
  }, []);
};
const j = O;
function z(e) {
  const {
    value: n,
    defaultValue: r,
    onChange: t
  } = e, s = j(), a = d(n !== void 0 ? n : r);
  n !== void 0 && (a.current = n);
  const o = _((c, f = !1) => {
    const u = typeof c == "function" ? c(a.current) : c;
    if (!(!f && u === a.current))
      return a.current = u, s(), t == null ? void 0 : t(u);
  });
  return [a.current, o];
}
export {
  $ as S,
  D as _,
  R as a,
  _ as b,
  N as c,
  x as d,
  V as e,
  S as i,
  F as m,
  z as u,
  E as w
};
