import{O as V}from"./chunk-3NJAM5KX.js";import{d as A,e as D}from"./chunk-IEJVBN5K.js";import{E as T,a as B,h as N,o as I}from"./chunk-MDIMQ3H3.js";import{q as $}from"./chunk-TKVDP62Z.js";import{Ad as M,Bc as y,F as p,Fa as u,Ib as b,Jb as f,Kb as C,Kc as O,Lc as _,N as s,R as d,Xb as v,Yc as o,ba as c,d as r,eb as g,ib as h,ma as m,td as S,u as l}from"./chunk-GJDGQISV.js";var w=class i{constructor(e){this.httpService=e}placeholder=o("Choose Brand");multiple=o(!1);clearable=o(!0);value=u(null);onChange=e=>{};onTouched=()=>{};brandInput$=new r;brands$;ngOnInit(){this.brands$=this.brandInput$.pipe(l(e=>e??""),p(e=>e===""||e.length>=3),d(),s(500),c(e=>this.httpService.post(V.SearchBrand,{prefix:e,count:20})))}onOpen(){this.brandInput$.next("")}writeValue(e){this.value.set(e),e!=null&&e!==""&&!(Array.isArray(e)&&e.length===0)&&this.brandInput$.next("")}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onModelChange(e){this.value.set(e),this.onChange(e)}onSelectChange(){this.onChange(this.value())}static \u0275fac=function(t){return new(t||i)(g($))};static \u0275cmp=h({type:i,selectors:[["POS-brand-options"]],inputs:{placeholder:[1,"placeholder"],multiple:[1,"multiple"],clearable:[1,"clearable"]},features:[y([{provide:B,useExisting:m(()=>i),multi:!0}])],decls:2,vars:8,consts:[["bindLabel","Value","bindValue","Key","appendTo","body",3,"ngModelChange","change","open","items","typeahead","ngModel","multiple","placeholder","clearable"]],template:function(t,n){t&1&&(f(0,"ng-select",0),O(1,"async"),v("ngModelChange",function(E){return n.onModelChange(E)})("change",function(){return n.onSelectChange()})("open",function(){return n.onOpen()}),C()),t&2&&b("items",_(1,6,n.brands$))("typeahead",n.brandInput$)("ngModel",n.value())("multiple",n.multiple())("placeholder",n.placeholder())("clearable",n.clearable())},dependencies:[M,T,N,I,D,A,S],encapsulation:2})};export{w as a};
