import { useContext as C, useState as V, useEffect as T } from "react";
import { a3 as I, aD as S, aE as D, a4 as n, eM as E, aa as H, V as p, aH as j, w as y, X as P, a9 as O, a5 as B, eN as M, v as w, U as A, H as o, ad as c, I as h, ae as d, af as m, am as f, ag as F, ah as N, aj as g, ai as U, c8 as G, aA as u, eh as W, eO as X, ar as q } from "./56c67d3b.js";
import { timelineDate as z, TimelineDataTooltip as J } from "./4a69de7b.js";
import { convertTimeLineData as K } from "./04ffe6b4.js";
import "react-dom";
const Q = I.div`
  ${(e) => `margin: ${e.$style.margin ?? "3px"}`};
  ${(e) => `padding: ${e.$style.padding !== "3px" ? e.$style.padding : "20px 10px 0px 10px"}`};
  ${(e) => `width: ${S(e.$style.margin ?? "3px")}`};
  ${(e) => `height: ${D(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;
  }
`, R = [q], Y = [{
  label: n("timeLine.left"),
  value: "left"
}, {
  label: n("timeLine.right"),
  value: "right"
}, {
  label: n("timeLine.alternate"),
  value: "alternate"
}], Z = {
  value: E(K, z),
  mode: H(Y, "alternate"),
  reverse: p,
  autoHeight: j,
  verticalScrollbar: y(p, !1),
  pending: y(P, n("timeLine.defaultPending")),
  onEvent: O(R),
  style: B(M, "style"),
  clickedObject: w({
    title: ""
  }),
  clickedIndex: w(0)
}, _ = async (e) => {
  if (!e)
    return null;
  try {
    const r = (await import("./56c67d3b.js").then((i) => i.Gf))[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, L] = V([]);
  T(() => {
    (async () => {
      const a = await Promise.all(l.map((s) => s.dot ? _(s.dot) : Promise.resolve(null)));
      L(a);
    })();
  }, [l]);
  const k = 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(G, {
        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(Q, {
      $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: k
      })
    })
  });
};
let b = function() {
  return new A(Z, (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: J,
        placeholder: "[]"
      })
    }), ["logic", "both"].includes(C(f).editorModeStatus) && /* @__PURE__ */ c(d, {
      name: m.interaction,
      children: [e.onEvent.getPropertyView(), F(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 = N(b, [new g("value", n("timeLine.valueDesc")), new g("clickedObject", n("timeLine.clickedObjectDesc")), new g("clickedIndex", n("timeLine.clickedIndexDesc")), U]);
export {
  ae as TimeLineComp
};
