const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let libphonenumber_js = require("libphonenumber-js");
require("./ReadPretty.less");
//#region src/components/dataSourceComponents/fields/Input.Phone/ReadPretty.tsx
const ReadPretty = ({ value, renderMode }) => {
	if (!value) return null;
	const className = (0, classnames.default)("pisell-phone-read-pretty", { "pisell-phone-read-pretty-table-view": renderMode === "tableView" });
	try {
		const phoneNumber = (0, libphonenumber_js.parsePhoneNumberFromString)(value);
		if (!phoneNumber) return /* @__PURE__ */ react.default.createElement("span", { className }, value);
		const formattedValue = `(${phoneNumber.formatInternational().split(" ")[0]}) ${phoneNumber.formatNational()}`;
		return /* @__PURE__ */ react.default.createElement("span", { className }, formattedValue);
	} catch (error) {
		return /* @__PURE__ */ react.default.createElement("span", { className }, value);
	}
};
//#endregion
exports.default = ReadPretty;
