1import{a as ht,b as Ot}from"./chunk-7MQ4SBPO.js";import{a as ue}from"./chunk-SIUVO6VG.js";import{h as vt}from"./chunk-O5IYCHZC.js";import{a as Ct}from"./chunk-O2ZJMO7B.js";import{a as ft,b as St}from"./chunk-LNZJJ3KZ.js";import{a as mt}from"./chunk-ZME7CHSV.js";import{a as pt}from"./chunk-OTKVWBE5.js";import{c as Z}from"./chunk-PG4F5PSG.js";import{b as Et}from"./chunk-FZFWY5Y6.js";import{D as et,E as K,F as tt,a as Qe,c as qe,g as j,h as je,o as Ke,r as Ye,w as Je,x as Ze}from"./chunk-EBOVR5NW.js";import{d as at}from"./chunk-UME7L37K.js";import{a as J}from"./chunk-R76LZEZS.js";import{Ab as T,Ah as ct,Bb as P,Ca as s,Cb as c,Cc as le,D as Le,Db as B,Dc as g,E as $e,Eb as X,Fb as W,Fd as Xe,Gb as h,Gh as gt,Ib as d,Kd as We,Lc as O,Ma as I,Oh as ut,Q as He,Rg as st,Uf as _e,Vc as q,Vf as rt,X as we,Xb as M,Xg as ce,Yb as $,Zb as se,aa as f,bb as xe,bc as Ue,cc as Ge,d as ae,dc as ze,eb as ke,ed as Be,fa as F,fb as u,ga as y,gb as p,ge as it,hh as lt,ib as z,j as Pe,jb as R,jc as Q,jh as dt,kb as A,kh as ge,lb as m,lc as b,mb as o,n as be,nb as r,ob as E,r as Ne,rf as ot,s as Ve,sb as S,tb as C,th as H,ve as Y,wh as _t,yb as L,ye as nt,zf as de}from"./chunk-HVCWS4IF.js";import{a as U,b as G,g as re,j as v}from"./chunk-KJ7W2O2B.js";var It=re(ce());var At=re(ce());function Pt(n,e){if(n&1){let t=L();o(0,"my-select-checkbox-default-all",1),ze("ngModelChange",function(a){F(t);let l=d();return Ge(l.selectedCategories,a)||(l.selectedCategories=a),y(a);}),h("ngModelChange",function(){F(t);let a=d();return y(a.onModelChange());}),r();}if(n&2){let t=d();m("inputId",t.inputId()),Ue("ngModel",t.selectedCategories),m("availableItems",t.availableCategories);}}var D=class D{server=f(H);inputId=g.required();selectedCategories;availableCategories;ngOnInit(){this.server.getVideoCategories().subscribe(e=>{this.availableCategories=e.map(t=>({label:t.label,id:t.id+""}));});}propagateChange=e=>{};writeValue(e){this.selectedCategories=e?e.map(t=>t+""):null;}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}onModelChange(){this.propagateChange(this.selectedCategories?this.selectedCategories.map(e=>e+""):null);}};v(D,"\u0275fac",function(t){return new(t||D)();}),v(D,"\u0275cmp",I({type:D,selectors:[["my-select-categories"]],inputs:{inputId:[1,"inputId"]},features:[Q([{provide:Qe,useExisting:we(()=>D),multi:!0}])],decls:1,vars:1,consts:()=>{let e;e="Add a new category";let t;t="All categories";let i;return i="{1} categories selected",[["placeholder",e,"allSelectedLabel",t,"selectedLabel",i,3,"inputId","ngModel","availableItems"],["placeholder",e,"allSelectedLabel",t,"selectedLabel",i,3,"ngModelChange","inputId","ngModel","availableItems"]];},template:function(t,i){t&1&&u(0,Pt,1,3,"my-select-checkbox-default-all",0),t&2&&p(i.availableCategories?0:-1);},dependencies:[ft,K,j,Ke],encapsulation:2}));var ee=D;var bt=n=>({active:n}),Nt=n=>({"opacity-0":n}),Vt=(n,e)=>e.key+(e.value||"");function Lt(n,e){if(n&1&&(o(0,"my-button",24),M(1),r()),n&2){let t=e.$implicit;m("icon",t.iconName)("ptQueryParams",t.filters)("active",t.isActive()),s(),se("",t.label," ");}}function $t(n,e){if(n&1&&(S(0),T(1,13),E(2,"strong"),P(),C()),n&2){let t=d(2);s(2),B(t.instanceName),X(1);}}function Ht(n,e){if(n&1&&(S(0),T(1,14),E(2,"strong")(3,"strong"),P(),C()),n&2){let t=d(2);s(3),B(t.instanceName)(t.totalFollowing)(t.totalFollowing),X(1);}}function wt(n,e){if(n&1&&(o(0,"div",27),u(1,$t,3,1,"ng-container")(2,Ht,4,3,"ng-container"),r()),n&2){let t=d();m("ngClass",b(2,Nt,t.totalFollowing===void 0)),s(),p(t.filters().scope==="local"||t.totalFollowing===0?1:2);}}function xt(n,e){if(n&1&&(o(0,"span"),M(1),r()),n&2){let t=d(2).$implicit;s(),se("",t.label,": ");}}function kt(n,e){if(n&1&&(o(0,"div",59),u(1,xt,2,1,"span"),o(2,"strong"),M(3),r()()),n&2){let t=d().$implicit,i=d();s(),p(t.value?1:-1),s(2),$(i.getFilterValue(t)||t.label);}}function Ut(n,e){if(n&1&&u(0,kt,4,2,"div",59),n&2){let t=e.$implicit;p(t.key!=="scope"?0:-1);}}function Gt(n,e){n&1&&(S(0),c(1,15),C());}function zt(n,e){n&1&&(S(0),c(1,16),C());}function Bt(n,e){if(n&1&&(o(0,"div",37)(1,"div",38),S(2),c(3,17),C(),o(4,"div",39)(5,"div"),T(6,18),E(7,"a",60),P(),r(),o(8,"div"),c(9,19),r()()(),o(10,"div",42)(11,"label",61),c(12,20),r(),E(13,"my-select-videos-scope",62),r()()),n&2){let t=d();s(7),B(t.instanceName)(t.totalFollowing)(t.totalFollowing),X(6);}}function Xt(n,e){n&1&&(o(0,"div",37)(1,"div",38),c(2,21),r(),o(3,"div",42),E(4,"my-peertube-checkbox",63),r()());}var Rt=(0,At.default)("peertube:videos:VideoFiltersHeaderComponent"),N=class N{auth=f(lt);serverService=f(H);fb=f(et);modalService=f(Ct);redirectService=f(_t);server=f(H);followService=f(ue);filters=g(void 0);displayModerationBlock=g(!1);hideScope=g(!1);areFiltersCollapsed=!0;form;quickFilters=[];instanceName;totalFollowing;videoCategories=[];videoLanguages=[];ngOnInit(){this.instanceName=this.server.getHTMLConfig().instance.name,this.form=this.fb.group({sort:[""],languageOneOf:[""],categoryOneOf:[""],scope:[""],allVideos:[""],live:[""]}),this.patchForm(!1),this.filters().onChange(()=>{this.patchForm(!1);}),this.form.valueChanges.subscribe(e=>{Rt("Loading values from form",{values:e}),this.filters().load(e,!0);}),this.serverService.getVideoCategories().subscribe(e=>this.videoCategories=e),this.serverService.getVideoLanguages().subscribe(e=>this.videoLanguages=e),this.followService.listSubscriptions({pagination:{count:1,start:0},state:"accepted"}).subscribe(({total:e})=>this.totalFollowing=e),this.buildQuickFilters();}canSeeAllVideos(){return!this.auth.isLoggedIn()||!this.displayModerationBlock()?!1:this.auth.getUser().hasRight(it.SEE_ALL_V
1IDEOS);}buildQuickFilters(){let e=this.redirectService.getDefaultTrendingSort();this.quickFilters=[{label:"Recently added",iconName:"add",isActive:()=>this.filters().sort==="-publishedAt",filters:{sort:"-publishedAt"}},{label:"Trending",iconName:"trending",isActive:()=>this.filters().sort===e,filters:{sort:e}}];}getFilterValue(e){if((e.key==="categoryOneOf"||e.key==="languageOneOf")&&Array.isArray(e.rawValue)){if(e.rawValue.length>2)return e.rawValue.length;let t=e.key==="categoryOneOf"?this.videoCategories:this.videoLanguages;return e.rawValue.map(a=>a==="_unknown"?"Unknown":t.find(l=>l.id+""===a)?.label).join(", ");}return e.value;}onAccountSettingsClick(e){this.auth.isLoggedIn()||(e.preventDefault(),e.stopPropagation(),this.modalService.openQuickSettingsSubject.next());}patchForm(e){let t=this.filters().toFormObject();this.form.patchValue(t,{emitEvent:e}),Rt("Patch form",{values:t});}};v(N,"\u0275fac",function(t){return new(t||N)();}),v(N,"\u0275cmp",I({type:N,selectors:[["my-video-filters-header"]],inputs:{filters:[1,"filters"],displayModerationBlock:[1,"displayModerationBlock"],hideScope:[1,"hideScope"]},features:[Q([ue])],decls:68,vars:13,consts:()=>{let e;e="Sort by:";let t;t="Content preferences";let i;i="You always use the same preferences?";let a;a="Update your "+"\uFFFD#30\uFFFD"+"default settings"+"\uFFFD/#30\uFFFD"+"";let l;l="Languages";let pe;pe="Sensitive content";let me;me=" Update your policy in "+"\uFFFD#43\uFFFD"+"your settings"+"\uFFFD/#43\uFFFD"+". ";let Ee;Ee="Content type";let fe;fe="Categories";let Se;Se="Type";let Ce;Ce="VOD & Live videos";let he;he="Live videos";let Oe;Oe="VOD videos";let ve;ve="Videos on "+"\uFFFD#2\uFFFD"+""+"\uFFFD0\uFFFD"+""+"\uFFFD/#2\uFFFD"+"";let w;w="{VAR_PLURAL, plural, =1 {other platform} other {other platforms}}",w=W(w,{VAR_PLURAL:"\uFFFD2\uFFFD"});let x;x=" Videos on "+"[\uFFFD#2\uFFFD|\uFFFD#3\uFFFD]"+""+"\uFFFD0\uFFFD"+""+"[\uFFFD/#2\uFFFD|\uFFFD/#3\uFFFD]"+" and "+"[\uFFFD#2\uFFFD|\uFFFD#3\uFFFD]"+""+"\uFFFD1\uFFFD"+""+"[\uFFFD/#2\uFFFD|\uFFFD/#3\uFFFD]"+" "+w+" ",x=W(x);let Fe;Fe="More filters";let ye;ye="Hide filters";let Re;Re="Platforms order";let k;k="{VAR_PLURAL, plural, =1 {other platform} other {other platforms}}",k=W(k,{VAR_PLURAL:"\uFFFD2\uFFFD"});let Ae;Ae=" "+"\uFFFD0\uFFFD"+" platform subscribes to content from "+"\uFFFD#7\uFFFD"+""+"\uFFFD1\uFFFD"+" "+k+""+"\uFFFD/#7\uFFFD"+". ";let Me;Me="Set your display preferences here.";let De;De="Displayed videos";let Ie;Ie="Display all videos (private, unlisted, password protected, not yet published or sensitive videos)";let Te;return Te="Moderation",[e,t,i,a,l,pe,me,Ee,fe,Se,Ce,he,Oe,ve,x,Fe,ye,Re,Ae,Me,De,Te,[1,"root",3,"formGroup"],[1,"d-flex","flex-wrap","mb-3"],["theme","secondary","ptRouterLink",".","ptQueryParamsHandling","merge",1,"me-2","mb-2",3,"icon","ptQueryParams","active"],[1,"d-flex","flex-wrap-reverse","align-items-start","justify-content-between"],[1,"gap-3"],[1,"scope-info",3,"ngClass"],[1,"filters-summary"],[1,"d-inline-block","active-filters"],["aria-controls","collapseBasic",1,"filters-toggle","peertube-button-like-link",3,"click","ngClass"],["iconName","chevrons-up"],[1,"d-flex","flex-wrap","align-items-center","mb-2"],["for","sort-videos",1,"select-label"],["inputId","sort-videos","formControlName","sort",1,"d-inline-block","me-2"],[3,"ngbCollapse","animation"],[1,"filters"],[1,"section"],[1,"section-title"],[1,"with-description"],[1,"me-1"],["routerLink","/my-account/settings","fragment","video-languages-subtitles",3,"click"],[1,"form-group"],["for","languageOneOf"],["inputId","languageOneOf","formControlName","languageOneOf",3,"maxLanguages"],["role","radiogroup",1,"form-group"],["for","nsfw"],[1,"form-group-description"],["routerLink","/my-account/settings","fragment","video-sensitive-content-policy",3,"click"],["for","categoryOneOf"],["inputId","categoryOneOf","formControlName","categoryOneOf"],["for","type"],[1,"peertube-radio-container"],["formControlName","live","type","radio","name","live","id","liveBoth","value","both"],["for","liveBoth"],["formControlName","live","type","radio","name","live","
1id","liveTrue","value","true"],["for","liveTrue"],["formControlName","live","type","radio","name","live","id","liveFalse","value","false"],["for","liveFalse"],[1,"d-inline-block","active-filter"],["routerLink","/about/follows","target","_blank"],["for","scope"],["inputId","scope","formControlName","scope",1,"scope-select"],["formControlName","allVideos","inputName","allVideos","labelText",Ie]];},template:function(t,i){t&1&&(o(0,"div",22)(1,"div",23),R(2,Lt,2,4,"my-button",24,z),r(),o(4,"div",25)(5,"div",26),u(6,wt,3,4,"div",27),o(7,"div",28)(8,"div",29),R(9,Ut,1,1,null,null,Vt),r(),o(11,"button",30),h("click",function(){return i.areFiltersCollapsed=!i.areFiltersCollapsed;}),u(12,Gt,2,0,"ng-container")(13,zt,2,0,"ng-container"),E(14,"my-global-icon",31),r()()(),o(15,"div",32)(16,"label",33),c(17,0),r(),E(18,"my-select-videos-sort",34),r()(),o(19,"div",35)(20,"div",36)(21,"div",37)(22,"div",38),S(23),c(24,1),C(),o(25,"div",39)(26,"span",40),c(27,2),r(),o(28,"span"),T(29,3),o(30,"a",41),h("click",function(l){return i.onAccountSettingsClick(l);}),r(),P(),r()()(),o(31,"div",42)(32,"label",43),c(33,4),r(),E(34,"my-select-languages",44),r(),o(35,"div",45)(36,"label",46),c(37,5),r(),o(38,"div",47)(39,"div"),M(40),r(),o(41,"div"),T(42,6),o(43,"a",48),h("click",function(l){return i.onAccountSettingsClick(l);}),r(),P(),r()()()(),u(44,Bt,14,3,"div",37),o(45,"div",37)(46,"div",38),c(47,7),r(),o(48,"div",42)(49,"label",49),c(50,8),r(),E(51,"my-select-categories",50),r(),o(52,"div",45)(53,"label",51),c(54,9),r(),o(55,"div",52),E(56,"input",53),o(57,"label",54),c(58,10),r()(),o(59,"div",52),E(60,"input",55),o(61,"label",56),c(62,11),r()(),o(63,"div",52),E(64,"input",57),o(65,"label",58),c(66,12),r()()()(),u(67,Xt,5,0,"div",37),r()()()),t&2&&(m("formGroup",i.form),s(2),A(i.quickFilters),s(4),p(i.hideScope()?-1:6),s(3),A(i.filters().getActiveFilters()),s(2),m("ngClass",b(11,bt,!i.areFiltersCollapsed)),xe("aria-expanded",!i.areFiltersCollapsed),s(),p(i.areFiltersCollapsed?12:13),s(7),m("ngbCollapse",i.areFiltersCollapsed)("animation",!0),s(15),m("maxLanguages",20),s(6),$(i.filters().getNSFWSettingsLabel()),s(4),p(i.totalFollowing&&!i.hideScope()?44:-1),s(23),p(i.canSeeAllVideos()?67:-1));},dependencies:[We,K,qe,Ye,j,je,tt,Ze,Je,q,J,at,St,ee,Et,Z,Ot,ht],styles:['@charset "UTF-8";.root[_ngcontent-%COMP%]{margin-bottom:1rem;min-height:140px}.scope-info[_ngcontent-%COMP%]{font-size:20px;color:var(--fg-350)}.select-label[_ngcontent-%COMP%]{font-weight:400;margin-bottom:0;color:var(--fg-200);font-size:1rem;margin-inline-end:.5rem}.section[_ngcontent-%COMP%]{min-width:1px;margin-inline-end:calc(1.425rem + 2.1vw)}@media(min-width:1200px){.section[_ngcontent-%COMP%]{margin-inline-end:3rem}}.section-title[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:700;color:var(--fg-300);margin-bottom:.5rem}.section-title[_ngcontent-%COMP%] .with-description[_ngcontent-%COMP%]{font-size:14px;font-weight:400}.section-title[_ngcontent-%COMP%] .with-description[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:inherit}.form-group-description[_ngcontent-%COMP%]{color:var(--fg-300)}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;background-color:var(--bg-secondary-400);border-radius:14px;--textarea-bg: var(--textarea-bg-in-secondary);--input-bg: var(--input-bg-in-secondary);--input-border-color: var(--input-bg-in-secondary);--p-multiselect-background: var(--input-bg-in-secondary);--p-select-background: var(--input-bg-in-secondary);padding:calc(1.275rem + .3vw)}@media(min-width:1200px){.filters[_ngcontent-%COMP%]{padding:1.5rem}}.filters[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%] + label[_ngcontent-%COMP%]{font-weight:400}.filters[_ngcontent-%COMP%] .form-group[_ngcontent-%COMP%]{margin-bottom:1.5rem}.filters[_ngcontent-%COMP%] .form-group[_ngcontent-%COMP%] > label[_ngcontent-%COMP%]:not(.select-label){display:block;color:var(--fg-300);font-size:18px}.active-filters[_ngcontent-%COMP%] .active-filter[_ngcontent-%COMP%]:not(:last-child):after{content:"\\2022";font-weight:400;display:inline-block;margin:0 5px}.filters-summary[_ngcontent-%COMP%]{color:var(--fg-200)}.filters-toggle[_ngcontent-%COMP%]{padding:var(--input-y-padding) .5rem calc(var(--input-y-padding) + .75rem) .75rem;margin-inline-start:.75rem}.filters-toggle[_ngcontent-%COMP%] my-global-icon[_ngcontent-%COMP%]{color:var(--secondary-icon-color);margin-inline-start:.3125rem}.filters-toggle.active[_ngcontent-%COMP%]{background-color:var(--bg-secondary-400);border-start-start-radius:14px;border-start-end-radius:14px}.filters-toggle.active[_ngcontent-%COMP%] my-global-icon[_ngcontent-%COMP%]{position:relative;top:-1px}.filters-toggle[_ngcontent-%COMP%]:not(.active) my-global-icon[_ngcontent-%COMP%] svg{transform:rotate(180deg)}.scope-select[_ngcontent-%COMP%]{min-width:250px;max-width:300px;height:min-content}my-select-videos-sort[_ngcontent-%COMP%], my-select-videos-scope[_ngcontent-%COMP%], my-select-languages[_ngcontent-%COMP%], my-select-categories[_ngcontent-%COMP%]{max-width:300px;display:inline-block}.update-your-settings[_ngcontent-%COMP%]{font-size:12px;margin-bottom:10px}.update-your-settings[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--primary);text-decoration:underline}@media screen and (max-width:800px){.scope-select[_ngcontent-%COMP%]{min-width:auto;max-width:90%}.filters-toggle[_ngcontent-%COMP%]{margin-top:.5rem;margin-inline-start:0}.filters-summary[_ngcontent-%COMP%]{display:flex;flex-direction:column}.filters[_ngcontent-%COMP%]{border-start-start-radius:0;border-start-end-radius:0}}']}));var te=N;var Mt=re(ce());var ie=(0,Mt.default)("peertube:videos:VideoFilters"),ne=class n{sort;languageOneOf;categoryOneOf;scope;allVideos;live;search;nsfwPolicy;nsfwFlagsDisplayed;nsfwFlagsHidden;nsfwFlagsWarned;nsfwFlagsBlurred;defaultValues=new Map([["sort",void 0],["languageOneOf",void 0],["categoryOneOf",void 0],["scope",void 0],["allVideos",!1],["live","both"],["search",""]]);activeFilters=[];onChangeCallbacks=[];oldFormObjectString;customizedByUser=!1;hiddenFields=[];constructor(e,t,i=[]){this.setDefaultSort(e),this.setDefaultScope(t),this.hiddenFields=i,this.reset({triggerChange:!1});}onChange(e){this.onChangeCallbacks.push(e);}triggerChange(){if(this.onChangeCallbacks.length===0)return;let e=JSON.stringify(this.toFormObject()),t=!!this.oldFormObjectString&&e===this.oldFormObjectString;if(ie("Checking if we need to trigger change",{changes:!t}),!t){this.oldFormObjectString=e;for(let i of this.onChangeCallbacks)i();}}setDefaultScope(e){this.defaultValues.set("scope",e);}setDefaultSort(e){this.defaultValues.set("sort",e);}setDefaultLanguages(e){this.defaultValues.set("languageOneOf",e);}setNSFWPolicy(e){this.nsfwPolicy=e.nsfwPolicy,this.nsfwFlagsDisplayed=e.nsfwFlagsDisplayed,this.nsfwFlagsHidden=e.nsfwFlagsHidden,this.nsfwFlagsWarned=e.nsfwFlagsWarned,this.nsfwFlagsBlurred=e.nsfwFlagsBlurred;}reset(e){let{specificKey:t,triggerChange:i=!0}=e;ie("Reset video filters",{specificKey:t});for(let[a,l]of this.defaultValues)t&&t!==a||(this[a]=l);this.buildActiveFilters(),i&&this.triggerChange();}load(e,t){ie("Loading object in video filters",{obj:e,customizedByUser:t}),this.reset({triggerChange:!1}),t&&(this.customizedByUser=t),e.sort!==void 0&&(this.sort=e.sort),e.languageOneOf!==void 0&&(this.languageOneOf=_e(e.languageOneOf)),e.categoryOneOf!==void 0&&(this.categoryOneOf=_e(e.categoryOneOf)),e.scope!==void 0&&(this.scope=e.scope),e.allVideos!==void 0&&(this.allVideos=rt(e.allVideos)),e.live!==void 0&&(this.live=e.live),e.search!==void 0&&(this.search=e.search),this.buildActiveFilters(),this.triggerChange();}clone(){ie("Cloning video filters",{videoFilters:this});let e=new n(this.defaultValues.get("sort"),this.defaultValues.get("scope"),this.hiddenFields);return e.setDefaultLanguages(this.defaultValues.get("languageOneOf")),e.setNSFWPolicy({nsfwPolicy:this.nsfwPolicy,nsfwFlagsDisplayed:this.nsfwFlagsDisplayed,nsfwFlagsHidden:this.nsfwFlagsHidden,nsfwFlagsWarned:this.nsfwFlagsWarned,nsfwFlagsBlurred:this.nsfwFlagsBlurred}),e.load(this.toUrlObject(),this.customizedByUser),e;}hasBeenCustomizedByUser(){return this.customizedByUser;}buildActiveFilters(){this.activeFilters=[],this.activeFilters.push({key:"nsfw",canRemove:!1,label:"Sensitive content",value:this.getNSFWValue()}),this.activeFilters.push({key:"scope",canRemove:!1,label:"Scope",value:this.scope==="federated"?"All platforms":"This platform"}),this.languageOneOf&&this.languageOneOf.length!==0&&this.activeFilters.push({key:"languageOneOf",canRemove:!0,label:"Languages",value:this.languageOneOf.map(e=>e.toUpperCase()).join(", "),rawValue:this.languageOneOf}),this.categoryOneOf&&this.categoryOneOf.length!==0&&this.activeFilters.push({key:"categoryOneOf",canRemove:!0,label:"Categories",value:this.categoryOneOf.join(", "),rawValue:this.categoryOneOf}),this.allVideos&&this.activeFilters.push({key:"allVideos",canRemove:!0,label:"All videos"}),this.live==="true"?this.activeFilters.push({key:"live",canRemove:!0,label:"Only lives"}):this.live==="false"&&this.activeFilters.push({key:"live",canRemove:!0,label:"Only VOD"}),this.activeFilters=this.activeFilters.filter(e=>
1this.hiddenFields.includes(e.key)===!1);}getActiveFilters(){return this.activeFilters;}toFormObject(){let e={};for(let[t]of this.defaultValues)e[t]=this[t];return e;}toUrlObject(){let e={};for(let[t,i]of this.defaultValues)this[t]!==i&&(e[t]=this[t]);return e;}toVideosAPIObject(){let e,t,i;this.scope==="local"&&(e=!0),this.allVideos&&(t=nt.NOT_PUBLISHED_STATE,i=ot());let a;return this.live==="true"?a=!0:this.live==="false"&&(a=!1),G(U({},this.buildNSFWVideosAPIObject()),{sort:this.sort,languageOneOf:this.languageOneOf,categoryOneOf:this.categoryOneOf,search:this.search,isLocal:e,include:t,privacyOneOf:i,isLive:a});}buildNSFWVideosAPIObject(){if(this.allVideos)return{nsfw:"both",nsfwFlagsExcluded:Y.NONE};let e=this.nsfwPolicy==="do_not_list"?"false":"both",t=Y.NONE,i=Y.NONE;return this.nsfwPolicy==="do_not_list"?(t|=this.nsfwFlagsDisplayed,t|=this.nsfwFlagsWarned,t|=this.nsfwFlagsBlurred):i|=this.nsfwFlagsHidden,{nsfw:e,nsfwFlagsIncluded:t,nsfwFlagsExcluded:i};}getNSFWSettingsLabel(){let e=this.getGlobalNSFWLabel();return this.hasCustomNSFWFlags()&&(e+=" Some videos with a specific sensitive content category have a different policy."),e;}getGlobalNSFWLabel(){return this.nsfwPolicy==="do_not_list"?"Sensitive content hidden.":this.nsfwPolicy==="warn"?"Sensitive content has a warning.":this.nsfwPolicy==="blur"?"Sensitive content has a warning and the thumbnail is blurred.":"Sensitive content is displayed.";}getNSFWValue(){return this.hasCustomNSFWFlags()?this.nsfwPolicy==="do_not_list"?"hidden (with exceptions)":this.nsfwPolicy==="warn"?"warned (with exceptions)":this.nsfwPolicy==="blur"?"blurred (with exceptions)":"displayed (with exceptions)":this.nsfwPolicy==="do_not_list"?"hidden":this.nsfwPolicy==="warn"?"warned":this.nsfwPolicy==="blur"?"blurred":"displayed";}hasCustomNSFWFlags(){return this.nsfwFlagsDisplayed||this.nsfwFlagsHidden||this.nsfwFlagsWarned||this.nsfwFlagsBlurred;}};var Wt=n=>({"display-as-row":n}),Qt=n=>({"visually-hidden":n});function qt(n,e){if(n&1&&(o(0,"my-button",11),M(1),r()),n&2){let t=d().$implicit;m("ptRouterLink",t.routerLink)("icon",t.iconName),s(),$(t.label);}}function jt(n,e){if(n&1&&u(0,qt,2,3,"my-button",11),n&2){let t=e.$implicit;p(t.routerLink?0:-1);}}function Kt(n,e){if(n&1&&(o(0,"div",6),R(1,jt,1,1,null,null,z),r()),n&2){let t=d();s(),A(t.headerActions());}}function Yt(n,e){if(n&1&&E(0,"my-video-filters-header",7),n&2){let t=d();m("displayModerationBlock",t.displayModerationBlock)("hideScope",t.hideScopeFilter())("filters",t.filters);}}function Jt(n,e){n&1&&(o(0,"div",8),c(1,0),r());}function Zt(n,e){if(n&1){let t=L();o(0,"div",14)(1,"my-video-miniature",16),h("videoBlocked",function(){let a=F(t).$implicit,l=d(2);return y(l.removeVideoFromArray(a));})("videoRemoved",function(){let a=F(t).$implicit,l=d(2);return y(l.removeVideoFromArray(a));}),r()();}if(n&2){let t=e.$implicit,i=d(2);s(),m("video",t)("user",i.user)("displayAsRow",i.displayAsRow())("displayVideoActions",i.displayVideoActions())("displayOptions",i.displayOptions);}}function ei(n,e){if(n&1&&(o(0,"h2",15),E(1,"my-global-icon",17),S(2),c(3,2),C(),r()),n&2){let t=d(2);m("ngClass",b(1,Qt,t.groupByDate()));}}function ti(n,e){if(n&1&&(o(0,"h2",12),E(1,"my-global-icon",13),S(2),c(3,1),C(),r(),R(4,Zt,2,5,"div",14,ke().videoById,!0),u(6,ei,4,3,"h2",15)),n&2){let t=d();s(4),A(t.highlightedLives),s(2),p(t.videos.length!==0?6:-1);}}function ii(n,e){if(n&1&&E(0,"my-date-group-label",18),n&2){let t=d().$implicit,i=d();m("date",t.publishedAt)("store",i.groupByDateStore)("groupedDateLabels",i.groupedDateLabels);}}function ni(n,e){if(n&1){let t=L();u(0,ii,1,3,"my-date-group-label",18),o(1,"div",14)(2,"my-video-miniature",16),h("videoBlocked",function(){let a=F(t).$implicit,l=d();return y(l.removeVideoFromArray(a));})("videoRemoved",function(){let a=F(t).$implicit,l=d();return y(l.removeVideoFromArray(a));}),r()();}if(n&2){let t=e.$implicit,i=d();p(i.groupByDate()?0:-1),s(2),m("video",t)("user",i.user)("displayAsRow",i.displayAsRow())("displayVideoActions",i.displayVideoActions())("displayOptions",i.displayOptions);}}function oi(n,e){if(n&1&&(o(0,"my-button",10),c(1,3),r()),n&2){let t=d();m("ptQueryParams",t.getNextPageQueryParams());}}var oe=(0,It.default)("peertube:videos:VideosListComponent"),V=class V{notifier=f(st);userService=f(ut);route=f(Xe);
1screenService=f(gt);peertubeRouter=f(ct);getVideosObservableFunction=g(void 0);getSyndicationItemsFunction=g(void 0);defaultSort=g(void 0);defaultScope=g("federated");displayFilters=g(!1,{transform:O});displayBy=g(!0,{transform:O});hideScopeFilter=g(!1,{transform:O});loadUserVideoPreferences=g(!1,{transform:O});displayAsRow=g(!1,{transform:O});displayVideoActions=g(!0,{transform:O});groupByDate=g(!1,{transform:O});highlightLives=g(!1,{transform:O});headerActions=g([]);disabled=g(!1,{transform:O});filtersChanged=le();videosLoaded=le();videos=[];highlightedLives=[];filters;syndicationItems;onVideosDataSubject=new ae();hasDoneFirstQuery=!1;user;displayOptions={date:!0,views:!0,by:!0,avatar:!0,privacyLabel:!0};displayModerationBlock=!0;groupByDateStore=new Set();groupedDateLabels={1:"Today's videos",2:"Yesterday's videos",3:"This week's videos",4:"This month's videos",5:"Last month's videos",6:"Older videos"};routeSub;userSub;resizeSub;pagination={currentPage:1,itemsPerPage:25,totalItems:null};lastQueryLength;videoRequests=new ae();alreadyDoneSearch=!1;ngOnInit(){this.displayOptions.by=this.displayBy(),this.displayOptions.avatar=this.displayBy(),this.subscribeToVideoRequests();let e=this.hideScopeFilter()?["scope"]:[];this.filters=new ne(this.defaultSort(),this.defaultScope(),e),this.resizeSub=Ve(window,"resize").pipe($e(500)).subscribe(()=>this.calcPageSizes()),this.calcPageSizes(),this.userService.getAnonymousOrLoggedUser().subscribe(t=>{this.user=t,this.loadUserVideoPreferences()&&this.loadUserSettings(t),this.subscribeToAnonymousUpdate(),this.subscribeToQueryParamsChange(),this.filters.load(this.route.snapshot.queryParams),this.filters.onChange(()=>{oe("Filters changed",this.filters),this.videos=[],this.highlightedLives=[],this.updateUrl(),this.reloadSyndicationItems(),this.reloadVideos(),this.filtersChanged.emit(this.filters);}),this.handlePagination(),this.reloadSyndicationItems(),this.loadMoreVideos({reset:!0});});}ngOnDestroy(){this.resizeSub&&this.resizeSub.unsubscribe(),this.routeSub&&this.routeSub.unsubscribe(),this.userSub&&this.userSub.unsubscribe();}videoById(e,t){return t.id;}onNearOfBottom(){this.disabled()||(window.location.pathname==="/"&&this.peertubeRouter.silentNavigate([],this.route.snapshot.queryParams),this.hasMoreResults()&&(this.pagination.currentPage+=1,this.loadMoreVideos()));}hasMoreResults(){return!(this.lastQueryLength!==void 0&&this.lastQueryLength<this.pagination.itemsPerPage);}loadMoreVideos(e={}){let{reset:t=!1}=e,i,a;t&&(this.hasDoneFirstQuery=!1,this.videos=[],this.highlightedLives=[],this.groupByDateStore.clear(),this.highlightLives()&&(!this.filters.live||this.filters.live==="both")&&(i=this.filters.clone(),i.live="true",a=this.filters.clone(),a.live="false")),this.videoRequests.next({reset:t,obsVideos:this.getVideosObservableFunction()(this.pagination,a??this.filters),obsHighlightedLives:i?this.getVideosObservableFunction()(this.pagination,i):Pe({data:this.highlightedLives})});}reloadVideos(){ge(this.pagination),this.loadMoreVideos({reset:!0});}removeVideoFromArray(e){this.videos.some(t=>t.id===e.id)&&(this.videos=this.videos.filter(t=>t.id!==e.id),dt(this.pagination)),this.highlightedLives=this.highlightedLives.filter(t=>t.id!==e.id);}getNextPageQueryParams(){return G(U({},this.route.snapshot.queryParams),{page:this.pagination.currentPage+1+""});}calcPageSizes(){this.screenService.isInMobileView()&&(this.pagination.itemsPerPage=5);}loadUserSettings(e){this.filters.setNSFWPolicy(e),this.filters.setDefaultLanguages(e.videoLanguages);}reloadSyndicationItems(){Promise.resolve(this.getSyndicationItemsFunction()(this.filters)).then(e=>{!e||e.length===0?this.syndicationItems=void 0:this.syndicationItems=e;}).catch(e=>de.error("Cannot get syndication items.",e));}updateUrl(){let e=this.filters.toUrlObject();oe("Will inject URL query",{queryParams:e}),(Object.keys(e).length!==0||this.filters.hasBeenCustomizedByUser())&&this.peertubeRouter.silentNavigate([],e);}subscribeToAnonymousUpdate(){this.userSub=this.userService.listenAnonymousUpdate().pipe(He(()=>this.userService.getAnonymousOrLoggedUser())).subscribe(e=>{oe("User changed",{user:e}),this.user=e,this.loadUserVideoPreferences()&&this.loadUserSettings(e),this.hasDoneFirstQuery&&this.reloadVideos();});}subscribeToQueryParamsChange(){this.routeSub=this.route.queryParams.subscribe(e=>{if(Object.keys(e).length===0&&!this.filters.hasBeenCustomizedByUser())return;let t=e.search;t?this.alreadyDoneSearch=!0:this.alreadyDoneSearch&&(t=""),oe("Query params changed",e),this.filters.load(e);});}subscribeToVideoRequests(){this.videoRequests.pipe(Le(({reset:e,obsHighlightedLives:t,obsVideos:i})=>Ne([t,i]).pipe(be(([a,l])=>({highlightedLives:a.data,videos:l.data,reset:e}))))).subscribe({next:({videos:e,highlightedLives:t,reset:i})=>{this.hasDoneFirstQuery=!0,this.lastQueryLength=e.length,i&&(this.videos=[],this.highlightedLives=t),this.videos=this.videos.concat(e),this.onVideosDataSubject.next(e),this.videosLoaded.emit(this.videos);},error:e=>{let t="Cannot load more videos. Please try again later.";de.error(t,e),this.notifier.error(t);}});}
1handlePagination(){let e=this.route.snapshot.queryParams.page;this.pagination.currentPage=e?+e:1,this.route.queryParams.subscribe(t=>{let i=t.page;!i||+i===this.pagination.currentPage||(ge(this.pagination),this.pagination.currentPage=+i,this.loadMoreVideos({reset:!0}));});}};v(V,"\u0275fac",function(t){return new(t||V)();}),v(V,"\u0275cmp",I({type:V,selectors:[["my-videos-list"]],inputs:{getVideosObservableFunction:[1,"getVideosObservableFunction"],getSyndicationItemsFunction:[1,"getSyndicationItemsFunction"],defaultSort:[1,"defaultSort"],defaultScope:[1,"defaultScope"],displayFilters:[1,"displayFilters"],displayBy:[1,"displayBy"],hideScopeFilter:[1,"hideScopeFilter"],loadUserVideoPreferences:[1,"loadUserVideoPreferences"],displayAsRow:[1,"displayAsRow"],displayVideoActions:[1,"displayVideoActions"],groupByDate:[1,"groupByDate"],highlightLives:[1,"highlightLives"],headerActions:[1,"headerActions"],disabled:[1,"disabled"]},outputs:{filtersChanged:"filtersChanged",videosLoaded:"videosLoaded"},decls:10,vars:9,consts:()=>{let e;e="No results.";let t;t="Lives";let i;i="Videos";let a;return a="Load more",[e,t,i,a,[1,"margin-content"],[1,"videos-header"],[1,"action-block","mb-4"],[1,"d-block",3,"displayModerationBlock","hideScope","filters"],[1,"no-results"],["myInfiniteScroller","",1,"videos",3,"nearOfBottom","dataObservable","ngClass"],["theme","secondary","ptRouterLink",".",3,"ptQueryParams"],["theme","secondary",3,"ptRouterLink","icon"],[1,"videos-section-title"],["iconName","live",1,"pt-icon","me-1","top--1px"],[1,"video-wrapper"],[1,"videos-section-title",3,"ngClass"],[3,"videoBlocked","videoRemoved","video","user","displayAsRow","displayVideoActions","displayOptions"],["iconName","videos",1,"pt-icon","me-1"],[3,"date","store","groupedDateLabels"]];},template:function(t,i){t&1&&(o(0,"div",4)(1,"div",5),u(2,Kt,3,0,"div",6),r(),u(3,Yt,1,3,"my-video-filters-header",7),u(4,Jt,2,0,"div",8),o(5,"div",9),h("nearOfBottom",function(){return i.onNearOfBottom();}),u(6,ti,7,1),R(7,ni,3,6,null,null,i.videoById,!0),u(9,oi,2,1,"my-button",10),r()()),t&2&&(s(2),p(i.headerActions().length!==0?2:-1),s(),p(i.displayFilters()?3:-1),s(),p(i.hasDoneFirstQuery&&i.videos.length===0&&i.highlightedLives.length===0?4:-1),s(),m("dataObservable",i.onVideosDataSubject.asObservable())("ngClass",b(7,Wt,i.displayAsRow())),s(),p(i.highlightedLives.length!==0?6:-1),s(),A(i.videos),s(2),p(i.videos.length!==0&&i.hasMoreResults()?9:-1));},dependencies:[Be,q,Z,te,pt,vt,J,mt],styles:[".videos[_ngcontent-%COMP%]{min-height:50vh}.videos-header[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto 1fr auto}.videos-header[_ngcontent-%COMP%] .action-block[_ngcontent-%COMP%]{grid-column:3;grid-row:1/3}my-date-group-label[_ngcontent-%COMP%]:not(.date-displayed){display:none}my-date-group-label.date-displayed[_ngcontent-%COMP%], .videos-section-title[_ngcontent-%COMP%]{font-weight:600;margin-bottom:20px;font-size:1rem;grid-column:1/-1}my-date-group-label.date-displayed[_ngcontent-%COMP%]:not(:first-child), .videos-section-title[_ngcontent-%COMP%]:not(:first-child){margin-top:.5rem;padding-top:20px;border-top:1px solid var(--bg-secondary-400)}.margin-content[_ngcontent-%COMP%]{--grid-videos-miniature-margins: var(--x-margin-content);margin-inline-start:var(--grid-videos-miniature-margins)!important;margin-inline-end:var(--grid-videos-miniature-margins)!important}@media screen and (max-width:500px){.margin-content[_ngcontent-%COMP%]{--grid-videos-miniature-margins: 0;width:auto}}@media screen and (min-width:500px){.margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%]{--co-miniature-min-width: 255px;--co-miniature-max-width: 280px;display:grid;column-gap:30px;grid-template-columns:repeat(auto-fill,minmax(var(--co-miniature-min-width),1fr))}.margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%]{margin:0 auto;width:100%}.margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%] my-video-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%] my-video-playlist-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%] my-video-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%] my-video-playlist-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%] my-video-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%] my-video-playlist-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%] my-video-miniature[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%] .playlist-wrapper[_ngcontent-%COMP%] my-video-playlist-miniature[_ngcontent-%COMP%]{display:block;min-width:var(--co-miniature-min-width);max-width:var(--co-miniature-max-width)}}@media screen and (min-width:500px)and (min-width:1800px){.margin-content[_ngcontent-%COMP%] .videos[_ngcontent-%COMP%], .margin-content[_ngcontent-%COMP%] .playlists[_ngcontent-%COMP%]{column-gap:2
1%}}.display-as-row.videos[_ngcontent-%COMP%]{margin-inline-start:var(--x-margin-content);margin-inline-end:var(--x-margin-content)}.display-as-row.videos[_ngcontent-%COMP%] .video-wrapper[_ngcontent-%COMP%]{margin-bottom:1rem}@media screen and (max-width:500px){my-video-filters-header[_ngcontent-%COMP%]{display:inline-block;margin-inline-start:1rem;margin-inline-end:1rem}my-date-group-label.date-displayed[_ngcontent-%COMP%]{text-align:center;display:block}.videos-header[_ngcontent-%COMP%]{text-align:center;width:100%;margin-bottom:1rem;display:block}}"]}));var Dt=V;export{Dt as a};/**i18n:347eeb695970c32bc275618edc2e751c67145d9fc3012e70543c114a99b9e016*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.