import { useContext as C, useState as V, useEffect as S } from "react";
import { X as T, aw as E, ax as I, Y as n, eE as D, a3 as H, O as p, aA as P, w, S as j, a2 as O, Z as B, eF as F, v as y, U as A, F as o, a6 as c, G as h, a7 as d, a8 as m, af as f, a9 as M, aa as G, ac as g, ab as U, bV as N, at as u, dk as W, eG as X, ak as Y } from "./603b75d9.js";
import { timelineDate as Z, TimelineDataTooltip as q } from "./e7aef1c7.js";
import { convertTimeLineData as z } from "./1fadbfa9.js";
import "react-dom";
const J = T.div`
  ${(e) => `margin: ${e.$style.margin ?? "3px"}`};
  ${(e) => `padding: ${e.$style.padding !== "3px" ? e.$style.padding : "20px 10px 0px 10px"}`};
  ${(e) => `width: ${E(e.$style.margin ?? "3px")}`};
  ${(e) => `height: ${I(e.$style.margin ?? "3px")}`};
  ${(e) => `background: ${e.$style.background}`};
  ${(e) => `border-radius: ${e.$style.radius}`};
  overflow: auto;
  overflow-x: hidden;

  .ant-timeline .ant-timeline-item-head {
    background-color: transparent;
  }
`, K = [Y], Q = [{
  label: n("timeLine.left"),
  value: "left"
}, {
  label: n("timeLine.right"),
  value: "right"
}, {
  label: n("timeLine.alternate"),
  value: "alternate"
}], R = {
  value: D(z, Z),
  mode: H(Q, "alternate"),
  reverse: p,
  autoHeight: P,
  verticalScrollbar: w(p, !1),
  pending: w(j, n("timeLine.defaultPending")),
  onEvent: O(K),
  style: B(F, "style"),
  clickedObject: y({
    title: ""
  }),
  clickedIndex: y(0)
}, _ = async (e) => {
  if (!e)
    return null;
  try {
    const r = (await import("./603b75d9.js").then((i) => i.Ea))[e];
    return r ? /* @__PURE__ */ o(r, {}) : null;
  } catch (l) {
    return console.error(`Error loading icon ${e}:`, l), null;
  }
}, v = (e) => {
  const {
    value: l,
    dispatch: r,
    style: i,
    mode: ee,
    reverse: te,
    onEvent: $
  } = e, [x, k] = V([]);
  S(() => {
    (async () => {
      const a = await Promise.all(l.map((s) => s.dot ? _(s.dot) : Promise.resolve(null)));
      k(a);
    })();
  }, [l]);
  const L = l.map((t, a) => ({
    key: a,
    color: t == null ? void 0 : t.color,
    dot: x[a] || "",
    label: /* @__PURE__ */ o("span", {
      style: {
        color: (t == null ? void 0 : t.labelColor) || (i == null ? void 0 : i.labelColor)
      },
      children: t == null ? void 0 : t.label
    }),
    children: /* @__PURE__ */ c(h, {
      children: [/* @__PURE__ */ o(N, {
        type: "link",
        onClick: (s) => {
          s.preventDefault(), r(u("clickedObject", t, !1)), r(u("clickedIndex", a, !1)), $("click");
        },
        style: {
          cursor: "pointer",
          color: (t == null ? void 0 : t.titleColor) || (i == null ? void 0 : i.titleColor)
        },
        children: /* @__PURE__ */ o("b", {
          children: t == null ? void 0 : t.title
        })
      }), /* @__PURE__ */ o("p", {
        style: {
          color: (t == null ? void 0 : t.subTitleColor) || (i == null ? void 0 : i.subTitleColor)
        },
        children: t == null ? void 0 : t.subTitle
      })]
    })
  }));
  return /* @__PURE__ */ o(W, {
    hideScrollbar: !e.verticalScrollbar,
    children: /* @__PURE__ */ o(J, {
      $style: i,
      children: /* @__PURE__ */ o(X, {
        mode: (e == null ? void 0 : e.mode) || "left",
        reverse: e == null ? void 0 : e.reverse,
        pending: (e == null ? void 0 : e.pending) && /* @__PURE__ */ o("span", {
          style: {
            color: i == null ? void 0 : i.titleColor
          },
          children: (e == null ? void 0 : e.pending) || ""
        }),
        items: L
      })
    })
  });
};
let b = function() {
  return new A(R, (e, l) => /* @__PURE__ */ o(v, {
    ...e,
    dispatch: l
  })).setPropertyViewFn((e) => /* @__PURE__ */ c(h, {
    children: [/* @__PURE__ */ o(d, {
      name: m.basic,
      children: e.value.propertyView({
        label: n("timeLine.value"),
        tooltip: q,
        placeholder: "[]"
      })
    }), ["logic", "both"].includes(C(f).editorModeStatus) && /* @__PURE__ */ c(d, {
      name: m.interaction,
      children: [e.onEvent.getPropertyView(), M(e)]
    }), ["layout", "both"].includes(C(f).editorModeStatus) && /* @__PURE__ */ c(h, {
      children: [/* @__PURE__ */ c(d, {
        name: m.layout,
        children: [e.autoHeight.getPropertyView(), !e.autoHeight.getView() && e.verticalScrollbar.propertyView({
          label: n("prop.showVerticalScrollbar")
        }), e.mode.propertyView({
          label: n("timeLine.mode"),
          tooltip: n("timeLine.modeTooltip")
        }), e.pending.propertyView({
          label: n("timeLine.pending"),
          tooltip: n("timeLine.pendingDescription")
        }), e.reverse.propertyView({
          label: n("timeLine.reverse")
        })]
      }), /* @__PURE__ */ o(d, {
        name: m.style,
        children: e.style.getPropertyView()
      })]
    })]
  })).build();
}();
b = class extends b {
  autoHeight() {
    return this.children.autoHeight.getView();
  }
};
const ae = G(b, [new g("value", n("timeLine.valueDesc")), new g("clickedObject", n("timeLine.clickedObjectDesc")), new g("clickedIndex", n("timeLine.clickedIndexDesc")), U]);
export {
  ae as TimeLineComp
};
