Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/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 n(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 o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?n(Object(t),!0).forEach((function(r){i(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):n(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(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 s=({editingLanguageId:r,fieldName:t,onChange:n})=>(i,s)=>{const l=e=>{let r={};e.enableValidation&&(r={name:e.selectedValidation.name,value:a.StringUtils.subWords(e.selectedValidation.template,{name:t})});const{enableValidation:i,errorMessage:s,parameter:l}=e;return n({enableValidation:i,errorMessage:s,expression:r,parameter:l}),o(o({},e),{},{expression:r})};switch(s.type){case e.ENABLE_VALIDATION:{const{enableValidation:e}=s.payload;return l(o(o({},i),{},{enableValidation:e}))}case e.CHANGE_ERROR_MESSAGE:{const{errorMessage:e}=s.payload;return l(o(o({},i),{},{errorMessage:o(o({},i.errorMessage),{},{[r]:e})}))}case e.CHANGE_SELECTED_VALIDATION:{const{selectedValidation:e}=s.payload;return l(o(o({},i),{},{selectedValidation:e}))}case e.SET_PARAMETER:{const{parameter:e}=s.payload;return l(o(o({},i),{},{parameter:o(o({},i.parameter),{},{[r]:e})}))}default:return i}};r.default=s}}));
//# sourceMappingURL=validationReducer.js.map