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