Liferay.Loader.define("data-engine-js-components-web@1.0.79/js/utils/evaluation.es",["module","exports","require","frontend-js-web","./fetch.es","./visitors.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.mergeFieldOptions=u,t.mergePages=d,t.evaluate=function(e,t){return new Promise(((r,n)=>{p(e,t,((e,t)=>{if(e)return n(e);r(t)}))}))};var n=r("frontend-js-web"),a=r("./fetch.es"),o=r("./visitors.es");function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=themeDisplay.getPathContext()+"/o/dynamic-data-mapping-form-context-provider/";let c=null;function u(e,t){let r=l({},t.value);return Object.keys(r).forEach((t=>{r=l(l({},r),{},{[t]:r[t].map((r=>{const n=e.value&&e.value[t]&&e.value[t].find((({value:e})=>e===r.value));return l(l({},r),{},{edited:n&&n.edited})}))})})),r}function d(e,t,r,n,a,i){const s=new o.PagesVisitor(n),d=new o.PagesVisitor(a),c=new Map,p=new Map;return d.visitFields((e=>{c.set(e.name,e),p.set(e.fieldName,e)})),s.mapFields((n=>{var a,o;const s=null!==(a=null!==(o=c.get(n.name))&&void 0!==o?o:p.get(n.fieldName))&&void 0!==a?a:{};let d=n.valueChanged?n.value:s.value;n.visible!==s.visible&&n.visible&&i&&(d="");let g=l(l(l({},s),n),{},{defaultLanguageId:e,displayErrors:s.displayErrors||n.fieldName===r,editingLanguageId:t,valid:!1!==n.valid,value:d});return"options"===g.type&&(g=l(l({},g),{},{value:u(s,g)})),g.localizable&&(g=l(l({},g),{},{localizedValue:l({},s.localizedValue)})),g}),!1,!0)}const p=(0,n.debounce)(((t,r,n)=>{const{defaultLanguageId:o,editingLanguageId:i,formId:s,groupId:u,nextPage:p,pages:g,portletNamespace:f,previousPage:v,viewMode:b}=r;c&&c.abort(),window.AbortController&&(c=new AbortController),(0,a.makeFetch)({body:(0,a.convertToFormData)({languageId:i,p_auth:Liferay.authToken,p_l_id:themeDisplay.getPlid(),p_v_l_s_g_id:themeDisplay.getSiteGroupId(),portletNamespace:f,serializedFormContext:JSON.stringify(l(l({},r),{},{formId:s,groupId:u||themeDisplay.getScopeGroupId(),nextPage:p||null,portletNamespace:f,previousPage:v||null})),trigger:t}),signal:c&&c.signal,url:e}).then((e=>{const r=d(o,i,t,e,g,b);n(null,r)})).catch((e=>n(e)))}),600)}}));
//# sourceMappingURL=evaluation.es.js.map