Liferay.Loader.define("@liferay/object-js-components-web@1.0.58/components/InputLocalized",["module","exports","require","@frontend-taglib-clay$clayui/localized-input","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","./FieldBase","./InputLocalized.scss"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.InputLocalized=function InputLocalized(e){let{disableFlag:t,disabled:r,error:c,id:d,label:s,name:u,onChange:f,onSelectedLocaleChange:p,placeholder:b,required:y,selectedLocale:g,translations:j}=e,_=function _objectWithoutProperties(e,t){if(null==e)return{};var r,a,l=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,a,l={},n=Object.keys(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||(l[r]=e[r]);return l}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r])}return l}(e,["disableFlag","disabled","error","id","label","name","onChange","onSelectedLocaleChange","placeholder","required","selectedLocale","translations"]);const[h,L]=(0,n.useState)(i[0]);return(0,n.useEffect)((()=>{var e;if(t){const e=document.querySelector(".dropdown-toggle");null==e||e.setAttribute("disabled","true")}const r=null!==(e=i.find((({label:e})=>e===g)))&&void 0!==e?e:i[0];L(r)}),[t,g]),n.default.createElement(o.FieldBase,{className:"lfr-objects__input-localized",disabled:r,errorMessage:c,id:d,label:s,required:y},n.default.createElement(a.default,_extends({},_,{className:(0,l.default)({"lfr-objects__input-localized--rtl":"rtl"===Liferay.Language.direction[h.label]}),disabled:r,id:d,label:"",locales:i,name:u,onSelectedLocaleChange:e=>{L(e),f(j,e),p&&p(e.label)},onTranslationsChange:e=>f(e,h),placeholder:b,selectedLocale:h,translations:j})))};var a=_interopRequireDefault(r("@frontend-taglib-clay$clayui/localized-input")),l=_interopRequireDefault(r("liferay!frontend-js-react-web$classnames")),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=a?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(r,l,n):r[l]=e[l]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("./FieldBase");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}r("./InputLocalized.scss");const e=Liferay.ThemeDisplay.getDefaultLanguageId(),i=Object.keys(Liferay.Language.available).sort((t=>t===e?-1:1)).map((e=>({label:e,symbol:e.replace(/_/g,"-").toLowerCase()})))}}));
//# sourceMappingURL=InputLocalized.js.map