UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

2 lines (1 loc) 6.96 kB
import{a as W}from"./chunk-JXZCNFW7.js";import{Za as ce,_a as C,s as le,t as pe}from"./chunk-O3YLAEVE.js";import{Aa as x,Ab as U,Ac as Y,Cd as ae,Eb as $,Ed as oe,Gb as m,Hb as q,Ib as I,Ic as Z,Jc as ee,Jd as se,Kd as re,Oa as p,Pb as S,Qb as h,Rb as v,Sa as R,Sb as A,Tb as u,Ub as L,Vb as V,Wa as j,Wb as H,Xa as b,ab as c,cc as z,db as F,ea as P,fb as M,fd as te,ja as f,jd as ie,kb as D,kc as g,lb as k,lc as G,mb as O,mc as J,nc as B,oc as N,od as ne,rb as s,sa as Q,sb as r,sc as K,tb as l,va as _,wc as y,xa as w,yc as X}from"./chunk-D55YR5X7.js";var me=["*"];function fe(n,t){n&1&&U(0)}function he(n,t){if(n&1&&(r(0,"bar",3),I(1),l()),n&2){let o=m();s("type",o.type)("value",o._value)("max",o.max)("animate",o.animate)("striped",o.striped)}}function ge(n,t){if(n&1&&(r(0,"bar",3),u(1),l()),n&2){let o=t.$implicit,e=m(2);s("type",o.type)("value",o.value)("max",o.max||e.max)("animate",e.animate)("striped",e.striped),p(),L(o.label)}}function ve(n,t){if(n&1&&M(0,ge,2,6,"bar",4),n&2){let o=m();s("ngForOf",o._values)}}var ye=(()=>{let t=class t{constructor(e,i){this.el=e,this.renderer=i,this.max=100,this.value=0,this.animate=!1,this.striped=!1,this.type="info",this.percent=100}ngOnChanges(e){(e.value||e.max)&&(this.percent=100*(Number(e.value?.currentValue||this.value)/Number(e.max?.currentValue||this.max||100))),e.type&&this.applyTypeClasses()}applyTypeClasses(){if(this._prevType){let e=`progress-bar-${this._prevType}`,i=`bg-${this._prevType}`;this.renderer.removeClass(this.el.nativeElement,e),this.renderer.removeClass(this.el.nativeElement,i),this._prevType=void 0}if(this.type){let e=`progress-bar-${this.type}`,i=`bg-${this.type}`;this.renderer.addClass(this.el.nativeElement,e),this.renderer.addClass(this.el.nativeElement,i),this._prevType=this.type}}};t.\u0275fac=function(i){return new(i||t)(b(x),b(j))},t.\u0275cmp=c({type:t,selectors:[["bar"]],hostAttrs:["role","progressbar","aria-valuemin","0"],hostVars:13,hostBindings:function(i,a){i&2&&(D("aria-valuenow",a.value)("aria-valuetext",a.percent?a.percent.toFixed(0)+"%":"")("aria-valuemax",a.max),h("height","100","%")("width",a.percent,"%"),v("progress-bar",!0)("progress-bar-animated",a.animate)("progress-bar-striped",a.striped))},inputs:{max:"max",value:"value",animate:"animate",striped:"striped",type:"type"},features:[w],ngContentSelectors:me,decls:1,vars:0,template:function(i,a){i&1&&(q(),I(0))},encapsulation:2,changeDetection:0});let n=t;return n})(),xe=(()=>{let t=class t{constructor(){this.animate=!1,this.max=100}};t.\u0275fac=function(i){return new(i||t)},t.\u0275prov=P({token:t,factory:t.\u0275fac,providedIn:"root"});let n=t;return n})(),ue=(()=>{let t=class t{set value(e){this.isStacked=Array.isArray(e),typeof e=="number"?(this._value=e,this._values=void 0):(this._value=void 0,this._values=e)}constructor(e){this.max=100,this.animate=!1,this.striped=!1,this.isStacked=!1,this._value=0,Object.assign(this,e)}};t.\u0275fac=function(i){return new(i||t)(b(xe))},t.\u0275cmp=c({type:t,selectors:[["progressbar"]],hostVars:3,hostBindings:function(i,a){i&2&&(D("max",a.max),v("progress",!0))},inputs:{max:"max",animate:"animate",striped:"striped",type:"type",value:"value"},ngContentSelectors:me,decls:5,vars:3,consts:[["NotStacked",""],["Stacked",""],[4,"ngIf","ngIfThen","ngIfElse"],[3,"type","value","max","animate","striped"],[3,"type","value","max","animate","striped",4,"ngFor","ngForOf"]],template:function(i,a){if(i&1&&(q(),M(0,fe,1,0,"ng-container",2)(1,he,2,5,"ng-template",null,0,N)(3,ve,1,1,"ng-template",null,1,N)),i&2){let d=S(2),T=S(4);s("ngIf",!a.isStacked)("ngIfThen",d)("ngIfElse",T)}},dependencies:[ee,ye,Z],styles:["[_nghost-%COMP%]{width:100%;display:flex}"],changeDetection:0});let n=t;return n})();var de=(()=>{let t=class t{transform(e,i=0,a=!1){return C(e,i,a)}};t.\u0275fac=function(i){return new(i||t)},t.\u0275pipe=F({name:"toBytes",type:t,pure:!0});let n=t;return n})();function be(n,t){if(n&1&&(r(0,"progressbar",0)(1,"span",1),u(2),g(3,"toBytes"),g(4,"toBytes"),l()()),n&2){let o=m();s("max",o.item().storageQuota)("value",o.item().storageUsage)("type",o.item().storageUsage>=o.item().storageQuota?"danger":null),p(),h("width",o.labelWidth??null,"px"),p(),H(" ",B(3,7,o.item().storageUsage,2,!0)," / ",G(4,11,o.item().storageQuota)," ")}}function Ce(n,t){if(n&1&&(r(0,"progressbar",0)(1,"span",1),u(2),g(3,"toBytes"),l()()),n&2){let o=m();s("max",1)("value",1)("type",null),p(2),V(" ",B(3,4,o.item().storageUsage,2,!0)," ")}}var Ee=(()=>{let t=class t{constructor(){this.item=y({storageUsage:0,storageQuota:null}),this.labelWidth=null,this.elRef=f(x),this.cdr=f(Y),this.destroyRef=f(Q),R(()=>{let e=this.elRef.nativeElement,i=()=>{let d=e.offsetWidth;d!==this.labelWidth&&(this.labelWidth=d,this.cdr.detectChanges())};i();let a=new ResizeObserver(()=>i());a.observe(e),this.destroyRef.onDestroy(()=>a.disconnect())})}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=c({type:t,selectors:[["app-storage-usage"]],inputs:{item:[1,"item"]},decls:2,vars:1,consts:[[1,"bg-black",3,"max","value","type"],[1,"ms-1","me-1"]],template:function(i,a){i&1&&k(0,be,5,13,"progressbar",0)(1,Ce,4,8,"progressbar",0),i&2&&O(a.item().storageQuota&&a.item().storageQuota>0?0:1)},dependencies:[ue,de],encapsulation:2});let n=t;return n})();var Ae=(()=>{let t=class t{constructor(){this.quota=X(null),this.maxWidthPercent=y(75),this.fullWidth=y(!1),this.displayMaxWidth=K(()=>this.fullWidth()?100:this.maxWidthPercent()),this.locale=f(oe),this.quotaText=_(""),this.invalid=_(!1)}ngOnInit(){let e=this.quota();e!=null&&this.quotaText.set(e===0?"0":C(e))}onQuotaInput(e){this.quotaText.set(e),this.validateQuota()}onQuotaBlur(){let e=this.quotaText();if(e){if(e==="0"){this.quota.set(0);return}let i=W.exec(e);if(i){let a=`${i[1]} ${i[2].toUpperCase()}`;this.quotaText.set(a),this.quota.set(ce(parseInt(i[1],10),i[2]));return}}this.quota.set(null)}validateQuota(){let e=this.quotaText();this.invalid.set(!!e&&e!=="0"&&!W.test(e))}};t.\u0275fac=function(i){return new(i||t)},t.\u0275cmp=c({type:t,selectors:[["app-storage-quota"]],inputs:{quota:[1,"quota"],maxWidthPercent:[1,"maxWidthPercent"],fullWidth:[1,"fullWidth"]},outputs:{quota:"quotaChange"},decls:5,vars:12,consts:[["for","storageQuota","l10nTranslate",""],["id","storageQuota"],["id","quota","placement","top","tooltip",'"512 MB" "12 GB" "2 TB" ...',"triggers","focus","type","text",3,"ngModelChange","blur","ngModel","placeholder"]],template:function(i,a){i&1&&(r(0,"label",0),u(1,"Storage Quota"),l(),r(2,"div",1)(3,"input",2),g(4,"translate"),$("ngModelChange",function(T){return a.onQuotaInput(T)})("blur",function(){return a.onQuotaBlur()}),l()()),i&2&&(p(3),A(z("form-control form-control-sm ",a.invalid()?"is-invalid":"")),h("max-width",a.displayMaxWidth(),"%"),v("w-100",a.fullWidth()),s("ngModel",a.quotaText())("placeholder",J(4,9,"Unlimited",a.locale.language)))},dependencies:[pe,le,ae,te,ie,ne,re,se],encapsulation:2});let n=t;return n})();export{ue as a,de as b,Ee as c,Ae as d};