1(function (global, factory) { 2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 typeof define === 'function' && define.amd ? define(factory) : 4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.config = factory()); 5})(this, (function () { 'use strict'; 6 7 /* eslint-disable no-var */ 8 /* eslint-disable no-unused-vars */ 9 /* eslint-disable no-extra-boolean-cast */ 10 /* -------------------------------------------------------------------------- */ 11 /* Config */ 12 /* -------------------------------------------------------------------------- */ 13 14 const configQueryMap = { 15 'navbar-vertical-collapsed': 'phoenixIsNavbarVerticalCollapsed', 16 'color-scheme': 'phoenixTheme', 17 'navigation-type': 'phoenixNavbarPosition', 18 'vertical-navbar-appearance': 'phoenixNavbarVerticalStyle', 19 'horizontal-navbar-shape': 'phoenixNavbarTopShape', 20 'horizontal-navbar-appearance': 'phoenixNavbarTopStyle' 21 }; 22 23 const initialConfig = { 24 phoenixIsNavbarVerticalCollapsed: false, 25 phoenixTheme: 'light', 26 phoenixNavbarTopStyle: 'default', 27 phoenixNavbarVerticalStyle: 'default', 28 phoenixNavbarPosition: 'vertical', 29 phoenixNavbarTopShape: 'default', 30 phoenixIsRTL: false, 31 phoenixSupportChat: false 32 }; 33 34 const CONFIG = { ...initialConfig }; 35 36 const setConfig = (payload, persist = true) => { 37 Object.keys(payload).forEach(key => { 38 CONFIG[key] = payload[key]; 39 if (persist) { 40 localStorage.setItem(key, payload[key]); 41 } 42 }); 43 }; 44 45 const resetConfig = () => { 46 Object.keys(initialConfig).forEach(key => { 47 CONFIG[key] = initialConfig[key]; 48 localStorage.setItem(key, initialConfig[key]); 49 }); 50 }; 51 52 const urlSearchParams = new URLSearchParams(window.location.search); 53 const params = Object.fromEntries(urlSearchParams.entries()); 54 55 if ( 56 Object.keys(params).length > 0 && 57 Object.keys(params).includes('theme-control') 58 ) { 59 resetConfig(); 60 61 Object.keys(params).forEach(param => { 62 if (configQueryMap[param]) { 63 localStorage.setItem(configQueryMap[param], params[param]); 64 } 65 }); 66 } 67 68 Object.keys(CONFIG).forEach(key => { 69 if (localStorage.getItem(key) === null) { 70 localStorage.setItem(key, CONFIG[key]); 71 } else { 72 try { 73 setConfig({ 74 [key]: JSON.parse(localStorage.getItem(key)) 75 }); 76 } catch { 77 setConfig({ 78 [key]: localStorage.getItem(key) 79 }); 80 } 81 } 82 }); 83 84 if (!!JSON.parse(localStorage.getItem('phoenixIsNavbarVerticalCollapsed'))) { 85 document.documentElement.classList.add('navbar-vertical-collapsed'); 86 } 87 88 if (localStorage.getItem('phoenixTheme') === 'dark') { 89 document.documentElement.setAttribute('data-bs-theme', 'dark'); 90 } else if (localStorage.getItem('phoenixTheme') === 'auto') { 91 document.documentElement.setAttribute( 92 'data-bs-theme', 93 window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 94 ); 95 } 96 97 if (localStorage.getItem('phoenixNavbarPosition') === 'horizontal') { 98 document.documentElement.setAttribute('data-navigation-type', 'horizontal'); 99 } 100 101 if (localStorage.getItem('phoenixNavbarPosition') === 'combo') { 102 document.documentElement.setAttribute('data-navigation-type', 'combo'); 103 } 104 105 var config = { 106 config: CONFIG, 107 reset: resetConfig, 108 set: setConfig 109 }; 110 111 return config; 112 113})); 114//# sourceMappingURL=config.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.