import m from "../../../../@babel/runtime/helpers/esm/defineProperty.mjs";
import * as n from "react";
import { useRef as d, useLayoutEffect as v } from "react";
import y from "../../../../classnames/index.mjs";
import { scrollTo as R, waitElementReady as g } from "../../utils/uiUtil.mjs";
import k from "../../PanelContext.mjs";
function S(l) {
  var o = l.prefixCls, b = l.units, p = l.onSelect, c = l.value, C = l.active, x = l.hideDisabledOptions, r = l.info, N = l.type, a = "".concat(o, "-cell"), E = n.useContext(k), i = E.open, f = d(null), s = d(/* @__PURE__ */ new Map()), u = d();
  return v(function() {
    var e = s.current.get(c);
    e && i !== !1 && R(f.current, e.offsetTop, 120);
  }, [c]), v(function() {
    if (i) {
      var e = s.current.get(c);
      e && (u.current = g(e, function() {
        R(f.current, e.offsetTop, 0);
      }));
    }
    return function() {
      var t;
      (t = u.current) === null || t === void 0 || t.call(u);
    };
  }, [i]), /* @__PURE__ */ n.createElement("ul", {
    className: y("".concat(o, "-column"), m({}, "".concat(o, "-column-active"), C)),
    ref: f,
    style: {
      position: "relative"
    }
  }, b.map(function(e) {
    var t;
    return x && e.disabled ? null : /* @__PURE__ */ n.createElement("li", {
      key: e.value,
      ref: function(_) {
        s.current.set(e.value, _);
      },
      className: y(a, (t = {}, m(t, "".concat(a, "-disabled"), e.disabled), m(t, "".concat(a, "-selected"), c === e.value), t)),
      onClick: function() {
        e.disabled || p(e.value);
      }
    }, r.cellRender ? r.cellRender(e.value, {
      today: r.today,
      locale: r.locale,
      originNode: /* @__PURE__ */ n.createElement("div", {
        className: "".concat(a, "-inner")
      }, e.label),
      type: "time",
      subType: N
    }) : /* @__PURE__ */ n.createElement("div", {
      className: "".concat(a, "-inner")
    }, e.label));
  }));
}
export {
  S as default
};
