/**
 * Hidden DOM stubs for Velzon theme app.js features not used in billing admin.
 */
(function () {
    'use strict';

    if (document.getElementById('billing-theme-stubs') || !document.body) {
        return;
    }

    var checkboxIds = {
        'sidebar-size-default': true,
        'sidebar-size-small-hover': true,
    };

    var buttonIds = {
        'delete-notification': true,
        'reset-layout': true,
        'NotificationModalbtn-close': true,
        'customizer-layout03': true,
        'customizerclose-btn': true,
        'sidebarimg-none': true,
        'layout-width-fluid': true,
        'sidebar-view-default': true,
        'sidebar-visibility-show': true,
        'collapseBgGradient': true,
        'sidebar-color-gradient': true,
    };

    var stubIds = [
        'removeNotificationModal',
        'notificationDropdown',
        'notification-actions',
        'delete-notification',
        'NotificationModalbtn-close',
        'select-content',
        'reset-layout',
        'theme-settings-offcanvas',
        'customizer-layout03',
        'customizerclose-btn',
        'sidebar-size',
        'sidebar-view',
        'sidebar-color',
        'sidebar-img',
        'layout-position',
        'layout-width',
        'sidebar-visibility',
        'sidebar-visibility-show',
        'sidebar-size-small-hover',
        'sidebar-size-default',
        'sidebarimg-none',
        'layout-width-fluid',
        'sidebar-view-default',
        'collapseBgGradient',
        'sidebar-color-gradient',
        'cart-item-total',
        'empty-cart',
        'checkout-elem',
        'search-close-options',
        'search-dropdown',
        'search-options',
        'search-dropdown-reponsive',
        'search-options-reponsive',
    ];

    var wrap = document.createElement('div');
    wrap.id = 'billing-theme-stubs';
    wrap.className = 'd-none';
    wrap.setAttribute('aria-hidden', 'true');

    function createStub(id) {
        var el;
        if (id === 'removeNotificationModal') {
            el = document.createElement('div');
            el.className = 'modal fade';
            el.setAttribute('tabindex', '-1');
            el.setAttribute('aria-hidden', 'true');
        } else if (checkboxIds[id]) {
            el = document.createElement('input');
            el.type = 'checkbox';
        } else if (buttonIds[id]) {
            el = document.createElement('button');
            el.type = 'button';
        } else {
            el = document.createElement('div');
        }
        el.id = id;
        return el;
    }

    stubIds.forEach(function (id) {
        if (!document.getElementById(id)) {
            wrap.appendChild(createStub(id));
        }
    });

    document.body.appendChild(wrap);
})();
