/* *
 *
 *  (c) 2009-2026 Highsoft AS
 *
 *  Integration of this software requires a license.
 *  - For commercial use, see www.highcharts.com/license
 *  - For non-commercial, see www.highcharts.com/license-eula
 *
 *
 *  Authors:
 *  - Sebastian Bochan
 *  - Wojciech Chmiel
 *  - Gøran Slettemark
 *  - Sophie Bremer
 *
 * */
class EditableOptions {
    constructor(component, bindings = EditableOptions.defaultBindings) {
        this.component = component;
        this.bindings = bindings;
    }
    getOptions() {
        const options = this.component.options.editableOptions;
        if (!options) {
            return [];
        }
        for (let i = 0, iEnd = options.length; i < iEnd; i++) {
            const option = options[i];
            if (option.propertyPath?.some((path) => path === 'connector')) {
                const board = this.component.board;
                const selectOptions = !board ?
                    [] :
                    board.dataPool
                        .getConnectorIds()
                        .map((name) => ({ name }));
                option.selectOptions = selectOptions;
            }
        }
        return options;
    }
}
EditableOptions.defaultBindings = {
    keyMap: {
        color: 'colorPicker',
        title: 'text',
        caption: 'text',
        style: 'textarea'
    },
    typeMap: {
        'string': 'text',
        'number': 'input',
        'boolean': 'toggle'
    },
    skipRedraw: []
};
// Bindings of basic types to "editor components"
EditableOptions.defaultTypeMap = {
    'string': 'text',
    'number': 'input',
    'boolean': 'toggle'
};
export default EditableOptions;
