Liferay.Loader.define("data-engine-taglib@3.3.26/data_layout_builder/js/components/translation-manager/TranslationManager.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.formatLabel=f,a.formatIcon=i,a.TranslationManagerLabel=d,a.default=function({availableLanguageIds:e,defaultLanguageId:a=themeDisplay.getDefaultLanguageId(),editingLanguageId:t=themeDisplay.getDefaultLanguageId(),onActiveChange:c=(()=>{}),onEditingLanguageIdChange:s,showUserView:g=!1,translatedLanguageIds:m,className:b}){const[y,p]=(0,o.useState)(!1),[L,E]=(0,o.useState)({}),[w,I]=(0,o.useState)({});return(0,o.useEffect)((()=>{I(Liferay.Language.available)}),[]),(0,o.useEffect)((()=>{E(e||w)}),[w,e]),(0,o.useEffect)((()=>{c(y)}),[y,c]),o.default.createElement(n.default,{active:y,className:(0,u.default)("localizable-dropdown",b),onActiveChange:e=>p(e),trigger:o.default.createElement(l.default,{displayType:"secondary",monospaced:!g,small:g,symbol:f(t)},o.default.createElement("span",{className:"inline-item"},o.default.createElement(r.default,{symbol:i(t)})),g?o.default.createElement("span",{className:"localizable-dropdown-label ml-2"},w[t]):o.default.createElement("span",{className:"btn-section"},f(t)),g&&o.default.createElement(r.default,{className:"ml-2",symbol:"caret-bottom"}))},o.default.createElement(n.default.ItemList,{className:"localizable-dropdown-ul"},Object.keys(L).map(((e,t)=>o.default.createElement(n.default.Item,{className:(0,u.default)("autofit-row",{"localizable-item-default":e===a}),key:t,onClick:()=>{s(e),p(!1)}},o.default.createElement("span",{className:"autofit-col autofit-col-expand"},o.default.createElement("span",{className:"autofit-section"},o.default.createElement("span",{className:"inline-item inline-item-before"},o.default.createElement(r.default,{symbol:i(e)})),g?w[e]:f(e))),!g&&o.default.createElement(d,{defaultLanguageId:a,languageId:e,translatedLanguageIds:m}))))))};var l=s(t("@frontend-taglib-clay$clayui/button")),n=s(t("@frontend-taglib-clay$clayui/drop-down")),r=s(t("@frontend-taglib-clay$clayui/icon")),u=s(t("liferay!frontend-js-react-web$classnames")),o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=c();if(a&&a.has(e))return a.get(e);var t={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(t,n,r):t[n]=e[n]}t.default=e,a&&a.set(e,t);return t}(t("liferay!frontend-js-react-web$react"));function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function s(e){return e&&e.__esModule?e:{default:e}}function f(e){return e.replace("_","-")}function i(e){return f(e).toLowerCase()}function d({defaultLanguageId:e,languageId:a,translatedLanguageIds:t}){let l="label-warning",n=Liferay.Language.get("not-translated");return a===e?(l="label-info",n=Liferay.Language.get("default")):t[a]&&(l="label-success",n=Liferay.Language.get("translated")),o.default.createElement("span",{className:"autofit-col"},o.default.createElement("span",{className:(0,u.default)("label",l)},o.default.createElement("span",{className:"label-item label-item-expand"},n)))}}}));
//# sourceMappingURL=TranslationManager.es.js.map