Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/FieldSet/FieldSet.es",["module","exports","require","./FieldSet.scss","data-engine-js-components-web","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","./Panel.es"],(function(e,t,r){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,r("./FieldSet.scss");var a=r("data-engine-js-components-web"),l=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var l=n?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(r,a,l):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("../FieldBase/ReactFieldBase.es"),s=(n=r("./Panel.es"))&&n.__esModule?n:{default:n};function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function u(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 f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(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=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return[]}return e},y=(t,r)=>e(t).map((e=>f(f({},e),{},{columns:e.columns.map((e=>f(f({},e),{},{fields:r.filter((t=>e.fields.includes(t.fieldName)))})))})));var b=e=>{let{collapsible:t,ddmStructureId:r,label:n,name:i,nestedFields:u=[],readOnly:f,repeatable:p,rows:b,showLabel:m,type:O}=e,w=d(e,["collapsible","ddmStructureId","label","name","nestedFields","readOnly","repeatable","rows","showLabel","type"]),j=!1,g=null;const v="fieldset"===O&&!r,{editable:P,page:h}=(0,a.usePage)(),E=(0,l.useMemo)((()=>(0,a.getRepeatedIndex)(i)),[i]),F=e=>null==e?void 0:e.find((e=>(j||(j=!!e.ddmStructureId),e.name===i?e:F(e.nestedFields))));return v&&h.rows.forEach((e=>{e.columns.forEach((e=>{g||(j=!1,g=F(e.fields))}))})),l.default.createElement(o.FieldBase,c({},w,{name:i,readOnly:f,repeatable:!t&&p,required:!1,showLabel:!1,tip:null,type:O}),l.default.createElement("div",{className:"ddm-field-types-fieldset__nested"},m&&!t&&l.default.createElement(l.default.Fragment,null,l.default.createElement("label",{className:"text-uppercase"},n),l.default.createElement("div",{className:"ddm-field-types-fieldset__nested-separator"},l.default.createElement("hr",{className:"mt-1 separator"}))),t?l.default.createElement(s.default,{name:i,readOnly:f,repeatable:p,showLabel:m,showRepeatableRemoveButton:p&&E>0,title:n},l.default.createElement(a.Layout,{editable:P?v&&!j:P,rows:y(b,u)})):l.default.createElement(a.Layout,{editable:P?v&&!j:P,rows:y(b,u)})))};t.default=b}}));
//# sourceMappingURL=FieldSet.es.js.map