var r;(function(r){r["RECENT_QUERIES"]="coveo-recent-queries";r["STANDALONE_SEARCH_BOX_DATA"]="coveo-standalone-search-box-data";r["GENERATED_ANSWER_DATA"]="coveo-generated-answer-data"})(r||(r={}));class t{constructor(){}clear(){return this.tryAccessLocalStorageOrWarn((()=>localStorage.clear()),(()=>{}))}getItem(r){return this.tryAccessLocalStorageOrWarn((()=>localStorage.getItem(r)),(()=>null))}getParsedJSON(r,t){const e=this.getItem(r);if(!e){return t}return this.tryJSONOrWarn(r,(()=>JSON.parse(e)),(()=>t))}key(r){return this.tryAccessLocalStorageOrWarn((()=>localStorage.key(r)),(()=>null))}get length(){return this.tryOrElse((()=>localStorage.length),(()=>0))}removeItem(r){return this.tryAccessLocalStorageOrWarn((()=>localStorage.removeItem(r)),(()=>{}))}setItem(r,t){return this.tryAccessLocalStorageOrWarn((()=>localStorage.setItem(r,t)),(()=>{}))}setJSON(r,t){const e=this.tryJSONOrWarn(r,(()=>JSON.stringify(t)),(()=>JSON.stringify({})));return this.setItem(r,e)}tryAccessLocalStorageOrWarn(r,t){return this.tryOrElse(r,(()=>{console.warn("Error while trying to read or modify local storage. This can be caused by browser specific settings.");return t()}))}tryJSONOrWarn(r,t,e){return this.tryOrElse(t,(()=>{console.warn(`Error while trying to do JSON manipulation with local storage entry. ${r}`);return e()}))}tryOrElse(r,t){try{return r()}catch(r){console.warn(r);return t()}}}export{r as S,t as a}; //# sourceMappingURL=p-0943c4bd.js.map