{"version":3,"file":"useNonReactiveLocalStorage-C8oWfv5C.js","sources":["../../meteoapi/client/services/ForecastService.ts","../../src/constants/localStorage.ts","../../src/hooks/useNonReactiveLocalStorage.ts"],"sourcesContent":["/* generated using openapi-typescript-codegen -- do not edit */\n/* istanbul ignore file */\n/* tslint:disable */\n/* eslint-disable */\nimport type { Color } from '../models/Color';\nimport type { ForecastPointWeek } from '../models/ForecastPointWeek';\nimport type { CancelablePromise } from '../core/CancelablePromise';\nimport { OpenAPI } from '../core/OpenAPI';\nimport { request as __request } from '../core/request';\nexport class ForecastService {\n /**\n * Returns the complete list of temperature-color mappings\n * Returns the complete list of current temperature-color mappings. Needed to accurately display the accurate color value in GUIs\n * @returns Color Returned when successful\n * @throws ApiError\n */\n public static getTemperatureMapList(): CancelablePromise> {\n return __request(OpenAPI, {\n method: 'GET',\n url: '/colors',\n });\n }\n /**\n * Returns a complete list of all symbolcodes and descriptions\n * @returns any Returned when successful\n * @throws ApiError\n */\n public static getSymbolCodes(): CancelablePromise<{\n symbol24_text?: Record;\n symbol_text?: Record;\n }> {\n return __request(OpenAPI, {\n method: 'GET',\n url: '/symbols',\n });\n }\n /**\n * Returns forecast data grouped by day,3hour and hour\n * Returns forecast data grouped by day-intervals, 3hour-intervals (threeHours) and hours interval\n * @returns ForecastPointWeek Returned when successful\n * @throws ApiError\n */\n public static getForecastWeekByGeoLocation({\n geolocationId,\n }: {\n /**\n * id of geolocation object ('[lat],[lon]' rounded to 4 digits)\n */\n geolocationId: string,\n }): CancelablePromise {\n return __request(OpenAPI, {\n method: 'GET',\n url: '/forecastpoint/{geolocationId}',\n path: {\n 'geolocationId': geolocationId,\n },\n errors: {\n 404: `Returned when geolocation is not found`,\n },\n });\n }\n}\n","export const DEPRECATED_FAVOURITES_LOCAL_STORAGE_KEY = \"SRF.meteoFavourites\";\nexport const RECENT_LOCATIONS_LOCAL_STORAGE_KEY = \"srf:meteo:recentLocations\";\nexport const ANIMATED_WEATHER_ICONS = \"srf:meteo:animatedWeatherIconsEnabled\";\n","/* Custom local storage hook that is non-reactive (unlike useLocalStorage from usehooks-ts), as in some\n cases it is not desired to re-render the component (or hook) when the local storage value changes. */\n\nimport { useCallback } from \"react\";\n\ntype UseNonReactiveLocalStorage = [\n () => T | null,\n (value: T) => void,\n () => void,\n];\n\nexport const useNonReactiveLocalStorage = (\n key: string,\n initialValue: T | null = null,\n): UseNonReactiveLocalStorage => {\n const getValue = useCallback(() => {\n const value = localStorage.getItem(key);\n\n if (value !== null) {\n return JSON.parse(value);\n }\n\n return initialValue;\n }, [key, initialValue]);\n\n const setValue = useCallback(\n (value: T) => {\n localStorage.setItem(key, JSON.stringify(value));\n },\n [key],\n );\n\n const removeValue = useCallback(() => {\n localStorage.removeItem(key);\n }, [key]);\n\n return [getValue, setValue, removeValue];\n};\n"],"names":["ForecastService","__request","OpenAPI","geolocationId","DEPRECATED_FAVOURITES_LOCAL_STORAGE_KEY","RECENT_LOCATIONS_LOCAL_STORAGE_KEY","ANIMATED_WEATHER_ICONS","useNonReactiveLocalStorage","key","initialValue","getValue","useCallback","value","setValue","removeValue"],"mappings":"8lCASO,MAAMA,CAAgB,CAOzB,OAAc,uBAAyD,CACnE,OAAOC,EAAUC,EAAS,CACtB,OAAQ,MACR,IAAK,SAAA,CACR,CAAA,CAOL,OAAc,gBAGX,CACC,OAAOD,EAAUC,EAAS,CACtB,OAAQ,MACR,IAAK,UAAA,CACR,CAAA,CAQL,OAAc,6BAA6B,CACvC,cAAAC,CAAA,EAMqC,CACrC,OAAOF,EAAUC,EAAS,CACtB,OAAQ,MACR,IAAK,iCACL,KAAM,CACF,cAAiBC,CACrB,EACA,OAAQ,CACJ,IAAK,wCAAA,CACT,CACH,CAAA,CAET,CC7DO,MAAMC,EAA0C,sBAC1CC,EAAqC,4BACrCC,EAAyB,wCCSzBC,EAA6B,CACxCC,EACAC,EAAyB,OACS,CAC5B,MAAAC,EAAWC,EAAAA,YAAY,IAAM,CAC3B,MAAAC,EAAQ,aAAa,QAAQJ,CAAG,EAEtC,OAAII,IAAU,KACL,KAAK,MAAMA,CAAK,EAGlBH,CAAA,EACN,CAACD,EAAKC,CAAY,CAAC,EAEhBI,EAAWF,EAAA,YACdC,GAAa,CACZ,aAAa,QAAQJ,EAAK,KAAK,UAAUI,CAAK,CAAC,CACjD,EACA,CAACJ,CAAG,CACN,EAEMM,EAAcH,EAAAA,YAAY,IAAM,CACpC,aAAa,WAAWH,CAAG,CAAA,EAC1B,CAACA,CAAG,CAAC,EAED,MAAA,CAACE,EAAUG,EAAUC,CAAW,CACzC"}