"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLogic = void 0;
const personalDataSecurity_1 = require("../../personalDataSecurity");
const useLogic = ({ onChange, isHidePersonalData, }) => {
    const handleChange = (_, newValue) => {
        if (typeof newValue === 'string') {
            return onChange({ addressString: newValue });
        }
        if (newValue) {
            return onChange(newValue);
        }
    };
    const getOptionLabel = (option) => {
        return typeof option === 'string' ? option : option.addressString;
    };
    const hidePersonalInputDataClassname = (0, personalDataSecurity_1.useHidePersonalData)({
        isEnabled: isHidePersonalData,
        type: 'input',
    });
    const hidePersonalDataClassname = (0, personalDataSecurity_1.useHidePersonalData)({
        isEnabled: isHidePersonalData,
    });
    return {
        handleChange,
        getOptionLabel,
        hidePersonalInputDataClassname,
        hidePersonalDataClassname,
    };
};
exports.useLogic = useLogic;
