/**1* Incognito2*3* This program is free software: you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation, either version 3 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program. If not, see <https://www.gnu.org/licenses/>.15*/1617/*18_____ _ _ _19| __ \ | | | | | |20| |__) | ___ _ __ | |_ ___ __| | | |__ _ _21| ___/ / _ \ | '__| | __| / _ \ / _` | | '_ \ | | | |22| | | (_) | | | | |_ | __/ | (_| | | |_) | | |_| |23|_| \___/ |_| \__| \___| \__,_| |_.__/ \__, |24__/ |25|___/26_ _ _ _ _ _ _27/\ | | | | | | | \ | | | | | |28/ \ _ __ ___ ___ | |_ | |__ _ _ ___ | |_ | \| | ___ | |_ __ __ ___ _ __ | | __29/ /\ \ | '_ ` _ \ / _ \ | __| | '_ \ | | | | / __| | __| | . ` | / _ \ | __| \ \ /\ / / / _ \ | '__| | |/ /30/ ____ \ | | | | | | | __/ | |_ | | | | | |_| | \__ \ | |_ | |\ | | __/ | |_ \ V V / | (_) | | | | <31/_/ \_\ |_| |_| |_| \___| \__| |_| |_| \__, | |___/ \__| |_| \_| \___| \__| \_/\_/ \___/ |_| |_|\_\32__/ |33|___/34*/35import EventEmitter from "./events.js";3637class Tabs extends EventEmitter {38constructor(app) {39super();40this.app = app;41this.createElement = app.createElement;42this.tabs = {};43this.element = app.createElement('div', [], {44class: 'tab-wrapper'45});46};47switchTab(id) {48if (!(id in this.tabs)) return false;49this.hideAll();50this.emit('switch', id);51this.tabs[id].style.display = 'block';52return this.tabs[id];53};54createTab(id, element) {55this.tabs[id] = element;56element.style.display = 'none';57this.element.append(element);58return element;59};60hideAll() {61for (const key in this.tabs) {62this.tabs[key].style.display = 'none';63};64return true;65};66};6768export { Tabs };6970