1import{t as P,J as b,C as A,_ as Q,v as f,x as k,n as r,p as a,z as o,F as w,q as C,G as y,H as D,y as T,A as $,$ as g,I as m,B as p,l as E}from"./main-jB1Kct5u.js";import{B as N}from"./BaseComponent.vue_vue_type_script_lang-DrDjpCzM.js";import{D as S}from"./DecisionTreeConclusion-BPIBllEL.js";import{D as q}from"./DecisionTreeQuestion-6h49ptiS.js";import"./BaseComponent.utils-ADJOHzt3.js";var F=Object.getOwnPropertyDescriptor,L=(s,e,t,n)=>{for(var i=n>1?void 0:n?F(e,t):e,c=s.length-1,l;c>=0;c--)(l=s[c])&&(i=l(i)||i);return i};let _=class extends N{constructor(){super(...arguments),this.activeQuestionNumber=0,this.questionsAnswers=[],this.decisionTreeStarted=!1,this.currentClass="",this.verifiedTotalAmount=0,this.verifiedCorrectAmount=0}created(){super.created(),this.currentClass=this.layoutComponent?.class??""}contentDidLoad(){super.contentDidLoad(),this.settingsProps.show_progress_bar=this.settingsProps.show_progress_bar??!1,this.settingsProps.manual_submit=this.settingsProps.manual_submit??!1,this.settingsProps.randomize_answers=this.settingsProps.randomize_answers??!1,this.settingsProps.verify_each_question=this.settingsProps.verify_each_question??!1,this.settingsProps.verify_question_label=this.settingsProps.verify_question_label??"Senden",this.settingsProps.next_question_label=this.settingsProps.next_question_label??"Weiter",this.settingsProps.not_answered_error=this.settingsProps.not_answered_error??"Bitte wählen Sie eine Antwort aus.",this.settingsProps.name=this.settingsProps.name??"Unknown",this.verifiedTotalAmount=this.settingsProps.questions.length,setTimeout(()=>{this.loadCustomEvents()},500)}loadCustomEvents(){const e=window.document.getElementsByClassName("start-button");for(let i=0;i<e.length;i++)e[i].addEventListener("click",this.startDecisionTree);const t=window.document.getElementsByClassName(`${this.layoutComponent.id}--triggerer`),n=window.document.getElementsByClassName(`${this.layoutComponent.id}--triggerer-wrapper`);if(t.length)for(let i=0;i<t.length;i++)t[i].addEventListener("click",c=>{c.preventDefault(),this.currentClass=this.currentClass.replace("d-none",""),this.$refs.decisionTree?this.$refs.decisionTree.classList.remove("d-none"):window.document.getElementById(this.layoutComponent.id)?.classList.remove("d-none");for(let l=0;l<n.length;l++)n[l].classList.add("d-none");c.stopPropagation(),c.stopImmediatePropagation()})}cleanupDecisionTree(){this.activeQuestionNumber=0,this.questionsAnswers=[]}restartDecisionTree(){this.cleanupDecisionTree(),this.decisionTreeStarted=!1,this.verifiedCorrectAmount=0,this.$nextTick(()=>{window.document.getElementById(this.layoutComponent.id)?.classList.remove("d-none")}),this.$eventManager.triggerLinkClickEvent({event_name:"special_interaction",link_name:`${this.analyticsFormName} | Restart`,link_text:`${this.analyticsFormName} | Restart`,link_href:this.$route.fullPath,special_interaction_name:`${this.analyticsFormName} | Restart`})}setActiveQuestionNumber(e){this.activeQuestionNumber=e,this.settingsProps.manual_submit&&this.$refs.decisionTree&&this.$refs.decisionTree.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}startDecisionTree(){this.decisionTreeStarted=!0,this.cleanupDecisionTree(),this.triggerStartEvent()}goToQuestion(e,t){e<0||e>this.settingsProps.questions.length||e>this.questionsAnswers.length||(t&&this.triggerAnswerEvent(e),this.setActiveQuestionNumber(e))}stepClick(e){this.goToQuestion(e,!0)}answerQuestion(e){if(this.questionsAnswers[this.activeQuestionNumber]?this.questionsAnswers[this.activeQuestionNumber]=e:this.questionsAnswers.push(e),this.settingsProps.verify_each_question){const t=this.settingsProps.conclusions[0]?.settings?.answers[this.activeQuestionNumber],n=this.activeQuestion.settings.answers[e];t===n&&this.verifiedCorrectAmount++}this.goToQuestion(this.activeQuestionNumber+1),this.triggerAnswerEvent()}areAnswersEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}triggerStartEvent(){this.$eventManager.triggerFormFieldEvent({survey_event:"start",event_name:"form_field_entry",form_name:this.analyticsFormName,form_field_name:"Start",link_text:`${this.analyticsFormName} | Form Interaction Initiated | Start`})}triggerAnswerEvent(e){const t=typeof e=="number"?this.activeQuestionNumber:this.activeQuestionNumber-1,n=this.settingsProps.questions[t],i=this.questionsAnswers[t];
1if(n===null||i===null)return;const c=this.stripHtmlTags(n.settings?.answers[i]??(i!=null?i[0]:"")),l=this.stripHtmlTags(n.settings.headline),h={event_name:"form_field_entry",form_name:this.analyticsFormName,form_field_name:`Step ${(t+1).toString()} | ${l}`};typeof e=="number"?this.$eventManager.triggerFormFieldEvent({...h,link_text:`${this.analyticsFormName} | Form Interaction | Progressbar - Click Go To Step ${(e+1).toString()}`}):this.$eventManager.triggerFormFieldEvent({...h,link_text:`${this.analyticsFormName} | Form Interaction | ${c}`}),this.shouldShowConclusion&&this.triggerConclusionEvent()}stripHtmlTags(e){return e.replace(/<[^>]*>?/gm,"")}triggerConclusionEvent(){this.$eventManager.triggerFormCompleteEvent({survey_event:"complete",form_name:this.analyticsFormName,link_text:`Form Complete | ${this.analyticsFormName}`})}get activeClass(){return this.decisionTreeStarted?this.currentClass.replaceAll("d-none",""):this.currentClass}get currentQuestion(){return this.activeQuestionNumber+1}get totalQuestions(){return this.settingsProps.questions.length}get currentProgress(){return Math.round(this.currentQuestion/this.totalQuestions*100)}get activeQuestion(){return this.mappedQuestions[this.activeQuestionNumber]}get shouldShowConclusion(){return this.activeQuestionNumber>=this.settingsProps.questions.length}get conclusion(){if(this.shouldShowConclusion)return this.settingsProps.manual_submit?this.settingsProps.conclusions[0]:this.settingsProps.conclusions.find(e=>this.areAnswersEqual(e.settings.answers,this.questionsAnswers))}get currentCorrectAnswerIndex(){if(!this.settingsProps.manual_submit||this.settingsProps.conclusions.length!==1||!this.decisionTreeStarted)return;const e=this.settingsProps.conclusions[0].settings.answers[this.activeQuestionNumber];return e?this.activeQuestion.settings.answers.indexOf(e):void 0}get mappedQuestions(){return this.settingsProps.randomize_answers?this.settingsProps.questions.map(e=>{const t=e.settings.answers;if(!t)return e;const n=t.sort(()=>Math.random()-.5);return{...e,settings:{...e.settings,answers:n}}}):this.settingsProps.questions}get noConclusionText(){const e=this.settingsProps.no_conclusion_text;return e||`Kein Ergebnis für die von Ihnen gegebenen Antworten festgelegt. (${this.questionsAnswers.join(", ")})`}get startScreen(){return this.settingsProps.start_screen.map(t=>new b(t))}get analyticsFormName(){return this.settingsProps.name?.trim()?`Decision Tree - ${this.settingsProps.name}`:"Decision Tree"}};_=L([A({components:{DecisionTreeQuestion:q,DecisionTreeConclusion:S}})],_);const I=P(_),B={key:0},M=["id","data-component","data-id"],z={key:0,class:"decision-tree__start-screen"},R={class:"decision-tree__start-screen-content"},H={class:"decision-tree__start-screen-start-button"},O={key:1,class:"decision-tree__on-going"},V={class:"decision-tree__progress-wrapper"},j={key:0,class:"decision-tree__progress decision-tree__progress--bar"},G={class:"decision-tree__progress-bar"},W={class:"decision-tree__progress-step-number"},J={class:"amount"},K={key:1,class:"decision-tree__progress decision-tree__progress--list"},U=["onClick"],X={class:"decision-tree__progress-step-number"},Y={class:"decision-tree__progress-step decision-tree__progress-conclusion"},Z={class:"decision-tree__progress-step-number"},x={key:1,class:"decision-tree__conclusion"},ee={key:1,class:"decision-tree__question-wrapper"};function se(s,e,t,n,i,c){const l=f("DecisionTreeConclusion"),h=f("DecisionTreeQuestion"),v=k("html-fragment");return s.contentLoaded?(r(),a("div",{key:1,id:s.settingsProps.id,ref:"decisionTree",class:p(["decision-tree",[s.activeClass,{"decision-tree--start-screen":!s.decisionTreeStarted,"decision-tree--on-going":s.decisionTreeStarted&&!s.shouldShowConclusion,"decision-tree--conclusion":s.decisionTreeStarted&&s.shouldShowConclusion}]]),"data-component":s.componentType,"data-id":s.internalId},[s.decisionTreeStarted?(r(),a("div",O,[o("div",V,[s.settingsProps.show_progress_bar&&!s.shouldShowConclusion?(r(),a("div",j,[o("div",G,[o("div",{class:"decision-tree__progress-bar-inner",style:$({width:`${s.currentProgress}%`})},null,4)]),o("div",W,[e[2]||(e[2]=o("span",{class:"text"},"FRAGE",-1)),o("span",J,g(s.currentQuestion)+" / "+g(s.totalQuestions),1)])])):m("",!0),s.settingsProps.show_progress_bar?m("",!0):(r(),a("div",K,[(r(!0),a(w,null,C(s.settingsProps.questions,(d,u)=>(r(),a("div",{key:u,class:p(["decision-tree__progress-step",{"decision-tree__progress-step--active":u===s.activeQuestionNumber,"decision-tree__progress-step--answered":s.questionsAnswers[u]}]),onClick:te=>s.stepClick(u)},[o("div",X,g(u+1),1)],10,U))),128)),o("div",Y,[o("div",Z,[o("span",null,g(s.settingsProps.conclusion_step_text),1)])])]))]),s.shouldShowConclusion?(r(),a("div",{key:0,class:p(["decision-tree__conclusion-wrapper",{"decision-tree__conclusion--no-conclusion":!s.conclusion}])},[s.conclusion?(r(),y(l,{key:0,layoutComponent:s.conclusion,verifiedTotal:s.verifiedTotalAmount,verifiedCorrect:s.verifiedCorrectAmount,onRestartDecisionTree:s.restartDecisionTree},null,8,["layoutComponent","verifiedTotal","verifiedCorrect","onRestartDecisionTree"])):T((r(),a("div",x,null,512)),[[v,s.noConclusionText]])],2)):s.activeQuestion?(r(),a("div",ee,[E(h,{layoutComponent:s.activeQuestion,manualMode:s.settingsProps.manual_submit,correctAnswer:s.currentCorrectAnswerIndex,verifyMode:s.settingsProps.verify_each_question,verifyLabel:s.settingsProps.verify_question_label,nextLabel:s.settingsProps.next_question_label,notAnsweredError:s.settingsProps.not_answered_error,onAnswerQuestion:s.answerQuestion},null,8,["layoutComponent","manualMode","correctAnswer","verifyMode","verifyLabel","nextLabel","notAnsweredError","onAnswerQuestion"])])):m("",!0)])):(r(),a("div",z,[o("div",R,[(r(!0),a(w,null,C(s.startScreen,(d,u)=>(r(),y(D(d.component),{key:u,"layout-component":d},null,8,["layout-component"]))),128))]),o("div",H,[T(o("button",{onClick:e[0]||(e[0]=(...d)=>s.startDecisionTree&&s.startDecisionTree(...d))},null,512),[[v,s.settingsProps.start_button_text]])])]))],10,M)):(r(),a("div",B,[...e[1]||(e[1]=[o("div",{class:"skeleton__headline"},null,-1)])]))}const le=Q(I,[["render",se],["__scopeId","data-v-c72a4e8e"]]);export{le 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.