require("../../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_index = require("../../../../../utils/index.js");
let _pisell_utils = require("@pisell/utils");
//#region src/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/serve.ts
const formatData = (data) => {
	return data.map((item, i) => {
		return {
			label: `${item.name} (+${item.calling_code})`,
			value: "+" + item.calling_code,
			key: i
		};
	});
};
const defaultCodes = formatData([
	{
		"name": "Mexico",
		"code": "MX",
		"calling_code": "52",
		"currency_code": "MXN"
	},
	{
		"name": "美国",
		"code": "US",
		"calling_code": "1",
		"currency_code": "USD"
	},
	{
		"name": "加拿大",
		"code": "CA",
		"calling_code": "1",
		"currency_code": "CAD"
	},
	{
		"name": "澳大利亚",
		"code": "AU",
		"calling_code": "61",
		"currency_code": "AUD"
	},
	{
		"name": "新西兰",
		"code": "NZ",
		"calling_code": "64",
		"currency_code": "NZD"
	},
	{
		"name": "新加坡",
		"code": "SG",
		"calling_code": "65",
		"currency_code": "SGD"
	},
	{
		"name": "香港特别行政区",
		"code": "HK",
		"calling_code": "852",
		"currency_code": "HKD"
	},
	{
		"name": "中国",
		"code": "CN",
		"calling_code": "86",
		"currency_code": "AUD"
	},
	{
		"name": "日本",
		"code": "JP",
		"calling_code": "81",
		"currency_code": "JPY"
	},
	{
		"name": "马来西亚",
		"code": "MY",
		"calling_code": "60",
		"currency_code": "USD"
	},
	{
		"name": "英国",
		"code": "GB",
		"calling_code": "44",
		"currency_code": "GBP"
	},
	{
		"name": "法国",
		"code": "FR",
		"calling_code": "33",
		"currency_code": "EUR"
	},
	{
		"name": "意大利",
		"code": "IT",
		"calling_code": "39",
		"currency_code": "EUR"
	},
	{
		"name": "Ireland",
		"code": "IE",
		"calling_code": "353",
		"currency_code": "EUR"
	},
	{
		"name": "Netherlands",
		"code": "NL",
		"calling_code": "31",
		"currency_code": "EUR"
	},
	{
		"name": "Germany",
		"code": "DE",
		"calling_code": "49",
		"currency_code": "EUR"
	},
	{
		"name": "Spain",
		"code": "ES",
		"calling_code": "34",
		"currency_code": "EUR"
	},
	{
		"name": "India",
		"code": "IND",
		"calling_code": "91",
		"currency_code": "INR"
	},
	{
		"name": "Nigeria",
		"code": "NG",
		"calling_code": "234",
		"currency_code": "NGN"
	},
	{
		"name": "Islamic Republic of Pakistan‎",
		"code": "PAK",
		"calling_code": "92",
		"currency_code": "PRK"
	},
	{
		"name": "Philippines",
		"code": "PH",
		"calling_code": "63",
		"currency_code": "PHP"
	},
	{
		"name": "Thailand",
		"code": "TH",
		"calling_code": "66",
		"currency_code": "THB"
	},
	{
		"name": "South Africa",
		"code": "ZA",
		"calling_code": "27",
		"currency_code": "ZAR"
	}
]);
const getCountries = function() {
	var _ref = require_asyncToGenerator._asyncToGenerator(function* (params) {
		require_index.request.getRequest().get("/shop/area/country", { "translate-locale": _pisell_utils.locales.formatLocale(localStorage.getItem("umi_locale") || "en") }, {
			abort: true,
			useCache: true
		}).then((res) => {
			localStorage.setItem("pisell2_data_countries", JSON.stringify(formatData(res.data || [])));
		});
		let data = localStorage.getItem("pisell2_data_countries");
		if (data) {
			data = JSON.parse(data);
			return data;
		} else return defaultCodes;
	});
	return function getCountries(_x) {
		return _ref.apply(this, arguments);
	};
}();
//#endregion
exports.getCountries = getCountries;
