import{r as t,e as s,h as e,f as i,g as h}from"./p-15c07fa9.js";import{ElementIDUtils as l}from"@sankhyalabs/core";import{F as a}from"./p-ff1990ad.js";import{E as o}from"./p-1a68fb59.js";const r=class{constructor(e){t(this,e),this.valueChanged=s(this,"valueChanged",7),this._noOptionValue="NO_VALUE",this._radioButtonValue=void 0,this.value=void 0,this.config=void 0,this.presentationMode=o.CHIP,this.errorMessage=void 0}isSelected(t){return null==this.value||this.value===t}ezChangeListener(t){if(this.errorMessage=void 0,this.presentationMode===o.MODAL)return t.detail||this.assertCheckedOption(t.target),void this.updateValue();this.value=t.detail===this._noOptionValue?void 0:t.detail,this._radioButtonValue=t.detail}async resetValues(){this.ezChangeListener({detail:this._noOptionValue})}async clearValue(){this.value=this.config.value,this._radioButtonValue=this.value||this._noOptionValue}async setFocus(){this.presentationMode!==o.MODAL?this._element.querySelector("ez-radio-button").focus():this._checkOne.setFocus()}assertCheckedOption(t){t===this._checkOne?this._checkTwo.value=!0:this._checkOne.value=!0}updateValue(){if(this._checkOne.value&&this._checkTwo.value)this.value=void 0;else{const[t,s]=this.config.props.options;this.value=this._checkOne.value?t.name:s.name}this.valueChanged.emit(this.value)}setRadioValue(){this._radioButtonValue=this.value||this._noOptionValue}componentDidLoad(){this._element&&l.addIDInfo(this._element,"filterContentEditor")}componentWillLoad(){this.setRadioValue()}componentShouldUpdate(){this.setRadioValue()}disconnectedCallback(){this.value=this.config.value}render(){if(!this.config||this.config.type!==a.BINARY_SELECT)return;const[t,s]=this.config.props.options;return e(i,null,this.presentationMode===o.MODAL?e("div",{class:"ez-row ez-size-height--full"},e("label",{class:"ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4"},this.config.detailModal),e("div",{class:"ez-col ez-col--sd-4"},e("ez-check",{ref:t=>this._checkOne=t,id:`${this.config.id}_${t.name||"option1"}`,class:"sc-snk-filter-bar editor__ez-check",label:t.label,enabled:this.config.enabled,value:this.isSelected(t.name)})),e("div",{class:"ez-col ez-col--sd-4"},e("ez-check",{ref:t=>this._checkTwo=t,id:`${this.config.id}_${s.name||"option2"}`,class:"sc-snk-filter-bar editor__ez-check",label:s.label,enabled:this.config.enabled,value:this.isSelected(s.name)})),this.errorMessage&&e("span",{class:"ez-text ez-text--small ez-text--error ez-margin--small"},this.errorMessage)):e("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},e("ez-radio-button",{value:this._radioButtonValue},e("ez-radio-button-option",{id:`${this.config.id}_${t.name||"option1"}`,class:"sc-snk-filter-bar editor__ez-check",label:t.label,value:t.name}),e("ez-radio-button-option",{id:`${this.config.id}_${s.name||"option2"}`,class:"sc-snk-filter-bar editor__ez-check",label:s.label,value:s.name}),e("ez-radio-button-option",{id:`${this.config.id}_option3`,class:"sc-snk-filter-bar editor__ez-check",label:`${t.label} + ${s.label}`,value:this._noOptionValue})),this.errorMessage&&e("span",{class:"ez-text ez-text--small ez-text--error ez-margin--small"},this.errorMessage)))}get _element(){return h(this)}};export{r as snk_filter_binary_select}