import { b0 as i, aK as C, aJ as l, V as h, s as P, aV as x, aW as B, S as f } from "./index-THhC4TET.js";
import { useState as D, useEffect as M } from "react";
const u = [
  { label: "United States dollar (USD)", value: "usd" },
  { label: "United Arab Emirates dirham (AED)", value: "aed" },
  { label: "Afghan afghani (AFN)", value: "afn" },
  { label: "Albanian lek (ALL)", value: "all" },
  { label: "Armenian dram (AMD)", value: "amd" },
  { label: "Netherlands Antillean guilder (ANG)", value: "ang" },
  { label: "Angolan kwanza (AOA)", value: "aoa" },
  { label: "Argentine peso (ARS)", value: "ars" },
  { label: "Australian dollar (AUD)", value: "aud" },
  { label: "Aruban florin (AWG)", value: "awg" },
  { label: "Azerbaijani manat (AZN)", value: "azn" },
  { label: "Bosnia and Herzegovina convertible mark (BAM)", value: "bam" },
  { label: "Barbadian dollar (BBD)", value: "bbd" },
  { label: "Bangladeshi taka (BDT)", value: "bdt" },
  { label: "Bulgarian lev (BGN)", value: "bgn" },
  { label: "Burundian franc (BIF)", value: "bif" },
  { label: "Bermudian dollar (BMD)", value: "bmd" },
  { label: "Brunei dollar (BND)", value: "bnd" },
  { label: "Bolivian boliviano (BOB)", value: "bob" },
  { label: "Brazilian real (BRL)", value: "brl" },
  { label: "Bahamian dollar (BSD)", value: "bsd" },
  { label: "Botswana pula (BWP)", value: "bwp" },
  { label: "Belarusian ruble (BYN)", value: "byn" },
  { label: "Belize dollar (BZD)", value: "bzd" },
  { label: "Canadian dollar (CAD)", value: "cad" },
  { label: "Congolese franc (CDF)", value: "cdf" },
  { label: "Swiss franc (CHF)", value: "chf" },
  { label: "Chilean peso (CLP)", value: "clp" },
  { label: "Chinese yuan (CNY)", value: "cny" },
  { label: "Colombian peso (COP)", value: "cop" },
  { label: "Costa Rican colón (CRC)", value: "crc" },
  { label: "Cape Verdean escudo (CVE)", value: "cve" },
  { label: "Czech koruna (CZK)", value: "czk" },
  { label: "Djiboutian franc (DJF)", value: "djf" },
  { label: "Danish krone (DKK)", value: "dkk" },
  { label: "Dominican peso (DOP)", value: "dop" },
  { label: "Algerian dinar (DZD)", value: "dzd" },
  { label: "Egyptian pound (EGP)", value: "egp" },
  { label: "Ethiopian birr (ETB)", value: "etb" },
  { label: "Euro (EUR)", value: "eur" },
  { label: "Fijian dollar (FJD)", value: "fjd" },
  { label: "Falkland Islands pound (FKP)", value: "fkp" },
  { label: "British pound sterling (GBP)", value: "gbp" },
  { label: "Georgian lari (GEL)", value: "gel" },
  { label: "Gibraltar pound (GIP)", value: "gip" },
  { label: "Gambian dalasi (GMD)", value: "gmd" },
  { label: "Guinean franc (GNF)", value: "gnf" },
  { label: "Guatemalan quetzal (GTQ)", value: "gtq" },
  { label: "Guyanese dollar (GYD)", value: "gyd" },
  { label: "Hong Kong dollar (HKD)", value: "hkd" },
  { label: "Honduran lempira (HNL)", value: "hnl" },
  { label: "Haitian gourde (HTG)", value: "htg" },
  { label: "Hungarian forint (HUF)", value: "huf" },
  { label: "Indonesian rupiah (IDR)", value: "idr" },
  { label: "Israeli new shekel (ILS)", value: "ils" },
  { label: "Indian rupee (INR)", value: "inr" },
  { label: "Icelandic króna (ISK)", value: "isk" },
  { label: "Jamaican dollar (JMD)", value: "jmd" },
  { label: "Japanese yen (JPY)", value: "jpy" },
  { label: "Kenyan shilling (KES)", value: "kes" },
  { label: "Kyrgyzstani som (KGS)", value: "kgs" },
  { label: "Cambodian riel (KHR)", value: "khr" },
  { label: "Comorian franc (KMF)", value: "kmf" },
  { label: "South Korean won (KRW)", value: "krw" },
  { label: "Cayman Islands dollar (KYD)", value: "kyd" },
  { label: "Kazakhstani tenge (KZT)", value: "kzt" },
  { label: "Laotian kip (LAK)", value: "lak" },
  { label: "Lebanese pound (LBP)", value: "lbp" },
  { label: "Sri Lankan rupee (LKR)", value: "lkr" },
  { label: "Liberian dollar (LRD)", value: "lrd" },
  { label: "Lesotho loti (LSL)", value: "lsl" },
  { label: "Moroccan dirham (MAD)", value: "mad" },
  { label: "Moldovan leu (MDL)", value: "mdl" },
  { label: "Malagasy ariary (MGA)", value: "mga" },
  { label: "Macedonian denar (MKD)", value: "mkd" },
  { label: "Myanmar kyat (MMK)", value: "mmk" },
  { label: "Mongolian tögrög (MNT)", value: "mnt" },
  { label: "Macanese pataca (MOP)", value: "mop" },
  { label: "Mauritian rupee (MUR)", value: "mur" },
  { label: "Maldivian rufiyaa (MVR)", value: "mvr" },
  { label: "Malawian kwacha (MWK)", value: "mwk" },
  { label: "Mexican peso (MXN)", value: "mxn" },
  { label: "Malaysian ringgit (MYR)", value: "myr" },
  { label: "Mozambican metical (MZN)", value: "mzn" },
  { label: "Namibian dollar (NAD)", value: "nad" },
  { label: "Nigerian naira (NGN)", value: "ngn" },
  { label: "Nicaraguan córdoba (NIO)", value: "nio" },
  { label: "Norwegian krone (NOK)", value: "nok" },
  { label: "Nepalese rupee (NPR)", value: "npr" },
  { label: "New Zealand dollar (NZD)", value: "nzd" },
  { label: "Panamanian balboa (PAB)", value: "pab" },
  { label: "Peruvian sol (PEN)", value: "pen" },
  { label: "Papua New Guinean kina (PGK)", value: "pgk" },
  { label: "Philippine peso (PHP)", value: "php" },
  { label: "Pakistani rupee (PKR)", value: "pkr" },
  { label: "Polish złoty (PLN)", value: "pln" },
  { label: "Paraguayan guaraní (PYG)", value: "pyg" },
  { label: "Qatari riyal (QAR)", value: "qar" },
  { label: "Romanian leu (RON)", value: "ron" },
  { label: "Serbian dinar (RSD)", value: "rsd" },
  { label: "Russian ruble (RUB)", value: "rub" },
  { label: "Rwandan franc (RWF)", value: "rwf" },
  { label: "Saudi riyal (SAR)", value: "sar" },
  { label: "Solomon Islands dollar (SBD)", value: "sbd" },
  { label: "Seychellois rupee (SCR)", value: "scr" },
  { label: "Swedish krona (SEK)", value: "sek" },
  { label: "Singapore dollar (SGD)", value: "sgd" },
  { label: "Saint Helena pound (SHP)", value: "shp" },
  { label: "Sierra Leonean leone (SLE)", value: "sle" },
  { label: "Somali shilling (SOS)", value: "sos" },
  { label: "Surinamese dollar (SRD)", value: "srd" },
  { label: "São Tomé and Príncipe dobra (STD)", value: "std" },
  { label: "Swazi lilangeni (SZL)", value: "szl" },
  { label: "Thai baht (THB)", value: "thb" },
  { label: "Tajikistani somoni (TJS)", value: "tjs" },
  { label: "Tongan paʻanga (TOP)", value: "top" },
  { label: "Turkish lira (TRY)", value: "try" },
  { label: "Trinidad and Tobago dollar (TTD)", value: "ttd" },
  { label: "New Taiwan dollar (TWD)", value: "twd" },
  { label: "Tanzanian shilling (TZS)", value: "tzs" },
  { label: "Ukrainian hryvnia (UAH)", value: "uah" },
  { label: "Ugandan shilling (UGX)", value: "ugx" },
  { label: "Uruguayan peso (UYU)", value: "uyu" },
  { label: "Uzbekistan som (UZS)", value: "uzs" },
  { label: "Vietnamese đồng (VND)", value: "vnd" },
  { label: "Vanuatu vatu (VUV)", value: "vuv" },
  { label: "Samoan tala (WST)", value: "wst" },
  { label: "Central African CFA franc (XAF)", value: "xaf" },
  { label: "East Caribbean dollar (XCD)", value: "xcd" },
  { label: "West African CFA franc (XOF)", value: "xof" },
  { label: "CFP franc (XPF)", value: "xpf" },
  { label: "Yemeni rial (YER)", value: "yer" },
  { label: "South African rand (ZAR)", value: "zar" },
  { label: "Zambian kwacha (ZMW)", value: "zmw" }
], A = ({
  getAppData: e,
  setAppData: r,
  disabled: v,
  eventType: d
}) => {
  var y;
  const c = e("price"), b = e("currency") || u[0].value, [s, S] = D(
    u.find((a) => a.value === b) || {
      label: u[0].label,
      value: u[0].value
    }
  ), m = e("paymentOption"), t = i.find((a) => m === a.value), o = e("enabled"), { t: n } = C(), p = ((y = d.recurringEvent) == null ? void 0 : y.count) !== void 0, g = !!d.seatsPerTimeSlot, k = (a, N) => 0 .toLocaleString(a, {
    style: "currency",
    currency: N,
    minimumFractionDigits: 0,
    maximumFractionDigits: 0
  }).replace(/\d/g, "").trim();
  return M(() => {
    o && (e("currency") || r("currency", u[0].value), e("paymentOption") || r("paymentOption", i[0].value));
  }, [o, e, r]), /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
    p && /* @__PURE__ */ l.jsx(h, { className: "mt-2", severity: "warning", title: n("warning_recurring_event_payment") }),
    !p && o && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
      /* @__PURE__ */ l.jsx("div", { className: "mt-4 block items-center justify-start sm:flex sm:space-x-2", children: /* @__PURE__ */ l.jsx(
        P,
        {
          "data-testid": "stripe-price-input",
          label: n("price"),
          className: "h-[38px]",
          addOnLeading: /* @__PURE__ */ l.jsx(l.Fragment, { children: s.value ? k("en", s.value) : "" }),
          addOnSuffix: b.toUpperCase(),
          addOnClassname: "h-[38px]",
          step: "0.01",
          min: "0.5",
          type: "number",
          required: !0,
          placeholder: "Price",
          disabled: v,
          onChange: (a) => {
            r("price", x(Number(a.target.value), b));
          },
          value: c > 0 ? B(c, b) : void 0
        }
      ) }),
      /* @__PURE__ */ l.jsxs("div", { className: "mt-5 w-60", children: [
        /* @__PURE__ */ l.jsx("label", { className: "text-default mb-1 block text-sm font-medium", htmlFor: "currency", children: n("currency") }),
        /* @__PURE__ */ l.jsx(
          f,
          {
            "data-testid": "stripe-currency-select",
            variant: "default",
            options: u,
            innerClassNames: {
              input: "stripe-currency-input"
            },
            value: s,
            className: "text-black",
            defaultValue: s,
            onChange: (a) => {
              a && (S(a), r("currency", a.value));
            }
          }
        )
      ] }),
      /* @__PURE__ */ l.jsxs("div", { className: "mt-4 w-60", children: [
        /* @__PURE__ */ l.jsx("label", { className: "text-default mb-1 block text-sm font-medium", htmlFor: "currency", children: "Payment option" }),
        /* @__PURE__ */ l.jsx(
          f,
          {
            "data-testid": "stripe-payment-option-select",
            defaultValue: t ? { ...t, label: n(t.label) } : { ...i[0], label: n(i[0].label) },
            options: i.map((a) => ({ ...a, label: n(a.label) || a.label })),
            onChange: (a) => {
              a && r("paymentOption", a.value);
            },
            className: "mb-1 h-[38px] w-full",
            isDisabled: g || v
          }
        )
      ] }),
      g && m === "HOLD" && /* @__PURE__ */ l.jsx(h, { className: "mt-2", severity: "warning", title: n("seats_and_no_show_fee_error") })
    ] })
  ] });
};
export {
  A as default
};
