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