const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_useEngineContext = require("../../../../../hooks/useEngineContext.js");
const require_index = require("../../../../../utils/index.js");
const require_serve = require("./serve.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let ahooks = require("ahooks");
//#region src/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.tsx
const defaultValue = {
	code: "+61",
	phone: ""
};
const PhoneField = ({ value, onChange }) => {
	const context = require_useEngineContext.default();
	require_index.request.setRequest(context.appHelper.utils.request);
	const codes = (0, ahooks.useRequest)(require_serve.getCountries, { manual: true });
	(0, react.useEffect)(() => {
		codes.run();
	}, []);
	const _onChange = (key, val) => {
		onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultValue), value), {}, { [key]: val }));
	};
	return /* @__PURE__ */ react.default.createElement(antd.Space.Compact, { style: { width: "100%" } }, /* @__PURE__ */ react.default.createElement(antd.Select, {
		options: codes.data || [],
		onChange: (val) => {
			_onChange("code", val);
		},
		size: "large",
		style: { flex: "0 0 100px" },
		loading: codes.loading,
		optionLabelProp: "value",
		value: value === null || value === void 0 ? void 0 : value.code,
		dropdownMatchSelectWidth: false
	}), /* @__PURE__ */ react.default.createElement(antd.Input, {
		type: "number",
		value: value === null || value === void 0 ? void 0 : value.phone,
		size: "large",
		style: { flex: 1 },
		onChange: (e) => {
			_onChange("phone", e.target.value);
		}
	}));
};
//#endregion
exports.default = PhoneField;
