import{a as Y,b as q,c as X,d as l,f as Z,g as ee,h as ie}from"./chunk-Q4NYC5UA.js";import{a as J}from"./chunk-AVFAJB4M.js";import"./chunk-U6YRSRTT.js";import{a as p}from"./chunk-DJAKY6QK.js";import"./chunk-R6IBOYOG.js";import"./chunk-5BPIMUJX.js";import"./chunk-ODMRQGW3.js";import"./chunk-ZIJO4HO5.js";import"./chunk-HQG36523.js";import"./chunk-YGYXAGAY.js";import"./chunk-PLEWUBWL.js";import"./chunk-OTNG4HUP.js";import"./chunk-IM4DWJIQ.js";import"./chunk-LW6EJSDY.js";import"./chunk-GLLGOTKA.js";import"./chunk-F6SBQNC2.js";import"./chunk-WLSVFQ44.js";import{a as v}from"./chunk-O2S5UZMY.js";import"./chunk-QU7DO36U.js";import"./chunk-SY45KLBX.js";import"./chunk-QMNAB5RF.js";import"./chunk-75H5WYAS.js";import"./chunk-UTEWCFAL.js";import{a as K}from"./chunk-OZXXRC5B.js";import"./chunk-PIY437ZZ.js";import"./chunk-7XEVKPRQ.js";import{a as $}from"./chunk-3DWZH7C4.js";import"./chunk-AFQOAXOF.js";import"./chunk-RWMJ5SWR.js";import"./chunk-F327JUCN.js";import"./chunk-EVTGC7G6.js";import{b as N,c as Q}from"./chunk-6MIIW7HE.js";import"./chunk-UJ3D6FHR.js";import"./chunk-74PB44RO.js";import"./chunk-2VIKQKFK.js";import"./chunk-PPCIMEI5.js";import"./chunk-LCBJQMGS.js";import"./chunk-V2PYXAJM.js";import"./chunk-7NI2GBG4.js";import"./chunk-L26R6QLO.js";import"./chunk-3BLHHGXR.js";import"./chunk-WVXLVXI4.js";import"./chunk-6LNMEHUC.js";import"./chunk-AZDDTWAU.js";import"./chunk-CFJ5N37G.js";import"./chunk-XJZQBBLJ.js";import{C as O,D as R}from"./chunk-LNGYW555.js";import{B as P,Bd as H,Ff as x,Fh as B,Ka as A,Oh as W,Q as g,Qh as m,Uh as z,Y as I,aa as t,fb as E,gb as T,j as c,ji as G,k as D,n as f,oe as _,of as j,ph as k,r as b,xd as F,ya as L,zb as S}from"./chunk-O5L4E6JZ.js";import{i as s,l as w}from"./chunk-ISBQGYOJ.js";var re=(()=>{let o=class o{route=t(F);serverService=t(m);notifier=t(k);manageController=t(l);isUpdatingVideo=!1;loaded=!1;ngOnInit(){let e=this.route.snapshot.data.resolverData,{userChannels:i,userQuota:r,privacies:a,videoEdit:d}=e;this.manageController.setStore({videoEdit:d,userQuota:r,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:"update",serverConfig:this.serverService.getHTMLConfig()});}ngOnDestroy(){this.manageController.cancelUploadIfNeeded();}onVideoUpdated(){this.notifier.success("Zaktualizowano film.");}onUnload(e){let{text:i,canDeactivate:r}=this.canDeactivate();if(!r)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"Masz niezapisane zmiany. Czy na pewno chcesz opu\u015Bci\u0107 t\u0119 stron\u0119?"};}};s(o,"\u0275fac",function(i){return new(i||o)();}),s(o,"\u0275cmp",A({type:o,selectors:[["my-video-manage"]],hostBindings:function(i,r){i&1&&S("beforeunload",function(d){return r.onUnload(d);},L);},decls:2,vars:0,consts:[[1,"margin-content"],["canUpdate","true","canWatch","true","cancelLink","/my-library/videos",3,"videoUpdated"]],template:function(i,r){i&1&&(E(0,"div",0)(1,"my-video-manage-container",1),S("videoUpdated",function(){return r.onVideoUpdated();}),T()());},dependencies:[O,R,ie],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 i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(g(r=>b(this.buildObservables(r))),g(Ye=>w(this,[Ye],function*([r,a,d,C,V,y,M,te,oe,U]){let ne=yield Z.createFromAPI(this.serverService.getHTMLConfig(),{video:r,captions:C,chapters:V,live:y,videoSource:a,playerSettings:U,videoPasswords:M.map(u=>u.password)});return{video:r,userChannels:d.filter(u=>u.ownerAccountId===r.channel.ownerAccount.id),captions:C,chapters:V,videoSource:a,live:y,videoPasswords:M,userQuota:te,privacies:oe,videoEdit:ne,playerSettings:U};})),P(r=>(j.error("Cannot fetch video information",r),this.router.navigate(["/401"],{state:{obj:r},skipLocationChange:!0}),D(()=>r))));}buildObservables(e){return[c(e),this.videoService.getSource(e.id),x(this.authService,{includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(f(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(f(({chapters:i})=>i)),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(i){return new(i||o)();}),s(o,"\u0275prov",I({token:o,factory:o.ɵfac}));let n=o;return n;})();var Qe=[{path:"",component:re,canActivate:[z],canDeactivate:[W],providers:[l,h,p,Y,q,X,J,v],resolve:{resolverData:h},children:ee}];export{Qe as default};/**i18n:4d96fbbe8a02868f1b15225bb74dfc1273beaf38b7ce36e9c53048b85eee2d05*///# sourceMappingURL=chunk-GFHKOHRE.js.map