export var scriptId = 'tiny-mce-core-source';
export var tinyMCESource = 'https://s3.amazonaws.com/procore-core/tinymce';
export var tinyMCEVersion = '5.8.1';
// TinyMCE Supported Languages: https://www.tiny.cloud/docs/configure/localization/#supportedlanguages
var textEditorLocales = {
    en: 'en',
    'en-CA': 'en_CA',
    'fr-CA': 'fr_FR',
    'fr-FR': 'fr_FR',
    es: 'es',
    'es-ES': 'es',
    'en-AE': 'en_GB',
    'en-AU': 'en',
    'en-GB': 'en_GB',
    'en-SG': 'en_GB',
    ko: 'ko_KR',
    'th-TH': 'th_TH',
    pt: 'pt_BR',
    'is-IS': 'en',
    'de-DE': 'de',
    pseudo: 'pseudo',
};
export var defaultPlugins = [
    'autolink',
    'autoresize',
    'lists',
    'nonbreaking',
    'paste',
];
export var plugins = [
    'advlist',
    'anchor',
    'autolink',
    'autoresize',
    'autosave',
    'bbcode',
    'charmap',
    'code',
    'codesample',
    'colorpicker',
    'contextmenu',
    'directionality',
    'emoticons',
    'fullpage',
    'fullscreen',
    'help',
    'hr',
    'image',
    'imagetools',
    'importcss',
    'insertdatetime',
    'legacyoutput',
    'link',
    'lists',
    'media',
    'nonbreaking',
    'noneditable',
    'pagebreak',
    'paste',
    'preview',
    'print',
    'save',
    'searchreplace',
    'spellchecker',
    'tabfocus',
    'table',
    'template',
    'textpattern',
    'toc',
    'visualblocks',
    'visualchars',
    'wordcount',
];
export var tinyMCEConfig = {
    autoresize_overflow_padding: 12,
    autoresize_bottom_margin: 0,
    browser_spellcheck: true,
    convert_url: false,
    content_css: "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/skins/content/default/content.min.css"),
    extended_valid_elements: 'table[class=mce-table|border:1px double #000|cellpadding: 3px|style=border-collapse: collapse; border-color: #000]',
    min_height: 96,
    invalid_elements: 'form,script',
    menubar: false,
    nonbreaking_force_tab: true,
    paste_preprocess: function (_, args) {
        args.content = args.content.replace(/<pre>/gi, '<p>');
        args.content = args.content.replace(/<\/pre>/gi, '</p>');
    },
    paste_remove_styles_if_webkit: true,
    paste_retain_style_properties: 'font-size,text-decoration',
    paste_word_valid_elements: '@[style],pre,-strong/b,-em/i,-span,-p,-ol,-ul,-li,-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[href|name],sub,sup,strike,br,u',
    relative_urls: false,
    remove_script_host: false,
    statusbar: false,
    skin_url: "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/skins/ui/oxide"),
    toolbar: 'bold italic underline | alignleft aligncenter alignright | bullist numlist | outdent indent | cut paste pastetext | fontsizeselect | forecolor backcolor | undo redo',
    toolbar_mode: 'floating',
};
export function getValidLookupLocale(locale) {
    return textEditorLocales[locale] || textEditorLocales.en;
}
function usesBuiltInText(locale) {
    return locale === textEditorLocales.en;
}
export function generateLanguageUrl(locale) {
    var lookupLocale = getValidLookupLocale(locale);
    return usesBuiltInText(lookupLocale)
        ? ''
        : "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/langs/").concat(lookupLocale, ".js");
}
function generatePluginUrl(plugin) {
    return "".concat(tinyMCESource, "/").concat(tinyMCEVersion, "/plugins/").concat(plugin, "/plugin.min.js");
}
export function generateExternalPlugins(plugins) {
    return Array.from(new Set(plugins.concat(defaultPlugins))).reduce(function (acc, plugin) {
        var _a;
        return plugins.includes(plugin)
            ? Object.assign(acc, (_a = {}, _a[plugin] = generatePluginUrl(plugin), _a))
            : acc;
    }, {});
}
//# sourceMappingURL=TinyMCE.js.map