import{b as Ee}from"./chunk-7P64XG2W.js";import{a as me}from"./chunk-TFYZZV4E.js";import{a as de,b as ge}from"./chunk-MK6LIWPQ.js";import{b as V,c as j}from"./chunk-TMK345NF.js";import{A as H,f as y,g as A,l as F,o as D,r as U,s as G,t as $,u as x,z as L}from"./chunk-TFL3IALR.js";import{Ab as ce,Ca as p,Da as c,Ib as h,K as ie,La as O,Oa as f,Qf as k,Sa as u,ab as o,ba as v,bb as i,bd as ue,cb as m,db as T,df as Se,eb as b,fg as w,hg as X,ib as B,jb as q,kb as s,lb as K,mb as J,nb as re,ob as R,pb as N,qb as ae,qc as _e,rb as le,rc as I,ug as z,vg as pe,zb as se}from"./chunk-CMXAM7KO.js";import{a as W,j as r}from"./chunk-OYEQFDD5.js";function Oe(_,E){if(_&1&&(o(0,"option",12),se(1),i()),_&2){let e=E.$implicit;u("value",e.id),p(),ce(e.label);}}function Re(_,E){if(_&1&&m(0,"input",13),_&2){let e=N();u("disabled",!e.form.valid);}}var C=class C extends j{constructor(e,t,n,a,S,d){super();this.formReactiveService=e;this.authService=t;this.notifier=n;this.userService=a;this.themeService=S;this.serverService=d;r(this,"user");r(this,"reactiveUpdate",!1);r(this,"notifyOnUpdate",!0);r(this,"userInformationLoaded");r(this,"availableThemes");r(this,"formValuesWatcher");r(this,"serverConfig");}get instanceName(){return this.serverConfig.instance.name;}ngOnInit(){this.serverConfig=this.serverService.getHTMLConfig(),this.availableThemes=this.themeService.buildAvailableThemes(),this.buildForm({theme:null}),this.userInformationLoaded.subscribe(()=>{this.form.patchValue({theme:this.user.theme}),this.reactiveUpdate&&(this.formValuesWatcher=this.form.valueChanges.subscribe(()=>this.updateInterfaceSettings()));});}ngOnDestroy(){var e;(e=this.formValuesWatcher)==null||e.unsubscribe();}getDefaultThemeLabel(){return this.themeService.getDefaultThemeLabel();}getDefaultInstanceThemeLabel(){let e=this.serverConfig.theme.default;return e==="default"?this.getDefaultThemeLabel():e;}updateInterfaceSettings(){let t={theme:this.form.value.theme};if(this.authService.isLoggedIn()){this.userService.updateMyProfile(t).subscribe({next:()=>{this.authService.refreshUserInformation(),this.notifyOnUpdate&&this.notifier.success("Interface settings updated.");},error:n=>this.notifier.error(n.message)});return;}this.userService.updateMyAnonymousProfile(t),this.notifyOnUpdate&&this.notifier.success("Interface settings updated.");}};r(C,"\u0275fac",function(t){return new(t||C)(c(V),c(X),c(w),c(z),c(pe),c(k));}),r(C,"\u0275cmp",v({type:C,selectors:[["my-user-interface-settings"]],inputs:{user:"user",reactiveUpdate:"reactiveUpdate",notifyOnUpdate:"notifyOnUpdate",userInformationLoaded:"userInformationLoaded"},standalone:!0,features:[O,h],decls:12,vars:6,consts:()=>{let e;e="Save interface settings";let t;t="Theme";let n;n=""+"\uFFFD0\uFFFD"+" default theme ("+"\uFFFD1\uFFFD"+")";let a;return a=""+"\uFFFD0\uFFFD"+"",[t,n,a,["role","form",3,"ngSubmit","formGroup"],[1,"form-group"],["for","theme"],[1,"peertube-select-container"],["formControlName","theme","id","theme",1,"form-control"],["value","instance-default"],["value","default"],[3,"value",4,"ngFor","ngForOf"],["type","submit","class","mt-0","value",e,3,"disabled",4,"ngIf"],[3,"value"],["type","submit","value",e,1,"mt-0",3,"disabled"]];},template:function(t,n){t&1&&(o(0,"form",3),R("ngSubmit",function(){return n.updateInterfaceSettings();}),o(1,"div",4)(2,"label",5),s(3,0),i(),o(4,"div",6)(5,"select",7)(6,"option",8),s(7,1),i(),o(8,"option",9),s(9,2),i(),f(10,Oe,2,2,"option",10),i()()(),f(11,Re,1,1,"input",11),i()),t&2&&(u("formGroup",n.form),p(7),K(n.instanceName)(n.getDefaultInstanceThemeLabel()),J(7),p(2),K(n.getDefaultThemeLabel()),J(9),p(),u("ngForOf",n.availableThemes),p(),u("ngIf",!n.reactiveUpdate));},dependencies:[L,F,$,x,G,y,A,H,D,U,_e,I],styles:['input[type=submit][_ngcontent-%COMP%]{display:block;margin-top:15px;padding:4px 13px;border:0;font-weight:600;border-radius:3px!important;text-align:center;cursor:pointer;font-size:15px;line-height:23px}input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%] + *[_ngcontent-%COMP%]{margin-inline-end:.25rem;margin-inline-start:.25rem}input[type=submit][_ngcontent-%COMP%]:focus, input[type=submit][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--mainColorLightest)}input[type=submit][_ngcontent-%COMP%], input[type=submit][_ngcontent-%COMP%]:active, input[type=submit][_ngcontent-%COMP%]:focus{color:#fff;background-color:var(--mainColor)}input[type=submit][_ngcontent-%COMP%]:hover{color:#fff;background-color:var(--mainHoverColor)}input[type=submit][disabled][_ngcontent-%COMP%], input[type=submit].disabled[_ngcontent-%COMP%]{cursor:default;color:#fff;background-color:var(--inputBorderColor)}input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .feather, input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .material, input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .misc{color:#fff}.peertube-select-container[_ngcontent-%COMP%]{padding:0;margin:0;width:340px;border-radius:3px;color:var(--inputForegroundColor);background:var(--inputBackgroundColor);position:relative;height:min-content}.peertube-select-container.disabled[_ngcontent-%COMP%]{background-color:#e5e5e5}.peertube-select-container.disabled[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{cursor:default}.peertube-select-container[_ngcontent-%COMP%]   select[disabled][_ngcontent-%COMP%]{background-color:#f9f9f9}@media screen and (max-width: 340px){.peertube-select-container[_ngcontent-%COMP%]{width:100%}}.peertube-select-container[_ngcontent-%COMP%]:after{top:50%;right:calc(0% + 15px);content:" ";height:0;width:0;position:absolute;pointer-events:none;border:5px solid rgba(0,0,0,0);border-top-color:var(--mainForegroundColor);margin-top:-2px;z-index:100}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{font-size:15px;padding:3px 35px 3px 12px;position:relative;border:1px solid var(--inputBorderColor);background:transparent none;-webkit-appearance:none;appearance:none;text-overflow:ellipsis;color:var(--mainForegroundColor);line-height:23px}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]:focus{outline:none}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]:-moz-focusring{color:transparent;text-shadow:0 0 0 #000}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]   option[_ngcontent-%COMP%]{color:#000}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]   option[value=undefined][_ngcontent-%COMP%]{font-weight:600}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]{background-color:var(--greyBackgroundColor);color:var(--greyForegroundColor)}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem #5858580d}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:hover, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:active, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus, .peertube-select-container.peertube-select-button[disabled][_ngcontent-%COMP%], .peertube-select-container.peertube-select-button.disabled[_ngcontent-%COMP%]{color:var(--greyForegroundColor);background-color:var(--greySecondaryBackgroundColor)}.peertube-select-container.peertube-select-button[disabled][_ngcontent-%COMP%], .peertube-select-container.peertube-select-button.disabled[_ngcontent-%COMP%]{cursor:default}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .feather, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .material, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .misc{color:var(--greyForegroundColor)}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{font-weight:600;color:var(--greyForegroundColor);border:0;padding:4px 35px 4px 12px}']}));var fe=C;var Ne=[[["inner-title"]]],he=["inner-title"];function Ie(_,E){_&1&&(T(0),B(1,9),m(2,"strong")(3,"strong"),q(),b());}function ye(_,E){_&1&&(T(0),s(1,10),b());}function Ae(_,E){if(_&1&&m(0,"input",31),_&2){let e=N();u("disabled",!e.form.valid);}}var P=class P extends j{constructor(e,t,n,a,S){super();this.formReactiveService=e;this.authService=t;this.notifier=n;this.userService=a;this.serverService=S;r(this,"user",null);r(this,"reactiveUpdate",!1);r(this,"notifyOnUpdate",!0);r(this,"userInformationLoaded");r(this,"defaultNSFWPolicy");r(this,"formValuesWatcher");}ngOnInit(){this.buildForm({nsfwPolicy:null,p2pEnabled:null,autoPlayVideo:null,autoPlayNextVideo:null,videoLanguages:null}),this.userInformationLoaded.pipe(ie()).subscribe(()=>{let e=this.serverService.getHTMLConfig();this.defaultNSFWPolicy=e.instance.defaultNSFWPolicy,this.form.patchValue({nsfwPolicy:this.user.nsfwPolicy||this.defaultNSFWPolicy,p2pEnabled:this.user.p2pEnabled,autoPlayVideo:this.user.autoPlayVideo===!0,autoPlayNextVideo:this.user.autoPlayNextVideo,videoLanguages:this.user.videoLanguages}),this.reactiveUpdate&&this.handleReactiveUpdate();});}ngOnDestroy(){var e;(e=this.formValuesWatcher)==null||e.unsubscribe();}updateDetails(e){let t=this.form.value.nsfwPolicy,n=this.form.value.p2pEnabled,a=this.form.value.autoPlayVideo,S=this.form.value.autoPlayNextVideo,d=this.form.value.videoLanguages;if(Array.isArray(d)&&d.length>20){this.notifier.error("Too many languages are enabled. Please enable them all or stay below 20 enabled languages.");return;}let g={nsfwPolicy:t,p2pEnabled:n,autoPlayVideo:a,autoPlayNextVideo:S,videoLanguages:d};return d&&(g=Object.assign(g,d)),e&&(g=Se(g,e)),this.authService.isLoggedIn()?this.updateLoggedProfile(g):this.updateAnonymousProfile(g);}handleReactiveUpdate(){let e=W({},this.form.value);this.formValuesWatcher=this.form.valueChanges.subscribe(t=>{let n=Object.keys(t).find(a=>t[a]!==e[a]);e=W({},this.form.value),this.updateDetails([n]);});}updateLoggedProfile(e){this.userService.updateMyProfile(e).subscribe({next:()=>{this.authService.refreshUserInformation(),this.notifyOnUpdate&&this.notifier.success("Video settings updated.","toto",15e3);},error:t=>this.notifier.error(t.message)});}updateAnonymousProfile(e){this.userService.updateMyAnonymousProfile(e),this.notifyOnUpdate&&this.notifier.success("Display/Video settings updated.");}};r(P,"\u0275fac",function(t){return new(t||P)(c(V),c(X),c(w),c(z),c(k));}),r(P,"\u0275cmp",v({type:P,selectors:[["my-user-video-settings"]],inputs:{user:"user",reactiveUpdate:"reactiveUpdate",notifyOnUpdate:"notifyOnUpdate",userInformationLoaded:"userInformationLoaded"},standalone:!0,features:[O,h],ngContentSelectors:he,decls:43,vars:4,consts:()=>{let e;e="Help share videos being played";let t;t="Automatically play videos";let n;n="Automatically start playing the next video";let a;a="Save video settings";let S;S="Default policy on videos containing sensitive content";let d;d="Policy for sensitive videos";let g;g="Hide";let Q;Q="Blur thumbnails";let Y;Y="Display";let Z;Z="Only display videos in the following languages/subtitles";let ee;ee="The "+"\uFFFD#31\uFFFD"+"sharing system"+"\uFFFD/#31\uFFFD"+" implies that some technical information about your system (such as a public IP address) can be sent to other peers, but greatly helps to reduce server load.";let te;te="When on a video page, directly start playing the video.";let ne;ne="When a video ends, follow up with the next suggested video.";let M;M=" With "+"[\uFFFD#2\uFFFD|\uFFFD#3\uFFFD]"+"Hide"+"[\uFFFD/#2\uFFFD|\uFFFD/#3\uFFFD]"+" or "+"[\uFFFD#2\uFFFD|\uFFFD#3\uFFFD]"+"Blur thumbnails"+"[\uFFFD/#2\uFFFD|\uFFFD/#3\uFFFD]"+", a confirmation will be requested to watch the video. ",M=re(M);let oe;return oe="In Recently added, Trending, Local, Most liked and Search pages",[S,d,g,Q,Y,Z,ee,te,ne,M,oe,["role","form",3,"ngSubmit","formGroup"],[1,"form-group"],["id","video-sensitive-content-policy",1,"anchor"],["for","nsfwPolicy"],["ptTemplate","customHtml"],[1,"peertube-select-container"],["id","nsfwPolicy","formControlName","nsfwPolicy",1,"form-control"],["value","undefined","disabled",""],["value","do_not_list"],["value","blur"],["value","display"],["id","video-languages-subtitles",1,"anchor"],["for","videoLanguages"],["formControlName","videoLanguages",3,"maxLanguages"],["inputName","p2pEnabled","formControlName","p2pEnabled","labelText",e,3,"recommended"],["ngProjectAs","description",5,["description"]],["routerLink","/about/peertube","fragment","privacy","target","_blank",1,"link-orange"],["inputName","autoPlayVideo","formControlName","autoPlayVideo","labelText",t],["inputName","autoPlayNextVideo","formControlName","autoPlayNextVideo","labelText",n],["type","submit","value",a,3,"disabled",4,"ngIf"],["type","submit","value",a,3,"disabled"]];},template:function(t,n){t&1&&(ae(Ne),o(0,"form",11),R("ngSubmit",function(){return n.updateDetails();}),o(1,"div",12),m(2,"div",13),o(3,"label",14),s(4,0),i(),o(5,"my-help"),f(6,Ie,4,0,"ng-template",15),i(),o(7,"div",16)(8,"select",17)(9,"option",18),s(10,1),i(),o(11,"option",19),s(12,2),i(),o(13,"option",20),s(14,3),i(),o(15,"option",21),s(16,4),i()()()(),o(17,"div",12),m(18,"div",22),o(19,"label",23),s(20,5),i(),o(21,"my-help"),f(22,ye,2,0,"ng-template",15),i(),o(23,"div"),m(24,"my-select-languages",24),i()(),le(25),o(26,"div",12)(27,"my-peertube-checkbox",25),T(28,26),o(29,"span"),B(30,6),m(31,"a",27),q(),i(),b(),i()(),o(32,"div",12)(33,"my-peertube-checkbox",28),T(34,26),o(35,"span"),s(36,7),i(),b(),i()(),o(37,"div",12)(38,"my-peertube-checkbox",29),T(39,26),o(40,"span"),s(41,8),i(),b(),i()(),f(42,Ae,1,1,"input",30),i()),t&2&&(u("formGroup",n.form),p(24),u("maxLanguages",20),p(3),u("recommended",!0),p(15),u("ngIf",!n.reactiveUpdate));},dependencies:[L,F,$,x,G,y,A,H,D,U,ge,de,Ee,me,ue,I],styles:['input[type=submit][_ngcontent-%COMP%]{margin-top:15px;padding:4px 13px;border:0;font-weight:600;border-radius:3px!important;text-align:center;cursor:pointer;font-size:15px;line-height:23px}input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%] + *[_ngcontent-%COMP%]{margin-inline-end:.25rem;margin-inline-start:.25rem}input[type=submit][_ngcontent-%COMP%]:focus, input[type=submit][_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem var(--mainColorLightest)}input[type=submit][_ngcontent-%COMP%], input[type=submit][_ngcontent-%COMP%]:active, input[type=submit][_ngcontent-%COMP%]:focus{color:#fff;background-color:var(--mainColor)}input[type=submit][_ngcontent-%COMP%]:hover{color:#fff;background-color:var(--mainHoverColor)}input[type=submit][disabled][_ngcontent-%COMP%], input[type=submit].disabled[_ngcontent-%COMP%]{cursor:default;color:#fff;background-color:var(--inputBorderColor)}input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .feather, input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .material, input[type=submit][_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .misc{color:#fff}.peertube-select-container[_ngcontent-%COMP%]{padding:0;margin:0;width:340px;border-radius:3px;color:var(--inputForegroundColor);background:var(--inputBackgroundColor);position:relative;height:min-content}.peertube-select-container.disabled[_ngcontent-%COMP%]{background-color:#e5e5e5}.peertube-select-container.disabled[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{cursor:default}.peertube-select-container[_ngcontent-%COMP%]   select[disabled][_ngcontent-%COMP%]{background-color:#f9f9f9}@media screen and (max-width: 340px){.peertube-select-container[_ngcontent-%COMP%]{width:100%}}.peertube-select-container[_ngcontent-%COMP%]:after{top:50%;right:calc(0% + 15px);content:" ";height:0;width:0;position:absolute;pointer-events:none;border:5px solid rgba(0,0,0,0);border-top-color:var(--mainForegroundColor);margin-top:-2px;z-index:100}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{font-size:15px;padding:3px 35px 3px 12px;position:relative;border:1px solid var(--inputBorderColor);background:transparent none;-webkit-appearance:none;appearance:none;text-overflow:ellipsis;color:var(--mainForegroundColor);line-height:23px}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]:focus{outline:none}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]:-moz-focusring{color:transparent;text-shadow:0 0 0 #000}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]   option[_ngcontent-%COMP%]{color:#000}.peertube-select-container[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]   option[value=undefined][_ngcontent-%COMP%]{font-weight:600}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]{background-color:var(--greyBackgroundColor);color:var(--greyForegroundColor)}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus-visible{box-shadow:0 0 0 .2rem #5858580d}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:hover, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:active, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]:focus, .peertube-select-container.peertube-select-button[disabled][_ngcontent-%COMP%], .peertube-select-container.peertube-select-button.disabled[_ngcontent-%COMP%]{color:var(--greyForegroundColor);background-color:var(--greySecondaryBackgroundColor)}.peertube-select-container.peertube-select-button[disabled][_ngcontent-%COMP%], .peertube-select-container.peertube-select-button.disabled[_ngcontent-%COMP%]{cursor:default}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .feather, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .material, .peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   my-global-icon[_ngcontent-%COMP%]     .misc{color:var(--greyForegroundColor)}.peertube-select-container.peertube-select-button[_ngcontent-%COMP%]   select[_ngcontent-%COMP%]{font-weight:600;color:var(--greyForegroundColor);border:0;padding:4px 35px 4px 12px}my-select-languages[_ngcontent-%COMP%]{display:block;width:340px}@media screen and (max-width: 340px){my-select-languages[_ngcontent-%COMP%]{width:100%}}']}));var Te=P;export{fe as a,Te as b};/**i18n:2321df1a7d0424ae0b2c3b82420e9e89fc52f7caf578a34327a0567eb5289370*/