Liferay.Loader.define("@liferay/frontend-icons-web@1.0.18/js/pages/site_settings/AddIconPackModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/card","@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 AddIconPackModal({icons:e,onSelectedPacksChange:t,onVisibleChange:a,portletNamespace:u,saveSiteSettingsURL:f,selectedPacks:s,visible:y}){const g=Object.keys(e),[p,b]=(0,d.useState)(!1),[m,_]=(0,d.useState)(s),{observer:v,onClose:h}=(0,c.useModal)({onClose:()=>{a(!1)}});return y?d.default.createElement(c.default,{observer:v,size:"lg"},d.default.createElement(c.default.Header,{withTitle:!0},Liferay.Language.get("add-icon-pack")),d.default.createElement(c.default.Body,null,d.default.createElement(r.default,{onSubmit:e=>{e.preventDefault()}},d.default.createElement(r.default.Group,null,d.default.createElement("div",{className:"row"},g.map(((e,t)=>d.default.createElement("div",{className:"col-md-4",key:t},d.default.createElement(n.ClayCardWithHorizontal,{onSelectChange:()=>{const t=m.includes(e)?m.filter((t=>t!==e)):[...m,e];_(t)},selected:m.includes(e),title:e})))))))),d.default.createElement(c.default.Footer,{last:d.default.createElement(l.default.Group,{spaced:!0},d.default.createElement(l.default,{disabled:p||!m.length,onClick:()=>{(()=>{b(!0);const e=new FormData;e.append(u+"selectedIconPacks",m.toString()),(0,o.fetch)(f,{body:e,method:"post"}).then((()=>{b(!1),(0,o.openToast)({message:Liferay.Language.get("icon-packs-saved"),title:Liferay.Language.get("success"),toastProps:{autoClose:5e3},type:"success"}),t(m),h()}))})()},type:"submit"},p?d.default.createElement(i.default,{className:"d-inline-block m-0",small:!0}):Liferay.Language.get("save")),d.default.createElement(l.default,{displayType:"secondary",onClick:h},Liferay.Language.get("cancel")))})):null};var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=a("@frontend-taglib-clay$clayui/card"),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/form")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/loading-indicator")),c=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/modal")),o=a("frontend-js-web"),d=_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={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=AddIconPackModal.js.map