import { jsx as _jsx } from "react/jsx-runtime";
import { PHIDField } from '../../../scalars/components/phid-field/index.js';
import { normalizeStringValue } from './utils.js';
export const buildPhidCellEditor = (phidFieldProps) => {
    const PhidCellEditor = (value, onChange, context) => {
        const phidValue = normalizeStringValue(value);
        if (phidFieldProps.autoComplete !== false && phidFieldProps.fetchOptionsCallback) {
            const { autoComplete: _1, fetchOptionsCallback, allowUris, allowedScopes, ...restProps } = phidFieldProps;
            return (_jsx(PHIDField, { name: context.column.field, className: "max-w-full", autoFocus: true, fetchOptionsCallback: fetchOptionsCallback, ...(allowUris ? { allowUris: true, allowedScopes } : { allowUris: undefined }), ...restProps, value: phidValue, onChange: (value) => {
                    onChange(value);
                } }));
        }
        const { autoComplete: _1, fetchOptionsCallback: _2, fetchSelectedOptionCallback: _3, previewPlaceholder: _4, allowUris, allowedScopes, ...restProps } = phidFieldProps;
        return (_jsx(PHIDField, { name: context.column.field, className: "max-w-full", autoFocus: true, autoComplete: false, ...(allowUris ? { allowUris: true, allowedScopes } : { allowUris: undefined }), ...restProps, value: phidValue, onChange: (value) => {
                onChange(value);
            } }));
    };
    return PhidCellEditor;
};
//# sourceMappingURL=phid-editor.js.map