Liferay.Loader.define("layout-seo-web@2.0.66/js/seo/display_page_templates/components/MappingSelector",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../constants","./MappingPanel"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/form")),a=(r("liferay!frontend-js-react-web$prop-types"),_interopRequireWildcard(r("liferay!frontend-js-react-web$react"))),l=r("../constants"),o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("./MappingPanel"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=n?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function MappingSelector({fieldTypes:e=[],fields:t,helpMessage:r,label:c,name:i,selectedFieldKey:u,selectedSource:p}){const f=[l.UNMAPPED_OPTION,...t],[d,s]=(0,a.useState)(p),[y,b]=(0,a.useState)(f.find((({key:e})=>e===u))||l.UNMAPPED_OPTION),O=!!y&&y.key!==l.UNMAPPED_OPTION.key,m=p?p.classTypeLabel||p.classNameLabel:"";return a.default.createElement(n.default.Group,null,a.default.createElement("label",{className:"control-label",htmlFor:i},c),a.default.createElement(n.ClayInput.Group,null,a.default.createElement(n.ClayInput.GroupItem,null,a.default.createElement(n.ClayInput,{className:"dpt-mapping-input",id:i,readOnly:!0,type:"text",value:"".concat(O&&m&&"".concat(m,": ")||"").concat(y.label)}),a.default.createElement(n.ClayInput,{name:i,type:"hidden",value:y.key})),a.default.createElement(n.ClayInput.GroupItem,{shrink:!0},a.default.createElement(o.default,{field:y,fieldTypes:e,fields:f,isActive:O,name:i,onSelect:({field:e,source:t})=>{s(t),b(e)},source:_objectSpread(_objectSpread({},d),{},{initialValue:m})}))),r&&a.default.createElement(n.default.Text,null,r))};t.default=c}}));
//# sourceMappingURL=MappingSelector.js.map