https://www.getepic.com/default-src_app_web-app_services_read-content_service_ts.ba7c678f34751b4e.js
1"use strict";(self.webpackChunkng_up=self.webpackChunkng_up||[]).push([["default-src_app_web-app_services_read-content_service_ts"],{78433:(K,M,t)=>{t.d(M,{E3:()=>O,EL:()=>v,Fr:()=>P,Hf:()=>g,KE:()=>C,L9:()=>p,Mc:()=>D,Sk:()=>y,_L:()=>a,_e:()=>_,_j:()=>d,pG:()=>T,tI:()=>u});const P="connect_to_teacher_start",D="connect_to_teacher_grownup_view",C="connect_to_teacher_password_view",d="connect_to_teacher_password_go",p="connect_to_teacher_password_success",y="connect_to_teacher_find_view",O="connect_to_teacher_find_start",T="connect_to_teacher_find_submit",v="connect_to_teacher_join_view",g="connect_to_teacher_join_send",a="connect_to_teacher_resend",u="connect_to_teacher_cancel",_="connect_to_teacher_unlink"},68087:(K,M,t)=>{t.d(M,{$P:()=>O,$S:()=>c,$_:()=>r,$f:()=>v,DC:()=>R,DZ:()=>j,G:()=>g,GM:()=>d,Gd:()=>C,KU:()=>S,OB:()=>Y,Oq:()=>E,P4:()=>H,SO:()=>I,Tk:()=>u,UH:()=>m,Vm:()=>F,WT:()=>e,X:()=>N,ZS:()=>_,_:()=>ie,_9:()=>L,aM:()=>h,gb:()=>o,hb:()=>a,hk:()=>Q,iT:()=>W,j:()=>l,nL:()=>G,qR:()=>w,rr:()=>V,sK:()=>p,sk:()=>y,t9:()=>T,tp:()=>D,u9:()=>s,vU:()=>P,wT:()=>$,yk:()=>B});const P="content_opened_book",D="content_opened_book_r2me",C="content_opened_audiobook",d="content_opened_video",p="content_paid_book",y="content_paid_book_r2me",O="CONTENT_FAVORITE_SEARCH",T="content_favorite",v="content_un_favorite",g="content_finish_enabled_book",a="content_finish_enabled_book_r2me",u="content_finished_book",_="content_finished_book_r2me",h="content_finished_audiobook",E="content_finished_video",s="storysketch_enabled",m="content_finish_click_book",r="content_finish_click_book_r2me",S="content_finish_view_book",B="content_finish_view_book_r2me",R="content_closed_book",L="content_closed_book_r2me",N="content_closed_video",Q="content_closed_audiobook",$="content_autoplay_video",H="content_zoom_in",V="content_zoom_out",j="content_full_screen_in",w="content_full_screen_in_out",e="content_play_book_r2me",o="content_pause_book_r2me",l="content_playback_menu_viewed",c="content_playback_speed_selected",I="content_settings_menu_click",F="content_volume_control_click",G="re_read_cta_clicked",W="show_video_caption",Y="content_video_caption_status",ie="read_controls_menu_click"},78343:(K,M,t)=>{t.d(M,{$U:()=>p,C4:()=>P,CP:()=>v,FJ:()=>h,Fe:()=>u,Gn:()=>L,HO:()=>s,IZ:()=>_,KG:()=>O,KW:()=>r,Ng:()=>S,QH:()=>C,Sg:()=>R,U_:()=>y,Ui:()=>m,Zp:()=>D,b8:()=>B,eP:()=>N,h5:()=>g,i_:()=>E,jh:()=>a,oy:()=>T,zD:()=>d});const P="create_new_quiz",D="create_quiz_add_title",C="edit_quiz_existing",d="edit_quiz_add_question",p="edit_quiz_tooltip",y="edit_quiz_view_need_ideas",O="edit_quiz_save_question",T="edit_quiz_delete_question",v="edit_quiz_preview",g="edit_quiz_publish_quiz",a="edit_quiz_delete",u="community_quiz_view",_="teacher_quiz_view",h="parent_quiz_view",E="student_quiz_view",s="student_quiz_start",m="student_quiz_close",r="student_quiz_results_done",S="student_quiz_results_retake",B="student_quiz_results_buddy_click",R="student_quiz_close_never_mind",L="student_quiz_take_quiz_later",N="edu_quiz_view"},47643:(K,M,t)=>{t.d(M,{$g:()=>p,Jc:()=>O,ot:()=>v,vx:()=>y});var P=t(98444),D=t(52701),C=t(25769),d=t(24364),p=(()=>{return(g=p||(p={})).COLLECTION="playlist",g.BOOK="book",p;var g})(),y=(()=>{return(g=y||(y={}))[g.ACTIVE=0]="ACTIVE",g[g.INACTIVE=1]="INACTIVE",g[g.ARCHIVED=2]="ARCHIVED",y;var g})(),O=(()=>{return(g=O||(O={}))[g.TYPEBASIC=1]="TYPEBASIC",g[g.TYPEAFTERHOUR=2]="TYPEAFTERHOUR",O;var g})();const T={US:"M/d/yyyy",IN:"d/M/yyyy"};class v{constructor(a){var u;this.numBooksAssigned=0,this.numVideosAssigned=0,this.numUsersAssigned=0,this.usersCompletedList=[],this.dateFormat=null!==(u=T[(0,d.Ui)()])&&void 0!==u?u:T.US,this.id=a.id,this.title=a.title,this.status=a.status,this.imageUrl=a.imageUrl,this.assignerId=a.assignerId,this.dateModified=new Date(1e3*a.dateModified),this.dateCreated=new Date(1e3*a.dateCreated),this.dateCreatedLabel=this.getDateCreatedFormatted(),this.requireQuiz=a.requireQuiz,this.hasStarted=a.hasStarted,this.assignerAccountType=a.assignerAccountType,a.dueDate&&(this.dueDate=new Date(1e3*a.dueDate)),a.startDate&&(this.startDate=new Date(1e3*a.startDate)),this.description=a.description,this.content=a.assignmentC
1ontent,this.content.forEach(_=>{}),this.numBooksAssigned=a.booksOnlyCount,this.numVideosAssigned=a.videosOnlyCount,this.numUsersAssigned=a.assignedCount||0,a.usersCompleted&&(this.usersCompletedList=a.usersCompleted.map(_=>parseInt(_))),this.assignmentType=a.type||1}getAssignmentContent(){return this.content[0]}getContentTypeString(){const a=this.getAssignmentContent();switch(a.contentType){case p.COLLECTION:return P.p.COLLECTION;case p.BOOK:return a.type===C._.VIDEO?P.p.VIDEO:P.p.BOOK;default:return P.p.BOOK}}getStats(a){const u={label:`${a?"Students":"Kids"} ${a?"Assigned":"Sent"}`,value:this.numUsersAssigned};return this.status===y.ACTIVE?this.assignmentHasStarted()?[{label:"Due Date",value:this.getDueDateFormatted()},u,{label:"Completed",value:this.usersCompletedList.length}]:[{label:"Start Date",value:this.getStartDateFormatted()},{label:"Due Date",value:this.getDueDateFormatted()},u]:[{label:"Date Created",value:this.getDateCreatedFormatted()},u,{label:"Completed",value:this.usersCompletedList.length}]}getUsersCompletedPercentage(){return this.numUsersAssigned?Math.round(this.usersCompletedList.length/this.numUsersAssigned*100):0}getThumbnailClass(){const a=this.getAssignmentContent();return a.contentType===p.BOOK?"epic-book-thumbnail":a.contentType===p.COLLECTION?"epic-collection-thumbnail":""}getDateCreatedFormatted(){return(0,D.Z)(this.dateCreated,this.dateFormat)}getStartDateFormatted(){return this.startDate?(0,D.Z)(this.startDate,this.dateFormat):"None"}getDueDateFormatted(){return this.dueDate?(0,D.Z)(this.dueDate,this.dateFormat):"None"}getDueDateFormattedForAssignee(){return this.dueDate?(0,D.Z)(this.dueDate,"MMMM d, yyyy"):"None"}insertUserCompleted(a){this.usersCompletedList.includes(a)||this.usersCompletedList.push(a)}updateAssignmentOnEdit(a){this.title=a.title,this.dueDate=a.dueDate?new Date(1e3*a.dueDate):void 0,this.startDate=a.startDate?new Date(1e3*a.startDate):void 0,this.description=a.description,this.requireQuiz=a.requireQuiz,this.hasStarted=a.hasStarted}assignmentHasStarted(){return this.status===y.ACTIVE&&this.hasStarted}}},28609:(K,M,t)=>{t.d(M,{B:()=>C,J:()=>D});var P=t(25769),D=(()=>{return(d=D||(D={})).LOG_ENTRY_TYPE_READING="LogEntry",d.LOG_ENTRY_TYPE_ACHIEVEMENT="LogEntryAchievement",d.LOG_ENTRY_TYPE_LEVEL_UP="LogEntryLevelUp",d.LOG_ENTRY_TYPE_VIDEO="LogEntryVideo",d.LOG_ENTRY_TYPE_QUIZ_COMPLETE="LogEntryQuizComplete",d.LOG_ENTRY_TYPE_PLAYLIST_COMPLETE="LogEntryPlaylistComplete",D;var d})();class C{constructor(p){this.modelClass=p.modelClass,this.modelId=p.modelId,this.date=p.date,this.userId=p.userId,this.type=p.type,this.lastModified=p.lastModified,this.dateModified=p.dateModified,this.progress=p.progress,this.time=p.time,this.pagesFlipped=p.pagesFlipped,this.bookId=p.bookId,this.finished=p.finished,this.readTime=p.readTime,this.readTimeAfterHours=p.readTimeAfterHours,this.watchedTime=p.watchedTime,this.timezoneOffsetMinutes=0,p.book&&(this.book=new P.c(p.book))}getTimeString(){if(this.time<60)return`${this.time} second${1===this.time?"":"s"}`;{const p=this.time/60;return`${Math.round(p)} minute${1===p?"":"s"}`}}}},35670:(K,M,t)=>{t.d(M,{p:()=>v});var P=t(10745),D=t(60116),C=t(59295),d=t(50635),p=t(67274),y=t(38102),O=t(3184),T=t(14045);let v=(()=>{class g{constructor(u){this._store=u,this.allowedPublishers=[],this.loaded=!1}init(){return this.loaded&&this.allowedPublishers.length>0?(0,P.of)(this.allowedPublishers):this._store.select(p.Yi).pipe((0,D.h)(u=>!!(null==u?void 0:u.flagsmithData)),(0,C.q)(1),(0,d.U)(u=>{var _;const h=null===(_=u.flagsmithData)||void 0===_?void 0:_[y.H.AI_QUIZ_ENABLED_PUBLISHERS];return this.allowedPublishers=this.parseAllowedPublishers(h),this.loaded=!0,this.allowedPublishers}))}parseAllowedPublishers(u){try{if(!(null==u?void 0:u.enabled)||null==u.value)return[];const _="string"==typeof u.value?JSON.parse(u.value):u.value;return Array.isArray(_)?_.filter(h=>"number"==typeof h||"string"==typeof h&&""!==h.trim()).map(h=>Number(h)).filter(h=>Number.isFinite(h)):[]}catch(_){return console.warn("AiQuizPublisherGate: failed to parse flag value",_),[]}}setCurrentPublisherId(u){this.currentPublisherId=u}isPublisherEnabled(u){if(null==u)return!1;const _=Number(u);return Number.isFinite(_)&&this.allowedPublishers.includes(_)}
1isAiGenerateEnabledForCurrentBook(){return this.isPublisherEnabled(this.currentPublisherId)}}return g.\u0275fac=function(u){return new(u||g)(O.LFG(T.yh))},g.\u0275prov=O.Yz7({token:g,factory:g.\u0275fac,providedIn:"root"}),g})()},98403:(K,M,t)=>{t.d(M,{R:()=>T,U4:()=>y,xO:()=>p});var P=t(3184),D=t(1146),C=t(11105),p=(()=>{return(v=p||(p={}))[v.END_OF_BOOK=-1]="END_OF_BOOK",v[v.FRONT_OF_BOOK=0]="FRONT_OF_BOOK",p;var v})(),y=(()=>{return(v=y||(y={})).TRAILER_STATUS="content_trailer_status",v.TRAILER_SHOWN="book_trailer_shown",v.TRAILER_PLAY="book_trailer_play",v.TRAILER_PAUSE="book_trailer_pause",v.TRAILER_END="book_trailer_end",y;var v})();let T=(()=>{class v{constructor(a,u){this._accountService=a,this._experienceService=u}getTrailerData(a,u){if(!a)return;let _;for(let h=0;h<(null==a?void 0:a.length);h++)if(_=a[h],_.page_number===u)return _}allowedToShowTrailersForUser(){return this._experienceService.isPremiumExperience()&&this._experienceService.isChild()&&!!this._accountService.videoEnabled}getPageNumbers(a){const u=[];let _;for(let h=0;h<a.length;h++)_=a[h],u.push(_.page_number);return u}}return v.\u0275fac=function(a){return new(a||v)(P.LFG(D.B),P.LFG(C.DT))},v.\u0275prov=P.Yz7({token:v,factory:v.\u0275fac,providedIn:"root"}),v})()},88578:(K,M,t)=>{t.d(M,{Q:()=>_,s:()=>u});var P=t(34929),D=t(97009),C=t(21333),d=t(3184),p=t(34101),y=t(90442),O=t(44687),T=t(65925),v=t(1146),g=t(41752),a=t(56187),u=(()=>{return(h=u||(u={}))[h.CAN_ENABLE=0]="CAN_ENABLE",h[h.PENDING=1]="PENDING",h[h.CONNECTED=2]="CONNECTED",h[h.PENDING_INCOMING=3]="PENDING_INCOMING",u;var h})();let _=(()=>{class h{constructor(s,m,r,S,B,R,L){this._toastrService=s,this.stringService=m,this.profileService=r,this.dataService=S,this.accountService=B,this.envService=R,this.epicToastCustomService=L,this.removingLinks=!1,this.maxStringLength=40,this.HOME_ACCESS_STATUS=D.j,this.PARENT_CONNECT_STATUS=u,this.USER_ACCOUNT_TRANSFER_STATUS=C.om,this.USER_ACCOUNT_TRANSFER_TYPE=C.om,this.USER_ACCOUNT_LINK_STATUS=C.D2,this.USER_ACCOUNT_LINK_TYPE=C.lR}getParentConnectStatus(s){return s.linkAndTransferData.getPendingHomeAccess()?u.PENDING_INCOMING:s.linkAndTransferData.getPendingConnectLink()?u.PENDING:s.linkAndTransferData.getConnectedLink()?u.CONNECTED:u.CAN_ENABLE}sendLinkRequest(s,m,r){const S="There was a problem processing your request. Please try again later.";if(!m)return Promise.reject(S);const B=L=>L&&L.result&&Array.isArray(L.result.UserAccountLink)&&L.result.UserAccountLink.length>0?(m.linkAndTransferData.setLinkData(L.result.UserAccountLink),r&&this.showToastResendToast(),L):L&&L.result&&Array.isArray(L.result.error)&&L.result.error.length>0?Promise.reject(`${S} ${L.result.error[0]}`):Promise.reject(S),R=s.email||s.accountEmail;return R?this.requestEducatorAccountLinkByEmail(m.id,R,r).then(B):this.requestEducatorAccountLinkByClassroomCode(m.id,s.classCodeInternal||s.classCode||s.classroomCode,r).then(B)}sendEnableHomeAccessRequest(s,m,r){return(0,P.mG)(this,void 0,void 0,function*(){if(!s)return Promise.resolve(null);void 0===r&&(r=!0);const S=m||s.email;return S?this.dataService.post("WebEmail","sendEnableHomeAccess",{email:S,userId:s.id,version:1}).then(R=>(R&&R.result&&!R.result.alert_message&&(this.profileService.getProfileData(s),r&&this.showHomeAccessSentToast()),R)).catch(R=>R):Promise.resolve(null)})}acceptHomeAccessRequest(s,m){const r=s.linkAndTransferData.getPendingHomeAccess();return r?this.approveProfileTransfer(r,s,m):Promise.resolve()}approveProfileTransfer(s,m,r){const S={tid:s.id,sig:s.sig};return s.type===C.om.HOMEACCESS&&(S.linkTeacherAccount=1),r&&(S.removeDefaultUser=!0),this.dataService.post("WebUserAccountTransfer","noAuthConfirmUserTransferToEmail",S).then(B=>B&&B.result?B.result.error?Promise.reject(B.result.error):(()=>r?this.profileService.reloadProfiles().then(()=>Promise.resolve()):m?this.profileService.getProfileData(m,!0):Promise.resolve())().then(()=>(this.profileService.childProfileApproved(),B.result)):Promise.reject())}cancelTransferRequest(s,m){const r={tid:s.id};return s.hasOwnProperty("sig")&&(r.sig=s.sig),this.dataService.post("WebUserAccountTransfer","cancelProfileTransfer",r).then(S=>S&&S.result?S.result.error?Promise.reject(S.result.error):(m&&m.linkAndTransferData.removeTransfer(s.id),S.result):Promise.reject())}approveAccountLink(s){return this.dataService.get("WebUserAccountLink","approveLink",{userId:s.id}).then(m=>{if(m)return m.result&&!m.error?(this.showToastApproveToast(s,!0),m.result.UserAccountLink&&m.result.UserAccountLink.forEach(r=>s.linkAndTransferData.addLink(r)),s.email="",this.profileService.childProfileApproved(),m.result):Promise.reject("Oops! there was a problem accepting this request. Please try again later.")})}unlinkAccountLink(s,m,r){return this._removeAccountLink(s,r,m)}
1cancelHomeAccess(s){return this.dataService.post("WebUserAccountTransfer","cancelHomeAccessInvite",{userId:s.id}).then(m=>(this.profileService.getProfileData(s,!0),m))}showToastRejectToast(s,m){const r=m?"Profile Request Rejected!":"Unlinked Profile!";this._toastrService.show(this.stringService.truncate(s.name,this.maxStringLength),r,{toastClass:"ngx-toastr icon-error stack-title-and-message"})}showToastApproveToast(s,m){const r=m?"New Profile Approved!":"Submitted Request to Link Profile!";this._toastrService.show(this.stringService.truncate(s.name,this.maxStringLength),r,{toastClass:"ngx-toastr stack-title-and-message"})}showToastResendToast(){this._toastrService.show("","Request has been resent!",{toastClass:"ngx-toastr icon-educator stack-title-and-message"})}showHomeAccessSentToast(s){this.epicToastCustomService.show({type:"info",duration:5e3,title:s?"Your invitations are on the way!":"Your invitation is on its way!",classes:["epic-toast-custom--image-peeking"],imgUrl:this.envService.cdnBase+"website/assets/app/toasts/home-access-character.svg"})}_removeAccountLink(s,m,r){const S={denied:m,userId:s.id};let B="removeLink";return this.removingLinks?Promise.reject():(this.removingLinks=!0,r&&(S.uuid=r,B="removeLinkWithUUID"),this.dataService.get("WebUserAccountLink",B,S).then(R=>(this.removingLinks=!1,R?R.result&&!R.error?(this.showToastRejectToast(s,!!m),R.result.UserAccountLink&&R.result.UserAccountLink.forEach(L=>{s.linkAndTransferData.removeLink(L)}),s.isOwnedByAccountId(this.accountService.id)||this.profileService.updateChildProfiles([],[s]),R.result):(alert("Error Encountered while trying to remove user link"),null):null)))}requestEducatorAccountLinkByClassroomCode(s,m,r){return this.dataService.post("WebUserAccountLink","requestJoinClassroomByClassroomCode",{userId:s,classroomCode:m,reminder:r?1:0}).then(B=>B)}requestEducatorAccountLinkByEmail(s,m,r){return this.dataService.post("WebUserAccountLink","requestLink",{userId:s,email:m,reminder:r?1:0}).then(B=>B)}}return h.\u0275fac=function(s){return new(s||h)(d.LFG(p._W),d.LFG(y.P),d.LFG(O.ProfileService),d.LFG(T.D),d.LFG(v.B),d.LFG(g.DJ),d.LFG(a.J))},h.\u0275prov=d.Yz7({token:h,factory:h.\u0275fac,providedIn:"root"}),h})()},34077:(K,M,t)=>{t.d(M,{x:()=>_});var P=t(34929),D=t(95679),C=t(94660),d=t(50253),p=t(3184),y=t(91102),O=t(98476),T=t(68893),v=t(56187),g=t(24047);let _=(()=>{class h{constructor(s,m,r,S,B){this._achievementService=s,this._bigQueryService=m,this._coreDialogService=r,this._epicToastCustomService=S,this._showRewardBackgroundService=B,this.badgeDialogQueue=[],this.closeAllBadgeDialogs$=new d.x,this.openNextBadgeDialog$=new d.x}getBadgeConfig(s){return this._getBadgeConfig(s)}_getBadgeConfig(s){return{badge:s,badgeType:this._achievementService.getBadgeType(s),badgeStatus:this._achievementService.getBadgeStatus(s),badgeAssets:{earnedBadgeImageUrl:this._achievementService.getEarnedAchievementImageUrl(s.achievementId),lockedBadgeImageUrl:this._achievementService.getLockedAchievementImageUrl(s.achievementId),downloadBadgeImageUrl:this._achievementService.getDownloadAchievementUrl(s.achievementId)}}}_getBadgeSeriesConfig(s){return(0,P.mG)(this,void 0,void 0,function*(){const m=yield this._achievementService.getAchievementSeriesForUser(s);let r=[];for(let R of m.achievementsData)r.push(this._getBadgeConfig(R));const S=r.filter(R=>R.badgeStatus===D.u0.EARNED||R.badgeStatus===D.u0.COVERED);return{seriesTitle:m.achievementSeriesTitle,seriesDescription:m.achievementSeriesDesc,seriesBadges:r,seriesHighestEarnedIndex:S.length-1,topicSearchString:m.achievementTopicString}})}showAchievementToast(s){this._epicToastCustomService.show({title:`You earned ${s.count} ${s.count>1?"badges":"badge"}`,message:"Click to collect.",type:"achievement",imgUrl:"../assets/app/animations/achievement/badgeStar.gif",classes:["epic-toast-custom--image-circle"],bqParams:{badges:s.badgeNames,count:s.count}})}showBadgeDialog(s,m,r,S=!1,B){return(0,P.mG)(this,void 0,void 0,function*(){let L,N,Q,R=this._getBadgeConfig(s);if(s.achievementSeriesID&&(L=yield this._getBadgeSeriesConfig(s)),B){let l=this._achievementService.getNextUpcomingBadge();N=this._getBadgeConfig(l)}s.revealed||(Q=l=>{S&&this.openNextBadgeDialog$.next(),this._achievementService.setAchievementRevealed(l)}),r=this._addSeriesBadgeBigQueryParams(r,L);let $,H=[];if(m!==D.$S.START_OF_BOOK&&!S)if(s.bookIdRequired){const l=new Set(s.bookIds||[]);H=(s.bookIdRequired||[]).filter(I=>!l.has(parseInt(I)))}else $=this._achievementService.getRecommendations().then(l=>{V.data.recommendedBookData=l});let V={};V=Object.assign(V,this._coreDialogService.fullScreenDialogConfigNoBorder),V.panelClass.push("allow-overflow"),V.closeOnNavigation=!1,V.data={badgeConfig:R,badgeSeriesConfig:L,badgeTips:this._achievementService.badgeTips,openedFrom:m,bqParams:r,nextBadgeConfig:N,showMultipleBadges:S,recommendedBookData:[],requiredBookIds:H,setBadgeRevealedFunction:Q,bookRecommendationsProm
1ise:$},this._logBadgeViewOpen(s,m,L);let j=!1;const w=yield this._coreDialogService.loadComponentWithLazyLoadImports(C.E.BadgeDialogComponent,V),o=(null==w?void 0:w.componentInstance).revealFinished.subscribe(()=>{o.unsubscribe(),j=!0});w.afterClosed().subscribe(()=>{const c={badge_view:j?"revealed":this._achievementService.getBadgeStatus(s),source:m};this._bigQueryService.log("badge_view_close",c),this.closeAllDialogs()}),this.badgeDialogQueue.push(w)})}closeAllDialogs(){this.closeAllBadgeDialogs$.next();for(let s of this.badgeDialogQueue)s.close();this._showRewardBackgroundService.hideRewardBackgroundOnApp(),this.badgeDialogQueue=[]}_logBadgeViewOpen(s,m,r){let R={badge_view:this._achievementService.getBadgeStatus(s),badge:s.name,source:m};R=this._addSeriesBadgeBigQueryParams(R,r),this._bigQueryService.log("badge_view_open",R)}_addSeriesBadgeBigQueryParams(s,m){let r=null==m?void 0:m.seriesBadges;return Object.assign(Object.assign({},s),(null==r?void 0:r.length)?{badge_status:1,series_count:null==r?void 0:r.length,series_earned:(null==r?void 0:r.filter(S=>1===S.badge.completed).length)||0}:{badge_status:0})}}return h.\u0275fac=function(s){return new(s||h)(p.LFG(y.o),p.LFG(O.p),p.LFG(T.CoreDialogService),p.LFG(v.J),p.LFG(g.R))},h.\u0275prov=p.Yz7({token:h,factory:h.\u0275fac,providedIn:"root"}),h})()},21879:(K,M,t)=>{t.d(M,{c:()=>u});var P=t(34929),D=t(95679),C=t(15527),d=t(17714),p=t(3184),y=t(91102),O=t(34077),T=t(11105),v=t(13530),g=t(31503),a=t(24047);let u=(()=>{class _{constructor(E,s,m,r,S,B){this.achievementService=E,this.achievementFlowsService=s,this.experienceService=m,this.messageHandler=r,this.routingService=S,this._showRewardBackgroundService=B,this.queue=[],this.queueIsPaused=!1,this.showMultipleBadges=!1,this.contentConsumptionStates=[C.Pm.READ],this.subscriptions=new d.w0,this.MULTIPLE_BADGE_REVEAL_DELAY=6e3}init(){return(0,P.mG)(this,void 0,void 0,function*(){this.messageHandler.subscribeObserver(this),this.subscriptions.add(this.achievementService.badgeRevealed$.subscribe(()=>{this.showMultipleBadges||this.clearAchievementQueue()})),this.subscriptions.add(this.achievementFlowsService.closeAllBadgeDialogs$.subscribe(()=>{clearTimeout(this.openNextBadgeDialogTimer),this.clearAchievementQueue()})),this.subscriptions.add(this.achievementFlowsService.openNextBadgeDialog$.subscribe(()=>{this.openNextBadgeDialogTimer=setTimeout(()=>(0,P.mG)(this,void 0,void 0,function*(){this.showMultipleBadges=this.queue.length>1,yield this.showNextAchievement()}),this.MULTIPLE_BADGE_REVEAL_DELAY)}))})}ngOnDestroy(){clearTimeout(this.openNextBadgeDialogTimer),clearTimeout(this.badgeCelebrationDelay),this.subscriptions.unsubscribe()}handleMessage(E){"UserAchievement"===E.objectType&&(this.achievementService.refreshAchievementsForUser(),this.queueAchievement(E))}queueAchievement(E){void 0===this.queue.find(s=>s.key===E.key)&&(this.queue=this.queue.filter(s=>s.object.name!==E.object.name),this.queue.push(E)),this.contentConsumptionStates.includes(this.routingService.getCurSubroute())&&this.pauseAchievementsQueue()}showNextAchievement(){var E;return(0,P.mG)(this,void 0,void 0,function*(){if(this.queue.length<1||this.queueIsPaused)return;this.currentAchievement=this.queue[0].object,null===(null===(E=this.currentAchievement)||void 0===E?void 0:E.rewards)&&(this.currentAchievement.rewards=[]);const s=this.queue.length,m=this.queue.map(r=>r.object.name).join();this.bqParams={badges:m,count:s},this.experienceService.isFreemiumExperience()?this.achievementFlowsService.showAchievementToast({badgeNames:m,count:s}):this.currentAchievement&&(yield this.achievementFlowsService.showBadgeDialog(this.currentAchievement,D.$
1S.CELEBRATION,this.bqParams,this.showMultipleBadges)),this.showMultipleBadges?this.queue.shift():this.clearAchievementQueue()})}pauseAchievementsQueue(){this.badgeCelebrationDelay&&clearTimeout(this.badgeCelebrationDelay),this.queueIsPaused=!0}unpauseAchievementsQueue(E=2e3){this.queueIsPaused?(this.queueIsPaused=!1,this.badgeCelebrationDelay&&clearTimeout(this.badgeCelebrationDelay),this.badgeCelebrationDelay=setTimeout(()=>(0,P.mG)(this,void 0,void 0,function*(){this.showMultipleBadges=this.queue.length>1,this.queue.length<1&&this._showRewardBackgroundService.hideRewardBackgroundOnApp(0),yield this.showNextAchievement()}),E)):this._showRewardBackgroundService.hideRewardBackgroundOnApp()}clearAchievementQueue(){this.currentAchievement=void 0,this.queue=[]}}return _.\u0275fac=function(E){return new(E||_)(p.LFG(y.o),p.LFG(O.x),p.LFG(T.DT),p.LFG(v.d),p.LFG(g.Zn),p.LFG(a.R))},_.\u0275prov=p.Yz7({token:_,factory:_.\u0275fac,providedIn:"root"}),_})()},14322:(K,M,t)=>{t.d(M,{Q:()=>g});var P=t(34929),D=t(65758),C=t(50253),d=t(73398),p=t(3184),y=t(86486),O=t(64617),T=t(44687),v=(()=>{return(a=v||(v={})).SLOW="slow",a.MEDIUM="medium",a.FAST="fast",v;var a})();let g=(()=>{class a{constructor(_,h,E){this.contentVolumeService=_,this.localStorageService=h,this.profileService=E,this.audio=null,this.isLoaded=!1,this.isPlaying=!1,this.endedObservable=new C.x,this.errorObservable=new C.x,this.playbackRateOptionsList=[{id:v.SLOW,label:"Slower",value:.75,icon:D.L.SKATE},{id:v.MEDIUM,label:"Medium",value:1,icon:D.L.CAR},{id:v.FAST,label:"Faster",value:1.25,icon:D.L.ROCKET}],this.playbackRateChanged=new C.x,this.selectedPlaybackRate=v.MEDIUM,this._playbackRate=1,this.errorHandler=s=>{this.isLoaded=!1,this.isPlaying=!1,this.errorObservable.next(s)},this.profileService.currentProfileObservable.subscribe(()=>{this.initPlaybackRate()})}get playbackRate(){return this._playbackRate}set playbackRate(_){this._playbackRate=_,this.playbackRateChanged.next(),this.audio&&(this.audio.playbackRate=this.playbackRate)}initNewAudio(_){console.log("initNewAudio gets called"),this.audio||(this.audio=new Audio(_),this.addEventListeners()),this.audio.src=_,this.audio.load()}addEventListeners(){!this.audio||(this.audio.addEventListener("ended",()=>{this.isLoaded=!1,this.isPlaying=!1,this.endedObservable.next(!0)}),this.audio.addEventListener("error",this.errorHandler))}play(){return(0,P.mG)(this,void 0,void 0,function*(){if(this.audio)return this.isPlaying=!0,this.audio.play().then(()=>{},this.errorHandler)})}pause(){this.audio&&(this.isPlaying=!1,this.audio.pause())}setVolume(_){this.audio&&(this.audio.volume=_)}getVolume(){return this.audio?this.audio.volume:100}set(_){!_||(this.audio?(this.audio.src=_,this.audio.load()):this.initNewAudio(_),this.playbackRate=this.playbackRate,this.audio.volume=this.contentVolumeService.value/100,this.isLoaded=!0)}clear(){this.isPlaying=!1,this.isLoaded=!1,this.audio&&(this.audio.pause(),this.audio.currentTime=0)}getAudioTime(){return this.audio?this.audio.currentTime:0}getAudioLength(){return this.audio?this.audio.duration:0}selectPlaybackRate(_){let h=this.getPlaybackDataById(_);if(h){this.playbackRate=h.value;const E=this.localStorageService.get(d.cB)||{};E[this.profileService.currentProfile.id]=_,this.localStorageService.set(d.cB,E),this.selectedPlaybackRate=_}}getPlaybackDataById(_){return this.playbackRateOptionsList.find(h=>h.id===_)}getPlaybackRate(){return this.playbackRate}initPlaybackRate(){const _=this.localStorageService.get(d.cB)||{};this.selectedPlaybackRate=_[this.profileService.currentProfile.id]||v.MEDIUM;let h=this.getPlaybackDataById(this.selectedPlaybackRate);h&&(this.playbackRate=h.value)}getFastestPlayBackSpeedValue(){const _=this.playbackRateOptionsList.find(h=>h.id===v.FAST);return _?_.value:null}}return a.\u0275fac=function(_){return new(_||a)(p.LFG(y.R),p.LFG(O.n),p.LFG(T.ProfileService))},a.\u0275prov=p.Yz7({token:a,factory:a.\u0275fac,providedIn:"root"}),a})()},86486:(K,M,t)=>{t.d(M,{R:()=>p});var P=t(73398),D=t(50253),C=t(3184),d=t(64617);let p=(()=>{class y{constructor(T){this.localStorage=T,this.muted=!1,this._value=100,this.volumeValueBeforeMute=100,this.volumeChanged=new D.x,this._lsVolume=this.localStorage.get(P.vM),this._isLoaded=this._lsVolume,this._value=this._lsVolume?this._lsVolume.level:100,this.muted=!!this._lsVolume&&this._lsVolume.muted,this.volumeValueBeforeMute=this.value}get isLoaded(){return this._isLoaded}initValues(){this.localStorage.set(P.vM,{level:100,muted:!1})}set value(T){0===T&&this.value&&(this.volumeValueBeforeMute=this.value),T<=0?this.muted=!0:T>0&&(this.muted=!1),this._value=T,this.volumeChanged.next(this._value),this.saveToLocalStorage()}get value(){return this._value}toggleMute(){this.muted=!this.muted,this.muted&&(this.volumeValueBeforeMute=this.value),this.value=this.muted?0:this.volumeValueBeforeMute,this.saveToLocalStorage()}isMuted(){return!!this.muted}saveToLocalStorage(){this.localStorage.set(P.vM,{level:this.value,muted:this.muted})}}return y.\u0275fac=function(T){return new(T||y)(C.LFG(d.n))},y.\u0275prov=C.Yz7({token:y,factory:y.\u0275fac,providedIn:"root"}),y})()},1495:(K,M,t)=>{t.d(M,{x:()=>u});var P=t(34929),D=t(95758),C=t(78433),d=t(3184),p=t(88578),y=t(98476),O=t(53453),T=t(55434);let v=(()=>{class _{constructor(E,s,m,r){this.dialogRef=E,this.accountLinkService=s,this.bigQueryService=m,this.data=r,this.accountUUID="",this.profile=r.profile||null,this.accountUUID=r.accountUUID||""}close(){this.dialogRef.close()}unlinkProfile(){this.accountUUID&&(this.bigQueryService.log(C._e,{source:"parent_dash",kid_id:this.profile.id,teacher_uuid:this.accountUUID}),this.accountLinkService.unlinkAccountLink(this.profile,this.accountUUID).then(()=>{this.dialogRef.close("success")}
1).catch(E=>{this.dialogRef.close()}))}}return _.\u0275fac=function(E){return new(E||_)(d.Y36(D.so),d.Y36(p.Q),d.Y36(y.p),d.Y36(D.WI,8))},_.\u0275cmp=d.Xpm({type:_,selectors:[["epic-profile-unlink"]],decls:17,vars:3,consts:[[1,"mat-dialog-close",3,"click"],["mat-dialog-title",""],["mat-dialog-content",""],[1,"prompt"],[1,""],[1,"profile-unlink-avatar"],[3,"avatarId","width"],["avatar-image","profile.avatar"],[1,"profile-unlink-h2","grey-text"],["fxLayout","","fxLayoutAlign","center center",1,"dialog-actions-container"],[1,"epic-btn","epic-btn--secondary",3,"click"],[1,"epic-btn",3,"click"]],template:function(E,s){1&E&&(d.TgZ(0,"div",0),d.NdJ("click",function(){return s.close()}),d.qZA(),d.TgZ(1,"h2",1),d._uU(2,"Leave the Class"),d.qZA(),d.TgZ(3,"div",2)(4,"div",3)(5,"div",4),d._uU(6," Are you sure you want to unlink this profile from the class? "),d.qZA()(),d.TgZ(7,"div",5),d._UZ(8,"avatar-icon",6)(9,"div",7),d.TgZ(10,"div",8),d._uU(11),d.qZA()(),d.TgZ(12,"div",9)(13,"button",10),d.NdJ("click",function(){return s.close()}),d._uU(14," Never Mind "),d.qZA(),d.TgZ(15,"button",11),d.NdJ("click",function(){return s.unlinkProfile()}),d._uU(16,"Unlink"),d.qZA()()()),2&E&&(d.xp6(8),d.Q6J("avatarId",s.profile.avatar)("width",90),d.xp6(3),d.Oqu(s.profile.name))},directives:[D.uh,D.xY,O.J,T.xw,T.Wh],styles:[".profile-unlink-avatar[_ngcontent-%COMP%]{margin:20px 0;text-align:center}"]}),_})();var g=t(94660),a=t(68893);let u=(()=>{class _{constructor(E,s){this.coreDialogService=E,this.dialog=s,this.dialogRef=this.dialog}openAssignInstructionsDialog(){return(0,P.mG)(this,void 0,void 0,function*(){return yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.AssignInstructionsDialogComponent,this.coreDialogService.defaultDialogConfig)})}openTestSendABookModal(){return(0,P.mG)(this,void 0,void 0,function*(){return yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.TestSendBookComponent,{backdropClass:"epic-mat-backdrop",panelClass:["epic-mat-dialog"]})})}openProfileUnlinkDialog(E,s,m){let r={data:{profile:E,onSuccess:s,accountUUID:m}};r=Object.assign(r,this.coreDialogService.defaultDialogConfig);const S=this.dialog.open(v,r);return S.afterClosed().subscribe(B=>{"success"===B&&s&&s()}),S}openProfileEditDialog(E,s){return(0,P.mG)(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},{data:{profile:E}}),this.coreDialogService.defaultDialogConfig);r.panelClass=["epic-mat-dialog--profile-edit"].concat(r.panelClass||[]),r.autoFocus=!1;const S=yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.ProfileEditComponent,r);return S.afterClosed().subscribe(B=>{"success"===B&&s&&s()}),S})}openInactiveBookDialog(E){return(0,P.mG)(this,void 0,void 0,function*(){let s={};return s=Object.assign(s,this.coreDialogService.defaultDialogConfig),s.data={bookSuggestions:E},yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.InactiveBookDialogComponent,s)})}openConfirmationDialog(E,s,m=!1,r){return(0,P.mG)(this,void 0,void 0,function*(){const S=Object.assign({},this.coreDialogService.defaultDialogConfig);return S.data={title:E,description:s,oneOption:m,replyData:this.coreDialogService.CONFIRMATION_DIALOG_REPLY_DATA,customParams:r},yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.ConfirmationDialogComponent,S)})}openKudosDialog(E){return(0,P.mG)(this,void 0,void 0,function*(){let s={};return s=Object.assign(s,this.coreDialogService.defaultDialogConfig),s.data={kudoMessage:E},s.panelClass=["epic-mat-dialog","epic-mat-dialog--kudos"],yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.KudosDialogComponent,s)})}openConnectSuccessDialog(E){return(0,P.mG)(this,void 0,void 0,function*(){let s={};return s=Object.assign(s,this.coreDialogService.defaultDialogConfig),s.data={connectedProfile:E},yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.ConnectSuccessDialogComponent,s)})}openGoogleClassroomDialog(){return(0,P.mG)(this,void 0,void 0,function*(){return yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.GoogleClassroomDialogComponent)})}}return _.\u0275fac=function(E){return new(E||_)(d.LFG(a.CoreDialogService),d.LFG(D.uw))},_.\u0275prov=d.Yz7({token:_,factory:_.\u0275fac,providedIn:"root"}),_})()},17963:(K,M,t)=>{t.d(M,{it:()=>O,n5:()=>p});var P=t(73398),D=t(3184),C=t(65925),d=t(64617),p=(()=>{return(T=p||(p={}))[T.NO_STATUS=0]="NO_STATUS",T[T.NOT_VERIFIED=1]="NOT_VERIFIED",T[T.VERIFIED=2]="VERIFIED",p;var T})(),y=(()=>{return(T=y||(y={})).EMPTY_EMAIL="",T.ACCOUNT_ALREADY_EXISTS="accountAlreadyExists",T.NO_EMAIL_RECORD="noEmailRecord",T.REQUEST_FAILED="requestFailed",y;var T})();let O=(()=>{class T{constructor(g,a){this._dataService=g,this._localStorageService=a}getEmailVerificationStatus(g){return this._dataService.post("WebEmailVerification","getEmailVerificationStatus",{userId:g}).then(a=>a)}sendConsumerEmailVerification(g,a,u,_){const h={userId:g};return a&&(h.email=a),u&&(h.allowAlreadyCreatedAccounts=u),_&&(h.shouldSubscribeToFreemium=_),this._dataService.post("WebEmailVerification","sendConsumerEmailVerification",h).then(E=>E?E.success?E.result:(console.log("Could not send email verification for user:",g),E):{success:0,reason:y.REQUEST_FAILED})}resetEmailVerifyDialogInfo(){this._localStorageService.get(P.PC)===P.rP.EMAIL_VERIFICATION&&(this._localStorageService.remove(P.PC),this._localStorageService.remove(P.es))}}return T.\u0275fac=function(g){return new(g||T)(D.LFG(C.D),D.LFG(d.n))},T.\u0275prov=D.Yz7({token:T,factory:T.\u0275fac,providedIn:"root"}),T})()},26555:(K,M,t)=>{t.d(M,{l:()=>g});var P=t(34929),D=t(73398),C=t(94660),d=t(3184),p=t(68893),y=t(11105),O=t(64617),T=t(17963),v=(()=>{return(a=v||(v={}))[a.NO_STATUS=0]="NO_STATUS",a[a.NOT_VERIFIED=1]="NOT_VERIFIED",a[a.VERIFIED=2]="VERIFIED",v;var a})();let g=(()=>{class a{constructor(_,h,E,s){this._coreDialogService=_,this._emailVerifyApiService=h,this._experienceService=E,this._localStorageService=s,this.verificationStatusMap=v}setEmailVerifyDialogInfo(_){this._localStorageService.set(D.PC,D.rP.EMAIL_VERIFICATION),this._localStorageService.set(D.es,_)}resetEmailVerifyDialogInfo(){return this._emailVerifyApiService.resetEmailVerifyDialogInfo()}openEmailVerificationDialog(_){return(0,P.mG)(this,void 0,void 0,function*(){if(this._experienceService.isTeacher())return;const h={disableClose:!0,panelClass:"epic-mat-dialog--freemium-simple-dialog",data:{type:_}};return yield this._coreDialogService.loadComponentWithLazyLoadImports(C.E.EmailVerificationDialogComponent,h)})}getEmailVerificationStatus(_){return this._emailVerifyApiService.getEmailVerificationStatus(_)}sendConsumerEmailVerification(_,h,E,s){return this._emailVerifyApiService.sendConsumerEmailVerification(_,h,E,s)}}return a.\u0275fac=function(_){return new(_||a)(d.LFG(p.CoreDialogService),d.LFG(T.it),d.LFG(y.DT),d.LFG(O.n))}
1,a.\u0275prov=d.Yz7({token:a,factory:a.\u0275fac,providedIn:"root"}),a})()},33949:(K,M,t)=>{t.d(M,{U:()=>_});var P=t(34929),D=t(73398),C=t(2279),d=t(3184),p=t(1146),y=t(1651),O=t(64617),T=t(44687),v=t(78693),g=t(26555),a=t(48146),u=t(64039);let _=(()=>{class h{constructor(s,m,r,S,B,R,L,N){this._accountService=s,this._afterHoursDialogService=m,this._afterHoursService=r,this._emailVerificationService=S,this._freemiumService=B,this._localStorageService=R,this._onboardingDialogService=L,this._profileService=N,this._subscriptions=[];const Q=this._accountService.accountLogoutObservable.subscribe($=>{this.resetDialogs()});this._subscriptions.push(Q)}ngOnDestroy(){for(let s=0;s<this._subscriptions.length;s++)this._subscriptions[s].unsubscribe()}setShowBlockingDialog(s){this._localStorageService.set(D.PC,s)}setShowBrowseDialog(s){this._localStorageService.set(D.rg,s)}showCurDialog(){return(0,P.mG)(this,void 0,void 0,function*(){let s,m=this._localStorageService.get(D.PC);return m?s=yield this.showCurBlockingDialog():(m=this._localStorageService.get(D.rg),m&&(s=yield this.showCurNonBlockingDialog())),s})}showCurBlockingDialog(){return(0,P.mG)(this,void 0,void 0,function*(){let s;const m=this._localStorageService.get(D.PC);if(m)switch(m){case D.rP.EMAIL_VERIFICATION:s=yield this._emailVerificationService.openEmailVerificationDialog();break;case D.rP.AFTER_HOURS:if(this._afterHoursService.shouldAllowAfterHoursReading())break;const r=yield this._profileService.loadCurrentProfile(),S=this._profileService.getNewProfile(r);s=yield this._afterHoursDialogService.openAfterHoursDialog(S,!0)}return s})}showCurNonBlockingDialog(){return(0,P.mG)(this,void 0,void 0,function*(){let s;switch(this._localStorageService.get(D.rg)){case D.rP.FREEMIUM_WELCOME:s=this._freemiumService.showFreemiumWelcomeDialog();break;case D.rP.FREE_TO_BASIC_TRANSITION_UPSELL:s=yield this._freemiumService.openFreeToBasicDialog();break;case D.rP.PRODUCT_COMPARE:s=yield this._onboardingDialogService.openProductCompareDialog(C.E4.UNKNOWN,{handleSubComplete:()=>null==location?void 0:location.reload(),handleClose:()=>null});break;case D.rP.ONE_DOLLAR_PROMO:case D.rP.NATIONAL_READING_MONTH:case D.rP.BTS2022:s=yield this._onboardingDialogService.openLimitedTimeOfferPromoUpsellDialog(C.E4.UNKNOWN,{handleSubComplete:()=>null==location?void 0:location.reload(),handleClose:()=>null})}return s})}resetDialogs(){this._localStorageService.remove(D.PC),this._localStorageService.remove(D.rg)}setDialogsFromSessionStorage(){}}return h.\u0275fac=function(s){return new(s||h)(d.LFG(p.B),d.LFG(v.h),d.LFG(y.AfterHoursService),d.LFG(g.l),d.LFG(a.h),d.LFG(O.n),d.LFG(u.G),d.LFG(T.ProfileService))},h.\u0275prov=d.Yz7({token:h,factory:h.\u0275fac,providedIn:"root"}),h})()},21618:(K,M,t)=>{t.d(M,{e:()=>E});var P=t(34929),D=t(25769),C=t(42307),d=t(50253),p=t(15527),y=t(68087),O=t(3184),T=t(65925),v=t(98476),g=t(44687),a=t(90442),u=t(56187),_=t(31503),h=t(12379);let E=(()=>{class s{constructor(r,S,B,R,L,N,Q){this.data=r,this.bigQuery=S,this.profileService=B,this.stringService=R,this.epicToastCustomService=L,this.routingService=N,this.router=Q,this.favorites={},this.favoriteToggled=new d.x,this.maxTitleLengthInToast=40,this.profileService.currentProfileObservable.subscribe(()=>{var $,H,V;const j=null===(H=null===($=this.router.url)||void 0===$?void 0:$.split("?"))||void 0===H?void 0:H[0],w=null===(V=null==window?void 0:window.location)||void 0===V?void 0:V.pathname;"/promo/success"!==j&&"/app/compare"!==w&&this.getFavorites()})}getContentTitle(r){return this.stringService.truncate(r,this.maxTitleLengthInToast)}loadFavorites(){var r,S;const B=null===(S=null===(r=this.router.url)||void 0===r?void 0:r.split("?"))||void 0===S?void 0:S[0];return"/promo/success"===B||"/app/compare"===B?Promise.resolve(null):this.data.get("WebFavorite","getFavoriteRowsForUserId").then(R=>{if(R&&R.result){const L={},N={},Q=R.result,$=["bookData","quizData","videoData"];for(let H=0;H<$.length;H++)Q[$[H]].length>0&&Q[$[H]].forEach(V=>{L[V.id]=!0});return Q.playlists.length>
10&&Q.playlists.forEach(H=>{N[H.id]=!0}),this.favorites[this.profileService.currentProfile.id]={books:L,collections:N},this.favorites[this.profileService.currentProfile.id]}return null})}getFavoritesFullData(){var r;return(0,P.mG)(this,void 0,void 0,function*(){let S,B=null===(r=yield this.data.get("WebFavorite","getFavoriteRowsForUserId"))||void 0===r?void 0:r.result;return B&&(S={},S.collections=B.playlists.map(R=>new C.FE(R)),S.books=B.bookData.map(R=>new D.c(R)),S.videos=B.videoData.map(R=>new D.c(R))),S})}getFavorites(){const r=this.favorites[this.profileService.currentProfile.id];return r?Promise.resolve(r):this.loadFavorites()}getFavoriteBooks(){return this.favorites[this.profileService.currentProfile.id]?this.favorites[this.profileService.currentProfile.id].books:{}}toggleContentFavorite(r,S,B,R,L,N){if(!r)return null;const Q={content_type:"",content_id:null,src:N},$=this.routingService.getCurRoute()[1];N||(Q.src=$);const H=D.c.getContentTypeString(R);return R&&(Q.content_type=H),Q.content_id=Number(r),this.bigQuery.log(B?y.t9:y.$f,Q),$===p.Pm.SEARCH&&(Q.favorite=B,this.bigQuery.log(y.$P,Q)),this.data.post("WebUserBook","favoriteBook",{bookId:r,val:B?1:0}).then(j=>{if(j.success&&(this.favoriteToggled.next([Number(r),B]),this.favorites[this.profileService.currentProfile.id]&&(this.favorites[this.profileService.currentProfile.id].books[r]=B),!L)){const w=this.getCustomToastParams(B,S);this.epicToastCustomService.show(w)}return j})}toggleCollectionFavorite(r,S,B,R){return r?this.data.post("WebPlaylist","favoritePlaylist",{playlistId:r,favorited:B?1:0}).then(L=>{if(L.result&&this.favorites[this.profileService.currentProfile.id]&&(this.favorites[this.profileService.currentProfile.id].collections[r]=B),L.result&&!R){const N=this.getCustomToastParams(B,S);this.epicToastCustomService.show(N)}return L}):null}getCombinedHtmlMessage(r,S){const B=`<div class='favorites-title-in-message'>${r?"Added to":"Removed from"} <a href='/${p.FW}/my-library/favorites'>My Library: Favorites</a>!</div>`,R=this.getContentTitle(S);return B.concat("",R)}getCustomToastParams(r,S){return{title:`${r?"Added to":"Removed from"} <a href='/${p.FW}/my-library/favorites'>My Library: Favorites</a>!`,message:this.getContentTitle(S),type:"info",imgUrl:r?"/assets/app/toasts/favorites-add-character.png":"/assets/app/toasts/favorites-remove-character.png"}}}return s.\u0275fac=function(r){return new(r||s)(O.LFG(T.D),O.LFG(v.p),O.LFG(g.ProfileService),O.LFG(a.P),O.LFG(u.J),O.LFG(_.Zn),O.LFG(h.F0))},s.\u0275prov=O.Yz7({token:s,factory:s.\u0275fac,providedIn:"root"}),s})()},34703:(K,M,t)=>{t.d(M,{BB:()=>y,Ob:()=>p,oG:()=>d});var P=t(15286),D=t(57478),C=t(3184),d=(()=>{return(O=d||(d={}))[O.PERMITTED=0]="PERMITTED",O[O.LIMIT_EXCEEDED=1]="LIMIT_EXCEEDED",d;var O})(),p=(()=>{return(O=p||(p={}))[O.ONE_BOOK_CHOOSE_BOOK=3]="ONE_BOOK_CHOOSE_BOOK",O[O.ONE_BOOK_BOOK_ALREADY_CHOSEN=4]="ONE_BOOK_BOOK_ALREADY_CHOSEN",p;var O})();let y=(()=>{class O{constructor(){}createBookPreviewHandler(v,g,a,u){if(!v)throw new Error("BookPreviewGuard::createPreviewHandler called with null value for book");const h=O.getPreviewPageLimit(a,v,g.previewPages);return{checkAccess:s=>(s=>({status:s,handleStatus:null==u?void 0:u[s]}))(s>h?d.LIMIT_EXCEEDED:d.PERMITTED),pageLimit:h}}createDailyBookPreviewHandler(v,g,a,u,_){if(!v)throw new Error("BookPreviewGuard::createPreviewHandler called with null value for book");const h=O.getPreviewPageLimit(u,v,a?g.previewPages:void 0);let m=a;return{checkAccess:S=>(S=>({status:S,handleStatus:null==_?void 0:_[S]}))(S<=h||m===v.id?d.PERMITTED:a?m!==v.id?p.ONE_BOOK_BOOK_ALREADY_CHOSEN:d.LIMIT_EXCEEDED:p.ONE_BOOK_CHOOSE_BOOK),pageLimit:h,setDailyBookId:S=>m=S}}static getPreviewPageLimit(v,g,a=D.f.DEFAULT_PREVIEW_PAGE_LIMIT){if(!g)return 0;let u=g.getPreviewPageLimit(a);return v===P.h.DOUBLE_PAGE&&u%2==1&&u--,u||1}}return O.\u0275fac=function(v){return new(v||O)},O.\u0275prov=C.Yz7({token:O,factory:O.\u0275fac,providedIn:"root"}),O})()},45317:(K,M,t)=>{t.d(M,{z:()=>a});var P=t(34929),D=t(3184),C=t(16447),d=t(98476),p=t(41752),y=t(9147),O=t(8296),T=(()=>{return(u=T||(T={})).COMING_SOON_DIALOG_OPENED="content_preview_open",u.COMING_SOON_DIALOG_CLOSED="content_preview_close",T;var u})(),v=(()=>{return(u=v||(v={})).SERIES_ID="series_id",u.BOOK_ID="book_id",u.PREVIEW_DAYS_REMAINING="preview_days_remaining",u.ROW_TITLE="row_title",u.BOOK_POSITION="item_position",u.CLOSE_TYPE="close_type",v;var u})(),g=(()=>{return(u=g||(g={})).CLOSE_X_BUTTON="x_button",u.CLOSE_CTA_BUTTON="cta_button",u.CLOSE_OUTSIDE="outside_popup",g;var u})();let a=(()=>{class u{constructor(h,E,s,m,r){this._bookService=h,this._bqService=E,this._confirmationDialogService=s,this._contentGatingService=m,this._env
1Service=r,this.cdn=this._envService.cdnBase}getBookPreviewMaskURL(h){if(!h.preview||void 0===h.previewDaysRemaining)return;if(h.preview&&null===h.previewDaysRemaining)return`${this.cdn}/epic_originals/locked-cover-masks/coming-soon-cover.png`;let E;if(h.previewDaysRemaining>1)E=`${h.previewDaysRemaining}-days-cover`;else{if(1!==h.previewDaysRemaining)return;E=`${h.previewDaysRemaining}-day-cover`}return`${this.cdn}/epic_originals/locked-cover-masks/${E}.png`}openComingSoonBlockingDialog(h,E){return(0,P.mG)(this,void 0,void 0,function*(){let s=this._contentGatingService.shouldShowLockIcon(h);const m=this._bookService.getThumbPathForBook(h,s),r=this.getBookPreviewMaskURL(h),S=$localize`:closes dialog|cta:Iâll Be Back`;let B;B=E.daysRemaining&&E.daysRemaining>0?$localize`:come back soon|header:Come back in ${E.daysRemaining} ${1===E.daysRemaining?"day":"days"}!`:$localize`:come back soon|header:Come back soon!`;const L={title:B,desc:$localize`:find out what happens next in the series|paragraph:Find out what happens next in the ${E.seriesTitle} series. You don't want to miss this.`,ctaText:S},N=yield this._confirmationDialogService.openConfirmationDialog(L.title||"",L.desc||"",!0,!1,{confirmText:L.ctaText,imgUrl:m,bookMaskUrl:r,confirmIsPrimaryAction:!0,imgStyle:{width:"186px",height:"unset"},titleStyle:{"padding-top":"16px"},descriptionStyle:{padding:"0px 100px 0px 100px"}});return null==N||N.afterOpened().subscribe(()=>(this._logDialogOpenEvent(E),N)),null==N||N.afterClosed().subscribe(Q=>{this._logDialogCloseEvent(E,Q)}),N})}_getBqParams(h){return{[v.SERIES_ID]:h.seriesId,[v.BOOK_ID]:h.bookId,[v.PREVIEW_DAYS_REMAINING]:h.daysRemaining||null}}_logDialogOpenEvent(h){let E=Object.assign(Object.assign({},this._getBqParams(h)),{[v.ROW_TITLE]:h.seriesTitle,[v.BOOK_POSITION]:h.bookPosition});this._bqService.log(T.COMING_SOON_DIALOG_OPENED,E)}_logDialogCloseEvent(h,E){let s="";switch(E){case"confirm":s=g.CLOSE_CTA_BUTTON;break;case"dismiss":s=g.CLOSE_X_BUTTON;break;default:s=g.CLOSE_OUTSIDE}let m=Object.assign(Object.assign({},this._getBqParams(h)),{[v.CLOSE_TYPE]:s});this._bqService.log(T.COMING_SOON_DIALOG_CLOSED,m)}}return u.\u0275fac=function(h){return new(h||u)(D.LFG(C.Z),D.LFG(d.p),D.LFG(y.O),D.LFG(O.s6),D.LFG(p.DJ))},u.\u0275prov=D.Yz7({token:u,factory:u.\u0275fac,providedIn:"root"}),u})()},94866:(K,M,t)=>{t.d(M,{X:()=>C});var P=t(50253),D=t(3184);let C=(()=>{class d{constructor(){this.openBookObservable=new P.x}}return d.\u0275fac=function(y){return new(y||d)},d.\u0275prov=D.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})()},55899:(K,M,t)=>{t.d(M,{K:()=>y});var P=t(28609),D=t(28653),C=t(3184),d=t(65925),p=t(41752);let y=(()=>{class O{constructor(v,g){this.data=v,this._envService=g,this.UPDATE_BE_EVERY=3e5,this.entryInterval=(0,D.F)(this.UPDATE_BE_EVERY),this.logEntryQueue=[]}findOrCreateCurrentLogEntry(v){const g=this._envService.getTimezoneOffset();return this.data.get("WebUser","findOrCreateCurrentLogEntry",{bookId:v,timezoneOffset:g}).then(u=>u.result?new P.B(u.result):(console.warn("problem finding or creating log entry..."),null))}shouldTheLogEntriesBeGrouped(v,g){return(null==v?void 0:v.userId)===g.userId&&(null==v?void 0:v.date)===g.date&&(null==v?void 0:v.userId)===g.userId&&(null==v?void 0:v.modelClass)===g.modelClass}startScheduler(){this.$beUpdateScheduler||(this.$beUpdateScheduler=this.entryInterval.subscribe(()=>{this.batchLogsAndUpdateBe()}))}batchLogsAndUpdateBe(){var v;if(this.logEntryQueue.length){let g=this.logEntryQueue.shift();for(;this.logEntryQueue.length;){const a=this.logEntryQueue.shift();g?this.shouldTheLogEntriesBeGrouped(g,a)?g=Object.assign({},g,a):(this.updateLogEntry(g,!0,!1),g=a):g=a}this.updateLogEntry(g,!0,!1)}else null===(v=this.$beUpdateScheduler)||void 0===v||v.unsubscribe(),this.$beUpdateScheduler=void 0}updateLogEntry(v,g,a){return a?(this.batchLogsAndUpdateBe(),Promise.resolve()):(v&&(v.timezoneOffsetMinutes=this._envService.getTimezoneOffset()),g?this.data.post("WebUser","updateLogEntry",v).then(u=>(null==u?void 0:u.result)?new P.B(u.result):(console.warn("problem updating log entry..."),null)):(this.logEntryQueue.push(v),this.startScheduler(),Promise.resolve()))}}return O.\u0275fac=function(v){return new(v||O)(C.LFG(d.D),C.LFG(p.DJ))},O.\u0275prov=C.Yz7({token:O,factory:O.\u0275fac,providedIn:"root"}),O})()},35814:(K,M,t)=>{t.d(M,{w:()=>p});var P=t(36362),D=t(68087),C=t(3184),d=t(98476);let p=(()=>{class y{constructor(T,v){this.bigQueryService=T,this.document=v,this.zoomLevel=1,this.maxZoomLevel=2,this.previousZoomLevel=null,this.readPanContainerElement=null,this.readContainerElement=null,this.previousMousePosition={x:0,y:0},this.onMouseDown=g=>{this.previousMousePosition={x:g.pageX,y:g.pageY},this.readPanContainerElement&&this.readPanContainerElement.classList.add("grabbing-cursor"),this.document.addEventListener("mousemove",this.onMouseMove),this.document.addEventListener("mouseup",this.onMouseUp)},this.onMouseUp=g=>{this.readContainerElement&&this.readContainerElement.classList.remove("disable-pointer-events"),this.readPanContainerElement&&this.readPanContainerElement.classList.remove("grabbing-cursor"),this.document.removeEventListener("mousemove",this.onMouseMove),this.document.removeEventListener("mouseup",this.onMouseUp)},this.onMouseMove=g=>{g.preventDefault(),g.stopPropagation(),this.readContainerElement&&this.readContainerElement.classList.add("disable-pointer-events"),this.readPanContainerElement&&(this.readPanContainerElement.scrollBy(1*(this.previousMousePosition.x-g.pageX),1*(this.previousMousePosition.y-g.pageY)),this.previousMousePosition={x:g.pageX,y:g.pageY})}}updateZoomLevel(T,v,g){(T=Math.min(this.maxZoomLevel,Math.max(1,T)))!==this.zoomLevel&&(this.logZoomEvent(T,v,g),this.previousZoomLevel=this.zoomLevel,this.zoomLevel=T,1===this.zoomLevel?this.clearPan():this.initPan(),this.applyStyling())}initPan(){this.readPanContainerElement=this.document.getElementById("read-pan-container"),this.readContainerElement=this.document.getElementById("read-container"),this.readPanContainerElement&&(this.readPanContainerElement.addEventListener("mousedown",this.onMouseDown),this.readPanContainerElement.classList.add("grab-cursor"))}clearPan(){this.readPanContainerElement&&(this.readPanContainerElement.removeEventListener("mousedown",this.onMouseDown),this.readPanContainerElement.classList.remove("grabbing-cursor"),this.readPanContainerElement.classList.remove("grab-cursor"))}applyStyling(T="top left"){const v="scale("+this.zoomLevel+")";this.readContainerElement&&(this.readContainerElement.style.transformOrigin=T,this.readContainerElement.style.transform=v)}logZoomEvent(T,v,g){const a=(this.previousZoomLevel||0)<T?D.P4:D.rr,u={content_type:"book"};u.book_id=v,g&&(u.src=g),this.bigQueryService.log(a,u)}}return y.\u0275fac=function(T){return new(T||y)(C.LFG(d.p),C.LFG(P.K0))},y.\u0275prov=C.Yz7({token:y,factory:y.\u0275fac,providedIn:"root"}),y})()},21365:(K,M,t)=>{t.d(M,{b:()=>H,v:()=>V});var P=t(34929),D=t(59346),C=t(20591),d=t(54363),p=t(50635),y=t(76317),O=t(50253),T=t
1(47643);class v{constructor(w){this.id=parseInt(w.id),this.user_id=parseInt(w.user_id),this.book_id=parseInt(w.book_id),this.title=w.title,this.description=w.description,this.date_created=parseInt(w.date_created),this.date_modified=parseInt(w.date_modified),this.state=parseInt(w.state),this.visibility=parseInt(w.visibility),this.published=parseInt(w.published),this.status=parseInt(w.status),this.date_marked_to_review=w.date_marked_to_review,this.marked_to_review=w.marked_to_review,this.contentType=parseInt(w.content_type),this.recommendation_uuid4=w.recommendation_uuid4,this.quizQuestions=w.quizQuestions,this.bookTitle=w.bookTitle,this.owner=w.owner,this.avgScore=parseInt(w.avgScore),this.numUserTakes=parseInt(w.numUserTakes),w.assignment&&(this.assignment=new T.ot(w.assignment))}isQuizAvailableForAssignment(){return this.published}}var g=t(94660),a=t(78343),u=t(3184),_=t(65925),h=t(41752),E=t(90442),s=t(11105),m=t(1146),r=t(44687),S=t(98476),B=t(68893),R=t(34101),L=t(1495),N=t(71283),Q=t(28784),$=t(35670);const H=[{key:"lexile_level",label:"Lexile",valueLabel:"Lexile value",placeholder:"e.g. 650"},{key:"accelerated_level",label:"AR (ATOS)",valueLabel:"AR book level",placeholder:"e.g. 3.2"},{key:"dra_level",label:"DRA",valueLabel:"DRA level",placeholder:"e.g. 28"},{key:"fandp_level",label:"F&P",valueLabel:"F&P level",placeholder:"e.g. M"},{key:"guided_reading_level",label:"Guided Reading",valueLabel:"Guided Reading level",placeholder:"e.g. P"}];let V=(()=>{class j{constructor(e,o,l,c,I,F,G,W,Y,ie,le,Se,Pe){this.data=e,this.env=o,this.toastr=l,this.stringService=c,this.dialogService=I,this.experienceService=F,this.accountService=G,this.profileService=W,this.bigQueryService=Y,this.coreDialogService=ie,this.autoplayService=le,this.http=Se,this.aiQuizPublisherGate=Pe,this.printableQuizIdStorageKey="epic.quiz.printableIds.v1",this._quizData=null,this.maxStrLen=40,this._quizIsInProgress=!1,this._quizTakerState=null,this.isQuizDrawerOpenObservable=new y.X(!1),this.isCreateNewQuizDrawerOpen$=new y.X(!1),this.openNewQuestionEditorOnMount=!1,this.returnToCreateNewQuizDrawerOnQuestionClose=!1,this.targetQuestionIndex=null,this.pendingCreateNewQuizDrawerAiGenerateCount=null,this.pendingCreateNewQuizDrawerGenerateOneQuestion=!1,this.createNewQuizSetupCompleteKeys=new Set,this.isTakingQuizObservable=new O.x,this.updateQu
1izObservable=new O.x,this.isEditingQuestion=!1,this.MIN_NUM_QUESTIONS_PREVIEW=1,this.MIN_NUM_QUESTIONS_PUBLISH=3,this.EPIC_CREATIONS_ACCOUNT_ID=30959905}markCreateNewQuizSetupComplete(e){null!=e&&this.createNewQuizSetupCompleteKeys.add(String(e))}isCreateNewQuizSetupComplete(e){return null!=e&&this.createNewQuizSetupCompleteKeys.has(String(e))}aiProxy(e,o,l){const c="post"===e?this.data.post("WebQuizGen",o,l):this.data.get("WebQuizGen",o,l);return(0,D.D)(c.then(I=>this.parseJsonProxyResult(I&&void 0!==I.result?I.result:I)))}parseJsonProxyResult(e){if("string"!=typeof e)return e;let o=e;for(let l=0;l<2&&"string"==typeof o;l++)try{o=JSON.parse(o.trim())}catch(c){return o}return o}generateAiQuiz(e,o,l,c,I,F=6,G){if(!this.aiQuizPublisherGate.isAiGenerateEnabledForCurrentBook())return C.E;const W={book_id:Number(e),reading_level:o,standard_uuid:l,standard_desc:c,title:I,formats:["multiple_choice"],count:F,validate:!0,progress_id:G};return this.env.useQuizGenProxy?this.aiProxy("post","generateQuiz",{payloadJSON:JSON.stringify(W)}):this.http.post("/quizgen/generate",W)}getGenerationProgress(e){return this.env.useQuizGenProxy?this.aiProxy("get","getProgress",{progressId:e}):this.http.get(`/quizgen/progress/${e}`)}generateAiQuestions(e,o,l,c=1){if(!this.aiQuizPublisherGate.isAiGenerateEnabledForCurrentBook())return C.E;const I={book_id:Number(e),reading_level:o,standard_uuid:l,formats:["multiple_choice"],count:c,validate:!0,persist:!1};return this.env.useQuizGenProxy?this.aiProxy("post","generateQuestions",{payloadJSON:JSON.stringify(I)}):this.http.post("/quizgen/generate",I)}getAiQuizzes(e,o,l){if(this.env.useQuizGenProxy){const I={bookId:Number(e)};return(null==o?void 0:o.system)&&(I.system=o.system),(null==o?void 0:o.value)&&(I.value=o.value),(null==o?void 0:o.grade)&&(I.grade=o.grade),l&&(I.standardUuid=l),this.aiProxy("get","listQuizzes",I)}let c=`/quizgen/quizzes?book_id=${Number(e)}`;return(null==o?void 0:o.system)&&(c+=`&system=${encodeURIComponent(o.system)}`),(null==o?void 0:o.value)&&(c+=`&value=${encodeURIComponent(o.value)}`),(null==o?void 0:o.grade)&&(c+=`&grade=${encodeURIComponent(o.grade)}`),l&&(c+=`&standard=${encodeURIComponent(l)}`),this.http.get(c)}loadAiQuiz(e){return this.env.useQuizGenProxy?this.aiProxy("get","getQuiz",{quizId:e}):this.http.get(`/quizgen/quiz/${e}`)}deleteAiQuiz(e){return this.env.useQuizGenProxy?this.aiProxy("get","deleteQuiz",{quizId:e}):this.http.delete(`/quizgen/quiz/${e}`)}createManualPrintableQuiz(e){const o=this.toManualQuizPayload(e);return this.env.useQuizGenProxy?this.aiProxy("post","manualQuiz",{payloadJSON:JSON.stringify(o)}):this.http.post("/quizgen/manual-quiz",o)}getPrintableQuizId(e){const o=(null==e?void 0:e.quiz)||{};return o.manual_quiz_id||o.ai_quiz_id||null}getOrCreatePrintableQuizId(e,o=!1){var l;return(0,P.mG)(this,void 0,void 0,function*(){const c=this.toManualQuizPayload(e);this.logPrintDebug("Preparing printable quiz id",{existingPrintId:this.getPrintableQuizId(e),forceManualCreate:o,useQuizGenProxy:this.env.useQuizGenProxy,payloadSummary:this.summarizeManualQuizPayload(c)});const I=null===(l=null==e?void 0:e.quiz)||void 0===l?void 0:l.manual_quiz_id,F=this.getPrintableQuizId(e);if(I||F&&!o)return I||F;let G;try{G=yield(0,d.z)(this.createManualPrintableQuiz(e))}catch(Y){throw this.logPrintError("Could not create printable quiz id",Y,c),Y}const W=this.extractPrintableQuizId(G);return W?(e.quiz.manual_quiz_id=W,this.persistPrintableQuizIds(e),this.quizData=e,yield this.saveQuizToServer(e,!1),this.logPrintDebug("Printable quiz id ready",{printableId:W}),W):(this.logPrintDebug("Printable quiz id missing from response",{reason:"PRINTABLE_QUIZ_ID_NOT_FOUND",responseKeys:G?Object.keys(G):[]}),null)})}extractPrintableQuizId(e){var o,l,c,I,F,G,W,Y,ie,le;return(null==e?void 0:e.quiz_id)||(null==e?void 0:e.quizId)||(null==e?void 0:e.manual_quiz_id)||(null==e?void 0:e.manualQuizId)||(null==e?void 0:e.ai_quiz_id)||(null==e?void 0:e.aiQuizId)||(null===(o=null==e?void 0:e.quiz)||void 0===o?void 0:o.manual_quiz_id)||(null===(l=null==e?void 0:e.quiz)||void 0===l?void 0:l.ai_quiz_id)||(null===(I=null===(c=null==e?void 0:e.quizdata)||void 0===c?void 0:c.quiz)||void 0===I?void 0:I.manual_quiz_id)||(null===(G=null===(F=null==e?void 0:e.quizdata)||void 0===F?void 0:F.quiz)||void 0===G?void 0:G.manualQuizId)||
1(null===(Y=null===(W=null==e?void 0:e.quizdata)||void 0===W?void 0:W.quiz)||void 0===Y?void 0:Y.ai_quiz_id)||(null===(le=null===(ie=null==e?void 0:e.quizdata)||void 0===ie?void 0:ie.quiz)||void 0===le?void 0:le.aiQuizId)||null}toManualQuizPayload(e){var o;const l=(null==e?void 0:e.quiz)||{},c=l.grade_level||l.grade||void 0,I=l.reading_level||l.reading_level_value||c?{system:l.reading_level||void 0,value:l.reading_level_value||void 0,grade:c}:void 0;return{book_id:Number(l.book_id||l.bookId||this.openBookId||0),title:l.title||"Manual Quiz",questions:this.toManualQuizQuestions((null==e?void 0:e.quizQuestions)||[]),grade:c,reading_level:I,grade_band:l.grade_band||void 0,standard_uuid:l.standard_uuid||void 0,reading_level_system:l.reading_level||void 0,reading_level_value:l.reading_level_value||void 0,user_id:l.user_id||(null===(o=this.profileService.currentProfile)||void 0===o?void 0:o.id)||Number(this.accountService.id)||1}}toManualQuizQuestions(e){return e.map(o=>{const l=this.toManualQuizChoices(o);return{stem:(null==o?void 0:o.title)||(null==o?void 0:o.question)||"",type:"multiple_choice",choices:l,payload:{choices:l},standard_uuid:(null==o?void 0:o.standard_uuid)||void 0,explanation:(null==o?void 0:o.explanation)||"",evidence:(null==o?void 0:o.evidence)||"",page:(null==o?void 0:o.page)||void 0}})}toManualQuizChoices(e){return Array.isArray(null==e?void 0:e.quizQuestionChoices)?e.quizQuestionChoices.map(c=>({text:(null==c?void 0:c.title)||(null==c?void 0:c.answer)||"",correct:!!(null==c?void 0:c.correct)})).filter(c=>c.text):[{text:(null==e?void 0:e.answer)||"",correct:!0},...(Array.isArray(null==e?void 0:e.wrongAnswers)?e.wrongAnswers:[]).map(c=>({text:c,correct:!1}))].filter(c=>c.text)}getPrintHtml(e,o="worksheet"){if(this.env.useQuizGenProxy)return this.aiProxy("get","getPrintHtml",{quizId:e,variant:o}).pipe((0,p.U)(c=>{var I;return"string"==typeof c?c:null!==(I=null==c?void 0:c.html)&&void 0!==I?I:""}));const l=new URLSearchParams({variant:o});return this.http.get(`/quizgen/print/${e}?${l.toString()}`,{responseType:"text"})}getPrintPdf(e,o="both"){if(this.env.useQuizGenProxy)return this.aiProxy("get","getPrintPdf",{quizId:e,variant:o}).pipe((0,p.U)(c=>{var I;return this.base64ToBlob(null!==(I=null==c?void 0:c.base64)&&void 0!==I?I:"",(null==c?void 0:c.contentType)||"application/pdf")}));const l=new URLSearchParams({variant:o});return this.http.get(`/quizgen/print/${e}.pdf?${l.toString()}`,{responseType:"blob"})}base64ToBlob(e,o){const l=atob(e),c=new Uint8Array(l.length);for(let I=0;I<l.length;I++)c[I]=l.charCodeAt(I);return new Blob([c],{type:o})}downloadBlob(e,o){const l=URL.createObjectURL(e),c=document.createElement("a");c.href=l,c.download=o,document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(l)}openPrintView(e,o="worksheet",l){const c=l||window.open("","_blank");this.getPrintHtml(e,o).subscribe({next:I=>{!c||(c.document.open(),c.document.write(I),c.document.close(),this.wirePdfLinks(c,e))},error:I=>{this.logPrintError("Could not load printable HTML",I,{quizId:e,variant:o}),c&&this.writePrintErrorPage(c,"We could not load the printable worksheet. Please try again in a moment. If the problem continues, contact support.")}})}logPrintClick(e,o){var l;const c=(null==o?void 0:o.quiz)||{};this.logPrintDebug(`${e} - print clicked`,{quizId:c.id,aiQuizId:c.ai_quiz_id,manualQuizId:c.manual_quiz_id,printableQuizId:this.getPrintableQuizId(o),bookId:c.book_id||c.bookId||this.openBookId,questionCount:(null===(l=null==o?void 0:o.quizQuestions)||void 0===l?void 0:l.length)||0,useQuizGenProxy:this.env.useQuizGenProxy})}logPrintError(e,o,l){console.warn(`Quiz Print - ${e}`,{reason:this.classifyPrintError(o),status:null==o?void 0:o.status,statusText:null==o?void 0:o.statusText,detail:this.extractPrintErrorDetail(o),context:this.summarizePrintErrorContext(l),rawError:o})}classifyPrintError(e){const o=this.extractPrintErrorDetail(e).toLowerCase();return o.includes("mysql")||o.includes("can't connect to mysql")||o.includes("cloud sql")||o.includes("failed to persist manual quiz")?"MYSQL_UNAVAILABLE":404===(null==e?void 0:e.status)?"PRINT_HTML_NOT_FOUND":0===(null==e?void 0:e.status)||502===(null==e?void 0:e.status)||503===(null==e?void 0:e.status)?"PRINT_SERVICE_UNAVAILABLE":(null==e?void 0:e.status)?"PRINT_SERVICE_ERROR":"UNKNOWN"}extractPrintErrorDetail(e){const o=null==e?void 0:e.error;return"string"==typeof o?o:(null==o?void 0:o.detail)?Array.isArray(o.detail)?JSON.stringify(o.detail):String(o.detail):(null==e?void 0:e.message)?String(e.message):""}summarizePrintErrorContext(e){var o;if(!e)return e;if(e.questions)return this.summarizeManualQuizPayload(e);if(e.quiz||e.quizQuestions){const l=e.quiz||{};return{quizId:l.id,aiQuizId:l.ai_quiz_id,manualQuizId:l.manual_quiz_id,bookId:l.book_id||l.bookId||this.openBookId,questionCount:(null===(o=e.quizQuestions)||void 0===o?void 0:o.length)||0}}return e}summarizeManualQuizPayload(e){var o;return{bookId:null==e?void 0:e.book_id,title:null==e?void 0:e.title,grade:null==e?void 0:e.grade,gradeBand:null==e?void 0:e.grade_band,readingLevelSystem:null==e?void 0:e.reading_level_system,readingLevelValue:null==e?void 0:e.reading_level_value,questionCount:(null===(o=null==e?void 0:e.questions)||void 0===o?void 0:o.length)||0,choiceCounts:((null==e?void 0:e.questions)||[]).map(l
1=>{var c;return(null===(c=null==l?void 0:l.choices)||void 0===c?void 0:c.length)||0})}}logPrintDebug(e,o){console.log(`Quiz Print - ${e}`,o||{})}writePrintErrorPage(e,o){e.document.open(),e.document.write(`<!doctype html>\n<html>\n<head>\n <meta charset="utf-8">\n <title>Printable quiz unavailable</title>\n <style>\n body {\n margin: 0;\n padding: 40px;\n color: #17212b;\n background: #f4f7fb;\n font-family: Arial, Helvetica, sans-serif;\n }\n main {\n max-width: 680px;\n margin: 0 auto;\n padding: 32px;\n background: #fff;\n border: 1px solid #d9e2ec;\n border-radius: 8px;\n }\n h1 {\n margin: 0 0 12px;\n font-size: 24px;\n }\n p {\n margin: 0;\n color: #52616f;\n line-height: 1.45;\n }\n </style>\n</head>\n<body>\n <main>\n <h1>Printable quiz unavailable</h1>\n <p>${this.escapePrintError(o)}</p>\n </main>\n</body>\n</html>`),e.document.close()}escapePrintError(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}wirePdfLinks(e,o){Array.from(e.document.querySelectorAll('a[href*=".pdf"]')).forEach(c=>{const F=(c.getAttribute("href")||"").split("?")[1]||"",G=new URLSearchParams(F).get("variant")||"both";c.addEventListener("click",W=>{W.preventDefault(),this.getPrintPdf(o,G).subscribe({next:Y=>this.downloadBlob(Y,`quiz-${o}-${G}.pdf`)})})})}showAiValidatedToast(e){var o,l;if(!e)return;const c=null!==(o=e.passed)&&void 0!==o?o:0,I=null!==(l=e.regen_rounds)&&void 0!==l?l:0;this.toastr.success(I>0?`Validated ${c} questions (refined over ${I+1} rounds).`:`Validated ${c} questions.`)}openQuizDataInDrawer(e){var o,l;if(null==e?void 0:e.quiz){e.quiz.book_id&&(this.openBookId=e.quiz.book_id);const c=null===(o=this.accountService.id)||void 0===o?void 0:o.toString();e.quiz.owner||(e.quiz.owner={simpleAccountId:c}),null==e.quiz.user_id&&(e.quiz.user_id=null===(l=this.profileService.currentProfile)||void 0===l?void 0:l.id)}this.hydratePrintableQuizIds(e),this.quizData=e,this.isQuizDrawerOpenObservable.next(!0)}set quizData(e){this.hydratePrintableQuizIds(e),this.persistPrintableQuizIds(e),this._quizData=e,this.updateQu
1izObservable.next(!0)}get quizData(){return this._quizData}set quizIsInProgress(e){this._quizIsInProgress=e}get quizIsInProgress(){return this._quizIsInProgress}set quizTakerState(e){this._quizTakerState=e}get quizTakerState(){return this._quizTakerState}showPublishedToast(e,o){const l=this.stringService.truncate(o.quiz.title,this.maxStrLen);e?this.toastr.show(l,"Published Quiz!",{toastClass:"ngx-toastr stack-title-and-message icon-publish-quiz-character"}):this.toastr.show(l,"Unpublished Quiz!",{toastClass:"ngx-toastr stack-title-and-message icon-unpublish-quiz-character"})}showSaveToast(e,o){const l=`Quiz has been ${e?"successfully":"unsuccessfully"} saved!`,c=o.quiz.title?this.stringService.truncate(o.quiz.title,this.maxStrLen):"Untitled Quiz";this.toastr.show(c,l,{toastClass:"ngx-toastr stack-title-and-message "+(e?"icon-successful-save-quiz-character":"icon-unsuccessful-save-quiz-character")})}showDeleteToast(e){const l=e.quiz.title?this.stringService.truncate(e.quiz.title,this.maxStrLen):"Untitled Quiz";this.toastr.show(l,"Quiz has been deleted!",{toastClass:"ngx-toastr stack-title-and-message icon-delete-quiz-character"})}closeQuizMakerModalCheck(){return(0,P.mG)(this,void 0,void 0,function*(){return this.close(),yield this.dialogService.openConfirmationDialog("Close the Quiz Maker?","Are you sure you want to close the Quiz Maker? Any unsaved changes in this question will be discarded.",void 0,{confirmIsPrimaryAction:!1,confirmText:"Discard & Close",dismissText:"Keep It Open"})})}isQuizValid(e){return!!e.quiz.title}saveQuizToServer(e,o,l){return this.isQuizValid(e)?this.data.post("WebQuiz","createOrUpdateQuiz",{quizDataJSON:JSON.stringify(e)}).then(c=>(c.result&&c.result.quiz?(this.preservePrintableQuizIds(e,c.result),this.persistPrintableQuizIds(c.result),this.quizData=c.result,l&&this.isQuizDrawerOpenObservable.next(!0),o&&this.showSaveToast(!0,c.result)):this.showSaveToast(!1,e),this.quizData)):(console.warn("Quiz Service - Save failed: Quiz does not have a title"),this.showSaveToast(!1,e),null)}preservePrintableQuizIds(e,o){!(null==e?void 0:e.quiz)||!(null==o?void 0:o.quiz)||(this.hydratePrintableQuizIds(e),this.hydratePrintableQuizIds(o),e.quiz.ai_quiz_id&&!o.quiz.ai_quiz_id&&(o.quiz.ai_quiz_id=e.quiz.ai_quiz_id),e.quiz.manual_quiz_id&&!o.quiz.manual_quiz_id&&(o.quiz.manual_quiz_id=e.quiz.manual_quiz_id))}hydratePrintableQuizIds(e){if(!(null==e?void 0:e.quiz))return;const o=this.getStoredPrintableQuizIds(e);!o||(o.ai_quiz_id&&!e.quiz.ai_quiz_id&&(e.quiz.ai_quiz_id=o.ai_quiz_id),o.manual_quiz_id&&!e.quiz.manual_quiz_id&&(e.quiz.manual_quiz_id=o.manual_quiz_id))}persistPrintableQuizIds(e){const o=null==e?void 0:e.quiz;if(!(null==o?void 0:o.ai_quiz_id)&&!(null==o?void 0:o.manual_quiz_id))return;const l=this.getPrintableQuizStorageKeys(e);if(!l.length)return;const c=this.getPrintableQuizIdStore();l.forEach(I=>{const F=c[I]||{};c[I]={ai_quiz_id:o.ai_quiz_id||F.ai_quiz_id,manual_quiz_id:o.manual_quiz_id||F.manual_quiz_id}}),this.setPrintableQuizIdStore(c)}getStoredPrintableQuizIds(e){const o=this.getPrintableQuizIdStore();for(const l of this.getPrintableQuizStorageKeys(e))if(o[l])return o[l];return null}getPrintableQuizStorageKeys(e){var o;const l=null==e?void 0:e.quiz;if(!l)return[];const c=this.accountService.id||(null===(o=this.profileService.currentProfile)||void 0===o?void 0:o.id)||l.user_id||"anonymous",I=[];return l.id&&I.push(`${c}:quiz:${l.id}`),I}getPrintableQuizIdStore(){if("undefined"==typeof window||!window.localStorage)return{};try{return JSON.parse(window.localStorage.getItem(this.printableQuizIdStorageKey)||"{}")}catch(e){return{}}}setPrintableQuizIdStore(e){if("undefined"!=typeof window&&window.localStorage)try{window.localStorage.setItem(this.printableQuizIdStorageKey,JSON.stringify(e))}catch(o){}}deleteQuizFromServer(e,o){return(0,P.mG)(this,void 0,void 0,function*(){this.confirmationModal=yield this.dialogService.openConfirmationDialog("Delete Your Quiz?","If you delete your quiz, it will no longer be available to you or others. Are you sure you want to delete your quiz?",void 0,{confirmIsPrimaryAction:!0,confirmText:"Delete Quiz",dismissText:"Never Mind"}),this.confirmationModal.afterClosed().subscribe(I=>{if(I===this.confirmationModal.componentInstance.replyData.CONFIRM
1){this.bigQueryService.log(a.jh,{accountId:this.accountService.id});const F=e.quiz.ai_quiz_id;if(F)return this.deleteAiQuiz(F).subscribe({next:()=>{},error:()=>{}}),this.quizData=null,this.isQuizDrawerOpenObservable.next(!1),void(o&&this.showDeleteToast(e));if(!e.quiz.id)return this.quizData=null,this.isQuizDrawerOpenObservable.next(!1),void(o&&this.showDeleteToast(e));this.data.post("WebQuiz","deleteQuiz",{quizId:e.quiz.id}).then(G=>{G&&G.result&&(this.quizData=null,this.isQuizDrawerOpenObservable.next(!1),o&&this.showDeleteToast(e))})}})})}isQuizValidForPublishing(e){return!(!(null==e?void 0:e.quiz)||!e.quiz.title||e.quizQuestions.length<this.MIN_NUM_QUESTIONS_PUBLISH)}publishQuiz(e){return e?this.data.get("WebQuiz","publishQuiz",{quizId:e}).then(o=>o&&o.result?(this.quizData=o.result,o.result):Promise.reject()):Promise.reject()}unpublishQuiz(e){e&&this.data.get("WebQuiz","unPublishQuiz",{quizId:e}).then(o=>{o&&o.result&&(this.quizData=o.result,this.showPublishedToast(!1,o.result))})}editQuiz(e){return(0,P.mG)(this,void 0,void 0,function*(){if(this.close(),this.quizData&&this.quizData.quiz&&0!==this.quizData.quiz.published){const o="Unpublish Your Quiz?",l="To edit your quiz, you must unpublish it first. Others won\u2019t be able to see your quiz while it is unpublished.";this.confirmationModal=yield this.dialogService.openConfirmationDialog(o,l,void 0,{confirmIsPrimaryAction:!0,confirmText:"Unpublish & Edit",dismissText:"Never Mind"}),this.confirmationModal.afterClosed().subscribe(c=>{c===this.confirmationModal.componentInstance.replyData.CONFIRM&&(this.quizData.quiz.id&&this.unpublishQuiz(this.quizData.quiz.id),this.isQuizDrawerOpenObservable.next(!0))})}else this.isQuizDrawerOpenObservable.next(!0)})}closeQuizTakeModalCheck(){var e;return(0,P.mG)(this,void 0,void 0,function*(){let o={state:this.quizTakerState,quizId:null===(e=this.quizData)||void 0===e?void 0:e.quiz.id};if(this.quizIsInProgress){const l="Exit Quiz",c="If you exit before finishing, your answers won\u2019t be saved!";o.dialogRef=yield this.dialogService.openConfirmationDialog(l,c,void 0,{confirmIsPrimaryAction:!0,confirmText:"Exit Quiz",dismissText:"Never Mind"}),this.autoplayService.loadAutoplayComp$.next(!1)}return o.dialogRef.afterClosed().subscribe(()=>{this.autoplayService.isBookFinished&&this.autoplayService.loadAutoplayComp$.next(!0)}),o})}takeQuiz(e,o,l,c){var I;return(0,P.mG)(this,void 0,void 0,function*(){if(this.close(),this.isTakingQuizObservable.next(!0),this.currentModal=yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.QuizTakeDialogComponent,{panelClass:["epic-mat-dialog","no-padding","allow-overflow"],hasBackdrop:!c,disableClose:!0,data:{quizData:this.quizData,openBookId:this.openBookId,quizServiceCloseFunction:this.closeQuizTakeModalCheck.bind(this),preview:l,autoplay:c}}),this.currentModal.afterClosed().subscribe(()=>{this.isTakingQuizObservable.next(!1)}),e){let F;F=this.experienceService.isStudent()||this.experienceService.isChildConsumer()?o?a.Ng:a.i_:this.experienceService.isTeacher()?a.IZ:a.FJ,this.bigQueryService.log(F,{source:e,quiz_id:null===(I=this.quizData)||void 0===I?void 0:I.quiz.id})}return this.currentModal})}previewQuiz(e){return(0,P.mG)(this,void 0,void 0,function*(){this.quizData=e,yield this.takeQuiz(void 0,void 0,!0)})}close(){this.currentModal&&this.currentModal.close&&(this.quizIsInProgress=!1,this.currentModal.close())}formattedPercentage(e){return Math.ceil(e.correct/e.total*100)}formattedColor(e){const o=this.formattedPercentage(e);let l;return l=o>80?["green"]:o>60?["magenta"]:["gray"],l}getQuizResults(){return this.data.get("WebQuiz","getQuizDataForAccount").then(e=>{if(e&&e.result){const o=[],l=[];return e.result.forEach(c=>{l[c.id]||(o.push({quiz:new v(c),user:c.user||[]}),l[c.id]=!0)}),o}return Promise.reject({errorMsg:"Error fetching quizzes for account"})})}isOwnerOfQuiz(){var e;return!!this.quizData&&this.quizData.quiz.owner.simpleAccountId===(null===(e=this.accountService.id)||void 0===e?void 0:e.toString())}getQuizAuthor(e){var o;const l=e||this.quizData,{owner:c,created_by:I}=null!==(o=l.quiz)&&void 0!==o?o:{},F=c.prefix||c.educatorPrefix,G=c.firstName||c.educatorFirstName,W=c.lastName||c.educatorLastName;let Y=c.name||I||F&&G&&W&&`${F} ${G} ${W}`||F&&W&&`${F} ${W}`||"Anonymous";return(c.accountId===this.EPIC_CREATIONS_ACCOUNT_ID||c.simpleAccountId===JSON.stringify(this.EPIC_CREATIONS_ACCOUNT_ID))&&(Y="Epic Kids"),Y}getQuizResultsForBook(e){return this.data.get("WebQuiz","getUserQuizzesByUserIdAndBookId",{userId:this.profileService.currentProfile.id,bookId:e}).then(o=>o&&o.result?o.result:[])}getMostRecentQuizResultForBook(e,o){return this.getQuizResultsForBook(e).then(l=>{let c=null;return(l=l.filter(I=>I.quizId===o)).length>0&&(c=l[0],l.forEach(I=>{I.date_created>c.date_created&&(c=I)})),c})}getQuizDataForUserId(e){return this.data.get("WebQuiz","getQuizDataForUserId",{userId:e}).then(o=>o&&o.result&&o.result.quizData?(o.result.quizData.forEach(l=>{l.eduInfo&&(l.quiz.creatorGrade=l.eduInfo.grade)}),{quizList:o.result.quizData,quizTaker:o.result.quizTaker}):Promise.reject())}isQuizAvailableForAssignment(e){return null==e?void 0:e.quiz.published}}return j.\u0275fac=function(e){return new(e||j)(u.LFG(_.D),u.LFG
1(h.DJ),u.LFG(R._W),u.LFG(E.P),u.LFG(L.x),u.LFG(s.DT),u.LFG(m.B),u.LFG(r.ProfileService),u.LFG(S.p),u.LFG(B.CoreDialogService),u.LFG(N.f),u.LFG(Q.eN),u.LFG($.p))},j.\u0275prov=u.Yz7({token:j,factory:j.\u0275fac,providedIn:"root"}),j})()},93450:(K,M,t)=>{t.d(M,{rN:()=>se,ow:()=>oe,jn:()=>Ze});var P=t(34929),D=t(36362),C=t(25769),d=t(76317),p=t(50253),y=t(26562),O=t(26966),T=t(15286),v=t(390),g=t(94660),a=t(15527),u=t(8296),_=t(98403),h=t(34703),E=t(68087),s=t(73398),m=t(20124),r=t(3184),S=t(1146),B=t(5485),R=t(98476),L=t(16447),N=t(68893),Q=t(64116),$=t(65925),H=t(41752),V=t(11105),j=t(64617),w=t(44687);let e=(()=>{class A{constructor(){this.isRunning=!1,this.startTime=0,this.overallTime=0,this.isRunning=!1,this.startTime=0,this.overallTime=0}_getTimeElapsedSinceLastStart(){return this.startTime?Date.now()-this.startTime:0}start(){if(this.isRunning)return console.error("Timer is already running");this.isRunning=!0,this.startTime=Date.now()}stop(){if(!this.isRunning)return console.error("Timer is already stopped");this.isRunning=!1,this.overallTime=this.overallTime+this._getTimeElapsedSinceLastStart()}reset(){this.overallTime=0,this.startTime=this.isRunning?Date.now():0}getTime(){return this.startTime?this.isRunning?this.overallTime+this._getTimeElapsedSinceLastStart():this.overallTime:0}}return A.\u0275fac=function(i){return new(i||A)},A.\u0275prov=r.Yz7({token:A,factory:A.\u0275fac,providedIn:"root"}),A})();var o=t(28887),l=t(52220),c=t(1409),I=t(14322),F=t(26237),G=t(15015),W=t(77861),Y=t(97646),ie=t(10350),le=t(47735),Se=t(1651),Pe=t(78693),Be=t(9147),ye=t(57625),Te=t(31503),de=(()=>{return(A=de||(de={})).GATED_CONTENT_DIALOG_VIEWED="locked_content_popup_view",A.GATED_CONTENT_CLICKED="locked_content_popup_click",de;var A})(),ee=(()=>{return(A=ee||(ee={})).LINKED_TRUE="y",A.LINKED_FALSE="n",A.USER_TEACHER="educator",A.USER_STUDENT="student",A.CLICK_TYPE_X="x_out",A.CLICK_TYPE_CTA="cta",A.CLICK_TYPE_OTHER="outside_popup",ee;var A})();let ke=(()=>{class A{constructor(i,n,f,b,k,U,x,J,q,X){this._accountService=i,this._afterHoursDialogService=n,this._afterHoursService=f,this._experienceService=b,this._bookService=k,this._bqService=U,this._confirmationDialogService=x,this._profileService=J,this._profileLinkingService=q,this._routingService=X,this.afterHoursEndTime=this._afterHoursService.educatorAllowedEndTimeDisplay(),this._studentVersion={title:$localize`:Return after school hours|header:Come back after school.`,desc:$localize`:paragraph:This book is not available through ${Y.nn.SCHOOL}. After ${this.afterHoursEndTime}, ask a grownup to help you unlock it.`,ctaText:$localize`:cta:Read Another Book`},this._teacherVersion={title:$localize`:header:This book is not available through ${Y.nn.SCHOOL}.`,desc:$localize`:paragraph:Students can read this book with an ${Y.nn.FAMILY} subscription, which families can purchase after school. To learn more about locked books, read the <a href="https://getepic.zendesk.com/hc/en-us/articles/6980628735373" target="_blank">FAQ</a>.`,ctaText:$localize`:cta:Go Back`}}showSchoolBlockingDialogs(i,n){return(0,P.mG)(this,void 0,void 0,function*(){const f=i.content;if(i.blockedReasons[0]===u.jg.PREMIUM_CONTENT)if(this._afterHoursService.shouldAllowAfterHoursReading()){const U=this._profileService.currentProfile;U instanceof le.V&&(yield this._afterHoursDialogService.openAfterHoursDialog(U))}else yield this.openGatedContentDialog(f,n||"")})}openGatedContentDialog(i,n,f){return(0,P.mG)(this,void 0,void 0,function*(){if(!this._experienceService.isEducatorExperience())return;const b=this._bookService.getThumbPathForBook(i,!0);let k=this._profileService.currentProfile.isParent?this._teacherVersion:this._studentVersion;f&&(k=Object.assign(Object.assign({},k),f));const U=yield this._confirmationDialogService.openConfirmationDialog(k.title||"",k.desc||"",!0,!1,{confirmText:k.ctaText,imgUrl:b,confirmIsPrimaryAction:!0,titleStyle:{"padding-top":"16px"},imgStyle:{width:"186px",height:"unset"}});null==U||U.afterOpened().subscribe(x=>(this._handleDialogOpen(i,n),U)),null==U||U.afterClosed().subscribe(x=>{this._handleDialogClose(i,n,x)})})}_bqGetCommonParamVals(i,n){let f={};f.class_code=this._accountService.getClassCode()||"",f.content_id=i.id.toString(),f.user_type=this._profileService.currentProfile.isParent?ee.USER_TEACHER:ee.USER_STUDENT;let b=this._profileLinkingService.isLinked(this._profileService.currentProfile);return f.linked=b?ee.LINKED_TRUE:ee.LINKED_FALSE,f.source_param=n,f}_handleDialogOpen(i,n){const f=this._bqGetCommonParamVals(i,n);this._bqService.log(de.GATED_CONTENT_DIALOG_VIEWED,f)}_handleDialogClose(i,n,f){const b=this._bqGetCommonParamVals(i,n);let k=ee.CLICK_TYPE_OTHER;switch(f){case"confirm":k=ee.CLICK_TYPE_CTA;break;case"dismiss":k=ee.CLICK_TYPE_X}b.type=k,this._bqService.log(de.GATED_CONTENT_CLICKED,b),this._handleReadRouteClose(n,i)}_handleReadRouteClose(i,n){this._routingService.getCurRoute()[1]===a.Pm.READ&&n.isBook()&&-1===i.indexOf(ie.z4.EOB)&&this._routingService.goToWebApp
1Route({route:a.Pm.EXPLORE})}}return A.\u0275fac=function(i){return new(i||A)(r.LFG(S.B),r.LFG(Pe.h),r.LFG(Se.AfterHoursService),r.LFG(V.DT),r.LFG(L.Z),r.LFG(R.p),r.LFG(Be.O),r.LFG(w.ProfileService),r.LFG(ye.i),r.LFG(Te.Zn))},A.\u0275prov=r.Yz7({token:A,factory:A.\u0275fac,providedIn:"root"}),A})();var Re=t(33949),Le=t(21618),Ae=t(48146),Me=t(1495);let Ue=(()=>{class A{constructor(i,n,f){this.dialogService=i,this.data=n,this.envService=f,this.cdn=this.envService.cdnBase}show(i){this.getBookSuggestions(i).then(n=>(0,P.mG)(this,void 0,void 0,function*(){this.dialogInstance=yield this.dialogService.openInactiveBookDialog(n)}))}close(){this.dialogInstance&&this.dialogInstance.close()}getBookSuggestions(i){return this.data.get("WebBook","getRecommendedBooks",{bookId:i}).then(n=>{const f=n.result.slice(0,10);return f.forEach(b=>{let k;const x=(k=String(b.id||b.modelId)).slice(-1);b.coverImgSrc=`${this.cdn}drm/${x}/${k}/cover.jpg`}),f}).catch(()=>{})}}return A.\u0275fac=function(i){return new(i||A)(r.LFG(Me.x),r.LFG($.D),r.LFG(H.DJ))},A.\u0275prov=r.Yz7({token:A,factory:A.\u0275fac,providedIn:"root"}),A})();var we=t(55899),Fe=t(84449),Ne=t(35814),ze=t(94866),xe=t(89243),Qe=t(75651),Ge=t(21879),We=t(45317),Ke=t(24047),He=t(71283),Ve=t(56187),$e=t(87421),je=t(94343),Ye=t(21365),oe=(()=>{return(A=oe||(oe={}))[A.BACKWARD=0]="BACKWARD",A[A.FORWARD=1]="FORWARD",oe;var A})(),se=(()=>{return(A=se||(se={})).NO_BOOK="no_book",A.LOADING="loading",A.LOADED="loaded",se;var A})();let Ze=(()=>{class A{constructor(i,n,f,b,k,U,x,J,q,X,re,ne,z,De,Oe,Z,ue,pe,he,ve,ge,_e,me,be,Ee,Je,Xe,qe,et,tt,it,ot,st,rt,nt,at,lt,ct,ut,Ce,dt,ht,vt,gt,_t,mt){this.accountService=i,this.audio=n,this.assetService=f,this.bigQueryService=b,this.bookService=k,this.bookOverlayService=U,this.browseService=x,this.coreDialogService=J,this._coreFreemiumService=q,this._contentGatingService=X,this.dailyReadTimeService=re,this.dataService=ne,this.dateHelperService=z,this.envService=De,this._epicSchoolGatedContentDialogService=Oe,this.experienceService=Z,this.experienceDialogService=ue,this.favoriteService=pe,this.freemiumService=he,this.inactiveBookModalService=ve,this.localStorageService=ge,this.location=_e,this.logEntryService=me,this.loggingSourceService=be,this.magicPanService=Ee,this.inactiveBookOpenService=Je,this.profileService=Xe,this.recommendService=qe,this.timerService=et,this.contentLoggerService=tt,this.readingBuddyService=it,this.achievementQueueService=ot,this.impressionsLoggerService=st,this.routingService=rt,this._trailerService=nt,this._bookComingSoonService=at,this._starCelebrationService=lt,this._showRewardBackgroundService=ct,this._autoplayService=ut,this.document=Ce,this._epicToastCustomService=dt,this._postTrialExperimentService=ht,this._drawboardService=vt,this._storySketchEnabledTeachersService=gt,this.injector=_t,this.quizService=mt,this.IDLE_THRESHOLD_DURATION=300,this.UPDATE_APP_TIME_EVERY=60,this.bookOpenSource="",this.favorites={},this.isLeavingReadState=!1,this.openQuizDrawer=!1,this.lastRouteData={route:void 0},this.timeInSeconds=0,this.timeInMinutes=0,this.stoppedTimerOnTabSwitch=!1,this.stoppedTimerOnWindowBlur=!1,this.lastTimeStamp=0,this.skipFirstCall=!1,this.heartBeatSimulator=0,this.heartBeatSimulatorProgress="",this.wasReadToMePlayingBeforeTabHidden=!1,this.wasReadToMePlayingBeforeWindowBlur=!1,this._contentPlaybackAllowed=!0,this._contentPlaybackAllowed$=new d.X(!0),this.contentPlaybackAllowed$=this._contentPlaybackAllowed$.asObservable(),this._readToMePlayState$=new d.X(!1),this.readToMePlayState$=this._readToMePlayState$.asObservable(),this._readToMePauseIntent$=new p.x,this.readToMePauseIntent$=this._readToMePauseIntent$.asObservable(),this._readToMeResumeIntent$=new p.x,this.readToMeResumeIntent$=this._readToMeResumeIntent$.asObservable(),this.bookLoadStatus$=new d.X({status:se.NO_BOOK}),this.bookOpenObservable=new p.x,this.bookCloseObservable=new p.x,this.backToExplore=new p.x,this.pageChangeObservable=new p.x,this.endOfBookObservable=new d.X(!1),this.finishBookObservable=new d.X(null),this.pagePeekObservable$=new d.X(!1),this.bookOpenLoggingComplete$=new d.X(!1),this.userKnowsHowToFlip=!1,this.shouldAutoFinishBook=!1,this.AUTO_FINISH_BOOK_DELAY=0,this.shouldImmediatelyEnableBookFinish=!1,this.enableDebugBookFinish=!1,this.enableVideoPlaybackControl
1=!1,this.romanNumeralsMapping=["0","i","ii","iii","iv","v","vi","vii","viii","ix","x"],this.isSeriesBook=!1,this.readingTimerInterval=null,this._snapshotSource=[v.vh.APP],this._contentSessionDurationSeconds=0,this._subscriptions=[],this._isAttemptingToOpenBook=!1,this._clickUuid4Dict={},this.iPreviousBookNextInSeries=!1,this.previousContentFinishedLogged=!1,this.autoPlayBook=new d.X({bookType:null,autoPlayBookId:null}),this.autoPlayBook$=this.autoPlayBook,this.autoPlayEpicBookItemComponentRef={newEpicBookItem:null,centerCoordinatesOfBook:{clientX:0,clientY:0}},this.instantHideBuddyWithoutAnim$=new d.X(!1),this._showRecommendedRowSection=new d.X(!0),this.showRecommendedRowSection$=this._showRecommendedRowSection.asObservable(),this.drawingExistsForCurrenBook=!1,this.readingData={isBookFinished:!1,currentReadTime:0,currUpdateSecondsRead:0,currUpdatePagesFlipped:0,pageStartTimestamp:0,secondsReadSinceOpen:0,readSessions:[],pagesFlippedSinceOpen:0,lastUpdatedSeconds:0,idleTimeSpent:0,isIdling:!1},this.checkIsContentAvailableAndShowBlockers=(ae,te)=>(0,P.mG)(this,void 0,void 0,function*(){const fe=this._contentGatingService.getContentAvailableResponse(ae,{profile:this.profileService.currentProfile,accountService:this.accountService,hasReachedReadingTimeLimit:this._coreFreemiumService.hasReachedReadingTimeLimit()}),Ie=null==te?void 0:te.openSource,Et=null==te?void 0:te.blockerDialogData;if(!fe.isAvailable){switch(fe.blockedReasons[0]){case u.jg.COMING_SOON:yield this._bookComingSoonService.openComingSoonBlockingDialog(ae,Et);break;case u.jg.INACTIVE:this.inactiveBookModalService.show(ae.id);break;case u.jg.BLOCKED_EXPERIENCE:yield this.experienceDialogService.showCurBlockingDialog()}this.experienceService.isEducatorExperience()?yield this._epicSchoolGatedContentDialogService.showSchoolBlockingDialogs(fe,Ie):this.experienceService.isFreemiumExperience()&&this.freemiumService.showFreemiumBlockingDialogs(fe,Ie)}return fe}),this.isOnBookReadPage=()=>this.location.path().startsWith("/app/read"),this.init(),this.timer=this.timerService,Ce.addEventListener("visibilitychange",this.stopBookTimerOrResumeOnWindowChange.bind(this),!1),this.boundHandleWindowBlur=this.handleWindowBlur.bind(this),this.boundHandleWindowFocus=this.handleWindowFocus.bind(this),window.addEventListener("blur",this.boundHandleWindowBlur,!1),window.addEventListener("focus",this.boundHandleWindowFocus,!1),this.freemiumService.shouldSe
1ndUpdatedTime.subscribe(ae=>{this.updateLogEntry()}),this.bookDataAndRecommendationsReady$=(0,y.a)([this.bookLoadStatus$,this.recommendService.recommendationsLoadedObservable,this.bookOpenLoggingComplete$]);const ft=this.bookDataAndRecommendationsReady$.subscribe(ae=>{var te;ae[0].status===se.LOADED&&ae[2]&&ae[1].bookId===(null===(te=this.curBook)||void 0===te?void 0:te.id)&&this.setImpressionsDataForEndOfBook(ae)});this._subscriptions.push(ft)}get isContentPlaybackAllowed(){return this._contentPlaybackAllowed}get snapshotSource(){return this._snapshotSource}set snapshotSource(i){this._snapshotSource=i}get readToMeIsPlaying(){return this._readToMePlayState$.value}set readToMeIsPlaying(i){i&&this.turnPeekFlipOff(),this._readToMePlayState$.next(i)}get isBookFinishEnabled(){return!!this.fullBookData&&(!!this._autoplayService.bookFinishData||this.shouldImmediatelyEnableBookFinish||!this.hasBookBeenFinished()&&this.getReadTimeSinceLastBookFinish()>this.fullBookData.timePerPage*this.fullBookData.getBookLength()||this.enableDebugBookFinish)}ngOnDestroy(){this.clearBookPreviewHandler();for(let i=0;i<this._subscriptions.length;i++)this._subscriptions[i].unsubscribe();this.boundHandleWindowBlur&&window.removeEventListener("blur",this.boundHandleWindowBlur,!1),this.boundHandleWindowFocus&&window.removeEventListener("focus",this.boundHandleWindowFocus,!1)}stopBookTimerOrResumeOnWindowChange(){const i="visible"===document.visibilityState;this._contentPlaybackAllowed=i,this._contentPlaybackAllowed$.next(i),document.hidden&&(this.wasReadToMePlayingBeforeTabHidden=this.readToMeIsPlaying,this._readToMePauseIntent$.next()),this.fullBookData&&this.fullBookData.bookType===C._.STANDARD&&this.isOnBookReadPage()&&(document.hidden&&!this.stoppedTimerOnTabSwitch?(this.pauseBookRead(),this.stoppedTimerOnTabSwitch=!0):(this.stoppedTimerOnTabSwitch&&this.readingData.isIdling&&this.resumeBookRead(),this.wasReadToMePlayingBeforeTabHidden&&!this.readToMeIsPlaying&&(this._readToMeResumeIntent$.next(),this.wasReadToMePlayingBeforeTabHidden=!1),this.wasReadToMePlayingBeforeWindowBlur&&!this.readToMeIsPlaying&&(this._readToMeResumeIntent$.next(),this.wasReadToMePlayingBeforeWindowBlur=!1)))}init(){this.inactiveBookOpenService.openBookObservable.subscribe(i=>{this.openBook(i)})}handleWindowBlur(){this._contentPlaybackAllowed=!1,this._contentPlaybackAllowed$.next(!1),this.wasReadToMePlayingBeforeWindowBlur=this.readToMeIsPlaying,this._readToMePauseIntent$.next(),this.fullBookData&&this.fullBookData.bookType===C._.STANDARD&&this.isOnBookReadPage()&&!this.stoppedTimerOnWindowBlur&&(console.log("Window blur - pausing read-to-me and timer"),this.pauseBookRead(),this.stoppedTimerOnWindowBlur=!0)}handleWindowFocus(){const i=!document.hidden;this._contentPlaybackAllowed=i,this._contentPlaybackAllowed$.next(i),this.fullBookData&&this.fullBookData.bookType===C._.STANDARD&&this.isOnBookReadPage()&&!document.hidden&&this.stoppedTimerOnWindowBlur&&this.readingData.isIdling&&(console.log(" Window focus - resuming read-to-me and timer"),this.resumeBookRead())}openBook(i){var n,f,b,k,U;return(0,P.mG)(this,void 0,void 0,function*(){let q,X,x=i.source,J=i.contentBlockerDialogData;if(this.isNextInSeries=i.isNextInSeries,this._autoplayService.bookFirstTimeOpened=!0,this._isAttemptingToOpenBook||this.isLeavingReadState)return!1;this._isAttemptingToOpenBook=!0;const re=Z=>(this._isAttemptingToOpenBook=!1,Z),ne=i.book.id;let z;if(this.bookLoadStatus$.next({status:se.LOADING,bookId:ne}),z=this.autoPlayFullBookData&&(null===(n=this.autoPlayFullBookData)||void 0===n?void 0:n.bookId)===ne&&i.autoplay?this.autoPlayFullBookData:yield this.bookService.getFullBookData(ne,this.profileService.freemiumExperience),!z||!(null==z?void 0:z.book)||0!==(null===(f=null==z?void 0:z.book)||void 0===f?void 0:f.regionRestricted)||(null===(b=null==z?void 0:z.book)||void 0===b?void 0:b.isBookHidden)){let Z;if(console.log("ReadContentService: openBook: Unable to get full book data"),z&&(null==z?void 0:z.book)){const ue=null===(k=null==z?void 0:z.book)||void 0===k?void 0:k.type;Z=(null===(U=null==z?void 0:z.book)||void 0===U?void 0:U.isBookHidden
1)?this.routingService.getCurSubroute()!==a.Pm.READ&&ue?4===ue?"This video is not accessible.":"This book is not accessible.":"The URL you entered is not accessible.":"Unable to open book"}else Z="The content you requested is not available.";return this._showToaster(Z),re(!1)}i.resetBookProgress&&z.resetAutoPlayUserBookProgressToZero(),q=z,X=q.book;let De={openSource:x,blockerDialogData:J};if((this._postTrialExperimentService.isAccountStatusFirstTimeBasicUser()||this._postTrialExperimentService.isAccountStatusFirstTimeFreetrialUser())&&(yield this._postTrialExperimentService.getExperimentDataForPostTrialPayment()),this._postTrialExperimentService.isEligibleForPremiumExperienceFreeTrial()&&this._postTrialExperimentService.checkIfRequiredDaysPastForExperiment()&&(yield this._postTrialExperimentService.refreshSubscriptionStatus(!0)),!(yield this.checkIsContentAvailableAndShowBlockers(X,De)).isAvailable)return re(!1);if(this._contentSessionDurationSeconds=0,X.active||this.envService.stagingMode||this.envService.devMode){const Z=this.routingService.getCurRoute(),ue=i.comingFromRoute;Z[1]!==a.Pm.READ||ue?this.lastRouteData.route=Z:this.updateLogEntry(!0);const pe=this.document.getElementById("epic-app-content-container");return pe&&(this.bookOverlayService.scrollOffset=pe.scrollTop||0),this.openQuizDrawer=i.createOrEditQuiz||!1,this.additionalBqParams=i.additionalBqParams,this.routingService.goToWebAppRoute({route:a.Pm.READ,pathParams:[X.id],extras:{queryParams:{assign:i.showAssign?"1":null},state:{additionalBqParams:this.additionalBqParams}}}),setTimeout(()=>{var he,ve,ge,_e,me;(()=>{this.snapshotSource=void 0===i.snapshotSource?this.loggingSourceService.getLoggingSourceFromRoute(Z[1]):i.snapshotSource,this.bookOpenSource=x||Z[1],i.clickUuid4&&this.addBookClickUuidToDict(X,i.clickUuid4)})(),this.fullBookData=q,this.curBook=X,this.autoplay=i.autoplay,this.upNextBook=i.upnext,this.autoplayRTM=i.autoplayRTM,this.previousContentFinishedLogged=!1,this.iPreviousBookNextInSeries=!1,this.isSeriesBook=!!this.isSeriesBook||!!(null===(ve=null===(he=this.fullBookData)||void 0===he?void 0:he.book)||void 0===ve?void 0:ve.crrSeriesId),this.bookOpenObservable.next(),this.bookLoadStatus$.next({status:se.LOADED,bookId:ne,isAudioOrVideoBook:(null===(ge=this.fullBookData)||void 0===ge?void 0:ge.bookType)===C._.VIDEO||(null===(_e=this.fullBookData)||void 0===_e?void 0:_e.bookType)===C._.AUDIOBOOK}),this.restoreUserBookStatus(this.fullBookData,null==i?void 0:i.openToPageIndex);const Ee=null===(me=this.fullBookData)||void 0===me?void 0:me.bookType;Ee!==C._.VIDEO&&Ee!==C._.AUDIOBOOK&&(this.startContentSnapshotLogs(),this.readingBuddyService.shouldShowAdventuresForProfile()&&this._starCelebrationService.updateCurrentNumberOfStars(!0)),this.autoPlayFullBookData=null},0),re(!0)}return this.inactiveBookModalService.show(ne),re(!1)})}initReadingDataAndTimers(){if(this.timerService.reset(),this.bookOverlayService.resetPopout(),this.clearBookPreviewHandler(),!this.fullBookData)return;this.checkoutOrReturnBookIfNeeded(!0).then(n=>{n&&n.result?n.result.cacheKey?(console.log("Checking out book",n.result),i()):n.result.alertMessage&&(console.log("Book already checked out, closing",n.result),this.closeBook(),this.showCheckedOutAlert(n.result.alertTitle,n.result.alertMessage)):(console.log("Checkout not needed",n),i())});const i=()=>{this.readingData.isBookFinished=!1,this.findOrCreateCurrentLogEntry(),this.readingData.currUpdateSecondsRead=0,this.readingData.currUpdatePagesFlipped=0,this.readingData.pagesFlippedSinceOpen=0,this.readingData.secondsReadSinceOpen=0,this.readingData.lastUpdatedSeconds=0,this.readingData.readSessions=[],this.readingData.idleTimeSpent=0,this.readingData.isIdling=!1,this.readingData.pageStartTimestamp=this.dateHelperService.getCurrentUnixTimestamp(),this.wasReadToMePlayingBeforeTabHidden=!1,this.wasReadToMePlayingBeforeWindowBlur=!1,this.stoppedTimerOnTabSwitch=!1,this.stoppedTimerOnWindowBlur=!1,this.timer.reset(),this.startReadingTimer()}}searchForBuddyRedirectFlows(){this.readingBuddyService.getBuddyRouteForAdventureExperience().then(i=>(0,P.mG)(this,void 0,void 0,function*(){const n=i;if(n)return this.dailyReadTimeService.logDailyReadTimeDialog(),void this.routingService.goToWebApp
1Route({route:a.Pm.READING_BUDDY,extras:{state:{buddyState:n,fromRoute:a.Pm.ADVENTURES}}});this._starCelebrationService.showVariableRewardForAssigningBuddy()?this.showVariableRewardToAssignReward():this._restorePreviousState(),this._showRewardBackgroundService.showRewardBackgroundOnApp(),this.achievementQueueService.unpauseAchievementsQueue(0)}))}getLastPlayPauseState(){return!!(this.localStorageService.get(s.vV)||{})[this.profileService.currentProfile.id]}checkStarCelebrationFlow(){var i,n;return(0,P.mG)(this,void 0,void 0,function*(){if(this.audio.clear(),this.readingBuddyService.shouldShowAdventuresForProfile()&&(yield this._starCelebrationService.updateCurrentNumberOfStars(!1)),this._starCelebrationService.showStarCelebration()&&this.readingBuddyService.shouldShowAdventuresForProfile()){const f=yield this.readingBuddyService.getAllBuddies(),b=yield this.readingBuddyService.getAllAccessories();this._showRewardBackgroundService.showRewardBackgroundOnApp(),0===(null===(i=f.result)||void 0===i?void 0:i.unHatchedEggsLeft)&&0===(null===(n=b.result)||void 0===n?void 0:n.remainingAccessories)?this.isBuddyFlowMatch():setTimeout(()=>{this._starCelebrationService.openVariableReward(!1).then(k=>{k.afterOpened().subscribe(()=>{this._showRewardBackgroundService.showRewardBackgroundOnApp()});const x=k.componentInstance.starAnimationClose.subscribe(J=>(0,P.mG)(this,void 0,void 0,function*(){x.unsubscribe(),null==k||k.close(),J&&this.isBuddyFlowMatch()}))})},100)}else this.isBuddyFlowMatch()})}isBuddyFlowMatch(){var i,n;return(0,P.mG)(this,void 0,void 0,function*(){const f=yield this.readingBuddyService.oneBookADayExperience(),b=this.readingBuddyService.shouldShowAdventuresForProfile()&&this.dailyReadTimeService.isFinishedReading&&this.dailyReadTimeService.shouldShowTimeCompleteDialog;if(!f&&b)this.searchForBuddyRedirectFlows();
1else{const k=yield this.readingBuddyService.getAllBuddies(),U=yield this.readingBuddyService.getAllAccessories(),x=0===(null===(i=k.result)||void 0===i?void 0:i.unHatchedEggsLeft)&&0===(null===(n=U.result)||void 0===n?void 0:n.remainingAccessories);0===this.getCurrentPage()&&!this.readingBuddyService.currentReadingBuddy.isHatched()&&this.instantHideBuddyWithoutAnim$.next(!0),this._starCelebrationService.showVariableRewardForAssigningBuddy()&&this.readingBuddyService.shouldShowAdventuresForProfile()&&!x?this.showVariableRewardToAssignReward():(this._restorePreviousState(),this.achievementQueueService.unpauseAchievementsQueue(0))}})}showVariableRewardToAssignReward(){this._starCelebrationService.openVariableReward(!0).then(i=>{const f=i.componentInstance.starAnimationClose.subscribe(()=>(0,P.mG)(this,void 0,void 0,function*(){if(f.unsubscribe(),null==i||i.close(),this._restorePreviousState(),this._starCelebrationService.rewardType===m.E4.ACCESSORY)return this.routingService.goToWebAppRoute({route:a.Pm.ADVENTURES}),void this._showRewardBackgroundService.hideRewardBackgroundOnApp()}))})}closeBook(i){var n,f;this.quizService.isCreateNewQuizDrawerOpen$.next(!1),this.quizService.isQuizDrawerOpenObservable.next(!1),this.clearBookPreviewHandler(),this.experienceService.isFreemiumExperience()?this.freemiumService.handleContentClose(this.curBook).then(b=>{b&&this.isBuddyFlowMatch()}):this.logData?(null===(n=this.curBook)||void 0===n?void 0:n.type)===C._.AUDIOBOOK||(null===(f=this.curBook)||void 0===f?void 0:f.type)===C._.VIDEO?this.isBuddyFlowMatch():this.updateLogEntry(!1,!0):this._restorePreviousState()}_restorePreviousState(){if(this.lastRouteData.route){this.isLeavingReadState=!0;let i=this.location.path();const n=this.location.subscribe(()=>{i=this.location.path(),i.includes("/read/")?this.location.back():(setTimeout(()=>{this.isLeavingReadState=!1},0),n.unsubscribe())});this.location.back()}else this.routingService.goToWebAppRoute({route:a.Pm.EXPLORE});this.bookOverlayService.scrollOffset&&setTimeout(()=>{const i=this.document.getElementById("epic-app-content-container");i&&i.scrollTo(0,this.bookOverlayService.scrollOffset)},100)}getContentSessionDuration(i=O.a_.SECONDS){let n;if(i===O.a_.SECONDS)n=this._contentSessionDurationSeconds;else{const f=this.dateHelperService.convertToMinutes(this._contentSessionDurationSeconds,O.a_.SECONDS);n=this.dateHelperService.convertMinutesToOtherUnit(f,i)}return n}resetReadContentServiceData(){this.fullBookData=void 0,this.curBook=void 0,this.logData=void 0,this.autoPlayFullBookData=null,this.bookLoadStatus$.next({status:se.NO_BOOK})}updateCurrentReadingGoal(){this.dailyReadTimeService.currentTimeReadStream.next({dailyReadTime:this.dailyReadTimeService.currentTimeRead,goalReadingTime:this.dailyReadTimeService.currentTimeRead>=300?1200:300,showSuccessAnimation:this.dailyReadTimeService.currentTimeRead>=1200})}onBookClose(){if(!this.fullBookData||this.curBook&&this.curBook.type!==C._.STANDARD)return;this.logPrevPageView(this.fullBookData.getCurrentPage()),this.stopReadingTimer(),this.updateLogEntry(!0),this.updateUserBook("bookCloseClick"),this.updateCurrentReadingGoal(),this.audio.clear(),this.checkoutOrReturnBookIfNeeded(!1),this.backToExplore.next(!0);const i=this.curBook,n=this.logData,f=i&&i.audio?E._9:E.DC,b=this.getCurBookClickUuid4();let k={book_id:i.id,content_type:i.type,duration:n&&n.time||0,freemium:this.profileService.showFreemiumExperience()?1:0,pages_flipped:this.readingData.pagesFlippedSinceOpen,view_duration:this.getSecondsReadSinceOpen(),mode:this.getFullScreenLabel(),zoom:this.magicPanService.zoomLevel>1?"yes":"no",src:this.bookOpenSource,click_uuid4:b};this.additionalBqParams&&(k=Object.assign(Object.assign({},k),this.additionalBqParams)),this.bigQueryService.log(f,k),this.recommendService.clearCurRecommendationsData(),this.updateLocalStorageBookProgress(),this.dailyReadTimeService.shouldShowDailyReadTimer()&&this.dailyReadTimeService.hasBeenOneMinute?this.bookCloseObservable.next({hasReadOneMinute:!0}):this.bookCloseObservable.next({previousRoute:this.lastRouteData.route}),this._autoplayService.resetAutoplayFlowFlags(),this.stopContentSnapshotLogs();let U={recommendationUuid4:i&&i.recommendation_uuid4,clickUuid4:b,contentId:i&&i.id,closePosition:this.getCurrentPage(),finishEnabled:this.isBookFinishEnabled?1:2,finished:this.hasBookBeenFinished()?1:2,source:this.snapshotSource,isNextInSeries:this.isNextInSeries};const x=this.previousContentFinishedLogged?this.iPreviousBookNextInSeries:this.isNextInSeries;x&&(U=Object.assign(Object.assign({},U),{isNextInSeries:x})),this.previousContentFinishedLogged=!1,this.iPreviousBookNextInSeries=!1,this.autoplayRTM&&(U=Object.assign(Object.assign({},U),{autoplay:this.autoplayRTM})),this.upNextBook&&(U=Object.assign(Object.assign({},U),{upnext:this.upNextBook})),this.contentLoggerService.createContentClosedLog(U)}startContentSnapshotLogs(i=(()=>this.readingData.isIdling?1:2),n=(()=>this.getCurrentPage())){this.stopContentSnapshotLogs(),this._contentSnapshotLogInterval=setInterval(()=>{var f,b;let k=Object.assign({recommendationUuid4:this.curBook&&this.curBook.recommendation_uuid4,clickUuid4:this.getCurBookClickUuid4()||"",contentId:this.curBook&&this.curBook.id,finishEnabled:this.isBookFinishEnabled?1:2,position:n(),isIdle:i(),finished:this.hasBookBeenFinished()?1:2,source:this.snapshotSource,isInteractive:!!(null===(f=this.curBook)||void 0===f?void 0:f.extensionUrl)},(null===(b=this.curBook)||void 0===b?void 0:b.extensionUrl)&&{extensionName:this.extractExtensionName(this.curBook.extensionUrl)});this.isNextInSeries&&(k=Object.assign(Object.assign({},k),{isNextInSeries:this.isNextInSeries})),this.autoplay&&(k=Object.assign(Object.assign({},k),{autoplay:!0})),this.upNextBook&&(k=Object.assign(Object.assign({},k),{upnext:!0})),this.autoplayRTM&&(k=Object.assign(Object.assign({},k),{autoplay:!0})),this.contentLoggerService.createContentSnapshotLog(k)},this.contentLoggerService.SNAPSHOT_HEARTBEAT)}stopContentSnapshotLogs(){this._contentSnapshotLogInterval&&clearInterval(this._contentSnapshotLogInterval)}extractExtensionName(i){var n;const b=((null===(n=i.split("/").pop())||void 0===n?void 0:n.split("?")[0])||"").match(/^(.+)-main\.js$/);return b?b[1]:""}_logContentTrailerStatus(i){var n;const f={};if(f.trailer_present=(null===(n=i.pageMetaContent)||void 0===n?void 0:n.length)>0?1:0,!f.trailer_present)return;f.book_id=i.bookId;const b=this._trailerService.getPageNumbers(i.pageMetaContent);f.page_numbers=JSON.stringify(b),f.video_enabled=this.accountService.videoEnabled,this.bigQueryService.log(_.U4.TRAILER_STATUS,f)}restoreUserBookStatus(i,n){if(!i||!i.book||!i.userBook)return null;this.bookOverlayService.resetHudDismissal();const f=i.book;return this.readingData.currentReadTime=i.userBook.currentReadTime,(n=Number(n))&&(this.openToIndex=n=1===n?-1:n-1-(f.pageNumOffset||0)),this.favorites=this.favoriteService.getFavoriteBooks(),this.peekFlipPage(),this.bookOverlayService.setHudDismissal(!!f.isBook()),this._logContentTrailerStatus(i),i}finishBook(){if(!this.fullBookData)return Promise.resolve();this.logData&&(this.logData.finished=1,this.updateLogEntry());const i=this.fullBookData.book.id;return this.bookService.finishBook(i).then(n=>{if(n){(this.fullBookData&&this.fullBookData.book.id)===i&&(this.finishBookObservable.next(n),this.readingData.isBookFinished=!0);const b=this.accountService.isSchoolPlus,U=this.experienceService.isStudent()&&!b,x=this._storySketchEnabledTeachersService.checkIfTeacherIsEnabled();return U&&x&&this.checkIfDrawingExistsForBook(i),n}return null})}checkIfDrawingExistsForBook(i){return(0,P.mG)(this,void 0,void 0,function*(){let n=yield this._drawboardService.checkIfDrawingExistsForBook(i);const f=!("object"!=typeof n||!(null==n?void 0:n.jsonFile))||!!n;this.drawingExistsForCurrenBook=f,this._drawboardService.drawingExistsForCurrenBook=f})}resumeBookRead(){!this.fullBookData||((this.stoppedTimerOnTabSwitch||this.stoppedTimerOnWindowBlur)&&this.timer.reset(),this.readingData.isIdling=!1,this.readingData.lastUpdatedSeconds=0,this.readingData.currUpdateSecondsRead=0,this.readingData.secondsReadSinceOpen=0,this.readingData.idleTimeSpent=0,this.heartBeatSimulator=0,this.wasReadToMePlayingBeforeTabHidden&&(this._readToMeResumeIntent$.next(),this.wasReadToMePlayingBeforeTabHidden=!1),this.wasReadToMePlayingBeforeWindowBlur&&(this._readToMeResumeIntent$.next(),this.wasReadToMePlayingBeforeWindowBlur=!1),this.stoppedTimerOnTabSwitch=!1,this.stoppedTimerOnWindowBlur=!1,this.readingTimerInterval||this.startReadingTimer())}pauseBookRead(){!this.fullBookData||(this.readingData.isIdling=!0,this.readingData.readSessions.push(this.readingData.secondsReadSinceOpen),this.stopReadingTimer(),this.readingData.idleTimeSpent=0,this.sendBookUpdatesCalls())}
1getBookLengthIncludingExtraPages(){if(!this.fullBookData)return 0;const i=this.fullBookData.getBookLength();return i%2==0?i+3:i+2}getCurrentPage(){return this.fullBookData?this.fullBookData.getCurrentPage():0}getCurPageLabel(){if(!this.curBook)return 0;const i=this.getCurPageIndexDisplay();return i<=0?this.romanNumeralsMapping[Math.abs(this.curBook.pageNumOffset||0)+i]:i}getCurPageIndexDisplay(i){return this.curBook?i&&this.getCurrentPage()>i?i:this.getCurrentPage()+1+(this.curBook.pageNumOffset||0):0}setCurrentPage(i,n,f,b="programmatic"){var k;return(0,P.mG)(this,void 0,void 0,function*(){if(!this.fullBookData)return!1;const U=()=>{const x=this.getCurrentPage();return this.bookOverlayService.previewBlocked$.value&&this.bookOverlayService.previewBlocked$.next(null),this.fullBookData.setCurrentPage(i),this.curPageTimeout&&clearTimeout(this.curPageTimeout),this.curPageTimeout=setTimeout(()=>{n||(this.logPrevPageView(x),this.incrementPagesFlipped(),this.isUserIdle()&&this.resumeBookRead());const J=this.getCurrentPage();this.pageChangeObservable.next({pageIndex:J,isSameSpread:f,source:b,direction:Math.sign(J-x)}),!this.userKnowsHowToFlip&&0!==this.getCurrentPage()&&this.turnPeekFlipOff()},150),!0};if(this._bookPreviewHandler){const x=this._bookPreviewHandler.checkAccess(i);return null===(k=x.handleStatus)||void 0===k||k.call(x,this.curBook),x.status===h.oG.PERMITTED?U():(this.bookOverlayService.previewBlocked$.next({pageIndex:i,pageLimit:this._bookPreviewHandler.pageLimit}),!1)}return U()})}turnPeekFlipOff(){this.pagePeekObservable$.next(!1),this.userKnowsHowToFlip=!0}peekFlipPage(){var i,n;this.userKnowsHowToFlip=!1,(null===(i=this.fullBookData)||void 0===i?void 0:i.bookType)===C._.STANDARD&&0===this.getCurrentPage()&&((null===(n=this.curBook)||void 0===n?void 0:n.isReadToMe())&&this.getLastPlayPauseState()?this.turnPeekFlipOff():this.pagePeekObservable$.next(!0))}pageExistsForDirection(i){const n=this.getCurrentPage();if(!this.fullBookData||!n&&0!==n)return!1;switch(i){case oe.BACKWARD:return n-1>=-1;case oe.FORWARD:return n<this.getBookLengthIncludingExtraPages()-1}}willPermitPageTurn(i,n){if(!this._bookPreviewHandler)return!0;const f=this.bookOverlayService.readingModesData[n].incrementCurPageIndexBy,b=i===oe.BACKWARD?this.getCurrentPage()-f:this.getCurrentPage()+f;return this._bookPreviewHandler.checkAccess(b).status===h.oG.PERMITTED}goToPageInDirection(i,n,f,b="programmatic"){if(this.fullBookData&&this.pageExistsForDirection(i)){switch(this.openToIndex=void 0,i){case oe.BACKWARD:this.setCurrentPage(this.getCurrentPage()-this.bookOverlayService.readingModesData[n].incrementCurPageIndexBy,void 0,f,b);break;case oe.FORWARD:this.setCurrentPage(this.getCurrentPage()+this.bookOverlayService.readingModesData[n].incrementCurPageIndexBy,void 0,f,b)}this.readingData.idleTimeSpent=0,this.bookOverlayService.toggleControls(!1)}}getPageHashByPageIndex(i){if(!this.fullBookData)return null;const n=this.fullBookData.getSpineItem(i);if(n&&n.page){const f=n.page.split("/");return f[f.length-1].split(".")[0]}return null}incrementPagesFlipped(){this.logData&&"number"==typeof this.logData.pagesFlipped&&(this.logData.pagesFlipped+=1),this.readingData.currUpdatePagesFlipped+=1,this.readingData.pagesFlippedSinceOpen+=1}shouldShowPreCompletionPage(){return!!this.fullBookData&&this.fullBookData.getBookLength()%2==0}onLastPage(){return!!this.fullBookData&&this.getCurrentPage()===this.fullBookData.getBookLength()}onEOBPages(){return!!this.fullBookData&&this.getCurrentPage()>this.fullBookData.getBookLength()}
1adjustIndexForReadingMode(i){if(this.openToIndex)this.setCurrentPage(this.openToIndex);else if(i===T.h.DOUBLE_PAGE&&this.fullBookData&&this.fullBookData.bookType===C._.STANDARD){let n=this.getCurrentPage();n=Math.min(Math.max(0,n),this.fullBookData.getBookMaxIndex()),n=1===Math.abs(n%2)?n+1:n,this.setCurrentPage(n,!0)}}getCdnPageImageUrlByIndex(i){return this.bookService.getCdnPageImageUrlByIndex(this.fullBookData,i)}logPrevPageView(i){if(!this.fullBookData)return;const n=this.readingData.pageStartTimestamp,f=this.dateHelperService.getCurrentUnixTimestamp();this.readingData.pageStartTimestamp=f;const b=this.fullBookData.getSpine();if(b&&i-1>=b.length)return;const k=this.fullBookData.bookId;let U=f-n;if(!U)return;U>this.IDLE_THRESHOLD_DURATION&&(U=this.IDLE_THRESHOLD_DURATION);const x=!(!this.getCdnPageImageUrlByIndex(i)||!this.getCdnPageImageUrlByIndex(i-1)),J={bookId:k,prevIndex:i,duration:U,isSpread:x||!1};J.bookId&&"number"==typeof J.prevIndex&&J.duration&&this.dataService.post("WebUserBook","logPageView",J).then(q=>{var X;if(q&&q.result&&q.result.paid_read){const re=null===(X=this.curBook)||void 0===X?void 0:X.isReadToMe(),ne=re?E.sk:E.sK;let z={book_id:k,content_type:this.curBook.type,page:this.getCurrentPage(),duration:this.getSecondsReadSinceOpen(),mode:this.getFullScreenLabel(),zoom:this.magicPanService.zoomLevel>1?"yes":"no",src:this.bookOpenSource};this.additionalBqParams&&(z=Object.assign(Object.assign({},z),this.additionalBqParams)),re&&(z.highlight=this.bookOverlayService.getHighlightMode()),this.bigQueryService.log(ne,z)}})}getFullScreenLabel(){return this.bookOverlayService.isFullscreen?"fullscreen":"mini"}getReadTimeSinceLastBookFinish(){return this.fullBookData&&this.readingData.currentReadTime+this.readingData.currUpdateSecondsRead||0}hasBookBeenFinished(){return this.readingData.isBookFinished}isUserIdle(){return this.readingData.isIdling}getSecondsReadSinceOpen(){return this.readingData.readSessions&&this.readingData.readSessions.length?this.readingData.secondsReadSinceOpen+this.readingData.readSessions.reduce((i,n)=>i+n,0):this.readingData.secondsReadSinceOpen}bookHasQuiz(){if(this.fullBookData)return this.fullBookData.quiz}getBigQueryLogParams(){var i,n,f;let b={content_id:null===(i=this.curBook)||void 0===i?void 0:i.id,content_type:null===(n=this.curBook)||void 0===n?void 0:n.type};return(null===(f=this.curBook)||void 0===f?void 0:f.type)===C._.STANDARD&&(b.display_page_index=this.getCurPageIndexDisplay()),b}updateLocalStorageGenericBookProgress(i,n=0){this.updateLocalStorageBookProgress(i,n)}updateLocalStorageBookProgress(i,n){var f,b;if(!this.curBook||this.curBook.type!==C._.VIDEO)try{const k=this.checkBookTypeAndGetProgressValue(i,n);if(this.curBook&&this.curBook.crrSeriesId&&100===k||0===k&&0===(null===(f=this.fullBookData)||void 0===f?void 0:f.getBookProgressPercentageFromApi())||(null===(b=this.curBook)||void 0===b?void 0:b.id.toString())===this.browseService.currentlyHiddenBookId)return void(this.browseService.currentlyHiddenBookId=null);const U=this.browseService.getForYouSectionContinueReadingRowData();Array.isArray(null==U?void 0:U.bookData)&&this.updateBookProgressOnBrowseScreen(U,k)}catch(k){console.warn("Error in updating the book in CRR ",k)}}updateBookProgressOnBrowseScreen(i,n){i.bookData=i.bookData.filter(b=>{var k;return b.id!==(null===(k=this.curBook)||void 0===k?void 0:k.id)});let f=new C.c(this.curBook);f.setBookProgress(n),i.bookData.unshift(f),this.browseService.setForYouSectionContinueReadingRowData(i.bookData)}checkBookTypeAndGetProgressValue(i,n){return i===C._.AUDIOBOOK?null!=n?n:0:this.getBookProgressPercentage()}startReadingTimer(){this.timer.start(),this.readingTimerInterval=setInterval(()=>{if(this.readingData.idleTimeSpent>this.IDLE_THRESHOLD_DURATION)return void this.pauseBookRead();const i=Number(Math.round(this.timer.getTime()/1e3)),n=i-this.timeInSeconds;if(n>200||n<-200)return this.timer.reset(),this.timer.start(),void console.warn("Change in the system time detected, resetting reading time!");this.timeInMinutes=Math.floor(this.timeInSeconds/60),this.timeInSeconds=i,this.readingData.secondsReadSinceOpen=i,this.readingData.currUpdateSecondsRead=i-this.readingData.lastUpdatedSeconds,this.lastTimeStamp!==Math.round(i)&&(this.lastTimeStamp=Math.round(i),this.heartBeatSimulator+=1,this.readingData.idleTimeSpent+=1),this.heartBeatSimulator===this.UPDATE_APP_TIME_EVERY&&(this.heartBeatSimulator=0,this.sendBookUpdatesCalls()),this.heartBeatSimulatorProgress=`${Math.round(100*this.heartBeatSimulator/this.UPDATE_APP_TIME_EVERY)}%`},100)}stopReadingTimer(){this.timer.stop(),this.timer.reset(),this.timeInSeconds=0,this.timeInMinutes=0,this.heartBeatSimulator=0,this.lastTimeStamp=0,clearInterval(this.readingTimerInterval),this.readingTimerInterval=null}sendBookUpdatesCalls(){!this.fullBookData||(this.updateLogEntry(),this.updateUserBook(),this.checkoutOrReturnBookIfNeeded(!0),this.readingData.currUpdateSecondsRead=0,this.readingData.currUpdatePagesFlipped=0)}findOrCreateCurrentLogEntry(){!this.fullBookData||(this.dailyReadTimeService.hasBeenOneMinute=!1,this.logEntryService.findOrCreateCurrentLogEntry(this.fullBookData.bookId).then(i=>{i&&(this.logData=i)}))}updateLogEntry(i=!1,n=!1){if(!this.fullBookData||!this.logData)return;const f=()=>{this.logEntryService.updateLogEntry(this.logData,n,i).then(b=>{b&&n&&this.checkStarCelebrationFlow()})};this.logData.progress=this.getBookProgressPercentage(),this.logData.time=(Number(this.logData.time)||0)+Number(this.readingData.currUpdateSecondsRead),this.readingData.lastUpdatedSeconds+=Number(this.readingData.currUpdateSecondsRead),!(this.logData.time<0)&&(this.freemiumService.handleFreemiumReadDurationUpdate(this.readingData.currUpdateSecondsRead,O.a_.SECONDS),this._contentSessionDurationSeconds+=this.readingData.currUpdateSecondsRead,this.dailyReadTimeService.setCurrentTimeRead(this.logData,Number(this.readingData.currUpdateSecondsRead)).then(b=>{this.logData=b,f()}))}addBookClickUuidToDict(i,n){i.recommendation_uuid4&&(this._clickUuid4Dict[i.recommendation_uuid4]=n)}getCurBookClickUuid4(){if(this.curBook&&this.curBook.recommendation_uuid4&&this._clickUuid4Dict[this.curBook.recommendation_uuid4])return this._clickUuid4Dict[this.curBook.recommendation_uuid4]}getBookClickUuid4(i){return i&&i.recommendation_uuid4&&this._clickUuid4Dict[i.recommendation_uuid4]?this._clickUuid4Dict[i.recommendation_uuid4]:void 0}setBookPreviewHandler(i){this._bookPreviewHandler=i}clearBookPreviewHandler(){this._bookPreviewHandler=void 0,this.bookOverlayService.previewBlocked$.value&&this.bookOverlayService.previewBlocked$.next(null)}setImpressionsDataForEndOfBook(i){var n;this.impressionsLoggerService.setData(a.Pm.READ,{categories:this.recommendService.curRecommendationsData&&this.recommendService.curRecommendationsData.recommendationsData&&this.recommendService.curRecommendationsData.recommendationsData.categories,apiUuid:i[1]&&i[1].apiResponseUuid4,curBookRecommendationUuid4:this.curBook&&this.curBook.recommendation_uuid4,current_content:{id:this.curBook&&this.curBook.id},curBookType:null===(n=this.curBook)||void 0===n?void 0:n.type})}updateUserBook(i=""){if(!this.fullBookData)return;let n=this.getCurrentPage();
1this.readingData.isBookFinished&&n+1===this.getBookLengthIncludingExtraPages()&&(n=0);const f={bookId:this.fullBookData.bookId,index:n,duration:this.readingData.currUpdateSecondsRead,pagesFlipped:this.readingData.currUpdatePagesFlipped,progress:this.getBookProgressPercentage(),timezoneOffset:this.envService.getTimezoneOffset(),currentTs:this.dateHelperService.getCurrentUnixTimestamp()};this.dataService.post("WebUserBook","updateUserBookWithIndex",f).then(b=>{if(b&&b.result){this.readingData.currentReadTime=b.result.currentReadTime;const k=this.routingService.getCurSubroute()===a.Pm.READ;this.isSeriesBook&&"bookCloseClick"===i&&!k&&(this.isSeriesBook=!1,this.browseService.handleContinueReadingDataRow())}})}checkoutOrReturnBookIfNeeded(i){return this.fullBookData&&this.fullBookData.publisherData.checkout?this.bookService.checkoutOrReturnBook(this.fullBookData.book.id,i):Promise.resolve()}getBookProgressPercentage(){const i=this.getCurrentPage();if(!this.fullBookData||!i&&0!==i)return 0;const n=this.fullBookData.getBookLength(),f=Math.floor(i/n*100);return Math.min(f,100)}showCheckedOutAlert(i,n){return(0,P.mG)(this,void 0,void 0,function*(){yield this.coreDialogService.loadComponentWithLazyLoadImports(g.E.ConfirmationDialogComponent,{data:{title:i,description:n,oneOption:!0,customParams:{confirmIsPrimaryAction:!0}}})})}isBookURLAccessible(){var i;return!!(null===(i=this.accountService)||void 0===i?void 0:i.videoEnabled)}getNextRecommendedBookIdInSeries(){var i,n,f,b;return(null===(n=null===(i=this.recommendService.curRecommendationsData)||void 0===i?void 0:i.nextBookRecommendation)||void 0===n?void 0:n.isSeriesBook)?null===(b=null===(f=this.recommendService.curRecommendationsData)||void 0===f?void 0:f.nextBookRecommendation)||void 0===b?void 0:b.id:null}autoPlayNextBook(i){this.autoPlayBook.next(i)}resetAutoPlayBookSubject(){this.autoPlayBook.next({bookType:null,autoPlayBookId:null})}fetchFullBookData(i){var n;return(0,P.mG)(this,void 0,void 0,function*(){if(i)try{const f=yield this.bookService.getFullBookData(i,this.profileService.freemiumExperience);f&&(null==f?void 0:f.book)&&0===(null===(n=null==f?void 0:f.book)||void 0===n?void 0:n.regionRestricted)&&(this.autoPlayFullBookData=f,this.autoPlayFullBookData.resetAutoPlayUserBookProgressToZero())}catch(f){this.autoPlayFullBookData=null}})}fetchRecommendedBookData(i,n,f){var b;return(0,P.mG)(this,void 0,void 0,function*(){if(i)try{const k=yield this.recommendService.getRecommendedBooksByBookId(i,n,f);(null===(b=null==k?void 0:k.categories)||void 0===b?void 0:b.length)>0&&(this.recommendService.autoPlayBookRecommendationData=k,this.recommendService.autoPlayBookId=i)}catch(k){this.recommendService.autoPlayBookRecommendationData=null}})}destroyDynamicallyCreatedItemComponent(){var i,n;null===(n=null===(i=this.autoPlayEpicBookItemComponentRef)||void 0===i?void 0:i.newEpicBookItem)||void 0===n||n.destroy(),this.autoPlayEpicBookItemComponentRef={newEpicBookItem:null,centerCoordinatesOfBook:{clientX:0,clientY:0}}}resetAutoPlayBookData(){this.recommendService.autoPlayBookRecommendationData=null,this.autoPlayFullBookData=null,this.autoplay=!1,this.recommendService.autoPlayBookId=null}_showToaster(i="The URL you entered is not accessible."){this._epicToastCustomService.show({duration:1e4,type:"info",title:"Something\u2019s gone haywire.",message:i,imgUrl:"/assets/app/toasts/collection-delete-character.png"}),this.routingService.getCurSubroute()===a.Pm.READ&&this._restorePreviousState()}showRecommendedRowSectionToggle(i){this._showRecommendedRowSection.next(void 0!==i?i:!this._showRecommendedRowSection.value)}getshowRecommendedRowSectionValue(){return this._showRecommendedRowSection.value}}return A.\u0275fac=function(i){return new(i||A)(r.LFG(S.B),r.LFG(I.Q),r.LFG(B.d),r.LFG(R.p),r.LFG(L.Z),r.LFG(F.th),r.LFG(G.Iz),r.LFG(N.CoreDialogService),r.LFG(Q.S),r.LFG(u.s6),r.LFG(W.R),r.LFG($.D),r.LFG(O.mx),r.LFG(H.DJ),r.LFG(ke),r.LFG(V.DT),r.LFG(Re.U),r.LFG(Le.e),r.LFG(Ae.h),r.LFG(Ue),r.LFG(j.n),r.LFG(D.Ye),r.LFG(we.K),r.LFG(Fe.f),r.LFG(Ne.w),r.LFG(ze.X),r.LFG(w.ProfileService),r.LFG(xe.JZ),r.LFG(e),r.LFG(o.N),r.LFG(Qe.Kj),r.LFG(Ge.c),r.LFG(l.Z),r.LFG(Te.Zn),r.LFG(_.R),r.LFG(We.z),r.LFG(m.cZ),r.LFG(Ke.R),r.LFG(He.f),r.LFG(D.K0),r.LFG(Ve.J),r.LFG($e.PostTrialExperimentService),r.LFG(c.DrawboardService),r.LFG(je.StorySketchEnabledTeachersService),r.LFG(r.zs3),r.LFG(Ye.v))},A.\u0275prov=r.Yz7({token:A,factory:A.\u0275fac,providedIn:"root"}),A})()}}]);
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.