import{a as Y,b as q,c as X,d as l,f as Z,g as ee,h as ie}from"./chunk-45M6RF6M.js";import{a as J}from"./chunk-SBXIBPTG.js";import"./chunk-5LP5D33T.js";import{a as p}from"./chunk-ZQSGZ43B.js";import"./chunk-3RTRYXKQ.js";import"./chunk-BNJ52YE5.js";import"./chunk-YREPR4YG.js";import"./chunk-Z36LWPVO.js";import"./chunk-T3DFRW2X.js";import"./chunk-NZKQCUSK.js";import"./chunk-EQOKZOFU.js";import"./chunk-2LA5KN57.js";import"./chunk-HTOANEUS.js";import"./chunk-ZHTTK5CI.js";import"./chunk-P2QKOLPI.js";import"./chunk-N3QXOJH5.js";import"./chunk-VQ6PNKJY.js";import{a as v}from"./chunk-PXQEENBV.js";import"./chunk-S3QWPEZ6.js";import"./chunk-56E7HJRD.js";import"./chunk-VHWPAAG7.js";import"./chunk-B7GPCO6K.js";import"./chunk-SULKYUMG.js";import{a as K}from"./chunk-XOGNMJY7.js";import"./chunk-XCGJBSLE.js";import"./chunk-ULGYO4HA.js";import{a as $}from"./chunk-VPM5GLD7.js";import"./chunk-A4LUEHNC.js";import"./chunk-FMCQBJGP.js";import"./chunk-LKXNPRL2.js";import"./chunk-NZGA74NV.js";import{b as N,c as Q}from"./chunk-5NI77QMM.js";import"./chunk-AEY4IYSS.js";import"./chunk-YAB4XGIF.js";import"./chunk-3WAQSKYH.js";import"./chunk-SBZQHZI5.js";import"./chunk-HTQDXPBO.js";import"./chunk-QYQGFIGV.js";import"./chunk-LWCNLX24.js";import"./chunk-LYBUFCRR.js";import"./chunk-D2IXLWV3.js";import"./chunk-NUCSST5L.js";import"./chunk-ZYWXQJ5J.js";import"./chunk-PH6IGF5W.js";import"./chunk-UWSHPMXV.js";import"./chunk-GNVITTGR.js";import{C as O,D as R}from"./chunk-KXBVYXHU.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-THW6YIIG.js";import{i as s,l as w}from"./chunk-PTJGHD3V.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("Videon har uppdaterats.");}onUnload(e){let{text:i,canDeactivate:r}=this.canDeactivate();if(!r)return e.returnValue=i,i;}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"Du har osparade \xE4ndringar som f\xF6rsvinner om du l\xE4mnar sidan."};}};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:90f1dd82a779b57eddc91ef20913c88eecaa9632bba8ac04ad50f47ae2b82df7*///# sourceMappingURL=chunk-Y7XHZ7PG.js.map