import{j as jS,m as me,C as Cn,I as Ii,y as ya,P as Pa,N as NC,t as to}from'./chunk-CM64Mgkv.js';import{M}from'./chunk-BPqeabYP.js';import{d}from'./chunk-BMYInCYm.js';import'./chunk-Boh6MEgd.js';import{b as ae}from'./chunk-tWBGFiFY.js';import'./chunk-CMCtTkWA.js';import'./chunk-CJ5LAhIS.js';import'./chunk-BcSizZT_.js';import'./chunk-DmY7bGyL.js';import'./chunk-DgmYhK2S.js';import'./chunk-hXR2OK-Q.js';import'./chunk-DxOctuNS.js';import'./chunk-Ddq7J0Wf.js';import'./chunk-BlVv8LBg.js';import'./chunk-DA9ZLNDO.js';import'./chunk-DHVyyAtU.js';import'./chunk-nfSA6zwi.js';import'./chunk-DF5sg2Q3.js';import'./chunk-G-N-DNp6.js';import'./chunk-BHCCT5h7.js';import{l}from'./chunk-Clnw85B_.js';import'./chunk-I7o41Fka.js';import{az as ok,d7 as ck,g as g$1,b2 as mt,aC as x,aQ as Ze,bc as k,e$ as I,f0 as _,P as Pc,$ as $t,a9 as Oe,aX as le,bs as M$1,aN as $,am as Xt,aY as S,aO as Vr,a as rc,b as Pa$1,J as Jn,Q as Qn,s as sp,e as Fp,d as lb,aM as N1,aE as L,j,f1 as Ir,f2 as nB}from'./main-DEZ5cZzu.js';import'./chunk-DxMtlMW3.js';import'./chunk-DZVj2nmI.js';var ie=(()=>{class t{route=g$1(Vr);serverService=g$1($t);notifier=g$1(rc);manageController=g$1(me);ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:i,userQuota:o,privacies:a,videoEdit:n}=e;this.manageController.setStore({videoEdit:n,userQuota:o,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("Video updated.");}onUnload(e){let{text:i,canDeactivate:o}=this.canDeactivate();if(!o)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}static ɵfac=function(i){return new(i||t)();};static ɵcmp=Pa$1({type:t,selectors:[["my-video-manage"]],hostBindings:function(i,o){i&1&&Fp("beforeunload",function(n){return o.onUnload(n);},nB);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(i,o){i&1&&(sp(0,"div",0)(1,"my-video-manage-container",1),Fp("videoUpdated",function(){return o.onVideoUpdated();}),lb()());},dependencies:[Jn,Qn,NC],encapsulation:2,changeDetection:1});}return t;})();var g=(()=>{class t{router=g$1(mt);videoService=g$1(x);liveVideoService=g$1(d);authService=g$1(Ze);videoCaptionService=g$1(k);videoChapterService=g$1(I);videoPasswordService=g$1(_);userService=g$1(Pc);serverService=g$1($t);playerSettingsService=g$1(l);videoEmbedPrivacyService=g$1(Pa);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(Oe(o=>N1(this.buildObservables(o))),Oe(Ke=>L(this,[Ke],function*([o,a,n,S,h,C,V,re,oe,y,M]){let te=yield to.createFromAPI(this.serverService.getHTMLConfig(),{video:o,captions:S,chapters:h,live:C,videoSource:a,playerSettings:y,videoPasswords:V.map(ae=>ae.password),embedPrivacy:M});return{video:o,userChannels:n,captions:S,chapters:h,videoSource:a,live:C,videoPasswords:V,userQuota:re,privacies:oe,videoEdit:te,playerSettings:y,embedPrivacy:M};})),le(o=>(j.error("Cannot fetch video information",o),this.router.navigate(["/401"],{state:{obj:o},skipLocationChange:true}),Ir(()=>o))));}buildObservables(e){return[M$1(e),this.videoService.getSource(e.id),ae({authService:this.authService,includeCollaborations:true}),this.videoCaptionService.listCaptions(e.uuid).pipe($(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe($(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):M$1(void 0),e.privacy.id===Xt.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):M$1([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:true}),this.videoEmbedPrivacyService.getPrivacy({videoId:e.uuid})];}static ɵfac=function(i){return new(i||t)();};static ɵprov=S({token:t,factory:t.ɵfac});}return t;})();var Je=[{path:"",component:ie,canActivate:[ck],canDeactivate:[ok],providers:[me,g,d,Cn,Ii,ya,M,l,Pa],resolve:{resolverData:g},children:jS}];/**i18n:c8855ca17fb20171aa9dd43d012e42547cb1f0cfd9c21d4dc05679bbbdf5ccb8*/export{Je as default};//# sourceMappingURL=chunk-yMe_NWP8.js.map