import { dataStorage } from './app.js';
import { showModal } from './overlays.js';
import { hideDiv, ElementById } from './helpers.js';
import { saveDataStorage, clearDataStorage, ConsoleLog, t, loadDS100 } from './app_functions.js';
import { html, render } from './lit-html.js';
import { searchView } from './searchView.js';
export const showSettings = () => {
showModal(t('settings'), settingsTemplate())
};
const settingsTemplate = () => html`
`;
const rebuildCache = () => {
ConsoleLog('sw update');
registration.update();
location.reload();
};
const saveSettings = async () => {
const provider = document.querySelector('input[name="provider"]:checked').value;
const accessibility = document.querySelector('input[name="accessibility"]:checked').value;
const language = document.querySelector('input[name="language"]:checked').value;
const show_ril100 = ElementById('ril100').checked;
const write_debug = ElementById('debug-messages').checked;
const enable_canvas = ElementById('enable-canvas').checked;
const fancy_canvas = ElementById('fancy-canvas').checked;
const travelynx = ElementById('travelynx').checked;
if (provider !== dataStorage.settings.provider) {
dataStorage.journeysHistory = [];
}
dataStorage.settings.provider = provider;
dataStorage.settings.accessibility = accessibility;
dataStorage.settings.showRIL100Names = show_ril100;
dataStorage.settings.writeDebugLog = write_debug;
dataStorage.settings.enableCanvas = enable_canvas;
dataStorage.settings.fancyCanvas = fancy_canvas;
dataStorage.settings.language = language;
dataStorage.settings.travelynx = travelynx;
saveDataStorage();
if (show_ril100) await loadDS100();
searchView();
hideDiv('overlay');
};