var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React, { useState, useCallback, useMemo } from 'react';
import { PerspectivesSettingsContext } from '../contexts/PerspectivesSettingsContext';
export var TestPerspectivesSettingsProvider = function (_a) {
    var children = _a.children, _b = _a.settings, settingsProp = _b === void 0 ? {} : _b;
    var _c = useState(settingsProp), settings = _c[0], setSettings = _c[1];
    var onChange = useCallback(function (perspectiveId, value) {
        setSettings(function (prev) {
            var _a;
            return (__assign(__assign({}, prev), (_a = {}, _a[perspectiveId] = __assign(__assign({}, prev[perspectiveId]), value), _a)));
        });
    }, []);
    var contextValue = useMemo(function () { return ({
        settings: settings,
        onChange: onChange
    }); }, [onChange, settings]);
    return React.createElement(PerspectivesSettingsContext.Provider, { value: contextValue }, children);
};
