import { Y as l, fp as w, at as c, a3 as a, a as s } from "./603b75d9.js";
import { O as u } from "./158dca8d.js";
import "react";
import "react-dom";
import "./18a95abc.js";
import "./c2be1293.js";
import "./4963ac97.js";
import "./ffcffc16.js";
import "./62f393ec.js";
import "./26dac75c.js";
import "./11b05d65.js";
import "./56edae87.js";
import "./0cc240d3.js";
import "./00d44232.js";
import "./f9847c56.js";
import "./a4d0e31e.js";
import "./41aba172.js";
import "./e735e391.js";
import "./140b48ce.js";
import "./f5fb28b1.js";
import "./930af84f.js";
import "./9c5ea6de.js";
import "./7f1b43fa.js";
import "./cee178c0.js";
import "./43b58a96.js";
import "./19a46fb5.js";
import "./98f17e53.js";
import "./794d827a.js";
import "./0cdeb449.js";
import "./d50792b8.js";
import "./f64a8554.js";
import "./cf72e8e5.js";
import "./84cede66.js";
import "./3dfed0b7.js";
import "./57f24d28.js";
import "./be662667.js";
import "./8064caf1.js";
import "./d8fd0c14.js";
const y = [{
  label: l("selectionControl.single"),
  value: "single"
}, {
  label: l("selectionControl.multiple"),
  value: "multiple"
}, {
  label: l("selectionControl.close"),
  value: "close"
}];
function i(r) {
  return r[u];
}
function oe(r) {
  switch (r.children.mode.getView()) {
    case "single":
      return [r.children.selectedRowKey.getView()];
    case "multiple":
      return r.children.selectedRowKeys.getView();
  }
  return [];
}
const te = function() {
  const r = {
    mode: a(y, "single"),
    selectedRowKey: s("0"),
    selectedRowKeys: s([])
  };
  return new w(r, (e, m) => {
    const n = (t) => {
      i(t) !== e.selectedRowKey && m(c("selectedRowKey", i(t), !1));
    };
    return (t) => {
      if (e.mode === "single" || e.mode === "close")
        return {
          rowKey: i,
          rowClassName: (o, d, C) => e.mode === "close" ? "" : i(o) === e.selectedRowKey ? "ant-table-row-selected" : "",
          onRow: (o, d) => ({
            onClick: () => {
              n(o), t("rowClick"), i(o) !== e.selectedRowKey && t("rowSelectChange");
            }
          })
        };
      const p = {
        type: "checkbox",
        selectedRowKeys: e.selectedRowKeys,
        preserveSelectedRowKeys: !0,
        onChange: (o) => {
          m(c("selectedRowKeys", o, !1)), t("rowSelectChange");
        },
        // click checkbox also trigger row click event
        onSelect: (o) => {
          n(o), t("rowClick");
        }
      };
      return {
        rowKey: i,
        rowSelection: p,
        onRow: (o) => ({
          onClick: () => {
            n(o), t("rowClick");
          }
        })
      };
    };
  }).setPropertyViewFn((e) => e.mode.propertyView({
    label: l("selectionControl.mode"),
    radioButton: !0
  })).build();
}();
export {
  te as SelectionControl,
  oe as getSelectedRowKeys
};
