principal-dashboard-lib-v2 0.0.39 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("angular-google-charts"),require("file-saver"),require("xlsx"),require("@angular/common"),require("ng2-datepicker"),require("html2canvas"),require("jspdf")):"function"==typeof define&&define.amd?define("principal-dashboard-lib-v2",["exports","@angular/core","rxjs","angular-google-charts","file-saver","xlsx","@angular/common","ng2-datepicker","html2canvas","jspdf"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["principal-dashboard-lib-v2"]={},e.ng.core,e.rxjs,e.angularGoogleCharts,e.FileSaver,e.XLSX,e.ng.common,e.ng2Datepicker,e.html2canvas,e.jspdf)}(this,(function(e,t,i,n,a,r,o,s,l,d){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(l),u=function(){function e(){this.isResoureMetaDataReady=new i.ReplaySubject,this.isResoureMetaDataReady$=this.isResoureMetaDataReady.asObservable(),this.isUserReqiuredDataReady=new i.ReplaySubject,this.isUserReqiuredDataReady$=this.isUserReqiuredDataReady.asObservable(),this.mychartType="",this.dataType="",this.userAllData="",this.userMetadata={userDetails:[],resourceDetails:[]},this.resoureMetadata=new Array,this.userDetailObject={},this.userlist=!1,this.chartType=new i.BehaviorSubject(this.mychartType),this.chartType$=this.chartType.asObservable(),this.isUserWise_data=new i.BehaviorSubject(!0),this.isUserWise_data$=this.isUserWise_data.asObservable(),this.isAllUsers=new i.BehaviorSubject(this.userlist),this.isAllUsers$=this.isAllUsers.asObservable(),this.detailedviewData=new i.BehaviorSubject(this.userMetadata),this.detailedviewData$=this.detailedviewData.asObservable(),this.isInsightsView=new i.BehaviorSubject(!1),this.isInsightsView$=this.isInsightsView.asObservable(),this.openSmallTable=new i.BehaviorSubject(!1),this.detailAccentColor="",this.detailRowRequest=null,this.openSmallTable$=this.openSmallTable.asObservable()}return e.prototype.genarateResourseReqiuredData=function(e){this.isResoureMetaDataReady.next(!1);var t=new Array;if(e&&null!==e){var i=e.resourcesMetadata.resourceMetadata;if(null!=i&&i.length>0)for(var n=0;n<i.length;n++){var a={resouseID:i[n].resourceId,subject:null!=i[n].subject&&null!=i[n].subject.title?i[n].subject.title:"",grade:null!=i[n].grade&&null!=i[n].grade.title?i[n].grade.title:"",chapter:null!=i[n].chapter&&null!=i[n].chapter.title?i[n].chapter.title:"",teachingPoint:null!=i[n].teachingPoint&&null!=i[n].teachingPoint.title?i[n].teachingPoint.title:"",type:null!=i[n].type?this.getDisplaytypeValue(i[n].type):"",title:null!=i[n].title?i[n].title:""};t.push(a),this.resoureMetaData=t,this.isResoureMetaDataReady.next(!0)}}return t},e.prototype.getName=function(e){return/School Admin/gm.exec(e.role)?"Support Admin":e.fullName},e.prototype.genarateUserReqiuredData=function(e){this.isUserReqiuredDataReady.next(!1);var t=new Array,i=new Array,n=new Array,a=new Array;if(e&&null!==e){var r=e.usersConsole.userConsole,o=e.usersMetadata.userMetadata,s=e.schoolTerminals.schoolTerminal;if(null!=o&&o.length>0)for(var l=0;l<o.length;l++){var d={};""!=o[l].userId&&(d={userId:o[l].userId,userName:void 0!==o[l].fullName?this.getName(o[l]):"",userSubjects:void 0!==o[l].userSubjects?o[l].userSubjects:""},t.push(d))}for(var c=0;c<t.length;c++)t.forEach((function(e){t[c].userName===e.userName&&(i.push(t[c]),t.splice(c,1))}));for(c=0;c<i.length;c++)i[c].userName=i[c].userName,t.push(i[c]),this.usersMetaData=t;if(null!=s&&s.length>0)for(c=0;c<s.length;c++){var p,u=void 0,h=void 0,m=void 0,f=void 0;if(u=void 0!==s[c].schoolId?s[c].schoolId:"",h=void 0!==s[c].terminalKey?s[c].terminalKey:"",m=void 0!==s[c].terminalType?s[c].terminalType:"",void 0!==s[c].metadata)f=JSON.parse(s[c].metadata).location;else f="";p={schoolId:u,terminalKey:h,terminalType:m,location:f},n.push(p),this.schoolTerminalData=n}if(null!=r&&r.length>0)for(var g=function(e){var i=void 0,o=void 0,s=void 0,l=void 0,d=void 0,c=void 0,p=[],u=[],h=void 0,m=void 0,f=void 0,g=[];i=void 0!==r[e].userId?r[e].userId:"",o=void 0!==r[e].startTime?r[e].startTime:"",void 0!==r[e].endTime?(s=r[e].endTime,v.myEndTime=s):s="",void 0!==r[e].selectedDate&&r[e].selectedDate,l=void 0!==r[e].duration?r[e].duration:"",d=void 0!==r[e].terminalIP?r[e].terminalIP:"",null!=(c=void 0!==r[e].userConsoleResources?r[e].userConsoleResources:null)&&(void 0!==c.userConsoleResource?c.userConsoleResource.forEach((function(e){p.push(e.resourceId),u.push(e.duration),e.launchedFrom&&g.push(e.launchedFrom)})):(p=[],u=[],g=[]));for(var b=0;b<t.length;b++)i===t[b].userId&&(h=t[b].userName,m=t[b].userSubjects);for(var y=0;y<n.length;y++){if(d===n[y].terminalKey){f=n[y].location;break}f=""}void 0!==f&&"undefined"!==f||(f="");var x={userId:i,userName:h,startTime:new Date(o),endTime:new Date(s),terminalIP:d,resourceMetauserConsoleData:p,resourceDurationFromConsole:u,launchedFrom:g,duration:l,terminalLocation:f,userSubjects:m};a.push(x),v.userConsoleData=a,v.isUserReqiuredDataReady.next(!0)},v=this,b=0;b<r.length;b++)g(b)}return{usersMetadata:t,schoolTerminalData:n,userConsoleData:a}},e.prototype.userWiseChartData=function(){var e=new Array;if(e=[],this.userConsoleData&&this.userConsoleData.length>0)for(var t=0;t<this.userConsoleData.length;t++){void 0===typeof this.userConsoleData[t].userName&&(this.userConsoleData[t].userName=Math.floor(100*Math.random()).toString()),void 0===this.userConsoleData[t].userName&&(this.userConsoleData[t].userName="-");var i=[this.userConsoleData[t].userName,this.userConsoleData[t].startTime,this.userConsoleData[t].endTime];e.push(i)}return e},e.prototype.classRoomWiseChartData=function(){var e=new Array;if(e=[],this.userConsoleData)for(var t=0;t<this.userConsoleData.length;t++){var i=this.userConsoleData[t].terminalLocation,n=[this.getRoomLabel(i,this.userConsoleData[t].terminalIP),this.userConsoleData[t].startTime,this.userConsoleData[t].endTime];e.push(n)}return e},e.prototype.newGetCurrentClassroomData=function(){var e=new Array;if(e=[],this.userConsoleData)for(var t=0;t<this.userConsoleData.length;t++){var i=this.userConsoleData[t].terminalLocation+" - "+this.userConsoleData[t].terminalIP;e.push(i)}return e=this.uniq(e)},e.prototype.getRoomLabel=function(e,t){var i=null==e||"undefined"===e?"":String(e).trim();return""!==i?i:t||""},e.prototype.uniq=function(e){return Array.from(new Set(e))},e.prototype.allUserChartData=function(){var e=new Array;e=[];var t=new Array;if(t=[],this.userConsoleData&&this.usersMetaData){for(var i=void 0,n=void 0,a=void 0,r=new Array,o=0;o<this.userConsoleData.length;o++)r.push(this.userConsoleData[o]),t.push(this.userConsoleData[o]);for(var s=0;s<this.usersMetaData.length;s++){a=this.usersMetaData[s].userId,i=this.usersMetaData[s].userName,n=this.usersMetaData[s].userSubjects;var l={userId:a,userName:i,startTime:new Date(this.myEndTime),endTime:new Date(this.myEndTime),terminalIP:"",resourceMetauserConsoleData:[],duration:"0",terminalLocation:"",userSubjects:n},d={userId:a,userName:i,startTime:"",endTime:"",terminalIP:"",resourceMetauserConsoleData:[],duration:0,terminalLocation:"",userSubjects:n};t.push(d),r.push(l)}setTimeout((function(){for(var t=function(t){null==r[t].userName&&r.splice(t,1),"--"===r[t].userName&&r.splice(t,1),setTimeout((function(){var i=[r[t].userName,r[t].startTime,r[t].endTime];e.push(i)}),300)},i=0;i<r.length;i++)t(i)}),50)}return{forChartData:e,fordurationTable:t}},e.prototype.allRoomsData=function(){var e=new Array;e=[];var t=new Array;if(t=[],this.userConsoleData&&this.schoolTerminalData){for(var i={},n=void 0,a=0;a<this.userConsoleData.length;a++){t.push(this.userConsoleData[a]);var r=this.userConsoleData[a].terminalLocation,o=this.userConsoleData[a].terminalIP,s=[this.getRoomLabel(r,o),this.userConsoleData[a].startTime,this.userConsoleData[a].endTime];e.push(s)}var l=this.userConsoleData.map((function(e){return e.terminalIP}));for(a=0;a<this.schoolTerminalData.length;a++)if(!l.includes(this.schoolTerminalData[a].terminalKey)){n=this.getRoomLabel(this.schoolTerminalData[a].location,this.schoolTerminalData[a].terminalKey),i={userId:"",userName:"",startTime:new Date(this.myEndTime),endTime:new Date(this.myEndTime),terminalIP:this.schoolTerminalData[a].terminalKey,resourceMetauserConsoleData:[],duration:0,terminalLocation:this.schoolTerminalData[a].location,userSubjects:""},t.push(i);var d=[n,new Date(this.myEndTime),new Date(this.myEndTime)];e.push(d)}}return{forChartData:e,fordurationTable:t}},e.prototype.dataForTableView=function(e,t){var i,n=new Array;new Array;n=[];for(var a=0;a<e.length;a++){var r,o,s,l=void 0,d=void 0,c=void 0,p=void 0,u=void 0,h=void 0,m=void 0,f=void 0,g=(new Array,new Array);new Array;g=[],[],f=e[a].userSubjects,m=e[a].userName,null!=e[a].startTime&&""!=e[a].startTime&&null!=e[a].endTime&&""!=e[a].endTime&&(l=e[a].startTime.toLocaleTimeString("en-US",{hour12:!0}),d=e[a].endTime.toLocaleTimeString("en-US",{hour12:!0}),i=e[a].startTime.getDate()+"/"+(e[a].startTime.getMonth()+1)+"/"+e[a].startTime.getFullYear()),c=Math.floor(e[a].duration);var v=e[a].terminalLocation+" "+e[a].terminalIP;if(r=e[a].resourceMetauserConsoleData,o=e[a].resourceDurationFromConsole,s=Array(e[a].launchedFrom),0===r.length)void 0,void 0,void 0,g=[m,f,i,l,d,c,v,p=void 0,u=void 0,h=void 0,void 0,void 0,s],n.push(g);else for(var b=0;b<r.length;b++)for(var y=0;y<t.length;y++)r[b]===t[y].resouseID&&(p=t[y].subject,u=t[y].grade,h=t[y].chapter,t[y].topicName,g=[m,f,i,l,d,c,v,p,u,h,t[y].teachingPoint,"whiteboard"===t[y].title.toLowerCase()||"question"===t[y].title.toLowerCase()?this.getDisplaytypeValue(t[y].type)+" : "+this.convertSeconds(o[b]):this.getDisplaytypeValue(t[y].type)+" : "+t[y].title+" : "+this.convertSeconds(o[b]),s],n.push(g),m=void 0,f=void 0,i=void 0,l=void 0,d=void 0,c=void 0,v=void 0)}return n},e.prototype.dataForDetailedView=function(e,t,i){var n=new Array;var a,r,o,s,l,d,c=new Array;c=[];var p=new Array;p=[],s=e[i].userSubjects,o=e[i].userName,null!=e[i].startTime&&""!=e[i].startTime&&null!=e[i].endTime&&""!=e[i].endTime&&(a=e[i].startTime.toLocaleTimeString("en-US",{hour12:!0}),r=e[i].endTime.toLocaleTimeString("en-US",{hour12:!0}),e[i].startTime.getDate(),e[i].startTime.getMonth(),e[i].startTime.getFullYear()),Math.floor(e[i].duration);var u=e[i].terminalLocation+" "+e[i].terminalIP;if(l=e[i].resourceMetauserConsoleData,d=e[i].resourceDurationFromConsole,n=[o,a,s,r,u],0==l.length)void 0,void 0,void 0,void 0,void 0;else for(var h=0;h<l.length;h++)for(var m=0;m<t.length;m++)l[h]===t[m].resouseID&&(p=[t[m].subject,t[m].grade,t[m].chapter,t[m].teachingPoint,"whiteboard"===t[m].title.toLowerCase()||"question"===t[m].title.toLowerCase()?this.getDisplaytypeValue(t[m].type)+": "+this.convertSeconds(d[h]):this.getDisplaytypeValue(t[m].type)+": "+t[m].title+": "+this.convertSeconds(d[h])],c.push(p));return{userDetails:n,resourceDetails:c}},e.prototype.getDisplaytypeValue=function(e){var t=e;return[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"}].forEach((function(i){i.type===e&&(t=i.display)})),t},e.prototype.convertSeconds=function(e){return Math.floor(e/60)+"m "+e%60+"s"},e}();u.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new u},token:u,providedIn:"root"}),u.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[]};var h=function(){function e(e){this.pdService=e,this.userSelectedDate=new t.EventEmitter,this.messageForUser="Loding...",this.isInsights=!1}return Object.defineProperty(e.prototype,"responseStatus",{set:function(e){this.setMessageForUser(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.pdService.isInsightsView.subscribe((function(t){return e.isInsights=t}))},e.prototype.setMessageForUser=function(e){this.messageForUser=e},e.prototype.onUserSelectDate=function(e){this.data=null,this.userSelectedDate.emit(e)},e}();h.decorators=[{type:t.Component,args:[{selector:"lib-principal-dashboard-lib-v2",template:'<div id="reprtModule">\n <div id="pd-mainDiv" class="pd-mainContainer">\n <lib-header [data]="data" (userSelectedDate)="onUserSelectDate($event)">\n </lib-header>\n <lib-chartheader></lib-chartheader>\n \n <div id="pd-preloader" class="pd-preloaderDiv" *ngIf="responseStatus !== \'true\' && !data">\n {{messageForUser}} \n </div>\n \x3c!-- kept alive (only hidden) while on Insights so the timeline keeps its state --\x3e\n <div [style.display]="isInsights ? \'none\' : \'block\'">\n <lib-chartview *ngIf="data" [data]="data"></lib-chartview>\n \x3c!-- <lib-tableview *ngIf="data" [data]="data"></lib-tableview> --\x3e\n <lib-full-table-view *ngIf="data" [data]="data"></lib-full-table-view>\n </div>\n <lib-insights *ngIf="data && isInsights" [data]="data"></lib-insights>\n \x3c!-- <lib-detailedview *ngIf="data" [data]="data"></lib-detailedview> --\x3e\n <lib-small-table-view *ngIf="data" [data]="data"></lib-small-table-view>\n \n </div>\n</div>\n ',styles:[".pd-mainContainer{width:100%;height:100%}.pd-mainContainer .pd-preloaderDiv{text-align:center;line-height:27;position:absolute;width:100%;height:87%;z-index:2}.bs-datepicker-head{background-color:#000!important}"]}]}],h.ctorParameters=function(){return[{type:u}]},h.propDecorators={data:[{type:t.Input}],responseStatus:[{type:t.Input}],userSelectedDate:[{type:t.Output}]};var m=function(){function e(e){this.pdService=e,this.mytype=n.ChartType.Timeline,this.datadisplaytype="UserWise",this.isUserWise=!0,this.isChartView=!0,this.isInsights=!1}return e.prototype.ngOnInit=function(){this.libVersion="0.0.39"},e.prototype.changeChatType=function(){this.mytype==n.ChartType.Timeline?(this.isChartView=!1,this.mytype=n.ChartType.Table,this.pdService.chartType.next(this.mytype)):(this.isChartView=!0,this.mytype=n.ChartType.Timeline,this.pdService.chartType.next(this.mytype))},e.prototype.showInsights=function(){this.isInsights=!0,this.pdService.openSmallTable.next(!1),this.pdService.isInsightsView.next(!0)},e.prototype.changeDataTypeClassRoom=function(){this.leaveInsights(),this.isUserWise=!1,this.pdService.isUserWise_data.next(!1)},e.prototype.changeDataTypeUser=function(){this.leaveInsights(),this.isUserWise=!0,this.pdService.isUserWise_data.next(!0)},e.prototype.leaveInsights=function(){this.isInsights&&(this.isInsights=!1,this.pdService.isInsightsView.next(!1))},e}();m.decorators=[{type:t.Component,args:[{selector:"lib-chartheader",template:'\n<div id="pd-chartheader">\n <div id="pd-chatTypeBtnDiv" *ngIf="!isInsights" class="pd-tabIconBtn" [ngClass]=" isChartView ? \'tableIconImg\' : \'chartIconImg\'" (click)="changeChatType()">\n </div>\n \n <div id="pd-userWisechatTypeBtn" class="userWiseBtn" [ngStyle]="{ color: isUserWise && !isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: isUserWise && !isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="changeDataTypeUser()">User wise</div>\n <div id="pd-classRoomWiseBtn" class="classWiseBtn" [ngStyle]="{ color: !isUserWise && !isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: !isUserWise && !isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="changeDataTypeClassRoom()">Classroom wise</div><div id="pd-insightsBtn" class="insightsBtn" [ngStyle]="{ color: isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="showInsights()">Insights</div>\n\n \n <div class="libVersionDiv">v{{libVersion}}</div>\n</div>',styles:['#pd-chartheader{font-size:12pt;font-weight:400;color:#5c5c5c;z-index:1;width:100%;height:40px;position:relative;margin:10 auto;text-align:center;background-color:#e0e0e0}#pd-chartheader #pd-classRoomWiseBtn,#pd-chartheader #pd-insightsBtn,#pd-chartheader #pd-userWisechatTypeBtn{background:-moz-linear-gradient(center top,#45a1da 5%,#1172ae 100%);display:inline-block;padding:0 20px;cursor:pointer;margin:5px 0 0;width:160px;height:30px;line-height:30px}#pd-chartheader .libVersionDiv{position:absolute;font-size:12px;color:#343a40;margin-top:-21px;font-weight:700;margin-left:71px}.userWiseBtn{border-radius:6px 0 0 6px}.insightsBtn{border-radius:0 6px 6px 0;border-left:1px solid #e0e0e0}.pd-tabIconBtn{cursor:pointer;position:absolute;left:10px;top:-17px;width:62px;height:52px;background-repeat:no-repeat}.tableIconImg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkZDQzc3REFDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkZDQzc3REJDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRkNDNzdEOEMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyRkNDNzdEOUMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnXBGHQAAAblSURBVHja3FrLbxtFGP9mdh0/m0DSPFvnEKAHkBCNShEHWlB5nEigqgRcokogLlwR/AHcEDf4BxBXToEDV0JfqlAgQiJIVVtKuaQmzcOO7fgxw3yzO/Z4vC/DurU70mhm19/Ofr/v981vZndNIFohMFyFhxnYEYGSgACQAQLHo9oGASEefTKAWcCNPtfOmX1fxr2AUuOYhGTAwwDNPSoz7IgO3otBaoDWq35+kFKdGYD1agaC+zGuA7aMlnpkwMNm3Atw02iZybjtkdpEA2u5NrYRhEEEroNtuNVM9daxF+M624mJ/BNHnj679HEimV4ilOYHeg1j7G79sLL6+4+rX2zfvVn0mf9d4maCto/OPzX6zCvLn1944+yFN8+cgumJxwZ68d7a3s1/t/bzR99a1szm2vef3Lv9x66P8HkqdivNT7z42rv2SOr8+2+dG3jQWNBH9FX4/PaTL5x7R5uuXThpkLAls2MXv/z0A2nDOR+KigV9TmZGLxqi3KFJts/6LYGLOT01PpprDTgs5XHhs/B90oNthZHbHozrrHOmRRJLLpcbSLClUqktcm1/fZdfv3W8tUnhBvDkGIXTH87B0QWMKgFKCHDqXkScikfUHYFoozo22qqCfXds7tzMbZ0qG6ZMuGyVK3ieMQa7t+uw8XWhw0cDuOfSa4dsV+XgWPUVMZM8AodQlgpBETxWywGFLbXEpfK808cAoS22FnUAtwLiApSZxWSKOaCaXPYZHjdBtky1eE5c2xA/ZFMTAmihw0et77vFtkPXRoNxda64XwZqg2QcwUngCqxNOgJCXeDSjjoBIkQDzh1ADott4IwpwLx9rPWbzSaM8nGT5UiaFAocPIDLHKIaCOoAaQEkzhRQ51utBOyy7x7LsblLBYdWQIiaPu45OS5XyqNcI95g4wDeleoqZyynUhcwsk9UyrvpbVmKZYNxqqc6cfaTmObUbd2NJ2G8LR7INgag4USIEBUsbqa3p789A+9KdXG3cr0Ehb/uyXnWEjXaFrfOPoFUMgm1eq2lZ0ro9DnOuWKcQMJOQKV66GZbW+DMPsYlnxpzhS/mVDeBN2scXp1/D54/eRpS6ZT36w3NvlYXqvvrBjx38iTYmAIhpVwuw+bmJiwuLors0PJaWw1Ur9Gowy/rG7DBvoofOOOdqW5DEhZyz8Lri+elk0EPaFxcOzZ+BNLFo/Dy6TOwt10U/tPA+2WzWRir/QRnT70Eu//sC/CW74PZ6HgO9m4yMSVIZ6rzWFK9M4JUOM7EBCxW9qB0UArNFjtFoVI/gEqlArul+y6LAddYDag2ylCtVmHvYMfXHsdOZhNQa1Zl7DsZhz6Km0i9dDodegPlOLaZTKZzA+MxpiqWmBa92Mcubl7AMbqpVAqSQrRC30u7zqHtxMREKJBazRHBRCIRyZ4/KFXHmyEb169fB9uOsg3gcHBwAFeuXIm05240GnLfffXq1UgipWziV3UPxvF4ampKpmJYqQtVLxQKMDs7KwMWVlALdnZ2pH2YHmCQbt261cUy7wfjqn/s2DHJTFAqou3MzAzcuHED8vm8DECQPRZM7zt37kj7ra2tQHE7fvy4zIy+MG4uZ3q0sQYBweuQcXQEW6xBLKIdjqnsse9nr8b2FDfej52bNtfDUh2v60XV9RKm6ji2/lv8jMvHwG5Vx6UMlTrsJrqqj4yMhNqaqh5m763qfXhIUaqOKo2qHiW6qOpra2uRmMZHTdSOS5cuhS5LD3Q5UwPPz89L1sNSF+chqvTCwkKoquN9UNWLxaK0DxsbNQCF8L+kOo3KuKpq0MnJydA3nmg/PT0t0xxbZDPsDamyx+UyyB7HnpubawXH9LNvLyJ0p6KoNLZRHMJxFZtB9mrMvr2ICFL1fu7VUT96se+Dqvvv1bEG3UR3rFdVR+BBqq7G7p+4GW83kDkUqWvXrvW0V0eV7kXVL1++HHmvrqu78jn2VEenVlZWBu6DQhyp3vFV0dzArK+vD+SXFJ8NTNfnYS/g5h9lWJC4DXLR/GXg/UcgX8bZIwScRWWcLS0tFeR8BtgZZuACx9/Yrq6ujvoxztvX8P3l5eWK6KfVZqDeaMKQIe94t4GYhPKnday2R4rrpfrZNz8c/l8/xkdzctGt1WvypiMWdY4bTfe9EZPHI0nHt/v7pThSrGrqn8m4zvaOvofP3fttNg4CDreMYz87t83Gw/usjgWxCdZbKW8yrgo+8uC2KRXlQSZCUVu4VESW4mCcueNti3rCHLfjm7iICn4aScKjWQ4F4xmTcRWJP2NmWpVMj/blOPc2GvMtZff6L6vfP5YH5Y+7/o8V3S33Oe/7v3QYErBRgwB+czxMlIa1+IrkvwIMANKaPx47pbRTAAAAAElFTkSuQmCC")}.chartIconImg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDk0MUYxOEJDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDk0MUYxOENDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEOTQxRjE4OUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEOTQxRjE4QUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PpdyrHsAAAZISURBVHja3FpLbBtFGP5nd/1I/CCOm0AqUqRCKwQHJB6qgIioVBUnEkCV4MAhUgsHuCU8Du0hCXAAoRwAwYEeQJW4AAcCiuBSiebI4wDiIR4qEKQooYkdx3b83OGftXczO96x1/HGWXeiiXd2Znf/b77/NbNLwF0h0FuFthqguQRKmkwA8RE46nZsMyDE4Zj4UAuocEy5c+KxlHEnoIrQJi004CBAU4eqC+MID96JQUUAzVf+vJ9UXRcA81WcCCpjnAesCr+KgwYcNONOgKvCry4yrjmoNuHAqvUxmjAJfgTOg63Uq6jqVtuJcZ7tQHL01tgd4xMvBEJ9E0RRRn0dw3R9pVzcWfz568U3N1b+3JbYf4NzE0Frh44ci995cvKNM4+Mn3n0oXvhxuSAr4P32kZ69PMr3z7/iare9MuVL15av/prWuL4HD22pebH7z/9lBYMP3H2sVO+B80Kk5HJijI/ftuJU09y5tqAU2nm2EKRG6befvmcMYZS2hOVFSZzqD8+JThlm0/SJPHbAI42PTwYj1o37JWSQJlR9iEHtk2MVHNgnGed6txMshKLxXw5EdlsdtfJ7conDb+yOG4lKVQAHo1GYXZ21leg5+fnbTIKwB1Dr9YiXQVd141qlmq1avxOT0/7AvTCwgJUKhWbjNyxNMXWWsZGgXF+AlZXV10J9/HYFFS38xBAAnAa4cH3zsPhB+7qGPTIyEgNDSEyxttelvLIO7bp0rU0DOd0OEbisAFlqJRK3icvvIxeABdVXSyKorTexVBVI5sk9T92jZvrWsklazeTt2NVZ0VFQEzN3BcEjeOJQjoGLj7Xc1UXgfPHTHhXwAnnYikTunPGRZk8B65Tuaq7ZdxyqZQw1AZo1VB/74DbVJ16our2h/BAeeDr2Txm/7vjIsEgRIMB+64BqU2Cug/A7W3w3rnxKsoLf987lyDDHhgI4V1VePGe2+HC+Am7I6TMxhVPbFy0d8+dmyyBEYEHNLxV/BAukQ4DGRjAmJ3i+ond1hW1Y8ZF9rvu1W2GjA8kODFErwDRGtVZoYrh1U1V38ptwoeX37Jtkpw9PQORcKxj1e8cuN7cuYkOjBoJYi1sWf2kBoyP46wvW8zAp99chEACIDmYgNQ/OXj65HMQV9tf+/My0v1m3NlOCesw7M7st7y64dzY+VqfpgWMHQGtHxc/yTBsrxVwQrQ92X9Xw5ldQM6OERgP3BYhMJCbcVypRwRaZSzVtN3M6kr5ImTW07ZnDR4ZcpWteRTO5IxLY7jJNLFv29P6HztvVuC0gdY1gp3/6avv4KNn34UgihgO90GOFOD1lQ+6yLhOXXlJGwLirKo6YWszKs9yuHkiGBKjpA+SJAY3D90CPxR+d23jTOZ9X6Q4AlBA/kqPSE6Txi6mHVVU2yqtQLMXoPsSx+lelqWkUU4j2uFJJ8YJNMWF86gcgHMTGG+ZeFTxocUyQLCRWubYKDizQZtgJ9YOUhcTmPY3ImgNfJvgZJ2mGXR9I6KtJR+mogTjMGHpqzAOe4ytJ1VEwWxbZZcq0NiFSRBeE1b78T85WFU3c3VR5a9lcwY8SstA0+uQPTps9e2ktzFz1+A3yEBer8JRZgqGVeC98bCUwtVddQuK+RJeX3tWpVCGAi3BJl7zR/oqpLdS0sxxL6rObyWbb0WDWHGJBeGHz53//tVnJhORcMi6YGxszHfby3Nzc7C8vGy1c4UiXHj/s9Tli6/djc0C1iLb+oPdt6h626oeiURgZmbGV8ATiYQnqm57qygmMEtLS+DHIklgqMxtahK/an06QT3YXu524eTVwflDICnj+nUEXHfLuD4xMfEfO5EFSPUycMTxL/tdXFyMyxinu9fQzOTk5A4e95nJQLlShR5Dzrd2GCbM5/t4rJqDivOl8MqlL4udyjEYjxrZR6lcMh4aVJVau1JP8ahutIOhmmybmawXKlYQ/Z/IOM92yloXYImu/zjiBQHFNaEtG2eGTG94H+GxMGzIuqXyIuNm+RtrkiUxAODFPrCZb4ZdsuQF43r9fhtYj4v3tb0Tx1nJ17O267EUkfF+kXFzJv7ymGmz9Lc5Pu9lbsMxb3l2p29ZZV8s++XD3WYLWwDnD3sb+mXfpUOPgHU7CSCz8VZOqVeL1En+L8AAjJTPo0iRABoAAAAASUVORK5CYII=")}']}]}],m.ctorParameters=function(){return[{type:u}]};function f(e,t,i,n){return new(i||(i=Promise))((function(a,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}function g(e,t){var i,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(a=2&r[0]?n.return:r[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,r[1])).done)return a;switch(n=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){o.label=r[1];break}if(6===r[0]&&o.label<a[1]){o.label=a[1],a=r;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(r);break}a[2]&&o.ops.pop(),o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e],n=0}finally{i=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function v(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,a,r=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(a)throw a.error}}return o}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}Object.create;var y=function(){function e(e){this.pdService=e,this.totalUsers=0,this.eligibleUsers=0,this.currentUsers=0,this.myChartType=n.ChartType.Timeline,this.myChartwidth=.88*window.innerWidth,this.myChartHeight=window.innerHeight,this.currentList="Current Users",this.allList="All Users",this.isAllUsers=!1,this.isUserWise=!1,this.isSubscribed=!1,this.useCustomTimeline=!0,this.isTableView=!1,this.timelineRows=[],this.timelineList=[],this.myChartDataMatrix=new Array,this.totalChartDataMatrix=new Array}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadChart(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.loadChart=function(e){var t=this;this.totalUsers=0,this.eligibleUsers=0,this.currentUsers=0,this.myChartType=n.ChartType.Timeline,this.myChartwidth=.88*window.innerWidth,this.myChartHeight=window.innerHeight,this.currentList="Current Users",this.allList="All Users",this.isAllUsers=!1,this.pdService.isAllUsers.next(!1),this.isUserWise=!1,this.myChartDataMatrix=[],this.totalChartDataMatrix=[],this.chartview=document.getElementById("pd-chartview"),this.myDataList=document.getElementById("pd-xmlData"),e&&(this.myXmlData=JSON.parse(e)),this.myXmlData&&(this.currentdataList=this.pdService.genarateUserReqiuredData(this.myXmlData),this.alluserList=this.pdService.allUserChartData(),this.allRoomsList=this.pdService.allRoomsData(),this.resourceDataList=this.pdService.genarateResourseReqiuredData(this.myXmlData),this.totalUsers=this.currentdataList.usersMetadata.length,this.eligibleUsers=this.findEligibleUserCount(),this.installedClassrooms=this.findInstalledClassrooms(),this.currentRooms=this.findCurrentClassrooms(),this.findCurrentUserCount()),this.isSubscribed?this.updateDataType(this.pdService.isUserWise_data.value):(this.isSubscribed=!0,this.pdService.chartType.subscribe((function(e){e&&t.updateChartType(e)})),this.pdService.isUserWise_data.subscribe((function(e){t.updateDataType(e)})),this.pdService.isInsightsView.subscribe((function(e){e||setTimeout((function(){return t.fitChartHeight()}))})),window.addEventListener("resize",this.onResizeWindow.bind(this)))},e.prototype.onResizeWindow=function(e){this.myChartwidth=.88*window.innerWidth,this.fitChartHeight()},e.prototype.fitChartHeight=function(){var e=document.getElementById("pd-chartview");if(e&&"none"!==e.style.display){var t=e.getBoundingClientRect().top+window.scrollY,i=Math.max(window.innerHeight-t-8,240);e.style.height=i+"px"}},e.prototype.myChartReady=function(){this.createDivforTotalDurartion(),this.setHeightofDivforTotalDurartion()},e.prototype.updateChartType=function(e){var t=this;this.isTableView=e==n.ChartType.Table,null!=this.chartview&&null!=this.chartview&&(e==n.ChartType.Table?this.chartview.style.display="none":(this.chartview.style.display="block",setTimeout((function(){return t.fitChartHeight()}))))},e.prototype.updateDataType=function(e){var t=this;setTimeout((function(){return t.fitChartHeight()})),this.isUserWise=e,this.myXmlData&&(this.isUserWise?(this.currentList="Current Users",this.allList="All Users",this.isAllUsers?this.userWiseAllData():this.userWiseCurrentData()):(this.allList="All Rooms",this.currentList="Current Rooms",this.isAllUsers?this.classRoomWiseAllData():this.classRoomWiseCurrentData()))},e.prototype.updateChart=function(){for(var e=this,t=document.getElementById("labels");t&&t.firstChild;)t.removeChild(t.lastChild);this.chartDataTable=this.myChartDataMatrix,this.myChartOptions={tooltip:{trigger:"none"},colors:["#ff7f0e","#2ca02c","#8c564b","#d62728","#bcbd22","#17becf"],timeline:{colorByRowLabel:!0,barLabelStyle:{fontSize:7}},hAxis:{format:"HH:mm a"}},setTimeout((function(){e.myChartHeight=e.AllrowHeight+100}),1e3)},e.prototype.filterUserHasDash=function(e){var t=this.myChartDataMatrix,i=this.currentdataList.userConsoleData;return{updatedChartData:t.filter((function(e){return"-"!==e[0]})),updatedRightData:i.filter((function(e){return"-"!==e.userName}))}},e.prototype.calulateTotalDuration=function(e){var t,i=new Array;if(i=[],this.totalChartDataMatrix=[],this.isUserWise)for(var n=0;n<e.length;n++)t={name:e[n].userName,value:parseInt(e[n].duration)},i.push(t);else for(n=0;n<e.length;n++)t={name:this.pdService.getRoomLabel(e[n].terminalLocation,e[n].terminalIP),value:parseInt(e[n].duration)},i.push(t);var a={};(i=b(new Set(i))).forEach((function(e){a[e.name]?a[e.name].value=a[e.name].value+e.value:a[e.name]=e}));var r=Object.values(a),o=new Array;o=[],r.forEach((function(e){o.push(e.value)}));for(n=0;n<o.length;n++){var s=[this.timeConvert(o[n]).toString()+" hrs"];this.totalChartDataMatrix.push(s)}},e.prototype.timeConvert=function(e){var t=Math.floor(e)/60,i=Math.floor(t),n=60*(t-i);return i+":"+Math.round(n)},e.prototype.removeBlankEntryBar=function(){for(var e=document.getElementById("myTimeLine").getElementsByTagName("rect"),t=1e8,i=[],n=0;n<e.length;n++){var a=parseInt(e[n].getAttribute("width"));a<t?(i=[e[n]],t=a):a==t&&i.push(e[n])}for(n=0;n<i.length;n++)i[n].setAttribute("fill","none")},e.prototype.createDivforTotalDurartion=function(){var e=[];this.rowElements=[];var t=document.getElementById("labels");if(t){for(;t.firstChild;)t.removeChild(t.lastChild);for(var i=0;i<this.totalChartDataMatrix.length;i++){var n=this.totalChartDataMatrix[i][0];e.push(n);var a=t.appendChild(document.createElement("div"));a.style["border-bottom"]="1px solid #b7b7b7",a.style["font-family"]="Arial",a.style["font-size"]="13px",a.style["text-align"]="left",a.style["padding-left"]="8px",a.style["padding-right"]="8px",a.style.position="inherit",a.style["background-color"]=i%2?"#e6e6e6":"#ffffff",a.innerHTML=n,this.rowElements.push(a)}}},e.prototype.setHeightofDivforTotalDurartion=function(){this.AllrowHeight=0;for(var e=document.getElementById("myTimeLine").getElementsByTagName("rect"),t=-1,i=0;i<e.length;i++)if(++t<this.rowElements.length){var n=parseFloat(e[i].getAttribute("height"))+"px";this.AllrowHeight+=parseFloat(e[i].getAttribute("height"));var a=this.rowElements[t];a&&(a.style.height=n,a.style.lineHeight=n)}},e.prototype.buildTimeline=function(e){var t=this;this.timelineList=e||[];var i=[],n={};this.timelineList.forEach((function(e,a){var r=t.isUserWise?e.userName:t.pdService.getRoomLabel(e.terminalLocation,e.terminalIP);if(null!=r&&""!==r&&"--"!==r){"-"===r&&(r="Unknown user");var o=n[r];if(o||(o=n[r]={label:r,bars:[]},i.push(o)),t.isSession(e)){var s=t.isUserWise?t.pdService.getRoomLabel(e.terminalLocation,e.terminalIP):e.userName,l=e.startTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})+" – "+e.endTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});o.bars.push({start:e.startTime,end:e.endTime,index:a,tooltip:((s||"")+"\n"+l).trim()})}}})),this.timelineRows=i},e.prototype.isSession=function(e){return!!e&&!!e.userId&&e.startTime instanceof Date&&!isNaN(e.startTime.getTime())&&e.endTime instanceof Date&&!isNaN(e.endTime.getTime())},e.prototype.openRow=function(e){var t=this,i=e.indexes.map((function(e){return t.timelineList[e]})).filter((function(e){return t.isSession(e)})).map((function(e){return{userId:e.userId,ip:e.terminalIP,start:e.startTime.getTime()}}));i.length&&(this.pdService.detailAccentColor=e.color,this.pdService.detailRowRequest={label:e.label,isUserWise:this.isUserWise,total:e.total,sessions:i},this.pdService.openSmallTable.next({allSessions:!0}))},e.prototype.openSession=function(e){var t=e.index,i=this.timelineList[t];this.isSession(i)&&(this.pdService.detailAccentColor=e.color,this.pdService.detailRowRequest=null,this.selectedUserData=this.pdService.dataForDetailedView(this.timelineList,this.resourceDataList,t),this.pdService.detailedviewData.next(this.selectedUserData),this.pdService.openSmallTable.next(this.selectedUserData))},e.prototype.onSelectRowData=function(e){var t=e.selection[0],i=t.row,n=(t.column,this.currentdataList.userConsoleData);if(this.isAllUsers&&(n=this.isUserWise?this.alluserList.fordurationTable:this.allRoomsList.fordurationTable),n[i]&&n[i].userId&&n[i].startTime){this.selectedUserData=this.pdService.dataForDetailedView(n,this.resourceDataList,i);this.currentdataList;this.pdService.detailedviewData.next(this.selectedUserData),this.updateChart(),this.pdService.openSmallTable.next(this.selectedUserData)}},e.prototype.showAllUser=function(){this.pdService.isAllUsers.next(!0),this.isAllUsers=!0,this.isUserWise?this.userWiseAllData():this.classRoomWiseAllData()},e.prototype.showCurrentUser=function(){this.isAllUsers=!1,this.pdService.isAllUsers.next(!1),this.isUserWise?this.userWiseCurrentData():this.classRoomWiseCurrentData()},e.prototype.userWiseCurrentData=function(){var e=this.pdService.userWiseChartData();this.buildTimeline(this.currentdataList.userConsoleData),e.length>0&&(this.myChartDataMatrix=e,this.updateChart(),this.currentdataList.userConsoleData.length>0&&this.calulateTotalDuration(this.currentdataList.userConsoleData))},e.prototype.userWiseAllData=function(){this.buildTimeline(this.alluserList.fordurationTable);var e=this.alluserList.forChartData;e.length>0&&(this.myChartDataMatrix=e,this.updateChart(),this.calulateTotalDuration(this.alluserList.fordurationTable))},e.prototype.classRoomWiseCurrentData=function(){var e=this.pdService.classRoomWiseChartData();this.buildTimeline(this.currentdataList.userConsoleData),console.log("classRoomdata",e),e&&e.length>0&&(this.myChartDataMatrix=e,console.log("myChartDataMatrix",this.myChartDataMatrix),this.updateChart(),this.currentdataList.userConsoleData.length>0&&this.calulateTotalDuration(this.currentdataList.userConsoleData))},e.prototype.classRoomWiseAllData=function(){var e=this.allRoomsList||this.pdService.allRoomsData();this.buildTimeline(e.fordurationTable),e.forChartData&&e.forChartData.length>0&&(this.myChartDataMatrix=e.forChartData,this.updateChart()),e.fordurationTable&&e.fordurationTable.length>0&&this.calulateTotalDuration(e.fordurationTable)},e.prototype.findCurrentUserCount=function(){for(var e=this.currentdataList.userConsoleData,t=new Array,i=0;i<e.length;i++){var n=e[i].userName;t.push(n)}var a=b(new Set(t));this.currentUsers=a.length},e.prototype.findCurrentClassrooms=function(){return this.pdService.newGetCurrentClassroomData().length},e.prototype.findInstalledClassrooms=function(){return this.currentdataList.schoolTerminalData.length},e.prototype.findEligibleUserCount=function(){for(var e=0,t=this.currentdataList.usersMetadata,i=0;i<t.length;i++){""!==t[i].userSubjects&&(e+=1)}return e},e.prototype.ngOnDestroy=function(){},e}();y.decorators=[{type:t.Component,args:[{selector:"lib-chartview",template:'<div id="pd-chartview-main-container" class="pd-chartview-main-container">\n <div id="userSummary">\n <table class="summaryTable">\n <tbody>\n <tr>\n <td id="totalUsers" class="chartview-navigationbar">\n Total users: {{totalUsers}}\n </td>\n <td id="eligibleUsers" class="chartview-navigationbar">\n Eligible users: {{eligibleUsers}}\n </td>\n <td id="currentUsers" class="chartview-navigationbar">\n Current users: {{currentUsers}}\n </td>\n <td id="totalRooms" class="chartview-navigationbar">\n Installed Classrooms: {{installedClassrooms}}\n </td>\n <td id="currentRooms" class="chartview-navigationbar">\n Current Classrooms: {{currentRooms}}\n </td>\n \x3c!-- <td\n id="currentRooms"\n \n >\n <span id="totalUsers_list" class="activeAll">User List</span>\n </td> --\x3e\n </tr>\n </tbody>\n </table>\n </div>\n <div id="pd-messageDivContainer" class=\'pd-messageDivContainer\'>\n <div id="pd-messageDiv" class=\'pd-messageDiv\' *ngIf="!isTableView">Click the bars to view details of content accessed by a teacher.</div>\n <div id="pd-toggleContainer" class="pd-toggleContainer">\n \n <div id="pd-currentUserBtn" class="pd-currentUserBtn-div pd-commonStyleBtn" (click)="showCurrentUser()" [ngStyle]="{ color: isAllUsers ? \'#000000\' : \'#ffffff\' , backgroundColor: isAllUsers ? \'#c4c4c4\' : \'#000000\'}">\n {{currentList}}</div>\n <div id="pd-allUserBtn" class="pd-allUserBtn-div pd-commonStyleBtn" (click)="showAllUser()" [ngStyle]="{ color: isAllUsers ? \'#ffffff\' : \'#000000\' , backgroundColor: isAllUsers ? \'#000000\' : \'#c4c4c4\'}">\n {{allList}}</div>\n </div>\n </div>\n <div id="pd-chartview" class="pd-chartview">\n <lib-timeline\n *ngIf="useCustomTimeline"\n [rows]="timelineRows"\n [labelTitle]="isUserWise ? \'Teacher\' : \'Room\'"\n (barClick)="openSession($event)"\n (totalClick)="openRow($event)"\n ></lib-timeline>\n <div id="myChartDiv" *ngIf="!useCustomTimeline">\n <div id="myTimeLine">\n <google-chart\n [type]="myChartType"\n [data]="chartDataTable"\n [options]="myChartOptions"\n [width]="myChartwidth"\n [height]="myChartHeight"\n (select)="onSelectRowData($event)"\n (ready)="myChartReady()"\n > \n </google-chart>\n \n </div>\n <div class="inline babloo" id="labels"></div> \n \n \n </div>\n</div>\n',styles:[".pd-chartview-main-container .pd-chartview{display:block;overflow:scroll;width:100%;height:484px;font-family:Tahoma;font-size:12pt;font-weight:400;color:#666;margin:10 auto;text-align:center;padding-top:1px}.pd-chartview-main-container #userSummary{background:#e0e0e0;margin-top:1px}.pd-chartview-main-container #roomSummary,.pd-chartview-main-container #userSummary{position:relative;width:100%;text-align:center;padding-top:6px;padding-bottom:6px;font-size:13px}.pd-chartview-main-container .pd-messageDivContainer{margin-top:1px;position:relative;display:flex;align-items:center;justify-content:center;min-height:40px;padding:0 200px;box-sizing:border-box}.pd-chartview-main-container .pd-messageDivContainer .pd-messageDiv{font-size:13px;text-align:center}.pd-chartview-main-container .pd-messageDivContainer .pd-toggleContainer{line-height:30px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:absolute;right:0;top:50%;transform:translateY(-50%)}.pd-chartview-main-container .pd-messageDivContainer .pd-allUserBtn-div{border-radius:0 5px 5px 0}.pd-chartview-main-container .pd-messageDivContainer .pd-currentUserBtn-div{border-radius:5px 0 0 5px}.pd-chartview-main-container .pd-messageDivContainer .pd-commonStyleBtn{display:inline-block;cursor:pointer;font-size:12px;width:92px;text-align:center}.pd-chartview-main-container .summaryTable{width:100%;border-collapse:collapse;border-spacing:2px;border-color:grey}.pd-chartview-main-container .activeAll{cursor:pointer;background:none!important;border-radius:13px;border:none;width:64px;height:18px!important;line-height:18px!important;color:#45a1da;margin-right:0!important;padding:1px 5px;vertical-align:sub}.pd-chartview-main-container #myTimeLine{width:89%;height:60%;margin-left:5px;overflow-x:scroll;overflow-y:hidden;float:left}.pd-chartview-main-container #myTimeLine2{width:71px;position:relative;overflow-x:hidden;overflow-y:hidden}.pd-chartview-main-container #myChartDiv{width:100%}.pd-chartview-main-container .chartview-navigationbar{border-collapse:collapse;border-right:1px solid #999;text-align:center}.pd-chartview-main-container #labels{border-right:1px solid #b7b7b7;border-top:1px solid #b7b7b7;width:10%;float:left;font-size:1.2vw;overflow-x:hidden;overflow-y:hidden}.inline{vertical-align:top;position:relative}"]}]}],y.ctorParameters=function(){return[{type:u}]},y.propDecorators={data:[{type:t.Input}]};var x=function(){function e(e){this.pdService=e,this.userMetadataHeadingArray=["Name:","Start Time:","Subject:","End Time:","Room Details:"],this.resourseMetadataHeadingArray=["Subject","Class","Chapter Name","Topic Name","Assets Details"]}return e.prototype.ngOnInit=function(){var e=this;this.deatilViewContainer=document.getElementById("pd-deatilViewContainer"),this.deatilViewTable=document.getElementById("pd-deatilViewTable"),this.closeButton=document.getElementById("pd-closeButton"),this.pdService.detailedviewData.subscribe((function(t){t&&(t.userDetails.length>0&&e.createTable(t.userDetails),t.resourceDetails.length>0&&(t.resourceDetails=e.replaceLabelChapterAndTopic(t.resourceDetails),e.createResourcesTable(t.resourceDetails)))})),this.deatilViewContainer.style.display="none"},e.prototype.replaceLabelChapterAndTopic=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";return e.map((function(e){return e.map((function(e){return e.includes("Topic:")?e.replace(/Topic: .*/,"Topic "+t):e.includes("Chapter:")?e.replace(/Chapter: .*/,"Chapter "+t):e}))}))},e.prototype.replaceLabelChapterAndTopic1=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(selected)</span>";return e.map((function(e){return e.map((function(e){return e.includes("Topic: :")?e.replace(/Topic: :.*$/,"Topic "+t):e.includes("Chapter:")?e.replace(/Chapter: .*$/,"Chapter "+t):e}))}))},e.prototype.createTable=function(e){for(this.deatilViewContainer.style.display="block";this.deatilViewTable.firstChild;)this.deatilViewTable.removeChild(this.deatilViewTable.lastChild);for(var t=new Array,i=0,n=0;n<e.length;n++){var a=document.createElement("label");a.appendChild(document.createTextNode(this.userMetadataHeadingArray[n])),"undefined"!==a.textContent&&void 0!==a.textContent||(a.textContent=""),t.push(a);var r=document.createElement("label");r.appendChild(document.createTextNode(e[n])),"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}var o=document.createElement("table");o.id="userDataTable",o.className="table table-bordered";for(var s=document.createElement("tbody"),l=0;l<e.length/2;l++){var d=document.createElement("tr"),c=void 0;for(n=0;n<4;n++)n%2==0?(c=document.createElement("th")).style["font-weight"]="bold":c=document.createElement("td"),i<t.length&&(c.appendChild(t[i]),d.appendChild(c)),i++;s.appendChild(d),o.appendChild(s),this.deatilViewTable.appendChild(o)}},e.prototype.createResourcesTable=function(e){for(var t=new Array,i=0,n=0;n<this.resourseMetadataHeadingArray.length;n++){(r=document.createElement("label")).appendChild(document.createTextNode(this.resourseMetadataHeadingArray[n])),"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}for(n=0;n<e.length;n++)for(var a=0;a<5;a++){var r;(r=document.createElement("label")).innerHTML=e[n][a],"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}var o=document.createElement("table");o.className="table table-bordered",o.id="resoureMetadataTable";var s=document.createElement("tbody");for(a=0;a<=e.length;a++){var l=document.createElement("tr"),d=void 0;for(n=0;n<5;n++)0==a?(d=document.createElement("th")).style["font-weight"]="bold":d=document.createElement("td"),i<t.length&&(d.appendChild(t[i]),l.appendChild(d)),i++;s.appendChild(l),o.appendChild(s),this.deatilViewTable.appendChild(o)}},e.prototype.onCloseBtnClick=function(){this.deatilViewContainer.style.display="none"},e}();x.decorators=[{type:t.Component,args:[{selector:"lib-detailedview",template:'<div id="pd-deatilViewContainer">\n <div class="pd-detailview-header">\n <div class="pd-detailview-title">Details</div>\n <div id="pd-closeButton" (click)="onCloseBtnClick()">+</div>\n </div>\n <div id="pd-deatilViewTable"></div>\n</div>\n',styles:["#pd-deatilViewContainer{position:absolute;background:#fff;box-shadow:0 0 17px #818181;font-size:12px;width:50%;max-height:350px;top:140px;left:230px}#pd-deatilViewContainer .pd-detailview-header{position:relative;width:100%;height:35px;background-color:#e6e6e6}#pd-deatilViewContainer .pd-detailview-title{position:absolute;margin-left:5px;font-size:20px;line-height:35px}#pd-deatilViewContainer #pd-closeButton{width:24px;position:absolute;float:right;right:0;cursor:pointer;height:24px;background:#000;border-radius:12px;color:#fff;line-height:22px;text-align:center;font-size:26px;transform:rotate(45deg);margin:5px}#pd-deatilViewContainer #pd-deatilViewTable{overflow:scroll;scroll-behavior:smooth;height:auto;margin:5px;max-height:300px}"]}]}],x.ctorParameters=function(){return[{type:u}]};var w=function(){function e(){this.resourceTypes=new Array,this.tabName=[{name:"School"},{name:"User Summary"},{name:"Terminal Summary"},{name:"Usage Details"}]}return e.prototype.exportAsExcelFile=function(e,t){for(var i,n={Sheets:{},SheetNames:[]},a=0;a<e.length;a++){var o=r.utils.json_to_sheet(e[a]);n.Sheets[this.tabName[a].name]=o,n.SheetNames.push(this.tabName[a].name)}var s=n;i=r.write(s,{bookType:"xlsx",type:"array"}),this.saveAsExcelFile(i,t)},e.prototype.saveAsExcelFile=function(e,t){var i=new Blob([e],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});a.saveAs(i,t+".xlsx")},e.prototype.genarateResourseReqiuredData_Excel=function(e){var t,i=new Array,n=e.resourcesMetadata.resourceMetadata;if(null!=n&&n.length>0)for(var a=0;a<n.length;a++){var r={resouseID:n[a].resourceId,subject:null!=n[a].subject&&null!=n[a].subject.title?n[a].subject.title:"",grade:null!=n[a].grade&&null!=n[a].grade.title?n[a].grade.title:"",chapter:null!=n[a].chapter&&null!=n[a].chapter.title?n[a].chapter.title:"",teachingpoint:null!=n[a].teachingpoint&&null!=n[a].teachingpoint.title?n[a].teachingpoint.title:"",type:t=null!=n[a].type?this.getDisplaytypeValue(n[a].type):"",title:null!=n[a].title?n[a].title:""};i.push(r),this.resourceTypes.push(t)}return this.resourceTypes=b(new Set(this.resourceTypes)),i},e.prototype.getName=function(e){return/School Admin/gm.exec(e.role)?"Support Admin":e.fullName},e.prototype.genarateUserReqiuredData_Excel=function(e){var t=e.usersConsole.userConsole,i=e.usersMetadata.userMetadata,n=e.schoolTerminals.schoolTerminal,a=new Array,r=new Array,o=new Array,s=new Array;if(null!=i&&i.length>0)for(var l=0;l<i.length;l++){var d={};""!=i[l].userId&&(d={userId:i[l].userId,userName:void 0!==i[l].fullName?this.getName(i[l]):"",userSubjects:void 0!==i[l].userSubjects?i[l].userSubjects:""},a.push(d))}for(var c=0;c<a.length;c++)a.forEach((function(e){a[c].userName===e.userName&&(r.push(a[c]),a.splice(c,1))}));for(c=0;c<r.length;c++)r[c].userName=r[c].userName+" "+c,a.push(r[c]);if(null!=n&&n.length>0)for(c=0;c<n.length;c++){var p;p={schoolId:void 0!==n[c].schoolId?n[c].schoolId:"",terminalKey:void 0!==n[c].terminalKey?n[c].terminalKey:"",terminalType:void 0!==n[c].terminalType?n[c].terminalType:"",location:void 0!==n[c].metadata?n[c].metadata:""},o.push(p)}if(null!=t&&t.length>0)for(var u=function(e){var i=void 0,n=void 0,r=void 0,l=void 0,d=void 0,c=void 0,p=[],u=[],m=void 0,f=void 0,g=void 0;i=void 0!==t[e].userId?t[e].userId:"",n=void 0!==t[e].startTime?t[e].startTime:"",void 0!==t[e].endTime?(r=t[e].endTime,h.myEndTime=r):r="",void 0!==t[e].selectedDate&&t[e].selectedDate,l=void 0!==t[e].duration?t[e].duration:"",d=void 0!==t[e].terminalIP?t[e].terminalIP:"",null!=(c=void 0!==t[e].userConsoleResources?t[e].userConsoleResources:null)&&(void 0!==c.userConsoleResource?c.userConsoleResource.forEach((function(e){p.push(e.resourceId),u.push(e.duration)})):(p=[],u=[]));for(var v=0;v<a.length;v++)i===a[v].userId&&(m=a[v].userName,f=a[v].userSubjects);for(var b=0;b<o.length;b++)d===o[b].terminalKey&&(g=o[b].location);var y={userId:i,userName:m,startTime:new Date(n),endTime:new Date(r),terminalIP:d,resourceMetauserConsoleData:p,duration:l,terminalLocation:g,userSubjects:f,resourceDurationFromConsole:u};s.push(y)},h=this,m=0;m<t.length;m++)u(m);return{usersMetadata:a,schoolTerminalData:o,userConsoleData:s}},e.prototype.deatilData_Excel=function(e,t){var i,n=new Array;n=[];for(var a=0;a<e.length;a++){var r,o,s,l,d,c=void 0,p=void 0,u=void 0,h=void 0,m=void 0,f=new Array;r=e[a].userId,m=e[a].userSubjects,h=e[a].userName,null!=e[a].startTime&&""!=e[a].startTime&&null!=e[a].endTime&&""!=e[a].endTime&&(c=e[a].startTime.toLocaleTimeString("en-US",{hour12:!0}),p=e[a].endTime.toLocaleTimeString("en-US",{hour12:!0}),i=e[a].startTime.getDate()+"/"+(e[a].startTime.getMonth()+1)+"/"+e[a].startTime.getFullYear()),u=Math.floor(e[a].duration);s=e[a].terminalLocation,o=e[a].terminalIP;var g=s,v=o;if(l=e[a].resourceMetauserConsoleData,d=e[a].resourceDurationFromConsole,0==l.length)f=[h,m,i,c,p,u,g,v,"","","","","","",r],n.push(f);else for(var b=0;b<l.length;b++)for(var y=0;y<t.length;y++)l[b]===t[y].resouseID&&(f=[h,m,i,c,p,u,g,v,t[y].subject,t[y].grade,t[y].chapter,t[y].teachingpoint,t[y].title,this.getDisplaytypeValue(t[y].type),r,d[b]],n.push(f),h="",m="",i="",c="",p="",g="",v="",u="")}return n},e.prototype.deatilUsage_Excel=function(e){var t=[];if(e.length>0)for(var i=0;i<e.length;i++){var n={Name:e[i][0],Subjects:e[i][1],Date:e[i][2],startTime:e[i][3],endTime:e[i][4],"duration(mins)":e[i][5],location:e[i][6],IP:e[i][7],subjectTitle:e[i][8],gradeTitle:e[i][9],Chapter:e[i][10],tpTitle:e[i][11],resourceTitle:e[i][12],resourceType:e[i][13],"resourceDuration(sec)":e[i][15]};t.push(n)}return t},e.prototype.userSummary_Excel=function(e,t){for(var i=e.usersMetadata.userMetadata,n=new Array,a=new Array,r=new Array,o=new Array,s=new Array,l=new Array,d=new Array,c=0,p=0;p<i.length;p++){n=[],a=[],o=[],s=[],l=[],d=[],c=0;for(var u=0;u<t.length;u++)i[p].userId===t[u][14]&&(""!=t[u][12]&&n.push(t[u][12]),""!=t[u][13]&&a.push(t[u][13]),""!=t[u][5]&&(c+=t[u][5]),o.push(t[u][6]),s.push(t[u][2]),l.push(t[u][9]),d.push(t[u][8]));var h=void 0,m=void 0,f=void 0,g=void 0,v=void 0;h=o.length>0?b(new Set(o))[0]:"",v=s.length>0?b(new Set(s)).length:"",m=s.length>0?b(new Set(s))[0]:"",f=l.length>0?b(new Set(l))[0]:"",g=d.length>0?b(new Set(d))[0]:"";var y={Name:this.getName(i[p]),Subjects:i[p].userSubjects,duration:c,ClassRooms:h,DatesAccess:m,DayAccess:v,Grades:f,SubjectTought:g,AseestUsed:n,AssetType:a};r.push(y)}var x=new Array,w=function(e){var t=[],i=r[e].AssetType;i=b(new Set(i)),r[e].AssetType.forEach((function(e){t[e]=(t[e]||0)+1})),D.resourceTypes.filter((function(e){return!i.includes(e)})).forEach((function(e){t[e]=0}));var n={Name:r[e].Name,Subjects_taught:r[e].Subjects," Duration(mins)":r[e].duration,ClassRooms:r[e].ClassRooms,DaysAccsessed:r[e].DayAccess,DatesAccess:r[e].DatesAccess,Grades:r[e].Grades,Subjects:r[e].SubjectTought},a=Object.assign(n,t);x.push(a)},D=this;for(p=0;p<r.length;p++)w(p);return x},e.prototype.getDisplaytypeValue=function(e){var t=e;return[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"}].forEach((function(i){i.type===e&&(t=i.display)})),t},e}();w.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new w},token:w,providedIn:"root"}),w.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[]};var D=function(){function e(e,i){this.excelService=e,this.pdService=i,this.userSelectedDate=new t.EventEmitter,this.refreshTimer=0,this.title="datepicker",this.date=new Date,this.options={inputClass:"input",calendarClass:"datepicker-default",scrollBarColor:"#010001",format:"dd/LL/yyyy",maxDate:new Date}}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadData(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){this.urlParams=new URLSearchParams(window.location.search),this.isDemo="1"===this.urlParams.get("demo"),this.getDefaultDate(),this.startTimer()},e.prototype.getDefaultDate=function(){var e=this.isDemo?new Date("2025-05-21T00:00:00"):new Date;this.getDateFormat(e),this.todayDate=this.calenderCurrentDate,console.log("this.isDemo",this.isDemo),this.isDemo&&(this.mydata=null,this.refreshChart(),this.pdService.openSmallTable.next(!1))},e.prototype.dateSelected=function(e){var t=this.isDemo?new Date("2025-05-21T00:00:00"):new Date(e);console.log("Selected Date:",t),this.getDateFormat(t),this.mydata=null,this.refreshChart(),this.pdService.openSmallTable.next(!1)},e.prototype.getDateFormat=function(e){var t,i=e.getDate(),n=e.getMonth()+1;t=n<10?"0"+n:n;var a=e.getFullYear()+"-"+t+"-"+(i<10?"0"+i:i);this.currentDate=a,this.calenderCurrentDate=a.split("-").reverse().join("-")},e.prototype.refreshChart=function(){this.stopTimer(),this.refreshTimer=0,this.calenderCurrentDate===this.todayDate&&this.countDown(),this.userSelectedDate.emit(this.calenderCurrentDate)},e.prototype.startTimer=function(){this.countDown()},e.prototype.stopTimer=function(){this.clearTimer(),this.message=""},e.prototype.clearTimer=function(){this.refreshTimer=0,window.clearInterval(this.intervalId)},e.prototype.countDown=function(){var e=this;this.clearTimer(),this.intervalId=window.setInterval((function(){e.refreshTimer-=1,0===e.refreshTimer?(e.refreshChart(),e.message=""):(e.refreshTimer<0&&(e.refreshTimer=300),e.message=""+e.refreshTimer)}),1e3)},e.prototype.timeConvert=function(e){var t=e/60,i=Math.floor(t),n=60*(t-i);return i+":"+Math.round(n)},e.prototype.loadData=function(e){if(e&&(this.mydata=JSON.parse(e),this.mydata)){var t=this.excelService.genarateUserReqiuredData_Excel(this.mydata).userConsoleData,i=this.excelService.genarateResourseReqiuredData_Excel(this.mydata),n=this.excelService.deatilData_Excel(t,i),a=this.excelService.deatilUsage_Excel(n),r=this.excelService.userSummary_Excel(this.mydata,n),o=this.mydata.schoolMetadata.school,s=a,l=this.mydata.schoolTerminals.schoolTerminal;this.dataList=[[o],r,l,s]}},e.prototype.exportReport=function(){this.mydata&&this.excelService.exportAsExcelFile(this.dataList,"UsageReport-"+this.calenderCurrentDate)},e.prototype.ngOnDestroy=function(){this.clearTimer()},e}();D.decorators=[{type:t.Component,args:[{selector:"lib-header",template:'<div id="pd_header" class="pd_header">\n \n <div *ngIf="message && mydata && (this.todayDate === this.calenderCurrentDate)" id="pd_refeshView" class="pd_refesh_bar">\n <div class="timer_msg"> This page will be refreshed in</div>\n <div class="timer_value"> {{timeConvert(message)}} min</div>\n <div id="pd_refeshBtn" (click)="refreshChart()"> Refresh </div>\n </div>\n\n <div id="pd_exportBtn" class="pd_exportButton" *ngIf="mydata"\n [ngClass]="{\'pd_exportButton_shiftRight\': this.todayDate != this.calenderCurrentDate}" (click)="exportReport()"> \n <span class="pd_exportButton_text">Download Report</span>\n <div class="pd_download_icon"></div>\n </div>\n \n <div class="pd_header_calendar">\n \x3c!-- <input type="Date" [max]="currentDate" [value]="currentDate" id="myCalendar" (input)="selectDate($event)" /> --\x3e\n <ngx-datepicker [(ngModel)]="date" [options]="options" (ngModelChange)="dateSelected($event)"></ngx-datepicker>\n </div>\n <div class="pd_header_content" >Realtime usage data</div>\n</div>\n',styles:['.pd_header{width:100%;background-color:#e0e0e0;height:50px;border-bottom:2px solid #fff}.pd_header_calendar{position:absolute;width:150px;margin:5px 5px 5px 17px}.pd_header_content{position:relative;width:350px;margin:0 auto;color:#000;text-align:center;font-size:30px;line-height:50px;pointer-events:none}.pd_exportButton{position:absolute;display:inline-block;right:144px;padding:0 16px;cursor:pointer;margin:9px 0 0;height:30px;width:160px;line-height:30px;background-color:#4285f9;font-size:10pt;font-weight:400;transition:right .5s;border-radius:5px;color:#fff;font-weight:700}.pd_exportButton_shiftRight{right:10px}.pd_download_icon{position:absolute;width:16px;height:16px;background-size:100% 100%;top:8px;background-repeat:no-repeat;display:inline-block;right:5px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAY0lEQVRIiWNgGOqAkQS1/8nRy0SCBWSBUQtGLRjiFpQzQDIXDKMDZLl6ch2Abgk2TLbhxFhCseH4LKGa4dgsIdpwZhIsOMoAKUEPMjAwNJLktFGADyDXStgyE8Vm07yoGPoAAH1UItbw1O5lAAAAAElFTkSuQmCC")}.pd_exportButton_text{position:relative;display:inline-block;width:130px}.pd_refesh_bar{position:absolute;color:#000;width:120px;height:78px;right:15px;top:4px;z-index:2;background-color:#fff;float:right;text-align:center;font-size:12px;border-radius:.25rem;border:1px solid #a09898;box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-animation:refreshViewAnimate .6s;animation:refreshViewAnimate .6s}@-webkit-keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}@keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}.timer_msg{position:absolute;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:14px;top:2px}.timer_value{font-weight:700;font-size:15px}#pd_refeshBtn,.timer_value{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;top:28px}#pd_refeshBtn{background-color:#2172f6;cursor:pointer;width:60px;margin:0 auto;border-radius:3px;color:#fff;height:22px;line-height:20px}#pd_refeshBtn:hover{opacity:.6}::ng-deep.bs-datepicker{margin-left:200px}.bs-datepicker-body table td span.selected,.theme-default .bs-datepicker-body table td.selected span,.theme-default .bs-datepicker-body table td[class*=select-] span:after,.theme-default .bs-datepicker-body table td span[class*=select-]:after{background-color:#000}.bs-datepicker-head{background-color:#000!important}']}]}],D.ctorParameters=function(){return[{type:w},{type:u}]},D.propDecorators={data:[{type:t.Input}],userSelectedDate:[{type:t.Output}]};var T=function(){function e(e){this.pdService=e,this.myChartType=n.ChartType.Table,this.isUserWise=!0}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadTable(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.loadTable=function(e){var t=this;if(console.log("mresponse: ",e),e&&(this.myXmlData=JSON.parse(e),this.myXmlData)){var i=this.pdService.genarateUserReqiuredData(this.myXmlData);this.currentdataList=i.userConsoleData;var n=this.pdService.allUserChartData();this.alluserList=n.fordurationTable,this.currentResoursedataList=this.pdService.genarateResourseReqiuredData(this.myXmlData)}this.tableViewDiv=document.getElementById("tableViewDiv"),this.tableRow=document.getElementById("tableRow"),this.tblBody=document.getElementById("tblBody"),this.tableViewDiv.style.display="none",this.pdService.chartType.subscribe((function(e){e&&t.updateChartType(e)})),this.pdService.isUserWise_data.subscribe((function(e){t.updateDataType(e)})),this.pdService.isAllUsers.subscribe((function(e){e?t.showAllUser():t.showCurrentDataUser()}))},e.prototype.findAndSimplifyNestedArray=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t])){var i=e[t];return i.every((function(e){return Array.isArray(e)&&e.every((function(t){return t===e[0]}))}))&&(e[t]=[[i[0][0]]]),e[t]}return"No nested array found."},e.prototype.showCurrentDataUser=function(){var e;this.tableViewData=this.pdService.dataForTableView(this.currentdataList,this.currentResoursedataList),this.tableViewData=this.replaceTopicAndChapter(this.tableViewData);for(var t=0;t<this.tableViewData.length;t++)(e=this.findAndSimplifyNestedArray(this.tableViewData[t]))[e.length-1]=e[e.length-1][0];for(var i=0;i<this.tableViewData.length;i++)this.mergerSourceWithRoomData(this.tableViewData[i]);this.tableViewData&&this.ueserWiseTableView(this.tableViewData)},e.prototype.replaceTopicAndChapter=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";return e.map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e&&(e=(e=e.replace(/Topic :\s*(.+?)\s*:\s*\d+m \d+s/,"Topic: $1 "+t)).replace(/Chapter :\s*(.+?)\s*:\s*\d+m \d+s/,"Chapter: $1 "+t)),e})):e}))},e.prototype.mergerSourceWithRoomData=function(e){var t=e[e.length-1].join(" ");"ce6"===t?t='<span style="color:black;"></span>':"ce6-a"===t?t='<span style="color:#1b60d1;font-weight:bold;font-size:14px;"><i class="fa fa-android" aria-hidden="true"></i></span>':"c"===t&&(t='<span style="color:#1b60d1;font-weight:bold;font-size:14px; display:flex;"><i style="margin-top:-1px;" class="fa fa-android" aria-hidden="true"></i><i style="margin-left:5px;" class="fa fa-desktop" aria-hidden="true"></i></span>'),e[6]='<div style="display: flex;flex-direction: row;align-content: center;justify-content: flex-start;align-items: center;"><span style="font-size:11px !important;color:gray;font-weight:600;">'+e[6]+'</span><span style="color:transparent">-</span>'+t+"</div>",e.pop()},e.prototype.showAllUser=function(){var e;this.tableViewData=this.pdService.dataForTableView(this.alluserList,this.currentResoursedataList),console.log("11decc tableViewDataBBB",this.replaceTopicAndChapter(this.tableViewData)),this.tableViewData=this.replaceTopicAndChapter(this.tableViewData);for(var t=0;t<this.tableViewData.length;t++)(e=this.findAndSimplifyNestedArray(this.tableViewData[t]))[e.length-1]&&(e[e.length-1]=e[e.length-1][0]);for(var i=0;i<this.tableViewData.length;i++)this.mergerSourceWithRoomData(this.tableViewData[i]);this.tableViewData&&this.ueserWiseTableView(this.tableViewData)},e.prototype.updateDataType=function(e){this.isUserWise=e},e.prototype.updateChartType=function(e){this.myChartType=e,this.myChartType==n.ChartType.Timeline?this.tableViewDiv.style.display="none":this.tableViewDiv.style.display="block"},e.prototype.ueserWiseTableView=function(e){document.getElementById("tblBody").innerHTML="";for(var t=new Array,i=0,n=0;n<e.length;n++)for(var a=0;a<12;a++){var r=document.createElement("div");r.innerHTML=e[n][a],"undefined"!==r.textContent&&void 0!==r.textContent&&"undefined\nce6-a"!==r.textContent&&"undefined\nce6"!==r.textContent&&"undefined\n"!==r.textContent&&"undefined\nAndroid"!==r.textContent&&"undefined\nWeb"!==r.textContent&&"undefined\n"!==r.textContent&&"\nundefined"!==r.textContent&&" undefined"!==r.textContent&&"undefined-"!==r.textContent&&"undefined-c"!==r.textContent&&"undefined- "!==r.textContent||(r.textContent=""),t.push(r)}for(a=0;a<=e.length;a++){var o=document.createElement("tr"),s=void 0;for(n=0;n<12;n++)s=document.createElement("td"),i<t.length&&(s.appendChild(t[i]),o.appendChild(s)),i++;this.tblBody.appendChild(o)}},e}();T.decorators=[{type:t.Component,args:[{selector:"lib-tableview",template:'\n <div id="tableViewDiv" class="pd-tableViewDiv">\n \n <table class="table table-bordered" id="tableRow">\n <thead class="table-head">\n <tr class="table-headerRow">\n <th scope="col">Teacher Name</th>\n <th scope="col">Subjects</th>\n <th scope="col">Date</th>\n <th scope="col">Start Time</th>\n <th scope="col">End Time</th>\n <th scope="col">Duration (mins)</th>\n <th scope="col">Room</th>\n <th scope="col">Subject</th>\n <th scope="col">Topic of Class</th>\n <th scope="col">Chapter Name</th>\n <th scope="col">Topic Name</th>\n <th scope="col">Assets Details</th>\n \n </tr>\n </thead>\n <tbody id="tblBody">\n \n </tbody>\n </table>\n </div>\n \n',styles:[".pd-tableViewDiv{width:100%;height:744px;overflow:scroll}.pd-tableViewDiv #tableRow{font-size:small;width:100%;margin-left:24px;margin-top:10px}.pd-tableViewDiv .table-headerRow{font-weight:700}.pd-tableViewDiv .table-head{position:sticky;top:0;background:#fff}.roomCell{display:flex;flex-direction:row;align-content:center;justify-content:flex-start;align-items:center}"]}]}],T.ctorParameters=function(){return[{type:u}]},T.propDecorators={data:[{type:t.Input}]};var C=function(){function e(e){this.pdService=e,this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.usersCheckboxChecked=!1,this.classroomArray=[],this.allClassrooms=[],this.isDisplay=!1,this.isUserWise=!0,this.isAllUsers=!1,this.isInitialized=!1}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&(console.log("newtable",JSON.parse(e)),this.jsonResponse=JSON.parse(e),this.isInitialized&&this.loadUserData())},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.loadUserData(),this.isInitialized=!0,this.pdService.isUserWise_data.subscribe((function(t){e.isUserWise=t})),this.pdService.isAllUsers.subscribe((function(t){e.isAllUsers=!!t})),this.pdService.chartType.subscribe((function(t){t&&(console.log("newTable",t),e.isDisplay="Table"===t)}))},Object.defineProperty(e.prototype,"userRows",{get:function(){return this.isAllUsers?this.allUsers:this.currentUserArray},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classroomRows",{get:function(){return this.isAllUsers?this.allClassrooms:this.classroomArray},enumerable:!1,configurable:!0}),e.prototype.loadUserData=function(){var e=this,t=this.jsonResponse;if(this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.classroomArray=[],this.allClassrooms=[],t){var i=t.usersConsole.userConsole,n=t.usersMetadata.userMetadata,a=t.resourcesMetadata.resourceMetadata;i.forEach((function(t){var i,r=n.find((function(e){return e.userId===t.userId}));if(null==t?void 0:t.userConsoleResources){var o=null===(i=t.userConsoleResources)||void 0===i?void 0:i.userConsoleResource;o&&o.length>0&&o.forEach((function(i,n){var o,s,l,d,c,p,u=i.resourceId,h=a.find((function(e){return e.resourceId===u&&i.type===e.type})),m=e.getDisplayTypeValue(i.type),f=(null==h?void 0:h.title)||"",g=null===(o=null==h?void 0:h.teachingPoint)||void 0===o?void 0:o.title,v=null===(s=null==h?void 0:h.subject)||void 0===s?void 0:s.title,b=null===(l=null==h?void 0:h.chapter)||void 0===l?void 0:l.title,y=null===(d=null==h?void 0:h.grade)||void 0===d?void 0:d.title,x=new Date(null==t?void 0:t.startTime),w=new Date(null==t?void 0:t.endTime),D=e.formatTime(Math.round((w.getTime()-x.getTime())/1e3)),T=parseInt((null==i?void 0:i.duration)||"0"),C=m+" : "+f+" : "+(T=(null===(c=null==i?void 0:i.type)||void 0===c?void 0:c.includes("question"))||(null===(p=null==i?void 0:i.type)||void 0===p?void 0:p.includes("cquestion"))?0:0===T?"<span class='seenTag' style='color:blue;'>(Seen)</span>":e.formatTime(T));""===f&&(C=m+" : "+T),e.currentUserArray.push({userId:t.userId,teacherName:0===n?null==r?void 0:r.fullName:"",subjects:0===n?null==r?void 0:r.userSubjects:"",date:0===n?null==t?void 0:t.selectedDate:"",startTime:0===n?e.formatDate(x):"",endtime:0===n?e.formatDate(w):"",totalDuration:0===n?D:"",room:0===n?null==t?void 0:t.terminalIP:"",tp:g,subject:v,chapter:b,grade:y,details:C})}))}}));var r=this.currentUserArray.map((function(e){return e.userId})).filter((function(e,t,i){return i.indexOf(e)===t}));this.remaningUsers=n.filter((function(e){return!r.includes(e.userId)})).map((function(e){return{userId:e.userId,teacherName:null==e?void 0:e.fullName,subjects:null==e?void 0:e.userSubjects,date:"",startTime:"",endtime:"",totalDuration:"0s",room:"",tp:"",subject:"",chapter:"",grade:"",details:""}})),this.allUsers=b(this.currentUserArray,this.remaningUsers),this.loadClassroomData(i,n,a),this.loadTable(this.currentUserArray)}},e.prototype.loadClassroomData=function(e,t,i){var n,a,r=this,o=(null===(a=null===(n=this.jsonResponse)||void 0===n?void 0:n.schoolTerminals)||void 0===a?void 0:a.schoolTerminal)||[],s={};o.forEach((function(e){s[e.terminalKey]=r.getTerminalLocation(e)}));var l={};e.forEach((function(e){var t=(null==e?void 0:e.terminalIP)||"";(l[t]=l[t]||[]).push(e)}));var d=function(e){return r.pdService.getRoomLabel(s[e],e)};Object.keys(l).sort((function(e,t){return d(e).localeCompare(d(t),void 0,{numeric:!0})})).forEach((function(e){l[e].sort((function(e,t){return new Date(e.startTime).getTime()-new Date(t.startTime).getTime()})).forEach((function(n,a){var o,s=t.find((function(e){return e.userId===n.userId})),l=new Date(null==n?void 0:n.startTime),c=new Date(null==n?void 0:n.endTime),p=r.formatTime(Math.round((c.getTime()-l.getTime())/1e3)),u=(null===(o=null==n?void 0:n.userConsoleResources)||void 0===o?void 0:o.userConsoleResource)||[];(u.length>0?u:[null]).forEach((function(t,o){var u,h,m,f,g=t&&i.find((function(e){return e.resourceId===t.resourceId&&t.type===e.type})),v=0===o;r.classroomArray.push({room:v&&0===a?d(e):"",teacherName:v?null==s?void 0:s.fullName:"",date:v?null==n?void 0:n.selectedDate:"",startTime:v?r.formatDate(l):"",endtime:v?r.formatDate(c):"",totalDuration:v?p:"",tp:null===(u=null==g?void 0:g.teachingPoint)||void 0===u?void 0:u.title,subject:null===(h=null==g?void 0:g.subject)||void 0===h?void 0:h.title,chapter:null===(m=null==g?void 0:g.chapter)||void 0===m?void 0:m.title,grade:null===(f=null==g?void 0:g.grade)||void 0===f?void 0:f.title,details:t?r.getAssetDetails(t,g):""})}))}))}));var c=o.filter((function(e){return!l[e.terminalKey]})).map((function(e){return{room:d(e.terminalKey),teacherName:"",date:"",startTime:"",endtime:"",totalDuration:"0s",tp:"",subject:"",chapter:"",grade:"",details:""}}));this.allClassrooms=b(this.classroomArray,c)},e.prototype.getTerminalLocation=function(e){var t;try{return(null==e?void 0:e.metadata)&&(null===(t=JSON.parse(e.metadata))||void 0===t?void 0:t.location)||""}catch(e){return""}},e.prototype.getAssetDetails=function(e,t){var i,n,a=this.getDisplayTypeValue(e.type),r=(null==t?void 0:t.title)||"",o=parseInt((null==e?void 0:e.duration)||"0");return o=(null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.includes("question"))||(null===(n=null==e?void 0:e.type)||void 0===n?void 0:n.includes("cquestion"))?0:0===o?"<span class='seenTag' style='color:blue;'>(Seen)</span>":this.formatTime(o),""===r?a+" : "+o:a+" : "+r+" : "+o},e.prototype.getDisplayTypeValue=function(e){var t=[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"},{type:"ebook",display:"Ebook"}].find((function(t){return t.type===e}));return t?t.display:e},e.prototype.formatDate=function(e){var t=e.getHours(),i=e.getMinutes(),n=e.getSeconds(),a=t>=12?"PM":"AM";return(t=t%12||12).toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+n.toString().padStart(2,"0")+" "+a},e.prototype.formatTime=function(e){var t=Math.floor(e/86400),i=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),a=e%60;return e<60?a+"s":e<3600?n+"m "+a+"s":e<86400?i+"h "+n+"m "+a+"s":t+"d "+i+"h "+n+"m "+a+"s"},e.prototype.loadTable=function(e){},e.prototype.toggleUsers=function(){this.usersCheckboxChecked=!this.usersCheckboxChecked,this.loadTable(this.usersCheckboxChecked?this.allUsers:this.currentUserArray)},e.prototype.getMockJson=function(){return{}},e}();C.decorators=[{type:t.Component,args:[{selector:"lib-full-table-view",template:'\n<div class="tableViewList" *ngIf="isDisplay">\n \x3c!-- <label for="usersCheckbox">All</label>\n <input\n type="checkbox"\n id="usersCheckbox"\n [checked]="usersCheckboxChecked"\n (change)="toggleUsers()"\n /> --\x3e\n <div class="tableArea">\n \n <table id="teacherTable" *ngIf="isUserWise">\n <thead class="tablehead">\n <tr>\n <th>Teacher Name</th>\n <th>Subjects</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Room</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let user of userRows">\n <td>{{ user.teacherName }}</td>\n <td>{{ user.subjects }}</td>\n <td>{{ user.date }}</td>\n <td>{{ user.startTime }}</td>\n <td>{{ user.endtime }}</td>\n <td>{{ user.totalDuration }}</td>\n <td>{{ user.room }}</td>\n <td>{{ user.tp }}</td>\n <td>{{ user.subject }}</td>\n <td>{{ user.chapter }}</td>\n <td>{{ user.grade }}</td>\n <td><div [innerHTML]="user.details"></div></td>\n </tr>\n </tbody>\n </table>\n\n <table id="classroomTable" *ngIf="!isUserWise">\n <thead class="tablehead">\n <tr>\n <th>Room</th>\n <th>Teacher Name</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let row of classroomRows" [class.roomStart]="row.room">\n <td class="roomCell">{{ row.room }}</td>\n <td>{{ row.teacherName }}</td>\n <td>{{ row.date }}</td>\n <td>{{ row.startTime }}</td>\n <td>{{ row.endtime }}</td>\n <td>{{ row.totalDuration }}</td>\n <td>{{ row.tp }}</td>\n <td>{{ row.subject }}</td>\n <td>{{ row.chapter }}</td>\n <td>{{ row.grade }}</td>\n <td><div [innerHTML]="row.details"></div></td>\n </tr>\n </tbody>\n </table>\n </div>\n \n</div>\n ',styles:["body{font-family:Arial,sans-serif;margin:20px}.tablehead{position:sticky;top:0;background:#fff}table{width:100%;border-collapse:collapse}td,th{border:1px solid #ddd;padding:8px;text-align:left}th{background-color:#f4f4f4;font-weight:700}tr:nth-child(2n){background-color:#f9f9f9}tr:hover{background-color:#f1f1f1}.tableViewList{position:absolute;margin-top:20px}.tableArea{height:700px;overflow:scroll;font-size:12px;margin:20px 5px 5px}.seenTag{color:#00f}.roomCell{font-weight:700}.roomStart td{border-top:2px solid #b7b7b7}"]}]}],C.ctorParameters=function(){return[{type:u}]},C.propDecorators={data:[{type:t.Input}]};var k=function(){function e(e){this.pdService=e,this.currentTimeFrameUserArray=[],this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.usersCheckboxChecked=!1,this.isDisplay=!1,this.accentColor="",this.mode="session",this.allTitle="",this.allSummary=[],this.otherColumn="Room",this.people=[],this.peopleTitle=""}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&(this.jsonResponse=JSON.parse(e))},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.pdService.openSmallTable$.subscribe((function(t){if(t){if(e.isDisplay=!0,e.accentColor=e.pdService.detailAccentColor,t.allSessions&&e.pdService.detailRowRequest)return void e.loadRowSessions(e.pdService.detailRowRequest);e.mode="session";var i=e.findUserIdByName(t.userDetails[0]),n=t.userDetails[1],a=t.userDetails[3];e.loadUserData(i,n,a)}else e.isDisplay=!1})),this.pdService.chartType.subscribe((function(t){e.isDisplay=!1}))},e.prototype.findUserIdByName=function(e){var t=this.jsonResponse.usersMetadata.userMetadata.find((function(t){return t.fullName===e}));return t?t.userId:null},e.prototype.loadUserData=function(e,t,i){var n=this;this.currentUserArray=[],this.allUsers=[],this.currentTimeFrameUserArray=[];var a=this.jsonResponse,r=a.usersConsole.userConsole,o=a.usersMetadata.userMetadata,s=a.resourcesMetadata.resourceMetadata;(e?r.filter((function(t){return t.userId===e})):r).forEach((function(e){var t;(t=n.currentUserArray).push.apply(t,b(n.rowsForConsole(e,o,s)))}));var l=this.currentUserArray.map((function(e){return e.userId})).filter((function(e,t,i){return i.indexOf(e)===t}));this.remaningUsers=o.filter((function(e){return!l.includes(e.userId)})).map((function(e){return{userId:e.userId,teacherName:null==e?void 0:e.fullName,subjects:null==e?void 0:e.userSubjects,date:"",startTime:"",endtime:"",totalDuration:"0s",room:"",tp:"",subject:"",chapter:"",grade:"",details:""}})),this.allUsers=b(this.currentUserArray,this.remaningUsers),this.currentTimeFrameUserArray=this.filterDataByCriteria(this.currentUserArray,e,t,i),console.log("smallData",this.currentTimeFrameUserArray)},e.prototype.loadRowSessions=function(e){var t=this;this.mode="all";var i=this.jsonResponse,n=i.usersConsole.userConsole,a=i.usersMetadata.userMetadata,r=i.resourcesMetadata.resourceMetadata,o=e.sessions,s=n.filter((function(e){return o.some((function(t){return t.userId===e.userId&&t.ip===e.terminalIP&&t.start===new Date(e.startTime).getTime()}))})).sort((function(e,t){return new Date(e.startTime).getTime()-new Date(t.startTime).getTime()})),l=function(e){return(a.find((function(t){return t.userId===e}))||{}).fullName||""},d=function(e){return t.getRoomName(e)||e};this.otherColumn=e.isUserWise?"Room":"Teacher";var c=[];s.forEach((function(i){var n=new Date(i.startTime),o=new Date(i.endTime),s={sessionHead:!0,sessionTime:t.formatClock(n)+" – "+t.formatClock(o),sessionDuration:t.formatTime(Math.round((o.getTime()-n.getTime())/1e3)),sessionOther:e.isUserWise?d(i.terminalIP):l(i.userId)},p=t.rowsForConsole(i,a,r);0===p.length?c.push(Object.assign(Object.assign({},s),{empty:!0})):p.forEach((function(e,t){return c.push(0===t?Object.assign(Object.assign({},e),s):e)}))})),this.currentTimeFrameUserArray=c;var p=new Map;s.forEach((function(t){var i=e.isUserWise?d(t.terminalIP):l(t.userId);if(i){var n=new Date(t.endTime).getTime()-new Date(t.startTime).getTime();p.set(i,(p.get(i)||0)+Math.max(n,0))}})),this.people=Array.from(p.entries()).map((function(e){var i=v(e,2),n=i[0],a=i[1];return{label:n,time:t.formatTime(Math.round(a/1e3))}})),this.peopleTitle=e.isUserWise?"Rooms used":"Teachers in this room",this.allTitle=!e.isUserWise&&/^\d+$/.test(String(e.label).trim())?"Room "+e.label:e.label,this.allSummary=[{label:"Sessions",value:""+s.length,icon:"sessions",tone:"lime"},{label:e.isUserWise?"Rooms":"Teachers",value:""+this.people.length,icon:e.isUserWise?"room":"teacher",tone:"sand"},{label:"First start",value:s.length?this.formatDate(new Date(s[0].startTime)):"—",icon:"start",tone:"sky"},{label:"Last end",value:s.length?this.formatDate(new Date(Math.max.apply(Math,b(s.map((function(e){return new Date(e.endTime).getTime()})))))):"—",icon:"end",tone:"sky"},{label:"Total time",value:e.total||"—",icon:"clock",tone:"mint"}]},Object.defineProperty(e.prototype,"sessionSummary",{get:function(){var e=this.currentTimeFrameUserArray[0]||{};return[{label:"Subject",value:e.subject||"—",icon:"subject",tone:"lime"},{label:"Room",value:e.roomName||e.room||"—",icon:"room",tone:"sand"},{label:"Start",value:e.startTime||"—",icon:"start",tone:"sky"},{label:"End",value:e.endtime||"—",icon:"end",tone:"sky"},{label:"Total time",value:e.totalDuration||"—",icon:"clock",tone:"mint"}]},enumerable:!1,configurable:!0}),e.prototype.formatClock=function(e){var t=e.getHours();return(t%12||12)+":"+e.getMinutes().toString().padStart(2,"0")+" "+(t>=12?"PM":"AM")},e.prototype.rowsForConsole=function(e,t,i){var n,a=this,r=[],o=t.find((function(t){return t.userId===e.userId}));if(null==e?void 0:e.userConsoleResources){var s=null===(n=e.userConsoleResources)||void 0===n?void 0:n.userConsoleResource;s&&s.length>0&&s.forEach((function(t,n){var s,l,d,c,p,u,h=t.resourceId,m=i.find((function(e){return e.resourceId===h&&t.type===e.type})),f=a.getDisplayTypeValue(t.type),g=(null==m?void 0:m.title)||"",v=a.decodeHtmlEntities(null===(s=null==m?void 0:m.teachingPoint)||void 0===s?void 0:s.title),b=a.decodeHtmlEntities(null===(l=null==m?void 0:m.subject)||void 0===l?void 0:l.title),y=a.decodeHtmlEntities(null===(d=null==m?void 0:m.chapter)||void 0===d?void 0:d.title),x=a.decodeHtmlEntities(null===(c=null==m?void 0:m.grade)||void 0===c?void 0:c.title),w=new Date(null==e?void 0:e.startTime),D=new Date(null==e?void 0:e.endTime),T=a.formatTime(Math.round((D.getTime()-w.getTime())/1e3)),C=parseInt((null==t?void 0:t.duration)||"0"),k=f+" : "+g+" : "+(C=(null===(p=null==t?void 0:t.type)||void 0===p?void 0:p.includes("question"))||(null===(u=null==t?void 0:t.type)||void 0===u?void 0:u.includes("cquestion"))?0:0===C?"<span class='dddd'>(Seen)</span>":a.formatTime(C));""===g&&(k=f+" : "+C),r.push({userId:e.userId,teacherName:0===n?null==o?void 0:o.fullName:"",subjects:0===n?null==o?void 0:o.userSubjects:"",date:0===n?null==e?void 0:e.selectedDate:"",startTime:a.formatDate(w),endtime:a.formatDate(D),totalDuration:T,room:0===n?null==e?void 0:e.terminalIP:"",roomName:0===n?a.getRoomName(null==e?void 0:e.terminalIP):"",tp:v,subject:b,chapter:y,grade:x,details:k,ip:null==e?void 0:e.terminalIP,sessionStart:w.getTime()})}))}return r},e.prototype.filterDataByCriteria=function(e,t,i,n){var a=function(e){if(!e)return null;var t=v(e.split(" "),2),i=t[0],n=t[1],a=v(i.split(":").map(Number),3),r=a[0],o=a[1],s=a[2];return new Date(0,0,0,"PM"===n&&r<12?r+12:r,o,s)},r=a(i),o=a(n);return e.filter((function(e){if(e.userId!==t)return!1;if(!e.startTime||!e.endtime)return!1;var i=a(e.startTime),n=a(e.endtime);return i&&n&&i>=r&&n<=o})).map((function(e,t){return Object.assign(Object.assign({},e),{subsequentCount:t})}))},e.prototype.decodeHtmlEntities=function(e){if(!e)return e;var t=document.createElement("textarea");return t.innerHTML=e,t.value},e.prototype.getDisplayTypeValue=function(e){var t=[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"}].find((function(t){return t.type===e}));return t?t.display:e},e.prototype.formatDate=function(e){var t=e.getHours(),i=e.getMinutes(),n=e.getSeconds(),a=t>=12?"PM":"AM";return(t=t%12||12).toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+n.toString().padStart(2,"0")+" "+a},e.prototype.formatTime=function(e){var t=Math.floor(e/86400),i=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),a=e%60;return e<60?a+"s":e<3600?n+"m "+a+"s":e<86400?i+"h "+n+"m "+a+"s":t+"d "+i+"h "+n+"m "+a+"s"},e.prototype.loadTable=function(e){},e.prototype.toggleUsers=function(){this.usersCheckboxChecked=!this.usersCheckboxChecked,this.loadTable(this.usersCheckboxChecked?this.allUsers:this.currentUserArray)},e.prototype.getRoomName=function(e){var t,i,n,a=((null===(i=null===(t=this.jsonResponse)||void 0===t?void 0:t.schoolTerminals)||void 0===i?void 0:i.schoolTerminal)||[]).find((function(t){return t.terminalKey===e}));try{return(null==a?void 0:a.metadata)?((null===(n=JSON.parse(a.metadata))||void 0===n?void 0:n.location)||"").trim():""}catch(e){return""}},e.prototype.onEscape=function(){this.isDisplay&&this.onCloseBtnClick()},e.prototype.onCloseBtnClick=function(){this.isDisplay=!1},e}();k.decorators=[{type:t.Component,args:[{selector:"lib-small-table-view",template:'<div class="pd-detail-backdrop" *ngIf="isDisplay" (click)="onCloseBtnClick()">\n <div id="pd-deatilViewContainer" class="pd-detail-dialog" role="dialog" aria-modal="true" aria-labelledby="pd-detail-title" (click)="$event.stopPropagation()">\n <div class="pd-detail-header">\n <div class="pd-detail-heading">\n <span class="pd-detail-swatch" *ngIf="accentColor" [style.background-color]="accentColor"></span>\n <div>\n <div id="pd-detail-title" class="pd-detail-title">{{ (mode === \'all\' ? allTitle : currentTimeFrameUserArray[0]?.teacherName) || \'Details\' }}</div>\n <div class="pd-detail-subtitle">{{ mode === \'all\' ? \'All Sessions Today\' : \'Session Details\' }}</div>\n </div>\n </div>\n <button type="button" class="pd-detail-close" aria-label="Close" (click)="onCloseBtnClick()">&times;</button>\n </div>\n\n <div class="pd-detail-summary">\n <div class="pd-detail-card" *ngFor="let card of (mode === \'all\' ? allSummary : sessionSummary)" [ngClass]="\'pd-tone-\' + card.tone">\n <div class="pd-detail-card-label">\n <span class="pd-card-icon" [ngSwitch]="card.icon" aria-hidden="true">\n <svg *ngSwitchCase="\'sessions\'" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10" /></svg>\n <svg *ngSwitchCase="\'room\'" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8" /></svg>\n <svg *ngSwitchCase="\'teacher\'" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n <svg *ngSwitchCase="\'subject\'" viewBox="0 0 24 24"><path d="M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z" /><path d="M4 19a2 2 0 0 1 2-2h13" /></svg>\n <svg *ngSwitchCase="\'start\'" viewBox="0 0 24 24"><path d="M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4" /><path d="M4 12h11M11 8l4 4-4 4" /></svg>\n <svg *ngSwitchCase="\'end\'" viewBox="0 0 24 24"><path d="M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4" /><path d="M9 12h11M16 8l4 4-4 4" /></svg>\n <svg *ngSwitchCase="\'clock\'" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></svg>\n </span>\n {{ card.label }}\n </div>\n <div class="pd-detail-card-value">\n {{ card.value }}\n <span class="pd-detail-muted" *ngIf="card.sub">{{ card.sub }}</span>\n </div>\n </div>\n </div>\n\n <div class="pd-people" *ngIf="mode === \'all\' && people.length">\n <span class="pd-people-title">{{ peopleTitle }}</span>\n <span class="pd-person" *ngFor="let p of people">{{ p.label }} <span class="pd-person-time">{{ p.time }}</span></span>\n </div>\n\n <div class="pd-detail-body">\n <div class="pd-detail-empty" *ngIf="currentTimeFrameUserArray.length === 0">No content was opened in this session.</div>\n <table class="pd-detail-table" *ngIf="currentTimeFrameUserArray.length > 0">\n <thead>\n <tr>\n <ng-container *ngIf="mode === \'all\'">\n <th>Time</th>\n <th>{{ otherColumn }}</th>\n </ng-container>\n <th>Subject</th>\n <th>Class</th>\n <th>Chapter</th>\n <th>Topic</th>\n <th>Asset details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let item of currentTimeFrameUserArray" [class.pd-session-start]="mode === \'all\' && item.sessionHead">\n <ng-container *ngIf="mode === \'all\'">\n <td class="pd-nowrap">\n <ng-container *ngIf="item.sessionHead">\n {{ item.sessionTime }}\n <div class="pd-detail-muted">{{ item.sessionDuration }}</div>\n </ng-container>\n </td>\n <td>{{ item.sessionHead ? item.sessionOther : \'\' }}</td>\n </ng-container>\n <ng-container *ngIf="!item.empty">\n <td>{{ item.subject || \'—\' }}</td>\n <td class="pd-nowrap">{{ item.grade || \'—\' }}</td>\n <td>{{ item.chapter || \'—\' }}</td>\n <td [class.pd-detail-muted]="!item.tp">{{ item.tp || \'—\' }}</td>\n <td [innerHTML]="item.details || \'\'"></td>\n </ng-container>\n <td *ngIf="item.empty" colspan="5" class="pd-detail-muted">No content was opened in this session.</td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\n',styles:[".pd-detail-backdrop{position:fixed;inset:0;top:0;left:0;right:0;bottom:0;z-index:1000;background:rgba(17,24,39,.45);display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}.pd-detail-dialog{background:#fff;border-radius:12px;box-shadow:0 20px 50px rgba(0,0,0,.25);width:900px;max-width:100%;height:600px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;font-family:Arial,sans-serif;font-size:13px;color:#1f2937}.pd-detail-header{flex:0 0 auto;display:flex;align-items:flex-start;justify-content:space-between;padding:18px 20px 12px;border-bottom:1px solid #e5e7eb}.pd-detail-title{font-size:20px;font-weight:700;line-height:1.3;color:#1f2937}.pd-detail-heading{display:flex;align-items:flex-start;gap:12px}.pd-detail-swatch{flex:0 0 auto;width:14px;height:14px;border-radius:50%;margin-top:6px}.pd-detail-subtitle{font-size:15px;font-weight:700;color:#c9952b;margin-top:4px}.pd-detail-close{border:none;background:#f3f4f6;color:#374151;width:32px;height:32px;border-radius:50%;font-size:22px;line-height:30px;cursor:pointer;flex-shrink:0}.pd-detail-close:hover{background:#e5e7eb}.pd-detail-summary{flex:0 0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;padding:14px 20px}.pd-detail-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:12px 14px;text-align:center}.pd-detail-card.pd-tone-lime{background:#eef6a3;border-color:#dfe98a}.pd-detail-card.pd-tone-sand{background:#f6ecd9;border-color:#ebdcc0}.pd-detail-card.pd-tone-sky{background:#e1edfb;border-color:#cbdcf3}.pd-detail-card.pd-tone-mint{background:#f3fbe6;border-color:#dfeecb}.pd-detail-card-label{display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-bottom:6px}.pd-card-icon{display:inline-flex}.pd-card-icon svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.pd-detail-card-value{font-size:15px;font-weight:700;word-break:break-word}.pd-people{flex:0 0 auto;display:flex;flex-wrap:wrap;align-items:center;gap:6px;max-height:72px;overflow:auto;padding:0 20px 12px}.pd-people-title{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-right:4px}.pd-person{padding:4px 10px;border-radius:999px;background:#f6ecd9;border:1px solid #ebdcc0;font-size:12px;font-weight:700;color:#1f2937}.pd-person-time{font-weight:400;color:#6b7280;margin-left:4px}.pd-detail-muted{color:#9ca3af;font-weight:400}.pd-detail-body{overflow:auto;margin:0 20px 20px;flex:1 1 auto;min-height:0;border:1px solid #e5e7eb;border-radius:8px}.pd-detail-table{width:100%;border-collapse:separate;border-spacing:0}.pd-detail-table td,.pd-detail-table th{text-align:left;padding:9px 12px;border-bottom:1px solid #f0f0f0;vertical-align:top}.pd-detail-table th{position:sticky;top:0;z-index:1;background:#f3f4f6;font-size:12px;color:#4b5563;font-weight:700}.pd-detail-table tbody tr:nth-child(2n) td{background:#fafafa}.pd-detail-table tbody tr.pd-session-start:not(:first-child) td{border-top:2px solid #e5e7eb}.pd-detail-table tbody tr:last-child td{border-bottom:none}.pd-detail-table tbody tr:hover td{background:#eef2ff}.pd-nowrap{white-space:nowrap}.pd-detail-empty{padding:24px;text-align:center;color:#6b7280}:host ::ng-deep .dddd{color:#2563eb;font-style:italic}"]}]}],k.ctorParameters=function(){return[{type:u}]},k.propDecorators={data:[{type:t.Input}],onEscape:[{type:t.HostListener,args:["document:keydown.escape"]}]};var A=function(){function e(){this.rows=[],this.labelTitle="Name",this.barClick=new t.EventEmitter,this.totalClick=new t.EventEmitter,this.renderedRows=[],this.ticks=[],this.quarterTicks=[],this.hourWidth=160,this.minWidth=0,this.nowLeft=null,this.sortKey="default",this.sortAsc=!0,this.tooltip=null,this.rangeStart=0,this.rangeEnd=0}return e.prototype.ngOnChanges=function(){this.render()},e.prototype.render=function(){var e=this,t=this.rows||[],i=t.reduce((function(e,t){return e.concat(t.bars)}),[]);if(0===i.length)return this.ticks=[],this.quarterTicks=[],this.nowLeft=null,this.minWidth=0,this.renderedRows=t.map((function(t,i){return e.toRenderedRow(t,i)})),void this.applySort();var n=Math.min.apply(Math,b(i.map((function(e){return e.start.getTime()})))),a=Math.max.apply(Math,b(i.map((function(e){return e.end.getTime()})))),r=36e5,o=new Date(n);o.setMinutes(0,0,0),this.rangeStart=o.getTime(),this.rangeEnd=Math.max(Math.ceil((a-this.rangeStart)/r)*r+this.rangeStart,this.rangeStart+r);var s=(this.rangeEnd-this.rangeStart)/r;this.minWidth=308+s*this.hourWidth,this.ticks=[],this.quarterTicks=[];for(var l=this.rangeStart;l<=this.rangeEnd;l+=9e5){var d=new Date(l).getMinutes();15===d||45===d?this.quarterTicks.push(this.toPercent(l)):this.ticks.push({left:this.toPercent(l),label:this.formatClock(new Date(l)),major:0===d})}var c=Date.now();this.nowLeft=c>=this.rangeStart&&c<=this.rangeEnd?this.toPercent(c):null,this.renderedRows=t.map((function(t,i){return e.toRenderedRow(t,i)})),this.applySort()},e.prototype.toggleSort=function(e){this.sortKey===e?this.sortAsc?this.sortAsc=!1:(this.sortKey="default",this.sortAsc=!0):(this.sortKey=e,this.sortAsc="name"===e),this.applySort()},e.prototype.sortIcon=function(e){return this.sortKey!==e?"":this.sortAsc?"▲":"▼"},e.prototype.onBarClick=function(e){this.tooltip=null,this.barClick.emit({index:e.index,color:e.color})},e.prototype.onTotalClick=function(e){e.bars.length&&(this.tooltip=null,this.totalClick.emit({label:e.label,indexes:e.bars.map((function(e){return e.index})),color:e.color,total:e.total}))},e.prototype.showTooltip=function(e,t){this.tooltip={text:t.tooltip,x:e.clientX+12,y:e.clientY+12}},e.prototype.hideTooltip=function(){this.tooltip=null},e.prototype.trackByLabel=function(e,t){return t.label},e.prototype.toRenderedRow=function(e,t){var i=this,n=this.mergedDuration(e.bars),a=e.bars.map((function(e){return e.start.getTime()})),r=e.bars.map((function(e){return e.end.getTime()})),o=a.length?this.toPercent(Math.min.apply(Math,b(a))):0;return{spanLeft:o,spanWidth:r.length?this.toPercent(Math.max.apply(Math,b(r)))-o:0,label:e.label,color:this.rowColor(t),totalMs:n,total:this.formatDuration(n),order:t,bars:e.bars.map((function(e){var n=i.toPercent(e.start.getTime());return Object.assign(Object.assign({},e),{left:n,width:Math.max(i.toPercent(e.end.getTime())-n,0),color:i.rowColor(t)})}))}},e.prototype.rowColor=function(e){return"hsl("+Math.round((217+137.508*e)%360)+", 62%, 68%)"},e.prototype.applySort=function(){var e=this,t=this.sortAsc?1:-1;this.renderedRows=b(this.renderedRows).sort((function(i,n){return"name"===e.sortKey?t*i.label.localeCompare(n.label,void 0,{numeric:!0}):"total"===e.sortKey?t*(i.totalMs-n.totalMs):i.order-n.order}))},e.prototype.mergedDuration=function(e){var t=b(e).sort((function(e,t){return e.start.getTime()-t.start.getTime()})),i=0,n=null,a=null;return t.forEach((function(e){var t=e.start.getTime(),r=e.end.getTime();null===a||t>a?(null!==a&&(i+=a-n),n=t,a=r):r>a&&(a=r)})),null!==a&&(i+=a-n),i},e.prototype.toPercent=function(e){var t=this.rangeEnd-this.rangeStart;return t>0?(e-this.rangeStart)/t*100:0},e.prototype.formatClock=function(e){var t=e.getHours(),i=e.getMinutes(),n=t>=12?"PM":"AM";return t=t%12||12,0===i?t+" "+n:t+":"+i.toString().padStart(2,"0")},e.prototype.formatDuration=function(e){var t=Math.round(e/6e4);return Math.floor(t/60)+":"+(t%60).toString().padStart(2,"0")+" hrs"},e}();A.decorators=[{type:t.Component,args:[{selector:"lib-timeline",template:'<div class="tl-container" [style.min-width.px]="minWidth">\n <div class="tl-row tl-header">\n <div class="tl-label tl-sortable" (click)="toggleSort(\'name\')">{{ labelTitle }} {{ sortIcon(\'name\') }}</div>\n <div class="tl-track tl-axis">\n <div class="tl-mark tl-mark-quarter" *ngFor="let left of quarterTicks" [style.left.%]="left"></div>\n <div class="tl-mark" *ngFor="let tick of ticks" [class.tl-mark-hour]="tick.major" [style.left.%]="tick.left"></div>\n <div class="tl-tick" *ngFor="let tick of ticks" [class.tl-minor]="!tick.major" [style.left.%]="tick.left">{{ tick.label }}</div>\n </div>\n <div class="tl-total tl-sortable" (click)="toggleSort(\'total\')">Total {{ sortIcon(\'total\') }}</div>\n </div>\n\n <div class="tl-empty" *ngIf="renderedRows.length === 0">No usage data for this view.</div>\n\n <div class="tl-row" *ngFor="let row of renderedRows; trackBy: trackByLabel; let odd = odd" [class.tl-odd]="odd">\n <div class="tl-label" [title]="row.label">{{ row.label }}</div>\n <div class="tl-track">\n <div class="tl-gridline" *ngFor="let tick of ticks" [class.tl-minor]="!tick.major" [style.left.%]="tick.left"></div>\n <div class="tl-span" *ngIf="row.bars.length" [style.left.%]="row.spanLeft" [style.width.%]="row.spanWidth"></div>\n <div class="tl-now" *ngIf="nowLeft !== null" [style.left.%]="nowLeft"></div>\n <div\n class="tl-bar"\n *ngFor="let bar of row.bars"\n [style.left.%]="bar.left"\n [style.width.%]="bar.width"\n [style.background-color]="bar.color"\n (click)="onBarClick(bar)"\n (mousemove)="showTooltip($event, bar)"\n (mouseleave)="hideTooltip()"\n ></div>\n </div>\n <div\n class="tl-total"\n [class.tl-total-link]="row.bars.length"\n [title]="row.bars.length ? \'Show all sessions\' : \'\'"\n (click)="onTotalClick(row)"\n >{{ row.bars.length ? row.total : \'—\' }}</div>\n </div>\n\n <div class="tl-tooltip" *ngIf="tooltip" [style.left.px]="tooltip.x" [style.top.px]="tooltip.y">{{ tooltip.text }}</div>\n</div>\n',styles:[".tl-container{font-family:Arial,sans-serif;font-size:13px;color:#1f2937;border:1px solid #e5e7eb;border-radius:8px;overflow:clip;min-width:900px;box-sizing:border-box;position:relative;isolation:isolate}.tl-row{display:flex;height:30px;border-bottom:1px solid #e2e6ec;background:#fff}.tl-row:hover:not(.tl-header){background:#eef2ff}.tl-odd{background:#f4f6f9}.tl-header{position:sticky;top:0;z-index:3;height:32px;background:#f8fafc;font-weight:700;color:#475569;border-bottom:1px solid #e5e7eb}.tl-label{flex:0 0 170px;overflow:hidden;text-overflow:ellipsis;border-right:1px solid #e5e7eb;left:0}.tl-label,.tl-total{padding:0 8px;line-height:30px;text-align:right;white-space:nowrap;position:sticky;z-index:2;background:inherit}.tl-total{flex:0 0 90px;font-variant-numeric:tabular-nums;color:#334155;border-left:1px solid #e5e7eb;right:0}.tl-total-link{cursor:pointer;color:#4338ca}.tl-total-link:hover{text-decoration:underline}.tl-sortable{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:32px}.tl-track{flex:1 1 auto;position:relative;margin:0 24px}.tl-axis .tl-tick{position:absolute;top:0;line-height:24px;transform:translateX(-50%);font-weight:400;font-size:11px;color:#64748b;white-space:nowrap}.tl-axis .tl-tick.tl-minor{font-size:10px;color:#94a3b8}.tl-axis .tl-mark{position:absolute;bottom:0;height:8px;border-left:2px solid #7c9cf5;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-hour{height:10px;border-left:2px solid #475569;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-quarter{height:8px;border-left:1px solid #c3cad6;transform:translateX(-.5px)}.tl-gridline{position:absolute;top:0;bottom:0;border-left:1px solid #d3d2d2;z-index:3}.tl-gridline.tl-minor{border-left:1px dashed #d3d2d2}.tl-span{position:absolute;top:5px;bottom:5px;background:#e4e8ee;border-radius:2px}.tl-now{top:0;bottom:0;border-left:2px solid #f43f5e}.tl-bar,.tl-now{position:absolute;z-index:1}.tl-bar{top:5px;bottom:5px;min-width:4px;border-radius:2px;cursor:pointer;box-shadow:inset 1px 0 0 hsla(0,0%,100%,.45);transition:filter .12s}.tl-bar:hover{filter:brightness(.82);z-index:2;box-shadow:0 2px 6px rgba(79,70,229,.35)}.tl-empty{padding:16px;text-align:center;color:#666}.tl-tooltip{position:fixed;z-index:1000;background:#1e293b;color:#fff;font-size:12px;padding:6px 10px;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.2);white-space:pre-line;pointer-events:none;max-width:320px}"]}]}],A.propDecorators={rows:[{type:t.Input}],labelTitle:[{type:t.Input}],barClick:[{type:t.Output}],totalClick:[{type:t.Output}]};var S=6e4,M=36e5,I=function(){function e(e,t){this.pdService=e,this.host=t,this.schoolName="",this.dayLabel="",this.kpis=[],this.hourly=[],this.grades=[],this.topTeachers=[],this.subjectDonut={total:"",segments:[]},this.donutRadius=52,this.gradeColumns=[],this.roomTiles=[],this.idleRooms=[],this.inactiveTeachers=[],this.contentMix=[],this.chapters=[],this.attention=[],this.hasSessions=!1,this.isExporting=!1,this.detailsOpen=!1,this.eligibleCount=0,this.classroomCount=0,this.fileDate="",this.countFrame=0}return Object.defineProperty(e.prototype,"data",{set:function(e){e&&this.build("string"==typeof e?JSON.parse(e):e)},enumerable:!1,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){return e.fitHeight()}))},e.prototype.fitHeight=function(){var e=this.host.nativeElement.querySelector(".in-page");if(e){var t=e.getBoundingClientRect().top;e.style.height=Math.max(window.innerHeight-t,240)+"px"}},e.prototype.build=function(e){var t=this,i=this.list(e,"usersMetadata","userMetadata"),n=this.list(e,"usersConsole","userConsole"),a=this.list(e,"resourcesMetadata","resourceMetadata"),r=this.list(e,"schoolTerminals","schoolTerminal");this.schoolName=e.schoolMetadata&&e.schoolMetadata.school&&e.schoolMetadata.school.schoolName||"";var o=new Map;i.forEach((function(e){return o.set(e.userId,e)}));var s=new Map;a.forEach((function(e){return s.set(e.resourceId,e)}));var l=new Map;r.forEach((function(e){return l.set(e.terminalKey,t.pdService.getRoomLabel(t.location(e.metadata),e.terminalKey))}));var d=r.filter((function(e){return"classroom"===e.terminalType})),c=n.map((function(e){return{userId:e.userId,ip:e.terminalIP,start:t.parseTime(e.startTime),end:t.parseTime(e.endTime),resources:(e.userConsoleResources&&e.userConsoleResources.userConsoleResource||[]).map((function(e){return{resourceId:e.resourceId,type:e.type}}))}})).filter((function(e){return!isNaN(e.start)&&!isNaN(e.end)&&e.end>=e.start})),p=c.filter((function(e){return e.end>e.start}));this.hasSessions=c.length>0;var u=c.length?new Date(Math.min.apply(Math,b(c.map((function(e){return e.start}))))):null;this.fileDate=u?[u.getDate(),u.getMonth()+1].map((function(e){return String(e).padStart(2,"0")})).join("-")+"-"+u.getFullYear():"",this.dayLabel=u?u.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"short",year:"numeric"}):"";var h=i.filter((function(e){return""!==(e.userSubjects||"")})),m=this.groupTime(p,(function(e){return e.userId})),f=this.countBy(p,(function(e){return e.userId})),g=new Set(c.map((function(e){return e.userId}))),y=Array.from(m.values()).reduce((function(e,t){return e+t}),0),x=h.filter((function(e){return g.has(e.userId)})).length;this.eligibleCount=h.length,this.classroomCount=d.length,this.topTeachers=this.toBars(Array.from(m.entries()).map((function(e){var i=v(e,2),n=i[0],a=i[1];return{label:t.userName(o.get(n),n),sub:(f.get(n)||0)+" sessions",value:a}})),(function(e){return t.formatDuration(e)}),8),this.inactiveTeachers=h.filter((function(e){return!g.has(e.userId)})).map((function(e){return t.userName(e,e.userId)})).sort((function(e,t){return e.localeCompare(t)}));var w=this.groupTime(p,(function(e){return e.ip})),D=new Set(c.map((function(e){return e.ip}))),T=d.filter((function(e){return D.has(e.terminalKey)})).length,C=p.length?Math.max.apply(Math,b(p.map((function(e){return e.end}))))-Math.min.apply(Math,b(p.map((function(e){return e.start})))):0,k=d.map((function(e){return e.terminalKey})).concat(Array.from(w.keys()).filter((function(e){return!d.some((function(t){return t.terminalKey===e}))}))),A=Math.max.apply(Math,b(Array.from(w.values()),[1]));if(this.roomTiles=k.map((function(e){var i=w.get(e)||0,n=C?Math.round(i/C*100):0;return{label:l.get(e)||e,display:i?t.formatDuration(i)+" · "+n+"% of the day":"Not used today",share:n,shade:n?t.navyShade(i/A):"",dark:!!n&&Math.pow(i/A,1.8)>.5,idle:!n,span:Math.min(Math.ceil(((l.get(e)||e).length+2)/5),4)}})).sort((function(e,t){return e.label.localeCompare(t.label,void 0,{numeric:!0})})),this.idleRooms=d.filter((function(e){return!D.has(e.terminalKey)})).map((function(e){return l.get(e.terminalKey)})).sort((function(e,t){return e.localeCompare(t,void 0,{numeric:!0})})),this.hourly=[],p.length){var S=new Date(Math.min.apply(Math,b(p.map((function(e){return e.start})))));S.setMinutes(0,0,0);for(var I=Math.max.apply(Math,b(p.map((function(e){return e.end})))),U=[],R=function(e){var t=new Set(p.filter((function(t){return t.start<e+M&&t.end>e})).map((function(e){return e.userId})));U.push({label:j.formatHour(new Date(e)),value:t.size})},j=this,E=S.getTime();E<I;E+=M)R(E);var N=Math.max.apply(Math,b(U.map((function(e){return e.value})),[1]));this.hourly=U.map((function(e){return Object.assign(Object.assign({},e),{percent:e.value/N*100,peak:e.value===N,color:t.utilisationColor(e.value/N)})}))}var L=this.hourly.reduce((function(e,t){return!e||t.value>e.value?t:e}),null),z=new Map,V=new Map;p.forEach((function(e){var i=e.resources.map((function(e){return s.get(e.resourceId)})).filter((function(e){return!!e}));t.share(z,i.map((function(e){return t.title(e.subject)})),e.end-e.start),t.share(V,i.map((function(e){return t.title(e.grade)})),e.end-e.start)})),this.subjectDonut=this.buildDonut(this.entries(z),7),this.grades=this.toBars(this.entries(V).sort((function(e,t){return e.label.localeCompare(t.label,void 0,{numeric:!0})})),(function(e){return t.formatDuration(e)}),0,!1),this.gradeColumns=this.grades.map((function(e){return Object.assign(Object.assign({},e),{short:t.shortGrade(e.label)})}));var B=c.reduce((function(e,t){return e.concat(t.resources)}),[]),O=this.countBy(B,(function(e){return t.typeLabel(e.type)}));this.contentMix=this.toBars(Array.from(O.entries()).map((function(e){var t=v(e,2);return{label:t[0],value:t[1]}})),(function(e){return""+e}),0).map((function(e,i){return Object.assign(Object.assign({},e),{color:t.color(i),percent:e.value/Math.max(B.length,1)*100})}));var W=new Map;B.forEach((function(e){var i=s.get(e.resourceId),n=i&&t.title(i.chapter);if(n){var a=t.title(i.subject)+"|"+t.title(i.grade)+"|"+n,r=W.get(a)||{n:0,sub:[t.title(i.subject),t.title(i.grade)].filter((function(e){return e})).join(" · ")};r.n++,W.set(a,r)}})),this.chapters=this.toBars(Array.from(W.entries()).map((function(e){var t=v(e,2),i=t[0],n=t[1];return{label:i.split("|")[2],sub:n.sub,value:n.n}})),(function(e){return e+" uses"}),8);var F=p.length?y/p.length:0,P=new Set(B.filter((function(e){return"tp"===e.type})).map((function(e){return e.resourceId})));this.kpis=[{label:"Active Teachers",value:x+" / "+h.length,hint:this.pct(x,h.length)+" of eligible teachers"},{label:"Classrooms Used",value:T+" / "+d.length,hint:this.pct(T,d.length)+" of classrooms"},{label:"Teaching Time",value:this.formatDuration(y),hint:this.formatDuration(g.size?y/g.size:0)+" per active teacher"},{label:"Sessions",value:""+p.length,hint:this.formatDuration(F)+" on average"},{label:"Content Used",value:""+B.length,hint:P.size+" distinct topics"},{label:"Peak Hour",value:L?L.label:"—",hint:L?L.value+" teachers in class":"No sessions"}],this.attention=[{label:"Teachers Not Active",icon:"teacher",value:this.inactiveTeachers.length,hint:"Eligible teachers with no session today"},{label:"Classrooms Not Used",icon:"room",value:this.idleRooms.length,hint:"Installed classrooms with no session today"},{label:"Sessions Under 5 Min",icon:"clock",value:p.filter((function(e){return e.end-e.start<3e5})).length,hint:"May be accidental log-ins"},{label:"Sessions Without Content",icon:"book",value:p.filter((function(e){return 0===e.resources.length})).length,hint:"Logged in but nothing was used"}],this.countUp()},e.prototype.buildDonut=function(e,t){var i=this,n=b(e).sort((function(e,t){return t.value-e.value})),a=n.slice(0,t),r=n.slice(t).reduce((function(e,t){return e+t.value}),0);r>0&&a.push({label:"Other",value:r});var o=a.reduce((function(e,t){return e+t.value}),0),s=2*Math.PI*this.donutRadius,l=0,d=a.map((function(e,t){var n=o?e.value/o*s:0,a=Object.assign(Object.assign({},e),{display:i.formatDuration(e.value),percent:o?Math.round(e.value/o*100):0,color:"Other"===e.label?"#c9d2e3":i.color(t),dash:Math.max(n-2,0)+" "+s,offset:-l});return l+=n,a}));return{total:this.formatDuration(o),segments:d}},e.prototype.utilisationColor=function(e,t){void 0===t&&(t=!1);var i=[{at:0,h:4,s:82,l:74},{at:.5,h:43,s:90,l:62},{at:1,h:88,s:45,l:56}],n=Math.min(Math.max(e,0),1),a=v(n<=.5?[i[0],i[1]]:[i[1],i[2]],2),r=a[0],o=a[1],s=(n-r.at)/(o.at-r.at),l=function(e,t){return Math.round(e+(t-e)*s)},d=l(r.l,o.l)+(t?12:0);return"hsl("+l(r.h,o.h)+", "+l(r.s,o.s)+"%, "+d+"%)"},e.prototype.navyShade=function(e){var t=[22,43,87],i=Math.pow(Math.min(Math.max(e,0),1),1.8),n=[234,241,251].map((function(e,n){return Math.round(e+(t[n]-e)*i)}));return"rgb("+n[0]+", "+n[1]+", "+n[2]+")"},e.prototype.shortGrade=function(e){var t=/^class\s+(.+)$/i.exec(e);return t?t[1]:e.split(/\s+/).filter((function(e){return e})).map((function(e){return e.charAt(0).toUpperCase()})).join("").slice(0,4)},Object.defineProperty(e.prototype,"activityNote",{get:function(){if(!this.hourly.length)return"";var e=this.hourly.reduce((function(e,t){return t.value>e.value?t:e})),t=this.hourly.reduce((function(e,t){return t.value<e.value?t:e}));return"Busiest at "+e.label+" with "+e.value+" teachers in class; quietest at "+t.label+" with "+t.value+"."},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"chaptersNote",{get:function(){var e=this.chapters[0];return e?"Most used: "+e.label+(e.sub?" ("+e.sub+")":"")+", "+e.display+".":""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subjectNote",{get:function(){var e=this.subjectDonut.segments.find((function(e){return"Other"!==e.label}));return e?e.label+" took the largest share of teaching time today ("+e.percent+"%, "+e.display+").":""},enumerable:!1,configurable:!0}),e.prototype.countUp=function(){var e=this;cancelAnimationFrame(this.countFrame);var t=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=function(t){e.kpis.forEach((function(e){return e.shown=e.value.replace(/\d+/g,(function(e){return""+Math.round(+e*t)}))})),e.attention.forEach((function(e){return e.shown=Math.round(e.value*t)}))};if(t)i(1);else{var n=performance.now(),a=function(t){var r=Math.min((t-n)/900,1);i(1-Math.pow(1-r,3)),r<1&&(e.countFrame=requestAnimationFrame(a))};i(0),this.countFrame=requestAnimationFrame(a)}},e.prototype.closeDetails=function(){this.detailsOpen=!1},e.prototype.initials=function(e){var t=(e||"").split(/\s+/).filter((function(e){return e&&!/^(mr|mrs|miss|ms|dr)\.?$/i.test(e)}));return t.length?(t[0][0]+(t.length>1?t[t.length-1][0]:"")).toUpperCase():"?"},e.prototype.downloadPdf=function(){return f(this,void 0,void 0,(function(){var e,t,i,n,a,r;return g(this,(function(o){switch(o.label){case 0:if(!(e=this.host.nativeElement.querySelector(".in-page"))||this.isExporting)return[2];this.isExporting=!0,(t=document.createElement("div")).setAttribute("data-pdf-wrapper",""),t.style.cssText="position:fixed;left:0;top:0;width:0;height:0;overflow:hidden;z-index:-1;",(i=e.cloneNode(!0)).classList.add("in-exporting"),i.style.width="1280px",t.appendChild(i),e.parentElement.appendChild(t),o.label=1;case 1:return o.trys.push([1,,3,4]),n=i.getBoundingClientRect().top,a=Array.from(i.querySelectorAll(".in-card")).map((function(e){return Math.round(e.getBoundingClientRect().top-n-8)})).filter((function(e,t,i){return e>0&&i.indexOf(e)===t})).sort((function(e,t){return e-t})),[4,p.default(i,{scale:2,backgroundColor:"#ffffff",onclone:function(e){var t=e.querySelector("[data-pdf-wrapper]");t&&(t.style.overflow="visible")}})];case 2:return r=o.sent(),this.savePdf(r,a.map((function(e){return 2*e}))),[3,4];case 3:return t.remove(),this.isExporting=!1,[7];case 4:return[2]}}))}))},e.prototype.savePdf=function(e,t){for(var i=this,n=new d.jsPDF({orientation:"portrait",unit:"mm",format:"a4"}),a=10,r=n.internal.pageSize.getWidth(),o=n.internal.pageSize.getHeight(),s=r-20,l=s/e.width,c=Math.floor((o-20-6)/l),p=[],u=0,h=function(){var i=Math.min(u+c,e.height);if(i<e.height){var n=t.filter((function(e){return e>u&&e<=i}));n.length&&(i=n[n.length-1])}p.push([u,i]),u=i};u<e.height;)h();p.forEach((function(t,d){var c=v(t,2),u=c[0],h=c[1],m=document.createElement("canvas");m.width=e.width,m.height=h-u,m.getContext("2d").drawImage(e,0,u,e.width,h-u,0,0,e.width,h-u),d>0&&n.addPage(),n.addImage(m.toDataURL("image/jpeg",.92),"JPEG",a,a,s,m.height*l),n.setFontSize(8),n.setTextColor(140),n.text(i.schoolName+" · Usage insights",a,o-5),n.text("Page "+(d+1)+" of "+p.length,r-a,o-5,{align:"right"})})),n.save("Insights-"+(this.fileDate||"report")+".pdf")},e.prototype.list=function(e,t,i){var n=e&&e[t]&&e[t][i];return Array.isArray(n)?n:[]},e.prototype.location=function(e){try{return("string"==typeof e?JSON.parse(e):e||{}).location||""}catch(e){return""}},e.prototype.parseTime=function(e){return e?new Date(String(e).replace(" ","T")).getTime():NaN},e.prototype.title=function(e){return(e&&e.title?String(e.title):"").trim()},e.prototype.typeLabel=function(e){if(!e)return"Other";var t=this.pdService.getDisplaytypeValue(e);if(t!==e)return t;var i=e.replace(/^c?asset_/,"").replace(/_/g," ");return i.charAt(0).toUpperCase()+i.slice(1)},e.prototype.userName=function(e,t){return e?this.pdService.getName(e):t},e.prototype.groupTime=function(e,t){var i=this,n=new Map;e.forEach((function(e){var i=t(e);n.set(i,(n.get(i)||[]).concat({start:e.start,end:e.end}))}));var a=new Map;return n.forEach((function(e,t){return a.set(t,i.mergedDuration(e))})),a},e.prototype.mergedDuration=function(e){var t=b(e).sort((function(e,t){return e.start-t.start})),i=0,n=null;return t.forEach((function(e){!n||e.start>n.end?(n&&(i+=n.end-n.start),n=Object.assign({},e)):e.end>n.end&&(n.end=e.end)})),n?i+n.end-n.start:i},e.prototype.countBy=function(e,t){var i=new Map;return e.forEach((function(e){return i.set(t(e),(i.get(t(e))||0)+1)})),i},e.prototype.share=function(e,t,i){var n=Array.from(new Set(t.filter((function(e){return e}))));n.forEach((function(t){return e.set(t,(e.get(t)||0)+i/n.length)}))},e.prototype.entries=function(e){return Array.from(e.entries()).map((function(e){var t=v(e,2);return{label:t[0],value:t[1]}}))},e.prototype.toBars=function(e,t,i,n){void 0===n&&(n=!0);var a=n?b(e).sort((function(e,t){return t.value-e.value})):e,r=i?a.slice(0,i):a,o=Math.max.apply(Math,b(r.map((function(e){return e.value})),[1]));return r.map((function(e){return Object.assign(Object.assign({},e),{display:t(e.value),percent:e.value/o*100})}))},e.prototype.color=function(e){var t=["#7c9cf5","#f6d27e","#a9bffa","#6fc6ba","#f4a98a","#c0aef7","#f3a6c8","#b4bfcf","#fbe7b4"];return t[e%t.length]},e.prototype.pct=function(e,t){return t?Math.round(e/t*100)+"%":"0%"},e.prototype.formatHour=function(e){var t=e.getHours();return(t%12||12)+" "+(t>=12?"PM":"AM")},e.prototype.formatDuration=function(e){var t=Math.round(e/S),i=Math.floor(t/60),n=t%60;return i?i+"h "+n+"m":n+"m"},e}();I.decorators=[{type:t.Component,args:[{selector:"lib-insights",template:'<div class="in-page">\n \x3c!-- title and headline numbers stay in view while the cards below scroll --\x3e\n <div class="in-sticky">\n <div class="in-heading">\n <div class="in-heading-text">{{ schoolName }}<span *ngIf="schoolName && dayLabel"> · </span>{{ dayLabel }}</div>\n <button\n type="button"\n class="in-pdf-btn"\n *ngIf="hasSessions"\n data-html2canvas-ignore="true"\n [disabled]="isExporting"\n (click)="downloadPdf()"\n >{{ isExporting ? \'Preparing PDF…\' : \'Download PDF\' }}</button>\n </div>\n\n <div class="in-kpis" *ngIf="hasSessions">\n <div class="in-kpi in-anim" *ngFor="let kpi of kpis; let i = index; let last = last" [class.in-kpi-accent]="last" [style.animation-delay.ms]="i * 60">\n <span class="in-kpi-icon">\n <svg viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2.5 7.5l5-5M3.5 2.5h4v4" /></svg>\n </span>\n <div class="in-kpi-label">{{ kpi.label }}</div>\n <div class="in-kpi-value">{{ kpi.shown || kpi.value }}</div>\n <div class="in-kpi-hint">{{ kpi.hint }}</div>\n </div>\n </div>\n </div>\n\n <div class="in-empty" *ngIf="!hasSessions">No usage was recorded on this day.</div>\n\n <ng-container *ngIf="hasSessions">\n\n \x3c!-- primary: what to act on, and who is using the system --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="120" class="in-anim in-card in-wide in-primary">\n <div class="in-card-title">Needs Attention</div>\n <div class="in-card-sub">Who and what to follow up on today</div>\n <div class="in-attention">\n <div class="in-attention-item in-anim-row" *ngFor="let a of attention; let i = index" [style.animation-delay.ms]="300 + i * 80">\n <div class="in-attention-value" [class.in-zero]="a.value === 0">{{ a.shown != null ? a.shown : a.value }}</div>\n <div>\n <div class="in-attention-label">\n <span class="in-inline-icon" [ngSwitch]="a.icon" aria-hidden="true">\n <svg *ngSwitchCase="\'teacher\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n <svg *ngSwitchCase="\'room\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8M7 9h6" /></svg>\n <svg *ngSwitchCase="\'clock\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></svg>\n <svg *ngSwitchCase="\'book\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z" /><path d="M4 19a2 2 0 0 1 2-2h13" /></svg>\n </span>\n {{ a.label }}\n </div>\n <div class="in-muted">{{ a.hint }}</div>\n </div>\n </div>\n </div>\n \x3c!-- who to follow up: big tiles that shrink to slim bars when the lists open below (accordion) --\x3e\n <div class="in-follow" [class.in-follow-compact]="detailsOpen">\n <button type="button" class="in-follow-tile in-follow-teachers" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n <span class="in-follow-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n </span>\n <span class="in-follow-number">{{ attention[0]?.shown != null ? attention[0].shown : inactiveTeachers.length }}</span>\n <span class="in-follow-label-big">Teachers Not Active</span>\n <span class="in-muted">of {{ eligibleCount }} eligible teachers</span>\n <span class="in-avatars" *ngIf="inactiveTeachers.length">\n <span class="in-avatar" *ngFor="let name of inactiveTeachers.slice(0, 7)" [title]="name">{{ initials(name) }}</span>\n <span class="in-avatar in-avatar-more" *ngIf="inactiveTeachers.length > 7">+{{ inactiveTeachers.length - 7 }}</span>\n </span>\n </button>\n <button type="button" class="in-follow-tile in-follow-rooms" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n <span class="in-follow-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8M7 9h6" /></svg>\n </span>\n <span class="in-follow-number">{{ attention[1]?.shown != null ? attention[1].shown : idleRooms.length }}</span>\n <span class="in-follow-label-big">Classrooms Not Used</span>\n <span class="in-muted">of {{ classroomCount }} installed classrooms</span>\n <span class="in-room-chips" *ngIf="idleRooms.length">\n <span class="in-room-chip" *ngFor="let room of idleRooms.slice(0, 6)">{{ room }}</span>\n <span class="in-room-chip in-avatar-more" *ngIf="idleRooms.length > 6">+{{ idleRooms.length - 6 }}</span>\n </span>\n </button>\n </div>\n <div class="in-follow-details" id="in-follow-details" *ngIf="detailsOpen">\n <ng-container *ngTemplateOutlet="followLists"></ng-container>\n </div>\n <div class="in-follow-foot" data-html2canvas-ignore="true">\n <button type="button" class="in-link-btn" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n {{ detailsOpen ? \'Hide details\' : \'Show details\' }}\n <span class="in-link-chevron" [class.in-link-chevron-up]="detailsOpen" aria-hidden="true"></span>\n </button>\n </div>\n \x3c!-- the PDF can\'t open a modal, so it prints the full lists here instead --\x3e\n <div class="in-print-only">\n <ng-container *ngTemplateOutlet="followLists"></ng-container>\n </div>\n </section>\n <section [style.animation-delay.ms]="180" class="in-anim in-card">\n <div class="in-card-title">Most Active Teachers</div>\n <div class="in-card-sub">Time in class, overlapping sessions counted once</div>\n <ng-container *ngTemplateOutlet="bars; context: { $implicit: topTeachers, color: \'#8BC34A\' }"></ng-container>\n </section>\n </div>\n\n \x3c!-- supporting detail --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="240" class="in-anim in-card">\n <div class="in-card-title">Activity Through the Day</div>\n <div class="in-card-sub">Number of teachers in a session during each hour</div>\n <div class="in-hours">\n <div class="in-hour" *ngFor="let h of hourly; let i = index" [title]="h.label + \': \' + h.value + \' teachers\'">\n <div class="in-hour-value">\n <svg class="in-hour-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n {{ h.value }}\n </div>\n <div class="in-hour-track">\n <div class="in-hour-bar" [class.in-peak]="h.peak" [style.height.%]="h.percent" [style.background-color]="h.color" [style.animation-delay.ms]="250 + i * 50"></div>\n </div>\n <div class="in-hour-label">{{ h.label }}</div>\n </div>\n </div>\n <div class="in-util-legend">\n <span class="in-muted">Low</span>\n <span class="in-util-scale"></span>\n <span class="in-muted">High</span>\n </div>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="activityNote">{{ activityNote }}</div>\n <div>Each column counts the teachers who were in a session at any point in that hour. Colour runs from red (quiet) to green (busiest hour).</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="300" class="in-anim in-card">\n <div class="in-card-title">Most Used Chapters</div>\n <div class="in-card-sub">Chapters and their topics used today</div>\n <ng-container *ngTemplateOutlet="bars; context: { $implicit: chapters, color: \'#f4a98a\' }"></ng-container>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="chaptersNote">{{ chaptersNote }}</div>\n <div>Counts how many times each chapter, or a topic inside it, was opened in class today. Bars are relative to the most used chapter.</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="360" class="in-anim in-card">\n <div class="in-card-title">Content Utilisation</div>\n <div class="in-card-sub">What teachers used in class</div>\n <div class="in-stack">\n <div\n class="in-stack-part"\n *ngFor="let c of contentMix; let i = index"\n [style.animation-delay.ms]="300 + i * 60"\n [style.width.%]="c.percent"\n [style.background-color]="c.color"\n [title]="c.label + \': \' + c.display"\n ></div>\n </div>\n <div class="in-legend">\n <div class="in-legend-item" *ngFor="let c of contentMix">\n <span class="in-dot" [style.background-color]="c.color"></span>\n <span class="in-legend-label">{{ c.label }}</span>\n <span class="in-legend-value">{{ c.display }}</span>\n </div>\n </div>\n </section>\n </div>\n\n \x3c!-- what was taught, and where --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="420" class="in-anim in-card">\n <div class="in-card-title">Time by Subject</div>\n <div class="in-card-sub">Share of session time by subject</div>\n <div class="in-donut-wrap">\n <svg class="in-donut" viewBox="0 0 140 140" role="img" aria-label="Time by subject">\n <circle cx="70" cy="70" [attr.r]="donutRadius" class="in-donut-track"></circle>\n <circle\n *ngFor="let s of subjectDonut.segments; let i = index"\n class="in-donut-seg"\n cx="70"\n cy="70"\n [attr.r]="donutRadius"\n [attr.stroke]="s.color"\n [attr.stroke-dasharray]="s.dash"\n [attr.stroke-dashoffset]="s.offset"\n [style.animation-delay.ms]="300 + i * 90"\n >\n <title>{{ s.label }}: {{ s.display }} ({{ s.percent }}%)</title>\n </circle>\n </svg>\n <div class="in-donut-center">\n <div class="in-donut-total">{{ subjectDonut.total }}</div>\n <div class="in-muted" title="Session time where content was used">with content</div>\n </div>\n </div>\n <div class="in-legend in-legend-compact">\n <div class="in-legend-item" *ngFor="let s of subjectDonut.segments">\n <span class="in-dot" [style.background-color]="s.color"></span>\n <span class="in-legend-label" [title]="s.label">{{ s.label }}</span>\n <span class="in-legend-value">{{ s.percent }}%</span>\n </div>\n </div>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="subjectNote">{{ subjectNote }}</div>\n <div>Each session\'s time is split equally across the subjects opened in it. Sessions where nothing was opened have no subject, so this total is lower than Teaching Time.</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="480" class="in-anim in-card">\n <div class="in-card-title">Classroom Usage</div>\n <div class="in-card-sub">Each classroom\'s utilisation by time</div>\n <div class="in-tiles">\n <div\n class="in-tile"\n *ngFor="let r of roomTiles; let i = index"\n [class.in-tile-idle]="r.idle"\n [class.in-tile-dark]="r.dark"\n [style.grid-column]="\'span \' + r.span"\n [style.background-color]="r.shade"\n [style.animation-delay.ms]="300 + i * 15"\n [title]="r.label + \': \' + r.display"\n >\n <span class="in-tile-name">\n <svg class="in-tile-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8" /></svg>{{ r.label }}\n </span>\n <span class="in-tile-value">{{ r.share }}%</span>\n </div>\n </div>\n <div class="in-tiles-legend">\n <span class="in-tile in-tile-key in-tile-idle"></span><span class="in-muted">0% / not used</span>\n <span class="in-scale"></span><span class="in-muted">Low → high utilisation</span>\n </div>\n </section>\n <section [style.animation-delay.ms]="540" class="in-anim in-card">\n <div class="in-card-title">Time by Class</div>\n <div class="in-card-sub">Session time per class</div>\n <div class="in-columns">\n <div class="in-column" *ngFor="let g of gradeColumns; let i = index" [title]="g.label + \': \' + g.display">\n <div class="in-column-track">\n <div class="in-column-bar" [style.height.%]="g.percent" [style.animation-delay.ms]="300 + i * 50"></div>\n </div>\n <div class="in-column-label">{{ g.short }}</div>\n </div>\n </div>\n <div class="in-columns-caption">Class</div>\n <div class="in-column-top" *ngIf="gradeColumns.length">\n <span class="in-muted">Most time</span>\n <ng-container *ngFor="let g of gradeColumns">\n <strong *ngIf="g.percent === 100">{{ g.label }} · {{ g.display }}</strong>\n </ng-container>\n </div>\n </section>\n </div>\n </ng-container>\n\n</div>\n\n<ng-template #followLists>\n <div class="in-follow-cols">\n <div class="in-follow-col">\n <div class="in-follow-label">Teachers Not Active <span class="in-count">{{ inactiveTeachers.length }}</span></div>\n <ul class="in-name-list" *ngIf="inactiveTeachers.length">\n <li *ngFor="let name of inactiveTeachers">{{ name }}</li>\n </ul>\n <span class="in-muted" *ngIf="inactiveTeachers.length === 0">Every eligible teacher used the system today.</span>\n </div>\n <div class="in-follow-col">\n <div class="in-follow-label">Classrooms Not Used <span class="in-count">{{ idleRooms.length }}</span></div>\n <ul class="in-name-list in-room-list" *ngIf="idleRooms.length">\n <li *ngFor="let room of idleRooms">{{ room }}</li>\n </ul>\n <span class="in-muted" *ngIf="idleRooms.length === 0">Every classroom was used today.</span>\n </div>\n </div>\n</ng-template>\n\n\x3c!-- each section passes its own bar colour so neighbouring cards are easy to tell apart --\x3e\n<ng-template #bars let-items let-color="color">\n <div class="in-bars">\n <div class="in-muted" *ngIf="items.length === 0">No data</div>\n <div class="in-bar-row" *ngFor="let item of items; let i = index">\n <div class="in-bar-head">\n <span class="in-bar-label" [title]="item.label">{{ item.label }}</span>\n <span class="in-bar-value">{{ item.display }}</span>\n </div>\n <div class="in-bar-sub" *ngIf="item.sub">{{ item.sub }}</div>\n <div class="in-bar-track"><div class="in-bar-fill" [style.width.%]="item.percent" [style.background-color]="color" [style.animation-delay.ms]="300 + i * 60"></div></div>\n </div>\n </div>\n</ng-template>\n',styles:['@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");.in-page{font-family:Poppins,Segoe UI,Arial,sans-serif;font-size:13px;color:#1e2437;padding:0 20px 24px;box-sizing:border-box;text-align:left;overflow-y:auto;background:#eef2f9}.in-sticky{position:sticky;top:0;z-index:2;margin:0 -20px 16px;padding:16px 20px;background:#eef2f9;box-shadow:0 6px 12px -10px rgba(30,36,55,.25)}.in-heading{position:relative;margin-bottom:14px;min-height:34px;display:flex;align-items:center;justify-content:center}.in-heading-text{font-size:17px;font-weight:600;color:#1e2437;text-align:center;padding:0 150px}.in-pdf-btn{position:absolute;right:0;top:50%;transform:translateY(-50%);height:34px;padding:0 16px;border:none;border-radius:10px;background:#5b84ec;color:#fff;font:500 13px Poppins,Segoe UI,Arial,sans-serif;cursor:pointer;box-shadow:0 4px 10px rgba(91,132,236,.22)}.in-pdf-btn:hover:not([disabled]){background:#406fe9}.in-pdf-btn[disabled]{cursor:progress;background:#b3c6f5;box-shadow:none}.in-page.in-exporting{height:auto!important;overflow:visible}.in-page.in-exporting *,.in-page.in-exporting :after,.in-page.in-exporting :before{-webkit-animation:none!important;animation:none!important}.in-page.in-exporting .in-sticky{position:static;box-shadow:none}.in-page.in-exporting .in-chips{max-height:none;overflow:visible}.in-page.in-exporting .in-print-only{display:block}.in-page.in-exporting .in-follow-details{display:none}.in-card-sub,.in-muted{font-size:12px;color:#8a93a6}.in-empty{padding:40px;text-align:center;color:#8a93a6}.in-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.in-kpi{position:relative;min-width:0;padding:12px 14px;border-radius:14px;background:#fff;box-shadow:0 1px 3px rgba(30,36,55,.06);color:#1e2437;box-sizing:border-box}.in-kpi.in-kpi-accent{background:#5b84ec;color:#fff}.in-kpi.in-kpi-accent .in-kpi-hint,.in-kpi.in-kpi-accent .in-kpi-label{color:hsla(0,0%,100%,.85)}.in-kpi.in-kpi-accent .in-kpi-icon{border-color:#fff;color:#fff}.in-kpi-icon{position:absolute;top:12px;right:12px;width:20px;height:20px;border:2px solid #1e2437;border-radius:50%;box-sizing:border-box;display:flex;align-items:center;justify-content:center;color:#1e2437}.in-kpi-icon svg{width:10px;height:10px}.in-kpi-label{padding-right:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;font-weight:500;color:rgba(30,36,55,.75)}.in-kpi-value{white-space:nowrap;font-size:22px;font-weight:700;margin:2px 0;font-variant-numeric:tabular-nums}.in-kpi-hint{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px;color:rgba(30,36,55,.7)}.in-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.in-grid+.in-grid{margin-top:16px}.in-card{background:#fff;border-radius:16px;box-shadow:0 1px 3px rgba(30,36,55,.06);padding:18px 20px;min-width:0;box-sizing:border-box}.in-card,.in-wide{display:flex;flex-direction:column}.in-wide{grid-column:span 2}.in-card-note{margin-top:auto;padding-top:14px;border-top:1px solid #eef1f6;display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:1.45;color:#8a93a6}.in-note-icon{flex:0 0 auto;width:15px;height:15px;margin-top:1px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}.in-note-insight{color:#1e2437;font-weight:500;margin-bottom:2px}.in-card-title{font-size:16px;font-weight:600;color:#1e2437}.in-card-sub{margin:2px 0 16px}.in-count{display:inline-block;min-width:22px;padding:0 8px;margin-left:6px;border-radius:11px;background:#fff6de;color:#a46b00;font-size:12px;font-weight:600;text-align:center;line-height:22px;vertical-align:middle}.in-hours{flex:1 1 auto;display:flex;align-items:stretch;gap:4px;min-height:200px;max-height:320px}.in-hour{flex:1 1 0;flex-direction:column;min-width:0}.in-hour,.in-hour-value{display:flex;align-items:center}.in-hour-value{gap:3px;font-size:12px;font-weight:600;color:#1e2437;margin-bottom:6px;white-space:nowrap}.in-hour-icon{width:12px;height:12px;color:#8a93a6;flex:0 0 auto}.in-hour-track{flex:1 1 auto;max-width:44px;display:flex;align-items:flex-end;background:#f1f4f9;overflow:hidden}.in-hour-bar,.in-hour-track{width:100%;border-radius:999px}.in-hour-bar{min-height:6px;background:#fbe0a0}.in-util-legend{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px}.in-util-scale{width:90px;height:8px;border-radius:999px;background:linear-gradient(90deg,#f38e86,#f5c447,#92c15c)}.in-hour-label{margin-top:8px;font-size:10px;color:#8a93a6;white-space:nowrap}.in-bars{display:flex;flex-direction:column;gap:12px}.in-bar-head{display:flex;justify-content:space-between;gap:12px}.in-bar-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.in-bar-value{flex:0 0 auto;color:#1e2437;font-weight:600;font-variant-numeric:tabular-nums}.in-bar-sub{font-size:11px;color:#8a93a6}.in-bar-track{height:8px;margin-top:6px;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-bar-fill{height:100%;border-radius:999px;background:#5b84ec}.in-donut-wrap{position:relative;width:150px;height:150px;margin:0 auto 14px}.in-donut{width:100%;height:100%;transform:rotate(-90deg)}.in-donut circle{fill:none;stroke-width:18}.in-donut-track{stroke:#f1f4f9}.in-donut-seg{stroke-linecap:butt;transition:stroke-width .15s;-webkit-animation:in-draw 1s cubic-bezier(.22,1,.36,1) both;animation:in-draw 1s cubic-bezier(.22,1,.36,1) both}.in-donut-seg:hover{stroke-width:22}@-webkit-keyframes in-draw{0%{stroke-dasharray:0 400}}@keyframes in-draw{0%{stroke-dasharray:0 400}}.in-donut-center{position:absolute;inset:0;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}.in-donut-total{font-size:18px;font-weight:700}.in-legend-compact{gap:6px}.in-legend-compact .in-legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.in-columns{flex:1 1 auto;display:flex;align-items:stretch;gap:5px;min-height:180px;max-height:340px}.in-column{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center}.in-column-track{flex:1 1 auto;width:100%;max-width:22px;display:flex;align-items:flex-end;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-column-bar{width:100%;min-height:4px;border-radius:999px;background:#f3cb6c;-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}.in-column:hover .in-column-bar{background:#f0be46}.in-column-label{margin-top:6px;font-size:11px;font-weight:500;color:#8a93a6;white-space:nowrap}.in-columns-caption{text-align:center;font-size:11px;color:#8a93a6;margin-top:2px}.in-column-top{margin-top:14px;padding:10px 12px;border-radius:10px;background:#fff6de;display:flex;justify-content:space-between;gap:8px;font-size:12px}.in-tiles{display:grid;grid-auto-flow:row dense;grid-template-columns:repeat(auto-fill,minmax(58px,1fr));gap:8px}.in-tile{height:58px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#162b57;cursor:default;-webkit-animation:in-pop .4s ease-out both;animation:in-pop .4s ease-out both;transition:transform .12s}.in-tile:hover{transform:scale(1.06)}.in-tile.in-tile-dark{color:#fff}.in-tile.in-tile-idle{background:#f4f7fd;border:2px solid #162b57;color:#162b57}@-webkit-keyframes in-pop{0%{opacity:0;transform:scale(.7)}}@keyframes in-pop{0%{opacity:0;transform:scale(.7)}}.in-tile-icon{width:13px;height:13px;margin-right:4px;vertical-align:-1px}.in-tile-name{max-width:100%;padding:0 4px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;font-weight:700}.in-tile-value{font-size:12px;font-weight:500;opacity:.85}.in-tiles-legend{display:flex;align-items:center;gap:6px;margin-top:14px;flex-wrap:wrap}.in-tiles-legend .in-tile-key{width:14px;height:14px;border-radius:4px;-webkit-animation:none;animation:none}.in-scale{width:46px;height:10px;margin-left:8px;border-radius:999px;background:linear-gradient(90deg,#eaf1fb,#162b57)}.in-primary .in-attention{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.in-primary .in-attention-item{gap:14px;padding:12px 14px}.in-primary .in-attention-value{flex:0 0 42px;height:42px;line-height:42px;border-radius:10px;background:#ef6a3a;color:#fff;font-size:16px}.in-primary .in-attention-value.in-zero{background:#8bc34a;color:#fff}.in-primary .in-attention-label{display:flex;align-items:center;gap:6px;font-size:14px}.in-primary .in-attention-item .in-muted{font-size:12px;margin-top:2px}.in-inline-icon{display:inline-flex;color:#ef6a3a}.in-inline-icon svg{width:16px;height:16px}.in-follow{flex:1 1 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:18px}.in-follow-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;padding:18px 20px;border:none;border-radius:32px;font:inherit;color:inherit;text-align:center;cursor:pointer;transition:transform .15s,box-shadow .15s}.in-follow-tile:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(30,36,55,.08)}.in-follow-teachers{background:#eaf0fd}.in-follow-teachers .in-follow-icon{color:#5b84ec}.in-follow-rooms{background:#eaf0fd}.in-follow-rooms .in-follow-icon{color:#5b84ec}.in-follow-icon{margin-bottom:6px;display:flex;align-items:center;justify-content:center}.in-follow-icon svg{width:40px;height:40px}.in-follow-number{font-size:34px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}.in-follow-tile>.in-muted{font-size:15px;color:#1e2437}.in-follow-label-big{font-size:18px;font-weight:600}.in-avatars{flex-wrap:wrap;margin-top:12px;padding-left:8px}.in-avatar,.in-avatars{display:flex;justify-content:center}.in-avatar{width:34px;height:34px;margin-left:-6px;border-radius:50%;border:1.5px solid #5b84ec;background:#fff;color:#3f5fae;font-size:11px;font-weight:600;align-items:center;box-sizing:border-box}.in-avatar-more{background:#5b84ec;color:#fff}.in-room-chips{flex-wrap:wrap;gap:6px;margin-top:12px}.in-room-chip,.in-room-chips{display:flex;justify-content:center}.in-room-chip{min-width:34px;height:34px;padding:0 10px;border-radius:999px;border:1.5px solid #5b84ec;background:#fff;color:#5b84ec;font-size:12px;font-weight:600;align-items:center;box-sizing:border-box}.in-room-chip.in-avatar-more{background:#5b84ec;color:#fff}.in-follow-foot{display:flex;justify-content:flex-end;margin-top:10px}.in-link-btn{border:none;background:transparent;padding:6px 4px;font:600 13px Poppins,Segoe UI,Arial,sans-serif;color:#5b84ec;cursor:pointer}.in-link-btn:hover{text-decoration:underline}.in-print-only{display:none;margin-top:16px}.in-follow-compact{flex:none}.in-follow-compact .in-follow-tile{flex-direction:row;justify-content:flex-start;gap:12px;padding:10px 16px;text-align:left}.in-follow-compact .in-follow-icon{margin:0}.in-follow-compact .in-follow-icon svg{width:24px;height:24px}.in-follow-compact .in-follow-number{font-size:22px}.in-follow-compact .in-avatars,.in-follow-compact .in-follow-tile>.in-muted,.in-follow-compact .in-room-chips{display:none}.in-follow-details{flex:none;margin-top:12px;padding:14px 16px;border:1px solid #eef1f6;border-radius:12px;-webkit-animation:in-rise .3s ease-out both;animation:in-rise .3s ease-out both}.in-link-chevron{display:inline-block;width:6px;height:6px;margin-left:6px;border-right:2px solid;border-bottom:2px solid;transform:rotate(45deg) translateY(-2px);transition:transform .2s}.in-link-chevron.in-link-chevron-up{transform:rotate(-135deg) translateY(-1px)}.in-follow-cols{display:grid;grid-template-columns:3fr 1fr;gap:24px}.in-follow-col{min-width:0}.in-follow-col+.in-follow-col{border-left:1px solid #e3e8f0;padding-left:24px}.in-follow-label{font-size:13px;font-weight:600;margin:2px 0 10px}.in-name-list{margin:0;padding:0;list-style:none;-moz-column-width:160px;column-width:160px;-moz-column-gap:20px;column-gap:20px}.in-name-list li{position:relative;padding:3px 0 3px 14px;-moz-column-break-inside:avoid;break-inside:avoid;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.in-name-list li:before{content:"";position:absolute;left:0;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:#a9bffa}.in-room-list li:before{background:#fbe0a0}.in-attention{display:flex;flex-direction:column;gap:10px}.in-attention-item{display:flex;align-items:center;gap:12px;padding:8px;border-radius:12px;background:#f7f9fc}.in-attention-value{flex:0 0 44px;height:40px;line-height:40px;text-align:center;border-radius:10px;background:#fbe0a0;color:#1e2437;font-size:16px;font-weight:700}.in-attention-value.in-zero{background:#eaf0fd;color:#5b84ec}.in-attention-label{font-weight:600}.in-stack{display:flex;height:14px;border-radius:999px;overflow:hidden;background:#f1f4f9;margin-bottom:16px}.in-stack-part{height:100%;box-shadow:inset -2px 0 0 #fff}.in-legend{display:flex;flex-direction:column;gap:8px}.in-legend-item{display:flex;align-items:center;gap:10px}.in-dot{flex:0 0 auto;width:10px;height:10px;border-radius:3px}.in-legend-label{flex:1 1 auto}.in-legend-value{font-weight:600;color:#1e2437;font-variant-numeric:tabular-nums}.in-chips{display:flex;flex-wrap:wrap;gap:8px;max-height:230px;overflow:auto}.in-chip{padding:5px 12px;border-radius:999px;background:#eaf0fd;color:#3f5fae;font-size:12px;font-weight:500}@-webkit-keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@-webkit-keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@-webkit-keyframes in-grow-width{0%{width:0}}@keyframes in-grow-width{0%{width:0}}@-webkit-keyframes in-grow-height{0%{height:0}}@keyframes in-grow-height{0%{height:0}}.in-anim{-webkit-animation:in-rise .5s cubic-bezier(.22,1,.36,1) both;animation:in-rise .5s cubic-bezier(.22,1,.36,1) both}.in-anim-row{-webkit-animation:in-fade-right .45s ease-out both;animation:in-fade-right .45s ease-out both}.in-bar-fill,.in-stack-part{-webkit-animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both;animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both}.in-hour-bar{-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}@media (prefers-reduced-motion:reduce){.in-anim,.in-anim-row,.in-bar-fill,.in-column-bar,.in-donut-seg,.in-hour-bar,.in-stack-part,.in-tile{-webkit-animation:none;animation:none}}@media (max-width:900px){.in-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:1100px){.in-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid>.in-card:last-child:nth-child(odd),.in-wide+.in-card{grid-column:span 2}}@media (max-width:760px){.in-heading-text{padding:0;text-align:left;flex:1 1 auto}.in-pdf-btn{position:static;transform:none}.in-grid>.in-card:last-child:nth-child(odd),.in-wide,.in-wide+.in-card{grid-column:auto}.in-follow,.in-follow-cols,.in-primary .in-attention{grid-template-columns:1fr}.in-follow-col+.in-follow-col{border-left:none;padding-left:0;border-top:1px solid #e3e8f0;padding-top:16px}.in-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid{grid-template-columns:1fr}}']}]}],I.ctorParameters=function(){return[{type:u},{type:t.ElementRef}]},I.propDecorators={data:[{type:t.Input}],fitHeight:[{type:t.HostListener,args:["window:resize"]}],closeDetails:[{type:t.HostListener,args:["document:keydown.escape"]}]};var U=function(){};U.decorators=[{type:t.NgModule,args:[{declarations:[m,y,x,D,T,h,C,k,A,I],imports:[o.CommonModule,n.GoogleChartsModule,s.DatepickerModule],exports:[h]}]}],e.PrincipalDashboardLibV2Component=h,e.PrincipalDashboardLibV2Module=U,e.PrincipalDashboardLibV2Service=u,e.ɵa=m,e.ɵb=y,e.ɵc=x,e.ɵd=D,e.ɵe=w,e.ɵf=T,e.ɵg=C,e.ɵh=k,e.ɵi=A,e.ɵj=I,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("angular-google-charts"),require("file-saver"),require("xlsx"),require("@angular/common"),require("ng2-datepicker"),require("html2canvas"),require("jspdf")):"function"==typeof define&&define.amd?define("principal-dashboard-lib-v2",["exports","@angular/core","rxjs","angular-google-charts","file-saver","xlsx","@angular/common","ng2-datepicker","html2canvas","jspdf"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["principal-dashboard-lib-v2"]={},e.ng.core,e.rxjs,e.angularGoogleCharts,e.FileSaver,e.XLSX,e.ng.common,e.ng2Datepicker,e.html2canvas,e.jspdf)}(this,(function(e,t,i,n,a,r,o,s,l,d){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=c(l),u=function(){function e(){this.isResoureMetaDataReady=new i.ReplaySubject,this.isResoureMetaDataReady$=this.isResoureMetaDataReady.asObservable(),this.isUserReqiuredDataReady=new i.ReplaySubject,this.isUserReqiuredDataReady$=this.isUserReqiuredDataReady.asObservable(),this.mychartType="",this.dataType="",this.userAllData="",this.userMetadata={userDetails:[],resourceDetails:[]},this.resoureMetadata=new Array,this.userDetailObject={},this.userlist=!1,this.chartType=new i.BehaviorSubject(this.mychartType),this.chartType$=this.chartType.asObservable(),this.isUserWise_data=new i.BehaviorSubject(!0),this.isUserWise_data$=this.isUserWise_data.asObservable(),this.isAllUsers=new i.BehaviorSubject(this.userlist),this.isAllUsers$=this.isAllUsers.asObservable(),this.detailedviewData=new i.BehaviorSubject(this.userMetadata),this.detailedviewData$=this.detailedviewData.asObservable(),this.isInsightsView=new i.BehaviorSubject(!1),this.isInsightsView$=this.isInsightsView.asObservable(),this.openSmallTable=new i.BehaviorSubject(!1),this.detailAccentColor="",this.detailRowRequest=null,this.openSmallTable$=this.openSmallTable.asObservable()}return e.prototype.parseData=function(e){if(!e)return null;if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){return console.error("principal-dashboard: could not parse data",e),null}},e.prototype.genarateResourseReqiuredData=function(e){this.isResoureMetaDataReady.next(!1);var t=new Array;if(e&&null!==e){var i=e.resourcesMetadata.resourceMetadata;if(null!=i&&i.length>0)for(var n=0;n<i.length;n++){var a={resouseID:i[n].resourceId,subject:null!=i[n].subject&&null!=i[n].subject.title?i[n].subject.title:"",grade:null!=i[n].grade&&null!=i[n].grade.title?i[n].grade.title:"",chapter:null!=i[n].chapter&&null!=i[n].chapter.title?i[n].chapter.title:"",teachingPoint:null!=i[n].teachingPoint&&null!=i[n].teachingPoint.title?i[n].teachingPoint.title:"",type:null!=i[n].type?this.getDisplaytypeValue(i[n].type):"",title:null!=i[n].title?i[n].title:""};t.push(a),this.resoureMetaData=t,this.isResoureMetaDataReady.next(!0)}}return t},e.prototype.getName=function(e){return/School Admin/gm.exec(e.role)?"Support Admin":e.fullName},e.prototype.genarateUserReqiuredData=function(e){this.isUserReqiuredDataReady.next(!1);var t=new Array,i=new Array,n=new Array,a=new Array;if(e&&null!==e){var r=e.usersConsole.userConsole,o=e.usersMetadata.userMetadata,s=e.schoolTerminals.schoolTerminal;if(null!=o&&o.length>0)for(var l=0;l<o.length;l++){var d={};""!=o[l].userId&&(d={userId:o[l].userId,userName:void 0!==o[l].fullName?this.getName(o[l]):"",userSubjects:void 0!==o[l].userSubjects?o[l].userSubjects:""},t.push(d))}for(var c=0;c<t.length;c++)t.forEach((function(e){t[c].userName===e.userName&&(i.push(t[c]),t.splice(c,1))}));for(c=0;c<i.length;c++)i[c].userName=i[c].userName,t.push(i[c]),this.usersMetaData=t;if(null!=s&&s.length>0)for(c=0;c<s.length;c++){var p,u=void 0,h=void 0,m=void 0,f=void 0;if(u=void 0!==s[c].schoolId?s[c].schoolId:"",h=void 0!==s[c].terminalKey?s[c].terminalKey:"",m=void 0!==s[c].terminalType?s[c].terminalType:"",void 0!==s[c].metadata)f=JSON.parse(s[c].metadata).location;else f="";p={schoolId:u,terminalKey:h,terminalType:m,location:f},n.push(p),this.schoolTerminalData=n}if(null!=r&&r.length>0)for(var g=function(e){var i=void 0,o=void 0,s=void 0,l=void 0,d=void 0,c=void 0,p=[],u=[],h=void 0,m=void 0,f=void 0,g=[];i=void 0!==r[e].userId?r[e].userId:"",o=void 0!==r[e].startTime?r[e].startTime:"",void 0!==r[e].endTime?(s=r[e].endTime,v.myEndTime=s):s="",void 0!==r[e].selectedDate&&r[e].selectedDate,l=void 0!==r[e].duration?r[e].duration:"",d=void 0!==r[e].terminalIP?r[e].terminalIP:"",null!=(c=void 0!==r[e].userConsoleResources?r[e].userConsoleResources:null)&&(void 0!==c.userConsoleResource?c.userConsoleResource.forEach((function(e){p.push(e.resourceId),u.push(e.duration),e.launchedFrom&&g.push(e.launchedFrom)})):(p=[],u=[],g=[]));for(var b=0;b<t.length;b++)i===t[b].userId&&(h=t[b].userName,m=t[b].userSubjects);for(var y=0;y<n.length;y++){if(d===n[y].terminalKey){f=n[y].location;break}f=""}void 0!==f&&"undefined"!==f||(f="");var x={userId:i,userName:h,startTime:new Date(o),endTime:new Date(s),terminalIP:d,resourceMetauserConsoleData:p,resourceDurationFromConsole:u,launchedFrom:g,duration:l,terminalLocation:f,userSubjects:m};a.push(x),v.userConsoleData=a,v.isUserReqiuredDataReady.next(!0)},v=this,b=0;b<r.length;b++)g(b)}return{usersMetadata:t,schoolTerminalData:n,userConsoleData:a}},e.prototype.userWiseChartData=function(){var e=new Array;if(e=[],this.userConsoleData&&this.userConsoleData.length>0)for(var t=0;t<this.userConsoleData.length;t++){void 0===typeof this.userConsoleData[t].userName&&(this.userConsoleData[t].userName=Math.floor(100*Math.random()).toString()),void 0===this.userConsoleData[t].userName&&(this.userConsoleData[t].userName="-");var i=[this.userConsoleData[t].userName,this.userConsoleData[t].startTime,this.userConsoleData[t].endTime];e.push(i)}return e},e.prototype.classRoomWiseChartData=function(){var e=new Array;if(e=[],this.userConsoleData)for(var t=0;t<this.userConsoleData.length;t++){var i=this.userConsoleData[t].terminalLocation,n=[this.getRoomLabel(i,this.userConsoleData[t].terminalIP),this.userConsoleData[t].startTime,this.userConsoleData[t].endTime];e.push(n)}return e},e.prototype.newGetCurrentClassroomData=function(){var e=new Array;if(e=[],this.userConsoleData)for(var t=0;t<this.userConsoleData.length;t++){var i=this.userConsoleData[t].terminalLocation+" - "+this.userConsoleData[t].terminalIP;e.push(i)}return e=this.uniq(e)},e.prototype.getRoomLabel=function(e,t){var i=null==e||"undefined"===e?"":String(e).trim();return""!==i?i:t||""},e.prototype.uniq=function(e){return Array.from(new Set(e))},e.prototype.allUserChartData=function(){var e=new Array;e=[];var t=new Array;if(t=[],this.userConsoleData&&this.usersMetaData){for(var i=void 0,n=void 0,a=void 0,r=new Array,o=0;o<this.userConsoleData.length;o++)r.push(this.userConsoleData[o]),t.push(this.userConsoleData[o]);for(var s=0;s<this.usersMetaData.length;s++){a=this.usersMetaData[s].userId,i=this.usersMetaData[s].userName,n=this.usersMetaData[s].userSubjects;var l={userId:a,userName:i,startTime:new Date(this.myEndTime),endTime:new Date(this.myEndTime),terminalIP:"",resourceMetauserConsoleData:[],duration:"0",terminalLocation:"",userSubjects:n},d={userId:a,userName:i,startTime:"",endTime:"",terminalIP:"",resourceMetauserConsoleData:[],duration:0,terminalLocation:"",userSubjects:n};t.push(d),r.push(l)}setTimeout((function(){for(var t=function(t){null==r[t].userName&&r.splice(t,1),"--"===r[t].userName&&r.splice(t,1),setTimeout((function(){var i=[r[t].userName,r[t].startTime,r[t].endTime];e.push(i)}),300)},i=0;i<r.length;i++)t(i)}),50)}return{forChartData:e,fordurationTable:t}},e.prototype.allRoomsData=function(){var e=new Array;e=[];var t=new Array;if(t=[],this.userConsoleData&&this.schoolTerminalData){for(var i={},n=void 0,a=0;a<this.userConsoleData.length;a++){t.push(this.userConsoleData[a]);var r=this.userConsoleData[a].terminalLocation,o=this.userConsoleData[a].terminalIP,s=[this.getRoomLabel(r,o),this.userConsoleData[a].startTime,this.userConsoleData[a].endTime];e.push(s)}var l=this.userConsoleData.map((function(e){return e.terminalIP}));for(a=0;a<this.schoolTerminalData.length;a++)if(!l.includes(this.schoolTerminalData[a].terminalKey)){n=this.getRoomLabel(this.schoolTerminalData[a].location,this.schoolTerminalData[a].terminalKey),i={userId:"",userName:"",startTime:new Date(this.myEndTime),endTime:new Date(this.myEndTime),terminalIP:this.schoolTerminalData[a].terminalKey,resourceMetauserConsoleData:[],duration:0,terminalLocation:this.schoolTerminalData[a].location,userSubjects:""},t.push(i);var d=[n,new Date(this.myEndTime),new Date(this.myEndTime)];e.push(d)}}return{forChartData:e,fordurationTable:t}},e.prototype.dataForTableView=function(e,t){var i,n=new Array;new Array;n=[];for(var a=0;a<e.length;a++){var r,o,s,l=void 0,d=void 0,c=void 0,p=void 0,u=void 0,h=void 0,m=void 0,f=void 0,g=(new Array,new Array);new Array;g=[],[],f=e[a].userSubjects,m=e[a].userName,null!=e[a].startTime&&""!=e[a].startTime&&null!=e[a].endTime&&""!=e[a].endTime&&(l=e[a].startTime.toLocaleTimeString("en-US",{hour12:!0}),d=e[a].endTime.toLocaleTimeString("en-US",{hour12:!0}),i=e[a].startTime.getDate()+"/"+(e[a].startTime.getMonth()+1)+"/"+e[a].startTime.getFullYear()),c=Math.floor(e[a].duration);var v=e[a].terminalLocation+" "+e[a].terminalIP;if(r=e[a].resourceMetauserConsoleData,o=e[a].resourceDurationFromConsole,s=Array(e[a].launchedFrom),0===r.length)void 0,void 0,void 0,g=[m,f,i,l,d,c,v,p=void 0,u=void 0,h=void 0,void 0,void 0,s],n.push(g);else for(var b=0;b<r.length;b++)for(var y=0;y<t.length;y++)r[b]===t[y].resouseID&&(p=t[y].subject,u=t[y].grade,h=t[y].chapter,t[y].topicName,g=[m,f,i,l,d,c,v,p,u,h,t[y].teachingPoint,"whiteboard"===t[y].title.toLowerCase()||"question"===t[y].title.toLowerCase()?this.getDisplaytypeValue(t[y].type)+" : "+this.convertSeconds(o[b]):this.getDisplaytypeValue(t[y].type)+" : "+t[y].title+" : "+this.convertSeconds(o[b]),s],n.push(g),m=void 0,f=void 0,i=void 0,l=void 0,d=void 0,c=void 0,v=void 0)}return n},e.prototype.dataForDetailedView=function(e,t,i){var n=new Array;var a,r,o,s,l,d,c=new Array;c=[];var p=new Array;p=[],s=e[i].userSubjects,o=e[i].userName,null!=e[i].startTime&&""!=e[i].startTime&&null!=e[i].endTime&&""!=e[i].endTime&&(a=e[i].startTime.toLocaleTimeString("en-US",{hour12:!0}),r=e[i].endTime.toLocaleTimeString("en-US",{hour12:!0}),e[i].startTime.getDate(),e[i].startTime.getMonth(),e[i].startTime.getFullYear()),Math.floor(e[i].duration);var u=e[i].terminalLocation+" "+e[i].terminalIP;if(l=e[i].resourceMetauserConsoleData,d=e[i].resourceDurationFromConsole,n=[o,a,s,r,u],0==l.length)void 0,void 0,void 0,void 0,void 0;else for(var h=0;h<l.length;h++)for(var m=0;m<t.length;m++)l[h]===t[m].resouseID&&(p=[t[m].subject,t[m].grade,t[m].chapter,t[m].teachingPoint,"whiteboard"===t[m].title.toLowerCase()||"question"===t[m].title.toLowerCase()?this.getDisplaytypeValue(t[m].type)+": "+this.convertSeconds(d[h]):this.getDisplaytypeValue(t[m].type)+": "+t[m].title+": "+this.convertSeconds(d[h])],c.push(p));return{userDetails:n,resourceDetails:c}},e.prototype.getDisplaytypeValue=function(e){var t=e;return[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"}].forEach((function(i){i.type===e&&(t=i.display)})),t},e.prototype.convertSeconds=function(e){return Math.floor(e/60)+"m "+e%60+"s"},e}();u.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new u},token:u,providedIn:"root"}),u.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[]};var h=function(){function e(e){this.pdService=e,this.userSelectedDate=new t.EventEmitter,this.messageForUser="Loding...",this.isInsights=!1}return Object.defineProperty(e.prototype,"responseStatus",{set:function(e){this.setMessageForUser(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.pdService.isInsightsView.subscribe((function(t){return e.isInsights=t}))},e.prototype.setMessageForUser=function(e){this.messageForUser=e},e.prototype.onUserSelectDate=function(e){this.data=null,this.userSelectedDate.emit(e)},e}();h.decorators=[{type:t.Component,args:[{selector:"lib-principal-dashboard-lib-v2",template:'<div id="reprtModule">\n <div id="pd-mainDiv" class="pd-mainContainer">\n <lib-header [data]="data" (userSelectedDate)="onUserSelectDate($event)">\n </lib-header>\n <lib-chartheader></lib-chartheader>\n \n <div id="pd-preloader" class="pd-preloaderDiv" *ngIf="responseStatus !== \'true\' && !data">\n {{messageForUser}} \n </div>\n \x3c!-- kept alive (only hidden) while on Insights so the timeline keeps its state --\x3e\n <div [style.display]="isInsights ? \'none\' : \'block\'">\n <lib-chartview *ngIf="data" [data]="data"></lib-chartview>\n \x3c!-- <lib-tableview *ngIf="data" [data]="data"></lib-tableview> --\x3e\n <lib-full-table-view *ngIf="data" [data]="data"></lib-full-table-view>\n </div>\n <lib-insights *ngIf="data && isInsights" [data]="data"></lib-insights>\n \x3c!-- <lib-detailedview *ngIf="data" [data]="data"></lib-detailedview> --\x3e\n <lib-small-table-view *ngIf="data" [data]="data"></lib-small-table-view>\n \n </div>\n</div>\n ',styles:[".pd-mainContainer{width:100%;height:100%}.pd-mainContainer .pd-preloaderDiv{text-align:center;line-height:27;position:absolute;width:100%;height:87%;z-index:2}.bs-datepicker-head{background-color:#000!important}"]}]}],h.ctorParameters=function(){return[{type:u}]},h.propDecorators={data:[{type:t.Input}],responseStatus:[{type:t.Input}],userSelectedDate:[{type:t.Output}]};var m=function(){function e(e){this.pdService=e,this.mytype=n.ChartType.Timeline,this.datadisplaytype="UserWise",this.isUserWise=!0,this.isChartView=!0,this.isInsights=!1}return e.prototype.ngOnInit=function(){this.libVersion="0.0.40"},e.prototype.changeChatType=function(){this.mytype==n.ChartType.Timeline?(this.isChartView=!1,this.mytype=n.ChartType.Table,this.pdService.chartType.next(this.mytype)):(this.isChartView=!0,this.mytype=n.ChartType.Timeline,this.pdService.chartType.next(this.mytype))},e.prototype.showInsights=function(){this.isInsights=!0,this.pdService.openSmallTable.next(!1),this.pdService.isInsightsView.next(!0)},e.prototype.changeDataTypeClassRoom=function(){this.leaveInsights(),this.isUserWise=!1,this.pdService.isUserWise_data.next(!1)},e.prototype.changeDataTypeUser=function(){this.leaveInsights(),this.isUserWise=!0,this.pdService.isUserWise_data.next(!0)},e.prototype.leaveInsights=function(){this.isInsights&&(this.isInsights=!1,this.pdService.isInsightsView.next(!1))},e}();m.decorators=[{type:t.Component,args:[{selector:"lib-chartheader",template:'\n<div id="pd-chartheader">\n <div id="pd-chatTypeBtnDiv" *ngIf="!isInsights" class="pd-tabIconBtn" [ngClass]=" isChartView ? \'tableIconImg\' : \'chartIconImg\'" (click)="changeChatType()">\n </div>\n \n <div id="pd-userWisechatTypeBtn" class="userWiseBtn" [ngStyle]="{ color: isUserWise && !isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: isUserWise && !isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="changeDataTypeUser()">User wise</div>\n <div id="pd-classRoomWiseBtn" class="classWiseBtn" [ngStyle]="{ color: !isUserWise && !isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: !isUserWise && !isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="changeDataTypeClassRoom()">Classroom wise</div><div id="pd-insightsBtn" class="insightsBtn" [ngStyle]="{ color: isInsights ? \'#ffffff\' : \'#000000\' , backgroundColor: isInsights ? \'#000000\' : \'#c4c4c4\'}"\n (click)="showInsights()">Insights</div>\n\n \n <div class="libVersionDiv">v{{libVersion}}</div>\n</div>',styles:['#pd-chartheader{font-size:12pt;font-weight:400;color:#5c5c5c;z-index:1;width:100%;height:40px;position:relative;margin:10 auto;text-align:center;background-color:#e0e0e0}#pd-chartheader #pd-classRoomWiseBtn,#pd-chartheader #pd-insightsBtn,#pd-chartheader #pd-userWisechatTypeBtn{background:-moz-linear-gradient(center top,#45a1da 5%,#1172ae 100%);display:inline-block;padding:0 20px;cursor:pointer;margin:5px 0 0;width:160px;height:30px;line-height:30px}#pd-chartheader .libVersionDiv{position:absolute;font-size:12px;color:#343a40;margin-top:-21px;font-weight:700;margin-left:71px}.userWiseBtn{border-radius:6px 0 0 6px}.insightsBtn{border-radius:0 6px 6px 0;border-left:1px solid #e0e0e0}.pd-tabIconBtn{cursor:pointer;position:absolute;left:10px;top:-17px;width:62px;height:52px;background-repeat:no-repeat}.tableIconImg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkZDQzc3REFDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkZDQzc3REJDMkQ2MTFFMkIzNDhCNTE1RDg3OUE1QTciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoyRkNDNzdEOEMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoyRkNDNzdEOUMyRDYxMUUyQjM0OEI1MTVEODc5QTVBNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PnXBGHQAAAblSURBVHja3FrLbxtFGP9mdh0/m0DSPFvnEKAHkBCNShEHWlB5nEigqgRcokogLlwR/AHcEDf4BxBXToEDV0JfqlAgQiJIVVtKuaQmzcOO7fgxw3yzO/Z4vC/DurU70mhm19/Ofr/v981vZndNIFohMFyFhxnYEYGSgACQAQLHo9oGASEefTKAWcCNPtfOmX1fxr2AUuOYhGTAwwDNPSoz7IgO3otBaoDWq35+kFKdGYD1agaC+zGuA7aMlnpkwMNm3Atw02iZybjtkdpEA2u5NrYRhEEEroNtuNVM9daxF+M624mJ/BNHnj679HEimV4ilOYHeg1j7G79sLL6+4+rX2zfvVn0mf9d4maCto/OPzX6zCvLn1944+yFN8+cgumJxwZ68d7a3s1/t/bzR99a1szm2vef3Lv9x66P8HkqdivNT7z42rv2SOr8+2+dG3jQWNBH9FX4/PaTL5x7R5uuXThpkLAls2MXv/z0A2nDOR+KigV9TmZGLxqi3KFJts/6LYGLOT01PpprDTgs5XHhs/B90oNthZHbHozrrHOmRRJLLpcbSLClUqktcm1/fZdfv3W8tUnhBvDkGIXTH87B0QWMKgFKCHDqXkScikfUHYFoozo22qqCfXds7tzMbZ0qG6ZMuGyVK3ieMQa7t+uw8XWhw0cDuOfSa4dsV+XgWPUVMZM8AodQlgpBETxWywGFLbXEpfK808cAoS22FnUAtwLiApSZxWSKOaCaXPYZHjdBtky1eE5c2xA/ZFMTAmihw0et77vFtkPXRoNxda64XwZqg2QcwUngCqxNOgJCXeDSjjoBIkQDzh1ADott4IwpwLx9rPWbzSaM8nGT5UiaFAocPIDLHKIaCOoAaQEkzhRQ51utBOyy7x7LsblLBYdWQIiaPu45OS5XyqNcI95g4wDeleoqZyynUhcwsk9UyrvpbVmKZYNxqqc6cfaTmObUbd2NJ2G8LR7INgag4USIEBUsbqa3p789A+9KdXG3cr0Ehb/uyXnWEjXaFrfOPoFUMgm1eq2lZ0ro9DnOuWKcQMJOQKV66GZbW+DMPsYlnxpzhS/mVDeBN2scXp1/D54/eRpS6ZT36w3NvlYXqvvrBjx38iTYmAIhpVwuw+bmJiwuLors0PJaWw1Ur9Gowy/rG7DBvoofOOOdqW5DEhZyz8Lri+elk0EPaFxcOzZ+BNLFo/Dy6TOwt10U/tPA+2WzWRir/QRnT70Eu//sC/CW74PZ6HgO9m4yMSVIZ6rzWFK9M4JUOM7EBCxW9qB0UArNFjtFoVI/gEqlArul+y6LAddYDag2ylCtVmHvYMfXHsdOZhNQa1Zl7DsZhz6Km0i9dDodegPlOLaZTKZzA+MxpiqWmBa92Mcubl7AMbqpVAqSQrRC30u7zqHtxMREKJBazRHBRCIRyZ4/KFXHmyEb169fB9uOsg3gcHBwAFeuXIm05240GnLfffXq1UgipWziV3UPxvF4ampKpmJYqQtVLxQKMDs7KwMWVlALdnZ2pH2YHmCQbt261cUy7wfjqn/s2DHJTFAqou3MzAzcuHED8vm8DECQPRZM7zt37kj7ra2tQHE7fvy4zIy+MG4uZ3q0sQYBweuQcXQEW6xBLKIdjqnsse9nr8b2FDfej52bNtfDUh2v60XV9RKm6ji2/lv8jMvHwG5Vx6UMlTrsJrqqj4yMhNqaqh5m763qfXhIUaqOKo2qHiW6qOpra2uRmMZHTdSOS5cuhS5LD3Q5UwPPz89L1sNSF+chqvTCwkKoquN9UNWLxaK0DxsbNQCF8L+kOo3KuKpq0MnJydA3nmg/PT0t0xxbZDPsDamyx+UyyB7HnpubawXH9LNvLyJ0p6KoNLZRHMJxFZtB9mrMvr2ICFL1fu7VUT96se+Dqvvv1bEG3UR3rFdVR+BBqq7G7p+4GW83kDkUqWvXrvW0V0eV7kXVL1++HHmvrqu78jn2VEenVlZWBu6DQhyp3vFV0dzArK+vD+SXFJ8NTNfnYS/g5h9lWJC4DXLR/GXg/UcgX8bZIwScRWWcLS0tFeR8BtgZZuACx9/Yrq6ujvoxztvX8P3l5eWK6KfVZqDeaMKQIe94t4GYhPKnday2R4rrpfrZNz8c/l8/xkdzctGt1WvypiMWdY4bTfe9EZPHI0nHt/v7pThSrGrqn8m4zvaOvofP3fttNg4CDreMYz87t83Gw/usjgWxCdZbKW8yrgo+8uC2KRXlQSZCUVu4VESW4mCcueNti3rCHLfjm7iICn4aScKjWQ4F4xmTcRWJP2NmWpVMj/blOPc2GvMtZff6L6vfP5YH5Y+7/o8V3S33Oe/7v3QYErBRgwB+czxMlIa1+IrkvwIMANKaPx47pbRTAAAAAElFTkSuQmCC")}.chartIconImg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAzCAYAAADPX7uaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDk0MUYxOEJDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDk0MUYxOENDQzFFMTFFMkIxOUNERTUyRTI5MjFDNEYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEOTQxRjE4OUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEOTQxRjE4QUNDMUUxMUUyQjE5Q0RFNTJFMjkyMUM0RiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PpdyrHsAAAZISURBVHja3FpLbBtFGP5nd/1I/CCOm0AqUqRCKwQHJB6qgIioVBUnEkCV4MAhUgsHuCU8Du0hCXAAoRwAwYEeQJW4AAcCiuBSiebI4wDiIR4qEKQooYkdx3b83OGftXczO96x1/HGWXeiiXd2Znf/b77/NbNLwF0h0FuFthqguQRKmkwA8RE46nZsMyDE4Zj4UAuocEy5c+KxlHEnoIrQJi004CBAU4eqC+MID96JQUUAzVf+vJ9UXRcA81WcCCpjnAesCr+KgwYcNONOgKvCry4yrjmoNuHAqvUxmjAJfgTOg63Uq6jqVtuJcZ7tQHL01tgd4xMvBEJ9E0RRRn0dw3R9pVzcWfz568U3N1b+3JbYf4NzE0Frh44ci995cvKNM4+Mn3n0oXvhxuSAr4P32kZ69PMr3z7/iare9MuVL15av/prWuL4HD22pebH7z/9lBYMP3H2sVO+B80Kk5HJijI/ftuJU09y5tqAU2nm2EKRG6befvmcMYZS2hOVFSZzqD8+JThlm0/SJPHbAI42PTwYj1o37JWSQJlR9iEHtk2MVHNgnGed6txMshKLxXw5EdlsdtfJ7conDb+yOG4lKVQAHo1GYXZ21leg5+fnbTIKwB1Dr9YiXQVd141qlmq1avxOT0/7AvTCwgJUKhWbjNyxNMXWWsZGgXF+AlZXV10J9/HYFFS38xBAAnAa4cH3zsPhB+7qGPTIyEgNDSEyxttelvLIO7bp0rU0DOd0OEbisAFlqJRK3icvvIxeABdVXSyKorTexVBVI5sk9T92jZvrWsklazeTt2NVZ0VFQEzN3BcEjeOJQjoGLj7Xc1UXgfPHTHhXwAnnYikTunPGRZk8B65Tuaq7ZdxyqZQw1AZo1VB/74DbVJ16our2h/BAeeDr2Txm/7vjIsEgRIMB+64BqU2Cug/A7W3w3rnxKsoLf987lyDDHhgI4V1VePGe2+HC+Am7I6TMxhVPbFy0d8+dmyyBEYEHNLxV/BAukQ4DGRjAmJ3i+ond1hW1Y8ZF9rvu1W2GjA8kODFErwDRGtVZoYrh1U1V38ptwoeX37Jtkpw9PQORcKxj1e8cuN7cuYkOjBoJYi1sWf2kBoyP46wvW8zAp99chEACIDmYgNQ/OXj65HMQV9tf+/My0v1m3NlOCesw7M7st7y64dzY+VqfpgWMHQGtHxc/yTBsrxVwQrQ92X9Xw5ldQM6OERgP3BYhMJCbcVypRwRaZSzVtN3M6kr5ImTW07ZnDR4ZcpWteRTO5IxLY7jJNLFv29P6HztvVuC0gdY1gp3/6avv4KNn34UgihgO90GOFOD1lQ+6yLhOXXlJGwLirKo6YWszKs9yuHkiGBKjpA+SJAY3D90CPxR+d23jTOZ9X6Q4AlBA/kqPSE6Txi6mHVVU2yqtQLMXoPsSx+lelqWkUU4j2uFJJ8YJNMWF86gcgHMTGG+ZeFTxocUyQLCRWubYKDizQZtgJ9YOUhcTmPY3ImgNfJvgZJ2mGXR9I6KtJR+mogTjMGHpqzAOe4ytJ1VEwWxbZZcq0NiFSRBeE1b78T85WFU3c3VR5a9lcwY8SstA0+uQPTps9e2ktzFz1+A3yEBer8JRZgqGVeC98bCUwtVddQuK+RJeX3tWpVCGAi3BJl7zR/oqpLdS0sxxL6rObyWbb0WDWHGJBeGHz53//tVnJhORcMi6YGxszHfby3Nzc7C8vGy1c4UiXHj/s9Tli6/djc0C1iLb+oPdt6h626oeiURgZmbGV8ATiYQnqm57qygmMEtLS+DHIklgqMxtahK/an06QT3YXu524eTVwflDICnj+nUEXHfLuD4xMfEfO5EFSPUycMTxL/tdXFyMyxinu9fQzOTk5A4e95nJQLlShR5Dzrd2GCbM5/t4rJqDivOl8MqlL4udyjEYjxrZR6lcMh4aVJVau1JP8ahutIOhmmybmawXKlYQ/Z/IOM92yloXYImu/zjiBQHFNaEtG2eGTG94H+GxMGzIuqXyIuNm+RtrkiUxAODFPrCZb4ZdsuQF43r9fhtYj4v3tb0Tx1nJ17O267EUkfF+kXFzJv7ymGmz9Lc5Pu9lbsMxb3l2p29ZZV8s++XD3WYLWwDnD3sb+mXfpUOPgHU7CSCz8VZOqVeL1En+L8AAjJTPo0iRABoAAAAASUVORK5CYII=")}']}]}],m.ctorParameters=function(){return[{type:u}]};function f(e,t,i,n){return new(i||(i=Promise))((function(a,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function s(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))}function g(e,t){var i,n,a,r,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(a=2&r[0]?n.return:r[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,r[1])).done)return a;switch(n=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){o.label=r[1];break}if(6===r[0]&&o.label<a[1]){o.label=a[1],a=r;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(r);break}a[2]&&o.ops.pop(),o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e],n=0}finally{i=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}Object.create;function v(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,a,r=i.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(a)throw a.error}}return o}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}Object.create;var y=function(){function e(e){this.pdService=e,this.totalUsers=0,this.eligibleUsers=0,this.currentUsers=0,this.myChartType=n.ChartType.Timeline,this.myChartwidth=.88*window.innerWidth,this.myChartHeight=window.innerHeight,this.currentList="Current Users",this.allList="All Users",this.isAllUsers=!1,this.isUserWise=!1,this.isSubscribed=!1,this.useCustomTimeline=!0,this.isTableView=!1,this.timelineRows=[],this.timelineList=[],this.myChartDataMatrix=new Array,this.totalChartDataMatrix=new Array}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadChart(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.loadChart=function(e){var t=this;this.totalUsers=0,this.eligibleUsers=0,this.currentUsers=0,this.myChartType=n.ChartType.Timeline,this.myChartwidth=.88*window.innerWidth,this.myChartHeight=window.innerHeight,this.currentList="Current Users",this.allList="All Users",this.isAllUsers=!1,this.pdService.isAllUsers.next(!1),this.isUserWise=!1,this.myChartDataMatrix=[],this.totalChartDataMatrix=[],this.chartview=document.getElementById("pd-chartview"),this.myDataList=document.getElementById("pd-xmlData"),e&&(this.myXmlData=this.pdService.parseData(e)),this.myXmlData&&(this.currentdataList=this.pdService.genarateUserReqiuredData(this.myXmlData),this.alluserList=this.pdService.allUserChartData(),this.allRoomsList=this.pdService.allRoomsData(),this.resourceDataList=this.pdService.genarateResourseReqiuredData(this.myXmlData),this.totalUsers=this.currentdataList.usersMetadata.length,this.eligibleUsers=this.findEligibleUserCount(),this.installedClassrooms=this.findInstalledClassrooms(),this.currentRooms=this.findCurrentClassrooms(),this.findCurrentUserCount()),this.isSubscribed?this.updateDataType(this.pdService.isUserWise_data.value):(this.isSubscribed=!0,this.pdService.chartType.subscribe((function(e){e&&t.updateChartType(e)})),this.pdService.isUserWise_data.subscribe((function(e){t.updateDataType(e)})),this.pdService.isInsightsView.subscribe((function(e){e||setTimeout((function(){return t.fitChartHeight()}))})),window.addEventListener("resize",this.onResizeWindow.bind(this)))},e.prototype.onResizeWindow=function(e){this.myChartwidth=.88*window.innerWidth,this.fitChartHeight()},e.prototype.fitChartHeight=function(){var e=document.getElementById("pd-chartview");if(e&&"none"!==e.style.display){var t=e.getBoundingClientRect().top+window.scrollY,i=Math.max(window.innerHeight-t-8,240);e.style.height=i+"px"}},e.prototype.myChartReady=function(){this.createDivforTotalDurartion(),this.setHeightofDivforTotalDurartion()},e.prototype.updateChartType=function(e){var t=this;this.isTableView=e==n.ChartType.Table,null!=this.chartview&&null!=this.chartview&&(e==n.ChartType.Table?this.chartview.style.display="none":(this.chartview.style.display="block",setTimeout((function(){return t.fitChartHeight()}))))},e.prototype.updateDataType=function(e){var t=this;setTimeout((function(){return t.fitChartHeight()})),this.isUserWise=e,this.myXmlData&&(this.isUserWise?(this.currentList="Current Users",this.allList="All Users",this.isAllUsers?this.userWiseAllData():this.userWiseCurrentData()):(this.allList="All Rooms",this.currentList="Current Rooms",this.isAllUsers?this.classRoomWiseAllData():this.classRoomWiseCurrentData()))},e.prototype.updateChart=function(){for(var e=this,t=document.getElementById("labels");t&&t.firstChild;)t.removeChild(t.lastChild);this.chartDataTable=this.myChartDataMatrix,this.myChartOptions={tooltip:{trigger:"none"},colors:["#ff7f0e","#2ca02c","#8c564b","#d62728","#bcbd22","#17becf"],timeline:{colorByRowLabel:!0,barLabelStyle:{fontSize:7}},hAxis:{format:"HH:mm a"}},setTimeout((function(){e.myChartHeight=e.AllrowHeight+100}),1e3)},e.prototype.filterUserHasDash=function(e){var t=this.myChartDataMatrix,i=this.currentdataList.userConsoleData;return{updatedChartData:t.filter((function(e){return"-"!==e[0]})),updatedRightData:i.filter((function(e){return"-"!==e.userName}))}},e.prototype.calulateTotalDuration=function(e){var t,i=new Array;if(i=[],this.totalChartDataMatrix=[],this.isUserWise)for(var n=0;n<e.length;n++)t={name:e[n].userName,value:parseInt(e[n].duration)},i.push(t);else for(n=0;n<e.length;n++)t={name:this.pdService.getRoomLabel(e[n].terminalLocation,e[n].terminalIP),value:parseInt(e[n].duration)},i.push(t);var a={};(i=b(new Set(i))).forEach((function(e){a[e.name]?a[e.name].value=a[e.name].value+e.value:a[e.name]=e}));var r=Object.values(a),o=new Array;o=[],r.forEach((function(e){o.push(e.value)}));for(n=0;n<o.length;n++){var s=[this.timeConvert(o[n]).toString()+" hrs"];this.totalChartDataMatrix.push(s)}},e.prototype.timeConvert=function(e){var t=Math.floor(e)/60,i=Math.floor(t),n=60*(t-i);return i+":"+Math.round(n)},e.prototype.removeBlankEntryBar=function(){for(var e=document.getElementById("myTimeLine").getElementsByTagName("rect"),t=1e8,i=[],n=0;n<e.length;n++){var a=parseInt(e[n].getAttribute("width"));a<t?(i=[e[n]],t=a):a==t&&i.push(e[n])}for(n=0;n<i.length;n++)i[n].setAttribute("fill","none")},e.prototype.createDivforTotalDurartion=function(){var e=[];this.rowElements=[];var t=document.getElementById("labels");if(t){for(;t.firstChild;)t.removeChild(t.lastChild);for(var i=0;i<this.totalChartDataMatrix.length;i++){var n=this.totalChartDataMatrix[i][0];e.push(n);var a=t.appendChild(document.createElement("div"));a.style["border-bottom"]="1px solid #b7b7b7",a.style["font-family"]="Arial",a.style["font-size"]="13px",a.style["text-align"]="left",a.style["padding-left"]="8px",a.style["padding-right"]="8px",a.style.position="inherit",a.style["background-color"]=i%2?"#e6e6e6":"#ffffff",a.innerHTML=n,this.rowElements.push(a)}}},e.prototype.setHeightofDivforTotalDurartion=function(){this.AllrowHeight=0;for(var e=document.getElementById("myTimeLine").getElementsByTagName("rect"),t=-1,i=0;i<e.length;i++)if(++t<this.rowElements.length){var n=parseFloat(e[i].getAttribute("height"))+"px";this.AllrowHeight+=parseFloat(e[i].getAttribute("height"));var a=this.rowElements[t];a&&(a.style.height=n,a.style.lineHeight=n)}},e.prototype.buildTimeline=function(e){var t=this;this.timelineList=e||[];var i=[],n={};this.timelineList.forEach((function(e,a){var r=t.isUserWise?e.userName:t.pdService.getRoomLabel(e.terminalLocation,e.terminalIP);if(null!=r&&""!==r&&"--"!==r){"-"===r&&(r="Unknown user");var o=n[r];if(o||(o=n[r]={label:r,bars:[]},i.push(o)),t.isSession(e)){var s=t.isUserWise?t.pdService.getRoomLabel(e.terminalLocation,e.terminalIP):e.userName,l=e.startTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})+" – "+e.endTime.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});o.bars.push({start:e.startTime,end:e.endTime,index:a,tooltip:((s||"")+"\n"+l).trim()})}}})),this.timelineRows=i},e.prototype.isSession=function(e){return!!e&&!!e.userId&&e.startTime instanceof Date&&!isNaN(e.startTime.getTime())&&e.endTime instanceof Date&&!isNaN(e.endTime.getTime())},e.prototype.openRow=function(e){var t=this,i=e.indexes.map((function(e){return t.timelineList[e]})).filter((function(e){return t.isSession(e)})).map((function(e){return{userId:e.userId,ip:e.terminalIP,start:e.startTime.getTime()}}));i.length&&(this.pdService.detailAccentColor=e.color,this.pdService.detailRowRequest={label:e.label,isUserWise:this.isUserWise,total:e.total,sessions:i},this.pdService.openSmallTable.next({allSessions:!0}))},e.prototype.openSession=function(e){var t=e.index,i=this.timelineList[t];this.isSession(i)&&(this.pdService.detailAccentColor=e.color,this.pdService.detailRowRequest=null,this.selectedUserData=this.pdService.dataForDetailedView(this.timelineList,this.resourceDataList,t),this.pdService.detailedviewData.next(this.selectedUserData),this.pdService.openSmallTable.next(this.selectedUserData))},e.prototype.onSelectRowData=function(e){var t=e.selection[0],i=t.row,n=(t.column,this.currentdataList.userConsoleData);if(this.isAllUsers&&(n=this.isUserWise?this.alluserList.fordurationTable:this.allRoomsList.fordurationTable),n[i]&&n[i].userId&&n[i].startTime){this.selectedUserData=this.pdService.dataForDetailedView(n,this.resourceDataList,i);this.currentdataList;this.pdService.detailedviewData.next(this.selectedUserData),this.updateChart(),this.pdService.openSmallTable.next(this.selectedUserData)}},e.prototype.showAllUser=function(){this.pdService.isAllUsers.next(!0),this.isAllUsers=!0,this.isUserWise?this.userWiseAllData():this.classRoomWiseAllData()},e.prototype.showCurrentUser=function(){this.isAllUsers=!1,this.pdService.isAllUsers.next(!1),this.isUserWise?this.userWiseCurrentData():this.classRoomWiseCurrentData()},e.prototype.userWiseCurrentData=function(){var e=this.pdService.userWiseChartData();this.buildTimeline(this.currentdataList.userConsoleData),e.length>0&&(this.myChartDataMatrix=e,this.updateChart(),this.currentdataList.userConsoleData.length>0&&this.calulateTotalDuration(this.currentdataList.userConsoleData))},e.prototype.userWiseAllData=function(){this.buildTimeline(this.alluserList.fordurationTable);var e=this.alluserList.forChartData;e.length>0&&(this.myChartDataMatrix=e,this.updateChart(),this.calulateTotalDuration(this.alluserList.fordurationTable))},e.prototype.classRoomWiseCurrentData=function(){var e=this.pdService.classRoomWiseChartData();this.buildTimeline(this.currentdataList.userConsoleData),console.log("classRoomdata",e),e&&e.length>0&&(this.myChartDataMatrix=e,console.log("myChartDataMatrix",this.myChartDataMatrix),this.updateChart(),this.currentdataList.userConsoleData.length>0&&this.calulateTotalDuration(this.currentdataList.userConsoleData))},e.prototype.classRoomWiseAllData=function(){var e=this.allRoomsList||this.pdService.allRoomsData();this.buildTimeline(e.fordurationTable),e.forChartData&&e.forChartData.length>0&&(this.myChartDataMatrix=e.forChartData,this.updateChart()),e.fordurationTable&&e.fordurationTable.length>0&&this.calulateTotalDuration(e.fordurationTable)},e.prototype.findCurrentUserCount=function(){for(var e=this.currentdataList.userConsoleData,t=new Array,i=0;i<e.length;i++){var n=e[i].userName;t.push(n)}var a=b(new Set(t));this.currentUsers=a.length},e.prototype.findCurrentClassrooms=function(){return this.pdService.newGetCurrentClassroomData().length},e.prototype.findInstalledClassrooms=function(){return this.currentdataList.schoolTerminalData.length},e.prototype.findEligibleUserCount=function(){for(var e=0,t=this.currentdataList.usersMetadata,i=0;i<t.length;i++){""!==t[i].userSubjects&&(e+=1)}return e},e.prototype.ngOnDestroy=function(){},e}();y.decorators=[{type:t.Component,args:[{selector:"lib-chartview",template:'<div id="pd-chartview-main-container" class="pd-chartview-main-container">\n <div id="userSummary">\n <table class="summaryTable">\n <tbody>\n <tr>\n <td id="totalUsers" class="chartview-navigationbar">\n Total users: {{totalUsers}}\n </td>\n <td id="eligibleUsers" class="chartview-navigationbar">\n Eligible users: {{eligibleUsers}}\n </td>\n <td id="currentUsers" class="chartview-navigationbar">\n Current users: {{currentUsers}}\n </td>\n <td id="totalRooms" class="chartview-navigationbar">\n Installed Classrooms: {{installedClassrooms}}\n </td>\n <td id="currentRooms" class="chartview-navigationbar">\n Current Classrooms: {{currentRooms}}\n </td>\n \x3c!-- <td\n id="currentRooms"\n \n >\n <span id="totalUsers_list" class="activeAll">User List</span>\n </td> --\x3e\n </tr>\n </tbody>\n </table>\n </div>\n <div id="pd-messageDivContainer" class=\'pd-messageDivContainer\'>\n <div id="pd-messageDiv" class=\'pd-messageDiv\' *ngIf="!isTableView">Click the bars to view details of content accessed by a teacher.</div>\n <div id="pd-toggleContainer" class="pd-toggleContainer">\n \n <div id="pd-currentUserBtn" class="pd-currentUserBtn-div pd-commonStyleBtn" (click)="showCurrentUser()" [ngStyle]="{ color: isAllUsers ? \'#000000\' : \'#ffffff\' , backgroundColor: isAllUsers ? \'#c4c4c4\' : \'#000000\'}">\n {{currentList}}</div>\n <div id="pd-allUserBtn" class="pd-allUserBtn-div pd-commonStyleBtn" (click)="showAllUser()" [ngStyle]="{ color: isAllUsers ? \'#ffffff\' : \'#000000\' , backgroundColor: isAllUsers ? \'#000000\' : \'#c4c4c4\'}">\n {{allList}}</div>\n </div>\n </div>\n <div id="pd-chartview" class="pd-chartview">\n <lib-timeline\n *ngIf="useCustomTimeline"\n [rows]="timelineRows"\n [labelTitle]="isUserWise ? \'Teacher\' : \'Room\'"\n (barClick)="openSession($event)"\n (totalClick)="openRow($event)"\n ></lib-timeline>\n <div id="myChartDiv" *ngIf="!useCustomTimeline">\n <div id="myTimeLine">\n <google-chart\n [type]="myChartType"\n [data]="chartDataTable"\n [options]="myChartOptions"\n [width]="myChartwidth"\n [height]="myChartHeight"\n (select)="onSelectRowData($event)"\n (ready)="myChartReady()"\n > \n </google-chart>\n \n </div>\n <div class="inline babloo" id="labels"></div> \n \n \n </div>\n</div>\n',styles:[".pd-chartview-main-container .pd-chartview{display:block;overflow:scroll;width:100%;height:484px;font-family:Tahoma;font-size:12pt;font-weight:400;color:#666;margin:10 auto;text-align:center;padding-top:1px}.pd-chartview-main-container #userSummary{background:#e0e0e0;margin-top:1px}.pd-chartview-main-container #roomSummary,.pd-chartview-main-container #userSummary{position:relative;width:100%;text-align:center;padding-top:6px;padding-bottom:6px;font-size:13px}.pd-chartview-main-container .pd-messageDivContainer{margin-top:1px;position:relative;display:flex;align-items:center;justify-content:center;min-height:40px;padding:0 200px;box-sizing:border-box}.pd-chartview-main-container .pd-messageDivContainer .pd-messageDiv{font-size:13px;text-align:center}.pd-chartview-main-container .pd-messageDivContainer .pd-toggleContainer{line-height:30px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:absolute;right:0;top:50%;transform:translateY(-50%)}.pd-chartview-main-container .pd-messageDivContainer .pd-allUserBtn-div{border-radius:0 5px 5px 0}.pd-chartview-main-container .pd-messageDivContainer .pd-currentUserBtn-div{border-radius:5px 0 0 5px}.pd-chartview-main-container .pd-messageDivContainer .pd-commonStyleBtn{display:inline-block;cursor:pointer;font-size:12px;width:92px;text-align:center}.pd-chartview-main-container .summaryTable{width:100%;border-collapse:collapse;border-spacing:2px;border-color:grey}.pd-chartview-main-container .activeAll{cursor:pointer;background:none!important;border-radius:13px;border:none;width:64px;height:18px!important;line-height:18px!important;color:#45a1da;margin-right:0!important;padding:1px 5px;vertical-align:sub}.pd-chartview-main-container #myTimeLine{width:89%;height:60%;margin-left:5px;overflow-x:scroll;overflow-y:hidden;float:left}.pd-chartview-main-container #myTimeLine2{width:71px;position:relative;overflow-x:hidden;overflow-y:hidden}.pd-chartview-main-container #myChartDiv{width:100%}.pd-chartview-main-container .chartview-navigationbar{border-collapse:collapse;border-right:1px solid #999;text-align:center}.pd-chartview-main-container #labels{border-right:1px solid #b7b7b7;border-top:1px solid #b7b7b7;width:10%;float:left;font-size:1.2vw;overflow-x:hidden;overflow-y:hidden}.inline{vertical-align:top;position:relative}"]}]}],y.ctorParameters=function(){return[{type:u}]},y.propDecorators={data:[{type:t.Input}]};var x=function(){function e(e){this.pdService=e,this.userMetadataHeadingArray=["Name:","Start Time:","Subject:","End Time:","Room Details:"],this.resourseMetadataHeadingArray=["Subject","Class","Chapter Name","Topic Name","Assets Details"]}return e.prototype.ngOnInit=function(){var e=this;this.deatilViewContainer=document.getElementById("pd-deatilViewContainer"),this.deatilViewTable=document.getElementById("pd-deatilViewTable"),this.closeButton=document.getElementById("pd-closeButton"),this.pdService.detailedviewData.subscribe((function(t){t&&(t.userDetails.length>0&&e.createTable(t.userDetails),t.resourceDetails.length>0&&(t.resourceDetails=e.replaceLabelChapterAndTopic(t.resourceDetails),e.createResourcesTable(t.resourceDetails)))})),this.deatilViewContainer.style.display="none"},e.prototype.replaceLabelChapterAndTopic=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";return e.map((function(e){return e.map((function(e){return e.includes("Topic:")?e.replace(/Topic: .*/,"Topic "+t):e.includes("Chapter:")?e.replace(/Chapter: .*/,"Chapter "+t):e}))}))},e.prototype.replaceLabelChapterAndTopic1=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(selected)</span>";return e.map((function(e){return e.map((function(e){return e.includes("Topic: :")?e.replace(/Topic: :.*$/,"Topic "+t):e.includes("Chapter:")?e.replace(/Chapter: .*$/,"Chapter "+t):e}))}))},e.prototype.createTable=function(e){for(this.deatilViewContainer.style.display="block";this.deatilViewTable.firstChild;)this.deatilViewTable.removeChild(this.deatilViewTable.lastChild);for(var t=new Array,i=0,n=0;n<e.length;n++){var a=document.createElement("label");a.appendChild(document.createTextNode(this.userMetadataHeadingArray[n])),"undefined"!==a.textContent&&void 0!==a.textContent||(a.textContent=""),t.push(a);var r=document.createElement("label");r.appendChild(document.createTextNode(e[n])),"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}var o=document.createElement("table");o.id="userDataTable",o.className="table table-bordered";for(var s=document.createElement("tbody"),l=0;l<e.length/2;l++){var d=document.createElement("tr"),c=void 0;for(n=0;n<4;n++)n%2==0?(c=document.createElement("th")).style["font-weight"]="bold":c=document.createElement("td"),i<t.length&&(c.appendChild(t[i]),d.appendChild(c)),i++;s.appendChild(d),o.appendChild(s),this.deatilViewTable.appendChild(o)}},e.prototype.createResourcesTable=function(e){for(var t=new Array,i=0,n=0;n<this.resourseMetadataHeadingArray.length;n++){(r=document.createElement("label")).appendChild(document.createTextNode(this.resourseMetadataHeadingArray[n])),"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}for(n=0;n<e.length;n++)for(var a=0;a<5;a++){var r;(r=document.createElement("label")).innerHTML=e[n][a],"undefined"!==r.textContent&&void 0!==r.textContent||(r.textContent=""),t.push(r)}var o=document.createElement("table");o.className="table table-bordered",o.id="resoureMetadataTable";var s=document.createElement("tbody");for(a=0;a<=e.length;a++){var l=document.createElement("tr"),d=void 0;for(n=0;n<5;n++)0==a?(d=document.createElement("th")).style["font-weight"]="bold":d=document.createElement("td"),i<t.length&&(d.appendChild(t[i]),l.appendChild(d)),i++;s.appendChild(l),o.appendChild(s),this.deatilViewTable.appendChild(o)}},e.prototype.onCloseBtnClick=function(){this.deatilViewContainer.style.display="none"},e}();x.decorators=[{type:t.Component,args:[{selector:"lib-detailedview",template:'<div id="pd-deatilViewContainer">\n <div class="pd-detailview-header">\n <div class="pd-detailview-title">Details</div>\n <div id="pd-closeButton" (click)="onCloseBtnClick()">+</div>\n </div>\n <div id="pd-deatilViewTable"></div>\n</div>\n',styles:["#pd-deatilViewContainer{position:absolute;background:#fff;box-shadow:0 0 17px #818181;font-size:12px;width:50%;max-height:350px;top:140px;left:230px}#pd-deatilViewContainer .pd-detailview-header{position:relative;width:100%;height:35px;background-color:#e6e6e6}#pd-deatilViewContainer .pd-detailview-title{position:absolute;margin-left:5px;font-size:20px;line-height:35px}#pd-deatilViewContainer #pd-closeButton{width:24px;position:absolute;float:right;right:0;cursor:pointer;height:24px;background:#000;border-radius:12px;color:#fff;line-height:22px;text-align:center;font-size:26px;transform:rotate(45deg);margin:5px}#pd-deatilViewContainer #pd-deatilViewTable{overflow:scroll;scroll-behavior:smooth;height:auto;margin:5px;max-height:300px}"]}]}],x.ctorParameters=function(){return[{type:u}]};var w=function(){function e(){this.resourceTypes=new Array,this.tabName=[{name:"School"},{name:"User Summary"},{name:"Terminal Summary"},{name:"Usage Details"}]}return e.prototype.exportAsExcelFile=function(e,t){for(var i,n={Sheets:{},SheetNames:[]},a=0;a<e.length;a++){var o=r.utils.json_to_sheet(e[a]);n.Sheets[this.tabName[a].name]=o,n.SheetNames.push(this.tabName[a].name)}var s=n;i=r.write(s,{bookType:"xlsx",type:"array"}),this.saveAsExcelFile(i,t)},e.prototype.saveAsExcelFile=function(e,t){var i=new Blob([e],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});a.saveAs(i,t+".xlsx")},e.prototype.genarateResourseReqiuredData_Excel=function(e){var t,i=new Array,n=e.resourcesMetadata.resourceMetadata;if(null!=n&&n.length>0)for(var a=0;a<n.length;a++){var r={resouseID:n[a].resourceId,subject:null!=n[a].subject&&null!=n[a].subject.title?n[a].subject.title:"",grade:null!=n[a].grade&&null!=n[a].grade.title?n[a].grade.title:"",chapter:null!=n[a].chapter&&null!=n[a].chapter.title?n[a].chapter.title:"",teachingpoint:null!=n[a].teachingpoint&&null!=n[a].teachingpoint.title?n[a].teachingpoint.title:"",type:t=null!=n[a].type?this.getDisplaytypeValue(n[a].type):"",title:null!=n[a].title?n[a].title:""};i.push(r),this.resourceTypes.push(t)}return this.resourceTypes=b(new Set(this.resourceTypes)),i},e.prototype.getName=function(e){return/School Admin/gm.exec(e.role)?"Support Admin":e.fullName},e.prototype.genarateUserReqiuredData_Excel=function(e){var t=e.usersConsole.userConsole,i=e.usersMetadata.userMetadata,n=e.schoolTerminals.schoolTerminal,a=new Array,r=new Array,o=new Array,s=new Array;if(null!=i&&i.length>0)for(var l=0;l<i.length;l++){var d={};""!=i[l].userId&&(d={userId:i[l].userId,userName:void 0!==i[l].fullName?this.getName(i[l]):"",userSubjects:void 0!==i[l].userSubjects?i[l].userSubjects:""},a.push(d))}for(var c=0;c<a.length;c++)a.forEach((function(e){a[c].userName===e.userName&&(r.push(a[c]),a.splice(c,1))}));for(c=0;c<r.length;c++)r[c].userName=r[c].userName+" "+c,a.push(r[c]);if(null!=n&&n.length>0)for(c=0;c<n.length;c++){var p;p={schoolId:void 0!==n[c].schoolId?n[c].schoolId:"",terminalKey:void 0!==n[c].terminalKey?n[c].terminalKey:"",terminalType:void 0!==n[c].terminalType?n[c].terminalType:"",location:void 0!==n[c].metadata?n[c].metadata:""},o.push(p)}if(null!=t&&t.length>0)for(var u=function(e){var i=void 0,n=void 0,r=void 0,l=void 0,d=void 0,c=void 0,p=[],u=[],m=void 0,f=void 0,g=void 0;i=void 0!==t[e].userId?t[e].userId:"",n=void 0!==t[e].startTime?t[e].startTime:"",void 0!==t[e].endTime?(r=t[e].endTime,h.myEndTime=r):r="",void 0!==t[e].selectedDate&&t[e].selectedDate,l=void 0!==t[e].duration?t[e].duration:"",d=void 0!==t[e].terminalIP?t[e].terminalIP:"",null!=(c=void 0!==t[e].userConsoleResources?t[e].userConsoleResources:null)&&(void 0!==c.userConsoleResource?c.userConsoleResource.forEach((function(e){p.push(e.resourceId),u.push(e.duration)})):(p=[],u=[]));for(var v=0;v<a.length;v++)i===a[v].userId&&(m=a[v].userName,f=a[v].userSubjects);for(var b=0;b<o.length;b++)d===o[b].terminalKey&&(g=o[b].location);var y={userId:i,userName:m,startTime:new Date(n),endTime:new Date(r),terminalIP:d,resourceMetauserConsoleData:p,duration:l,terminalLocation:g,userSubjects:f,resourceDurationFromConsole:u};s.push(y)},h=this,m=0;m<t.length;m++)u(m);return{usersMetadata:a,schoolTerminalData:o,userConsoleData:s}},e.prototype.deatilData_Excel=function(e,t){var i,n=new Array;n=[];for(var a=0;a<e.length;a++){var r,o,s,l,d,c=void 0,p=void 0,u=void 0,h=void 0,m=void 0,f=new Array;r=e[a].userId,m=e[a].userSubjects,h=e[a].userName,null!=e[a].startTime&&""!=e[a].startTime&&null!=e[a].endTime&&""!=e[a].endTime&&(c=e[a].startTime.toLocaleTimeString("en-US",{hour12:!0}),p=e[a].endTime.toLocaleTimeString("en-US",{hour12:!0}),i=e[a].startTime.getDate()+"/"+(e[a].startTime.getMonth()+1)+"/"+e[a].startTime.getFullYear()),u=Math.floor(e[a].duration);s=e[a].terminalLocation,o=e[a].terminalIP;var g=s,v=o;if(l=e[a].resourceMetauserConsoleData,d=e[a].resourceDurationFromConsole,0==l.length)f=[h,m,i,c,p,u,g,v,"","","","","","",r],n.push(f);else for(var b=0;b<l.length;b++)for(var y=0;y<t.length;y++)l[b]===t[y].resouseID&&(f=[h,m,i,c,p,u,g,v,t[y].subject,t[y].grade,t[y].chapter,t[y].teachingpoint,t[y].title,this.getDisplaytypeValue(t[y].type),r,d[b]],n.push(f),h="",m="",i="",c="",p="",g="",v="",u="")}return n},e.prototype.deatilUsage_Excel=function(e){var t=[];if(e.length>0)for(var i=0;i<e.length;i++){var n={Name:e[i][0],Subjects:e[i][1],Date:e[i][2],startTime:e[i][3],endTime:e[i][4],"duration(mins)":e[i][5],location:e[i][6],IP:e[i][7],subjectTitle:e[i][8],gradeTitle:e[i][9],Chapter:e[i][10],tpTitle:e[i][11],resourceTitle:e[i][12],resourceType:e[i][13],"resourceDuration(sec)":e[i][15]};t.push(n)}return t},e.prototype.userSummary_Excel=function(e,t){for(var i=e.usersMetadata.userMetadata,n=new Array,a=new Array,r=new Array,o=new Array,s=new Array,l=new Array,d=new Array,c=0,p=0;p<i.length;p++){n=[],a=[],o=[],s=[],l=[],d=[],c=0;for(var u=0;u<t.length;u++)i[p].userId===t[u][14]&&(""!=t[u][12]&&n.push(t[u][12]),""!=t[u][13]&&a.push(t[u][13]),""!=t[u][5]&&(c+=t[u][5]),o.push(t[u][6]),s.push(t[u][2]),l.push(t[u][9]),d.push(t[u][8]));var h=void 0,m=void 0,f=void 0,g=void 0,v=void 0;h=o.length>0?b(new Set(o))[0]:"",v=s.length>0?b(new Set(s)).length:"",m=s.length>0?b(new Set(s))[0]:"",f=l.length>0?b(new Set(l))[0]:"",g=d.length>0?b(new Set(d))[0]:"";var y={Name:this.getName(i[p]),Subjects:i[p].userSubjects,duration:c,ClassRooms:h,DatesAccess:m,DayAccess:v,Grades:f,SubjectTought:g,AseestUsed:n,AssetType:a};r.push(y)}var x=new Array,w=function(e){var t=[],i=r[e].AssetType;i=b(new Set(i)),r[e].AssetType.forEach((function(e){t[e]=(t[e]||0)+1})),D.resourceTypes.filter((function(e){return!i.includes(e)})).forEach((function(e){t[e]=0}));var n={Name:r[e].Name,Subjects_taught:r[e].Subjects," Duration(mins)":r[e].duration,ClassRooms:r[e].ClassRooms,DaysAccsessed:r[e].DayAccess,DatesAccess:r[e].DatesAccess,Grades:r[e].Grades,Subjects:r[e].SubjectTought},a=Object.assign(n,t);x.push(a)},D=this;for(p=0;p<r.length;p++)w(p);return x},e.prototype.getDisplaytypeValue=function(e){var t=e;return[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"}].forEach((function(i){i.type===e&&(t=i.display)})),t},e}();w.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new w},token:w,providedIn:"root"}),w.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[]};var D=function(){function e(e,i){this.excelService=e,this.pdService=i,this.userSelectedDate=new t.EventEmitter,this.refreshTimer=0,this.title="datepicker",this.date=new Date,this.options={inputClass:"input",calendarClass:"datepicker-default",scrollBarColor:"#010001",format:"dd/LL/yyyy",maxDate:new Date}}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadData(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){this.urlParams=new URLSearchParams(window.location.search),this.isDemo="1"===this.urlParams.get("demo"),this.getDefaultDate(),this.startTimer()},e.prototype.getDefaultDate=function(){var e=this.isDemo?new Date("2025-05-21T00:00:00"):new Date;this.getDateFormat(e),this.todayDate=this.calenderCurrentDate,console.log("this.isDemo",this.isDemo),this.isDemo&&(this.mydata=null,this.refreshChart(),this.pdService.openSmallTable.next(!1))},e.prototype.dateSelected=function(e){var t=this.isDemo?new Date("2025-05-21T00:00:00"):new Date(e);console.log("Selected Date:",t),this.getDateFormat(t),this.mydata=null,this.refreshChart(),this.pdService.openSmallTable.next(!1)},e.prototype.getDateFormat=function(e){var t,i=e.getDate(),n=e.getMonth()+1;t=n<10?"0"+n:n;var a=e.getFullYear()+"-"+t+"-"+(i<10?"0"+i:i);this.currentDate=a,this.calenderCurrentDate=a.split("-").reverse().join("-")},e.prototype.refreshChart=function(){this.stopTimer(),this.refreshTimer=0,this.calenderCurrentDate===this.todayDate&&this.countDown(),this.userSelectedDate.emit(this.calenderCurrentDate)},e.prototype.startTimer=function(){this.countDown()},e.prototype.stopTimer=function(){this.clearTimer(),this.message=""},e.prototype.clearTimer=function(){this.refreshTimer=0,window.clearInterval(this.intervalId)},e.prototype.countDown=function(){var e=this;this.clearTimer(),this.intervalId=window.setInterval((function(){e.refreshTimer-=1,0===e.refreshTimer?(e.refreshChart(),e.message=""):(e.refreshTimer<0&&(e.refreshTimer=300),e.message=""+e.refreshTimer)}),1e3)},e.prototype.timeConvert=function(e){var t=e/60,i=Math.floor(t),n=60*(t-i);return i+":"+Math.round(n)},e.prototype.loadData=function(e){if(e&&(this.mydata=this.pdService.parseData(e),this.mydata)){var t=this.excelService.genarateUserReqiuredData_Excel(this.mydata).userConsoleData,i=this.excelService.genarateResourseReqiuredData_Excel(this.mydata),n=this.excelService.deatilData_Excel(t,i),a=this.excelService.deatilUsage_Excel(n),r=this.excelService.userSummary_Excel(this.mydata,n),o=this.mydata.schoolMetadata.school,s=a,l=this.mydata.schoolTerminals.schoolTerminal;this.dataList=[[o],r,l,s]}},e.prototype.exportReport=function(){this.mydata&&this.excelService.exportAsExcelFile(this.dataList,"UsageReport-"+this.calenderCurrentDate)},e.prototype.ngOnDestroy=function(){this.clearTimer()},e}();D.decorators=[{type:t.Component,args:[{selector:"lib-header",template:'<div id="pd_header" class="pd_header">\n \n <div *ngIf="message && mydata && (this.todayDate === this.calenderCurrentDate)" id="pd_refeshView" class="pd_refesh_bar">\n <div class="timer_msg"> This page will be refreshed in</div>\n <div class="timer_value"> {{timeConvert(message)}} min</div>\n <div id="pd_refeshBtn" (click)="refreshChart()"> Refresh </div>\n </div>\n\n <div id="pd_exportBtn" class="pd_exportButton" *ngIf="mydata"\n [ngClass]="{\'pd_exportButton_shiftRight\': this.todayDate != this.calenderCurrentDate}" (click)="exportReport()"> \n <span class="pd_exportButton_text">Download Report</span>\n <div class="pd_download_icon"></div>\n </div>\n \n <div class="pd_header_calendar">\n \x3c!-- <input type="Date" [max]="currentDate" [value]="currentDate" id="myCalendar" (input)="selectDate($event)" /> --\x3e\n <ngx-datepicker [(ngModel)]="date" [options]="options" (ngModelChange)="dateSelected($event)"></ngx-datepicker>\n </div>\n <div class="pd_header_content" >Realtime usage data</div>\n</div>\n',styles:['.pd_header{width:100%;background-color:#e0e0e0;height:50px;border-bottom:2px solid #fff}.pd_header_calendar{position:absolute;width:150px;margin:5px 5px 5px 17px}.pd_header_content{position:relative;width:350px;margin:0 auto;color:#000;text-align:center;font-size:30px;line-height:50px;pointer-events:none}.pd_exportButton{position:absolute;display:inline-block;right:144px;padding:0 16px;cursor:pointer;margin:9px 0 0;height:30px;width:160px;line-height:30px;background-color:#4285f9;font-size:10pt;font-weight:400;transition:right .5s;border-radius:5px;color:#fff;font-weight:700}.pd_exportButton_shiftRight{right:10px}.pd_download_icon{position:absolute;width:16px;height:16px;background-size:100% 100%;top:8px;background-repeat:no-repeat;display:inline-block;right:5px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAY0lEQVRIiWNgGOqAkQS1/8nRy0SCBWSBUQtGLRjiFpQzQDIXDKMDZLl6ch2Abgk2TLbhxFhCseH4LKGa4dgsIdpwZhIsOMoAKUEPMjAwNJLktFGADyDXStgyE8Vm07yoGPoAAH1UItbw1O5lAAAAAElFTkSuQmCC")}.pd_exportButton_text{position:relative;display:inline-block;width:130px}.pd_refesh_bar{position:absolute;color:#000;width:120px;height:78px;right:15px;top:4px;z-index:2;background-color:#fff;float:right;text-align:center;font-size:12px;border-radius:.25rem;border:1px solid #a09898;box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.75);-webkit-animation:refreshViewAnimate .6s;animation:refreshViewAnimate .6s}@-webkit-keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}@keyframes refreshViewAnimate{0%{opacity:.5;top:-32px}to{opacity:1;top:4px}}.timer_msg{position:absolute;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:14px;top:2px}.timer_value{font-weight:700;font-size:15px}#pd_refeshBtn,.timer_value{position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;top:28px}#pd_refeshBtn{background-color:#2172f6;cursor:pointer;width:60px;margin:0 auto;border-radius:3px;color:#fff;height:22px;line-height:20px}#pd_refeshBtn:hover{opacity:.6}::ng-deep.bs-datepicker{margin-left:200px}.bs-datepicker-body table td span.selected,.theme-default .bs-datepicker-body table td.selected span,.theme-default .bs-datepicker-body table td[class*=select-] span:after,.theme-default .bs-datepicker-body table td span[class*=select-]:after{background-color:#000}.bs-datepicker-head{background-color:#000!important}']}]}],D.ctorParameters=function(){return[{type:w},{type:u}]},D.propDecorators={data:[{type:t.Input}],userSelectedDate:[{type:t.Output}]};var T=function(){function e(e){this.pdService=e,this.myChartType=n.ChartType.Table,this.isUserWise=!0}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&this.loadTable(e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){},e.prototype.loadTable=function(e){var t=this;if(console.log("mresponse: ",e),e&&(this.myXmlData=this.pdService.parseData(e),this.myXmlData)){var i=this.pdService.genarateUserReqiuredData(this.myXmlData);this.currentdataList=i.userConsoleData;var n=this.pdService.allUserChartData();this.alluserList=n.fordurationTable,this.currentResoursedataList=this.pdService.genarateResourseReqiuredData(this.myXmlData)}this.tableViewDiv=document.getElementById("tableViewDiv"),this.tableRow=document.getElementById("tableRow"),this.tblBody=document.getElementById("tblBody"),this.tableViewDiv.style.display="none",this.pdService.chartType.subscribe((function(e){e&&t.updateChartType(e)})),this.pdService.isUserWise_data.subscribe((function(e){t.updateDataType(e)})),this.pdService.isAllUsers.subscribe((function(e){e?t.showAllUser():t.showCurrentDataUser()}))},e.prototype.findAndSimplifyNestedArray=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t])){var i=e[t];return i.every((function(e){return Array.isArray(e)&&e.every((function(t){return t===e[0]}))}))&&(e[t]=[[i[0][0]]]),e[t]}return"No nested array found."},e.prototype.showCurrentDataUser=function(){var e;this.tableViewData=this.pdService.dataForTableView(this.currentdataList,this.currentResoursedataList),this.tableViewData=this.replaceTopicAndChapter(this.tableViewData);for(var t=0;t<this.tableViewData.length;t++)(e=this.findAndSimplifyNestedArray(this.tableViewData[t]))[e.length-1]=e[e.length-1][0];for(var i=0;i<this.tableViewData.length;i++)this.mergerSourceWithRoomData(this.tableViewData[i]);this.tableViewData&&this.ueserWiseTableView(this.tableViewData)},e.prototype.replaceTopicAndChapter=function(e){var t="<span style='font-style: italic;color: #3F51B5;'>(seen)</span>";return e.map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e&&(e=(e=e.replace(/Topic :\s*(.+?)\s*:\s*\d+m \d+s/,"Topic: $1 "+t)).replace(/Chapter :\s*(.+?)\s*:\s*\d+m \d+s/,"Chapter: $1 "+t)),e})):e}))},e.prototype.mergerSourceWithRoomData=function(e){var t=e[e.length-1].join(" ");"ce6"===t?t='<span style="color:black;"></span>':"ce6-a"===t?t='<span style="color:#1b60d1;font-weight:bold;font-size:14px;"><i class="fa fa-android" aria-hidden="true"></i></span>':"c"===t&&(t='<span style="color:#1b60d1;font-weight:bold;font-size:14px; display:flex;"><i style="margin-top:-1px;" class="fa fa-android" aria-hidden="true"></i><i style="margin-left:5px;" class="fa fa-desktop" aria-hidden="true"></i></span>'),e[6]='<div style="display: flex;flex-direction: row;align-content: center;justify-content: flex-start;align-items: center;"><span style="font-size:11px !important;color:gray;font-weight:600;">'+e[6]+'</span><span style="color:transparent">-</span>'+t+"</div>",e.pop()},e.prototype.showAllUser=function(){var e;this.tableViewData=this.pdService.dataForTableView(this.alluserList,this.currentResoursedataList),console.log("11decc tableViewDataBBB",this.replaceTopicAndChapter(this.tableViewData)),this.tableViewData=this.replaceTopicAndChapter(this.tableViewData);for(var t=0;t<this.tableViewData.length;t++)(e=this.findAndSimplifyNestedArray(this.tableViewData[t]))[e.length-1]&&(e[e.length-1]=e[e.length-1][0]);for(var i=0;i<this.tableViewData.length;i++)this.mergerSourceWithRoomData(this.tableViewData[i]);this.tableViewData&&this.ueserWiseTableView(this.tableViewData)},e.prototype.updateDataType=function(e){this.isUserWise=e},e.prototype.updateChartType=function(e){this.myChartType=e,this.myChartType==n.ChartType.Timeline?this.tableViewDiv.style.display="none":this.tableViewDiv.style.display="block"},e.prototype.ueserWiseTableView=function(e){document.getElementById("tblBody").innerHTML="";for(var t=new Array,i=0,n=0;n<e.length;n++)for(var a=0;a<12;a++){var r=document.createElement("div");r.innerHTML=e[n][a],"undefined"!==r.textContent&&void 0!==r.textContent&&"undefined\nce6-a"!==r.textContent&&"undefined\nce6"!==r.textContent&&"undefined\n"!==r.textContent&&"undefined\nAndroid"!==r.textContent&&"undefined\nWeb"!==r.textContent&&"undefined\n"!==r.textContent&&"\nundefined"!==r.textContent&&" undefined"!==r.textContent&&"undefined-"!==r.textContent&&"undefined-c"!==r.textContent&&"undefined- "!==r.textContent||(r.textContent=""),t.push(r)}for(a=0;a<=e.length;a++){var o=document.createElement("tr"),s=void 0;for(n=0;n<12;n++)s=document.createElement("td"),i<t.length&&(s.appendChild(t[i]),o.appendChild(s)),i++;this.tblBody.appendChild(o)}},e}();T.decorators=[{type:t.Component,args:[{selector:"lib-tableview",template:'\n <div id="tableViewDiv" class="pd-tableViewDiv">\n \n <table class="table table-bordered" id="tableRow">\n <thead class="table-head">\n <tr class="table-headerRow">\n <th scope="col">Teacher Name</th>\n <th scope="col">Subjects</th>\n <th scope="col">Date</th>\n <th scope="col">Start Time</th>\n <th scope="col">End Time</th>\n <th scope="col">Duration (mins)</th>\n <th scope="col">Room</th>\n <th scope="col">Subject</th>\n <th scope="col">Topic of Class</th>\n <th scope="col">Chapter Name</th>\n <th scope="col">Topic Name</th>\n <th scope="col">Assets Details</th>\n \n </tr>\n </thead>\n <tbody id="tblBody">\n \n </tbody>\n </table>\n </div>\n \n',styles:[".pd-tableViewDiv{width:100%;height:744px;overflow:scroll}.pd-tableViewDiv #tableRow{font-size:small;width:100%;margin-left:24px;margin-top:10px}.pd-tableViewDiv .table-headerRow{font-weight:700}.pd-tableViewDiv .table-head{position:sticky;top:0;background:#fff}.roomCell{display:flex;flex-direction:row;align-content:center;justify-content:flex-start;align-items:center}"]}]}],T.ctorParameters=function(){return[{type:u}]},T.propDecorators={data:[{type:t.Input}]};var C=function(){function e(e){this.pdService=e,this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.usersCheckboxChecked=!1,this.classroomArray=[],this.allClassrooms=[],this.isDisplay=!1,this.isUserWise=!0,this.isAllUsers=!1,this.isInitialized=!1}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&(this.jsonResponse=this.pdService.parseData(e),this.isInitialized&&this.loadUserData())},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.loadUserData(),this.isInitialized=!0,this.pdService.isUserWise_data.subscribe((function(t){e.isUserWise=t})),this.pdService.isAllUsers.subscribe((function(t){e.isAllUsers=!!t})),this.pdService.chartType.subscribe((function(t){t&&(console.log("newTable",t),e.isDisplay="Table"===t)}))},Object.defineProperty(e.prototype,"userRows",{get:function(){return this.isAllUsers?this.allUsers:this.currentUserArray},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classroomRows",{get:function(){return this.isAllUsers?this.allClassrooms:this.classroomArray},enumerable:!1,configurable:!0}),e.prototype.loadUserData=function(){var e=this,t=this.jsonResponse;if(this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.classroomArray=[],this.allClassrooms=[],t){var i=t.usersConsole.userConsole,n=t.usersMetadata.userMetadata,a=t.resourcesMetadata.resourceMetadata;i.forEach((function(t){var i,r=n.find((function(e){return e.userId===t.userId}));if(null==t?void 0:t.userConsoleResources){var o=null===(i=t.userConsoleResources)||void 0===i?void 0:i.userConsoleResource;o&&o.length>0&&o.forEach((function(i,n){var o,s,l,d,c,p,u=i.resourceId,h=a.find((function(e){return e.resourceId===u&&i.type===e.type})),m=e.getDisplayTypeValue(i.type),f=(null==h?void 0:h.title)||"",g=null===(o=null==h?void 0:h.teachingPoint)||void 0===o?void 0:o.title,v=null===(s=null==h?void 0:h.subject)||void 0===s?void 0:s.title,b=null===(l=null==h?void 0:h.chapter)||void 0===l?void 0:l.title,y=null===(d=null==h?void 0:h.grade)||void 0===d?void 0:d.title,x=new Date(null==t?void 0:t.startTime),w=new Date(null==t?void 0:t.endTime),D=e.formatTime(Math.round((w.getTime()-x.getTime())/1e3)),T=parseInt((null==i?void 0:i.duration)||"0"),C=m+" : "+f+" : "+(T=(null===(c=null==i?void 0:i.type)||void 0===c?void 0:c.includes("question"))||(null===(p=null==i?void 0:i.type)||void 0===p?void 0:p.includes("cquestion"))?0:0===T?"<span class='seenTag' style='color:blue;'>(Seen)</span>":e.formatTime(T));""===f&&(C=m+" : "+T),e.currentUserArray.push({userId:t.userId,teacherName:0===n?null==r?void 0:r.fullName:"",subjects:0===n?null==r?void 0:r.userSubjects:"",date:0===n?null==t?void 0:t.selectedDate:"",startTime:0===n?e.formatDate(x):"",endtime:0===n?e.formatDate(w):"",totalDuration:0===n?D:"",room:0===n?null==t?void 0:t.terminalIP:"",tp:g,subject:v,chapter:b,grade:y,details:C})}))}}));var r=this.currentUserArray.map((function(e){return e.userId})).filter((function(e,t,i){return i.indexOf(e)===t}));this.remaningUsers=n.filter((function(e){return!r.includes(e.userId)})).map((function(e){return{userId:e.userId,teacherName:null==e?void 0:e.fullName,subjects:null==e?void 0:e.userSubjects,date:"",startTime:"",endtime:"",totalDuration:"0s",room:"",tp:"",subject:"",chapter:"",grade:"",details:""}})),this.allUsers=b(this.currentUserArray,this.remaningUsers),this.loadClassroomData(i,n,a),this.loadTable(this.currentUserArray)}},e.prototype.loadClassroomData=function(e,t,i){var n,a,r=this,o=(null===(a=null===(n=this.jsonResponse)||void 0===n?void 0:n.schoolTerminals)||void 0===a?void 0:a.schoolTerminal)||[],s={};o.forEach((function(e){s[e.terminalKey]=r.getTerminalLocation(e)}));var l={};e.forEach((function(e){var t=(null==e?void 0:e.terminalIP)||"";(l[t]=l[t]||[]).push(e)}));var d=function(e){return r.pdService.getRoomLabel(s[e],e)};Object.keys(l).sort((function(e,t){return d(e).localeCompare(d(t),void 0,{numeric:!0})})).forEach((function(e){l[e].sort((function(e,t){return new Date(e.startTime).getTime()-new Date(t.startTime).getTime()})).forEach((function(n,a){var o,s=t.find((function(e){return e.userId===n.userId})),l=new Date(null==n?void 0:n.startTime),c=new Date(null==n?void 0:n.endTime),p=r.formatTime(Math.round((c.getTime()-l.getTime())/1e3)),u=(null===(o=null==n?void 0:n.userConsoleResources)||void 0===o?void 0:o.userConsoleResource)||[];(u.length>0?u:[null]).forEach((function(t,o){var u,h,m,f,g=t&&i.find((function(e){return e.resourceId===t.resourceId&&t.type===e.type})),v=0===o;r.classroomArray.push({room:v&&0===a?d(e):"",teacherName:v?null==s?void 0:s.fullName:"",date:v?null==n?void 0:n.selectedDate:"",startTime:v?r.formatDate(l):"",endtime:v?r.formatDate(c):"",totalDuration:v?p:"",tp:null===(u=null==g?void 0:g.teachingPoint)||void 0===u?void 0:u.title,subject:null===(h=null==g?void 0:g.subject)||void 0===h?void 0:h.title,chapter:null===(m=null==g?void 0:g.chapter)||void 0===m?void 0:m.title,grade:null===(f=null==g?void 0:g.grade)||void 0===f?void 0:f.title,details:t?r.getAssetDetails(t,g):""})}))}))}));var c=o.filter((function(e){return!l[e.terminalKey]})).map((function(e){return{room:d(e.terminalKey),teacherName:"",date:"",startTime:"",endtime:"",totalDuration:"0s",tp:"",subject:"",chapter:"",grade:"",details:""}}));this.allClassrooms=b(this.classroomArray,c)},e.prototype.getTerminalLocation=function(e){var t;try{return(null==e?void 0:e.metadata)&&(null===(t=JSON.parse(e.metadata))||void 0===t?void 0:t.location)||""}catch(e){return""}},e.prototype.getAssetDetails=function(e,t){var i,n,a=this.getDisplayTypeValue(e.type),r=(null==t?void 0:t.title)||"",o=parseInt((null==e?void 0:e.duration)||"0");return o=(null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.includes("question"))||(null===(n=null==e?void 0:e.type)||void 0===n?void 0:n.includes("cquestion"))?0:0===o?"<span class='seenTag' style='color:blue;'>(Seen)</span>":this.formatTime(o),""===r?a+" : "+o:a+" : "+r+" : "+o},e.prototype.getDisplayTypeValue=function(e){var t=[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"},{type:"ebook",display:"Ebook"}].find((function(t){return t.type===e}));return t?t.display:e},e.prototype.formatDate=function(e){var t=e.getHours(),i=e.getMinutes(),n=e.getSeconds(),a=t>=12?"PM":"AM";return(t=t%12||12).toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+n.toString().padStart(2,"0")+" "+a},e.prototype.formatTime=function(e){var t=Math.floor(e/86400),i=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),a=e%60;return e<60?a+"s":e<3600?n+"m "+a+"s":e<86400?i+"h "+n+"m "+a+"s":t+"d "+i+"h "+n+"m "+a+"s"},e.prototype.loadTable=function(e){},e.prototype.toggleUsers=function(){this.usersCheckboxChecked=!this.usersCheckboxChecked,this.loadTable(this.usersCheckboxChecked?this.allUsers:this.currentUserArray)},e.prototype.getMockJson=function(){return{}},e}();C.decorators=[{type:t.Component,args:[{selector:"lib-full-table-view",template:'\n<div class="tableViewList" *ngIf="isDisplay">\n \x3c!-- <label for="usersCheckbox">All</label>\n <input\n type="checkbox"\n id="usersCheckbox"\n [checked]="usersCheckboxChecked"\n (change)="toggleUsers()"\n /> --\x3e\n <div class="tableArea">\n \n <table id="teacherTable" *ngIf="isUserWise">\n <thead class="tablehead">\n <tr>\n <th>Teacher Name</th>\n <th>Subjects</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Room</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let user of userRows">\n <td>{{ user.teacherName }}</td>\n <td>{{ user.subjects }}</td>\n <td>{{ user.date }}</td>\n <td>{{ user.startTime }}</td>\n <td>{{ user.endtime }}</td>\n <td>{{ user.totalDuration }}</td>\n <td>{{ user.room }}</td>\n <td>{{ user.tp }}</td>\n <td>{{ user.subject }}</td>\n <td>{{ user.chapter }}</td>\n <td>{{ user.grade }}</td>\n <td><div [innerHTML]="user.details"></div></td>\n </tr>\n </tbody>\n </table>\n\n <table id="classroomTable" *ngIf="!isUserWise">\n <thead class="tablehead">\n <tr>\n <th>Room</th>\n <th>Teacher Name</th>\n <th>Date</th>\n <th>Start Time</th>\n <th>End Time</th>\n <th>Total Duration</th>\n <th>Topic</th>\n <th>Subject</th>\n <th>Chapter</th>\n <th>Grade</th>\n <th>Details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let row of classroomRows" [class.roomStart]="row.room">\n <td class="roomCell">{{ row.room }}</td>\n <td>{{ row.teacherName }}</td>\n <td>{{ row.date }}</td>\n <td>{{ row.startTime }}</td>\n <td>{{ row.endtime }}</td>\n <td>{{ row.totalDuration }}</td>\n <td>{{ row.tp }}</td>\n <td>{{ row.subject }}</td>\n <td>{{ row.chapter }}</td>\n <td>{{ row.grade }}</td>\n <td><div [innerHTML]="row.details"></div></td>\n </tr>\n </tbody>\n </table>\n </div>\n \n</div>\n ',styles:["body{font-family:Arial,sans-serif;margin:20px}.tablehead{position:sticky;top:0;background:#fff}table{width:100%;border-collapse:collapse}td,th{border:1px solid #ddd;padding:8px;text-align:left}th{background-color:#f4f4f4;font-weight:700}tr:nth-child(2n){background-color:#f9f9f9}tr:hover{background-color:#f1f1f1}.tableViewList{position:absolute;margin-top:20px}.tableArea{height:700px;overflow:scroll;font-size:12px;margin:20px 5px 5px}.seenTag{color:#00f}.roomCell{font-weight:700}.roomStart td{border-top:2px solid #b7b7b7}"]}]}],C.ctorParameters=function(){return[{type:u}]},C.propDecorators={data:[{type:t.Input}]};var k=function(){function e(e){this.pdService=e,this.currentTimeFrameUserArray=[],this.currentUserArray=[],this.remaningUsers=[],this.allUsers=[],this.usersCheckboxChecked=!1,this.isDisplay=!1,this.accentColor="",this.mode="session",this.allTitle="",this.allSummary=[],this.otherColumn="Room",this.people=[],this.peopleTitle=""}return Object.defineProperty(e.prototype,"data",{set:function(e){null!==e&&(this.jsonResponse=this.pdService.parseData(e))},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.pdService.openSmallTable$.subscribe((function(t){if(t){if(e.isDisplay=!0,e.accentColor=e.pdService.detailAccentColor,t.allSessions&&e.pdService.detailRowRequest)return void e.loadRowSessions(e.pdService.detailRowRequest);e.mode="session";var i=e.findUserIdByName(t.userDetails[0]),n=t.userDetails[1],a=t.userDetails[3];e.loadUserData(i,n,a)}else e.isDisplay=!1})),this.pdService.chartType.subscribe((function(t){e.isDisplay=!1}))},e.prototype.findUserIdByName=function(e){var t=this.jsonResponse.usersMetadata.userMetadata.find((function(t){return t.fullName===e}));return t?t.userId:null},e.prototype.loadUserData=function(e,t,i){var n=this;this.currentUserArray=[],this.allUsers=[],this.currentTimeFrameUserArray=[];var a=this.jsonResponse,r=a.usersConsole.userConsole,o=a.usersMetadata.userMetadata,s=a.resourcesMetadata.resourceMetadata;(e?r.filter((function(t){return t.userId===e})):r).forEach((function(e){var t;(t=n.currentUserArray).push.apply(t,b(n.rowsForConsole(e,o,s)))}));var l=this.currentUserArray.map((function(e){return e.userId})).filter((function(e,t,i){return i.indexOf(e)===t}));this.remaningUsers=o.filter((function(e){return!l.includes(e.userId)})).map((function(e){return{userId:e.userId,teacherName:null==e?void 0:e.fullName,subjects:null==e?void 0:e.userSubjects,date:"",startTime:"",endtime:"",totalDuration:"0s",room:"",tp:"",subject:"",chapter:"",grade:"",details:""}})),this.allUsers=b(this.currentUserArray,this.remaningUsers),this.currentTimeFrameUserArray=this.filterDataByCriteria(this.currentUserArray,e,t,i),console.log("smallData",this.currentTimeFrameUserArray)},e.prototype.loadRowSessions=function(e){var t=this;this.mode="all";var i=this.jsonResponse,n=i.usersConsole.userConsole,a=i.usersMetadata.userMetadata,r=i.resourcesMetadata.resourceMetadata,o=e.sessions,s=n.filter((function(e){return o.some((function(t){return t.userId===e.userId&&t.ip===e.terminalIP&&t.start===new Date(e.startTime).getTime()}))})).sort((function(e,t){return new Date(e.startTime).getTime()-new Date(t.startTime).getTime()})),l=function(e){return(a.find((function(t){return t.userId===e}))||{}).fullName||""},d=function(e){return t.getRoomName(e)||e};this.otherColumn=e.isUserWise?"Room":"Teacher";var c=[];s.forEach((function(i){var n=new Date(i.startTime),o=new Date(i.endTime),s={sessionHead:!0,sessionTime:t.formatClock(n)+" – "+t.formatClock(o),sessionDuration:t.formatTime(Math.round((o.getTime()-n.getTime())/1e3)),sessionOther:e.isUserWise?d(i.terminalIP):l(i.userId)},p=t.rowsForConsole(i,a,r);0===p.length?c.push(Object.assign(Object.assign({},s),{empty:!0})):p.forEach((function(e,t){return c.push(0===t?Object.assign(Object.assign({},e),s):e)}))})),this.currentTimeFrameUserArray=c;var p=new Map;s.forEach((function(t){var i=e.isUserWise?d(t.terminalIP):l(t.userId);if(i){var n=new Date(t.endTime).getTime()-new Date(t.startTime).getTime();p.set(i,(p.get(i)||0)+Math.max(n,0))}})),this.people=Array.from(p.entries()).map((function(e){var i=v(e,2),n=i[0],a=i[1];return{label:n,time:t.formatTime(Math.round(a/1e3))}})),this.peopleTitle=e.isUserWise?"Rooms used":"Teachers in this room",this.allTitle=!e.isUserWise&&/^\d+$/.test(String(e.label).trim())?"Room "+e.label:e.label,this.allSummary=[{label:"Sessions",value:""+s.length,icon:"sessions",tone:"lime"},{label:e.isUserWise?"Rooms":"Teachers",value:""+this.people.length,icon:e.isUserWise?"room":"teacher",tone:"sand"},{label:"First start",value:s.length?this.formatDate(new Date(s[0].startTime)):"—",icon:"start",tone:"sky"},{label:"Last end",value:s.length?this.formatDate(new Date(Math.max.apply(Math,b(s.map((function(e){return new Date(e.endTime).getTime()})))))):"—",icon:"end",tone:"sky"},{label:"Total time",value:e.total||"—",icon:"clock",tone:"mint"}]},Object.defineProperty(e.prototype,"sessionSummary",{get:function(){var e=this.currentTimeFrameUserArray[0]||{};return[{label:"Subject",value:e.subject||"—",icon:"subject",tone:"lime"},{label:"Room",value:e.roomName||e.room||"—",icon:"room",tone:"sand"},{label:"Start",value:e.startTime||"—",icon:"start",tone:"sky"},{label:"End",value:e.endtime||"—",icon:"end",tone:"sky"},{label:"Total time",value:e.totalDuration||"—",icon:"clock",tone:"mint"}]},enumerable:!1,configurable:!0}),e.prototype.formatClock=function(e){var t=e.getHours();return(t%12||12)+":"+e.getMinutes().toString().padStart(2,"0")+" "+(t>=12?"PM":"AM")},e.prototype.rowsForConsole=function(e,t,i){var n,a=this,r=[],o=t.find((function(t){return t.userId===e.userId}));if(null==e?void 0:e.userConsoleResources){var s=null===(n=e.userConsoleResources)||void 0===n?void 0:n.userConsoleResource;s&&s.length>0&&s.forEach((function(t,n){var s,l,d,c,p,u,h=t.resourceId,m=i.find((function(e){return e.resourceId===h&&t.type===e.type})),f=a.getDisplayTypeValue(t.type),g=(null==m?void 0:m.title)||"",v=a.decodeHtmlEntities(null===(s=null==m?void 0:m.teachingPoint)||void 0===s?void 0:s.title),b=a.decodeHtmlEntities(null===(l=null==m?void 0:m.subject)||void 0===l?void 0:l.title),y=a.decodeHtmlEntities(null===(d=null==m?void 0:m.chapter)||void 0===d?void 0:d.title),x=a.decodeHtmlEntities(null===(c=null==m?void 0:m.grade)||void 0===c?void 0:c.title),w=new Date(null==e?void 0:e.startTime),D=new Date(null==e?void 0:e.endTime),T=a.formatTime(Math.round((D.getTime()-w.getTime())/1e3)),C=parseInt((null==t?void 0:t.duration)||"0"),k=f+" : "+g+" : "+(C=(null===(p=null==t?void 0:t.type)||void 0===p?void 0:p.includes("question"))||(null===(u=null==t?void 0:t.type)||void 0===u?void 0:u.includes("cquestion"))?0:0===C?"<span class='dddd'>(Seen)</span>":a.formatTime(C));""===g&&(k=f+" : "+C),r.push({userId:e.userId,teacherName:0===n?null==o?void 0:o.fullName:"",subjects:0===n?null==o?void 0:o.userSubjects:"",date:0===n?null==e?void 0:e.selectedDate:"",startTime:a.formatDate(w),endtime:a.formatDate(D),totalDuration:T,room:0===n?null==e?void 0:e.terminalIP:"",roomName:0===n?a.getRoomName(null==e?void 0:e.terminalIP):"",tp:v,subject:b,chapter:y,grade:x,details:k,ip:null==e?void 0:e.terminalIP,sessionStart:w.getTime()})}))}return r},e.prototype.filterDataByCriteria=function(e,t,i,n){var a=function(e){if(!e)return null;var t=v(e.split(" "),2),i=t[0],n=t[1],a=v(i.split(":").map(Number),3),r=a[0],o=a[1],s=a[2];return new Date(0,0,0,"PM"===n&&r<12?r+12:r,o,s)},r=a(i),o=a(n);return e.filter((function(e){if(e.userId!==t)return!1;if(!e.startTime||!e.endtime)return!1;var i=a(e.startTime),n=a(e.endtime);return i&&n&&i>=r&&n<=o})).map((function(e,t){return Object.assign(Object.assign({},e),{subsequentCount:t})}))},e.prototype.decodeHtmlEntities=function(e){if(!e)return e;var t=document.createElement("textarea");return t.innerHTML=e,t.value},e.prototype.getDisplayTypeValue=function(e){var t=[{type:"asset_media",display:"Media"},{type:"asset_print",display:"Print"},{type:"quiz",display:"Quiz"},{type:"question",display:"Question"},{type:"chapter",display:"Chapter"},{type:"tp",display:"Topic"},{type:"whiteboard",display:"Whiteboard"},{type:"widget",display:"Widget"},{type:"casset_media",display:"cMedia"},{type:"casset_print",display:"cPrint"},{type:"cquiz",display:"cQuiz"},{type:"cquestion",display:"cQuestion"},{type:"image",display:"Image"},{type:"video",display:"Video"},{type:"tools",display:"Tools"},{type:"feature",display:"Feature"}].find((function(t){return t.type===e}));return t?t.display:e},e.prototype.formatDate=function(e){var t=e.getHours(),i=e.getMinutes(),n=e.getSeconds(),a=t>=12?"PM":"AM";return(t=t%12||12).toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+n.toString().padStart(2,"0")+" "+a},e.prototype.formatTime=function(e){var t=Math.floor(e/86400),i=Math.floor(e%86400/3600),n=Math.floor(e%3600/60),a=e%60;return e<60?a+"s":e<3600?n+"m "+a+"s":e<86400?i+"h "+n+"m "+a+"s":t+"d "+i+"h "+n+"m "+a+"s"},e.prototype.loadTable=function(e){},e.prototype.toggleUsers=function(){this.usersCheckboxChecked=!this.usersCheckboxChecked,this.loadTable(this.usersCheckboxChecked?this.allUsers:this.currentUserArray)},e.prototype.getRoomName=function(e){var t,i,n,a=((null===(i=null===(t=this.jsonResponse)||void 0===t?void 0:t.schoolTerminals)||void 0===i?void 0:i.schoolTerminal)||[]).find((function(t){return t.terminalKey===e}));try{return(null==a?void 0:a.metadata)?((null===(n=JSON.parse(a.metadata))||void 0===n?void 0:n.location)||"").trim():""}catch(e){return""}},e.prototype.onEscape=function(){this.isDisplay&&this.onCloseBtnClick()},e.prototype.onCloseBtnClick=function(){this.isDisplay=!1},e}();k.decorators=[{type:t.Component,args:[{selector:"lib-small-table-view",template:'<div class="pd-detail-backdrop" *ngIf="isDisplay" (click)="onCloseBtnClick()">\n <div id="pd-deatilViewContainer" class="pd-detail-dialog" role="dialog" aria-modal="true" aria-labelledby="pd-detail-title" (click)="$event.stopPropagation()">\n <div class="pd-detail-header">\n <div class="pd-detail-heading">\n <span class="pd-detail-swatch" *ngIf="accentColor" [style.background-color]="accentColor"></span>\n <div>\n <div id="pd-detail-title" class="pd-detail-title">{{ (mode === \'all\' ? allTitle : currentTimeFrameUserArray[0]?.teacherName) || \'Details\' }}</div>\n <div class="pd-detail-subtitle">{{ mode === \'all\' ? \'All Sessions Today\' : \'Session Details\' }}</div>\n </div>\n </div>\n <button type="button" class="pd-detail-close" aria-label="Close" (click)="onCloseBtnClick()">&times;</button>\n </div>\n\n <div class="pd-detail-summary">\n <div class="pd-detail-card" *ngFor="let card of (mode === \'all\' ? allSummary : sessionSummary)" [ngClass]="\'pd-tone-\' + card.tone">\n <div class="pd-detail-card-label">\n <span class="pd-card-icon" [ngSwitch]="card.icon" aria-hidden="true">\n <svg *ngSwitchCase="\'sessions\'" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10" /></svg>\n <svg *ngSwitchCase="\'room\'" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8" /></svg>\n <svg *ngSwitchCase="\'teacher\'" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n <svg *ngSwitchCase="\'subject\'" viewBox="0 0 24 24"><path d="M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z" /><path d="M4 19a2 2 0 0 1 2-2h13" /></svg>\n <svg *ngSwitchCase="\'start\'" viewBox="0 0 24 24"><path d="M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4" /><path d="M4 12h11M11 8l4 4-4 4" /></svg>\n <svg *ngSwitchCase="\'end\'" viewBox="0 0 24 24"><path d="M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4" /><path d="M9 12h11M16 8l4 4-4 4" /></svg>\n <svg *ngSwitchCase="\'clock\'" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></svg>\n </span>\n {{ card.label }}\n </div>\n <div class="pd-detail-card-value">\n {{ card.value }}\n <span class="pd-detail-muted" *ngIf="card.sub">{{ card.sub }}</span>\n </div>\n </div>\n </div>\n\n <div class="pd-people" *ngIf="mode === \'all\' && people.length">\n <span class="pd-people-title">{{ peopleTitle }}</span>\n <span class="pd-person" *ngFor="let p of people">{{ p.label }} <span class="pd-person-time">{{ p.time }}</span></span>\n </div>\n\n <div class="pd-detail-body">\n <div class="pd-detail-empty" *ngIf="currentTimeFrameUserArray.length === 0">No content was opened in this session.</div>\n <table class="pd-detail-table" *ngIf="currentTimeFrameUserArray.length > 0">\n <thead>\n <tr>\n <ng-container *ngIf="mode === \'all\'">\n <th>Time</th>\n <th>{{ otherColumn }}</th>\n </ng-container>\n <th>Subject</th>\n <th>Class</th>\n <th>Chapter</th>\n <th>Topic</th>\n <th>Asset details</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor="let item of currentTimeFrameUserArray" [class.pd-session-start]="mode === \'all\' && item.sessionHead">\n <ng-container *ngIf="mode === \'all\'">\n <td class="pd-nowrap">\n <ng-container *ngIf="item.sessionHead">\n {{ item.sessionTime }}\n <div class="pd-detail-muted">{{ item.sessionDuration }}</div>\n </ng-container>\n </td>\n <td>{{ item.sessionHead ? item.sessionOther : \'\' }}</td>\n </ng-container>\n <ng-container *ngIf="!item.empty">\n <td>{{ item.subject || \'—\' }}</td>\n <td class="pd-nowrap">{{ item.grade || \'—\' }}</td>\n <td>{{ item.chapter || \'—\' }}</td>\n <td [class.pd-detail-muted]="!item.tp">{{ item.tp || \'—\' }}</td>\n <td [innerHTML]="item.details || \'\'"></td>\n </ng-container>\n <td *ngIf="item.empty" colspan="5" class="pd-detail-muted">No content was opened in this session.</td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</div>\n',styles:[".pd-detail-backdrop{position:fixed;inset:0;top:0;left:0;right:0;bottom:0;z-index:1000;background:rgba(17,24,39,.45);display:flex;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}.pd-detail-dialog{background:#fff;border-radius:12px;box-shadow:0 20px 50px rgba(0,0,0,.25);width:900px;max-width:100%;height:600px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;font-family:Arial,sans-serif;font-size:13px;color:#1f2937}.pd-detail-header{flex:0 0 auto;display:flex;align-items:flex-start;justify-content:space-between;padding:18px 20px 12px;border-bottom:1px solid #e5e7eb}.pd-detail-title{font-size:20px;font-weight:700;line-height:1.3;color:#1f2937}.pd-detail-heading{display:flex;align-items:flex-start;gap:12px}.pd-detail-swatch{flex:0 0 auto;width:14px;height:14px;border-radius:50%;margin-top:6px}.pd-detail-subtitle{font-size:15px;font-weight:700;color:#c9952b;margin-top:4px}.pd-detail-close{border:none;background:#f3f4f6;color:#374151;width:32px;height:32px;border-radius:50%;font-size:22px;line-height:30px;cursor:pointer;flex-shrink:0}.pd-detail-close:hover{background:#e5e7eb}.pd-detail-summary{flex:0 0 auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;padding:14px 20px}.pd-detail-card{background:#f9fafb;border:1px solid #e5e7eb;border-radius:10px;padding:12px 14px;text-align:center}.pd-detail-card.pd-tone-lime{background:#eef6a3;border-color:#dfe98a}.pd-detail-card.pd-tone-sand{background:#f6ecd9;border-color:#ebdcc0}.pd-detail-card.pd-tone-sky{background:#e1edfb;border-color:#cbdcf3}.pd-detail-card.pd-tone-mint{background:#f3fbe6;border-color:#dfeecb}.pd-detail-card-label{display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-bottom:6px}.pd-card-icon{display:inline-flex}.pd-card-icon svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.pd-detail-card-value{font-size:15px;font-weight:700;word-break:break-word}.pd-people{flex:0 0 auto;display:flex;flex-wrap:wrap;align-items:center;gap:6px;max-height:72px;overflow:auto;padding:0 20px 12px}.pd-people-title{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-right:4px}.pd-person{padding:4px 10px;border-radius:999px;background:#f6ecd9;border:1px solid #ebdcc0;font-size:12px;font-weight:700;color:#1f2937}.pd-person-time{font-weight:400;color:#6b7280;margin-left:4px}.pd-detail-muted{color:#9ca3af;font-weight:400}.pd-detail-body{overflow:auto;margin:0 20px 20px;flex:1 1 auto;min-height:0;border:1px solid #e5e7eb;border-radius:8px}.pd-detail-table{width:100%;border-collapse:separate;border-spacing:0}.pd-detail-table td,.pd-detail-table th{text-align:left;padding:9px 12px;border-bottom:1px solid #f0f0f0;vertical-align:top}.pd-detail-table th{position:sticky;top:0;z-index:1;background:#f3f4f6;font-size:12px;color:#4b5563;font-weight:700}.pd-detail-table tbody tr:nth-child(2n) td{background:#fafafa}.pd-detail-table tbody tr.pd-session-start:not(:first-child) td{border-top:2px solid #e5e7eb}.pd-detail-table tbody tr:last-child td{border-bottom:none}.pd-detail-table tbody tr:hover td{background:#eef2ff}.pd-nowrap{white-space:nowrap}.pd-detail-empty{padding:24px;text-align:center;color:#6b7280}:host ::ng-deep .dddd{color:#2563eb;font-style:italic}"]}]}],k.ctorParameters=function(){return[{type:u}]},k.propDecorators={data:[{type:t.Input}],onEscape:[{type:t.HostListener,args:["document:keydown.escape"]}]};var A=function(){function e(){this.rows=[],this.labelTitle="Name",this.barClick=new t.EventEmitter,this.totalClick=new t.EventEmitter,this.renderedRows=[],this.ticks=[],this.quarterTicks=[],this.hourWidth=160,this.minWidth=0,this.nowLeft=null,this.sortKey="default",this.sortAsc=!0,this.tooltip=null,this.rangeStart=0,this.rangeEnd=0}return e.prototype.ngOnChanges=function(){this.render()},e.prototype.render=function(){var e=this,t=this.rows||[],i=t.reduce((function(e,t){return e.concat(t.bars)}),[]);if(0===i.length)return this.ticks=[],this.quarterTicks=[],this.nowLeft=null,this.minWidth=0,this.renderedRows=t.map((function(t,i){return e.toRenderedRow(t,i)})),void this.applySort();var n=Math.min.apply(Math,b(i.map((function(e){return e.start.getTime()})))),a=Math.max.apply(Math,b(i.map((function(e){return e.end.getTime()})))),r=36e5,o=new Date(n);o.setMinutes(0,0,0),this.rangeStart=o.getTime(),this.rangeEnd=Math.max(Math.ceil((a-this.rangeStart)/r)*r+this.rangeStart,this.rangeStart+r);var s=(this.rangeEnd-this.rangeStart)/r;this.minWidth=308+s*this.hourWidth,this.ticks=[],this.quarterTicks=[];for(var l=this.rangeStart;l<=this.rangeEnd;l+=9e5){var d=new Date(l).getMinutes();15===d||45===d?this.quarterTicks.push(this.toPercent(l)):this.ticks.push({left:this.toPercent(l),label:this.formatClock(new Date(l)),major:0===d})}var c=Date.now();this.nowLeft=c>=this.rangeStart&&c<=this.rangeEnd?this.toPercent(c):null,this.renderedRows=t.map((function(t,i){return e.toRenderedRow(t,i)})),this.applySort()},e.prototype.toggleSort=function(e){this.sortKey===e?this.sortAsc?this.sortAsc=!1:(this.sortKey="default",this.sortAsc=!0):(this.sortKey=e,this.sortAsc="name"===e),this.applySort()},e.prototype.sortIcon=function(e){return this.sortKey!==e?"":this.sortAsc?"▲":"▼"},e.prototype.onBarClick=function(e){this.tooltip=null,this.barClick.emit({index:e.index,color:e.color})},e.prototype.onTotalClick=function(e){e.bars.length&&(this.tooltip=null,this.totalClick.emit({label:e.label,indexes:e.bars.map((function(e){return e.index})),color:e.color,total:e.total}))},e.prototype.showTooltip=function(e,t){this.tooltip={text:t.tooltip,x:e.clientX+12,y:e.clientY+12}},e.prototype.hideTooltip=function(){this.tooltip=null},e.prototype.trackByLabel=function(e,t){return t.label},e.prototype.toRenderedRow=function(e,t){var i=this,n=this.mergedDuration(e.bars),a=e.bars.map((function(e){return e.start.getTime()})),r=e.bars.map((function(e){return e.end.getTime()})),o=a.length?this.toPercent(Math.min.apply(Math,b(a))):0;return{spanLeft:o,spanWidth:r.length?this.toPercent(Math.max.apply(Math,b(r)))-o:0,label:e.label,color:this.rowColor(t),totalMs:n,total:this.formatDuration(n),order:t,bars:e.bars.map((function(e){var n=i.toPercent(e.start.getTime());return Object.assign(Object.assign({},e),{left:n,width:Math.max(i.toPercent(e.end.getTime())-n,0),color:i.rowColor(t)})}))}},e.prototype.rowColor=function(e){return"hsl("+Math.round((217+137.508*e)%360)+", 62%, 68%)"},e.prototype.applySort=function(){var e=this,t=this.sortAsc?1:-1;this.renderedRows=b(this.renderedRows).sort((function(i,n){return"name"===e.sortKey?t*i.label.localeCompare(n.label,void 0,{numeric:!0}):"total"===e.sortKey?t*(i.totalMs-n.totalMs):i.order-n.order}))},e.prototype.mergedDuration=function(e){var t=b(e).sort((function(e,t){return e.start.getTime()-t.start.getTime()})),i=0,n=null,a=null;return t.forEach((function(e){var t=e.start.getTime(),r=e.end.getTime();null===a||t>a?(null!==a&&(i+=a-n),n=t,a=r):r>a&&(a=r)})),null!==a&&(i+=a-n),i},e.prototype.toPercent=function(e){var t=this.rangeEnd-this.rangeStart;return t>0?(e-this.rangeStart)/t*100:0},e.prototype.formatClock=function(e){var t=e.getHours(),i=e.getMinutes(),n=t>=12?"PM":"AM";return t=t%12||12,0===i?t+" "+n:t+":"+i.toString().padStart(2,"0")},e.prototype.formatDuration=function(e){var t=Math.round(e/6e4);return Math.floor(t/60)+":"+(t%60).toString().padStart(2,"0")+" hrs"},e}();A.decorators=[{type:t.Component,args:[{selector:"lib-timeline",template:'<div class="tl-container" [style.min-width.px]="minWidth">\n <div class="tl-row tl-header">\n <div class="tl-label tl-sortable" (click)="toggleSort(\'name\')">{{ labelTitle }} {{ sortIcon(\'name\') }}</div>\n <div class="tl-track tl-axis">\n <div class="tl-mark tl-mark-quarter" *ngFor="let left of quarterTicks" [style.left.%]="left"></div>\n <div class="tl-mark" *ngFor="let tick of ticks" [class.tl-mark-hour]="tick.major" [style.left.%]="tick.left"></div>\n <div class="tl-tick" *ngFor="let tick of ticks" [class.tl-minor]="!tick.major" [style.left.%]="tick.left">{{ tick.label }}</div>\n </div>\n <div class="tl-total tl-sortable" (click)="toggleSort(\'total\')">Total {{ sortIcon(\'total\') }}</div>\n </div>\n\n <div class="tl-empty" *ngIf="renderedRows.length === 0">No usage data for this view.</div>\n\n <div class="tl-row" *ngFor="let row of renderedRows; trackBy: trackByLabel; let odd = odd" [class.tl-odd]="odd">\n <div class="tl-label" [title]="row.label">{{ row.label }}</div>\n <div class="tl-track">\n <div class="tl-gridline" *ngFor="let tick of ticks" [class.tl-minor]="!tick.major" [style.left.%]="tick.left"></div>\n <div class="tl-span" *ngIf="row.bars.length" [style.left.%]="row.spanLeft" [style.width.%]="row.spanWidth"></div>\n <div class="tl-now" *ngIf="nowLeft !== null" [style.left.%]="nowLeft"></div>\n <div\n class="tl-bar"\n *ngFor="let bar of row.bars"\n [style.left.%]="bar.left"\n [style.width.%]="bar.width"\n [style.background-color]="bar.color"\n (click)="onBarClick(bar)"\n (mousemove)="showTooltip($event, bar)"\n (mouseleave)="hideTooltip()"\n ></div>\n </div>\n <div\n class="tl-total"\n [class.tl-total-link]="row.bars.length"\n [title]="row.bars.length ? \'Show all sessions\' : \'\'"\n (click)="onTotalClick(row)"\n >{{ row.bars.length ? row.total : \'—\' }}</div>\n </div>\n\n <div class="tl-tooltip" *ngIf="tooltip" [style.left.px]="tooltip.x" [style.top.px]="tooltip.y">{{ tooltip.text }}</div>\n</div>\n',styles:[".tl-container{font-family:Arial,sans-serif;font-size:13px;color:#1f2937;border:1px solid #e5e7eb;border-radius:8px;overflow:clip;min-width:900px;box-sizing:border-box;position:relative;isolation:isolate}.tl-row{display:flex;height:30px;border-bottom:1px solid #e2e6ec;background:#fff}.tl-row:hover:not(.tl-header){background:#eef2ff}.tl-odd{background:#f4f6f9}.tl-header{position:sticky;top:0;z-index:3;height:32px;background:#f8fafc;font-weight:700;color:#475569;border-bottom:1px solid #e5e7eb}.tl-label{flex:0 0 170px;overflow:hidden;text-overflow:ellipsis;border-right:1px solid #e5e7eb;left:0}.tl-label,.tl-total{padding:0 8px;line-height:30px;text-align:right;white-space:nowrap;position:sticky;z-index:2;background:inherit}.tl-total{flex:0 0 90px;font-variant-numeric:tabular-nums;color:#334155;border-left:1px solid #e5e7eb;right:0}.tl-total-link{cursor:pointer;color:#4338ca}.tl-total-link:hover{text-decoration:underline}.tl-sortable{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:32px}.tl-track{flex:1 1 auto;position:relative;margin:0 24px}.tl-axis .tl-tick{position:absolute;top:0;line-height:24px;transform:translateX(-50%);font-weight:400;font-size:11px;color:#64748b;white-space:nowrap}.tl-axis .tl-tick.tl-minor{font-size:10px;color:#94a3b8}.tl-axis .tl-mark{position:absolute;bottom:0;height:8px;border-left:2px solid #7c9cf5;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-hour{height:10px;border-left:2px solid #475569;transform:translateX(-1px)}.tl-axis .tl-mark.tl-mark-quarter{height:8px;border-left:1px solid #c3cad6;transform:translateX(-.5px)}.tl-gridline{position:absolute;top:0;bottom:0;border-left:1px solid #d3d2d2;z-index:3}.tl-gridline.tl-minor{border-left:1px dashed #d3d2d2}.tl-span{position:absolute;top:5px;bottom:5px;background:#e4e8ee;border-radius:2px}.tl-now{top:0;bottom:0;border-left:2px solid #f43f5e}.tl-bar,.tl-now{position:absolute;z-index:1}.tl-bar{top:5px;bottom:5px;min-width:4px;border-radius:2px;cursor:pointer;box-shadow:inset 1px 0 0 hsla(0,0%,100%,.45);transition:filter .12s}.tl-bar:hover{filter:brightness(.82);z-index:2;box-shadow:0 2px 6px rgba(79,70,229,.35)}.tl-empty{padding:16px;text-align:center;color:#666}.tl-tooltip{position:fixed;z-index:1000;background:#1e293b;color:#fff;font-size:12px;padding:6px 10px;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.2);white-space:pre-line;pointer-events:none;max-width:320px}"]}]}],A.propDecorators={rows:[{type:t.Input}],labelTitle:[{type:t.Input}],barClick:[{type:t.Output}],totalClick:[{type:t.Output}]};var S=6e4,M=36e5,I=function(){function e(e,t){this.pdService=e,this.host=t,this.schoolName="",this.dayLabel="",this.kpis=[],this.hourly=[],this.grades=[],this.topTeachers=[],this.subjectDonut={total:"",segments:[]},this.donutRadius=52,this.gradeColumns=[],this.roomTiles=[],this.idleRooms=[],this.inactiveTeachers=[],this.contentMix=[],this.chapters=[],this.attention=[],this.hasSessions=!1,this.isExporting=!1,this.detailsOpen=!1,this.eligibleCount=0,this.classroomCount=0,this.fileDate="",this.countFrame=0}return Object.defineProperty(e.prototype,"data",{set:function(e){if(e){var t=this.pdService.parseData(e);t&&this.build(t)}},enumerable:!1,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){return e.fitHeight()}))},e.prototype.fitHeight=function(){var e=this.host.nativeElement.querySelector(".in-page");if(e){var t=e.getBoundingClientRect().top;e.style.height=Math.max(window.innerHeight-t,240)+"px"}},e.prototype.build=function(e){var t=this,i=this.list(e,"usersMetadata","userMetadata"),n=this.list(e,"usersConsole","userConsole"),a=this.list(e,"resourcesMetadata","resourceMetadata"),r=this.list(e,"schoolTerminals","schoolTerminal");this.schoolName=e.schoolMetadata&&e.schoolMetadata.school&&e.schoolMetadata.school.schoolName||"";var o=new Map;i.forEach((function(e){return o.set(e.userId,e)}));var s=new Map;a.forEach((function(e){return s.set(e.resourceId,e)}));var l=new Map;r.forEach((function(e){return l.set(e.terminalKey,t.pdService.getRoomLabel(t.location(e.metadata),e.terminalKey))}));var d=r.filter((function(e){return"classroom"===e.terminalType})),c=n.map((function(e){return{userId:e.userId,ip:e.terminalIP,start:t.parseTime(e.startTime),end:t.parseTime(e.endTime),resources:(e.userConsoleResources&&e.userConsoleResources.userConsoleResource||[]).map((function(e){return{resourceId:e.resourceId,type:e.type}}))}})).filter((function(e){return!isNaN(e.start)&&!isNaN(e.end)&&e.end>=e.start})),p=c.filter((function(e){return e.end>e.start}));this.hasSessions=c.length>0;var u=c.length?new Date(Math.min.apply(Math,b(c.map((function(e){return e.start}))))):null;this.fileDate=u?[u.getDate(),u.getMonth()+1].map((function(e){return String(e).padStart(2,"0")})).join("-")+"-"+u.getFullYear():"",this.dayLabel=u?u.toLocaleDateString("en-GB",{weekday:"long",day:"numeric",month:"short",year:"numeric"}):"";var h=i.filter((function(e){return""!==(e.userSubjects||"")})),m=this.groupTime(p,(function(e){return e.userId})),f=this.countBy(p,(function(e){return e.userId})),g=new Set(c.map((function(e){return e.userId}))),y=Array.from(m.values()).reduce((function(e,t){return e+t}),0),x=h.filter((function(e){return g.has(e.userId)})).length;this.eligibleCount=h.length,this.classroomCount=d.length,this.topTeachers=this.toBars(Array.from(m.entries()).map((function(e){var i=v(e,2),n=i[0],a=i[1];return{label:t.userName(o.get(n),n),sub:(f.get(n)||0)+" sessions",value:a}})),(function(e){return t.formatDuration(e)}),8),this.inactiveTeachers=h.filter((function(e){return!g.has(e.userId)})).map((function(e){return t.userName(e,e.userId)})).sort((function(e,t){return e.localeCompare(t)}));var w=this.groupTime(p,(function(e){return e.ip})),D=new Set(c.map((function(e){return e.ip}))),T=d.filter((function(e){return D.has(e.terminalKey)})).length,C=p.length?Math.max.apply(Math,b(p.map((function(e){return e.end}))))-Math.min.apply(Math,b(p.map((function(e){return e.start})))):0,k=d.map((function(e){return e.terminalKey})).concat(Array.from(w.keys()).filter((function(e){return!d.some((function(t){return t.terminalKey===e}))}))),A=Math.max.apply(Math,b(Array.from(w.values()),[1]));if(this.roomTiles=k.map((function(e){var i=w.get(e)||0,n=C?Math.round(i/C*100):0;return{label:l.get(e)||e,display:i?t.formatDuration(i)+" · "+n+"% of the day":"Not used today",share:n,shade:n?t.navyShade(i/A):"",dark:!!n&&Math.pow(i/A,1.8)>.5,idle:!n,span:Math.min(Math.ceil(((l.get(e)||e).length+2)/5),4)}})).sort((function(e,t){return e.label.localeCompare(t.label,void 0,{numeric:!0})})),this.idleRooms=d.filter((function(e){return!D.has(e.terminalKey)})).map((function(e){return l.get(e.terminalKey)})).sort((function(e,t){return e.localeCompare(t,void 0,{numeric:!0})})),this.hourly=[],p.length){var S=new Date(Math.min.apply(Math,b(p.map((function(e){return e.start})))));S.setMinutes(0,0,0);for(var I=Math.max.apply(Math,b(p.map((function(e){return e.end})))),U=[],R=function(e){var t=new Set(p.filter((function(t){return t.start<e+M&&t.end>e})).map((function(e){return e.userId})));U.push({label:j.formatHour(new Date(e)),value:t.size})},j=this,E=S.getTime();E<I;E+=M)R(E);var N=Math.max.apply(Math,b(U.map((function(e){return e.value})),[1]));this.hourly=U.map((function(e){return Object.assign(Object.assign({},e),{percent:e.value/N*100,peak:e.value===N,color:t.utilisationColor(e.value/N)})}))}var L=this.hourly.reduce((function(e,t){return!e||t.value>e.value?t:e}),null),z=new Map,V=new Map;p.forEach((function(e){var i=e.resources.map((function(e){return s.get(e.resourceId)})).filter((function(e){return!!e}));t.share(z,i.map((function(e){return t.title(e.subject)})),e.end-e.start),t.share(V,i.map((function(e){return t.title(e.grade)})),e.end-e.start)})),this.subjectDonut=this.buildDonut(this.entries(z),7),this.grades=this.toBars(this.entries(V).sort((function(e,t){return e.label.localeCompare(t.label,void 0,{numeric:!0})})),(function(e){return t.formatDuration(e)}),0,!1),this.gradeColumns=this.grades.map((function(e){return Object.assign(Object.assign({},e),{short:t.shortGrade(e.label)})}));var B=c.reduce((function(e,t){return e.concat(t.resources)}),[]),W=this.countBy(B,(function(e){return t.typeLabel(e.type)}));this.contentMix=this.toBars(Array.from(W.entries()).map((function(e){var t=v(e,2);return{label:t[0],value:t[1]}})),(function(e){return""+e}),0).map((function(e,i){return Object.assign(Object.assign({},e),{color:t.color(i),percent:e.value/Math.max(B.length,1)*100})}));var O=new Map;B.forEach((function(e){var i=s.get(e.resourceId),n=i&&t.title(i.chapter);if(n){var a=t.title(i.subject)+"|"+t.title(i.grade)+"|"+n,r=O.get(a)||{n:0,sub:[t.title(i.subject),t.title(i.grade)].filter((function(e){return e})).join(" · ")};r.n++,O.set(a,r)}})),this.chapters=this.toBars(Array.from(O.entries()).map((function(e){var t=v(e,2),i=t[0],n=t[1];return{label:i.split("|")[2],sub:n.sub,value:n.n}})),(function(e){return e+" uses"}),8);var F=p.length?y/p.length:0,P=new Set(B.filter((function(e){return"tp"===e.type})).map((function(e){return e.resourceId})));this.kpis=[{label:"Active Teachers",value:x+" / "+h.length,hint:this.pct(x,h.length)+" of eligible teachers"},{label:"Classrooms Used",value:T+" / "+d.length,hint:this.pct(T,d.length)+" of classrooms"},{label:"Teaching Time",value:this.formatDuration(y),hint:this.formatDuration(g.size?y/g.size:0)+" per active teacher"},{label:"Sessions",value:""+p.length,hint:this.formatDuration(F)+" on average"},{label:"Content Used",value:""+B.length,hint:P.size+" distinct topics"},{label:"Peak Hour",value:L?L.label:"—",hint:L?L.value+" teachers in class":"No sessions"}],this.attention=[{label:"Teachers Not Active",icon:"teacher",value:this.inactiveTeachers.length,hint:"Eligible teachers with no session today"},{label:"Classrooms Not Used",icon:"room",value:this.idleRooms.length,hint:"Installed classrooms with no session today"},{label:"Sessions Under 5 Min",icon:"clock",value:p.filter((function(e){return e.end-e.start<3e5})).length,hint:"May be accidental log-ins"},{label:"Sessions Without Content",icon:"book",value:p.filter((function(e){return 0===e.resources.length})).length,hint:"Logged in but nothing was used"}],this.countUp()},e.prototype.buildDonut=function(e,t){var i=this,n=b(e).sort((function(e,t){return t.value-e.value})),a=n.slice(0,t),r=n.slice(t).reduce((function(e,t){return e+t.value}),0);r>0&&a.push({label:"Other",value:r});var o=a.reduce((function(e,t){return e+t.value}),0),s=2*Math.PI*this.donutRadius,l=0,d=a.map((function(e,t){var n=o?e.value/o*s:0,a=Object.assign(Object.assign({},e),{display:i.formatDuration(e.value),percent:o?Math.round(e.value/o*100):0,color:"Other"===e.label?"#c9d2e3":i.color(t),dash:Math.max(n-2,0)+" "+s,offset:-l});return l+=n,a}));return{total:this.formatDuration(o),segments:d}},e.prototype.utilisationColor=function(e,t){void 0===t&&(t=!1);var i=[{at:0,h:4,s:82,l:74},{at:.5,h:43,s:90,l:62},{at:1,h:88,s:45,l:56}],n=Math.min(Math.max(e,0),1),a=v(n<=.5?[i[0],i[1]]:[i[1],i[2]],2),r=a[0],o=a[1],s=(n-r.at)/(o.at-r.at),l=function(e,t){return Math.round(e+(t-e)*s)},d=l(r.l,o.l)+(t?12:0);return"hsl("+l(r.h,o.h)+", "+l(r.s,o.s)+"%, "+d+"%)"},e.prototype.navyShade=function(e){var t=[22,43,87],i=Math.pow(Math.min(Math.max(e,0),1),1.8),n=[234,241,251].map((function(e,n){return Math.round(e+(t[n]-e)*i)}));return"rgb("+n[0]+", "+n[1]+", "+n[2]+")"},e.prototype.shortGrade=function(e){var t=/^class\s+(.+)$/i.exec(e);return t?t[1]:e.split(/\s+/).filter((function(e){return e})).map((function(e){return e.charAt(0).toUpperCase()})).join("").slice(0,4)},Object.defineProperty(e.prototype,"activityNote",{get:function(){if(!this.hourly.length)return"";var e=this.hourly.reduce((function(e,t){return t.value>e.value?t:e})),t=this.hourly.reduce((function(e,t){return t.value<e.value?t:e}));return"Busiest at "+e.label+" with "+e.value+" teachers in class; quietest at "+t.label+" with "+t.value+"."},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"chaptersNote",{get:function(){var e=this.chapters[0];return e?"Most used: "+e.label+(e.sub?" ("+e.sub+")":"")+", "+e.display+".":""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subjectNote",{get:function(){var e=this.subjectDonut.segments.find((function(e){return"Other"!==e.label}));return e?e.label+" took the largest share of teaching time today ("+e.percent+"%, "+e.display+").":""},enumerable:!1,configurable:!0}),e.prototype.countUp=function(){var e=this;cancelAnimationFrame(this.countFrame);var t=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=function(t){e.kpis.forEach((function(e){return e.shown=e.value.replace(/\d+/g,(function(e){return""+Math.round(+e*t)}))})),e.attention.forEach((function(e){return e.shown=Math.round(e.value*t)}))};if(t)i(1);else{var n=performance.now(),a=function(t){var r=Math.min((t-n)/900,1);i(1-Math.pow(1-r,3)),r<1&&(e.countFrame=requestAnimationFrame(a))};i(0),this.countFrame=requestAnimationFrame(a)}},e.prototype.closeDetails=function(){this.detailsOpen=!1},e.prototype.initials=function(e){var t=(e||"").split(/\s+/).filter((function(e){return e&&!/^(mr|mrs|miss|ms|dr)\.?$/i.test(e)}));return t.length?(t[0][0]+(t.length>1?t[t.length-1][0]:"")).toUpperCase():"?"},e.prototype.downloadPdf=function(){return f(this,void 0,void 0,(function(){var e,t,i,n,a,r;return g(this,(function(o){switch(o.label){case 0:if(!(e=this.host.nativeElement.querySelector(".in-page"))||this.isExporting)return[2];this.isExporting=!0,(t=document.createElement("div")).setAttribute("data-pdf-wrapper",""),t.style.cssText="position:fixed;left:0;top:0;width:0;height:0;overflow:hidden;z-index:-1;",(i=e.cloneNode(!0)).classList.add("in-exporting"),i.style.width="1280px",t.appendChild(i),e.parentElement.appendChild(t),o.label=1;case 1:return o.trys.push([1,,3,4]),n=i.getBoundingClientRect().top,a=Array.from(i.querySelectorAll(".in-card")).map((function(e){return Math.round(e.getBoundingClientRect().top-n-8)})).filter((function(e,t,i){return e>0&&i.indexOf(e)===t})).sort((function(e,t){return e-t})),[4,p.default(i,{scale:2,backgroundColor:"#ffffff",onclone:function(e){var t=e.querySelector("[data-pdf-wrapper]");t&&(t.style.overflow="visible")}})];case 2:return r=o.sent(),this.savePdf(r,a.map((function(e){return 2*e}))),[3,4];case 3:return t.remove(),this.isExporting=!1,[7];case 4:return[2]}}))}))},e.prototype.savePdf=function(e,t){for(var i=this,n=new d.jsPDF({orientation:"portrait",unit:"mm",format:"a4"}),a=10,r=n.internal.pageSize.getWidth(),o=n.internal.pageSize.getHeight(),s=r-20,l=s/e.width,c=Math.floor((o-20-6)/l),p=[],u=0,h=function(){var i=Math.min(u+c,e.height);if(i<e.height){var n=t.filter((function(e){return e>u&&e<=i}));n.length&&(i=n[n.length-1])}p.push([u,i]),u=i};u<e.height;)h();p.forEach((function(t,d){var c=v(t,2),u=c[0],h=c[1],m=document.createElement("canvas");m.width=e.width,m.height=h-u,m.getContext("2d").drawImage(e,0,u,e.width,h-u,0,0,e.width,h-u),d>0&&n.addPage(),n.addImage(m.toDataURL("image/jpeg",.92),"JPEG",a,a,s,m.height*l),n.setFontSize(8),n.setTextColor(140),n.text(i.schoolName+" · Usage insights",a,o-5),n.text("Page "+(d+1)+" of "+p.length,r-a,o-5,{align:"right"})})),n.save("Insights-"+(this.fileDate||"report")+".pdf")},e.prototype.list=function(e,t,i){var n=e&&e[t]&&e[t][i];return Array.isArray(n)?n:[]},e.prototype.location=function(e){try{return("string"==typeof e?JSON.parse(e):e||{}).location||""}catch(e){return""}},e.prototype.parseTime=function(e){return e?new Date(String(e).replace(" ","T")).getTime():NaN},e.prototype.title=function(e){return(e&&e.title?String(e.title):"").trim()},e.prototype.typeLabel=function(e){if(!e)return"Other";var t=this.pdService.getDisplaytypeValue(e);if(t!==e)return t;var i=e.replace(/^c?asset_/,"").replace(/_/g," ");return i.charAt(0).toUpperCase()+i.slice(1)},e.prototype.userName=function(e,t){return e?this.pdService.getName(e):t},e.prototype.groupTime=function(e,t){var i=this,n=new Map;e.forEach((function(e){var i=t(e);n.set(i,(n.get(i)||[]).concat({start:e.start,end:e.end}))}));var a=new Map;return n.forEach((function(e,t){return a.set(t,i.mergedDuration(e))})),a},e.prototype.mergedDuration=function(e){var t=b(e).sort((function(e,t){return e.start-t.start})),i=0,n=null;return t.forEach((function(e){!n||e.start>n.end?(n&&(i+=n.end-n.start),n=Object.assign({},e)):e.end>n.end&&(n.end=e.end)})),n?i+n.end-n.start:i},e.prototype.countBy=function(e,t){var i=new Map;return e.forEach((function(e){return i.set(t(e),(i.get(t(e))||0)+1)})),i},e.prototype.share=function(e,t,i){var n=Array.from(new Set(t.filter((function(e){return e}))));n.forEach((function(t){return e.set(t,(e.get(t)||0)+i/n.length)}))},e.prototype.entries=function(e){return Array.from(e.entries()).map((function(e){var t=v(e,2);return{label:t[0],value:t[1]}}))},e.prototype.toBars=function(e,t,i,n){void 0===n&&(n=!0);var a=n?b(e).sort((function(e,t){return t.value-e.value})):e,r=i?a.slice(0,i):a,o=Math.max.apply(Math,b(r.map((function(e){return e.value})),[1]));return r.map((function(e){return Object.assign(Object.assign({},e),{display:t(e.value),percent:e.value/o*100})}))},e.prototype.color=function(e){var t=["#7c9cf5","#f6d27e","#a9bffa","#6fc6ba","#f4a98a","#c0aef7","#f3a6c8","#b4bfcf","#fbe7b4"];return t[e%t.length]},e.prototype.pct=function(e,t){return t?Math.round(e/t*100)+"%":"0%"},e.prototype.formatHour=function(e){var t=e.getHours();return(t%12||12)+" "+(t>=12?"PM":"AM")},e.prototype.formatDuration=function(e){var t=Math.round(e/S),i=Math.floor(t/60),n=t%60;return i?i+"h "+n+"m":n+"m"},e}();I.decorators=[{type:t.Component,args:[{selector:"lib-insights",template:'<div class="in-page">\n \x3c!-- title and headline numbers stay in view while the cards below scroll --\x3e\n <div class="in-sticky">\n <div class="in-heading">\n <div class="in-heading-text">{{ schoolName }}<span *ngIf="schoolName && dayLabel"> · </span>{{ dayLabel }}</div>\n <button\n type="button"\n class="in-pdf-btn"\n *ngIf="hasSessions"\n data-html2canvas-ignore="true"\n [disabled]="isExporting"\n (click)="downloadPdf()"\n >{{ isExporting ? \'Preparing PDF…\' : \'Download PDF\' }}</button>\n </div>\n\n <div class="in-kpis" *ngIf="hasSessions">\n <div class="in-kpi in-anim" *ngFor="let kpi of kpis; let i = index; let last = last" [class.in-kpi-accent]="last" [style.animation-delay.ms]="i * 60">\n <span class="in-kpi-icon">\n <svg viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2.5 7.5l5-5M3.5 2.5h4v4" /></svg>\n </span>\n <div class="in-kpi-label">{{ kpi.label }}</div>\n <div class="in-kpi-value">{{ kpi.shown || kpi.value }}</div>\n <div class="in-kpi-hint">{{ kpi.hint }}</div>\n </div>\n </div>\n </div>\n\n <div class="in-empty" *ngIf="!hasSessions">No usage was recorded on this day.</div>\n\n <ng-container *ngIf="hasSessions">\n\n \x3c!-- primary: what to act on, and who is using the system --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="120" class="in-anim in-card in-wide in-primary">\n <div class="in-card-title">Needs Attention</div>\n <div class="in-card-sub">Who and what to follow up on today</div>\n <div class="in-attention">\n <div class="in-attention-item in-anim-row" *ngFor="let a of attention; let i = index" [style.animation-delay.ms]="300 + i * 80">\n <div class="in-attention-value" [class.in-zero]="a.value === 0">{{ a.shown != null ? a.shown : a.value }}</div>\n <div>\n <div class="in-attention-label">\n <span class="in-inline-icon" [ngSwitch]="a.icon" aria-hidden="true">\n <svg *ngSwitchCase="\'teacher\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n <svg *ngSwitchCase="\'room\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8M7 9h6" /></svg>\n <svg *ngSwitchCase="\'clock\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9" /><path d="M12 7v5l3 2" /></svg>\n <svg *ngSwitchCase="\'book\'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2V5z" /><path d="M4 19a2 2 0 0 1 2-2h13" /></svg>\n </span>\n {{ a.label }}\n </div>\n <div class="in-muted">{{ a.hint }}</div>\n </div>\n </div>\n </div>\n \x3c!-- who to follow up: big tiles that shrink to slim bars when the lists open below (accordion) --\x3e\n <div class="in-follow" [class.in-follow-compact]="detailsOpen">\n <button type="button" class="in-follow-tile in-follow-teachers" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n <span class="in-follow-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n </span>\n <span class="in-follow-number">{{ attention[0]?.shown != null ? attention[0].shown : inactiveTeachers.length }}</span>\n <span class="in-follow-label-big">Teachers Not Active</span>\n <span class="in-muted">of {{ eligibleCount }} eligible teachers</span>\n <span class="in-avatars" *ngIf="inactiveTeachers.length">\n <span class="in-avatar" *ngFor="let name of inactiveTeachers.slice(0, 7)" [title]="name">{{ initials(name) }}</span>\n <span class="in-avatar in-avatar-more" *ngIf="inactiveTeachers.length > 7">+{{ inactiveTeachers.length - 7 }}</span>\n </span>\n </button>\n <button type="button" class="in-follow-tile in-follow-rooms" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n <span class="in-follow-icon">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8M7 9h6" /></svg>\n </span>\n <span class="in-follow-number">{{ attention[1]?.shown != null ? attention[1].shown : idleRooms.length }}</span>\n <span class="in-follow-label-big">Classrooms Not Used</span>\n <span class="in-muted">of {{ classroomCount }} installed classrooms</span>\n <span class="in-room-chips" *ngIf="idleRooms.length">\n <span class="in-room-chip" *ngFor="let room of idleRooms.slice(0, 6)">{{ room }}</span>\n <span class="in-room-chip in-avatar-more" *ngIf="idleRooms.length > 6">+{{ idleRooms.length - 6 }}</span>\n </span>\n </button>\n </div>\n <div class="in-follow-details" id="in-follow-details" *ngIf="detailsOpen">\n <ng-container *ngTemplateOutlet="followLists"></ng-container>\n </div>\n <div class="in-follow-foot" data-html2canvas-ignore="true">\n <button type="button" class="in-link-btn" [attr.aria-expanded]="detailsOpen" aria-controls="in-follow-details" (click)="detailsOpen = !detailsOpen">\n {{ detailsOpen ? \'Hide details\' : \'Show details\' }}\n <span class="in-link-chevron" [class.in-link-chevron-up]="detailsOpen" aria-hidden="true"></span>\n </button>\n </div>\n \x3c!-- the PDF can\'t open a modal, so it prints the full lists here instead --\x3e\n <div class="in-print-only">\n <ng-container *ngTemplateOutlet="followLists"></ng-container>\n </div>\n </section>\n <section [style.animation-delay.ms]="180" class="in-anim in-card">\n <div class="in-card-title">Most Active Teachers</div>\n <div class="in-card-sub">Time in class, overlapping sessions counted once</div>\n <ng-container *ngTemplateOutlet="bars; context: { $implicit: topTeachers, color: \'#8BC34A\' }"></ng-container>\n </section>\n </div>\n\n \x3c!-- supporting detail --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="240" class="in-anim in-card">\n <div class="in-card-title">Activity Through the Day</div>\n <div class="in-card-sub">Number of teachers in a session during each hour</div>\n <div class="in-hours">\n <div class="in-hour" *ngFor="let h of hourly; let i = index" [title]="h.label + \': \' + h.value + \' teachers\'">\n <div class="in-hour-value">\n <svg class="in-hour-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" /></svg>\n {{ h.value }}\n </div>\n <div class="in-hour-track">\n <div class="in-hour-bar" [class.in-peak]="h.peak" [style.height.%]="h.percent" [style.background-color]="h.color" [style.animation-delay.ms]="250 + i * 50"></div>\n </div>\n <div class="in-hour-label">{{ h.label }}</div>\n </div>\n </div>\n <div class="in-util-legend">\n <span class="in-muted">Low</span>\n <span class="in-util-scale"></span>\n <span class="in-muted">High</span>\n </div>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="activityNote">{{ activityNote }}</div>\n <div>Each column counts the teachers who were in a session at any point in that hour. Colour runs from red (quiet) to green (busiest hour).</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="300" class="in-anim in-card">\n <div class="in-card-title">Most Used Chapters</div>\n <div class="in-card-sub">Chapters and their topics used today</div>\n <ng-container *ngTemplateOutlet="bars; context: { $implicit: chapters, color: \'#f4a98a\' }"></ng-container>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="chaptersNote">{{ chaptersNote }}</div>\n <div>Counts how many times each chapter, or a topic inside it, was opened in class today. Bars are relative to the most used chapter.</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="360" class="in-anim in-card">\n <div class="in-card-title">Content Utilisation</div>\n <div class="in-card-sub">What teachers used in class</div>\n <div class="in-stack">\n <div\n class="in-stack-part"\n *ngFor="let c of contentMix; let i = index"\n [style.animation-delay.ms]="300 + i * 60"\n [style.width.%]="c.percent"\n [style.background-color]="c.color"\n [title]="c.label + \': \' + c.display"\n ></div>\n </div>\n <div class="in-legend">\n <div class="in-legend-item" *ngFor="let c of contentMix">\n <span class="in-dot" [style.background-color]="c.color"></span>\n <span class="in-legend-label">{{ c.label }}</span>\n <span class="in-legend-value">{{ c.display }}</span>\n </div>\n </div>\n </section>\n </div>\n\n \x3c!-- what was taught, and where --\x3e\n <div class="in-grid">\n <section [style.animation-delay.ms]="420" class="in-anim in-card">\n <div class="in-card-title">Time by Subject</div>\n <div class="in-card-sub">Share of session time by subject</div>\n <div class="in-donut-wrap">\n <svg class="in-donut" viewBox="0 0 140 140" role="img" aria-label="Time by subject">\n <circle cx="70" cy="70" [attr.r]="donutRadius" class="in-donut-track"></circle>\n <circle\n *ngFor="let s of subjectDonut.segments; let i = index"\n class="in-donut-seg"\n cx="70"\n cy="70"\n [attr.r]="donutRadius"\n [attr.stroke]="s.color"\n [attr.stroke-dasharray]="s.dash"\n [attr.stroke-dashoffset]="s.offset"\n [style.animation-delay.ms]="300 + i * 90"\n >\n <title>{{ s.label }}: {{ s.display }} ({{ s.percent }}%)</title>\n </circle>\n </svg>\n <div class="in-donut-center">\n <div class="in-donut-total">{{ subjectDonut.total }}</div>\n <div class="in-muted" title="Session time where content was used">with content</div>\n </div>\n </div>\n <div class="in-legend in-legend-compact">\n <div class="in-legend-item" *ngFor="let s of subjectDonut.segments">\n <span class="in-dot" [style.background-color]="s.color"></span>\n <span class="in-legend-label" [title]="s.label">{{ s.label }}</span>\n <span class="in-legend-value">{{ s.percent }}%</span>\n </div>\n </div>\n <div class="in-card-note">\n <svg class="in-note-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9" /><path d="M12 11v5M12 8h.01" /></svg>\n <div>\n <div class="in-note-insight" *ngIf="subjectNote">{{ subjectNote }}</div>\n <div>Each session\'s time is split equally across the subjects opened in it. Sessions where nothing was opened have no subject, so this total is lower than Teaching Time.</div>\n </div>\n </div>\n </section>\n <section [style.animation-delay.ms]="480" class="in-anim in-card">\n <div class="in-card-title">Classroom Usage</div>\n <div class="in-card-sub">Each classroom\'s utilisation by time</div>\n <div class="in-tiles">\n <div\n class="in-tile"\n *ngFor="let r of roomTiles; let i = index"\n [class.in-tile-idle]="r.idle"\n [class.in-tile-dark]="r.dark"\n [style.grid-column]="\'span \' + r.span"\n [style.background-color]="r.shade"\n [style.animation-delay.ms]="300 + i * 15"\n [title]="r.label + \': \' + r.display"\n >\n <span class="in-tile-name">\n <svg class="in-tile-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2" /><path d="M12 16v4M8 20h8" /></svg>{{ r.label }}\n </span>\n <span class="in-tile-value">{{ r.share }}%</span>\n </div>\n </div>\n <div class="in-tiles-legend">\n <span class="in-tile in-tile-key in-tile-idle"></span><span class="in-muted">0% / not used</span>\n <span class="in-scale"></span><span class="in-muted">Low → high utilisation</span>\n </div>\n </section>\n <section [style.animation-delay.ms]="540" class="in-anim in-card">\n <div class="in-card-title">Time by Class</div>\n <div class="in-card-sub">Session time per class</div>\n <div class="in-columns">\n <div class="in-column" *ngFor="let g of gradeColumns; let i = index" [title]="g.label + \': \' + g.display">\n <div class="in-column-track">\n <div class="in-column-bar" [style.height.%]="g.percent" [style.animation-delay.ms]="300 + i * 50"></div>\n </div>\n <div class="in-column-label">{{ g.short }}</div>\n </div>\n </div>\n <div class="in-columns-caption">Class</div>\n <div class="in-column-top" *ngIf="gradeColumns.length">\n <span class="in-muted">Most time</span>\n <ng-container *ngFor="let g of gradeColumns">\n <strong *ngIf="g.percent === 100">{{ g.label }} · {{ g.display }}</strong>\n </ng-container>\n </div>\n </section>\n </div>\n </ng-container>\n\n</div>\n\n<ng-template #followLists>\n <div class="in-follow-cols">\n <div class="in-follow-col">\n <div class="in-follow-label">Teachers Not Active <span class="in-count">{{ inactiveTeachers.length }}</span></div>\n <ul class="in-name-list" *ngIf="inactiveTeachers.length">\n <li *ngFor="let name of inactiveTeachers">{{ name }}</li>\n </ul>\n <span class="in-muted" *ngIf="inactiveTeachers.length === 0">Every eligible teacher used the system today.</span>\n </div>\n <div class="in-follow-col">\n <div class="in-follow-label">Classrooms Not Used <span class="in-count">{{ idleRooms.length }}</span></div>\n <ul class="in-name-list in-room-list" *ngIf="idleRooms.length">\n <li *ngFor="let room of idleRooms">{{ room }}</li>\n </ul>\n <span class="in-muted" *ngIf="idleRooms.length === 0">Every classroom was used today.</span>\n </div>\n </div>\n</ng-template>\n\n\x3c!-- each section passes its own bar colour so neighbouring cards are easy to tell apart --\x3e\n<ng-template #bars let-items let-color="color">\n <div class="in-bars">\n <div class="in-muted" *ngIf="items.length === 0">No data</div>\n <div class="in-bar-row" *ngFor="let item of items; let i = index">\n <div class="in-bar-head">\n <span class="in-bar-label" [title]="item.label">{{ item.label }}</span>\n <span class="in-bar-value">{{ item.display }}</span>\n </div>\n <div class="in-bar-sub" *ngIf="item.sub">{{ item.sub }}</div>\n <div class="in-bar-track"><div class="in-bar-fill" [style.width.%]="item.percent" [style.background-color]="color" [style.animation-delay.ms]="300 + i * 60"></div></div>\n </div>\n </div>\n</ng-template>\n',styles:['@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");.in-page{font-family:Poppins,Segoe UI,Arial,sans-serif;font-size:13px;color:#1e2437;padding:0 20px 24px;box-sizing:border-box;text-align:left;overflow-y:auto;background:#eef2f9}.in-sticky{position:sticky;top:0;z-index:2;margin:0 -20px 16px;padding:16px 20px;background:#eef2f9;box-shadow:0 6px 12px -10px rgba(30,36,55,.25)}.in-heading{position:relative;margin-bottom:14px;min-height:34px;display:flex;align-items:center;justify-content:center}.in-heading-text{font-size:17px;font-weight:600;color:#1e2437;text-align:center;padding:0 150px}.in-pdf-btn{position:absolute;right:0;top:50%;transform:translateY(-50%);height:34px;padding:0 16px;border:none;border-radius:10px;background:#5b84ec;color:#fff;font:500 13px Poppins,Segoe UI,Arial,sans-serif;cursor:pointer;box-shadow:0 4px 10px rgba(91,132,236,.22)}.in-pdf-btn:hover:not([disabled]){background:#406fe9}.in-pdf-btn[disabled]{cursor:progress;background:#b3c6f5;box-shadow:none}.in-page.in-exporting{height:auto!important;overflow:visible}.in-page.in-exporting *,.in-page.in-exporting :after,.in-page.in-exporting :before{-webkit-animation:none!important;animation:none!important}.in-page.in-exporting .in-sticky{position:static;box-shadow:none}.in-page.in-exporting .in-chips{max-height:none;overflow:visible}.in-page.in-exporting .in-print-only{display:block}.in-page.in-exporting .in-follow-details{display:none}.in-card-sub,.in-muted{font-size:12px;color:#8a93a6}.in-empty{padding:40px;text-align:center;color:#8a93a6}.in-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}.in-kpi{position:relative;min-width:0;padding:12px 14px;border-radius:14px;background:#fff;box-shadow:0 1px 3px rgba(30,36,55,.06);color:#1e2437;box-sizing:border-box}.in-kpi.in-kpi-accent{background:#5b84ec;color:#fff}.in-kpi.in-kpi-accent .in-kpi-hint,.in-kpi.in-kpi-accent .in-kpi-label{color:hsla(0,0%,100%,.85)}.in-kpi.in-kpi-accent .in-kpi-icon{border-color:#fff;color:#fff}.in-kpi-icon{position:absolute;top:12px;right:12px;width:20px;height:20px;border:2px solid #1e2437;border-radius:50%;box-sizing:border-box;display:flex;align-items:center;justify-content:center;color:#1e2437}.in-kpi-icon svg{width:10px;height:10px}.in-kpi-label{padding-right:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;font-weight:500;color:rgba(30,36,55,.75)}.in-kpi-value{white-space:nowrap;font-size:22px;font-weight:700;margin:2px 0;font-variant-numeric:tabular-nums}.in-kpi-hint{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px;color:rgba(30,36,55,.7)}.in-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.in-grid+.in-grid{margin-top:16px}.in-card{background:#fff;border-radius:16px;box-shadow:0 1px 3px rgba(30,36,55,.06);padding:18px 20px;min-width:0;box-sizing:border-box}.in-card,.in-wide{display:flex;flex-direction:column}.in-wide{grid-column:span 2}.in-card-note{margin-top:auto;padding-top:14px;border-top:1px solid #eef1f6;display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:1.45;color:#8a93a6}.in-note-icon{flex:0 0 auto;width:15px;height:15px;margin-top:1px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}.in-note-insight{color:#1e2437;font-weight:500;margin-bottom:2px}.in-card-title{font-size:16px;font-weight:600;color:#1e2437}.in-card-sub{margin:2px 0 16px}.in-count{display:inline-block;min-width:22px;padding:0 8px;margin-left:6px;border-radius:11px;background:#fff6de;color:#a46b00;font-size:12px;font-weight:600;text-align:center;line-height:22px;vertical-align:middle}.in-hours{flex:1 1 auto;display:flex;align-items:stretch;gap:4px;min-height:200px;max-height:320px}.in-hour{flex:1 1 0;flex-direction:column;min-width:0}.in-hour,.in-hour-value{display:flex;align-items:center}.in-hour-value{gap:3px;font-size:12px;font-weight:600;color:#1e2437;margin-bottom:6px;white-space:nowrap}.in-hour-icon{width:12px;height:12px;color:#8a93a6;flex:0 0 auto}.in-hour-track{flex:1 1 auto;max-width:44px;display:flex;align-items:flex-end;background:#f1f4f9;overflow:hidden}.in-hour-bar,.in-hour-track{width:100%;border-radius:999px}.in-hour-bar{min-height:6px;background:#fbe0a0}.in-util-legend{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px}.in-util-scale{width:90px;height:8px;border-radius:999px;background:linear-gradient(90deg,#f38e86,#f5c447,#92c15c)}.in-hour-label{margin-top:8px;font-size:10px;color:#8a93a6;white-space:nowrap}.in-bars{display:flex;flex-direction:column;gap:12px}.in-bar-head{display:flex;justify-content:space-between;gap:12px}.in-bar-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.in-bar-value{flex:0 0 auto;color:#1e2437;font-weight:600;font-variant-numeric:tabular-nums}.in-bar-sub{font-size:11px;color:#8a93a6}.in-bar-track{height:8px;margin-top:6px;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-bar-fill{height:100%;border-radius:999px;background:#5b84ec}.in-donut-wrap{position:relative;width:150px;height:150px;margin:0 auto 14px}.in-donut{width:100%;height:100%;transform:rotate(-90deg)}.in-donut circle{fill:none;stroke-width:18}.in-donut-track{stroke:#f1f4f9}.in-donut-seg{stroke-linecap:butt;transition:stroke-width .15s;-webkit-animation:in-draw 1s cubic-bezier(.22,1,.36,1) both;animation:in-draw 1s cubic-bezier(.22,1,.36,1) both}.in-donut-seg:hover{stroke-width:22}@-webkit-keyframes in-draw{0%{stroke-dasharray:0 400}}@keyframes in-draw{0%{stroke-dasharray:0 400}}.in-donut-center{position:absolute;inset:0;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}.in-donut-total{font-size:18px;font-weight:700}.in-legend-compact{gap:6px}.in-legend-compact .in-legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.in-columns{flex:1 1 auto;display:flex;align-items:stretch;gap:5px;min-height:180px;max-height:340px}.in-column{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center}.in-column-track{flex:1 1 auto;width:100%;max-width:22px;display:flex;align-items:flex-end;background:#f1f4f9;border-radius:999px;overflow:hidden}.in-column-bar{width:100%;min-height:4px;border-radius:999px;background:#f3cb6c;-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}.in-column:hover .in-column-bar{background:#f0be46}.in-column-label{margin-top:6px;font-size:11px;font-weight:500;color:#8a93a6;white-space:nowrap}.in-columns-caption{text-align:center;font-size:11px;color:#8a93a6;margin-top:2px}.in-column-top{margin-top:14px;padding:10px 12px;border-radius:10px;background:#fff6de;display:flex;justify-content:space-between;gap:8px;font-size:12px}.in-tiles{display:grid;grid-auto-flow:row dense;grid-template-columns:repeat(auto-fill,minmax(58px,1fr));gap:8px}.in-tile{height:58px;border-radius:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#162b57;cursor:default;-webkit-animation:in-pop .4s ease-out both;animation:in-pop .4s ease-out both;transition:transform .12s}.in-tile:hover{transform:scale(1.06)}.in-tile.in-tile-dark{color:#fff}.in-tile.in-tile-idle{background:#f4f7fd;border:2px solid #162b57;color:#162b57}@-webkit-keyframes in-pop{0%{opacity:0;transform:scale(.7)}}@keyframes in-pop{0%{opacity:0;transform:scale(.7)}}.in-tile-icon{width:13px;height:13px;margin-right:4px;vertical-align:-1px}.in-tile-name{max-width:100%;padding:0 4px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;font-weight:700}.in-tile-value{font-size:12px;font-weight:500;opacity:.85}.in-tiles-legend{display:flex;align-items:center;gap:6px;margin-top:14px;flex-wrap:wrap}.in-tiles-legend .in-tile-key{width:14px;height:14px;border-radius:4px;-webkit-animation:none;animation:none}.in-scale{width:46px;height:10px;margin-left:8px;border-radius:999px;background:linear-gradient(90deg,#eaf1fb,#162b57)}.in-primary .in-attention{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.in-primary .in-attention-item{gap:14px;padding:12px 14px}.in-primary .in-attention-value{flex:0 0 42px;height:42px;line-height:42px;border-radius:10px;background:#ef6a3a;color:#fff;font-size:16px}.in-primary .in-attention-value.in-zero{background:#8bc34a;color:#fff}.in-primary .in-attention-label{display:flex;align-items:center;gap:6px;font-size:14px}.in-primary .in-attention-item .in-muted{font-size:12px;margin-top:2px}.in-inline-icon{display:inline-flex;color:#ef6a3a}.in-inline-icon svg{width:16px;height:16px}.in-follow{flex:1 1 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:18px}.in-follow-tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;padding:18px 20px;border:none;border-radius:32px;font:inherit;color:inherit;text-align:center;cursor:pointer;transition:transform .15s,box-shadow .15s}.in-follow-tile:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(30,36,55,.08)}.in-follow-teachers{background:#eaf0fd}.in-follow-teachers .in-follow-icon{color:#5b84ec}.in-follow-rooms{background:#eaf0fd}.in-follow-rooms .in-follow-icon{color:#5b84ec}.in-follow-icon{margin-bottom:6px;display:flex;align-items:center;justify-content:center}.in-follow-icon svg{width:40px;height:40px}.in-follow-number{font-size:34px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}.in-follow-tile>.in-muted{font-size:15px;color:#1e2437}.in-follow-label-big{font-size:18px;font-weight:600}.in-avatars{flex-wrap:wrap;margin-top:12px;padding-left:8px}.in-avatar,.in-avatars{display:flex;justify-content:center}.in-avatar{width:34px;height:34px;margin-left:-6px;border-radius:50%;border:1.5px solid #5b84ec;background:#fff;color:#3f5fae;font-size:11px;font-weight:600;align-items:center;box-sizing:border-box}.in-avatar-more{background:#5b84ec;color:#fff}.in-room-chips{flex-wrap:wrap;gap:6px;margin-top:12px}.in-room-chip,.in-room-chips{display:flex;justify-content:center}.in-room-chip{min-width:34px;height:34px;padding:0 10px;border-radius:999px;border:1.5px solid #5b84ec;background:#fff;color:#5b84ec;font-size:12px;font-weight:600;align-items:center;box-sizing:border-box}.in-room-chip.in-avatar-more{background:#5b84ec;color:#fff}.in-follow-foot{display:flex;justify-content:flex-end;margin-top:10px}.in-link-btn{border:none;background:transparent;padding:6px 4px;font:600 13px Poppins,Segoe UI,Arial,sans-serif;color:#5b84ec;cursor:pointer}.in-link-btn:hover{text-decoration:underline}.in-print-only{display:none;margin-top:16px}.in-follow-compact{flex:none}.in-follow-compact .in-follow-tile{flex-direction:row;justify-content:flex-start;gap:12px;padding:10px 16px;text-align:left}.in-follow-compact .in-follow-icon{margin:0}.in-follow-compact .in-follow-icon svg{width:24px;height:24px}.in-follow-compact .in-follow-number{font-size:22px}.in-follow-compact .in-avatars,.in-follow-compact .in-follow-tile>.in-muted,.in-follow-compact .in-room-chips{display:none}.in-follow-details{flex:none;margin-top:12px;padding:14px 16px;border:1px solid #eef1f6;border-radius:12px;-webkit-animation:in-rise .3s ease-out both;animation:in-rise .3s ease-out both}.in-link-chevron{display:inline-block;width:6px;height:6px;margin-left:6px;border-right:2px solid;border-bottom:2px solid;transform:rotate(45deg) translateY(-2px);transition:transform .2s}.in-link-chevron.in-link-chevron-up{transform:rotate(-135deg) translateY(-1px)}.in-follow-cols{display:grid;grid-template-columns:3fr 1fr;gap:24px}.in-follow-col{min-width:0}.in-follow-col+.in-follow-col{border-left:1px solid #e3e8f0;padding-left:24px}.in-follow-label{font-size:13px;font-weight:600;margin:2px 0 10px}.in-name-list{margin:0;padding:0;list-style:none;-moz-column-width:160px;column-width:160px;-moz-column-gap:20px;column-gap:20px}.in-name-list li{position:relative;padding:3px 0 3px 14px;-moz-column-break-inside:avoid;break-inside:avoid;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.in-name-list li:before{content:"";position:absolute;left:0;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:#a9bffa}.in-room-list li:before{background:#fbe0a0}.in-attention{display:flex;flex-direction:column;gap:10px}.in-attention-item{display:flex;align-items:center;gap:12px;padding:8px;border-radius:12px;background:#f7f9fc}.in-attention-value{flex:0 0 44px;height:40px;line-height:40px;text-align:center;border-radius:10px;background:#fbe0a0;color:#1e2437;font-size:16px;font-weight:700}.in-attention-value.in-zero{background:#eaf0fd;color:#5b84ec}.in-attention-label{font-weight:600}.in-stack{display:flex;height:14px;border-radius:999px;overflow:hidden;background:#f1f4f9;margin-bottom:16px}.in-stack-part{height:100%;box-shadow:inset -2px 0 0 #fff}.in-legend{display:flex;flex-direction:column;gap:8px}.in-legend-item{display:flex;align-items:center;gap:10px}.in-dot{flex:0 0 auto;width:10px;height:10px;border-radius:3px}.in-legend-label{flex:1 1 auto}.in-legend-value{font-weight:600;color:#1e2437;font-variant-numeric:tabular-nums}.in-chips{display:flex;flex-wrap:wrap;gap:8px;max-height:230px;overflow:auto}.in-chip{padding:5px 12px;border-radius:999px;background:#eaf0fd;color:#3f5fae;font-size:12px;font-weight:500}@-webkit-keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@keyframes in-rise{0%{opacity:0;transform:translateY(14px)}}@-webkit-keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@keyframes in-fade-right{0%{opacity:0;transform:translateX(-10px)}}@-webkit-keyframes in-grow-width{0%{width:0}}@keyframes in-grow-width{0%{width:0}}@-webkit-keyframes in-grow-height{0%{height:0}}@keyframes in-grow-height{0%{height:0}}.in-anim{-webkit-animation:in-rise .5s cubic-bezier(.22,1,.36,1) both;animation:in-rise .5s cubic-bezier(.22,1,.36,1) both}.in-anim-row{-webkit-animation:in-fade-right .45s ease-out both;animation:in-fade-right .45s ease-out both}.in-bar-fill,.in-stack-part{-webkit-animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both;animation:in-grow-width .9s cubic-bezier(.22,1,.36,1) both}.in-hour-bar{-webkit-animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both;animation:in-grow-height .8s cubic-bezier(.22,1,.36,1) both}@media (prefers-reduced-motion:reduce){.in-anim,.in-anim-row,.in-bar-fill,.in-column-bar,.in-donut-seg,.in-hour-bar,.in-stack-part,.in-tile{-webkit-animation:none;animation:none}}@media (max-width:900px){.in-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (max-width:1100px){.in-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid>.in-card:last-child:nth-child(odd),.in-wide+.in-card{grid-column:span 2}}@media (max-width:760px){.in-heading-text{padding:0;text-align:left;flex:1 1 auto}.in-pdf-btn{position:static;transform:none}.in-grid>.in-card:last-child:nth-child(odd),.in-wide,.in-wide+.in-card{grid-column:auto}.in-follow,.in-follow-cols,.in-primary .in-attention{grid-template-columns:1fr}.in-follow-col+.in-follow-col{border-left:none;padding-left:0;border-top:1px solid #e3e8f0;padding-top:16px}.in-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.in-grid{grid-template-columns:1fr}}']}]}],I.ctorParameters=function(){return[{type:u},{type:t.ElementRef}]},I.propDecorators={data:[{type:t.Input}],fitHeight:[{type:t.HostListener,args:["window:resize"]}],closeDetails:[{type:t.HostListener,args:["document:keydown.escape"]}]};var U=function(){};U.decorators=[{type:t.NgModule,args:[{declarations:[m,y,x,D,T,h,C,k,A,I],imports:[o.CommonModule,n.GoogleChartsModule,s.DatepickerModule],exports:[h]}]}],e.PrincipalDashboardLibV2Component=h,e.PrincipalDashboardLibV2Module=U,e.PrincipalDashboardLibV2Service=u,e.ɵa=m,e.ɵb=y,e.ɵc=x,e.ɵd=D,e.ɵe=w,e.ɵf=T,e.ɵg=C,e.ɵh=k,e.ɵi=A,e.ɵj=I,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=principal-dashboard-lib-v2.umd.min.js.map