import{c as R}from"./chunk-5T6TZLDM.js";import{f as U,s as c}from"./chunk-LBZE4AC4.js";import{b as w}from"./chunk-ZBAZR7FK.js";import{b as B,e as j,f as O}from"./chunk-Y5ITWXM5.js";import{B as S,D as A,Fa as L,Ga as T,Wa as x,_a as k,o as p,q as v,r as I,u as F,w as E,z as N}from"./chunk-NNMVEAHQ.js";import{a as y,b as m}from"./chunk-KXDO3JYP.js";import{b as M}from"./chunk-EVIBIPJS.js";import{p as G}from"./chunk-JBWPPKX4.js";import{$c as r,Cb as C,ad as n,bc as a,cc as _,dc as b,ec as l,kb as s,la as g,sd as D,vb as o}from"./chunk-PVUKHE45.js";import{d as f,n as $}from"./chunk-VD6R3735.js";import{a as d,b as h}from"./chunk-MZPAXKJS.js";$();var e,z=(e=class{constructor(i,t,u,P,H){this.data=i,this._dialogRef=t,this._cdr=u,this._fb=P,this._localizationService=H,this.categories$=g(G).select(M.categories),this.icon=O,this.categories=[],this.categoryForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[p.required,p.minLength(c.min),p.maxLength(U.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??"",R(c.max,this._localizationService.getSync.bind(this._localizationService)))})}ngOnInit(){this._dialogRef.submitData$$.next(this.categoryForm),this._initSubs()}_initSubs(){this.categories$.pipe(m(this)).subscribe(i=>{this.categories=this._filterOutCurrentCategory(i)}),this._dialogRef.instance?.submitted.pipe(m(this)).subscribe(()=>this._cdr.markForCheck())}_filterOutCurrentCategory(i){return this.data?.id?i.filter(t=>t.id!==this.data?.id).map(t=>h(d({},t),{children:this._filterOutCurrentCategory(t.children)})):i}},e.\u0275fac=function(t){return new(t||e)(o(T),o(L),o(D),o(S),o(j))},e.\u0275cmp=C({type:e,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(t,u){t&1&&(_(0,"form",0),l(1,"tis-text-field",1),r(2,"translate"),r(3,"translate"),l(4,"wk-tree-input",2),r(5,"translate"),r(6,"translate"),l(7,"wk-text-area",3),r(8,"translate"),b()),t&2&&(a("formGroup",u.categoryForm),s(),a("label",n(2,9,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438"))("placeholder",n(3,11,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041E\u0432\u043E\u0449\u0438 \u0438 \u0444\u0440\u0443\u043A\u0442\u044B")),s(3),a("searchInput",!0)("options",u.categories)("label",n(5,13,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F"))("placeholder",n(6,15,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")),s(3),a("minHeight",68)("label",n(8,17,"\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0439")))},dependencies:[A,F,v,I,E,N,w,k,x,B],styles:[`.tree-view-item[_ngcontent-%COMP%]{width:100%;display:flex;gap:var(--space-horizontal-s);align-items:center}.icon-star[_ngcontent-%COMP%]{fill:var(--color-font-warning)}
/*# sourceMappingURL=upsert-category-dialog.component-4TP2JSGL.css.map */`],changeDetection:0}),e);z=f([y()],z);export{z as a};
//# sourceMappingURL=chunk-UUAD7R5O.js.map
