Liferay.Loader.define("@liferay/object-web@1.0.153/js/components/ObjectDetails/useObjectDetailsForm",["module","exports","require","@liferay/object-js-components-web","../../utils/constants","../../utils/string"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.useObjectDetailsForm=function useObjectDetailsForm({initialValues:a,onSubmit:t}){const{errors:r,handleChange:l,handleSubmit:s,handleValidate:u,setValues:c,values:o}=(0,n.useForm)({initialValues:a,onSubmit:t,validate:a=>{var t,r;const l={},s=null===(t=a.label)||void 0===t?void 0:t[i.defaultLanguageId];return(0,n.invalidateRequired)(s)&&(l.label=e),(0,n.invalidateRequired)(null===(r=a.pluralLabel)||void 0===r?void 0:r[i.defaultLanguageId])&&(l.pluralLabel=e),a.accountEntryRestricted&&!a.accountEntryRestrictedObjectFieldName&&(l.accountEntryRestrictedObjectFieldName=Liferay.Language.get("if-activated-the-account-restriction-field-must-be-selected")),getNameErrors(l,a.name),l}});return{errors:r,handleChange:l,handleSubmit:s,handleValidate:u,setValues:c,values:o}};var n=t("@liferay/object-js-components-web"),i=t("../../utils/constants"),r=t("../../utils/string");const e=Liferay.Language.get("required"),getNameErrors=(a,t)=>{(0,n.invalidateRequired)(t)?a.name=e:(0,r.specialCharactersInString)(t)?a.name=Liferay.Language.get("name-must-only-contain-letters-and-digits"):t.length>41?a.name=Liferay.Language.get("only-41-characters-are-allowed"):(0,r.checkIfFirstLetterIsUppercase)(t)||(a.name=Liferay.Language.get("the-first-character-of-a-name-must-be-an-upper-case-letter"))}}}));
//# sourceMappingURL=useObjectDetailsForm.js.map