import{W as WS,m as me,S as Sn,I as Ii,D as Da,P as Pa,a as IC,t as to}from'./chunk-Cehb0HhG.js';import{M}from'./chunk-BW-_LixX.js';import{d}from'./chunk-Dpcaoaz_.js';import'./chunk-D6Wpnize.js';import{a as ae}from'./chunk-ByCPOpgQ.js';import'./chunk-BkaflMxL.js';import'./chunk-Bms7X8vH.js';import'./chunk-BeORjHTo.js';import'./chunk-DKL7x6EW.js';import'./chunk-BCG3LzB5.js';import'./chunk-C05w3Nns.js';import'./chunk-CS1Y69iq.js';import'./chunk-CHdr4AjD.js';import'./chunk-DgsNRGqZ.js';import'./chunk-DoK4sbCH.js';import'./chunk-sjVbQlUC.js';import'./chunk-ChTAcsy3.js';import'./chunk-DKHznHxm.js';import'./chunk-UlPSRvqf.js';import'./chunk-z1LC5-Xv.js';import{l}from'./chunk-54JF0Aut.js';import'./chunk-ZCgWdH_J.js';import{az as rk,d7 as ak,g as g$1,b2 as mt,aC as x,aQ as Xe,bc as k,e$ as I,f0 as _,P as Pc,$ as $t,a9 as Oe,aX as fe,bs as L$1,aN as $,am as Zt,aY as S,aO as jr,a as rc,b as Pa$1,J as Jn,Q as Qn,s as sp,F as Fp,u as ub,aM as R1,aE as L,j,f1 as Fo,f2 as tB}from'./main-BiUBeaMj.js';import'./chunk-DWtNtBal.js';import'./chunk-F7sai10S.js';var ie=(()=>{class t{route=g$1(jr);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("Vid\xE8o actualizada.");}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);},tB);},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();}),ub()());},dependencies:[Jn,Qn,IC],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(Xe);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=>R1(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};})),fe(o=>(j.error("Cannot fetch video information",o),this.router.navigate(["/401"],{state:{obj:o},skipLocationChange:true}),Fo(()=>o))));}buildObservables(e){return[L$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):L$1(void 0),e.privacy.id===Zt.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):L$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:[ak],canDeactivate:[rk],providers:[me,g,d,Sn,Ii,Da,M,l,Pa],resolve:{resolverData:g},children:WS}];/**i18n:fad79908930cbb4c308e7550a5fe49bb3841dbb330066a6429aebaa006173605*/export{Je as default};//# sourceMappingURL=chunk-B1JYZOdE.js.map