import { KeyMod as KeyMod$1, KeyCode } from '../../../../base/common/keyCodes.js';
import { registerEditorContribution, registerEditorCommand, EditorCommand, EditorContributionInstantiation } from '../../../browser/editorExtensions.js';
import { editorConfigurationBaseNode } from '../../../common/config/editorConfigurationSchema.js';
import { registerEditorFeature } from '../../../common/editorFeatures.js';
import { DefaultDropProvidersFeature } from './defaultProviders.js';
import { localizeWithPath } from '../../../../nls.js';
import { Extensions, ConfigurationScope } from '../../../../platform/configuration/common/configurationRegistry.js';
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { changeDropTypeCommandId, dropWidgetVisibleCtx, DropIntoEditorController, defaultProviderConfig } from './dropIntoEditorController.js';
const _moduleId = "vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution";
registerEditorContribution(DropIntoEditorController.ID, DropIntoEditorController, EditorContributionInstantiation.BeforeFirstInteraction);
registerEditorFeature(DefaultDropProvidersFeature);
registerEditorCommand(new (class extends EditorCommand {
    constructor() {
        super({
            id: changeDropTypeCommandId,
            precondition: dropWidgetVisibleCtx,
            kbOpts: {
                weight: KeybindingWeight.EditorContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.Period,
            }
        });
    }
    runEditorCommand(_accessor, editor, _args) {
        DropIntoEditorController.get(editor)?.changeDropType();
    }
}));
registerEditorCommand(new (class extends EditorCommand {
    constructor() {
        super({
            id: 'editor.hideDropWidget',
            precondition: dropWidgetVisibleCtx,
            kbOpts: {
                weight: KeybindingWeight.EditorContrib,
                primary: KeyCode.Escape,
            }
        });
    }
    runEditorCommand(_accessor, editor, _args) {
        DropIntoEditorController.get(editor)?.clearWidgets();
    }
}));
( (Registry.as(Extensions.Configuration))).registerConfiguration({
    ...editorConfigurationBaseNode,
    properties: {
        [defaultProviderConfig]: {
            type: 'object',
            scope: ConfigurationScope.LANGUAGE_OVERRIDABLE,
            description: ( localizeWithPath(
                _moduleId,
                0,
                "Configures the default drop provider to use for content of a given mime type."
            )),
            default: {},
            additionalProperties: {
                type: 'string',
            },
        },
    }
});
