import { a3 as K, aC as k, aD as x, aE as j, a4 as t, a5 as I, g3 as W, a9 as z, w as c, X as C, V as g, g4 as H, db as O, v as f, U as A, H as s, ad as h, I as D, ae as y, af as d, ag as R, ah as N, aj as n, ai as U, ak as B, aI as F, g5 as P, cD as L, g6 as M, g7 as X, aA as u } from "./56c67d3b.js";
import { useRef as _, useState as m, useEffect as q } from "react";
import "react-dom";
const G = K.div`
  height: 100%;
  width: 100%;
  ${(e) => e.$style && J(e.$style)}
`, J = (e) => k`
    margin: ${e.margin};
    padding: ${e.padding};
    border-style: ${e.borderStyle};
    border-width: ${e.borderWidth};
    border-color: ${e.border};
    background: ${e.background};
    border-radius: ${e.radius};
    max-width: ${x(e.margin)};
    max-height: ${j(e.margin)};
  `, Q = [{
  key: "1",
  title: t("transfer.content", {
    i: 1
  })
}, {
  key: "2",
  title: t("transfer.content", {
    i: 2
  })
}, {
  key: "3",
  title: t("transfer.content", {
    i: 3
  })
}, {
  key: "4",
  title: t("transfer.content", {
    i: 4
  })
}, {
  key: "5",
  title: t("transfer.content", {
    i: 5
  })
}, {
  key: "6",
  title: t("transfer.content", {
    i: 6
  })
}, {
  key: "7",
  title: t("transfer.content", {
    i: 7
  })
}], Y = [L, M, X], Z = {
  style: I(W, "style"),
  onEvent: z(Y),
  sourceTitle: c(C, t("transfer.sourceTitle")),
  targetTitle: c(C, t("transfer.targetTitle")),
  oneWay: g,
  pagination: g,
  showSearch: g.DEFAULT_TRUE,
  pageSize: c(B, 10),
  items: H("items", Q),
  targetKeys: O("targetKeys", []),
  selectedKeys: f([[], []]),
  targerObject: f([]),
  searchInfo: f(["", ""])
}, ee = (e) => {
  const i = _(null), [o, S] = m(0), [l, v] = m(0), [E, T] = m([]);
  q(() => {
    l && o && b();
  }, [l, o]);
  const V = (a) => {
    e.targetKeys.onChange(a), e.dispatch(u("targerObject", Array.isArray(e.items.value) ? e.items.value.filter((r) => a.includes(r.key)) : [], !1)), e.onEvent("change");
  }, p = (a, r) => {
    T([...a, ...r]), e.dispatch(u("selectedKeys", [a, r], !1)), e.onEvent("selectedChange");
  }, $ = (a, r) => {
    e.dispatch(u("searchInfo", [a, r], !1)), e.onEvent("search");
  }, b = () => {
    const a = i.current;
    S((a == null ? void 0 : a.clientWidth) ?? 0), v((a == null ? void 0 : a.clientHeight) ?? 0);
  };
  return /* @__PURE__ */ s(F, {
    onResize: b,
    children: /* @__PURE__ */ s(G, {
      ref: i,
      $style: e.style,
      children: /* @__PURE__ */ s(P, {
        listStyle: {
          width: o,
          height: l
        },
        showSearch: e.showSearch,
        dataSource: e.items.value,
        titles: [e.targetTitle, e.sourceTitle],
        targetKeys: e.targetKeys.value,
        selectedKeys: E,
        onChange: V,
        onSelectChange: p,
        render: (a) => a.title,
        oneWay: e.oneWay,
        onSearch: $,
        pagination: e.pagination ? {
          pageSize: e.pageSize || 10
        } : !1
      })
    })
  });
};
let w = function() {
  return new A(Z, (e, i) => /* @__PURE__ */ s(ee, {
    ...e,
    dispatch: i
  })).setPropertyViewFn((e) => /* @__PURE__ */ h(D, {
    children: [/* @__PURE__ */ h(y, {
      name: d.basic,
      children: [e.items.propertyView({
        label: t("transfer.items")
      }), e.targetKeys.propertyView({
        label: t("transfer.targetKeys")
      }), e.sourceTitle.propertyView({
        label: t("transfer.sourceTitle")
      }), e.targetTitle.propertyView({
        label: t("transfer.targetTitle")
      }), e.showSearch.propertyView({
        label: t("transfer.allowSearch")
      }), e.oneWay.propertyView({
        label: t("transfer.oneWay")
      }), e.pagination.propertyView({
        label: t("transfer.pagination")
      }), e.pagination.getView() && e.pageSize.propertyView({
        label: t("transfer.pageSize")
      })]
    }), /* @__PURE__ */ h(y, {
      name: d.layout,
      children: [e.onEvent.propertyView(), R(e)]
    }), /* @__PURE__ */ s(y, {
      name: d.style,
      children: e.style.getPropertyView()
    })]
  })).build();
}();
w = class extends w {
  autoHeight() {
    return !1;
  }
};
const ne = N(w, [new n("items", t("transfer.items")), new n("targetKeys", t("transfer.targetKeys")), new n("targerObject", t("transfer.targerObject")), new n("selectedKeys", t("transfer.selectedKeys")), new n("searchInfo", t("transfer.searchInfo")), U]);
export {
  ne as TransferComp
};
