Liferay.Loader.define("@liferay/document-library-web@6.0.111/document_library/js/LanguageSelector",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=u(n("@frontend-taglib-clay$clayui/button")),r=u(n("@frontend-taglib-clay$clayui/drop-down")),l=u(n("@frontend-taglib-clay$clayui/icon")),o=(u(n("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=a?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(n,r,l):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("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 u(e){return e&&e.__esModule?e:{default:e}}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function f(e){const t=e.replace("_","-");return{icon:t.toLowerCase(),text:t}}function s({languageIds:e,onChange:t,selectedLanguageId:n}){const[c,u]=(0,o.useState)(!1),i=f(n);return o.default.createElement(r.default,{active:c,onActiveChange:u,trigger:o.default.createElement(a.default,{displayType:"secondary",monospaced:!0},o.default.createElement("span",{className:"inline-item"},o.default.createElement(l.default,{symbol:i.icon})),o.default.createElement("span",{className:"btn-section"},i.text))},o.default.createElement(r.default.ItemList,null,e.map((e=>{const{icon:a,text:c}=f(e);return o.default.createElement(r.default.Item,{active:e===n,key:e,onClick:()=>{t(e),u(!1)}},o.default.createElement("span",{className:"inline-item inline-item-before"},o.default.createElement(l.default,{symbol:a})),c)}))))}var p=function(e){let{ddmStructureIds:t,portletNamespace:n,selectedLanguageId:a,translatedLanguageIds:r}=e,l=d(e,["ddmStructureIds","portletNamespace","selectedLanguageId","translatedLanguageIds"]);const[c,u]=(0,o.useState)(a),[f,p]=(0,o.useState)([...new Set([...r,a])]);return(0,o.useEffect)((()=>{t.forEach((e=>{Liferay.componentReady("".concat(n,"dataEngineLayoutRenderer").concat(e)).then((e=>{const{reactComponentRef:{current:t}}=e;t&&t.updateEditingLanguageId({editingLanguageId:c})}))}))}),[n,c,t]),o.default.createElement(o.default.Fragment,null,o.default.createElement("input",{name:"".concat(n,"availableLocales"),type:"hidden",value:f.join(",")}),o.default.createElement(s,i({},l,{onChange:e=>{u(e),f.includes(e)||p([...f,e])},selectedLanguageId:c})))};t.default=p}}));
//# sourceMappingURL=LanguageSelector.js.map