Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/LocalizableText/transform.es",["module","exports","require"],(function(e,a,l){window;{function t(e,a){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),l.push.apply(l,t)}return l}function o(e){for(var a=1;a<arguments.length;a++){var l=null!=arguments[a]?arguments[a]:{};a%2?t(Object(l),!0).forEach((function(a){r(e,a,l[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):t(Object(l)).forEach((function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(l,a))}))}return e}function r(e,a,l){return a in e?Object.defineProperty(e,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[a]=l,e}function n(e){if(e&&"string"==typeof e)try{return JSON.parse(e)}catch(a){console.warn("Unable to parse JSON",e)}return e}Object.defineProperty(a,"__esModule",{value:!0}),a.convertValueToJSON=n,a.getEditingValue=function({defaultLocale:e,editingLocale:a,fieldName:l,value:t}){const o=n(t);if(o)return"submitLabel"===l?o[a.localeId]||"":o[a.localeId]||o[e.localeId]||"";return a},a.getInitialInternalValue=function({editingLocale:e,value:a}){return n(a)[e.localeId]||""},a.normalizeLocaleId=c,a.transformAvailableLocales=function(e,a,t){return{availableLocales:e.map((e=>({displayName:e[1].label,icon:c(e[0]),isDefault:i({defaultLocale:a,localeId:e[0]}),isTranslated:l({localeId:e[0],value:t}),localeId:e[0]})))}},a.transformAvailableLocalesAndValue=function({availableLocales:a,defaultLocale:t,value:r}){return{availableLocales:a.map((e=>o(o({},e),{},{icon:c(e.localeId),isDefault:i({defaultLocale:t,localeId:e.localeId}),isTranslated:l({localeId:e.localeId,value:r})}))),value:e(r)}},a.transformEditingLocale=function({defaultLocale:e,editingLocale:a,value:t}){return{displayName:a.label,icon:a.icon,isDefault:i({defaultLocale:e,localeId:a.id}),isTranslated:l({localeId:a.id,value:t}),localeId:a.id}};const e=e=>e&&"object"==typeof e?JSON.stringify(e):e,l=({localeId:e,value:a})=>{const l=n(a);return!!l&&!!l[e]},i=({defaultLocale:e,localeId:a})=>e.localeId===a;function c(e){if(!e||""===e)throw new Error("localeId ".concat(e," is invalid"));return e.replace("_","-").toLowerCase()}}}));
//# sourceMappingURL=transform.es.js.map