import{a as ee,b as ie,c as te,d as _,f as re,g as ae,h as ne}from"./chunk-J5PXDNSV.js";import{a as Z}from"./chunk-L5MTFLJL.js";import"./chunk-M36QCY56.js";import{a as p}from"./chunk-DH46CB3A.js";import"./chunk-3SZWNDWA.js";import"./chunk-N5CJVF7E.js";import"./chunk-OSH2TZWP.js";import"./chunk-YLNKUOVX.js";import"./chunk-WNBJBVXJ.js";import"./chunk-QZ53ZUSC.js";import"./chunk-XMEBKSG5.js";import"./chunk-EVSOOXHN.js";import"./chunk-2EAPFIQ6.js";import"./chunk-EHVKFKPD.js";import"./chunk-FTTZW43R.js";import"./chunk-FBALHOVS.js";import"./chunk-5QCCV5R6.js";import"./chunk-CAXDEGGN.js";import"./chunk-ER7EMBHV.js";import"./chunk-324ME3OV.js";import"./chunk-A4DZ32RR.js";import{a as oe}from"./chunk-N7RNFZPS.js";import"./chunk-CI4NT327.js";import{a as X}from"./chunk-2UAPJW2Y.js";import"./chunk-ZHFNFMYI.js";import"./chunk-KIQS6SC4.js";import"./chunk-AGUFAIIY.js";import{b as q,c as K}from"./chunk-HZVQRTVP.js";import"./chunk-BGGH2M52.js";import"./chunk-IK2OAM6A.js";import"./chunk-QKR6CYIM.js";import"./chunk-NDNJHD75.js";import"./chunk-RXROXYSE.js";import"./chunk-XISWHTUN.js";import"./chunk-F2RHVEY3.js";import"./chunk-ZVD6TXT7.js";import"./chunk-HA45IZBL.js";import"./chunk-COYR5OJK.js";import"./chunk-LTWNJELO.js";import"./chunk-ZOFAT6TJ.js";import"./chunk-B77GRI2G.js";import"./chunk-4I6A5WFT.js";import"./chunk-OB7E47V3.js";import"./chunk-RFEPQN7L.js";import{C as W,D as B}from"./chunk-2BCM34HS.js";import"./chunk-EOUHC4NV.js";import{$b as O,Bb as y,Cb as H,Fa as L,Fh as $,Ha as x,Hc as R,Hh as v,Lg as z,Lh as J,Q as D,Sa as T,Tc as j,Y as P,Ya as F,aa as t,ai as Y,eb as A,fh as G,ge as N,ha as b,ia as I,j as c,n as m,nb as C,ob as V,r as w,rd as k,tb as E,wh as Q}from"./chunk-PXFCSR5K.js";import{i as n,j as M}from"./chunk-DOSG2ZAB.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("\u0110\xE3 c\u1EADp nh\u1EADt video.");}onUnload(i){let{text:e,canDeactivate:r}=this.canDeactivate();if(!r)return i.returnValue=e,e;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"B\u1EA1n ch\u01B0a l\u01B0u thay \u0111\u1ED5i. B\u1EA1n c\xF3 ch\u1EAFc mu\u1ED1n tho\xE1t?"};}};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:c65a26d1e9dd8b923403d49a4dccad76e3fa3313ede414d8a3b16d3f73c99bce*///# sourceMappingURL=chunk-KXL6KQZY.js.map