import { jsx as e, jsxs as u } from "react/jsx-runtime";
import { a as h } from "./index.CfQlFjZU.js";
import { c as F } from "./index.CfM2L_w0.js";
import { D as w } from "./DataTable.CDOMpN3l.js";
import { B as g } from "./Button.CpTwUWVr.js";
import { d as b, a as R, g as d } from "./GridRow._ehOXG8R.js";
import { G as _ } from "./GridLayouts.DSIvKCIo.js";
import { n as x } from "./index.B0wX8xO7.js";
import { c as D } from "./Dropdown.CMeTYQwB.js";
import { l as c } from "./lodash.xuulwbEa.js";
import { P as H } from "./PageSection.DaF45FbK.js";
import { a as T } from "./ComboInput.C7taEbNO.js";
import { S as W } from "./shared.EdGf6tcG.js";
import "react";
import { P as I } from "./Page.DxkgZw21.js";
import { P as E } from "./PageHeader.BwFpx_pz.js";
const G = "creator_numbersList_CzgKo", k = "creator_country_JCnU4", B = "creator_number_FERdD", s = { numbersList: G, country: k, number: B }, K = (r) => {
  const t = [
    {
      element: /* @__PURE__ */ e("span", { className: s.number, children: "Number" }),
      props: { class: s.number }
    },
    "Country",
    ""
  ];
  return { ...r, tableHeader: t, emptyTableContent: {
    title: "No data to show",
    description: "Search a different number or change any filters applied."
  }, tableRows: (o) => [
    {
      element: /* @__PURE__ */ e("span", { className: s.number, children: o.phoneNumber }),
      props: {}
    },
    {
      element: /* @__PURE__ */ e("span", { className: s.country, children: o.countryCode }),
      props: {}
    },
    {
      element: /* @__PURE__ */ e(
        g,
        {
          onClick: () => r.onNumberSelect(o),
          style: { marginLeft: "auto" },
          label: "Select",
          size: "small"
        }
      ),
      props: {}
    }
  ] };
}, O = ({
  tableHeader: r,
  emptyTableContent: t,
  tableRows: a,
  data: l,
  isTableLoading: o
}) => /* @__PURE__ */ e(b, { className: F(s.numbersList, _.colCentre), children: /* @__PURE__ */ e(
  w,
  {
    isLoading: o,
    head: r,
    emptyTableContent: t,
    row: a,
    data: l
  }
) }), U = h(O, K), V = "creator_pageFilter_C9vLS", j = "creator_title_D7-W-", z = "creator_filterWrapper_p-ABM", A = "creator_filterFields_lHma1", M = "creator_countryFilter_yXiEK", $ = "creator_numberFilter_P0oDx", n = { pageFilter: V, title: j, filterWrapper: z, filterFields: A, countryFilter: M, numberFilter: $ }, J = (r) => {
  const t = {
    placeholder: "Select",
    noLabel: !0,
    noHelper: !0,
    onClick: c.noop,
    onSelect: r.onFilterChange,
    onChange: c.noop,
    value: [r.selectedFilter],
    items: r.filterOptions,
    removeItemOnReselect: !1
  };
  return { ...r, searchTypeDropdown: t };
}, X = ({
  filterHasError: r,
  filterHelperText: t,
  searchTypeDropdown: a,
  countriesOptions: l,
  selectedCountry: o,
  onCountrySelect: i,
  onNumberInput: m,
  onSearchClick: p
}) => /* @__PURE__ */ e(b, { className: F(n.pageFilter, _.colCentre), children: /* @__PURE__ */ e(H, { children: /* @__PURE__ */ u("div", { className: n.filterWrapper, children: [
  /* @__PURE__ */ e("span", { className: n.title, children: "Phone number" }),
  /* @__PURE__ */ u("div", { className: n.filterFields, children: [
    /* @__PURE__ */ e("div", { className: n.countryFilter, children: /* @__PURE__ */ e(
      D,
      {
        onClick: c.noop,
        onSelect: i,
        onChange: c.noop,
        label: "Country",
        multiple: !1,
        placeholder: "Select country",
        items: l,
        value: o,
        removeItemOnReselect: !1
      }
    ) }),
    /* @__PURE__ */ e("div", { className: n.numberFilter, children: /* @__PURE__ */ e(
      T,
      {
        label: "Phone number",
        helper: t,
        hasError: r,
        dropdownProps: a,
        textInputProps: {
          onKeyUp: m,
          isError: !1,
          placeholder: "Phrase or numbers"
        }
      }
    ) })
  ] }),
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
    g,
    {
      semantic: W.PRIMARY,
      label: "Search",
      onClick: p
    }
  ) })
] }) }) }), Y = h(X, J), q = "creator_tollFreeWrapper_0dt8h", Q = "creator_pageHeader_Ix-i8", f = { tollFreeWrapper: q, pageHeader: Q }, Z = (r) => ({
  ...r
}), ee = ({
  previousPageURL: r,
  filterHasError: t,
  filterHelperText: a,
  availableNumbers: l,
  isTableLoading: o,
  countriesOptions: i,
  filterOptions: m,
  selectedCountry: p,
  selectedFilter: y,
  isTableVisible: N,
  onFilterChange: C,
  onNumberInput: P,
  onSearchClick: S,
  onCountrySelect: v,
  onNumberSelect: L
}) => /* @__PURE__ */ e(I, { isLoading: !1, className: f.tollFreeWrapper, children: /* @__PURE__ */ u(R, { children: [
  /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(b, { className: f.pageHeader, children: /* @__PURE__ */ e(
    E,
    {
      title: "Set up a toll-free number",
      previousPageUrl: r
    }
  ) }) }),
  /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(
    Y,
    {
      filterHasError: t,
      filterHelperText: a,
      onCountrySelect: v,
      onFilterChange: C,
      onNumberInput: P,
      onSearchClick: S,
      countriesOptions: i,
      filterOptions: m,
      selectedCountry: p,
      selectedFilter: y
    }
  ) }),
  /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(
    x,
    {
      value: N,
      then: /* @__PURE__ */ e(
        U,
        {
          isTableLoading: o,
          data: l,
          onNumberSelect: L
        }
      )
    }
  ) })
] }) }), Fe = h(
  ee,
  Z
);
export {
  Fe as T,
  ee as t,
  Z as u
};
