Liferay.Loader.define("@liferay/frontend-icons-web@1.0.18/js/pages/instance_settings/DeleteIconModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/loading-indicator","@frontend-taglib-clay$clayui/modal","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function DeleteIconModal({deleteIconsPackResourceURL:e,iconPackName:t,icons:a,onIconsChange:u,onVisibleChange:d,portletNamespace:f,selectedIcon:s,visible:p}){const[y,g]=(0,i.useState)(!1),{observer:b,onClose:m}=(0,o.useModal)({onClose:()=>{d(!1)}});return p?i.default.createElement(o.default,{observer:b,size:"lg"},i.default.createElement(o.default.Header,{withTitle:!0},Liferay.Language.get("add-icon-pack")),i.default.createElement(o.default.Body,null,i.default.createElement(n.default,{onSubmit:e=>{e.preventDefault()}},i.default.createElement(n.default.Group,null,i.default.createElement("label",{htmlFor:f+"name"},Liferay.Language.get("pack-name")),i.default.createElement(n.ClayInput,{name:f+"name",placeholder:Liferay.Language.get("name"),readOnly:!0,type:"text",value:t})),i.default.createElement(n.default.Group,null,i.default.createElement("label",{htmlFor:f+"icon"},Liferay.Language.get("icon-name")),i.default.createElement(n.ClayInput,{name:f+"icon",placeholder:Liferay.Language.get("icon"),readOnly:!0,type:"text",value:s})))),i.default.createElement(o.default.Footer,{last:i.default.createElement(r.default.Group,{spaced:!0},i.default.createElement(r.default,{disabled:y,displayType:"danger",onClick:()=>{(()=>{g(!0);const r=new FormData;r.append(f+"name",t),r.append(f+"icon",s),(0,c.fetch)(e,{body:r,method:"post"}).then((()=>{(0,c.openToast)({message:Liferay.Language.get("icon-deleted"),title:Liferay.Language.get("success"),toastProps:{autoClose:5e3},type:"success"});const e=a[t],r=_objectSpread(_objectSpread({},a),{},{[t]:_objectSpread(_objectSpread({},e),{},{icons:e.icons.filter((e=>e.name!==s))})});u(r),m()}))})()},type:"submit"},y?i.default.createElement(l.default,{className:"d-inline-block m-0",small:!0}):Liferay.Language.get("delete")),i.default.createElement(r.default,{displayType:"secondary",onClick:m},Liferay.Language.get("cancel")))})):null};var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/loading-indicator")),o=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),c=a("frontend-js-web"),i=_interopRequireWildcard(a("liferay!frontend-js-react-web$react"));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 n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(a),!0).forEach((function(t){_defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ownKeys(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}}}));
//# sourceMappingURL=DeleteIconModal.js.map