Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/common/components/ImageSelector",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-components-web","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../app/config/constants/viewportSizes","../../app/contexts/StoreContext","../../app/selectors/selectPageContents","../openImageSelector"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ImageSelector=function ImageSelector({fileEntryId:e,imageTitle:t="",label:a,onClearButtonPressed:f,onImageSelected:p}){var g,m;const y=(0,r.useId)(),b=(0,u.useSelector)((e=>e.selectedViewportSize)),I=(0,u.useSelector)(d.selectPageContents),C=null!==(g=null===(m=I.find((t=>t.classPK===e)))||void 0===m?void 0:m.title)&&void 0!==g?g:t,_=!!t.length,E=(0,o.sub)(_?Liferay.Language.get("change-x"):Liferay.Language.get("select-x"),Liferay.Language.get("image"));return b===c.VIEWPORT_SIZES.desktop?i.default.createElement(i.default.Fragment,null,i.default.createElement(n.default.Group,null,i.default.createElement("label",{htmlFor:y},a),i.default.createElement(n.ClayInput.Group,{small:!0},i.default.createElement(n.ClayInput.GroupItem,null,i.default.createElement(n.ClayInput,{className:"page-editor__item-selector__content-input",id:y,onClick:()=>(0,s.openImageSelector)((e=>{p(e)})),placeholder:Liferay.Language.get("select-image"),readOnly:!0,sizing:"sm",value:C})),i.default.createElement(n.ClayInput.GroupItem,{shrink:!0},i.default.createElement(l.ClayButtonWithIcon,{"aria-label":E,displayType:"secondary",onClick:()=>(0,s.openImageSelector)((e=>{p(e)})),size:"sm",symbol:_?"change":"plus",title:E})),_&&i.default.createElement(i.default.Fragment,null,i.default.createElement(n.ClayInput.GroupItem,{shrink:!0},i.default.createElement(l.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("clear-selection"),displayType:"secondary",onClick:f,size:"sm",symbol:"times-circle",title:Liferay.Language.get("clear-selection")})))))):i.default.createElement(ReadOnlyImageInput,{imageTitle:t,label:a})};var l=a("@frontend-taglib-clay$clayui/button"),n=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]}a.default=e,t&&t.set(e,a);return a}(a("@frontend-taglib-clay$clayui/form")),r=a("frontend-js-components-web"),o=a("frontend-js-web"),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),c=a("../../app/config/constants/viewportSizes"),u=a("../../app/contexts/StoreContext"),d=a("../../app/selectors/selectPageContents"),s=a("../openImageSelector");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 ReadOnlyImageInput({imageTitle:e,label:t}){const a=(0,r.useId)();return i.default.createElement(i.default.Fragment,null,i.default.createElement("label",{htmlFor:a},t),i.default.createElement(n.default.Group,{small:!0},i.default.createElement(n.ClayInput,{className:"mb-2",disabled:!0,id:a,readOnly:!0,value:e})))}}}));
//# sourceMappingURL=ImageSelector.js.map