import{a as G}from"./chunk-X4FM4H2E.js";import{E as M,a as b,g as L,o as E}from"./chunk-XQH6HV66.js";import{Ec as n,Ef as D,Hb as p,Jb as h,Mc as O,Na as g,Tg as P,Y as u,ba as c,cc as S,dc as I,ec as C,ga as A,gb as T,ha as x,hb as y,kc as f,mb as r,nb as m,ob as _,ra as N,vh as w,zb as R}from"./chunk-EKZJWO2J.js";import{i as o}from"./chunk-BODC7FZN.js";var k=(()=>{let a=class a{notifier=c(P);inputId=n.required();availableItems=n([]);placeholder=n(void 0);maxIndividualItems=n(void 0);allSelectedLabel=n(void 0);selectedLabel=n(void 0);virtualScroll=n(!1,{transform:O});selectedItemsLabel;selectedItems;propagateChange=e=>{};writeValue(e){if(e){this.selectedItems=e,this.updateLabel();return;}this.selectAll();}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}ngOnChanges(){this.updateLabel();}onModelChange(){this.updateLabel(),this.isMaxItemsValid()&&this.propagateChange(this.buildOutputItems());}onPanelHide(){Array.isArray(this.selectedItems)&&this.selectedItems.length===0&&this.selectAll(),this.checkMaxItemsOrSelectAll();}isMaxItemsValid(){let e=this.maxIndividualItems();if(!e)return!0;let l=this.buildOutputItems();return l?!(l.length>=e):!0;}checkMaxItemsOrSelectAll(){this.isMaxItemsValid()||(this.notifier.error(D("Du kannst nicht mehr als {maxItems, Plural, =1 {1 Objekt} andere {{maxItems} Objekte}} ausw\xE4hlen",{maxItems:this.maxIndividualItems()})),this.selectAll());}selectAll(){this.selectedItems=this.availableItems().map(e=>e.id+""),this.updateLabel();}updateLabel(){let e=this.availableItems();this.selectedItems?.length===e?.length?this.selectedItemsLabel=this.allSelectedLabel():this.selectedItemsLabel=this.selectedLabel();}buildOutputItems(){if(Array.isArray(this.selectedItems))return this.selectedItems.length===0||this.selectedItems.length===this.availableItems().length?null:this.selectedItems;}};o(a,"\u0275fac",function(l){return new(l||a)();}),o(a,"\u0275cmp",g({type:a,selectors:[["my-select-checkbox-default-all"]],inputs:{inputId:[1,"inputId"],availableItems:[1,"availableItems"],placeholder:[1,"placeholder"],maxIndividualItems:[1,"maxIndividualItems"],allSelectedLabel:[1,"allSelectedLabel"],selectedLabel:[1,"selectedLabel"],virtualScroll:[1,"virtualScroll"]},features:[f([{provide:b,useExisting:u(()=>a),multi:!0}]),N],decls:1,vars:6,consts:[["showClear","false","showToggleAll","true",3,"ngModelChange","panelHide","ngModel","availableItems","placeholder","inputId","selectedItemsLabel","virtualScroll"]],template:function(l,t){l&1&&(m(0,"my-select-checkbox",0),C("ngModelChange",function(v){return I(t.selectedItems,v)||(t.selectedItems=v),v;}),p("ngModelChange",function(){return t.onModelChange();})("panelHide",function(){return t.onPanelHide();}),_()),l&2&&(S("ngModel",t.selectedItems),r("availableItems",t.availableItems())("placeholder",t.placeholder())("inputId",t.inputId())("selectedItemsLabel",t.selectedItemsLabel)("virtualScroll",t.virtualScroll()));},dependencies:[G,M,L,E],encapsulation:2}));let i=a;return i;})();function V(i,a){if(i&1){let s=R();m(0,"my-select-checkbox-default-all",1),C("ngModelChange",function(l){A(s);let t=h();return I(t.selectedLanguages,l)||(t.selectedLanguages=l),x(l);}),p("ngModelChange",function(){A(s);let l=h();return x(l.onModelChange());}),_();}if(i&2){let s=h();r("availableItems",s.availableLanguages),S("ngModel",s.selectedLanguages),r("inputId",s.inputId())("maxIndividualItems",s.maxLanguages());}}var ee=(()=>{let a=class a{server=c(w);inputId=n.required();maxLanguages=n(void 0);selectedLanguages;availableLanguages;ngOnInit(){this.server.getVideoLanguages().subscribe(e=>{let l=e.find(t=>t.id==="zxx");this.availableLanguages=[{label:"Unbekannte Sprache",id:"_unknown"},l,...e.filter(t=>t.id!=="zxx").map(t=>({label:t.label,id:t.id}))];});}propagateChange=e=>{};writeValue(e){this.selectedLanguages=e;}registerOnChange(e){this.propagateChange=e;}registerOnTouched(){}onModelChange(){this.propagateChange(this.selectedLanguages);}};o(a,"\u0275fac",function(l){return new(l||a)();}),o(a,"\u0275cmp",g({type:a,selectors:[["my-select-languages"]],inputs:{inputId:[1,"inputId"],maxLanguages:[1,"maxLanguages"]},features:[f([{provide:b,useExisting:u(()=>a),multi:!0}])],decls:1,vars:1,consts:()=>{let e;e="Alle Sprachen";let l;l="";let t;return t="Neue Sprache hinzuf\xFCgen",[["virtualScroll","true","virtualScrollItemSize","37","allSelectedLabel",e,"selectedLabel",l,"placeholder",t,3,"availableItems","ngModel","inputId","maxIndividualItems"],["virtualScroll","true","virtualScrollItemSize","37","allSelectedLabel",e,"selectedLabel",l,"placeholder",t,3,"ngModelChange","availableItems","ngModel","inputId","maxIndividualItems"]];},template:function(l,t){l&1&&T(0,V,1,4,"my-select-checkbox-default-all",0),l&2&&y(t.availableLanguages?0:-1);},dependencies:[k,M,L,E],encapsulation:2}));let i=a;return i;})();export{k as a,ee as b};/**i18n:e079feaac094a2c754af8c2d9f82a9400e546e6b8cdd8ff7d538e47a33fc4649*///# sourceMappingURL=chunk-VIMY7YSQ.js.map