Liferay.Loader.define("@liferay/object-js-components-web@1.0.58/components/RichTextLocalized",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/label","@frontend-taglib-clay$clayui/layout","frontend-editor-ckeditor-web","liferay!frontend-js-react-web$react","./FieldBase","./RichTextLocalized.scss"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.RichTextLocalized=function RichTextLocalized({ariaLabels:e={default:"Default",openLocalizations:"Open Localizations",translated:"Translated",untranslated:"Untranslated"},editorConfig:t,helpMessage:a,label:s,onSelectedLocaleChange:p,onTranslationsChange:y,selectedLocale:b,translations:g}){const m=(0,u.useRef)(null),[_,O]=(0,u.useState)(!1),j=f[0];return(0,u.useEffect)((()=>{var e;const t=null===(e=m.current)||void 0===e?void 0:e.editor;t&&(t.config.contentsLangDirection=Liferay.Language.direction[b],t.config.contentsLanguage=b,g[b]&&t.setData(g[b]))}),[b]),u.default.createElement(d.FieldBase,{helpMessage:a,label:s},u.default.createElement("div",{className:"lfr-notification__rich-text-localized"},u.default.createElement("div",{className:"lfr-notification__rich-text-localized-editor"},u.default.createElement(c.ClassicEditor,{contents:g[b],editorConfig:t,name:"richTextLocalizedEditor",onChange:e=>{y(_objectSpread(_objectSpread({},g),{},{[b]:e}))},ref:m})),u.default.createElement(l.default,{active:_,className:"lfr-notification__rich-text-localized-flag",onActiveChange:O,trigger:u.default.createElement(n.default,{displayType:"secondary",monospaced:!0,onClick:()=>O(!_),title:e.openLocalizations},u.default.createElement("span",{className:"inline-item"},u.default.createElement(r.default,{symbol:b.replace(/_/g,"-").toLowerCase()})),u.default.createElement("span",{className:"btn-section"},b))},u.default.createElement(l.default.ItemList,null,f.map((t=>{const a=g[t.label];return u.default.createElement(l.default.Item,{key:t.label,onClick:()=>{p(t),O(!1)}},u.default.createElement(o.default.ContentRow,{containerElement:"span"},u.default.createElement(o.default.ContentCol,{containerElement:"span",expand:!0},u.default.createElement(o.default.ContentSection,null,u.default.createElement(r.default,{className:"inline-item inline-item-before",symbol:t.symbol}),t.label)),u.default.createElement(o.default.ContentCol,{containerElement:"span"},u.default.createElement(o.default.ContentSection,null,u.default.createElement(i.default,{displayType:t.label===j.label?"info":a?"success":"warning"},t.label===j.label?e.default:a?e.translated:e.untranslated)))))}))))))};var n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/drop-down")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/label")),o=_interopRequireDefault(a("@frontend-taglib-clay$clayui/layout")),c=a("frontend-editor-ckeditor-web"),u=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 l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var r=n?Object.getOwnPropertyDescriptor(e,l):null;r&&(r.get||r.set)?Object.defineProperty(a,l,r):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),d=a("./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 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}a("./RichTextLocalized.scss");const e=Liferay.ThemeDisplay.getDefaultLanguageId(),f=Object.keys(Liferay.Language.available).sort((t=>t===e?-1:1)).map((e=>({label:e,symbol:e.replace(/_/g,"-").toLowerCase()})))}}));
//# sourceMappingURL=RichTextLocalized.js.map