System.register(["./p-3c39d395.system.js"],function(e){"use strict";var t,n,r,i;return{setters:[function(e){t=e.r;n=e.h;r=e.H;i=e.g}],execute:function(){var u=e("bce_element_checkbox",function(){function e(e){var n=this;t(this,e);this.handleOption=function(e){if(!n.template)return;e.cancelBubble=true;var t=e.target;var r=t.value||[];var i=n.el.querySelector("bce-option bce-input");var u=i;n.value=r.map(function(e){var t=parseInt(e,10);var r=u&&t===n.template.options.length-1?u.value:n.template.options[t].text;return{index:t,text:r}});n.el.dispatchEvent(new Event("input",{bubbles:true}))};this.handleInput=function(e){e.cancelBubble=true;var t=Array.from(n.el.querySelectorAll("bce-option")||[]);var r=t[t.length-1];if(!r.checked)return;var i=e.target;n.value=n.value.slice(0,-1).concat([{index:parseInt(r.value,10),text:i.value}]);n.el.dispatchEvent(new Event("input",{bubbles:true}))}}e.prototype.renderOther=function(e,t){var r=this.value&&this.value[this.value.length-1];var i=r&&r.index===t?r.text:"";return n("bce-input",{placeholder:e.text,value:i||"",onInput:this.handleInput})};e.prototype.renderOption=function(e,t){if(!this.template)return null;var r=this.template.other&&t===this.template.options.length-1;return n("bce-option",{value:""+t},r?this.renderOther(e,t):e.text)};e.prototype.render=function(){var e=this;if(!this.template)return null;return n(r,{orientation:this.template.orientation},n("p",null,this.template.question),n("bce-input",{type:"checkbox",value:this.value&&this.value.map(function(e){return e.index+""}),validation:this.template.required?"required":"",onInput:this.handleOption},this.template.options.map(function(t,n){return e.renderOption(t,n)})))};Object.defineProperty(e.prototype,"el",{get:function(){return i(this)},enumerable:true,configurable:true});Object.defineProperty(e,"style",{get:function(){return"bce-element-checkbox p{font-weight:500;text-align:center}\@media screen and (min-width:1024px){bce-element-checkbox p{text-align:left}}bce-element-checkbox bce-option[type=checkbox][checked] bce-input[focus] input{border-color:var(--bce-color-n)}bce-element-checkbox bce-option[type=checkbox][checked] bce-input input{background-color:var(--bce-color-light-l);border:1px solid var(--bce-color-light-d)}bce-element-checkbox bce-option[type=checkbox] bce-input{margin:0;width:auto;min-width:200px}bce-element-checkbox bce-option[type=checkbox] bce-input input{margin:0;min-width:200px;border-radius:4px}"},enumerable:true,configurable:true});return e}())}}});