import{o as F}from"./chunk-C6uGsfWa.js";import{D as CF,Do as kg,Eo as kb,Fa as eo,Gr as Va,Hr as V,Is as rh,Ln as Or,Oi as Zt,Wa as g,cs as on,ei as WH,er as Qc,fr as S,gt as G,nt as Et,pn as Mg,ro as he,rs as nt,sn as M,ta as bi,vc as wp,y as Be}from"./chunk-B_pj7Jpm.js";import"./chunk-CgIzqGPc.js";import"./chunk-qQMrTuzm.js";import{r as b,t as H}from"./chunk-CagJEiiY.js";import{t as n}from"./chunk-DghzBX6c.js";import{t as O}from"./chunk-CX0pAEF-.js";import"./chunk-CdfINgvq.js";import{s as Jn,u as Qn}from"./chunk-BPHMC4rz.js";import"./chunk-COgN00_S.js";import"./chunk-DULXsDZq.js";import"./chunk-CEibY8iL.js";import"./chunk-BkYXs1tH.js";import"./chunk-CEOUYBvT.js";import"./chunk-BmH4cOwr.js";import"./chunk-CR0lnyBO.js";import"./chunk-1IezKpCQ.js";import"./chunk-CEewNwum.js";import"./chunk-D7eF6KoS2.js";import"./chunk-r0Xv-ufY2.js";import"./chunk-CQiHXmZG2.js";import"./chunk-sRRTHa8X2.js";import"./chunk-cztdWiEo2.js";import"./chunk-BHPWLTEh2.js";import"./chunk-DQ-dV2Zg2.js";import"./chunk-TcpfKQW12.js";import"./chunk-Dw_PgttJ2.js";import"./chunk-BD06qecY2.js";import{t as L}from"./chunk-ZL035zBp2.js";import"./chunk-DU192T682.js";import"./chunk-Dg5vKWKM2.js";import{f as ae}from"./chunk-CJlLEstA2.js";import"./chunk-AyVtDcTK.js";import"./chunk-CHiPV57o.js";import"./chunk-DVjyCVai.js";import"./chunk-mhEVtCsW.js";import"./chunk-YumTPOJn.js";import"./chunk-FhARnEsq.js";import{t as R}from"./chunk-7OmbJtav.js";import"./chunk-Blx4GYci.js";import"./chunk-CmVGojCQ.js";import"./chunk-C37TSMgw.js";import"./chunk-BtRj7p5_.js";import"./chunk-3knu2Usr.js";import{t as S$1}from"./chunk-0S7iE8qE2.js";import"./chunk-BIZnpkkM2.js";import{a as Pi,c as pA,l as qt,n as An,o as Ws,r as Di,s as oe,t as $n}from"./chunk-DTGjSwDe2.js";var u=class r{route=g(eo);serverService=g(Zt);notifier=g(bi);manageController=g(oe);ngOnInit(){let{userChannels:i,userQuota:t,privacies:a,videoEdit:n}=this.route.snapshot.data.resolverData;this.manageController.setStore({videoEdit:n,userQuota:t,userChannels:i,privacies:a}),this.manageController.setConfig({manageType:`update`,serverConfig:this.serverService.getHTMLConfig()})}ngOnDestroy(){this.manageController.cancelUploadIfNeeded()}onVideoUpdated(){this.notifier.success("動画を更新しました。")}onUnload(e){let{text:i,canDeactivate:t}=this.canDeactivate();if(!t)return e.returnValue=i,i}canDeactivate(){return{canDeactivate:!this.manageController.hasPendingChanges(),text:"保存されていない変更が存在します。移動してもよろしいですか？"}}static ɵfac=function(i){return new(i||r)};static ɵcmp=Va({type:r,selectors:[[`my-video-manage`]],hostBindings:function(i,t){i&1&&rh(`beforeunload`,function(n){return t.onUnload(n)},WH)},decls:2,vars:0,consts:[[1,`margin-content`],[`canUpdate`,`true`,`canWatch`,`true`,`cancelLink`,`/my-library/videos`,3,`videoUpdated`]],template:function(i,t){i&1&&(wp(0,`div`,0)(1,`my-video-manage-container`,1),rh(`videoUpdated`,function(){return t.onVideoUpdated()}),kb()())},dependencies:[Jn,Qn,Ws],encapsulation:2,changeDetection:1})};var s=class r{router=g(Et);videoService=g(H);liveVideoService=g(L);authService=g(nt);videoCaptionService=g(O);videoChapterService=g(n);videoPasswordService=g(b);userService=g(Qc);serverService=g(Zt);playerSettingsService=g(S$1);videoEmbedPrivacyService=g(Pi);resolve(e){let i=e.params.uuid;return this.videoService.getVideo({videoId:i}).pipe(Be(t=>CF(this.buildObservables(t))),Be(mi=>F(this,[mi],function*([t,a,n,V,h,C,y,oe,te,D,P]){return{video:t,userChannels:n,captions:V,chapters:h,videoSource:a,live:C,videoPasswords:y,userQuota:oe,privacies:te,videoEdit:yield $n.createFromAPI(this.serverService.getHTMLConfig(),{video:t,captions:V,chapters:h,live:C,videoSource:a,playerSettings:D,videoPasswords:y.map(ae=>ae.password),embedPrivacy:P}),playerSettings:D,embedPrivacy:P}})),he(t=>(V.error(`Cannot fetch video information`,t),this.router.navigate([`/401`],{state:{obj:t},skipLocationChange:!0}),Or(()=>t))))}buildObservables(e){return[M(e),this.videoService.getSource(e.id),ae({authService:this.authService,includeCollaborations:!0}),this.videoCaptionService.listCaptions(e.uuid).pipe(G(i=>i.data)),this.videoChapterService.getChapters({videoId:e.uuid}).pipe(G(({chapters:i})=>i)),e.isLive?this.liveVideoService.getVideoLive(e.id):M(void 0),e.privacy.id===on.PASSWORD_PROTECTED?this.videoPasswordService.getVideoPasswords({videoUUID:e.uuid}):M([]),this.userService.getMyVideoQuotaUsed(),this.serverService.getVideoPrivacies(),this.playerSettingsService.getVideoSettings({videoId:e.uuid,raw:!0}),this.videoEmbedPrivacyService.getPrivacy({videoId:e.uuid})]}static ɵfac=function(i){return new(i||r)};static ɵprov=S({token:r,factory:r.ɵfac})};var ci=[{path:``,component:u,canActivate:[kg],canDeactivate:[Mg],providers:[oe,s,L,qt,An,Di,R,S$1,Pi],resolve:{resolverData:s},children:pA}];export{ci as default};
//# debugId=9bd6d92b-2c5a-55eb-86e4-439308cb7ddd
//# sourceMappingURL=chunk-Cj2_pZZC2.js.map