Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.147/Validation/validationReducer",["module","exports","require","data-engine-js-components-web"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=r.EVENT_TYPES=void 0;var a=t("data-engine-js-components-web");function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const e={CHANGE_ERROR_MESSAGE:"changeErrorMessage",ENABLE_VALIDATION:"enableValidation",SELECTED_VALIDATION:"changeSelectedValidation",SET_PARAMETER:"setParameter"};r.EVENT_TYPES=e;var _default=({editingLanguageId:r,fieldName:t,onChange:n})=>(o,i)=>{const onSave=e=>{let r={};e.enableValidation&&(r={name:e.selectedValidation.name,value:a.StringUtils.subWords(e.selectedValidation.template,{name:t})});const{enableValidation:o,errorMessage:i,parameter:c}=e;return n({enableValidation:o,errorMessage:i,expression:r,parameter:c}),_objectSpread(_objectSpread({},e),{},{expression:r})};switch(i.type){case e.ENABLE_VALIDATION:{const{enableValidation:e}=i.payload;return onSave(_objectSpread(_objectSpread({},o),{},{enableValidation:e}))}case e.CHANGE_ERROR_MESSAGE:{const{errorMessage:e}=i.payload;return onSave(_objectSpread(_objectSpread({},o),{},{errorMessage:_objectSpread(_objectSpread({},o.errorMessage),{},{[r]:e})}))}case e.CHANGE_SELECTED_VALIDATION:{const{selectedValidation:e}=i.payload;return onSave(_objectSpread(_objectSpread({},o),{},{selectedValidation:e}))}case e.SET_PARAMETER:{const{parameter:e}=i.payload;return onSave(_objectSpread(_objectSpread({},o),{},{parameter:_objectSpread(_objectSpread({},o.parameter),{},{[r]:e})}))}default:return o}};r.default=_default}}));
//# sourceMappingURL=validationReducer.js.map