Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/app/components/ManageAllowedFragmentModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../contexts/StoreContext","../thunks/updateItemConfig","./AllowedFragmentSelectorTree"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/modal")),l=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),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]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),o=a("../contexts/StoreContext"),i=_interopRequireDefault(a("../thunks/updateItemConfig")),u=_interopRequireDefault(a("./AllowedFragmentSelectorTree"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({item:e,observer:t,onClose:a})=>{const d=(0,o.useDispatch)(),[c,f]=(0,l.useState)(!0),[s,p]=(0,l.useState)(new Set([])),[m,g]=(0,l.useState)(),y=(0,l.useCallback)((({allowNewFragmentEntries:e,selectedFragments:t})=>{f(e),p(t)}),[]);return l.default.createElement(n.default,{className:"page-editor__allowed-fragment__modal",containerProps:{className:"cadmin"},observer:t,size:"md"},l.default.createElement(n.default.Header,null,Liferay.Language.get("allowed-fragments")),l.default.createElement(n.default.Body,{className:"p-0"},l.default.createElement("p",{className:"m-4 small text-secondary"},Liferay.Language.get("specify-which-fragments-a-page-author-is-allowed-to-use-within-the-drop-zone-when-creating-a-page-from-this-master")),l.default.createElement(u.default,{dropZoneConfig:e.config,onSelectedFragment:y})),l.default.createElement(n.default.Footer,{last:l.default.createElement(r.default.Group,{spaced:!0},l.default.createElement(r.default,{displayType:"secondary",onClick:a},Liferay.Language.get("cancel")),l.default.createElement(r.default,{displayType:"primary",onClick:()=>{g(!0),d((0,i.default)({itemConfig:{allowNewFragmentEntries:c,fragmentEntryKeys:[...s]},itemId:e.itemId})).then((()=>{g(!1),a()}))}},m&&l.default.createElement("span",{className:"inline-item inline-item-before"},l.default.createElement("span",{"aria-hidden":"true",className:"loading-animation"})),Liferay.Language.get("save")))}))};t.default=_default}}));
//# sourceMappingURL=ManageAllowedFragmentModal.js.map