<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import{b4 as b,P as p,a as $,ab as f,A as y,aO as A,b6 as I,b7 as T,O as E,a7 as S,x as o}from"./D9GMebbP.js";import{u as h}from"./DHHO9lIu.js";const j=b("assessment",{state:()=&gt;({assessment:{},routeAction:"",assessmentType:"",blooms:"",assessmentEntry:"",mistakesTestCount:0}),getters:{getAssessmentLanguage(t){return t.assessment.language},getAssessmentDirection(t){return p(t.assessment.language)},getAssessmentId(t){return t.assessment.id},getAssessmentType(t){return t.assessmentType},getAssessmentEntry(t){let e=h();return t.assessmentEntry=="from_mistakes_test_banner"?"previous_mistakes_test":t.assessmentEntry=="from_subject"||t.assessmentEntry=="from_playlist"?e.subjectTabSource:t.assessmentEntry=="from_morshed_playlist"?"morshed_playlist":"direct_url"}},actions:{async modifyAssessmentType(t){this.assessmentType=t},async skipQuizOrTest(){const{$i18n:t,$router:e}=o();let s=h(),r=$(),n=f(),a=s.subjectTabSource,i=e.currentRoute.value.params;const m=`/${r.lanco}/program/${i.program}/subject/${i.subject}`,l=this.assessmentEntry=="from_morshed_playlist"?`${m}/morshed/${n.selectedWeekTab}`:`${m}/subtopic/${i.learning_type_id}`,c=`${m}/tabs`;let d="";return this.assessmentEntry=="from_playlist"||this.assessmentEntry=="from_morshed_playlist"||this.assessmentEntry==""?i.quiz!==void 0?d=l+`/list/quiz-cover/${i.quiz}`:i.test!==void 0&amp;&amp;(d=l+`/list/test-cover/${i.test}`):(this.assessmentEntry=="from_subject"||this.assessmentEntry=="from_mistakes_test_banner")&amp;&amp;(d={assessments_home:`${c}/assessments`,learning_journey:`${c}/learning`,revisions_home:`${c}/revisions`,nael_home:`${c}/nael`,external_test:`${c}/assessments`,unit_tests:`${c}/assessments/unit`,semester_tests:`${c}/assessments/semester`,end_of_year_tests:`${c}/assessments/end-of-year`}[a]||`${c}/assessments`),d},async fetchTestResults(t){const{$API:e}=o();try{const{testId:s,subtopicId:r}=t;let n=`exams/test/results?test_id=${s}&amp;subtopic_id=${r}`,{data:a}=await e.get(n);return a}catch(s){this.handleAssessmentErrors(s)}},setAssessmentResult(t){this.blooms=t;let e=t.map(n=&gt;({student_answer_correctly:n.student_answer_correctly,bloom:n.bloom})),r=[{id:1,nameAr:"Ø§Ù„ØªØ°ÙƒØ±",nameEn:"Remembering",color:"#3B82F6"},{id:2,nameAr:"Ø§Ù„ÙÙ‡Ù…",nameEn:"Understanding",color:"#22C55E"},{id:3,nameAr:"Ø§Ù„ØªØ·Ø¨ÙŠÙ‚ ",nameEn:"Applying ",color:"#F59E0B"},{id:4,nameAr:"Ø§Ù„ØªØ­Ù„ÙŠÙ„",nameEn:"Analyzing ",color:"#F97316"},{id:5,nameAr:"Ø§Ù„ØªÙ‚ÙŠÙŠÙ… ",nameEn:"Evaluating ",color:"#F43F5E"},{id:6,nameAr:"Ø§Ù„Ø§Ø¨ØªÙƒØ§Ø±",nameEn:"Creating ",color:"#B91C1C"}].map(n=&gt;{let a=e.filter(u=&gt;u.bloom.includes(n.id)).length,i=e.filter(u=&gt;u.bloom.includes(n.id)&amp;&amp;u.student_answer_correctly).length;return{...n,numberBlooms:a,numberCorectBlooms:i,value:i/a}});this.blooms=r.filter(n=&gt;n.numberBlooms&gt;0)},async fetchQuiz(t){const{$API:e}=o();try{const{quizId:s,subtopicId:r}=t;let n=`exams/quiz?quiz_id=${s}&amp;subtopic_id=${r}`,a=await e.get(n);a.fetchType="quiz",a.entityId=s,this.setTestOrQuiz(a)}catch(s){this.handleAssessmentErrors(s)}},async fetchTest(t){const{$API:e}=o();try{const{testId:s,subtopicId:r}=t;let n=`exams/test?test_id=${s}&amp;subtopic_id=${r}&amp;get_correct_answers=true`,a=await e.get(n);a.fetchType="test",a.entityId=s,this.setTestOrQuiz(a)}catch(s){this.handleAssessmentErrors(s)}},async fetchTestCover(t){const{testId:e,subtopicId:s}=t,{$API:r}=o();try{let{data:n}=await r.get(`exams/test-cover?test_id=${e}&amp;subtopic_id=${s}`);return n}catch(n){this.handleAssessmentErrors(n)}},async answerTestQuestion(t){const{$API:e}=o();try{return await e.post(t,`tests/student-test-answer?coming_from=${this.getAssessmentEntry}`)}catch(s){if(s)return s}},async answerEssayTestQuestion(t){const{$API:e}=o();try{return(await e.post(t,`tests/essay-question-result?coming_from=${this.getAssessmentEntry}`)).data}catch{}},async setTestOrQuiz(t){const e=await this.getAssessmentDate(),s=`${t.fetchType}_id=${t.entityId}`,r=`start_time_${t.fetchType}_id=${t.entityId}`;localStorage.setItem(s,t["request-id"]),localStorage.setItem(r,e),Array.isArray(t.data)?this.assessment=t.data[0]:this.assessment=t.data},async submitQuizToBackend(t){const{$API:e}=o();t.start_request_id=localStorage.getItem(`quiz_id=${t.quiz_id}`),t.frontend_start_time=localStorage.getItem(`start_time_quiz_id=${t.quiz_id}`),t.frontend_end_time=await this.getAssessmentDate(),await e.post(t,"exams/quiz"),localStorage.removeItem(`quiz_id=${t.quiz_id}`),localStorage.removeItem(`start_time_quiz_id=${t.quiz_id}`)},async submitTestToBackend(t){const{$API:e}=o();t.start_request_id=localStorage.getItem(`test_id=${t.test_id}`),t.frontend_start_time=localStorage.getItem(`start_time_test_id=${t.test_id}`),t.frontend_end_time=await this.getAssessmentDate(),await e.post(t,`exams/submit-test?coming_from=${this.getAssessmentEntry}`),localStorage.removeItem(`test_id=${t.test_id}`),localStorage.removeItem(`start_time_test_id=${t.test_id}`)},async removeTestfromBackend(t){const{$API:e,$router:s}=o(),a=`#t_${s.currentRoute.value.params.test}`;return localStorage.removeItem(a),await e.delete(t,"tests/student-test-answers")},async clearCurrentAssessment(t){this.assessment={}},async sendDataPipeline(t){var i;let e=y(),{$DataAPI:s}=o(),r=Date.now(),a={source:"FE",timestamp:A(r),user_id:(i=e.userInfo)==null?void 0:i.id,user_type:"signed_in",body:{comp_ver:"1",trace_id:t.trace_id,device:I(),browser:T(),event_type:"assessment",event_content:{type:t.assessment_type,id:t.assessment_Id,subtopic_id:t.subtopic_id,action:t.action,q_indx:t.q_indx,total_q:t.total_q}}};try{return await s.put(a,"Default/streams/DataPipeline/record")}catch{}},handleAssessmentErrors(t){var _,g;const e=E(),s=S();let r=$(),n=y(),a=(_=t.response.data)==null?void 0:_.detail,i=(g=t.response.data)==null?void 0:g.message_key,u=n.isUserLoggedIn,m=r.lanco,l=r.language,c=e.params;if(["Student is not subscribed to see this lesson","you have ended your subscription"].includes(a))u?s.push(`${m}/program/${c.program}/subject/${c.subject}/${c.learning_type}/${c.learning_type_id}/${c.quiz?`list/quiz-cover/${c.quiz}`:`test-cover/${c.test}`}`):s.push(`/${l}/signup`);else{if(i=="resource not found")return;s.push(`/${l}/signin`)}},async createCustomTest(t){let{$API:e}=o();try{return(await e.post(t,"exams/custom-test/create")).data}catch{}},async generatePreSelectedCustomTest(t){try{let{$API:e}=o();const{custom_test_id:s,subject_id:r}=t;let n=`/exams/custom-test/generate?custom_test_id=${s}&amp;subject_id=${r}`;return(await e.get(n)).data}catch{}},async fetchCustomTest(t){try{let{$API:e}=o();const{testId:s,subjectId:r}=t;let n=`/exams/custom-test/get?custom_test_id=${s}&amp;subject_id=${r}`,a=await e.get(n);a.fetchType="test",a.entityId=s,this.setTestOrQuiz(a)}catch{}},async fetchCustomTestAttempt(t){try{let{$API:e}=o();const{testId:s,subjectId:r}=t;let n=`/exams/custom-test/get?custom_test_id=${s}&amp;subject_id=${r}`;return(await e.get(n)).data}catch{}},async fetchCustomTestResults(t){try{let{$API:e}=o(),s=`exams/test/results?test_id=${t}&amp;subtopic_id=0`,{data:r}=await e.get(s);return r}catch(e){this.handleAssessmentErrors(e)}},async fetchCustomTestSubjects(t){try{let{$API:e}=o(),s=`/practice/practice-subjects?program_id=${t}`,{data:r}=await e.get(s);return r.subjects}catch{}},async fetchCustomTestAttempts(t){try{let{$API:e}=o(),s=`/exams/subject-custom-tests/get?subject_id=${t}`,{data:r}=await e.get(s);return r}catch{}},async fetchCustomTestStudentStatus(t){try{let{$API:e}=o(),s=`/exams/custom-tests/student-status?subject_id=${t}`,{data:r}=await e.get(s);return r}catch{}},async getAssessmentDate(){let t=new Date;const e=t.getFullYear(),s=t.getMonth()+1,r=t.getDate(),n=t.getHours(),a=t.getMinutes(),i=t.getSeconds(),u=t.getMilliseconds();return`${e}-${s}-${r} ${n}:${a}:${i}.${u}`},async getMistakesTestCount(t){try{let{$API:e}=o(),s=`exams/subject-student-previous-mistakes-count?subject_id=${t}`,{data:r}=await e.get(s);return this.mistakesTestCount=r,r}catch{}},async fetchMistakesTestBySubjectId(t){try{let{$API:e}=o(),s=`exams/subject-student-previous-mistakes?subject_id=${t}`,r=await e.get(s);return r.fetchType="test",r.entityId=r.data.id,this.setTestOrQuiz(r),r}catch{}}}});export{j as u};
</pre></body></html>