"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[9795],{9795:(v,d,c)=>{c.r(d),c.d(d,{QuizselectionPageModule:()=>T});var a=c(6019),m=c(9133),s=c(4599),g=c(8699),e=c(3668),z=c(2670),f=c(3321),p=c(6875);function h(t,o){if(1&t){const i=e.EpF();e.TgZ(0,"ion-item",6),e.NdJ("click",function(){const r=e.CHM(i).$implicit;return e.oxw(2).selectQuizPublic(r)}),e._uU(1),e.qZA()}if(2&t){const i=o.$implicit;e.xp6(1),e.Oqu(i.quizname)}}function Q(t,o){if(1&t&&(e.ynx(0),e.TgZ(1,"ion-list"),e.TgZ(2,"ion-list-header"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,h,2,1,"ion-item",5),e.qZA(),e.BQk()),2&t){const i=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,2,"SELECTITEM")),e.xp6(2),e.Q6J("ngForOf",i.quizList)}}function _(t,o){if(1&t){const i=e.EpF();e.TgZ(0,"ion-item",6),e.NdJ("click",function(){const r=e.CHM(i).$implicit;return e.oxw(2).selectQuizPrivate(r)}),e._uU(1),e.qZA()}if(2&t){const i=o.$implicit;e.xp6(1),e.Oqu(i.quizName)}}function Z(t,o){if(1&t&&(e.ynx(0),e.TgZ(1,"ion-list"),e.TgZ(2,"ion-list-header"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,_,2,1,"ion-item",5),e.qZA(),e.BQk()),2&t){const i=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,2,"SELECTITEM")),e.xp6(2),e.Q6J("ngForOf",i.quizList)}}const P=[{path:"",component:(()=>{class t{constructor(i,u,n){this.gameService=i,this.modalCtrl=u,this.wsrest=n,this.quizList=[]}ngOnInit(){}ionViewWillEnter(){this.publicMode?this.wsrest.getQuizzesWithCaps().subscribe(i=>{this.quizList=this.filterUnblockedQuizzes(i.quizzes)}):this.gameService.listOfCourses===[]?this.gameService.getGames().subscribe(i=>{this.quizList=this.filterUnblockedQuizzes(i.quizzes)}):this.quizList=this.filterUnblockedQuizzes(this.gameService.listOfQuizzes)}filterUnblockedQuizzes(i){const u=[];return 0===this.gameService.purchases.length&&this.gameService.getPurchases(),i.forEach(n=>{let r=!1;this.gameService.purchases.forEach((l,b)=>{switch(this.publicMode){case!0:(l.quizId===n.quizid||l.courseId===n.courseid&&"unlockcourse"===l.productId||"unlockplatformsubscription"===l.productId)&&1===l.isPublic&&(r=!0);break;case!1:(l.quizId===n.quizId||l.courseId===n.courseid||"unlockplatformsubscription"===l.productId)&&(r=!0)}}),r||u.push(n)}),u}dismiss(){this.modalCtrl.dismiss()}selectQuizPublic(i){this.modalCtrl.dismiss({quizid:i.quizId,courseid:i.courseId})}selectQuizPrivate(i){this.modalCtrl.dismiss({quizid:i.quizId,courseid:i.courseId})}}return t.\u0275fac=function(i){return new(i||t)(e.Y36(z.B),e.Y36(s.IN),e.Y36(f.N))},t.\u0275cmp=e.Xpm({type:t,selectors:[["app-quizselection"]],inputs:{publicMode:"publicMode"},decls:11,vars:2,consts:[["slot","start"],[3,"click"],["name","arrow-back"],[4,"ngIf","ngIfElse"],["privateMode",""],["style","color: black",3,"click",4,"ngFor","ngForOf"],[2,"color","black",3,"click"]],template:function(i,u){if(1&i&&(e.TgZ(0,"ion-header"),e.TgZ(1,"ion-toolbar"),e.TgZ(2,"ion-buttons",0),e.TgZ(3,"ion-button",1),e.NdJ("click",function(){return u.dismiss()}),e._UZ(4,"ion-icon",2),e.qZA(),e.qZA(),e.TgZ(5,"ion-title"),e._uU(6,"Quizzes"),e.qZA(),e.qZA(),e.qZA(),e.TgZ(7,"ion-content"),e.YNc(8,Q,6,4,"ng-container",3),e.YNc(9,Z,6,4,"ng-template",null,4,e.W1O),e.qZA()),2&i){const n=e.MAs(10);e.xp6(8),e.Q6J("ngIf",u.publicMode)("ngIfElse",n)}},directives:[s.Gu,s.sr,s.Sm,s.YG,s.gu,s.wd,s.W2,a.O5,s.q_,s.yh,a.sg,s.Ie],pipes:[p.X$],styles:[""]}),t})()}];let x=(()=>{class t{}return t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({imports:[[g.Bz.forChild(P)],g.Bz]}),t})();var q=c(1382);let T=(()=>{class t{}return t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=e.oAB({type:t}),t.\u0275inj=e.cJS({imports:[[q.m,a.ez,m.u5,s.Pc,x]]}),t})()}}]);