import x from "../../../@babel/runtime/helpers/esm/slicedToArray.mjs";
import M from "../../../rc-util/es/hooks/useMemo.mjs";
import c from "../../../rc-util/es/isEqual.mjs";
import * as T from "react";
import { isEqual as V, formatValue as v } from "../utils/dateUtil.mjs";
function E(o, a) {
  var u = a.formatList, f = a.generateConfig, n = a.locale, g = M(function() {
    if (!o)
      return [[""], ""];
    for (var r = "", e = [], t = 0; t < u.length; t += 1) {
      var p = u[t], l = v(o, {
        generateConfig: f,
        locale: n,
        format: p
      });
      e.push(l), t === 0 && (r = l);
    }
    return [e, r];
  }, [o, u, n], function(r, e) {
    return (
      // Not Same Date
      !V(f, r[0], e[0]) || // Not Same format
      !c(r[1], e[1], !0) || // Not Same locale
      !c(r[2], e[2], !0)
    );
  }), i = x(g, 2), m = i[0], s = i[1];
  return T.useMemo(function() {
    return [m, s];
  }, [m.join(""), s]);
}
export {
  E as default
};
