import{s as I,ba as R,K as N,y as S,f as b,a5 as z,cX as k,cY as E,t as W,be as D,z as V,D as j,Q as G}from"./index-BPRWoLf4.js";var K=function(F){I(o,F);function o(e){var r=F.call(this,e)||this;r.renderInput=r.renderInput.bind(r);var n=e.body;return Array.isArray(n)&&(r.reaction=R(function(){return n.map(function(t){var i,d=N(t.id,e.data),u=N(t.name,e.data);return"".concat((i=e.statusStore.visibleState[d])!==null&&i!==void 0?i:e.statusStore.visibleState[u])}).join("-")},function(){return r.forceUpdate()})),r}return o.prototype.componentWillUnmount=function(){var e;(e=this.reaction)===null||e===void 0||e.call(this)},o.prototype.renderControl=function(e,r,n){var t=this.props,i=t.render,d=t.disabled;t.data;var u=t.mode,f=t.horizontal,l=t.formMode,m=t.formHorizontal,c=t.subFormMode,s=t.subFormHorizontal;if(!e)return null;var y=e;return i("".concat(r),y,S({disabled:e.disabled||d,formMode:c||u||l,formHorizontal:s||f||m},n))},o.prototype.renderVertical=function(e){var r=this;e===void 0&&(e=this.props);var n=e.body,t=e.className;e.style;var i=e.classnames,d=e.mode,u=e.formMode,f=e.data,l=e.statusStore;return u=d||u,Array.isArray(n)?b.createElement("div",{className:i("Form-group Form-group--ver Form-group--".concat(u),t)},n.map(function(m,c){var s;return z(m,f,l)?r.renderControl(m,c,{key:"".concat((s=m.name)!==null&&s!==void 0?s:"","-").concat(c)}):null})):null},o.prototype.renderHorizontal=function(e){var r=this;e===void 0&&(e=this.props);var n=e.body,t=e.className;e.style;var i=e.classPrefix,d=e.classnames,u=e.mode,f=e.horizontal,l=e.formMode,m=e.formHorizontal,c=e.subFormMode,s=e.subFormHorizontal,y=e.data,g=e.gap,M=e.statusStore;if(!Array.isArray(n))return null;l=c||u||l;var A=s||f||(m?k(m,n.filter(function(a){return(a==null?void 0:a.mode)!=="inline"&&z(a,y,M)}).length):void 0);return b.createElement("div",{className:d("Form-group Form-group--hor Form-group--".concat(l),g?"Form-group--".concat(g):"",t)},n.map(function(a,v){var h,_;if(!z(a,y,M))return null;var C=(a==null?void 0:a.mode)||l;if(C==="inline"||a!=null&&a.type&&["formula","hidden"].includes(a.type))return r.renderControl(a,v,{key:"".concat((h=a.name)!==null&&h!==void 0?h:"","-").concat(v),className:d(a.className,a.columnClassName)});var H=a.columnRatio||E(a&&a.columnClassName,!0);return b.createElement("div",{key:v,className:d("".concat(i,"Form-groupColumn"),H?"".concat(i,"Form-groupColumn--").concat(H):"",a&&a.columnClassName)},r.renderControl(a,v,{key:"".concat((_=a.name)!==null&&_!==void 0?_:"","-").concat(v),formHorizontal:A,formMode:C}))}))},o.prototype.renderInput=function(e){e===void 0&&(e=this.props);var r=e.direction;return r==="vertical"?this.renderVertical(e):this.renderHorizontal(e)},o.prototype.render=function(){var e=this.props,r=e.label,n=W(e,["label"]);return typeof r<"u"?b.createElement(D,S({},n,{sizeMutable:!1,label:r,renderControl:this.renderInput})):this.renderInput()},o=V([j({type:"group"}),G("design:paramtypes",[Object])],o),o}(b.Component);export{K as ControlGroupRenderer};
