Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.156/page_editor/app/components/fragment_configuration_fields/URLField",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../common/components/CurrentLanguageFlag","../../../common/components/LayoutSelector","../../../common/hooks/useControlledState","../../../common/hooks/useId","../../../prop_types/index","../../utils/editable_value/isMappedToLayout"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function URLField({field:t,onValueSelect:a,value:p}){const[m,s]=(0,u.default)(p.href||""),[y,g]=(0,l.useState)(f);(0,l.useEffect)((()=>{(0,c.default)(p)?g(e):p.href&&g(f)}),[p]);const _=(0,i.useId)(),b=(0,i.useId)(),handleChange=e=>{a(t.name,e)};return l.default.createElement(l.default.Fragment,null,l.default.createElement(r.default.Group,{small:!0},l.default.createElement("label",{htmlFor:b},t.label),l.default.createElement(r.ClaySelectWithOption,{id:b,onChange:e=>{a(t.name,{}),g(e.target.value)},options:d,value:y})),y===f&&l.default.createElement(r.default.Group,null,l.default.createElement("label",{htmlFor:_},Liferay.Language.get("url")),l.default.createElement(r.ClayInput.Group,{small:!0},l.default.createElement(r.ClayInput.GroupItem,null,l.default.createElement(r.ClayInput,{id:_,onBlur:()=>handleChange({href:m}),onChange:e=>s(e.target.value),type:"text",value:m||""})),t.localizable&&l.default.createElement(r.ClayInput.GroupItem,{shrink:!0},l.default.createElement(n.default,null)))),y===e&&l.default.createElement(o.LayoutSelector,{mappedLayout:null==p?void 0:p.layout,onLayoutSelect:e=>{e&&Object.keys(e).length?handleChange({layout:e}):handleChange({})}}))};var r=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),l=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react"))),n=_interopRequireDefault(a("../../../common/components/CurrentLanguageFlag")),o=a("../../../common/components/LayoutSelector"),u=_interopRequireDefault(a("../../../common/hooks/useControlledState")),i=a("../../../common/hooks/useId"),c=(a("../../../prop_types/index"),_interopRequireDefault(a("../../utils/editable_value/isMappedToLayout")));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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}const e="fromLayout",f="manual",d=[{label:Liferay.Language.get("url"),value:f},{label:Liferay.Language.get("page"),value:e}]}}));
//# sourceMappingURL=URLField.js.map