import{n as s}from"./chunk-HWGAVAUA.js";import"./chunk-YYX6ZCUM.js";import{c as n}from"./chunk-EQKTRDAQ.js";import"./chunk-MM5QLNJM.js";import"./chunk-72KDLSWN.js";import"./chunk-OBXDPQ3V.js";import"./chunk-TKIBDTVT.js";import"./chunk-MCRJI3T3.js";import{c as b}from"./chunk-QZDXILNC.js";import{b as l,f as i,g as d,i as m,k as h}from"./chunk-VAPGY3BN.js";import"./chunk-OYAVQN5W.js";var p=".sc-ion-select-modal-ionic-h{height:100%}ion-list.sc-ion-select-modal-ionic ion-radio.sc-ion-select-modal-ionic::part(container){display:none}ion-list.sc-ion-select-modal-ionic ion-radio.sc-ion-select-modal-ionic::part(label){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-item.sc-ion-select-modal-ionic{--inner-border-width:0}.item-radio-checked.sc-ion-select-modal-ionic{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08);--background-focused:var(--ion-color-primary, #0054e9);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #0054e9);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-modal-ionic{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #0054e9)}",u=p,f='.sc-ion-select-modal-ios-h{height:100%}ion-item.sc-ion-select-modal-ios{--inner-padding-end:0}ion-radio.sc-ion-select-modal-ios::after{bottom:0;position:absolute;width:calc(100% - 0.9375rem - 16px);border-width:0px 0px 0.55px 0px;border-style:solid;border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))));content:""}ion-radio.sc-ion-select-modal-ios::after{inset-inline-start:calc(0.9375rem + 16px)}',k=f,g=".sc-ion-select-modal-md-h{height:100%}ion-list.sc-ion-select-modal-md ion-radio.sc-ion-select-modal-md::part(container){display:none}ion-list.sc-ion-select-modal-md ion-radio.sc-ion-select-modal-md::part(label){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-item.sc-ion-select-modal-md{--inner-border-width:0}.item-radio-checked.sc-ion-select-modal-md{--background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08);--background-focused:var(--ion-color-primary, #0054e9);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #0054e9);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-modal-md{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #0054e9)}",v=g,F=(()=>{let a=class{constructor(o){l(this,o),this.header=void 0,this.multiple=void 0,this.options=[]}closeModal(){let o=this.el.closest("ion-modal");o&&o.dismiss()}findOptionFromEvent(o){let{options:e}=this;return e.find(t=>t.value===o.target.value)}getValues(o){let{multiple:e,options:t}=this;if(e)return t.filter(c=>c.checked).map(c=>c.value);let r=o?this.findOptionFromEvent(o):null;return r?r.value:void 0}callOptionHandler(o){let e=this.findOptionFromEvent(o),t=this.getValues(o);e!=null&&e.handler&&s(e.handler,t)}setChecked(o){let{multiple:e}=this,t=this.findOptionFromEvent(o);e&&t&&(t.checked=o.detail.checked)}renderRadioOptions(){let o=this.options.filter(e=>e.checked).map(e=>e.value)[0];return i("ion-radio-group",{value:o,onIonChange:e=>this.callOptionHandler(e)},this.options.map(e=>i("ion-item",{lines:"none",class:Object.assign({"item-radio-checked":e.value===o},n(e.cssClass))},i("ion-radio",{value:e.value,disabled:e.disabled,justify:"start",labelPlacement:"end",onClick:()=>this.closeModal(),onKeyUp:t=>{t.key===" "&&this.closeModal()}},e.text))))}renderCheckboxOptions(){return this.options.map(o=>i("ion-item",{class:Object.assign({"item-checkbox-checked":o.checked},n(o.cssClass))},i("ion-checkbox",{value:o.value,disabled:o.disabled,checked:o.checked,justify:"start",labelPlacement:"end",onIonChange:e=>{this.setChecked(e),this.callOptionHandler(e),h(this)}},o.text)))}render(){return i(d,{key:"4df42c447b4026d09d9231f09dc4bdae9a8cfe4a",class:b(this)},i("ion-header",{key:"211c4e869b858867f3d60637e570aeb01de41de7"},i("ion-toolbar",{key:"dc4b151331aecbaaaafb460802ee9b689493601d"},this.header!==void 0&&i("ion-title",{key:"ba1347a59ae0a5c6770c239b5ec02a536a445bd1"},this.header),i("ion-buttons",{key:"43c98fd25d7e7f54b94b24e53535c6d5ba599892",slot:"end"},i("ion-button",{key:"51b2b3f3eed42637b2cfc213c95d0bcf10e4b89d",onClick:()=>this.closeModal()},"Close")))),i("ion-content",{key:"fe721b09f80555856211f7e40dbfc31a533acae1"},i("ion-list",{key:"d0b932d137136958d896408fb2fa571023775b92"},this.multiple===!0?this.renderCheckboxOptions():this.renderRadioOptions())))}get el(){return m(this)}};return a.style={ionic:u,ios:k,md:v},a})();export{F as ion_select_modal};
