// DeepBlocker visible filter-list display names.
//
// UI-only: this rebrands the names users see for built-in stock lists.
// It never touches internal asset keys, filter URLs, assets.json, or any
// filtering logic. Shared by every place a list name can surface (Filter
// lists page and the blocked page) so no built-in upstream wording appears.

const listDisplayNameMap = new Map([
    [ 'uBlock filters', 'DeepBlocker' ],
    [ 'uBlock filters – Ads', 'DeepBlocker Core Filters' ],
    [ 'uBlock filters – Badware risks', 'DeepBlocker Badware Protection' ],
    [ 'uBlock filters – Privacy', 'DeepBlocker Privacy' ],
    [ 'uBlock filters – Unbreak', 'DeepBlocker Compatibility' ],
    [ 'uBlock filters – Quick fixes', 'DeepBlocker Quick Fixes' ],
    [ 'uBlock filters – Experimental', 'DeepBlocker Experimental' ],
    [ 'uBlock filters – Cookie Notices', 'DeepBlocker Cookie Filters' ],
    [ 'uBlock filters – Annoyances', 'DeepBlocker Annoyances' ],
    [ 'uBO filters', 'DeepBlocker Filters' ],
    [ 'AdGuard/uBO – URL Tracking Protection', 'DeepBlocker URL Tracking Protection' ],
]);

const displayListName = title => {
    if ( typeof title !== 'string' || title === '' ) { return title; }
    if ( listDisplayNameMap.has(title) ) { return listDisplayNameMap.get(title); }
    // Safety net: rebrand any remaining upstream wording in a list title.
    if ( /uBlock|uBO/i.test(title) ) {
        return title
            .replace(/AdGuard\/uBO/gi, 'DeepBlocker')
            .replace(/uBlock Origin/gi, 'DeepBlocker')
            .replace(/uBlocka Origin/gi, 'DeepBlocker')
            .replace(/uBlock filters/gi, 'DeepBlocker')
            .replace(/uBlock/gi, 'DeepBlocker')
            .replace(/\buBO\b/gi, 'DeepBlocker');
    }
    return title;
};

export { displayListName };
