var __spreadArray=this&&this.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,a;r<i;r++){if(a||!(r in e)){if(!a)a=Array.prototype.slice.call(e,0,r);a[r]=e[r]}}return t.concat(a||Array.prototype.slice.call(e))};System.register(["./p-343b3b10.system.js"],(function(t){"use strict";var e,n,r,i;return{setters:[function(t){e=t.r;n=t.c;r=t.h;i=t.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=t("dvn_field_input_sub_form",function(){function t(t){var r=this;e(this,t);this.change=n(this,"change",7);this.getParentValue=function(){return r.value||new Array(r.field.minCount).fill(undefined)}}t.prototype.componentWillLoad=function(){if(this.field.maxCount===1){return}this.subFormKeys=this.getParentValue().map((function(){return"".concat(Math.random())}))};t.prototype.render=function(){var t=this;var e=this,n=e.field,a=e.errors,o=e.subFormKeys,u=e.value;var s=a&&a.length>0;var l=s?a[0]:undefined;if(n.maxCount===1){var d=n.fields.map((function(t){return Object.assign(Object.assign({},t),{value:(u||{})[t.id]})}));return r(i,null,r("div",{class:{"form-container":true,separated:n.separated}},r("doldurma-form",{fields:d,layout:n.layout,onChange:function(e){e.stopImmediatePropagation();t.change.emit(e.detail)}})),r("div",null,l))}var c=this.getParentValue();return r(i,null,c.map((function(e,i){var a=e?n.fields.map((function(t){return Object.assign(Object.assign({},t),{value:e[t.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(e){e.stopImmediatePropagation();var n=__spreadArray([],c,true);n[i]=e.detail;t.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(e){e.stopImmediatePropagation();t.subFormKeys=o.filter((function(t,e){return e!==i}));t.change.emit(c.filter((function(t,e){return e!==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(e){e.stopImmediatePropagation();t.subFormKeys=__spreadArray(__spreadArray([],o,true),["".concat(Math.random())],false);t.change.emit(__spreadArray(__spreadArray([],c,true),[undefined],false))}},r("i",{class:"uil uil-plus"})),r("div",null,l))};return t}());o.style=a}}}));