1const debounce = (func, wait = 500) => { 2 let timeout 3 return function (...args) { 4 clearTimeout(timeout) 5 timeout = setTimeout(() => { 6 func.apply(this, args) 7 }, wait) 8 } 9} 10 11const getInitialTheme = () => { 12 if (typeof window !== "undefined" && window.localStorage) { 13 const storedPrefs = window.localStorage.getItem("color-theme") 14 if (typeof storedPrefs === "string") { 15 return storedPrefs 16 } 17 18 const userMedia = window.matchMedia("(prefers-color-scheme: dark)") 19 if (userMedia.matches) { 20 return "dark" 21 } 22 } 23 24 // If you want to use dark theme as the default, return 'dark' instead 25 return "light" 26} 27 28const popperSameWidth = { 29 name: "sameWidth", 30 enabled: true, 31 phase: "beforeWrite", 32 requires: ["computeStyles"], 33 fn: ({ state }) => { 34 state.styles.popper.width = `${state.rects.reference.width}px` 35 }, 36 effect: ({ state }) => { 37 state.elements.popper.style.width = `${state.elements.reference.offsetWidth}px` 38 }, 39} 40 41export { debounce, getInitialTheme, popperSameWidth };
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.