Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.141/page_editor/plugins/browser/components/page-structure/components/item-configuration-panels/DateEditableFormatInput",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../../../../../app/components/fragment-configuration-fields/SelectField","../../../../../../app/components/fragment-configuration-fields/TextField","../../../../../../app/config/constants/editableFragmentEntryProcessor","../../../../../../app/contexts/StoreContext","../../../../../../app/selectors/selectLanguageId","../../../../../../app/thunks/updateEditableValues","../../../../../../app/utils/getEditableLocalizedValue","../../../../../../app/utils/updateIn","../../../../../../common/components/CurrentLanguageFlag"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function DateEditableFormatInput({editableId:t,editableValueNamespace:a,editableValues:m,fragmentEntryLinkId:b}){var y;const O=(0,i.useDispatch)(),v=(0,i.useSelector)(c.default),j=m[a][t],E=(0,f.getEditableLocalizedValue)(null===(y=j.config)||void 0===y?void 0:y.dateFormat,v),[_,w]=(0,r.useState)((()=>getSelectedOption(E))),[D,M]=(0,r.useState)((()=>_===e.custom));(0,r.useEffect)((()=>{E&&(getSelectedOption(E)!==e.custom?M(!1):M(!0))}),[v,E]);const onValueSelectHandler=(e,a)=>{w(getSelectedOption(a)),O((0,d.default)({editableValues:(0,p.updateIn)(m,[u.EDITABLE_FRAGMENT_ENTRY_PROCESSOR,t,"config",e],(e=>_objectSpread(_objectSpread({},e),{},{[v]:a}))),fragmentEntryLinkId:b}))};return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:(0,n.default)("autofit-row align-items-end mb-3")},r.default.createElement("div",{className:(0,n.default)("autofit-col autofit-col-expand")},r.default.createElement(l.SelectField,{field:{label:Liferay.Language.get("date-format"),name:"dateFormat",typeOptions:{validValues:g}},onValueSelect:(t,a)=>{a===e.custom?M(!0):(M(!1),onValueSelectHandler(t,a))},value:getSelectedOption(E)})),r.default.createElement(s.default,null)),D&&r.default.createElement(o.TextField,{field:{label:Liferay.Language.get("custom-format"),name:"dateFormat"},onValueSelect:onValueSelectHandler,value:null!=E?E:g[0].value}));function getSelectedOption(t){var a;if(!t)return g[0].value;const n=g.find((e=>t===e.value));return null!==(a=null==n?void 0:n.value)&&void 0!==a?a:e.custom}};var n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),r=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 a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),l=a("../../../../../../app/components/fragment-configuration-fields/SelectField"),o=a("../../../../../../app/components/fragment-configuration-fields/TextField"),u=a("../../../../../../app/config/constants/editableFragmentEntryProcessor"),i=a("../../../../../../app/contexts/StoreContext"),c=_interopRequireDefault(a("../../../../../../app/selectors/selectLanguageId")),d=_interopRequireDefault(a("../../../../../../app/thunks/updateEditableValues")),f=a("../../../../../../app/utils/getEditableLocalizedValue"),p=a("../../../../../../app/utils/updateIn"),s=_interopRequireDefault(a("../../../../../../common/components/CurrentLanguageFlag"));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 ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e={custom:"custom"},g=[{label:Liferay.Language.get("default"),value:""},{label:"MM/DD/YY",value:"MM/dd/yy"},{label:"DD/MM/YY",value:"dd/MM/yy"},{label:"YY/MM/DD",value:"yy/MM/dd"},{label:"DD/MM/YYYY",value:"dd/MM/yyyy"},{label:Liferay.Language.get("custom"),value:e.custom}]}}));
//# sourceMappingURL=DateEditableFormatInput.js.map