1const HSThemeAppearance={currentThemeAttributeName:'data-hs-current-theme',visablilityAttributeName:'data-hs-theme-appearance',init(){const defaultTheme=window.hs_config.themeAppearance.layoutSkin 2let theme=localStorage.getItem('hs_theme')||defaultTheme 3if(theme==='auto'){theme=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'default'} 4const $appearances=document.querySelectorAll(`[data-hs-appearance="${theme}"]`) 5this._linkElementsAction(theme,$appearances,()=>{document.querySelector('[data-hs-appearance-onload-styles]')?.remove()}) 6this._setVisablilityStyles(theme)},setAppearance(theme,saveInStore=true){const scrollTop=window.pageYOffset 7if(saveInStore){localStorage.setItem('hs_theme',theme)} 8if(theme==='auto'){theme=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'default'} 9const $appearances=document.querySelectorAll(`[data-hs-appearance="${theme}"]`) 10if(!$appearances.length){return console.error(`Theme '${theme}' not found.`)} 11const $resetStyles=this._resetStylesOnLoad() 12this._linkElementsAction(theme,$appearances,()=>{window.scrollTo({top:scrollTop}) 13this._removeOldStyleElements() 14this._setVisablilityStyles(theme) 15$resetStyles.remove()}) 16window.dispatchEvent(new CustomEvent('on-hs-appearance-change',{detail:theme}))},_resetStylesOnLoad(){const $resetStyles=document.createElement('style') 17$resetStyles.innerText=`*{transition: unset !important;}body{opacity: 0 !important;}` 18$resetStyles.setAttribute('data-hs-appearance-onload-styles','') 19document.head.appendChild($resetStyles) 20return $resetStyles},_setVisablilityStyles(theme){const attrubuteName='data-hs-appearance-visability-styles' 21let $style=document.querySelector(`[${attrubuteName}]`) 22if(!$style){$style=document.createElement('style') 23$style.setAttribute(attrubuteName,'') 24document.head.append($style)} 25$style.textContent=`[${this.visablilityAttributeName}]:not([${this.visablilityAttributeName}='${theme}']){display:none!important;}`},_linkElementsAction(theme,appearances,callback=null){this._setOldAppearanceElements() 26const linkElements=[] 27appearances.forEach($appearanceNode=>{const $link=document.createElement('link') 28$link.setAttribute('rel','stylesheet') 29$link.setAttribute('href',$appearanceNode.getAttribute('href')) 30$link.setAttribute(this.currentThemeAttributeName,'stylesheet') 31document.head.insertAdjacentElement('afterEnd',$link) 32linkElements.push($link)}) 33if(callback){let loaded=0 34linkElements.forEach($styleNode=>{$styleNode.addEventListener('load',function(){loaded++ 35if(loaded===linkElements.length){return callback()}})})}},_setOldAppearanceElements(){const $currentAppearanceElements=document.querySelectorAll(`[${this.currentThemeAttributeName}]`) 36if($currentAppearanceElements.length){$currentAppearanceElements.forEach($appearnce=>$appearnce.setAttribute('data-hs-appearnce-old',true))}},_removeOldStyleElements(){const $oldAppearanceElements=document.querySelectorAll(`[${'data-hs-appearnce-old'}]`) 37if($oldAppearanceElements.length){$oldAppearanceElements.forEach($appearnce=>$appearnce.remove())}},getAppearance(){let theme=this.getOriginalAppearance() 38if(theme==='auto'){theme=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'default'} 39return theme},getOriginalAppearance(){const defaultTheme=window.hs_config.themeAppearance.layoutSkin 40return localStorage.getItem('hs_theme')||defaultTheme}} 41HSThemeAppearance.init() 42window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change',e=>{if(HSThemeAppearance.getOriginalAppearance()==='auto'){HSThemeAppearance.setAppearance('auto',false)}});
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.