import{a as M,C as L,k as V,b as u,m as l,g as o,p as t,q as r,f as O,L as W,n as Z,D as c,u as a,K as w,F as I,H as P,I as S}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import{c as R,u as E,n as H,d as G,a as N,o as z}from"./widget-BUAABBRb.js";import{c as U}from"./ThankYouPage-bf4cLsjC.js";import{_ as j}from"./RequiredHint.vue_vue_type_style_index_0_lang-R4Bqx90z.js";import{u as Y}from"./translationsStore-DBJu9sBR.js";import{_ as J}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./index-CEuXXsrq.js";const y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyBAMAAADsEZWCAAAAAXNSR0IB2cksfwAAACpQTFRFAAAA7vH47vL27vH37vH37vD47vH44+fu1tvj3+Pr3+Pq5env7vH37vD4a97ZqgAAAA50Uk5TAGrQ//5pz////////Wi7cMjRAAAApklEQVR4nGNgVDbGBpwCGISxShgbmzJg12JsbMaAQ8LYBKeM8agMhTLmnWBqxWYMGYuOyUDSqqMZQ8ayA6RpBVgezZ4ZQEGrjk4sLgBpQtKC7LYZHbOQtCDLWHZ0IGlB8c8MZC0oMitwyVjhNG1Fx0zsLgD5ZQZWV4P8YonNpxDvz8ASOpAQtcQSorhjAQOMypAp44xDwgZPiRSMQ8aWgTUHq4TbBQCzQBLHTuhWZAAAAABJRU5ErkJggg==",K={class:"ccb-field__label"},$={class:"ccb-field__title"},X={key:0,class:"ccb-field-required-mark"},ee={key:0,class:"ccb-field__descriptions ccb-before"},se={key:0,class:"ccb-field__description"},te={class:"ccb-dropdown"},ae={key:0,class:"ccb-dropdown__label"},oe=["src"],ie={key:1,class:"ccb-dropdown__label"},le=["src"],ce={class:"ccb-dropdown__list"},ne=["src"],re=["onClick"],de=["src"],ue={class:"ccb-dropdown--option"},pe={class:"ccb-dropdown--option-label"},_e={key:0,class:"ccb-dropdown--option-converted"},ve={key:1,class:"ccb-field__descriptions ccb-after"},ge={key:0,class:"ccb-field__description"},Ae=M({__name:"ImageDropdown",props:{field:{}},setup(B){const C=B,{field:e}=L(C),p=R(),D=z(),b=E(),A=Y(),d=V(!1),x=H(),Q=G(),_=V(null),T=u(()=>{var i;return((i=N().getWarningTexts)==null?void 0:i.requiredMsg)||""}),m=()=>{d.value?document.removeEventListener("click",f):document.addEventListener("click",f),d.value=!d.value},f=s=>{_.value&&"contains"in _.value&&!_.value.contains(s.target)&&(d.value=!1,document.removeEventListener("click",f))},k=(s,i=!0)=>{var n;if((s==null?void 0:s.optionValue)!==((n=v.value)==null?void 0:n.optionValue)){let g=0;s!=null&&s.optionValue&&e.value.summaryView!=="show_label_not_calculable"&&(g=+(s==null?void 0:s.optionValue).split("_")[0]||0),e.value.selectedOption=s,e.value.value=g,e.value.displayValue=D.getMultipleOptionsFieldDisplayView(e.value),p.updateField(e.value.alias,e.value),x.applyConditionForField(e.value.alias),p.getPageBreakEnabled&&p.getActivePage.action==="not_skip"&&Q.checkPageFieldsConditions()}i&&m()},v=u(()=>e.value.selectedOption),q=u(()=>{var s;return(s=e.value.options)==null?void 0:s.map(i=>({...i}))}),h=u(()=>p.checkFieldRequired(e.value)),F=u(()=>{var s;return((s=e.value)==null?void 0:s.additionalStyles)||""});return(s,i)=>(o(),l("div",{class:S(["ccb-field ccb-dropdown-img-field",{active:d.value,required:h.value,"ccb-field-disabled":a(e).disabled,[F.value]:!0}])},[t("div",K,[h.value?(o(),O(j,{key:0,text:T.value},null,8,["text"])):r("",!0),t("div",$,[W(c(a(e).label),1),a(e).required?(o(),l("span",X,"*")):r("",!0),Z(U)])]),a(b).getAppearanceDescriptionPosition==="before"?(o(),l("div",ee,[a(e).description?(o(),l("div",se,c(a(e).description),1)):r("",!0)])):r("",!0),t("div",{class:"ccb-field__input-wrapper",ref_key:"dropdownWrapper",ref:_},[t("div",te,[t("div",{class:"ccb-dropdown__input",onClick:m},[v.value?(o(),l("div",ie,[t("img",{src:v.value.src,alt:"selected-image"},null,8,le),t("span",null,c(v.value.optionText),1)])):(o(),l("div",ae,[t("img",{src:a(y),alt:"#"},null,8,oe),t("span",null,c(a(A).getTranslations.selectValue),1)])),i[1]||(i[1]=t("span",{class:"ccb-dropdown__icon"},[t("i",{class:"ccb-icon-Path-3485"})],-1))]),t("div",ce,[t("ul",null,[t("li",{onClick:i[0]||(i[0]=w(()=>k(void 0,!0),["prevent"]))},[t("img",{src:a(y),alt:""},null,8,ne),t("span",null,c(a(A).getTranslations.selectValue),1)]),(o(!0),l(I,null,P(q.value,(n,g)=>(o(),l("li",{key:n.optionValue,onClick:w(()=>k(n),["prevent"]),class:S({"ccb-option-disabled":a(e).disableOptions.includes(g)})},[t("img",{src:n.src,alt:"#"},null,8,de),t("span",ue,[t("span",pe,c(n.optionText),1),a(e).showValueInOption?(o(),l("span",_e,c(a(A).getTranslations.price)+": "+c(n.optionConverted),1)):r("",!0)])],10,re))),128))])])])],512),a(b).getAppearanceDescriptionPosition==="after"?(o(),l("div",ve,[a(e).description?(o(),l("div",ge,c(a(e).description),1)):r("",!0)])):r("",!0)],2))}}),Ce=J(Ae,[["__scopeId","data-v-58b26bf3"]]);export{Ce as default};
//# sourceMappingURL=index-CVbcCAoK.js.map
