var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++){if(a||!(r in t)){if(!a)a=Array.prototype.slice.call(t,0,r);a[r]=t[r]}}return e.concat(a||Array.prototype.slice.call(t))};System.register(["./p-5e377a26.system.js"],(function(e){"use strict";var t,n,r,i;return{setters:[function(e){t=e.r;n=e.c;r=e.h;i=e.H}],execute:function(){var a="dvn-field-input-sub-form{display:block}dvn-field-input-sub-form .form-container{margin-top:calc(4 * var(--spacing-unit));position:relative}dvn-field-input-sub-form .form-container.separated{border:1px solid var(--color-border);padding:calc(4 * var(--spacing-unit));border-radius:var(--corner-radius)}dvn-field-input-sub-form .form-container .remove-input-button i,dvn-field-input-sub-form .form-container .add-input-button i{line-height:1rem}dvn-field-input-sub-form .form-container .remove-input-button{position:absolute;top:6px;left:-8px}dvn-field-input-sub-form doldurma-form{--form-min-height:0px}";var o=e("dvn_field_input_sub_form",function(){function e(e){var r=this;t(this,e);this.change=n(this,"change",7);this.getParentValue=function(){return r.value||new Array(r.field.minCount).fill(undefined)}}e.prototype.componentWillLoad=function(){if(this.field.maxCount===1){return}this.subFormKeys=this.getParentValue().map((function(){return"".concat(Math.random())}))};e.prototype.render=function(){var e=this;var t=this,n=t.field,a=t.errors,o=t.subFormKeys,u=t.value;var s=a&&a.length>0;var l=s?a[0]:undefined;if(n.maxCount===1){var d=n.fields.map((function(e){return Object.assign(Object.assign({},e),{value:(u||{})[e.id]})}));return r(i,null,r("div",{class:{"form-container":true,separated:n.separated}},r("doldurma-form",{fields:d,layout:n.layout,onChange:function(t){t.stopImmediatePropagation();e.change.emit(t.detail)}})),r("div",null,l))}var c=this.getParentValue();return r(i,null,c.map((function(t,i){var a=t?n.fields.map((function(e){return Object.assign(Object.assign({},e),{value:t[e.id]})})):n.fields;return r("div",{key:o[i],class:{"form-container":true,separated:n.separated}},r("doldurma-form",{fields:a,layout:n.layout,onChange:function(t){t.stopImmediatePropagation();var n=__spreadArray([],c,true);n[i]=t.detail;e.change.emit(n)}}),c.length>n.minCount&&r("dvn-button",{class:"remove-input-button",shape:"circle",scale:"x-small",tint:"danger",leaned:true,onClick:function(t){t.stopImmediatePropagation();e.subFormKeys=o.filter((function(e,t){return t!==i}));e.change.emit(c.filter((function(e,t){return t!==i})))}},r("i",{class:"uil uil-minus"})))})),c.length<n.maxCount&&r("dvn-button",{class:"add-input-button",shape:"circle",view:"flat",scale:"small",leaned:true,onClick:function(t){t.stopImmediatePropagation();e.subFormKeys=__spreadArray(__spreadArray([],o,true),["".concat(Math.random())],false);e.change.emit(__spreadArray(__spreadArray([],c,true),[undefined],false))}},r("i",{class:"uil uil-plus"})),r("div",null,l))};return e}());o.style=a}}}));