import { isArray as a, isFunction as p } from "lodash-unified";
import { cloneVNode as l } from "vue";
function x(n, r) {
  const t = u(n), o = u(r);
  return r.map((e) => {
    const i = m(e.props.name), f = o.get(i), s = t.get(i);
    if (!t.get(i) || f?.index !== s?.index)
      return e;
    const g = c(s.item), y = c(f.item);
    return JSON.stringify(g) !== JSON.stringify(y) ? e : l(e, { _signal: s.item._signal });
  });
}
function m(n) {
  return n ? (a(n) ? n : [n]).map((t) => "" + t).join("") : "";
}
function u(n) {
  const r = /* @__PURE__ */ new Map();
  return n.forEach((t, o) => {
    const e = t.props, i = m(e.name);
    r.set(i, { item: e, index: o });
  }), r;
}
function c(n) {
  if (n === null || typeof n != "object") return n;
  const r = {};
  for (const t in n) {
    const o = n[t];
    t === "_signal" || typeof o == "function" || (r[t] = c(o));
  }
  return r;
}
function M(n, ...r) {
  if (a(n))
    for (const t of n)
      p(t) && t(...r);
  else p(n) && n(...r);
}
export {
  x as diffFormItem,
  M as execFunc
};
