import{B}from'./chunk-CmO6E5J5.js';import{s}from'./chunk-DsZ3hjLw.js';import{g as g$1,P as Pc,aQ as Xe,dG as ze,b as Pa,s as sp,y as yV,u as ub,e as Pp,cq as v$,m as _2,z as zB,a3 as B0,cr as S$,A as w2,o as bV}from'./main-sJAtkqeq.js';function g(i,E){if(i&1&&(sp(0,"div",5)(1,"div",3),yV(2,1),ub(),Pp(3,"my-progress-bar",4),v$(4,"bytes"),ub()),i&2){let e=bV();zB(3),B0("label",e.labelQuotaDaily())("max",e.user?.videoQuotaDaily||0)("value",e.userVideoQuotaUsedDaily)("valueFormatted",S$(4,5,e.userVideoQuotaUsedDaily,1))("maxFormatted",e.userVideoQuotaDaily);}}var b=(()=>{class i{userService=g$1(Pc);auth=g$1(Xe);userVideoQuota="0";userVideoQuotaUsed=0;userVideoQuotaPercentage=15;userVideoQuotaDaily="0";userVideoQuotaUsedDaily=0;userVideoQuotaDailyPercentage=15;get user(){return this.auth.getUser();}ngOnInit(){this.auth.userInformationLoaded.pipe(ze()).subscribe(()=>{this.user.videoQuota!==-1?this.userVideoQuota=new s().transform(this.user.videoQuota,0).toString():this.userVideoQuota="Ubegrenset",this.user.videoQuotaDaily!==-1?this.userVideoQuotaDaily=new s().transform(this.user.videoQuotaDaily,0).toString():this.userVideoQuotaDaily="Ubegrenset";}),this.userService.getMyVideoQuotaUsed().subscribe(e=>{this.userVideoQuotaUsed=e.videoQuotaUsed,this.userVideoQuotaPercentage=this.userVideoQuotaUsed*100/this.user.videoQuota,this.userVideoQuotaUsedDaily=e.videoQuotaUsedDaily,this.userVideoQuotaDailyPercentage=this.userVideoQuotaUsedDaily*100/this.user.videoQuotaDaily;});}hasDailyQuota(){return this.user.videoQuotaDaily!==-1;}labelQuota(){return`Total video quota: ${new s().transform(this.userVideoQuotaUsed,0).toString()} / ${this.userVideoQuota}`;}labelQuotaDaily(){return`Total daily video quota: ${new s().transform(this.userVideoQuotaUsedDaily,0).toString()} / ${this.userVideoQuotaDaily}`;}static ɵfac=function(o){return new(o||i)();};static ɵcmp=Pa({type:i,selectors:[["my-user-quota"]],decls:7,vars:9,consts:()=>{let e;e="Total videokvote";let o;return o="Daglig videokvote",[e,o,[1,"user-quota","mb-3"],[1,"label"],["height","2rem",3,"label","max","value","valueFormatted","maxFormatted"],[1,"mt-3"]];},template:function(o,t){o&1&&(sp(0,"div",2)(1,"div")(2,"div",3),yV(3,0),ub(),Pp(4,"my-progress-bar",4),v$(5,"bytes"),ub(),_2(6,g,5,8,"div",5),ub()),o&2&&(zB(4),B0("label",t.labelQuota())("max",t.user?.videoQuota||0)("value",t.userVideoQuotaUsed)("valueFormatted",S$(5,6,t.userVideoQuotaUsed,1))("maxFormatted",t.userVideoQuota),zB(2),w2(t.hasDailyQuota()?6:-1));},dependencies:[B,s],encapsulation:2,changeDetection:1});}return i;})();/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{b};//# sourceMappingURL=chunk-D_76E9qL.js.map