Liferay.Loader.define("data-engine-js-components-web@1.0.75/js/utils/fieldSets",["module","exports","require","./FormSupport.es","./constants","./fieldSupport","./settingsContext","./visitors.es"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.createFieldSet=function(t,n,r,s=[{columns:[{fields:[],size:12}]}]){const{defaultLanguageId:d,editingLanguageId:a,fieldNameGenerator:c,fieldTypes:p,portletNamespace:u}=t,{skipFieldNameGeneration:f,useFieldName:m}=n,g=(0,o.createField)({defaultLanguageId:d,editingLanguageId:a,fieldNameGenerator:c,fieldType:p.find((({name:e})=>e===i.FIELD_TYPE_FIELDSET)),portletNamespace:u,skipFieldNameGeneration:f,useFieldName:m});return e({field:l(l({},g),{},{rows:s,style:{}}),indexes:{columnIndex:0,pageIndex:0,rowIndex:0},nestedFields:r,props:t})};var r=n("./FormSupport.es"),i=n("./constants"),o=n("./fieldSupport"),s=n("./settingsContext"),d=n("./visitors.es");function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const e=({field:e,indexes:t,nestedFields:n,props:i})=>{let a=[{rows:e.rows}];new d.PagesVisitor(a).mapFields(((e,t,i,o,s)=>{n.some((t=>t.fieldName===e.fieldName))||(a=(0,r.removeFields)(a,s,o,i))})),[...n].reverse().forEach((e=>{e.instanceId||(e.instanceId=(0,o.generateInstanceId)()),a=(0,r.addFieldToColumn)(a,t.pageIndex,t.rowIndex,t.columnIndex,e.fieldName)})),e=(0,s.updateField)(i,e,"nestedFields",n);const{rows:c}=a[t.pageIndex];return l(l({},(0,s.updateField)(i,e,"rows",c)),{},{nestedFields:n,rows:c})}}}));
//# sourceMappingURL=fieldSets.js.map