"use client";
'use strict';

var fingerprintShared = require('./fingerprint-shared.js');

function getLocalStorageValue(key) {
    if (typeof window === 'undefined') {
        return null;
    }
    try {
        return window.localStorage.getItem(key);
    }
    catch (_a) {
        return null;
    }
}
function setLocalStorageValue(key, value) {
    if (typeof window === 'undefined') {
        return;
    }
    try {
        window.localStorage.setItem(key, value);
    }
    catch (_a) {
        // Ignore storage failures in debug helpers.
    }
}
function getDebugFingerprintOverride() {
    const value = getLocalStorageValue(fingerprintShared.FINGERPRINT_DEBUG_OVERRIDE_STORAGE_KEY);
    if (!value || !fingerprintShared.isValidFingerprintId(value)) {
        return null;
    }
    return value;
}
function setDebugFingerprintOverride(fingerprintId) {
    if (!fingerprintShared.isValidFingerprintId(fingerprintId)) {
        throw new Error('Invalid fingerprint ID');
    }
    setLocalStorageValue(fingerprintShared.FINGERPRINT_DEBUG_OVERRIDE_STORAGE_KEY, fingerprintId);
}

exports.getDebugFingerprintOverride = getDebugFingerprintOverride;
exports.setDebugFingerprintOverride = setDebugFingerprintOverride;
