import{c as j}from"./chunk-KGCVL6CP.js";import{f as G,s as d}from"./chunk-LBZE4AC4.js";import{b as O}from"./chunk-RTVR37QC.js";import{I as k,La as M,Ma as U}from"./chunk-QHAVDXDG.js";import{X as A,Z as R,d as p,f as D,g as v,j as I,ma as T,n as E,o as F,q as N,qa as L,s as S}from"./chunk-27KSTDMK.js";import{b as B}from"./chunk-7E4GTVCE.js";import{m as x}from"./chunk-OWZ5YAMH.js";import{z as c}from"./chunk-GQAU5ACB.js";import{Bb as i,Ea as g,Ib as C,fd as o,gd as r,hc as n,ic as _,jc as y,kc as l,qa as m,sb as s,yd as b}from"./chunk-ISMRT7VU.js";import{a as h,b as f}from"./chunk-M5TX2NVG.js";var ae=(()=>{class a{constructor(t,e,u,w,z){this.data=t,this._dialogRef=e,this._cdr=u,this._fb=w,this._localizationService=z,this.destroyRef=m(g),this.categories$=m(x).select(B.categories),this.icon=U,this.categories=[],this.categoryForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[p.required,p.minLength(d.min),p.maxLength(G.max)]),isQuick:this._fb.nonNullable.control(!!this.data?.isQuick),parentId:this._fb.control(this.data?.parentId??null),comment:this._fb.nonNullable.control(this.data?.comment??"",j(d.max,this._localizationService.getSync.bind(this._localizationService)))})}ngOnInit(){this._dialogRef.submitData$$.next(this.categoryForm),this._initSubs()}_initSubs(){this.categories$.pipe(c(this.destroyRef)).subscribe(t=>{this.categories=this._filterOutCurrentCategory(t)}),this._dialogRef.instance?.submitted.pipe(c(this.destroyRef)).subscribe(()=>this._cdr.markForCheck())}_filterOutCurrentCategory(t){return this.data?.id?t.filter(e=>e.id!==this.data?.id).map(e=>f(h({},e),{children:this._filterOutCurrentCategory(e.children)})):t}static{this.\u0275fac=function(e){return new(e||a)(i(R),i(A),i(b),i(N),i(M))}}static{this.\u0275cmp=C({type:a,selectors:[["tis-upsert-category-dialog"]],decls:9,vars:19,consts:[[3,"formGroup"],["formControlName","name","token","name",3,"label","placeholder"],["formControlName","parentId","token","parentId",3,"searchInput","options","label","placeholder"],["formControlName","comment","token","comment",3,"minHeight","label"]],template:function(e,u){e&1&&(_(0,"form",0),l(1,"tis-text-field",1),o(2,"translate"),o(3,"translate"),l(4,"wk-tree-input",2),o(5,"translate"),o(6,"translate"),l(7,"wk-text-area",3),o(8,"translate"),y()),e&2&&(n("formGroup",u.categoryForm),s(),n("label",r(2,9,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438"))("placeholder",r(3,11,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041E\u0432\u043E\u0449\u0438 \u0438 \u0444\u0440\u0443\u043A\u0442\u044B")),s(3),n("searchInput",!0)("options",u.categories)("label",r(5,13,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F"))("placeholder",r(6,15,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")),s(3),n("minHeight",68)("label",r(8,17,"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439")))},dependencies:[S,I,D,v,F,E,O,L,T,k],styles:[`.tree-view-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--space-horizontal-8);align-items:center}.icon-star[_ngcontent-%COMP%]{fill:var(--color-font-warning)}
/*# sourceMappingURL=upsert-category-dialog.component-UE3TE4IR.css.map */`],changeDetection:0})}}return a})();export{ae as a};
//# sourceMappingURL=chunk-HJTVQF34.js.map
