/*!
 * Copyright (c) Microsoft. All rights reserved.
 * Licensed under the MIT license. See LICENSE file in the project.
 */ import { jsx as _jsx } from "react/jsx-runtime";
import cloneDeep from 'lodash-es/cloneDeep.js';
import { memo, useCallback, useMemo } from 'react';
import { FormInputType, VerbForm } from '../verbForm/VerbForm.js';
/**
 * Provides inputs for a OneHot step.
 */ export const OneHotBase = /*#__PURE__*/ memo(function OneHotBase({ step , onChange  }) {
    const prefixInput = useMemo(()=>{
        return {
            advanced: true,
            label: `Prefix for column ${step.args.column ?? ''}`,
            type: FormInputType.Text,
            current: step.args.prefix,
            onChange: (s, val)=>s.args.prefix = val
        };
    }, [
        step
    ]);
    const inputs = useMemo(()=>{
        return [
            {
                label: 'Keep source columns',
                type: FormInputType.Checkbox,
                current: step.args.preserveSource,
                onChange: (s, val)=>s.args.preserveSource = val,
                advanced: true
            },
            prefixInput
        ];
    }, [
        step,
        prefixInput
    ]);
    const onStepChange = useCallback((s)=>{
        const step = cloneDeep(s);
        onChange?.(step);
    }, [
        onChange
    ]);
    return /*#__PURE__*/ _jsx(VerbForm, {
        inputs: inputs,
        step: step,
        onChange: onStepChange
    });
});
