Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.105/admin/js/components/form-settings/FormSettingsModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,a){var r;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=(r=a("@frontend-taglib-clay$clayui/button"))&&r.__esModule?r:{default:r},l=i(a("@frontend-taglib-clay$clayui/modal")),o=a("data-engine-js-components-web"),s=i(a("liferay!frontend-js-react-web$react"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();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}var d=({children:e,onCloseFormSettings:t,prevPagesRef:a,serializedSettingsContext:r,undoPagesRef:u,visibleFormSettings:i})=>{const{spritemap:d}=(0,o.useConfig)(),{pages:f}=(0,o.useFormState)(),c=(0,o.useForm)();(0,s.useEffect)((()=>{if(r.value){const e=JSON.parse(r.value).pages;c({payload:e,type:o.EVENT_TYPES.PAGE.UPDATE}),a.current=e}r.value=JSON.stringify({pages:a.current})}),[c,a,r]);const{observer:p,onClose:y}=(0,l.useModal)({onClose:()=>{var e;u.current?(c({payload:a.current,type:o.EVENT_TYPES.PAGE.UPDATE}),r.value=JSON.stringify({pages:a.current})):r.value=JSON.stringify({pages:f});const n=null===(e=new o.PagesVisitor(f).findField((({fieldName:e})=>"showPartialResultsToRespondents"===e)))||void 0===e?void 0:e.value,l=document.querySelector(".lfr-ddm__show-partial-results-alert");n?l.classList.remove("lfr-ddm__show-partial-results-alert--hidden"):l.classList.add("lfr-ddm__show-partial-results-alert--hidden"),u.current=!0,t()}});return s.default.createElement(s.default.Fragment,null,i&&s.default.createElement(l.default,{className:"ddm-form-settings-modal",observer:p,spritemap:d},s.default.createElement(l.default.Header,null,Liferay.Language.get("settings")),s.default.createElement(l.default.Body,null,e),s.default.createElement(l.default.Footer,{last:s.default.createElement(n.default.Group,{key:1,spaced:!0},s.default.createElement(n.default,{displayType:"secondary",onClick:()=>{u.current=!0,y()}},Liferay.Language.get("cancel")),s.default.createElement(n.default,{displayType:"primary",onClick:()=>{a.current=f,u.current=!1,y()}},Liferay.Language.get("done")))})))};t.default=d}}));
//# sourceMappingURL=FormSettingsModal.js.map