/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
export var StorageKeys;
(function (StorageKeys) {
    StorageKeys["DEVICE_ID"] = "vertexvis:device-id";
})(StorageKeys || (StorageKeys = {}));
function getLocalStorage() {
    if (typeof window === 'undefined') {
        throw new Error('Local storage is not available.');
    }
    return window.localStorage;
}
export function upsertStorageEntry(key, values, storage = getLocalStorage()) {
    const existing = storage.getItem(key);
    if (existing != null) {
        const updated = { ...JSON.parse(existing), ...values };
        storage.setItem(key, JSON.stringify(updated));
    }
    else {
        storage.setItem(key, JSON.stringify(values));
    }
}
export function getStorageEntry(key, f, storage = getLocalStorage()) {
    const item = storage.getItem(key);
    if (item != null) {
        return f(JSON.parse(item));
    }
}
//# sourceMappingURL=storage.js.map
