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