1import{_ as f,C as w,y as p}from"./app.js";import"./swiper.js";const g=window.Vue.nextTick,b={name:"ArabellaPoll",components:{CmmsResponsiveImage:w},data:function(){return{selectedAnswer:null,public:!1,closed:!1,submitted:!1,error:!1,success:!1,voted:!1,results:null,nonce:null,captcha:null,hasCaptcha:null,passedCaptcha:!1,captchaResponse:null,popupVisible:!1}},props:["element"],computed:{radioButtonName:function(){return"cmms_poll_answer_".concat(this.element.data.poll.id)},localStorageKey:function(){return"poll_"+this.element.data.poll.id}},methods:{selectAnswer:function(e){this.requestNonce(),this.selectedAnswer=e},requestNonce:function(){this.nonce===null&&!this.voted&&(this.nonce=!1,p.get("/cmms-api-v2/cmms-poll/nonce/".concat(this.element.data.poll.id,"/")).then(e=>{e.data&&e.data.nonce&&(this.nonce=e.data.nonce)}).catch(e=>{e.response||console.debug(e)}))},setPopup(e,t="validation"){this.popupText=e,this.popupType=t,this.popupVisible=this.popupText!==""},submitVote:function(e=!0){if(this.selectedAnswer!==null){if(this.hasCaptcha&&!this.passedCaptcha){this.setPopup("Das Captcha wurde noch nicht ausgeführt.");return}if(this.nonce===!1&&e===!0){setTimeout(()=>{this.submitVote(!1)},1e3);return}this.submitted=!0,this.voted?this.getResults():p.post("/cmms-api-v2/cmms-poll/vote/".concat(this.element.data.poll.id,"/"),{answer_id:this.selectedAnswer,nonce:this.nonce,"h-captcha-response":this.captchaResponse}).then(t=>{t.status===200||t.status===204?(this.success=!0,this.voted=!0,t.data.results&&(this.results=t.data.results),window.localStorage.setItem(this.localStorageKey,"1")):this.error=!0}).catch(t=>{t.data==="captcha-error"&&(this.voted=!1,this.submitted=!0,this.error=!0),t.response||console.debug(t)})}},getResults(){window.isDynamicRenderer||this.public&&p.get("/cmms-api-v2/cmms-poll/results/".concat(this.element.data.poll.id,"/")).then(e=>{e.data.results&&(this.results=e.data.results)}).catch(e=>{e.response||console.debug(e)})}},mounted(){this.public=this.element.data.poll.public,this.closed=this.element.data.poll.closed,this.voted=parseInt(window.localStorage.getItem(this.localStorageKey),10)===1,this.element.data.poll.results?this.results=this.element.data.poll.results:this.public&&this.voted&&this.getResults(),this.hasCaptcha=this.element.data.poll.hasCaptcha==="1",g(()=>{if(this.hasCaptcha){this.$refs.captcha.setAttribute("data-explicit","1"),this.$refs.captcha.innerHTML="<small>Bitte akzeptieren Sie den Service hCaptcha, um das Formular zu benutzen. Sie können diesem Dienst in den <a onclick=\"window['UC_UI'].showSecondLayer()\">Privatsphäre-Einstellungen</a> zustimmen.</small>";let e="hca"+Date.now();if(window[e]=t=>{console.log("CALLBACK RESPONSE"),console.log(t),t&&t.length&&(this.captchaResponse=t,this.passedCaptcha=!0,this.popupVisible=!1)},this.$refs.captcha.setAttribute("data-callback",e),this.$refs.captcha.getAttribute("data-explicit"))try{console.log("try render"),hcaptcha.render(this.$refs.captcha)}catch(t){console.log(t)}}})}},v=window.Vue.resolveComponent,_=window.Vue.createVNode,s=window.Vue.openBlock,l=window.Vue.createElementBlock,n=window.Vue.createCommentVNode,c=window.Vue.toDisplayString,i=window.Vue.createElementVNode,h=window.Vue.renderList,r=window.Vue.Fragment,y=window.Vue.normalizeStyle,V=window.Vue.vShow,k=window.Vue.withDirectives,m=window.Vue.createTextVNode,C=window.Vue.normalizeClass,S={class:"poll__wrapper__outer"},A={key:0,class:"poll__opener --image"},N={class:"poll__container__inner"},T={class:"poll__question"},R={class:"poll__content"},z={key:0,class:"poll__list --results"},L={key:0,class:"poll__list__item__media --image"},B={class:"poll__list__item__content"},D={class:"poll__list__item__label"},E={class:"poll__list__item__indicator"},I={key:1,class:"poll__list --answers"},P=["onClick"],q={key:0,class:"poll__list__item__media --image"},H={class:"poll__list__item__content"},K=["name","value"],$={class:"poll__list__item__label"}
1,F={key:0,ref:"captcha",class:"h-captcha captcha","data-sitekey":"2f287e33-67f0-4970-934f-964bba1eb239"},M=["innerHTML"],U=["disabled"],x={key:3,class:"poll__voted"},O={key:4,class:"poll__popup"},j={key:5,class:"poll__popup-fail"};function G(e,t,o,J,Q,d){const u=v("CmmsResponsiveImage");return s(),l("div",{class:C(["element",o.element.type,o.element.subtype])},[i("div",S,[o.element.data.poll.image?(s(),l("div",A,[_(u,{image:o.element.data.poll.image},null,8,["image"])])):n("",!0),i("div",N,[i("p",T,c(o.element.data.poll.question),1),i("div",R,[this.results?(s(),l("ul",z,[(s(!0),l(r,null,h(this.results,a=>(s(),l("li",{class:"poll__list__item",key:a.id},[a.image?(s(),l("span",L,[_(u,{zoom:!0,image:a.image},null,8,["image"])])):n("",!0),i("span",B,[i("span",D,c(a.text),1),i("span",E,c(a.percentage)+" %",1),i("span",{class:"poll__list__item__progress",style:y("width: ".concat(a.percentage,"%"))},null,4)])]))),128))])):o.element.data.poll.answers?(s(),l("ul",I,[(s(!0),l(r,null,h(o.element.data.poll.answers,a=>(s(),l("li",{onClick:W=>d.selectAnswer(a.id),class:"poll__list__item",key:a.id},[a.image?(s(),l("span",q,[_(u,{zoom:!0,image:a.image},null,8,["image"])])):n("",!0),i("label",H,[i("input",{class:"poll__list__item__input",type:"radio",name:d.radioButtonName,value:a.id},null,8,K),i("span",$,c(a.text),1),t[1]||(t[1]=i("span",{class:"poll__list__item__indicator"},null,-1))])],8,P))),128))])):n("",!0),!e.submitted&&!e.closed&&!this.results?(s(),l(r,{key:2},[e.hasCaptcha?(s(),l("div",F,null,512)):n("",!0),e.popupVisible?k((s(),l("div",{key:1,class:"poll__popup-fail",innerHTML:e.popupText},null,8,M)),[[V,e.popupType==="validation"]]):n("",!0),i("button",{disabled:e.selectedAnswer===null||e.nonce===!1,class:"poll__vote element cta --text-link",onClick:t[0]||(t[0]=a=>d.submitVote())},[...t[2]||(t[2]=[i("span",{class:"cta__label"},"Abstimmen",-1)])],8,U)],64)):n("",!0),e.submitted&&e.voted&&!e.success?(s(),l("p",x,c(o.element.data.poll.messages.voted),1)):n("",!0),e.submitted&&e.success?(s(),l("p",O,c(o.element.data.poll.messages.popup),1)):n("",!0),e.submitted&&e.error?(s(),l("p",j,[...t[3]||(t[3]=[m(" Hoppla, etwas ist schief gegangen!",-1),i("br",null,null,-1),i("br",null,null,-1),m(" Laden Sie die Seite neu und stimmen Sie erneut ab. ",-1)])])):n("",!0)])])])],2)}const Z=f(b,[["render",G]]);export{Z as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.