"use strict";
exports.__esModule = true;
exports.callbackWithSelector = exports.getStoryIds = exports.createMetadata = exports.createStory = void 0;
var tslib_1 = require("tslib");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var addon_actions_1 = require("@storybook/addon-actions");
var addon_knobs_1 = require("@storybook/addon-knobs");
var createStory = function (Component, params) {
    if (params === void 0) { params = {}; }
    var wrapper = function () { return react_1["default"].createElement(Component, null); };
    wrapper.story = (0, tslib_1.__assign)({}, params);
    return wrapper;
};
exports.createStory = createStory;
var createMetadata = function (params) { return params; };
exports.createMetadata = createMetadata;
var getStoryIds = function (obj) { return Object.keys(obj); };
exports.getStoryIds = getStoryIds;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var callbackWithSelector = function (_a, fn) {
    var name = _a.name, _b = _a.isActive, isActive = _b === void 0 ? false : _b;
    var defaultOptions = ['undefined', '() => void'];
    var options = isActive ? defaultOptions.reverse() : defaultOptions;
    if ((0, addon_knobs_1.select)(name, options, options[0]) === 'undefined') {
        return undefined;
    }
    return function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        (0, addon_actions_1.action)(name).apply(void 0, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(args), false));
        if (fn) {
            return fn.apply(void 0, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(args), false));
        }
    };
};
exports.callbackWithSelector = callbackWithSelector;
