import{a as N,b as Q,c as J,d as l,f as Y,g as q,h as K}from"./chunk-OWY3ZARR.js";import{a as G}from"./chunk-GUX73PDT.js";import"./chunk-W4RAMIOH.js";import{a as p}from"./chunk-BW2WNA6I.js";import"./chunk-VE76W7DZ.js";import"./chunk-T3R6K6CV.js";import"./chunk-NABIRIYG.js";import"./chunk-HQOODZGX.js";import"./chunk-L5ZGZZJD.js";import"./chunk-5J2KKW5N.js";import"./chunk-OIQ6DE4H.js";import"./chunk-ZDF6ONRF.js";import"./chunk-GUZVTDEQ.js";import"./chunk-JIKLIHHQ.js";import"./chunk-62Z53MV5.js";import"./chunk-ZE653MYA.js";import"./chunk-V4KYNO2P.js";import{a as v}from"./chunk-YNHA3FUH.js";import"./chunk-K3S7L2EH.js";import"./chunk-AIK3CIBO.js";import"./chunk-WZPHEMNE.js";import"./chunk-AGCCWYR2.js";import{a as $}from"./chunk-RNOSYDTB.js";import"./chunk-SEURN4CU.js";import{a as z}from"./chunk-5SUL3RBM.js";import"./chunk-4EF7DIQA.js";import"./chunk-DLKNAYIF.js";import"./chunk-HNQ65T3Z.js";import"./chunk-PJI4YDTY.js";import{b as B,c as W}from"./chunk-JDO6XDLS.js";import"./chunk-MH4MFR45.js";import"./chunk-5EJWFQRB.js";import"./chunk-DAES6XAH.js";import"./chunk-HY74C762.js";import"./chunk-WPYN5NP7.js";import"./chunk-N2PVJHKU.js";import"./chunk-N6H5PN4U.js";import"./chunk-EGENQJKI.js";import"./chunk-S3QG3QQ2.js";import"./chunk-7LEFMGY2.js";import"./chunk-3QJX743Y.js";import"./chunk-GAE2J7EH.js";import"./chunk-DBI6SHHM.js";import"./chunk-SIHEBH6V.js";import{C as E,D as F}from"./chunk-2UGJU7DR.js";import"./chunk-IM5O2N5E.js";import{Bb as S,Fa as w,Fh as R,Hh as m,Lg as O,Lh as j,Q as f,Sa as b,Tc as T,Y as P,aa as r,ai as k,fh as _,ge as H,j as c,n as u,nb as I,ob as L,r as D,rd as A,wh as x}from"./chunk-EWB56PWF.js";import{i as d,l as U}from"./chunk-2T7OYDCL.js";var X=(()=>{let o=class o{route=r(A);serverService=r(m);notifier=r(_);manageController=r(l);isUpdatingVideo=!1;loaded=!1;ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:i,userQuota:t,privacies:n,videoEdit:s}=e;this.manageController.setStore({videoEdit:s,userQuota:t,userChannels:i,privacies:n}),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:t}=this.canDeactivate();if(!t)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"You have unsaved changes. Are you sure you want to leave?"};}};d(o,"\u0275fac",function(i){return new(i||o)();}),d(o,"\u0275cmp",b({type:o,selectors:[["my-video-manage"]],hostBindings:function(i,t){i&1&&S("beforeunload",function(s){return t.onUnload(s);},!1,w);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(i,t){i&1&&(I(0,"div",0)(1,"my-video-manage-container",1),S("videoUpdated",function(){return t.onVideoUpdated();}),L()());},dependencies:[T,E,F,K],encapsulation:2}));let a=o;return a;})();var g=(()=>{let o=class o{videoService=r(W);liveVideoService=r(p);authService=r(x);videoCaptionService=r(z);videoChapterService=r($);videoPasswordService=r(B);userService=r(k);serverService=r(m);playerSettingsService=r(v);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(f(t=>D(this.buildObservables(t))),f(Ne=>U(this,[Ne],function*([t,n,s,h,C,V,y,Z,ee,M]){let ie=yield Y.createFromAPI(this.serverService.getHTMLConfig(),{video:t,captions:h,chapters:C,live:V,videoSource:n,playerSettings:M,videoPasswords:y.map(re=>re.password)});return{video:t,userChannels:s,captions:h,chapters:C,videoSource:n,live:V,videoPasswords:y,userQuota:Z,privacies:ee,videoEdit:ie,playerSettings:M};})));}buildObservables(e){return[c(e),this.videoService.getSource(e.id),O(this.authService),this.videoCaptionService.listCaptions(e.uuid).pipe(u(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(u(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):c(void 0),e.privacy.id===H.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):c([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0})];}};d(o,"\u0275fac",function(i){return new(i||o)();}),d(o,"\u0275prov",P({token:o,factory:o.ɵfac}));let a=o;return a;})();var We=[{path:"",component:X,canActivate:[j],canDeactivate:[R],providers:[l,g,p,N,Q,J,G,v],resolve:{resolverData:g},children:q}];export{We as default};/**i18n:85d030b7fdd36d163c6d41dcef9178681a6baa573eb199e8b12fe27dbb057a98*///# sourceMappingURL=chunk-IHHOX2QV.js.map