Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.170/page_editor/app/components/fragment_configuration_fields/ImageSelectorField",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../common/components/ImageSelector","../../../common/components/ImageSelectorSize","../../../common/components/MappingSelector","../../../common/hooks/useId","../../../prop_types/index","../../config/constants/editableTypes","../../config/constants/viewportSizes","../../contexts/StoreContext","../../utils/editable_value/isMapped","../../utils/editable_value/isMappedToCollection","../../utils/editable_value/isMappedToInfoItem"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ImageSelectorField=function ImageSelectorField({field:t,onValueSelect:a,value:g={}}){const y=(0,u.useId)(),S=(0,p.useSelector)((e=>e.selectedViewportSize)),[I,_]=(0,n.useState)((()=>(0,f.default)(g)?e.mapping.value:e.direct.value)),handleImageChanged=e=>{a(t.name,e)};return n.default.createElement(n.default.Fragment,null,S===d.VIEWPORT_SIZES.desktop&&n.default.createElement(l.default.Group,{small:!0},n.default.createElement("label",{htmlFor:y},Liferay.Language.get("image-source")),n.default.createElement(l.ClaySelectWithOption,{id:y,onChange:e=>{_(e.target.value),Object.keys(g).length&&handleImageChanged({})},options:Object.values(e),value:I})),I===e.direct.value?n.default.createElement(n.default.Fragment,null,n.default.createElement(r.ImageSelector,{fileEntryId:g.fileEntryId,imageTitle:g.title||g.url,label:t.label,onClearButtonPressed:()=>handleImageChanged({}),onImageSelected:handleImageChanged}),(null==g?void 0:g.fileEntryId)&&n.default.createElement(o.ImageSelectorSize,{fieldValue:{fileEntryId:g.fileEntryId},imageSizeId:"auto"})):n.default.createElement(n.default.Fragment,null,S===d.VIEWPORT_SIZES.desktop?n.default.createElement(i.default,{fieldType:c.EDITABLE_TYPES.backgroundImage,mappedItem:g,onMappingSelect:handleImageChanged}):null,((null==g?void 0:g.fileEntryId)||(0,m.default)(g)||(0,s.default)(g))&&n.default.createElement(o.ImageSelectorSize,{fieldValue:g,imageSizeId:"auto"})))};var l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),n=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),r=a("../../../common/components/ImageSelector"),o=a("../../../common/components/ImageSelectorSize"),i=_interopRequireDefault(a("../../../common/components/MappingSelector")),u=a("../../../common/hooks/useId"),c=(a("../../../prop_types/index"),a("../../config/constants/editableTypes")),d=a("../../config/constants/viewportSizes"),p=a("../../contexts/StoreContext"),f=_interopRequireDefault(a("../../utils/editable_value/isMapped")),s=_interopRequireDefault(a("../../utils/editable_value/isMappedToCollection")),m=_interopRequireDefault(a("../../utils/editable_value/isMappedToInfoItem"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}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 a={},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(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}const e={direct:{label:Liferay.Language.get("direct"),value:"direct"},mapping:{label:Liferay.Language.get("mapping"),value:"mapping"}}}}));
//# sourceMappingURL=ImageSelectorField.js.map