import{C as h,b as f}from"./chunk-YXUFZINL.js";import{a as p}from"./chunk-IGFM5CCE.js";import{Ac as m,Bc as d,Db as l,wb as n,zc as u}from"./chunk-I3FGJX2C.js";import{d as s,n as v}from"./chunk-INB5GR2I.js";v();var A=["autocomplete"],t,g=(t=class{constructor(e){this.nomenclatureService=e,this.enableAutocompleteEnterEvent=!0}ngOnInit(){this.dataSourceAutocomplete=this.nomenclatureService.initDataSourceAutocomplete(!0)}customNameFormatter(e){return`${e.name}, \u0410\u0440\u0442: ${e.article??"-"}, \u0428\u041A: ${e.barcode}`}parseWeightBarcode(e){let o=e.target.value.startsWith("27")&&e.target.value.length===13;if(f(e.target.value,o)&&o){this.enableAutocompleteEnterEvent=!1;let r=e.target.value.slice(0,7),a=this.nomenclatureService.toWeightFormatFromBarcode(e.target.value.slice(7,12));this.dataSourceAutocomplete.load({filter:r}).then(i=>{i.data.length===1&&(this.addProduct(i.data[0],a),this.autocomplete.close(!1)),i.data.length>1&&i.data.forEach(c=>{(c.barcode===r||c.additionalBarcodes.includes(r))&&(this.addProduct(c,a),this.autocomplete.close(!1))}),this.enableAutocompleteEnterEvent=!0})}}},t.\u0275fac=function(o){return new(o||t)(n(h))},t.\u0275cmp=l({type:t,selectors:[["tis-base-parser"]],viewQuery:function(o,r){if(o&1&&u(A,5),o&2){let a;m(a=d())&&(r.autocomplete=a.first)}},decls:0,vars:0,template:function(o,r){},encapsulation:2}),t);g=s([p()],g);export{g as a};
//# sourceMappingURL=chunk-WS2DCHJD.js.map
