import{a as U}from"./chunk-FQ5HIUWR.js";import{a as u}from"./chunk-ZTACZQT5.js";import{$a as d,$b as p,Fa as n,Ga as m,L as y,La as c,Sa as h,Sf as g,Zb as S,ib as _,jb as r,kb as Q,sb as v,vc as f,xb as D,yg as E}from"./chunk-4JM6MIZ5.js";import{i as l}from"./chunk-QJQRWPYR.js";function V(a,o){if(a&1&&(_(0,"div",6)(1,"div",3),v(2,1),r(),Q(3,"my-progress-bar",4),S(4,"bytes"),r()),a&2){let s=D();n(3),d("label",s.labelQuotaDaily())("max",(s.user==null?null:s.user.videoQuotaDaily)||0)("value",s.userVideoQuotaUsedDaily)("valueFormatted",p(4,5,s.userVideoQuotaUsedDaily,1))("maxFormatted",s.userVideoQuotaDaily);}}var C=(()=>{let o=class o{userService;auth;userVideoQuota="0";userVideoQuotaUsed=0;userVideoQuotaPercentage=15;userVideoQuotaDaily="0";userVideoQuotaUsedDaily=0;userVideoQuotaDailyPercentage=15;constructor(e,i){this.userService=e,this.auth=i;}get user(){return this.auth.getUser();}ngOnInit(){this.auth.userInformationLoaded.pipe(y()).subscribe(()=>{this.user.videoQuota!==-1?this.userVideoQuota=new u().transform(this.user.videoQuota,0).toString():this.userVideoQuota="Obegr\xE4nsat",this.user.videoQuotaDaily!==-1?this.userVideoQuotaDaily=new u().transform(this.user.videoQuotaDaily,0).toString():this.userVideoQuotaDaily="Obegr\xE4nsat";}),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 u().transform(this.userVideoQuotaUsed,0).toString()} / ${this.userVideoQuota}`;}labelQuotaDaily(){return`Total daily video quota: ${new u().transform(this.userVideoQuotaUsedDaily,0).toString()} / ${this.userVideoQuotaDaily}`;}};l(o,"\u0275fac",function(i){return new(i||o)(m(E),m(g));}),l(o,"\u0275cmp",c({type:o,selectors:[["my-user-quota"]],decls:7,vars:9,consts:()=>{let e;e="Total videokvot";let i;return i="Daglig videokvot",[e,i,[1,"user-quota","mb-3"],[1,"label"],["height","2rem",3,"label","max","value","valueFormatted","maxFormatted"],["class","mt-3",4,"ngIf"],[1,"mt-3"]];},template:function(i,t){i&1&&(_(0,"div",2)(1,"div")(2,"div",3),v(3,0),r(),Q(4,"my-progress-bar",4),S(5,"bytes"),r(),h(6,V,5,8,"div",5),r()),i&2&&(n(4),d("label",t.labelQuota())("max",(t.user==null?null:t.user.videoQuota)||0)("value",t.userVideoQuotaUsed)("valueFormatted",p(5,6,t.userVideoQuotaUsed,1))("maxFormatted",t.userVideoQuota),n(2),d("ngIf",t.hasDailyQuota()));},dependencies:[f,u,U],encapsulation:2}));let a=o;return a;})();export{C as a};/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*///# sourceMappingURL=chunk-JVUFKAJW.js.map