Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.145/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","../../../core/hooks/useControlledState","../../../core/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[s,y]=(0,u.default)(p.href||""),[m,g]=(0,l.useState)(f);(0,l.useEffect)((()=>{(0,c.default)(p)?g(e):p.href&&g(f)}),[p]);const b=(0,i.useId)(),h=(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:h},t.label),l.default.createElement(r.ClaySelectWithOption,{id:h,onChange:e=>{a(t.name,{}),g(e.target.value)},options:d,value:m})),m===f&&l.default.createElement(r.default.Group,null,l.default.createElement("label",{htmlFor:b},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:b,onBlur:()=>handleChange({href:s}),onChange:e=>y(e.target.value),type:"text",value:s||""})),t.localizable&&l.default.createElement(r.ClayInput.GroupItem,{shrink:!0},l.default.createElement(n.default,null)))),m===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("../../../core/hooks/useControlledState")),i=a("../../../core/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