import{r as t,h as s,g as e}from"./p-fdd3ce28.js";import"./p-f1210c25.js";import"./p-fd8baa6a.js";import"./p-c3e4abe9.js";import{v as i}from"./p-29ab64f2.js";const r=class{constructor(s){t(this,s),this.handleClick=t=>{const s=t.target;if(!s||!this.template)return;this.value=parseInt(s.parentElement.dataset.index,10);const e=new Event("input",{bubbles:!0,composed:!0});this.el.dispatchEvent(e)}}async validate(t=!1){if(!this.template||!this.template.required)return[];const s=await i.validateRule("required",[],this.value,{el:this.el,tag:this.el.tagName.toLocaleLowerCase()});return this.error=s&&!t?s.message:"",s?[s]:[]}render(){if(this.template)return[s("p",null,this.handler.t("question")),s("div",null,this.template.options.map((t,e)=>s("bce-button",{"data-index":e,"data-checked":this.value===e,onClick:this.handleClick},s("bce-icon",{raw:t.text,style:{color:t.color}})))),this.error&&s("small",null,this.error)]}get el(){return e(this)}static get style(){return":host{position:relative;display:block;margin:20px 0}:host p{font-weight:500;text-align:center}\@media screen and (min-width: 1024px){:host p{text-align:left}}:host>div{display:-ms-flexbox;display:flex;-ms-flex-flow:column wrap;flex-flow:column wrap;-ms-flex-pack:center;justify-content:center}:host bce-button{--bce-c300:var(--bce-c300-light);--bce-c400:var(--bce-c400-light);--bce-c500:var(--bce-c500-light);--bce-c600:var(--bce-c600-light);--bce-c700:var(--bce-c700-light);--bce-con1:var(--bce-con1-light);--bce-con2:var(--bce-con2-light);--bce-con3:var(--bce-con3-light);--bce-con4:var(--bce-con4-light);-ms-flex:0 0 auto;flex:0 0 auto;margin:8px;-webkit-transition:-webkit-transform 0.2s ease-in-out;transition:-webkit-transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out;transition:transform 0.2s ease-in-out, -webkit-transform 0.2s ease-in-out;height:68px}:host bce-button[data-checked]{-webkit-transform:scale(1.2);transform:scale(1.2)}:host bce-button bce-icon{display:-ms-flexbox;display:flex;width:100%;font-size:44px;-ms-flex-pack:center;justify-content:center}:host>small{position:absolute;font-size:12px;bottom:-16px;left:12px;text-align:left;-webkit-transition:left 0.15s cubic-bezier(0.4, 0, 0.2, 1);transition:left 0.15s cubic-bezier(0.4, 0, 0.2, 1);color:var(--bce-c500-error)}:host>small:before{content:\"\";position:absolute;left:-6px;font-weight:100}\@media screen and (min-width: 600px){:host>div{-ms-flex-flow:row wrap;flex-flow:row wrap}}\@media screen and (min-width: 1024px){:host>div{-ms-flex-pack:start;justify-content:flex-start}}"}};export{r as bce_element_icon};