import * as l from "react";
import { composeRefs as y } from "../../../../../@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.8_react@19.2.3/node_modules/@radix-ui/react-compose-refs/dist/index.es.js";
import { jsx as p, Fragment as S } from "react/jsx-runtime";
// @__NO_SIDE_EFFECTS__
function _(e) {
  const r = /* @__PURE__ */ g(e), t = l.forwardRef((o, n) => {
    const { children: i, ...a } = o, s = l.Children.toArray(i), c = s.find(E);
    if (c) {
      const f = c.props.children, m = s.map((u) => u === c ? l.Children.count(f) > 1 ? l.Children.only(null) : l.isValidElement(f) ? f.props.children : null : u);
      return /* @__PURE__ */ p(r, { ...a, ref: n, children: l.isValidElement(f) ? l.cloneElement(f, void 0, m) : null });
    }
    return /* @__PURE__ */ p(r, { ...a, ref: n, children: i });
  });
  return t.displayName = `${e}.Slot`, t;
}
// @__NO_SIDE_EFFECTS__
function g(e) {
  const r = l.forwardRef((t, o) => {
    const { children: n, ...i } = t;
    if (l.isValidElement(n)) {
      const a = b(n), s = C(i, n.props);
      return n.type !== l.Fragment && (s.ref = o ? y(o, a) : a), l.cloneElement(n, s);
    }
    return l.Children.count(n) > 1 ? l.Children.only(null) : null;
  });
  return r.displayName = `${e}.SlotClone`, r;
}
var d = /* @__PURE__ */ Symbol("radix.slottable");
// @__NO_SIDE_EFFECTS__
function x(e) {
  const r = ({ children: t }) => /* @__PURE__ */ p(S, { children: t });
  return r.displayName = `${e}.Slottable`, r.__radixId = d, r;
}
function E(e) {
  return l.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === d;
}
function C(e, r) {
  const t = { ...r };
  for (const o in r) {
    const n = e[o], i = r[o];
    /^on[A-Z]/.test(o) ? n && i ? t[o] = (...s) => {
      const c = i(...s);
      return n(...s), c;
    } : n && (t[o] = n) : o === "style" ? t[o] = { ...n, ...i } : o === "className" && (t[o] = [n, i].filter(Boolean).join(" "));
  }
  return { ...e, ...t };
}
function b(e) {
  let r = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning;
  return t ? e.ref : (r = Object.getOwnPropertyDescriptor(e, "ref")?.get, t = r && "isReactWarning" in r && r.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
}
export {
  _ as createSlot,
  x as createSlottable
};
//# sourceMappingURL=index.es.js.map
