/*
 * Copyright (C) 2016-2020 Kano Computing Ltd.
 * License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 */
import { ContributionManager } from '../contribution.js';
export * from './copy.js';
const registeredCreators = new ContributionManager();
const registeredHelpers = new ContributionManager();
export function registerCreator(id, creator) {
    registeredCreators.register(id, creator);
}
export function create(editor, opts) {
    const CreatorConstructor = registeredCreators.get(editor.sourceType);
    if (!CreatorConstructor) {
        throw new Error(`Could not create creator: Creator for source type '${editor.sourceType}' was not imported.`);
    }
    return new CreatorConstructor(editor, opts);
}
export function registerCreatorHelper(id, helper) {
    const helpers = registeredHelpers.get(id) || [];
    helpers.push(helper);
    registeredHelpers.register(id, helpers);
}
export function getHelpers(id) {
    return registeredHelpers.get(id);
}
//# sourceMappingURL=index.js.map