import{a as Y,b as q,c as X,d as u,f as Z,g as ee,h as re}from"./chunk-74G5ZRIM.js";import{a as J}from"./chunk-3LKRKUGW.js";import"./chunk-YSBAN2DD.js";import{a as p}from"./chunk-XBI4NP5I.js";import"./chunk-V64VSAJA.js";import"./chunk-EAPNY2GD.js";import"./chunk-5NX4V4UA.js";import"./chunk-NDU4YC6K.js";import"./chunk-7QZFE2LC.js";import"./chunk-F6OP3MIC.js";import"./chunk-ASXAQHIZ.js";import"./chunk-QRDMURBQ.js";import"./chunk-QIUFPYFH.js";import"./chunk-D6SYNZK4.js";import"./chunk-QQEAIHHQ.js";import"./chunk-SUHWCX6C.js";import"./chunk-OBRJM6AH.js";import{a as v}from"./chunk-DIHDYJNP.js";import"./chunk-SXNK4P2R.js";import"./chunk-TGJYSDH6.js";import"./chunk-MKYK26YH.js";import"./chunk-CALDWOUO.js";import"./chunk-BICQJDQP.js";import{a as K}from"./chunk-3CEMPKJO.js";import"./chunk-6CFKSF6M.js";import"./chunk-H6ZPQGVK.js";import{a as $}from"./chunk-3DBNKHSQ.js";import"./chunk-SW7IGQ6L.js";import"./chunk-ONZ54AJT.js";import"./chunk-ICQDBBSV.js";import"./chunk-X6NJ2SDR.js";import{b as N,c as Q}from"./chunk-7TPOLMSO.js";import"./chunk-RFDIS7RO.js";import"./chunk-VMPGITBT.js";import"./chunk-S5OPFI5G.js";import"./chunk-6ZSPPAUO.js";import"./chunk-X7R57V6U.js";import"./chunk-V2GKRMU4.js";import"./chunk-XKHZ653L.js";import"./chunk-4GMKSIW4.js";import"./chunk-KP34JQHZ.js";import"./chunk-CHJSFALA.js";import"./chunk-KKNPEIDS.js";import"./chunk-4ARSJVAF.js";import"./chunk-K6U64Q72.js";import"./chunk-KZ26MFAT.js";import{C as O,D as R}from"./chunk-Y4WF5HJS.js";import{B as P,Cd as H,Gf as x,Gh as B,Ka as A,Ph as W,Q as g,Sh as m,Wh as z,Y as I,aa as t,fb as E,gb as T,j as c,k as D,li as G,n as f,pe as _,pf as j,qh as k,r as b,ya as L,yd as F,zb as S}from"./chunk-R4Z6ZI3L.js";import{i as s,l as U}from"./chunk-P6NJDXIL.js";var ie=(()=>{let o=class o{route=t(F);serverService=t(m);notifier=t(k);manageController=t(u);ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:r,userQuota:i,privacies:a,videoEdit:d}=e;this.manageController.setStore({videoEdit:d,userQuota:i,userChannels:r,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("\u89C6\u9891\u5DF2\u66F4\u65B0\u3002");}onUnload(e){let{text:r,canDeactivate:i}=this.canDeactivate();if(!i)return e.returnValue=r,r;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"\u60A8\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539\u3002\u786E\u5B9A\u8981\u79BB\u5F00\u5417\uFF1F"};}};s(o,"\u0275fac",function(r){return new(r||o)();}),s(o,"\u0275cmp",A({type:o,selectors:[["my-video-manage"]],hostBindings:function(r,i){r&1&&S("beforeunload",function(d){return i.onUnload(d);},L);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(r,i){r&1&&(E(0,"div",0)(1,"my-video-manage-container",1),S("videoUpdated",function(){return i.onVideoUpdated();}),T()());},dependencies:[O,R,re],encapsulation:2}));let n=o;return n;})();var h=(()=>{let o=class o{router=t(H);videoService=t(Q);liveVideoService=t(p);authService=t(B);videoCaptionService=t($);videoChapterService=t(K);videoPasswordService=t(N);userService=t(G);serverService=t(m);playerSettingsService=t(v);resolve(e){let r=e.params.uuid;return this.videoService.getVideo({videoId:r}).pipe(g(i=>b(this.buildObservables(i))),g(Ye=>U(this,[Ye],function*([i,a,d,C,V,y,M,te,oe,w]){let ne=yield Z.createFromAPI(this.serverService.getHTMLConfig(),{video:i,captions:C,chapters:V,live:y,videoSource:a,playerSettings:w,videoPasswords:M.map(l=>l.password)});return{video:i,userChannels:d.filter(l=>l.ownerAccountId===i.channel.ownerAccount.id),captions:C,chapters:V,videoSource:a,live:y,videoPasswords:M,userQuota:te,privacies:oe,videoEdit:ne,playerSettings:w};})),P(i=>(j.error("Cannot fetch video information",i),this.router.navigate(["/401"],{state:{obj:i},skipLocationChange:!0}),D(()=>i))));}buildObservables(e){return[c(e),this.videoService.getSource(e.id),x(this.authService,{includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(f(r=>r.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(f(({chapters:r})=>r)),e.isLive?this.liveVideoService.getVideoLive(e.id):c(void 0),e.privacy.id===_.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0})];}};s(o,"\u0275fac",function(r){return new(r||o)();}),s(o,"\u0275prov",I({token:o,factory:o.ɵfac}));let n=o;return n;})();var Qe=[{path:"",component:ie,canActivate:[z],canDeactivate:[W],providers:[u,h,p,Y,q,X,J,v],resolve:{resolverData:h},children:ee}];export{Qe as default};/**i18n:138e9aba5923606215625ab5641fbdc103d8a34cfe13ae910386f40f27aea675*///# sourceMappingURL=chunk-ZN3C42PN.js.map