This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
922.9e37c82c029314e6f892.js
1 lines (1 loc) · 62.3 KB
/
922.9e37c82c029314e6f892.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[922],{8922:(Te,O,c)=>{c.r(O),c.d(O,{UserModule:()=>Ze});var P=c(4785),p=c(8583),l=c(3679),T=c(4655),B=c(3191),z=c(8086),A=c(2378),t=c(7716),M=c(1584),m=c(2238),S=c(6458),_=c(1095),u=c(6627),H=c(7106);function j(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",8),t.TgZ(1,"app-world-card",9),t.NdJ("onEdit",function(){const s=t.CHM(e).$implicit;return t.oxw().onEditDomain(s)}),t.qZA(),t.qZA()}if(2&o){const e=r.$implicit;t.xp6(1),t.Q6J("world",e)}}let R=(()=>{class o{constructor(e,n,i){this.userService=e,this.dialog=n,this.snackBar=i,this.domains=[],this.refreshDomains()}refreshDomains(e=!1){const n=this.userService.getUserDomains().subscribe(i=>{this.domains=i,e&&this.snackBar.open("Domains have been reloaded","Dismiss",{duration:2e3})},i=>{},()=>{n.unsubscribe()})}onCreateDomain(){this.dialog.open(A.G,{width:"600px"}).componentInstance.onUpdated.subscribe(()=>{this.refreshDomains()})}onEditDomain(e){this.dialog.open(A.G,{width:"600px",data:e}).componentInstance.onUpdated.subscribe(i=>{this.refreshDomains()})}ngOnInit(){}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(M.K),t.Y36(m.uw),t.Y36(S.ux))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-domains"]],decls:15,vars:1,consts:[[1,"container"],[2,"padding-top","16px"],["mat-flat-button","","color","primary",2,"margin-bottom","32px",3,"click"],[2,"padding","0 4px"],["mat-flat-button","",2,"margin-bottom","32px",3,"click"],[1,"row"],["class","col-lg-4 col-md-6","style","padding-bottom: 40px;",4,"ngFor","ngForOf"],[2,"padding","0 8px"],[1,"col-lg-4","col-md-6",2,"padding-bottom","40px"],["editMode","false",3,"world","onEdit"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t.TgZ(1,"h1",1),t._uU(2,"My worlds"),t.qZA(),t.TgZ(3,"button",2),t.NdJ("click",function(){return n.onCreateDomain()}),t.TgZ(4,"mat-icon"),t._uU(5,"add"),t.qZA(),t._uU(6," Create new world "),t.qZA(),t._UZ(7,"span",3),t.TgZ(8,"button",4),t.NdJ("click",function(){return n.refreshDomains(!0)}),t.TgZ(9,"mat-icon"),t._uU(10,"refresh"),t.qZA(),t._uU(11," Refresh "),t.qZA(),t.TgZ(12,"div",5),t.YNc(13,j,2,1,"div",6),t.qZA(),t.qZA(),t._UZ(14,"div",7)),2&e&&(t.xp6(13),t.Q6J("ngForOf",n.domains))},directives:[_.lW,u.Hw,p.sg,H.F],styles:[""]}),o})();var I=c(4762),V=c(5758),C=c(1841),$=c(205),q=c(8002),L=c(5304),k=c(3342),y=c(2575),h=c(3204);class W{constructor(r,e,n,i,s,a=!1,d=null){this.key=r,this.name=e,this.size=n,this.httpUrl=i,this.teaUrl=s,this.teaOnly=a,this.parent=d,this.cacheBust=0}}class Z{constructor(r,e=null,n=[],i=[],s=!1){this.name=r,this.parent=e,this.folders=n,this.files=i,this.teaOnly=s,this.key="/"+this.getBreadcrumbs().map(a=>a.name).join("/")+"/"}getBreadcrumbs(){const r=[];let e=this;for(;null!=e.parent;)r.unshift(e),e=e.parent;return r}traverseAndCheckForTeaOnly(){let r=0!=this.files.length||0!=this.folders.length;for(const e of this.files)if(0==e.teaOnly){r=!1;break}for(const e of this.folders)0==e.traverseAndCheckForTeaOnly()&&(r=!1);return this.teaOnly=r,r}}let b=(()=>{class o{constructor(e,n,i){this.authService=e,this.utilsService=n,this.http=i,this.pathsForCacheBust={}}findFolderByName(e,n){for(const i of n.folders)if(i.name==e)return i;return null}getFolder(e,n,i=!0){let s=n;if(0==e.length)return s;for(const a of e){const d=this.findFolderByName(a,s);if(null!=d)s=d;else{if(!i)return null;{const g=new Z(a,s);s.folders.push(g),s=g}}}return s}getFiles(){return this.http.get("/api/user/files").pipe((0,q.U)(e=>{const n=e.files,i=this.authService.user$.getValue().profile.username.toLowerCase(),s=new Z("");let a=0;for(const d of n){const g=d.key.slice(1).split("/"),Y=g.pop(),Q=this.getFolder(g,s);if(0!=Y.length){const w=new W(d.key,Y,d.size,e.url+d.key,"tea://"+i+d.key,d.tea,Q),E=this.utilsService.formatExt(w.name);w.type=E.type,w.icon=E.icon;const D=this.pathsForCacheBust[d.key];null!=D&&(w.cacheBust=D),Q.files.push(w),a++}}return s.traverseAndCheckForTeaOnly(),{folder:s,total:a}}))}getStatus(){return this.http.get("/api/user/files/status")}uploadFile(e,n,i){const s=new FormData;return s.set("path",e),s.set("file",n),this.http.put("/api/user/files",s,{reportProgress:!0,observe:"events"}).pipe((0,L.K)(a=>(0,$._)(a.error.message)),(0,q.U)(a=>Object.assign(Object.assign({},a),{upload:i})),(0,k.b)(a=>{a.type==C.dt.Response&&(null==this.pathsForCacheBust[e]?this.pathsForCacheBust[e]=1:this.pathsForCacheBust[e]++)}))}deleteFile(e){return this.http.delete("/api/user/files",{params:{path:e}})}createFolder(e){return this.http.put("/api/user/files/folder",{},{params:{path:e}})}createFile(e){const n=e.split("/").pop(),i=new globalThis.File([],n,{type:"application/octet-stream"});return this.uploadFile(e,i)}deleteFolder(e){return this.http.delete("/api/user/files/folder",{params:{path:e}})}moveFile(e,n){return this.http.post("/api/user/files/move",{},{params:{oldPath:e,newPath:n}})}moveFolder(e,n){return this.http.post("/api/user/files/folder/move",{},{params:{oldPath:e,newPath:n}})}toggleTeaOnlyFile(e){return this.http.post("/api/user/files/tea-only",{},{params:{path:e}})}toggleTeaOnlyFolder(e){return this.http.post("/api/user/files/folder/tea-only",{},{params:{path:e}})}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(y.e),t.LFG(h.F),t.LFG(C.eN))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var J=c(6682),K=c(7574),F=c(3738),N=c(4885),x=c(2178);function G(o,r){if(1&o&&(t.TgZ(0,"h2",10),t.TgZ(1,"b"),t._uU(2),t.qZA(),t._uU(3," of "),t.TgZ(4,"b"),t._uU(5),t.qZA(),t._uU(6),t.qZA()),2&o){const e=t.oxw();t.xp6(2),t.Oqu(e.utilsService.displayPlural(e.uploads.length,"file")),t.xp6(3),t.Oqu(e.utilsService.formatBytes(e.getTotalSize())),t.xp6(1),t.hij(" ",e.uploading?"uploading...":"to upload","\n")}}function X(o,r){if(1&o&&(t.TgZ(0,"mat-card",11),t.TgZ(1,"mat-icon",12),t._uU(2," error_outline "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.error,"\n")}}function tt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",13),t.NdJ("click",function(i){t.CHM(e);const s=t.oxw(),a=t.MAs(1);return s.openFilesInput(i,a)}),t.TgZ(1,"h2",14),t._uU(2," Drag and drop files here "),t.qZA(),t.TgZ(3,"h2",15),t._uU(4,"or"),t.qZA(),t.TgZ(5,"button",16),t.NdJ("click",function(i){t.CHM(e);const s=t.oxw(),a=t.MAs(1);return s.openFilesInput(i,a)}),t.TgZ(6,"mat-icon"),t._uU(7,"insert_drive_file"),t.qZA(),t._uU(8," Choose files "),t.qZA(),t.qZA()}if(2&o){const e=t.oxw();t.ekj("active",e.dragOvers>0)}}function et(o,r){if(1&o&&t._UZ(0,"mat-progress-spinner",22),2&o){const e=t.oxw().$implicit;t.Q6J("value",e.progress)}}function nt(o,r){1&o&&(t.TgZ(0,"mat-icon",23),t._uU(1," done "),t.qZA())}function ot(o,r){if(1&o&&(t.TgZ(0,"div",17),t.YNc(1,et,1,1,"mat-progress-spinner",18),t.YNc(2,nt,2,0,"mat-icon",19),t.TgZ(3,"mat-icon",20),t._uU(4),t.qZA(),t.TgZ(5,"div"),t._uU(6),t._UZ(7,"br"),t.TgZ(8,"span",21),t._uU(9),t.qZA(),t.qZA(),t.qZA()),2&o){const e=r.$implicit,n=t.oxw();t.Udp("background-color",e.error?"#f44336":"")("color",e.error?"#fff":""),t.xp6(1),t.Q6J("ngIf",n.uploading&&"uploading"==e.state),t.xp6(1),t.Q6J("ngIf",n.uploading&&"uploaded"==e.state),t.xp6(2),t.hij(" ",n.utilsService.formatExt(e.file.name).icon," "),t.xp6(2),t.hij(" ",e.file.name," "),t.xp6(3),t.Oqu(n.utilsService.formatBytes(e.file.size))}}function it(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"button",27),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).onReset()}),t._uU(1," Reset "),t.qZA()}}function rt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",24),t.TgZ(1,"button",25),t.NdJ("click",function(){return t.CHM(e),t.oxw().onUpload()}),t.TgZ(2,"mat-icon"),t._uU(3,"cloud_upload"),t.qZA(),t._uU(4," Upload "),t.qZA(),t.YNc(5,it,2,0,"button",26),t.qZA()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("disabled",e.disabled),t.xp6(4),t.Q6J("ngIf",0!=e.uploads.length)}}function st(o,r){if(1&o&&t._UZ(0,"mat-progress-bar",28),2&o){const e=t.oxw();t.Q6J("value",e.getProgressValue())}}function at(o,r){if(1&o&&(t.TgZ(0,"div",29),t.TgZ(1,"div"),t._uU(2),t.qZA(),t._UZ(3,"div",30),t.TgZ(4,"div"),t._uU(5),t.qZA(),t.qZA()),2&o){const e=t.oxw();t.xp6(2),t.hij("",e.getProgressValue().toFixed(0),"%"),t.xp6(3),t.AsE(" ",e.utilsService.formatBytes(e.getUploadedSize())," / ",e.utilsService.formatBytes(e.getTotalSize())," ")}}let lt=(()=>{class o{constructor(e,n,i,s){this.utilsService=e,this.filesService=n,this.dialogRef=i,this.data=s,this.uploads=[],this.uploading=!1,this.error="",this.disabled=!1,this.maxSize="50 MB",this.maxSizeBytes=5e7,this.getTotalSize=()=>this.uploads.reduce((a,d)=>a+d.file.size,0),this.getUploadedSize=()=>this.uploads.reduce((a,d)=>a+d.file.size*(d.progress/100),0),this.getProgressValue=()=>this.getUploadedSize()/this.getTotalSize()*100,this.dragOvers=0}onDragOver(e){e.preventDefault()}onDragEnter(e){e.preventDefault(),this.dragOvers++}onDragLeave(e){e.preventDefault(),this.dragOvers--}onDrop(e){e.preventDefault(),0!==e.dataTransfer.files.length&&(this.onFilesChanged(e.dataTransfer.files),this.dragOvers=0)}openFilesInput(e,n){e.stopPropagation(),n.click()}onFilesChanged(e){let n=!1;this.uploads=[...e].map(i=>{const s=i.size>this.maxSizeBytes;return s&&(n=!0),{state:"ready",progress:0,file:i,error:s}}),this.error=n?"Maximum file size is "+this.maxSize:"",this.disabled=n}onReset(){this.uploads=[],this.error=""}onUpload(){if(this.disabled)return;this.dialogRef.disableClose=!0,this.uploading=!0;const e=this.uploads.map(i=>(0,J.T)(new K.y(s=>{i.state="uploading",s.complete()}),this.filesService.uploadFile(this.data.currentPath+(this.data.currentPath.endsWith("/")?"":"/")+i.file.name,i.file,i)));(0,J.T)(...e,8).subscribe(i=>{i.type==C.dt.UploadProgress&&(i.upload.progress=Math.round(i.loaded/i.total*100)),i.type==C.dt.Response&&(i.upload.state="uploaded",this.uploads.every(s=>"uploaded"==s.state)&&this.dialogRef.close())},i=>{this.dialogRef.disableClose=!1,this.uploading=!1,this.error=i})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.F),t.Y36(b),t.Y36(m.so),t.Y36(m.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-upload"]],hostBindings:function(e,n){1&e&&t.NdJ("dragover",function(s){return n.onDragOver(s)})("dragenter",function(s){return n.onDragEnter(s)})("dragleave",function(s){return n.onDragLeave(s)})("drop",function(s){return n.onDrop(s)})},decls:10,vars:7,consts:[["hidden","","type","file","multiple","",3,"change"],["filesInput",""],["style","margin-top: 0;",4,"ngIf"],["class","bg-warn","style","\n\t\tmargin-bottom: 16px;\n\t\tcolor: #fff;\n\t\tdisplay: flex;\n\t\tvertical-align: middle;\n\t",4,"ngIf"],[1,"uploads","fluid"],["class","drag-over",3,"active","click",4,"ngIf"],["class","file",3,"backgroundColor","color",4,"ngFor","ngForOf"],["style","display: flex; width: 100%; margin-top: 24px;",4,"ngIf"],["style","margin-top: 24px;",3,"value",4,"ngIf"],["style","margin-top: 8px; display: flex;",4,"ngIf"],[2,"margin-top","0"],[1,"bg-warn",2,"margin-bottom","16px","color","#fff","display","flex","vertical-align","middle"],[2,"margin-top","-3px","margin-right","8px"],[1,"drag-over",3,"click"],[2,"margin","0"],[2,"margin","16px 0"],["mat-button","","color","primary",3,"click"],[1,"file"],["class","icon","diameter","24","style","padding: 0 16px;",3,"value",4,"ngIf"],["class","icon","style","color: #e91e63; width: 32px; height: 32px; font-size: 32px;",4,"ngIf"],[1,"icon"],[1,"size"],["diameter","24",1,"icon",2,"padding","0 16px",3,"value"],[1,"icon",2,"color","#e91e63","width","32px","height","32px","font-size","32px"],[2,"display","flex","width","100%","margin-top","24px"],["mat-flat-button","","color","primary",2,"flex-grow","1",3,"disabled","click"],["mat-flat-button","","style","flex-grow: 1;",3,"click",4,"ngIf"],["mat-flat-button","",2,"flex-grow","1",3,"click"],[2,"margin-top","24px",3,"value"],[2,"margin-top","8px","display","flex"],[2,"flex-grow","1"]],template:function(e,n){if(1&e){const i=t.EpF();t.TgZ(0,"input",0,1),t.NdJ("change",function(){t.CHM(i);const a=t.MAs(1);return n.onFilesChanged(a.files)}),t.qZA(),t.YNc(2,G,7,3,"h2",2),t.YNc(3,X,4,1,"mat-card",3),t.TgZ(4,"div",4),t.YNc(5,tt,9,2,"div",5),t.YNc(6,ot,10,9,"div",6),t.qZA(),t.YNc(7,rt,6,2,"div",7),t.YNc(8,st,1,1,"mat-progress-bar",8),t.YNc(9,at,6,3,"div",9)}2&e&&(t.xp6(2),t.Q6J("ngIf",0!=n.uploads.length),t.xp6(1),t.Q6J("ngIf",n.error),t.xp6(2),t.Q6J("ngIf",0==n.uploads.length),t.xp6(1),t.Q6J("ngForOf",n.uploads),t.xp6(1),t.Q6J("ngIf",!n.uploading&&0!=n.uploads.length),t.xp6(1),t.Q6J("ngIf",n.uploading),t.xp6(1),t.Q6J("ngIf",n.uploading))},directives:[p.O5,p.sg,F.a8,u.Hw,_.lW,N.Ou,x.pW],styles:[".fluid[_ngcontent-%COMP%]{margin-left:-24px;width:calc(100% + 48px)}.uploads[_ngcontent-%COMP%]{max-height:60vh;overflow:auto}.uploads[_ngcontent-%COMP%] .drag-over[_ngcontent-%COMP%]{text-align:center;border:dashed 2px rgba(0,0,0,.25);color:#00000080;border-radius:4px;padding:32px 0;margin:0 24px;cursor:pointer}.uploads[_ngcontent-%COMP%] .drag-over.active[_ngcontent-%COMP%]{background:rgba(0,0,0,.05)}.uploads[_ngcontent-%COMP%] .file[_ngcontent-%COMP%]{display:flex;align-items:center;padding:4px 24px}.uploads[_ngcontent-%COMP%] .file[_ngcontent-%COMP%]:nth-child(even){background:rgba(0,0,0,.025)}.uploads[_ngcontent-%COMP%] .file[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin-right:8px}.uploads[_ngcontent-%COMP%] .file[_ngcontent-%COMP%] .size[_ngcontent-%COMP%]{opacity:.6}"]}),o})();var f=c(8295),U=c(9983);function ct(o,r){if(1&o&&(t.TgZ(0,"span",10),t._uU(1),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Oqu(e.inputPrefix)}}function dt(o,r){if(1&o&&(t.TgZ(0,"span",11),t._uU(1),t.qZA()),2&o){const e=t.oxw();t.xp6(1),t.Oqu(e.inputSuffix)}}function pt(o,r){1&o&&t._UZ(0,"mat-progress-bar",12)}let v=(()=>{class o{constructor(e,n){this.dialogRef=e,this.data=n,this.loading=!1,this.onSubmit=new t.vpe,this.inputPrefix="",this.inputSuffix="",this.titleText="",this.buttonText="",this.buttonIcon="",null!=n.inputPrefix&&(this.inputPrefix=n.inputPrefix),null!=n.inputSuffix&&(this.inputSuffix=n.inputSuffix),null!=n.titleText&&(this.titleText=n.titleText),null!=n.buttonText&&(this.buttonText=n.buttonText),null!=n.buttonIcon&&(this.buttonIcon=n.buttonIcon),this.form=new l.cw({value:new l.NI(n.inputDefault,[l.kI.required,...null==n.validators?[]:n.validators])})}onCancel(){this.dialogRef.close()}ngOnInit(){this.sub=this.onSubmit.subscribe(()=>{this.loading=!0})}ngOnDestroy(){this.sub.unsubscribe()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(m.so),t.Y36(m.WI))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-input"]],outputs:{onSubmit:"onSubmit"},decls:15,vars:8,consts:[[2,"margin","0"],[3,"formGroup","ngSubmit"],[1,"input"],["matInput","","type","text","formControlName","value"],["matPrefix","",4,"ngIf"],["matSuffix","",4,"ngIf"],[1,"buttons"],["mat-flat-button","","type","button",3,"click"],["mat-flat-button","","type","submit","color","primary",3,"disabled"],["class","loading","mode","indeterminate",4,"ngIf"],["matPrefix",""],["matSuffix",""],["mode","indeterminate",1,"loading"]],template:function(e,n){1&e&&(t.TgZ(0,"h2",0),t._uU(1),t.qZA(),t.TgZ(2,"form",1),t.NdJ("ngSubmit",function(){return n.onSubmit.emit(n.form.value.value)}),t.TgZ(3,"mat-form-field",2),t._UZ(4,"input",3),t.YNc(5,ct,2,1,"span",4),t.YNc(6,dt,2,1,"span",5),t.qZA(),t.TgZ(7,"div",6),t.TgZ(8,"button",7),t.NdJ("click",function(){return n.onCancel()}),t._uU(9," Cancel "),t.qZA(),t.TgZ(10,"button",8),t.TgZ(11,"mat-icon"),t._uU(12),t.qZA(),t._uU(13),t.qZA(),t.qZA(),t.qZA(),t.YNc(14,pt,1,0,"mat-progress-bar",9)),2&e&&(t.xp6(1),t.Oqu(n.titleText),t.xp6(1),t.Q6J("formGroup",n.form),t.xp6(3),t.Q6J("ngIf",n.inputPrefix),t.xp6(1),t.Q6J("ngIf",n.inputSuffix),t.xp6(4),t.Q6J("disabled",n.form.invalid),t.xp6(2),t.Oqu(n.buttonIcon),t.xp6(1),t.hij(" ",n.buttonText," "),t.xp6(1),t.Q6J("ngIf",n.loading))},directives:[l._Y,l.JL,l.sg,f.KE,U.Nt,l.Fj,l.JJ,l.u,p.O5,_.lW,u.Hw,f.qo,f.R9,x.pW],styles:[".input[_ngcontent-%COMP%]{width:100%}.buttons[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:flex-end}.buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin-left:8px}.loading[_ngcontent-%COMP%]{margin-top:24px;margin-bottom:-24px;margin-left:-24px;width:calc(100% + 48px)}"]}),o})();function mt(o,r){1&o&&(t.TgZ(0,"mat-icon"),t._uU(1,"arrow_drop_down"),t.qZA())}function ut(o,r){1&o&&(t.TgZ(0,"mat-icon"),t._uU(1,"arrow_right"),t.qZA())}function gt(o,r){if(1&o&&(t.TgZ(0,"div",4),t._UZ(1,"app-tree-item",5),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Q6J("folder",e)}}function _t(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",1),t.NdJ("click",function(){const s=t.CHM(e).$implicit;return t.oxw().toggleCollapsed(s.name)}),t.TgZ(2,"mat-icon"),t._uU(3,"folder"),t.qZA(),t.YNc(4,mt,2,0,"mat-icon",2),t.YNc(5,ut,2,0,"mat-icon",2),t._uU(6),t.qZA(),t.YNc(7,gt,2,1,"div",3),t.BQk()}if(2&o){const e=r.$implicit,n=t.oxw();t.xp6(4),t.Q6J("ngIf",n.collapsed[e.name]),t.xp6(1),t.Q6J("ngIf",!n.collapsed[e.name]),t.xp6(1),t.hij(" ",e.name," "),t.xp6(1),t.Q6J("ngIf",n.collapsed[e.name])}}function ft(o,r){if(1&o&&(t.ynx(0),t.TgZ(1,"div",6),t.TgZ(2,"mat-icon",7),t._uU(3),t.qZA(),t.TgZ(4,"span"),t.TgZ(5,"p"),t._uU(6),t.qZA(),t.TgZ(7,"p",8),t._uU(8),t.qZA(),t.qZA(),t.qZA(),t.BQk()),2&o){const e=r.$implicit,n=t.oxw();t.xp6(3),t.Oqu(e.icon),t.xp6(3),t.Oqu(e.name),t.xp6(2),t.Oqu(n.utilsService.formatBytes(e.size))}}let ht=(()=>{class o{constructor(e,n){this.utilsService=e,this.filesService=n,this.collapsed={},this.toggleCollapsed=i=>this.collapsed[i]=!this.collapsed[i]}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.F),t.Y36(b))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-tree-item"]],inputs:{folder:"folder"},decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[1,"folder",3,"click"],[4,"ngIf"],["style","margin-left: 24px;",4,"ngIf"],[2,"margin-left","24px"],[3,"folder"],[1,"file"],[1,"icon"],[1,"size"]],template:function(e,n){1&e&&(t.YNc(0,_t,8,4,"ng-container",0),t.YNc(1,ft,9,3,"ng-container",0)),2&e&&(t.Q6J("ngForOf",n.folder.folders),t.xp6(1),t.Q6J("ngForOf",n.folder.files))},directives:[p.sg,u.Hw,p.O5,o],styles:[".folder[_ngcontent-%COMP%], .file[_ngcontent-%COMP%]{padding:4px 0;font-size:.9em;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:flex;align-items:center}.folder[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%], .file[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin-right:8px}.folder[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .file[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.folder[_ngcontent-%COMP%] .size[_ngcontent-%COMP%], .file[_ngcontent-%COMP%] .size[_ngcontent-%COMP%]{opacity:.6}.folder[_ngcontent-%COMP%]{cursor:pointer}"]}),o})();const xt=["editor"];function vt(o,r){if(1&o&&(t.TgZ(0,"div",15),t._UZ(1,"mat-spinner",16),t.TgZ(2,"p",17),t._uU(3),t.qZA(),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij("Loading ",e.loading,"...")}}let Ct=(()=>{class o{constructor(e,n,i,s,a){this.dialogRef=e,this.data=n,this.http=i,this.filesService=s,this.platformId=a,this.loading="file",this.saving=!1,this.mimeType=null}initMonaco(){return new Promise(e=>{const n=window,i="/assets/monaco-editor/min/vs",s=()=>{n.require.config({paths:{vs:i}}),n.require(["vs/editor/editor.main"],()=>{this.monaco=n.monaco,e(null)})};if(n.require)s();else{const a=document.createElement("script");a.type="text/javascript",a.src=i+"/loader.js",a.addEventListener("load",()=>{s()}),document.body.appendChild(a)}})}getLanguage(){const e=this.data.file.name.split(".").pop().toLowerCase();return this.monaco.languages.getLanguages().find(i=>i.extensions.includes("."+e))}getFileData(){return this.http.get(this.data.file.httpUrl,{responseType:"text"}).toPromise()}save(){this.saving=!0;const e=new globalThis.File([this.editor.getValue()],this.data.file.name,{type:this.mimeType});return this.filesService.uploadFile(this.data.file.key,e).pipe((0,k.b)(n=>{n.type>=4&&(this.saving=!1)}))}ngOnInit(){return(0,I.mG)(this,void 0,void 0,function*(){if((0,p.PM)(this.platformId))return;this.loading="file";const e=yield this.getFileData();this.loading="editor",yield this.initMonaco();const n=this.getLanguage();this.mimeType=n&&n.mimetypes.length>0?n.mimetypes[0]:"text/plain",this.monaco.languages.typescript.typescriptDefaults.setCompilerOptions({target:this.monaco.languages.typescript.ScriptTarget.ES3,allowNonTsExtensions:!0,moduleResolution:this.monaco.languages.typescript.ModuleResolutionKind.NodeJs,module:this.monaco.languages.typescript.ModuleKind.CommonJS,noEmit:!0,typeRoots:["node_modules/@types"]}),this.loading=null,this.editor=this.monaco.editor.create(this.editorRef.nativeElement,{value:e,language:n?n.id:"plaintext",theme:"vs-dark",mouseWheelZoom:!0,fontFamily:"'Roboto Mono', monospace",fontSize:18}),setTimeout(()=>{this.editor.layout()},50)})}onWindowResize(){this.editor&&this.editor.layout()}onKeyDown(e){if(e.ctrlKey||e.metaKey)switch(e.code){case"KeyS":e.preventDefault(),this.save().subscribe(()=>{})}}ngOnDestroy(){this.editor&&this.editor.dispose()}onDiscard(){this.dialogRef.close()}onSave(){this.save().subscribe(e=>{})}onSaveAndClose(){this.save().subscribe(e=>{e.type>=4&&this.dialogRef.close()})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(m.so),t.Y36(m.WI),t.Y36(C.eN),t.Y36(b),t.Y36(t.Lbi))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-editor"]],viewQuery:function(e,n){if(1&e&&t.Gf(xt,5),2&e){let i;t.iGM(i=t.CRH())&&(n.editorRef=i.first)}},hostBindings:function(e,n){1&e&&t.NdJ("resize",function(){return n.onWindowResize()},!1,t.Jf7)("keydown",function(s){return n.onKeyDown(s)})},decls:28,vars:11,consts:[[1,"editor-container"],[2,"display","flex","width","100%","flex-direction","row","align-items","center"],[2,"margin","6px 12px"],[2,"flex-grow","1"],[2,"font-size","32px","width","32px","height","32px","margin-right","12px","cursor","pointer",3,"click"],["class","editor loading",4,"ngIf"],[1,"editor"],["editor",""],["mode","indeterminate"],[2,"display","flex","padding","8px","align-items","center"],[2,"margin","0"],[2,"margin","0 8px"],["mat-flat-button","",3,"disabled","click"],[2,"margin","0 4px"],["mat-flat-button","","color","primary",3,"disabled","click"],[1,"editor","loading"],["mode","indeterminate","diameter","64"],[2,"margin-top","24px"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t.TgZ(1,"div",1),t.TgZ(2,"h2",2),t._uU(3),t.qZA(),t._UZ(4,"div",3),t.TgZ(5,"mat-icon",4),t.NdJ("click",function(){return n.onSaveAndClose()}),t._uU(6," close "),t.qZA(),t.qZA(),t.YNc(7,vt,4,1,"div",5),t._UZ(8,"div",6,7),t._UZ(10,"mat-progress-bar",8),t.TgZ(11,"div",9),t._UZ(12,"div",3),t.TgZ(13,"p",10),t._uU(14," Saving file... "),t.qZA(),t._UZ(15,"div",11),t.TgZ(16,"button",12),t.NdJ("click",function(){return n.onDiscard()}),t._uU(17," Discard "),t.qZA(),t._UZ(18,"div",13),t.TgZ(19,"button",12),t.NdJ("click",function(){return n.onSave()}),t.TgZ(20,"mat-icon"),t._uU(21,"save"),t.qZA(),t._uU(22," Save "),t.qZA(),t._UZ(23,"div",13),t.TgZ(24,"button",14),t.NdJ("click",function(){return n.onSaveAndClose()}),t.TgZ(25,"mat-icon"),t._uU(26,"save"),t.qZA(),t._uU(27," Save & Close "),t.qZA(),t.qZA(),t.qZA()),2&e&&(t.xp6(3),t.hij(" ",n.data.file.key," "),t.xp6(4),t.Q6J("ngIf",n.loading),t.xp6(1),t.Udp("display",n.loading?"none":"initial"),t.xp6(2),t.Udp("opacity",n.saving?"1":"0"),t.xp6(3),t.Udp("opacity",n.saving?"0.5":"0"),t.xp6(3),t.Q6J("disabled",n.saving),t.xp6(3),t.Q6J("disabled",n.saving),t.xp6(5),t.Q6J("disabled",n.saving))},directives:[u.Hw,p.O5,x.pW,_.lW,N.$g],styles:[".editor-container[_ngcontent-%COMP%]{margin:-24px;width:calc(100% + 48px);height:calc(100% + 48px);overflow:hidden;display:flex;flex-direction:column}.editor-container[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0;padding:8px}.editor-container[_ngcontent-%COMP%] .editor[_ngcontent-%COMP%]{width:100%;height:100%;background:#1e1e1e}.editor-container[_ngcontent-%COMP%] .editor.loading[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex-direction:column;color:#fff6;font-size:1.2em}.editor-container[_ngcontent-%COMP%] .editor.loading[_ngcontent-%COMP%] .mat-spinner circle{stroke:#fff3}"]}),o})();var bt=c(1792),wt=c(1769);function Zt(o,r){1&o&&(t.TgZ(0,"div",9),t.TgZ(1,"mat-icon",8),t._uU(2,"emoji_food_beverage"),t.qZA(),t.qZA())}function Tt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",5),t.NdJ("click",function(){const s=t.CHM(e).$implicit;return t.oxw().onFolderClick.emit(s)})("contextmenu",function(i){const a=t.CHM(e).$implicit;return t.oxw().onItemContextMenu("folder",a,i)}),t.YNc(1,Zt,3,0,"div",6),t.TgZ(2,"div",7),t.TgZ(3,"mat-icon",8),t._uU(4,"folder"),t.qZA(),t._uU(5),t.qZA(),t.qZA()}if(2&o){const e=r.$implicit;t.ekj("tea-only",e.teaOnly),t.xp6(1),t.Q6J("ngIf",e.teaOnly),t.xp6(4),t.hij(" ",e.name," ")}}function Mt(o,r){1&o&&(t.TgZ(0,"div",9),t.TgZ(1,"mat-icon",8),t._uU(2,"emoji_food_beverage"),t.qZA(),t.qZA())}function yt(o,r){if(1&o&&t._UZ(0,"div",18),2&o){const e=t.oxw(2).$implicit,n=t.oxw();t.Udp("background-image","url("+n.encodeURI(e.httpUrl)+(e.cacheBust>0?"?"+e.cacheBust:"")+")")}}function Ft(o,r){if(1&o&&(t.TgZ(0,"video",19),t._UZ(1,"source",20),t.qZA()),2&o){const e=t.oxw(2).$implicit,n=t.oxw();t.xp6(1),t.Q6J("src",n.encodeURI(e.httpUrl)+(e.cacheBust>0?"?"+e.cacheBust:""),t.LSH)}}function Ut(o,r){if(1&o&&t._UZ(0,"audio",21),2&o){const e=t.oxw(2).$implicit,n=t.oxw();t.Q6J("src",n.encodeURI(e.httpUrl)+(e.cacheBust>0?"?"+e.cacheBust:""),t.LSH)}}function Ot(o,r){if(1&o&&(t.ynx(0),t.YNc(1,yt,1,2,"div",15),t.YNc(2,Ft,2,1,"video",16),t.YNc(3,Ut,1,1,"audio",17),t.BQk()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Q6J("ngIf","image"==e.type&&e.size<1e7),t.xp6(1),t.Q6J("ngIf","video"==e.type),t.xp6(1),t.Q6J("ngIf","audio"==e.type)}}function Pt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",10),t.NdJ("click",function(){const s=t.CHM(e).$implicit;return t.oxw().onItemClick(s)})("contextmenu",function(i){const a=t.CHM(e).$implicit;return t.oxw().onItemContextMenu("file",a,i)}),t.YNc(1,Mt,3,0,"div",6),t.TgZ(2,"div",11),t.TgZ(3,"mat-icon",8),t._uU(4),t.qZA(),t.YNc(5,Ot,4,3,"ng-container",12),t.qZA(),t.TgZ(6,"div",7),t.TgZ(7,"mat-icon",8),t._uU(8),t.qZA(),t.TgZ(9,"span",13),t.TgZ(10,"p"),t._uU(11),t.qZA(),t.TgZ(12,"p",14),t._uU(13),t.qZA(),t.qZA(),t.qZA(),t.qZA()}if(2&o){const e=r.$implicit,n=t.oxw();t.ekj("tea-only",e.teaOnly),t.xp6(1),t.Q6J("ngIf",e.teaOnly),t.xp6(3),t.Oqu(e.icon),t.xp6(1),t.Q6J("ngIf",!e.teaOnly),t.xp6(3),t.Oqu(e.icon),t.xp6(3),t.Oqu(e.name),t.xp6(2),t.Oqu(n.utilsService.formatBytes(e.size))}}function At(o,r){1&o&&(t.ynx(0),t._uU(1," https:// "),t.BQk())}function St(o,r){1&o&&(t.ynx(0),t._uU(1," Copied! "),t.BQk())}function It(o,r){1&o&&(t.ynx(0),t._uU(1," tea:// "),t.BQk())}function qt(o,r){1&o&&(t.ynx(0),t._uU(1," Copied! "),t.BQk())}function kt(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"div",28),t._uU(2),t._UZ(3,"br"),t.TgZ(4,"span",29),t._uU(5),t.qZA(),t.qZA(),t._UZ(6,"mat-divider"),t.TgZ(7,"p",30),t._uU(8," Copy URL to clipboard "),t.qZA(),t.TgZ(9,"div",31),t.TgZ(10,"button",32),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).onContextMenuCopyHttpUrl()}),t.TgZ(11,"mat-icon"),t._uU(12,"link"),t.qZA(),t.YNc(13,At,2,0,"ng-container",12),t.YNc(14,St,2,0,"ng-container",12),t.qZA(),t.TgZ(15,"button",33),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).onContextMenuCopyTeaUrl()}),t.TgZ(16,"mat-icon"),t._uU(17,"emoji_food_beverage"),t.qZA(),t.YNc(18,It,2,0,"ng-container",12),t.YNc(19,qt,2,0,"ng-container",12),t.qZA(),t.qZA(),t._UZ(20,"div",34),t.BQk()}if(2&o){const e=t.oxw(2);t.xp6(2),t.hij(" ",e.contextMenu.file.name," "),t.xp6(3),t.hij(" ",e.utilsService.formatBytes(e.contextMenu.file.size)," "),t.xp6(5),t.Q6J("disabled",e.contextMenu.teaOnly),t.xp6(3),t.Q6J("ngIf",!e.contextMenu.httpUrlCopied),t.xp6(1),t.Q6J("ngIf",e.contextMenu.httpUrlCopied),t.xp6(4),t.Q6J("ngIf",!e.contextMenu.teaUrlCopied),t.xp6(1),t.Q6J("ngIf",e.contextMenu.teaUrlCopied)}}function Jt(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"button",35),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).onContextMenuEditFile()}),t.TgZ(2,"mat-icon"),t._uU(3,"launch"),t.qZA(),t._uU(4," Open in editor "),t.qZA(),t._UZ(5,"mat-divider"),t.BQk()}if(2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("disabled",e.contextMenu.teaOnly)}}function Nt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"button",35),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).onContextMenuDownload()}),t.TgZ(1,"mat-icon"),t._uU(2,"get_app"),t.qZA(),t._uU(3," Download "),t.qZA()}if(2&o){const e=t.oxw(2);t.Q6J("disabled",e.contextMenu.teaOnly)}}function Yt(o,r){1&o&&t._UZ(0,"mat-progress-bar",36)}function Qt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",22),t.YNc(1,kt,21,7,"ng-container",12),t.ynx(2),t.TgZ(3,"button",23),t.NdJ("click",function(){return t.CHM(e),t.oxw().onContextMenuToggleTea()}),t.TgZ(4,"mdc-checkbox",24),t.NdJ("change",function(){return t.CHM(e),t.oxw().onContextMenuToggleTea()}),t.qZA(),t.TgZ(5,"mat-icon"),t._uU(6,"emoji_food_beverage"),t.qZA(),t._uU(7," Toggle tea:// only "),t.qZA(),t._UZ(8,"mat-divider"),t.BQk(),t.YNc(9,Jt,6,1,"ng-container",12),t.TgZ(10,"button",23),t.NdJ("click",function(){return t.CHM(e),t.oxw().onContextMenuMove()}),t.TgZ(11,"mat-icon"),t._uU(12,"folder"),t.qZA(),t._uU(13," Move "),t.qZA(),t.TgZ(14,"button",23),t.NdJ("click",function(){return t.CHM(e),t.oxw().onContextMenuRename()}),t.TgZ(15,"mat-icon"),t._uU(16,"create"),t.qZA(),t._uU(17," Rename "),t.qZA(),t.YNc(18,Nt,4,1,"button",25),t._UZ(19,"mat-divider"),t.TgZ(20,"button",26),t.NdJ("click",function(){return t.CHM(e),t.oxw().onContextMenuDelete()}),t.TgZ(21,"mat-icon"),t._uU(22,"delete"),t.qZA(),t._uU(23),t.qZA(),t.YNc(24,Yt,1,0,"mat-progress-bar",27),t.qZA()}if(2&o){const e=t.oxw();t.Udp("top",e.contextMenu.y+"px")("left",e.contextMenu.x+"px"),t.xp6(1),t.Q6J("ngIf","file"==e.contextMenu.type),t.xp6(3),t.Q6J("checked",e.contextMenu.teaOnly),t.xp6(5),t.Q6J("ngIf","file"==e.contextMenu.type&&"code"==e.contextMenu.file.type),t.xp6(9),t.Q6J("ngIf","file"==e.contextMenu.type),t.xp6(2),t.Q6J("color",e.contextMenu.areYouSureDelete?"warn":""),t.xp6(3),t.hij(" ",e.contextMenu.areYouSureDelete?"Are you sure?":"Delete"," "),t.xp6(1),t.Q6J("ngIf",e.contextMenu.loading)}}let Et=(()=>{class o{constructor(e,n,i,s,a){this.utilsService=e,this.filesService=n,this.platformId=i,this.clipboard=s,this.dialog=a,this.onFolderClick=new t.vpe,this.onRefresh=new t.vpe,this.contextMenu=null}encodeURI(e){return encodeURI(e)}onItemClick(e){!e.teaOnly&&(0,p.NF)(this.platformId)&&window.open(e.httpUrl)}onItemContextMenu(e,n,i){i.preventDefault(),this.contextMenu={type:e,file:"file"==e?n:null,folder:"folder"==e?n:null,x:i.clientX,y:i.clientY,httpUrlCopied:!1,teaUrlCopied:!1,teaOnly:n.teaOnly,areYouSureDelete:!1,loading:!1}}onContextMenuClickAway(e){null!=this.contextMenu&&0==[...e.composedPath()].some(n=>null!=n.className&&n.className.includes("context-menu"))&&(this.contextMenu=null)}onContextMenuCopyHttpUrl(){this.clipboard.copy(this.contextMenu.file.httpUrl),this.contextMenu.teaUrlCopied=!1,this.contextMenu.httpUrlCopied=!0}onContextMenuCopyTeaUrl(){this.clipboard.copy(this.contextMenu.file.teaUrl),this.contextMenu.httpUrlCopied=!1,this.contextMenu.teaUrlCopied=!0}onContextMenuMoveFile(){const e=this.contextMenu.file.key,n=e.split("/").slice(0,-1).join("/"),i=this.dialog.open(v,{width:"600px",data:{inputSuffix:"/"+this.contextMenu.file.name,inputDefault:n||"/",titleText:"Move a file",buttonText:"Move file",buttonIcon:"folder",validators:[]}}),s=i.componentInstance.onSubmit.subscribe(a=>{const d=a+(a.endsWith("/")?"":"/")+this.contextMenu.file.name;this.filesService.moveFile(e,d).subscribe(()=>{i.close(),this.onRefresh.emit(),this.contextMenu=null,s.unsubscribe()})})}onContextMenuMoveFolder(){const e=this.contextMenu.folder.getBreadcrumbs().map(a=>a.name).join("/"),n="/"+e,i=this.dialog.open(v,{width:"600px",data:{inputPrefix:"/",inputDefault:e,titleText:"Move a folder",buttonText:"Move folder",buttonIcon:"folder",validators:[]}}),s=i.componentInstance.onSubmit.subscribe(a=>{this.filesService.moveFolder(n,"/"+a).subscribe(()=>{i.close(),this.onRefresh.emit(),this.contextMenu=null,s.unsubscribe()})})}onContextMenuMove(){return"file"==this.contextMenu.type?this.onContextMenuMoveFile():"folder"==this.contextMenu.type?this.onContextMenuMoveFolder():void 0}onContextMenuRenameFile(){const e=this.contextMenu.file.key,n=e.split("/").slice(0,-1).join("/")+"/",i=this.dialog.open(v,{width:"600px",data:{inputPrefix:n,inputDefault:this.contextMenu.file.name,titleText:"Rename a file",buttonText:"Rename file",buttonIcon:"create",validators:[l.kI.pattern(/^[^\/]*?$/)]}}),s=i.componentInstance.onSubmit.subscribe(a=>{this.filesService.moveFile(e,n+a).subscribe(()=>{i.close(),this.onRefresh.emit(),this.contextMenu=null,s.unsubscribe()})})}onContextMenuRenameFolder(){let e="/"+this.contextMenu.folder.getBreadcrumbs().slice(0,-1).map(a=>a.name).join("/");e.endsWith("/")||(e+="/");const n=e+this.contextMenu.folder.name,i=this.dialog.open(v,{width:"600px",data:{inputPrefix:e,inputDefault:this.contextMenu.folder.name,titleText:"Rename a folder",buttonText:"Rename folder",buttonIcon:"create",validators:[l.kI.pattern(/^[^\/]*?$/)]}}),s=i.componentInstance.onSubmit.subscribe(a=>{this.filesService.moveFolder(n,e+a).subscribe(()=>{i.close(),this.onRefresh.emit(),this.contextMenu=null,s.unsubscribe()})})}onContextMenuRename(){return"file"==this.contextMenu.type?this.onContextMenuRenameFile():"folder"==this.contextMenu.type?this.onContextMenuRenameFolder():void 0}onContextMenuToggleTea(){const e=this.contextMenu;e.loading=!0,("file"==this.contextMenu.type?this.filesService.toggleTeaOnlyFile(this.contextMenu.file.key):this.filesService.toggleTeaOnlyFolder(this.contextMenu.folder.key)).subscribe(()=>{this.onRefresh.emit(),this.contextMenu==e&&(this.contextMenu=null)})}onContextMenuEditFile(){this.dialog.open(Ct,{width:"calc(100vw - 50px)",height:"calc(100vh - 50px)",disableClose:!0,data:{file:this.contextMenu.file}}),this.contextMenu=null}onContextMenuDownload(){(0,p.PM)(this.platformId)||window.open(this.contextMenu.file.httpUrl+"?download","_self")}onContextMenuDelete(){if(0==this.contextMenu.areYouSureDelete)return void(this.contextMenu.areYouSureDelete=!0);const e=this.contextMenu;e.loading=!0,("file"==e.type?this.filesService.deleteFile(this.contextMenu.file.key):this.filesService.deleteFolder(this.contextMenu.folder.key)).subscribe(()=>{this.onRefresh.emit(),this.contextMenu==e&&(this.contextMenu=null)},()=>{this.contextMenu==e&&(this.contextMenu=null)})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.F),t.Y36(b),t.Y36(t.Lbi),t.Y36(P.TU),t.Y36(m.uw))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-folder-view"]],hostBindings:function(e,n){1&e&&t.NdJ("mousedown",function(s){return n.onContextMenuClickAway(s)},!1,t.Jf7)},inputs:{folder:"folder"},outputs:{onFolderClick:"onFolderClick",onRefresh:"onRefresh"},decls:6,vars:3,consts:[[1,"view"],["class","item folder","oncontextmenu","return false;",3,"tea-only","click","contextmenu",4,"ngFor","ngForOf"],["class","item file","oncontextmenu","return false;",3,"tea-only","click","contextmenu",4,"ngFor","ngForOf"],["class","context-menu mat-elevation-z2","oncontextmenu","return false;",3,"top","left",4,"ngIf"],[2,"margin","384px 0"],["oncontextmenu","return false;",1,"item","folder",3,"click","contextmenu"],["class","tea-only",4,"ngIf"],[1,"contents"],[1,"icon"],[1,"tea-only"],["oncontextmenu","return false;",1,"item","file",3,"click","contextmenu"],[1,"thumbnail"],[4,"ngIf"],[2,"height","36px"],[1,"size"],["class","preview",3,"backgroundImage",4,"ngIf"],["class","preview","style","object-fit: cover;","autoplay","","loop","","mute","",4,"ngIf"],["class","preview","style","background: #fff;","controls","",3,"src",4,"ngIf"],[1,"preview"],["autoplay","","loop","","mute","",1,"preview",2,"object-fit","cover"],[3,"src"],["controls","",1,"preview",2,"background","#fff",3,"src"],["oncontextmenu","return false;",1,"context-menu","mat-elevation-z2"],["mat-button","",3,"click"],[2,"margin-left","-8px",3,"checked","change"],["mat-button","",3,"disabled","click",4,"ngIf"],["mat-flat-button","",3,"color","click"],["mode","indeterminate","style","margin-bottom: -8px; margin-top: 8px;",4,"ngIf"],[1,"info"],[2,"opacity","0.6"],[2,"opacity","0.6","text-align","center","margin-bottom","4px","margin-top","16px"],[2,"display","flex","padding","0 16px"],["mat-button","",2,"text-align","center",3,"disabled","click"],["mat-button","",2,"text-align","center",3,"click"],[2,"margin","8px 0"],["mat-button","",3,"disabled","click"],["mode","indeterminate",2,"margin-bottom","-8px","margin-top","8px"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t.YNc(1,Tt,6,4,"div",1),t.qZA(),t.TgZ(2,"div",0),t.YNc(3,Pt,14,8,"div",2),t.qZA(),t.YNc(4,Qt,25,11,"div",3),t._UZ(5,"div",4)),2&e&&(t.xp6(1),t.Q6J("ngForOf",n.folder.folders),t.xp6(2),t.Q6J("ngForOf",n.folder.files),t.xp6(1),t.Q6J("ngIf",n.contextMenu))},directives:[p.sg,p.O5,u.Hw,_.lW,bt.qC,wt.d,x.pW],styles:[".view[_ngcontent-%COMP%]{width:100%;overflow:hidden}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{display:inline-block;padding:12px;height:48px;border:solid 1px rgba(0,0,0,.15);border-radius:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none;color:#000;position:relative;margin:8px}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]:hover{background-color:#00000006;border-color:#0003}.view[_ngcontent-%COMP%] .item.tea-only[_ngcontent-%COMP%]{border-color:#e91e634d}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%] .tea-only[_ngcontent-%COMP%]{width:27px;height:27px;background-color:#f06292;color:#fff;padding-left:1px;padding-top:1px;border-radius:3px 0 6px;position:absolute;top:0px;left:0px;z-index:999}.view[_ngcontent-%COMP%] .item.folder.tea-only[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%]{margin-left:27px}@media (max-width: 7200px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(4.347826087% - 16px)}}@media (max-width: 6900px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(4.5454545455% - 16px)}}@media (max-width: 6600px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(4.7619047619% - 16px)}}@media (max-width: 6300px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(5% - 16px)}}@media (max-width: 6000px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(5.2631578947% - 16px)}}@media (max-width: 5700px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(5.5555555556% - 16px)}}@media (max-width: 5400px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(5.8823529412% - 16px)}}@media (max-width: 5100px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(6.25% - 16px)}}@media (max-width: 4800px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(6.6666666667% - 16px)}}@media (max-width: 4500px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(7.1428571429% - 16px)}}@media (max-width: 4200px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(7.6923076923% - 16px)}}@media (max-width: 3900px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(8.3333333333% - 16px)}}@media (max-width: 3600px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(9.0909090909% - 16px)}}@media (max-width: 3300px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(10% - 16px)}}@media (max-width: 3000px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(11.1111111111% - 16px)}}@media (max-width: 2700px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(12.5% - 16px)}}@media (max-width: 2400px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(14.2857142857% - 16px)}}@media (max-width: 2100px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(16.6666666667% - 16px)}}@media (max-width: 1800px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(20% - 16px)}}@media (max-width: 1500px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(25% - 16px)}}@media (max-width: 1200px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(33.3333333333% - 16px)}}@media (max-width: 900px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(50% - 16px)}}@media (max-width: 600px){.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{width:calc(100% - 16px)}}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;align-items:center;font-size:.9em}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{margin-right:8px}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.view[_ngcontent-%COMP%] .item[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%] .size[_ngcontent-%COMP%]{opacity:.6}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%]{height:136px}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%] .thumbnail[_ngcontent-%COMP%]{height:72px;border-radius:4px;margin-bottom:8px;display:flex;align-items:center;justify-content:center;position:relative;overflow:hidden;background-color:#f2f2f2}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%] .thumbnail[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{width:48px;height:48px;font-size:3em;opacity:.2}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%] .thumbnail[_ngcontent-%COMP%] .preview[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#000;background-size:cover;background-position:center;background-repeat:no-repeat;width:100%;height:100%}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%] .thumbnail[_ngcontent-%COMP%] .preview.contain[_ngcontent-%COMP%]{background-size:contain}.view[_ngcontent-%COMP%] .item.file[_ngcontent-%COMP%] .contents[_ngcontent-%COMP%]{height:32px;overflow:hidden}.context-menu[_ngcontent-%COMP%]{position:fixed;background:#fff;width:250px;padding:8px 0;border-radius:4px;top:0;left:0;z-index:999;overflow:hidden}.context-menu[_ngcontent-%COMP%] .info[_ngcontent-%COMP%]{padding:8px 16px}.context-menu[_ngcontent-%COMP%] mat-divider[_ngcontent-%COMP%]{margin:8px 0}.context-menu[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{text-align:left;display:block;width:100%;border-radius:0}"]}),o})();function Dt(o,r){1&o&&t._UZ(0,"mat-progress-bar",3)}function Bt(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",4),t._UZ(1,"div",5),t.TgZ(2,"div",6),t.TgZ(3,"mat-icon",7),t._uU(4,"storage"),t.qZA(),t.TgZ(5,"p",8),t._uU(6),t._UZ(7,"mat-progress-bar",9),t._uU(8),t.qZA(),t.qZA(),t._UZ(9,"div",5),t.TgZ(10,"button",10),t.NdJ("click",function(){return t.CHM(e),t.oxw().onUpload()}),t.TgZ(11,"mat-icon",11),t._uU(12,"cloud_upload"),t.qZA(),t._uU(13," Upload "),t.qZA(),t._UZ(14,"div",12),t.TgZ(15,"div",13),t.TgZ(16,"button",14),t.NdJ("click",function(){return t.CHM(e),t.oxw().onCreateFolder()}),t.TgZ(17,"mat-icon",11),t._uU(18," create_new_folder "),t.qZA(),t._uU(19," Create folder "),t.qZA(),t.TgZ(20,"button",14),t.NdJ("click",function(){return t.CHM(e),t.oxw().onCreateFile()}),t.TgZ(21,"mat-icon",11),t._uU(22," note_add "),t.qZA(),t._uU(23," Create file "),t.qZA(),t.qZA(),t._UZ(24,"br"),t.TgZ(25,"div",15),t._UZ(26,"app-tree-item",16),t.qZA(),t.qZA()}if(2&o){const e=t.oxw();t.xp6(6),t.hij(" Storage of ",e.total," files "),t.xp6(1),t.Q6J("value",e.status.usedSize/e.status.maxSize*100),t.xp6(1),t.AsE(" ",e.utilsService.formatBytes(e.status.usedSize)," of ",-1==e.status.maxSize?"unlimited":e.utilsService.formatBytes(e.status.maxSize)," used "),t.xp6(18),t.Q6J("folder",e.rootFolder)}}function zt(o,r){if(1&o){const e=t.EpF();t.ynx(0),t.TgZ(1,"mat-icon",22),t._uU(2,"keyboard_arrow_right"),t.qZA(),t.TgZ(3,"button",19),t.NdJ("click",function(){const s=t.CHM(e).$implicit;return t.oxw(2).changeCurrentFolder(s)}),t._uU(4),t.qZA(),t.BQk()}if(2&o){const e=r.$implicit;t.xp6(4),t.hij(" ",e.name," ")}}function Ht(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"div",17),t.TgZ(1,"div",18),t.TgZ(2,"button",19),t.NdJ("click",function(){t.CHM(e);const i=t.oxw();return i.changeCurrentFolder(i.rootFolder)}),t._uU(3),t.qZA(),t.YNc(4,zt,5,1,"ng-container",20),t.qZA(),t.TgZ(5,"app-folder-view",21),t.NdJ("onFolderClick",function(i){return t.CHM(e),t.oxw().changeCurrentFolder(i)})("onRefresh",function(){return t.CHM(e),t.oxw().refresh()}),t.qZA(),t.qZA()}if(2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.utilsService.displayPluralName(e.user.profile.username)," Files "),t.xp6(1),t.Q6J("ngForOf",e.getBreadcrumbs()),t.xp6(1),t.Q6J("folder",e.currentFolder)}}let jt=(()=>{class o{constructor(e,n,i,s,a,d){this.utilsService=e,this.filesService=n,this.authService=i,this.dialog=s,this.route=a,this.router=d,this.rootFolder=new Z(""),this.currentFolder=new Z(""),this.loading=!0,this.total=0}getBreadcrumbs(e){const n=[];for(null==e&&(e=this.currentFolder);null!=e.parent;)n.unshift(e),e=e.parent;return n}getCurrentPath(e){return this.getBreadcrumbs(e).map(n=>n.name)}refresh(e){return new Promise(n=>{this.loading=!0,(0,V.D)({files:this.filesService.getFiles(),status:this.filesService.getStatus()}).subscribe(i=>{this.rootFolder=i.files.folder,this.total=i.files.total,this.status=i.status;const s=this.filesService.getFolder(e||this.getCurrentPath(),this.rootFolder,!1);this.currentFolder=null!=s?s:this.rootFolder,this.loading=!1,n(null)})})}ngOnInit(){return(0,I.mG)(this,void 0,void 0,function*(){yield this.refresh(),this.route.queryParams.subscribe(e=>{if(null==e.path)this.router.navigate([],{relativeTo:this.route,queryParams:{path:"/"}});else{const n=(e.path.startsWith("/")?e.path.slice(1):e.path).split("/"),i=this.filesService.getFolder(n,this.rootFolder,!1);this.currentFolder=null!=i?i:this.rootFolder}}),this.authService.user$.subscribe(e=>{this.user=e})})}onUpload(){const n=this.dialog.open(lt,{width:"500px",data:{currentPath:"/"+this.getCurrentPath().join("/")}}).afterClosed().subscribe(()=>{this.refresh(),n.unsubscribe()})}changeCurrentFolder(e){this.router.navigate(["."],{relativeTo:this.route,queryParams:{path:"/"+this.getCurrentPath(e).join("/")}})}onCreateFolder(){let e="/"+this.getCurrentPath().join("/");e.endsWith("/")||(e+="/");const n=this.dialog.open(v,{width:"600px",data:{inputPrefix:e,inputDefault:"",titleText:"Create a new folder",buttonText:"Create folder",buttonIcon:"create_new_folder"}}),i=n.componentInstance.onSubmit.subscribe(s=>{this.filesService.createFolder(e+s).subscribe(()=>{n.close(),this.refresh(),i.unsubscribe()})})}onCreateFile(){let e="/"+this.getCurrentPath().join("/");e.endsWith("/")||(e+="/");const n=this.dialog.open(v,{width:"600px",data:{inputPrefix:e,inputDefault:"",titleText:"Create a new file",buttonText:"Create file",buttonIcon:"note_add"}}),i=n.componentInstance.onSubmit.subscribe(s=>{this.filesService.createFile(e+s).subscribe(()=>{n.close(),this.refresh(),i.unsubscribe()})})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(h.F),t.Y36(b),t.Y36(y.e),t.Y36(m.uw),t.Y36(T.gz),t.Y36(T.F0))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-files"]],decls:3,vars:3,consts:[["mode","indeterminate",4,"ngIf"],["class","sidebar",4,"ngIf"],["class","files",4,"ngIf"],["mode","indeterminate"],[1,"sidebar"],[2,"margin","12px 0"],[1,"storage",2,"display","flex","align-items","top"],[2,"margin-right","8px"],[2,"margin","0","width","100%"],[2,"margin","8px 0",3,"value"],["mat-flat-button","","color","primary",3,"click"],[2,"margin-right","4px"],[2,"margin","4px 0"],[2,"display","flex"],["mat-flat-button","",3,"click"],[1,"tree"],[3,"folder"],[1,"files"],[1,"breadcrumbs"],["mat-button","",3,"click"],[4,"ngFor","ngForOf"],[3,"folder","onFolderClick","onRefresh"],[1,"icon"]],template:function(e,n){1&e&&(t.YNc(0,Dt,1,0,"mat-progress-bar",0),t.YNc(1,Bt,27,5,"div",1),t.YNc(2,Ht,6,3,"div",2)),2&e&&(t.Q6J("ngIf",n.loading),t.xp6(1),t.Q6J("ngIf",n.status),t.xp6(1),t.Q6J("ngIf",n.user))},directives:[p.O5,x.pW,u.Hw,_.lW,ht,p.sg,Et],styles:[".sidebar[_ngcontent-%COMP%]{position:fixed;top:64px;bottom:0;left:0;width:300px;overflow:hidden;display:flex;flex-direction:column;padding:0 16px}.sidebar[_ngcontent-%COMP%] .tree[_ngcontent-%COMP%]{overflow-y:auto;width:100%;height:auto}.files[_ngcontent-%COMP%]{position:fixed;top:64px;bottom:0;left:300px;right:0;padding-right:16px;overflow:auto}.files[_ngcontent-%COMP%] .breadcrumbs[_ngcontent-%COMP%]{display:flex;align-items:center;margin-top:16px;margin-bottom:4px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.files[_ngcontent-%COMP%] .breadcrumbs[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{font-size:1.4em;font-weight:400;padding-left:8px;padding-right:8px}.files[_ngcontent-%COMP%] .breadcrumbs[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{opacity:.75}.drag-over[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#1d1f21cc;display:flex;align-items:center;justify-content:center;color:#fff;-webkit-user-select:none;-moz-user-select:none;user-select:none}"]}),o})();function Rt(o,r){if(1&o&&(t.TgZ(0,"mat-card",10),t.TgZ(1,"mat-icon",11),t._uU(2," error_outline "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.error," ")}}function Vt(o,r){1&o&&(t.TgZ(0,"mat-error"),t._uU(1," Password is required "),t.qZA())}function $t(o,r){1&o&&(t.TgZ(0,"mat-error"),t._uU(1," Password is too short "),t.qZA())}function Lt(o,r){1&o&&(t.TgZ(0,"mat-error"),t._uU(1," Password is too long "),t.qZA())}let Wt=(()=>{class o{constructor(e,n,i){this.userService=e,this.dialogRef=n,this.utilsService=i,this.error="",this.form=new l.cw({password:new l.NI(null,[l.kI.required,l.kI.minLength(6),l.kI.maxLength(64)])})}ngOnInit(){}onSubmit(){this.form.invalid||(this.form.disable(),this.userService.exportData(this.form.value.password).subscribe(e=>{this.utilsService.downloadBlob(e,"tivoli-export-data.zip"),this.dialogRef.close()},e=>{this.error="Invalid password",this.form.enable()}))}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(M.K),t.Y36(m.so),t.Y36(h.F))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-export-data"]],decls:23,vars:6,consts:[[3,"formGroup","submit"],[2,"margin-top","0"],["class","bg-warn","style","\n\t\t\tmargin-bottom: 16px;\n\t\t\tcolor: #fff;\n\t\t\tdisplay: flex;\n\t\t\tvertical-align: middle;\n\t\t",4,"ngIf"],["href","https://en.wikipedia.org/wiki/Data_portability","target","_blank"],[2,"margin","4px 0"],[2,"width","100%"],["matInput","","type","password","placeholder","Password","required","","formControlName","password"],[4,"ngIf"],[2,"margin","8px 0"],["mat-flat-button","","color","primary","type","submit",3,"disabled"],[1,"bg-warn",2,"margin-bottom","16px","color","#fff","display","flex","vertical-align","middle"],[2,"margin-top","-3px","margin-right","8px"]],template:function(e,n){1&e&&(t.TgZ(0,"form",0),t.NdJ("submit",function(){return n.onSubmit()}),t.TgZ(1,"h1",1),t._uU(2,"Export all my data"),t.qZA(),t.YNc(3,Rt,4,1,"mat-card",2),t.TgZ(4,"p"),t._uU(5," You can download all of your personal data we keep as a zip archive. You have the right to "),t.TgZ(6,"a",3),t._uU(7," data portability"),t.qZA(),t._uU(8,". "),t._UZ(9,"br"),t._UZ(10,"br"),t._uU(11," To continue, please verify yourself with your password. "),t.qZA(),t._UZ(12,"div",4),t.TgZ(13,"mat-form-field",5),t._UZ(14,"input",6),t.YNc(15,Vt,2,0,"mat-error",7),t.YNc(16,$t,2,0,"mat-error",7),t.YNc(17,Lt,2,0,"mat-error",7),t.qZA(),t._UZ(18,"div",8),t.TgZ(19,"button",9),t.TgZ(20,"mat-icon"),t._uU(21,"get_app"),t.qZA(),t._uU(22," Download my data "),t.qZA(),t.qZA()),2&e&&(t.Q6J("formGroup",n.form),t.xp6(3),t.Q6J("ngIf",n.error),t.xp6(12),t.Q6J("ngIf",n.form.hasError("required","password")),t.xp6(1),t.Q6J("ngIf",n.form.hasError("minlength","password")),t.xp6(1),t.Q6J("ngIf",n.form.hasError("maxlength","password")),t.xp6(2),t.Q6J("disabled",n.form.disabled||n.form.invalid))},directives:[l._Y,l.JL,l.sg,p.O5,f.KE,U.Nt,l.Fj,l.Q7,l.JJ,l.u,_.lW,u.Hw,F.a8,f.TO],styles:[""]}),o})();var Kt=c(1908);function Gt(o,r){if(1&o&&(t.TgZ(0,"mat-card",21),t.TgZ(1,"mat-icon",22),t._uU(2," error_outline "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.emailFormError," ")}}function Xt(o,r){1&o&&(t.TgZ(0,"mat-error"),t._uU(1," Email is invalid "),t.qZA())}function te(o,r){1&o&&(t.TgZ(0,"mat-error"),t._uU(1," Email is too long "),t.qZA())}function ee(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"form",14),t.NdJ("ngSubmit",function(){return t.CHM(e),t.oxw().onEmailFormSubmit()}),t.TgZ(1,"mat-form-field",8),t._UZ(2,"input",23),t.YNc(3,Xt,2,0,"mat-error",7),t.YNc(4,te,2,0,"mat-error",7),t.qZA(),t.TgZ(5,"button",16),t.TgZ(6,"mat-icon"),t._uU(7,"save"),t.qZA(),t._uU(8," Save changes "),t.qZA(),t.qZA()}if(2&o){const e=t.oxw();t.Q6J("formGroup",e.emailForm),t.xp6(3),t.Q6J("ngIf",e.emailForm.hasError("email","email")),t.xp6(1),t.Q6J("ngIf",e.emailForm.hasError("maxlength","email")),t.xp6(1),t.Q6J("disabled",e.emailForm.pristine||e.emailForm.invalid||e.emailForm.disabled)}}function ne(o,r){if(1&o&&(t.TgZ(0,"mat-card",24),t.TgZ(1,"mat-icon",22),t._uU(2," done "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.emailFormSuccess," ")}}function oe(o,r){1&o&&(t.TgZ(0,"div"),t._UZ(1,"br"),t._UZ(2,"mat-progress-bar",25),t.qZA())}function ie(o,r){if(1&o&&(t.TgZ(0,"mat-card",21),t.TgZ(1,"mat-icon",22),t._uU(2," error_outline "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.passwordFormError," ")}}function re(o,r){if(1&o&&(t.TgZ(0,"mat-error"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.label," is required ")}}function se(o,r){if(1&o&&(t.TgZ(0,"mat-error"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.label," is too short ")}}function ae(o,r){if(1&o&&(t.TgZ(0,"mat-error"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.label," is too long ")}}function le(o,r){if(1&o&&(t.TgZ(0,"mat-error"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.label," cant be the same as current password ")}}function ce(o,r){if(1&o&&(t.TgZ(0,"mat-error"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.hij(" ",e.label," does not match new password ")}}function de(o,r){if(1&o&&(t.TgZ(0,"mat-form-field",8),t._UZ(1,"input",28,29),t.YNc(3,re,2,1,"mat-error",7),t.YNc(4,se,2,1,"mat-error",7),t.YNc(5,ae,2,1,"mat-error",7),t.YNc(6,le,2,1,"mat-error",7),t.YNc(7,ce,2,1,"mat-error",7),t.qZA()),2&o){const e=r.$implicit,n=t.oxw(2);t.xp6(1),t.Q6J("placeholder",e.label)("formControlName",e.name),t.xp6(2),t.Q6J("ngIf",n.passwordForm.hasError("required",e.name)),t.xp6(1),t.Q6J("ngIf",n.passwordForm.hasError("minlength",e.name)),t.xp6(1),t.Q6J("ngIf",n.passwordForm.hasError("maxlength",e.name)),t.xp6(1),t.Q6J("ngIf",n.passwordForm.hasError("cantBeSame",e.name)),t.xp6(1),t.Q6J("ngIf",n.passwordForm.hasError("mismatch",e.name))}}function pe(o,r){1&o&&(t.TgZ(0,"p",30),t._uU(1," Current password can't be same as new password "),t.qZA())}function me(o,r){1&o&&(t.TgZ(0,"p",30),t._uU(1," New password doesn't match confirmed password "),t.qZA())}const ue=function(){return{label:"Current password",name:"currentPassword"}},ge=function(){return{label:"New password",name:"newPassword"}},_e=function(){return{label:"Confirm password",name:"confirmPassword"}},fe=function(o,r,e){return[o,r,e]};function he(o,r){if(1&o){const e=t.EpF();t.TgZ(0,"form",14),t.NdJ("ngSubmit",function(){return t.CHM(e),t.oxw().onPasswordFormSubmit()}),t.YNc(1,de,8,7,"mat-form-field",26),t.YNc(2,pe,2,0,"p",27),t.YNc(3,me,2,0,"p",27),t.TgZ(4,"button",16),t.TgZ(5,"mat-icon"),t._uU(6,"save"),t.qZA(),t._uU(7," Save changes "),t.qZA(),t.qZA()}if(2&o){const e=t.oxw();t.Q6J("formGroup",e.passwordForm),t.xp6(1),t.Q6J("ngForOf",t.kEZ(8,fe,t.DdM(5,ue),t.DdM(6,ge),t.DdM(7,_e))),t.xp6(1),t.Q6J("ngIf",e.passwordForm.hasError("cantBeSame")),t.xp6(1),t.Q6J("ngIf",e.passwordForm.hasError("mismatch")),t.xp6(1),t.Q6J("disabled",e.passwordForm.pristine||e.passwordForm.invalid||e.passwordForm.disabled)}}function xe(o,r){if(1&o&&(t.TgZ(0,"mat-card",24),t.TgZ(1,"mat-icon",22),t._uU(2," done "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.passwordFormSuccess," ")}}function ve(o,r){1&o&&(t.TgZ(0,"div"),t._UZ(1,"br"),t._UZ(2,"mat-progress-bar",25),t.qZA())}function Ce(o,r){if(1&o&&(t.TgZ(0,"mat-card",21),t.TgZ(1,"mat-icon",22),t._uU(2," error_outline "),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.imageFormError," ")}}function be(o,r){1&o&&(t.TgZ(0,"div"),t._UZ(1,"br"),t._UZ(2,"mat-progress-bar",25),t.qZA())}const we=[{path:"",redirectTo:"settings",pathMatch:"full"},{path:"files",component:jt},{path:"worlds",component:R},{path:"settings",component:(()=>{class o{constructor(e,n,i,s){this.userService=e,this.authService=n,this.snackBar=i,this.dialog=s,this.user={},this.userSub=null,this.userImageSrc="",this.emailForm=new l.cw({email:new l.NI(null,[l.kI.email,l.kI.maxLength(64)])}),this.emailFormError="",this.emailFormSuccess="",this.passwordForm=new l.cw({currentPassword:new l.NI(null,[l.kI.required,l.kI.minLength(6),l.kI.maxLength(64)]),newPassword:new l.NI(null,[l.kI.required,l.kI.minLength(6),l.kI.maxLength(64)]),confirmPassword:new l.NI(null,[l.kI.required])},a=>{const d=null!=a.get("currentPassword").value&&null!=a.get("newPassword").value&&a.get("currentPassword").value===a.get("newPassword").value,g=null!=a.get("newPassword").value&&null!=a.get("confirmPassword").value&&a.get("newPassword").value!==a.get("confirmPassword").value;return d||g?Object.assign(Object.assign({},d?{cantBeSame:d}:{}),g?{mismatch:g}:{}):null}),this.passwordFormError="",this.passwordFormSuccess="",this.imageForm=new l.cw({image:new l.NI(null,[l.kI.required])}),this.imageFormError="",this.userSub=this.authService.user$.subscribe(a=>{this.user=a,this.updateUserImage(),this.emailForm.controls.email.setValue(this.user.profile.email)})}updateUserImage(){null!=this.user&&(this.userImageSrc="/api/user/"+this.user.profile.username+"/image?"+ +new Date)}onEmailFormSubmit(){if(this.emailForm.invalid)return;this.emailForm.disable();const e=this.userService.updateUserEmail(this.emailForm.value).subscribe(n=>{this.emailForm.enable(),this.emailFormSuccess=n.message},n=>{this.emailForm.enable(),this.emailFormError=n},()=>{e.unsubscribe()})}onPasswordFormSubmit(){if(this.passwordForm.invalid)return;this.passwordForm.disable();const e=this.userService.updateUserPassword({currentPassword:this.passwordForm.value.currentPassword,newPassword:this.passwordForm.value.newPassword}).subscribe(n=>{this.passwordForm.enable(),this.passwordFormError="",this.passwordFormSuccess=n.message},n=>{this.passwordForm.enable(),this.passwordFormError=n,this.passwordFormSuccess=""},()=>{e.unsubscribe()})}onImageFormSubmit(){this.imageForm.invalid||(this.imageForm.disable(),this.userService.updateUserImage(this.imageForm.value).subscribe(()=>{this.imageForm.enable(),this.imageForm.reset(),this.updateUserImage(),this.snackBar.open("User image has been updated","Dismiss",{duration:2e3})},n=>{this.imageForm.enable(),this.imageFormError=n}))}onRemoveImage(){!1!==confirm("Are you sure you want to delete your image?")&&(this.imageForm.disable(),this.userService.removeUserImage().subscribe(()=>{this.imageForm.enable(),this.imageForm.reset(),this.updateUserImage(),this.snackBar.open("User image has been deleted","Dismiss",{duration:2e3})},e=>{this.imageForm.enable(),this.imageFormError=e}))}onExportData(){this.dialog.open(Wt,{width:"600px"})}ngOnInit(){}ngOnDestroy(){this.userSub.unsubscribe()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(M.K),t.Y36(y.e),t.Y36(S.ux),t.Y36(m.uw))},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-settings"]],decls:57,vars:13,consts:[[1,"container"],[2,"padding","16px 0"],[1,"row"],[1,"col-md-6"],["class","bg-warn","style","\n\t\t\t\t\t\tmargin-bottom: 16px;\n\t\t\t\t\t\tcolor: #fff;\n\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\tvertical-align: middle;\n\t\t\t\t\t",4,"ngIf"],[3,"formGroup","ngSubmit",4,"ngIf"],["class","bg-success","style","\n\t\t\t\t\t\tmargin-bottom: 16px;\n\t\t\t\t\t\tcolor: #fff;\n\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\tvertical-align: middle;\n\t\t\t\t\t",4,"ngIf"],[4,"ngIf"],[2,"width","100%"],[2,"vertical-align","top"],[2,"margin","0"],["href","https://en.gravatar.com","target","_blank"],[2,"text-align","right"],[1,"user-image",3,"src"],[3,"formGroup","ngSubmit"],["circle","true","name","image","formControlName","image"],["type","submit","mat-stroked-button","",3,"disabled"],[2,"margin","0 4px"],["type","button","mat-button","",3,"click"],["href","https://en.wikipedia.org/wiki/Data_portability","target","_blank"],["mat-flat-button","","color","primary",3,"click"],[1,"bg-warn",2,"margin-bottom","16px","color","#fff","display","flex","vertical-align","middle"],[2,"margin-top","-3px","margin-right","8px"],["matInput","","type","email","placeholder","Email","formControlName","email"],[1,"bg-success",2,"margin-bottom","16px","color","#fff","display","flex","vertical-align","middle"],["mode","indeterminate"],["style","width: 100%;",4,"ngFor","ngForOf"],["style","color: #f44336; font-size: 75%; margin-top: 0;",4,"ngIf"],["matInput","","type","password",3,"placeholder","formControlName"],["password",""],[2,"color","#f44336","font-size","75%","margin-top","0"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t.TgZ(1,"h1",1),t._uU(2,"User settings"),t.qZA(),t.TgZ(3,"div",2),t.TgZ(4,"div",3),t.TgZ(5,"mat-card"),t.TgZ(6,"h2"),t._uU(7,"Update email"),t.qZA(),t.YNc(8,Gt,4,1,"mat-card",4),t.YNc(9,ee,9,4,"form",5),t.YNc(10,ne,4,1,"mat-card",6),t.YNc(11,oe,3,0,"div",7),t.qZA(),t.TgZ(12,"mat-card"),t.TgZ(13,"h2"),t._uU(14,"Update password"),t.qZA(),t.YNc(15,ie,4,1,"mat-card",4),t.YNc(16,he,8,12,"form",5),t.YNc(17,xe,4,1,"mat-card",6),t.YNc(18,ve,3,0,"div",7),t.qZA(),t.qZA(),t.TgZ(19,"div",3),t.TgZ(20,"mat-card"),t.TgZ(21,"table",8),t.TgZ(22,"tr",9),t.TgZ(23,"td"),t.TgZ(24,"h2",10),t._uU(25,"Update image"),t.qZA(),t.TgZ(26,"p"),t._uU(27," Your profile picture may be provided by "),t.TgZ(28,"a",11),t._uU(29,"Gravatar"),t.qZA(),t.qZA(),t.qZA(),t.TgZ(30,"td",12),t._UZ(31,"img",13),t.qZA(),t.qZA(),t.qZA(),t.YNc(32,Ce,4,1,"mat-card",4),t.TgZ(33,"form",14),t.NdJ("ngSubmit",function(){return n.onImageFormSubmit()}),t._UZ(34,"app-image-picker",15),t.TgZ(35,"button",16),t.TgZ(36,"mat-icon"),t._uU(37,"save"),t.qZA(),t._uU(38," Save changes "),t.qZA(),t._UZ(39,"span",17),t.TgZ(40,"button",18),t.NdJ("click",function(){return n.onRemoveImage()}),t.TgZ(41,"mat-icon"),t._uU(42,"delete"),t.qZA(),t._uU(43," Remove image "),t.qZA(),t.qZA(),t.YNc(44,be,3,0,"div",7),t.qZA(),t.TgZ(45,"mat-card"),t.TgZ(46,"h2"),t._uU(47,"Export all my data"),t.qZA(),t.TgZ(48,"p"),t._uU(49," You can download all of your personal data we keep as a zip archive. You have the right to "),t.TgZ(50,"a",19),t._uU(51," data portability"),t.qZA(),t._uU(52,". "),t.qZA(),t.TgZ(53,"button",20),t.NdJ("click",function(){return n.onExportData()}),t.TgZ(54,"mat-icon"),t._uU(55,"get_app"),t.qZA(),t._uU(56," Download my data "),t.qZA(),t.qZA(),t.qZA(),t.qZA(),t.qZA()),2&e&&(t.xp6(8),t.Q6J("ngIf",n.emailFormError),t.xp6(1),t.Q6J("ngIf",!n.emailFormSuccess),t.xp6(1),t.Q6J("ngIf",n.emailFormSuccess),t.xp6(1),t.Q6J("ngIf",n.emailForm.disabled),t.xp6(4),t.Q6J("ngIf",n.passwordFormError),t.xp6(1),t.Q6J("ngIf",!n.passwordFormSuccess),t.xp6(1),t.Q6J("ngIf",n.passwordFormSuccess),t.xp6(1),t.Q6J("ngIf",n.passwordForm.disabled),t.xp6(13),t.Q6J("src",n.userImageSrc,t.LSH),t.xp6(1),t.Q6J("ngIf",n.imageFormError),t.xp6(1),t.Q6J("formGroup",n.imageForm),t.xp6(2),t.Q6J("disabled",n.imageForm.invalid||n.imageForm.disabled),t.xp6(9),t.Q6J("ngIf",n.imageForm.disabled))},directives:[F.a8,p.O5,l._Y,l.JL,l.sg,Kt.Q,l.JJ,l.u,_.lW,u.Hw,f.KE,U.Nt,l.Fj,f.TO,x.pW,p.sg],styles:["mat-card[_ngcontent-%COMP%]{margin-bottom:32px}mdc-text-field[_ngcontent-%COMP%]{width:100%}.user-image[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:50%}"]}),o})()},{path:"**",redirectTo:"/"}];let Ze=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[[p.ez,T.Bz.forChild(we),z.W,B.q,l.UX,P.Iq]]}),o})()}}]);