import{a as ee,b as ie,c as te,d as _,f as re,g as ae,h as ne}from"./chunk-L5B7YK62.js";import{a as Z}from"./chunk-ZXV56MAE.js";import"./chunk-5ZMIEKBG.js";import{a as p}from"./chunk-SFGJKAZI.js";import"./chunk-MLTXSYU4.js";import"./chunk-WYS6FDUZ.js";import"./chunk-AMKDBJ6F.js";import"./chunk-HHEJXXQU.js";import"./chunk-AA45ITUH.js";import"./chunk-UOHNCV6W.js";import"./chunk-AOHGUAPI.js";import"./chunk-MSNAVIOI.js";import"./chunk-BKOY3MDH.js";import"./chunk-6SIZ7WEI.js";import"./chunk-4YSBGDK5.js";import"./chunk-NR2VR5FH.js";import"./chunk-XQ5IN4ZO.js";import"./chunk-JMWX4RXE.js";import"./chunk-UF4HW5GF.js";import"./chunk-RTRKRTP4.js";import{a as oe}from"./chunk-ME7ZZPOB.js";import"./chunk-KZ5U35N3.js";import{a as X}from"./chunk-A6J6W6PT.js";import"./chunk-QC6DFMPP.js";import"./chunk-5SU3TER7.js";import"./chunk-XVUFDEMS.js";import"./chunk-5VE2IDUJ.js";import{b as q,c as K}from"./chunk-TEWEKZE4.js";import"./chunk-GYUUHJHO.js";import"./chunk-56EHH477.js";import"./chunk-UHBBURJJ.js";import"./chunk-DLN4X5UL.js";import"./chunk-5RZNWWZS.js";import"./chunk-ZS7KQDH6.js";import"./chunk-RYQTF4WW.js";import"./chunk-6VQ6ANCO.js";import"./chunk-PFFW6WF3.js";import"./chunk-5JFAGJ5Y.js";import"./chunk-AQDUOXUN.js";import"./chunk-LHJFDW2A.js";import{B as W,C as B}from"./chunk-J3Q5GF64.js";import"./chunk-FE65AIAB.js";import{Ab as y,Af as z,Ag as J,Bb as H,Cc as R,Ea as L,Ga as x,Nc as j,Q as D,Ra as T,Rg as Y,Wb as O,Wf as G,Xa as F,Y as P,Yd as N,aa as t,db as A,ga as b,ha as I,j as c,jd as k,kg as Q,mb as C,n as m,nb as V,r as w,sb as E,ug as $,wg as v}from"./chunk-WOSO3QBJ.js";import{i as n,j as M}from"./chunk-C2HMJUB7.js";function ve(a,o){if(a&1){let se=E();C(0,"my-video-manage-container",2),y("videoUpdated",function(){b(se);let e=H();return I(e.onVideoUpdated());}),V();}}var de=(()=>{let o=class o{route=t(k);serverService=t(v);notifier=t(G);manageController=t(_);isUpdatingVideo=!1;loaded=!1;ngOnInit(){return M(this,null,function*(){let i=this.route.snapshot.data.resolverData,{video:e,userChannels:r,captions:s,chapters:d,videoSource:l,live:u,videoPasswords:f,userQuota:g,privacies:S}=i,h=yield re.createFromAPI(this.serverService.getHTMLConfig(),{video:e,captions:s,chapters:d,live:u,videoSource:l,videoPasswords:f.map(ce=>ce.password)});this.manageController.setStore({videoEdit:h,userQuota:g,userChannels:r,privacies:S}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()}),this.loaded=!0;});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("\u0648\u06CC\u062F\u0626\u0648 \u0628\u0647 \u0631\u0648\u0632 \u0634\u062F.");}onUnload(i){let{text:e,canDeactivate:r}=this.canDeactivate();if(!r)return i.returnValue=e,e;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}};n(o,"\u0275fac",function(e){return new(e||o)();}),n(o,"\u0275cmp",T({type:o,selectors:[["my-video-manage"]],hostBindings:function(e,r){e&1&&y("beforeunload",function(d){return r.onUnload(d);},!1,L);},features:[O([_])],decls:2,vars:1,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated",4,"ngIf"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(e,r){e&1&&(C(0,"div",0),F(1,ve,1,0,"my-video-manage-container",1),V()),e&2&&(x(),A("ngIf",r.loaded));},dependencies:[j,R,W,B,ne],encapsulation:2}));let a=o;return a;})();var U=(()=>{let o=class o{videoService=t(K);liveVideoService=t(p);authService=t(Q);videoCaptionService=t(X);videoChapterService=t(oe);videoPasswordService=t(q);userService=t(Y);serverService=t(v);resolve(i){let e=i.params.uuid;return this.videoService.getVideo({videoId:e}).pipe(D(r=>w(this.buildObservables(r))),m(([r,s,d,l,u,f,g,S,h])=>({video:r,userChannels:d,captions:l,chapters:u,videoSource:s,live:f,videoPasswords:g,userQuota:S,privacies:h})));}buildObservables(i){return[c(i),this.videoService.getSource(i.id),z(this.authService),this.videoCaptionService.listCaptions(i.uuid).pipe(m(e=>e.data)),this.videoChapterService.getChapters({videoId:i.uuid}).pipe(m(({chapters:e})=>e)),i.isLive?this.liveVideoService.getVideoLive(i.id):c(void 0),i.privacy.id===N.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:i.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies()];}};n(o,"\u0275fac",function(e){return new(e||o)();}),n(o,"\u0275prov",P({token:o,factory:o.ɵfac}));let a=o;return a;})();var Je=[{path:"",component:de,canActivate:[J],canDeactivate:[$],providers:[U,p,ee,ie,te,Z],resolve:{resolverData:U},children:ae}];export{Je as default};/**i18n:b44b17e72e4b9ae03afb92709eafda64a985c0c8f0453c865708cceafe42f927*///# sourceMappingURL=chunk-TKS6ZOZE.js.map