1import { _ as provide, f as onUnmounted, $ as reactive, s as computed, X as defineStore } from "./index.37deb195.js"; 2function windowExists() { 3 return typeof window !== "undefined"; 4} 5function windowHasFeature(feature) { 6 return windowExists() && feature in window; 7} 8function resolveValue({ "min-width": _minWidth, min = _minWidth, max, raw } = {}) { 9 return { min, max, raw }; 10} 11function normalizeScreens(screens, root = true) { 12 if (Array.isArray(screens)) { 13 return screens.map((screen) => { 14 if (root && Array.isArray(screen)) { 15 throw new Error("The tuple syntax is not supported for `screens`."); 16 } 17 if (typeof screen === "string") { 18 return { name: screen.toString(), values: [{ min: screen, max: void 0 }] }; 19 } 20 let [name, options] = screen; 21 name = name.toString(); 22 if (typeof options === "string") { 23 return { name, values: [{ min: options, max: void 0 }] }; 24 } 25 if (Array.isArray(options)) { 26 return { name, values: options.map((option) => resolveValue(option)) }; 27 } 28 return { name, values: [resolveValue(options)] }; 29 }); 30 } 31 return normalizeScreens(Object.entries(screens != null ? screens : {}), false); 32} 33function buildMediaQuery(screenValues) { 34 return screenValues.map((sv) => { 35 if (sv.raw !== void 0) 36 return sv.raw; 37 return [sv.min && `(min-width: ${sv.min})`, sv.max && `(max-width: ${sv.max})`].filter(Boolean).join(" and "); 38 }).join(", "); 39} 40var defaultScreens = { 41 xs: "0px", 42 sm: "640px", 43 md: "768px", 44 lg: "1024px", 45 xl: "1280px" 46}; 47const defaultInjectKey = "$screens"; 48function initScreens(screens) { 49 const state = reactive({ 50 screens: normalizeScreens(screens || defaultScreens), 51 queries: {}, 52 matches: {}, 53 hasSetup: false 54 }); 55 function refreshMatches() { 56 Object.entries(state.queries).forEach(([key, query]) => { 57 state.matches[key] = query.matches; 58 }); 59 } 60 function mapList(config) { 61 return computed(() => Object.keys(state.matches).filter((key) => state.matches[key] === true && config.hasOwnProperty(key)).map((key) => config[key])); 62 } 63 const list = computed(() => Object.keys(state.matches).filter((k) => state.matches[k])); 64 function mapCurrent(config, def) { 65 return computed(() => { 66 const curr = current.value; 67 if (curr && config.hasOwnProperty(curr)) 68 return config[curr]; 69 return def; 70 }); 71 } 72 const current = computed(() => { 73 const arr = list.value; 74 if (arr.length) 75 return arr[arr.length - 1]; 76 return ""; 77 }); 78 function cleanup() { 79 Object.values(state.queries).forEach((query) => query.removeEventListener("change", refreshMatches)); 80 state.queries = {}; 81 state.matches = {}; 82 } 83 if (!state.hasSetup && windowHasFeature("matchMedia")) { 84 cleanup(); 85 state.queries = state.screens.reduce((result, { name, values }) => { 86 const mediaQuery = window.matchMedia(buildMediaQuery(values)); 87 mediaQuery.addEventListener("change", refreshMatches); 88 result[name] = mediaQuery; 89 return result; 90 }, {}); 91 refreshMatches(); 92 state.hasSetup = true; 93 } 94 return { matches: state.matches, list, mapList, current, mapCurrent, cleanup }; 95} 96function useScreens(screens, opts) { 97 const s = initScreens(screens); 98 provide((opts == null ? void 0 : opts.injectKey) || defaultInjectKey, s); 99 onUnmounted(() => s.cleanup()); 100 return s; 101} 102const useTodayViewRentcarListStore = defineStore("todayViewRentcarList", { 103 state: () => ({ 104 todayViewRentcarList: [] 105 }), 106 getters: { 107 getTodayViewRentcarList: (state) => state.todayViewRentcarList 108 }, 109 actions: { 110 loadTodayViewRentcar() { 111 if (typeof window === "undefined") 112 return; 113 const todayViewList = localStorage.getItem("todayViewList"); 114 if (todayViewList) { 115 this.todayViewRentcarList = JSON.parse(todayViewList); 116 } 117 }, 118 addTodayViewRentcar(todayViewRentcar) { 119 var _a; 120 (_a = this.todayViewRentcarList) == null ? void 0 : _a.push(todayViewRentcar); 121 }, 122 unshiftTodayViewRentcar(todayViewRentcar) { 123 var _a; 124 (_a = this.todayViewRentcarList) == null ? void 0 : _a.unshift(todayViewRentcar); 125 }, 126 setTodayViewRentcarList(todayViewRentcarList) { 127 this.todayViewRentcarList = todayViewRentcarList; 128 if (typeof window === "undefined") 129 return; 130 localStorage.setItem("todayViewList", JSON.stringify(this.todayViewRentcarList)); 131 } 132 } 133}); 134export { 135 useTodayViewRentcarListStore as a, 136 useScreens as u 137};
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.