'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function isScenario(config) { const keys = Object.keys(config); return ["id", "value", "initialValue", "options"].every((key) => keys.includes(key)); } function isScenarioConfig(config) { return Object.keys(config).includes("options"); } var __defProp$4 = Object.defineProperty; var __defProps$4 = Object.defineProperties; var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; var __hasOwnProp$4 = Object.prototype.hasOwnProperty; var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$4 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); if (__getOwnPropSymbols$4) for (var prop of __getOwnPropSymbols$4(b)) { if (__propIsEnum$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); } return a; }; var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b)); function createExpositionState(config, prependKey) { return Object.keys(config).reduce((accumulator, key) => { const configItem = config[key]; const combinedKey = prependKey ? `${prependKey}.${key}` : key; if (isScenarioConfig(configItem)) { const { options } = configItem; const firstOptionValue = options[0]; return __spreadProps$4(__spreadValues$4({}, accumulator), { [key]: { id: combinedKey, options, initialValue: firstOptionValue, value: firstOptionValue } }); } return __spreadProps$4(__spreadValues$4({}, accumulator), { [key]: createExpositionState(configItem, combinedKey) }); }, {}); } var __defProp$3 = Object.defineProperty; var __defProps$3 = Object.defineProperties; var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; var __hasOwnProp$3 = Object.prototype.hasOwnProperty; var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$3 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); if (__getOwnPropSymbols$3) for (var prop of __getOwnPropSymbols$3(b)) { if (__propIsEnum$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); } return a; }; var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b)); function getExpositionValues(expositionState) { return Object.keys(expositionState).reduce((accumulator, key) => { const state = expositionState[key]; if (isScenario(state)) { return __spreadProps$3(__spreadValues$3({}, accumulator), { [key]: state.value }); } return __spreadProps$3(__spreadValues$3({}, accumulator), { [key]: getExpositionValues(state) }); }, {}); } var __defProp$2 = Object.defineProperty; var __defProps$2 = Object.defineProperties; var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; var __hasOwnProp$2 = Object.prototype.hasOwnProperty; var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$2 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]); if (__getOwnPropSymbols$2) for (var prop of __getOwnPropSymbols$2(b)) { if (__propIsEnum$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]); } return a; }; var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); function getInitialExpositionValues(expositionState) { return Object.keys(expositionState).reduce((accumulator, key) => { const state = expositionState[key]; if (isScenario(state)) { return __spreadProps$2(__spreadValues$2({}, accumulator), { [key]: state.initialValue }); } return __spreadProps$2(__spreadValues$2({}, accumulator), { [key]: getInitialExpositionValues(state) }); }, {}); } var __defProp$1 = Object.defineProperty; var __defProps$1 = Object.defineProperties; var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); if (__getOwnPropSymbols$1) for (var prop of __getOwnPropSymbols$1(b)) { if (__propIsEnum$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); } return a; }; var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b)); function resetExpositionValues(expositionState) { return Object.keys(expositionState).reduce((accumulator, key) => { const state = expositionState[key]; if (isScenario(state)) { return __spreadProps$1(__spreadValues$1({}, accumulator), { [key]: __spreadProps$1(__spreadValues$1({}, state), { value: state.initialValue }) }); } return __spreadProps$1(__spreadValues$1({}, accumulator), { [key]: resetExpositionValues(state) }); }, {}); } var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); function updateExpositionValues(expositionState, values) { return Object.keys(expositionState).reduce((accumulator, key) => { const state = expositionState[key]; const value = values[key]; if (isScenario(state)) { return __spreadProps(__spreadValues({}, accumulator), { [key]: __spreadProps(__spreadValues({}, expositionState[key]), { value: value || state.value }) }); } return __spreadProps(__spreadValues({}, accumulator), { [key]: !value ? state : updateExpositionValues(state, value) }); }, {}); } exports.createExpositionState = createExpositionState; exports.getExpositionValues = getExpositionValues; exports.getInitialExpositionValues = getInitialExpositionValues; exports.resetExpositionValues = resetExpositionValues; exports.updateExpositionValues = updateExpositionValues;