import{a as H,b as O}from"./chunk-PEX7YGG3.js";import{f as M,t as $}from"./chunk-ZVQ5RRLK.js";import{b as w}from"./chunk-FZR6ITPM.js";import{b as L}from"./chunk-BNNGG6ED.js";import{B as Q,D as T,Fa as A,Ga as j,Za as B,o as m,q as S,r as v,u as y,w as N,z as E}from"./chunk-CQ74FR7E.js";import{a as I,b as h}from"./chunk-KXDO3JYP.js";import{p as x,q as G,r as R,s as U}from"./chunk-JBWPPKX4.js";import{$c as a,Cb as g,ad as s,bc as l,cc as q,dc as C,ec as f,fa as F,kb as d,la as b,sd as _,vb as n}from"./chunk-PVUKHE45.js";import{d as o,n as D}from"./chunk-VD6R3735.js";import{a as c,b as k}from"./chunk-MZPAXKJS.js";D();var e,u=(e=class{static quickGroups(t){return t.quickGroups}setQuickGroups(t,i){t.setState(c({},i.quickGroup))}clearQuickGroups(t){t.setState({quickGroups:[]})}},e.\u0275fac=function(i){return new(i||e)},e.\u0275prov=F({token:e,factory:e.\u0275fac}),e);o([G(H)],u.prototype,"setQuickGroups",null);o([G(O)],u.prototype,"clearQuickGroups",null);o([U()],u,"quickGroups",null);u=o([R({name:"quickGroup",defaults:{quickGroups:[]}})],u);D();var r,P=(r=class{constructor(t,i,p,V){this.data=t,this._dialogRef=i,this._cdr=p,this._fb=V,this.quickGroups$=b(x).select(u.quickGroups),this.quickGroups=[],this.quickGroupForm=this._fb.group({name:this._fb.nonNullable.control(this.data?.name??"",[m.required,m.minLength($.min),m.maxLength(M.max)]),parentId:this._fb.control(this.data?.parentId??null)})}ngOnInit(){this._dialogRef.submitData$$.next(this.quickGroupForm),this._initSubs()}_initSubs(){this.quickGroups$.pipe(h(this)).subscribe(t=>{this.quickGroups=this._filterGroups(t)}),this._dialogRef.instance?.submitted.pipe(h(this)).subscribe(()=>this._cdr.markForCheck())}_filterGroups(t){return this.data?.id?t.filter(i=>i.id!==this.data?.id).map(i=>k(c({},i),{children:i.children.filter(p=>p.id!==this.data?.id)})):t}},r.\u0275fac=function(i){return new(i||r)(n(j),n(A),n(_),n(Q))},r.\u0275cmp=g({type:r,selectors:[["tis-upsert-quick-group-dialog"]],decls:7,vars:14,consts:[[3,"formGroup"],["formControlName","name","token","name",3,"label","placeholder"],["formControlName","parentId","token","parentId",3,"options","label","placeholder"]],template:function(i,p){i&1&&(q(0,"form",0),f(1,"tis-text-field",1),a(2,"translate"),a(3,"translate"),f(4,"wk-tree-input",2),a(5,"translate"),a(6,"translate"),C()),i&2&&(l("formGroup",p.quickGroupForm),d(),l("label",s(2,6,"\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u0433\u0440\u0443\u043F\u043F\u044B"))("placeholder",s(3,8,"\u041D\u0430\u043F\u0440\u0438\u043C\u0435\u0440: \u041D\u0430\u043F\u0438\u0442\u043A\u0438")),d(3),l("options",p.quickGroups)("label",s(5,10,"\u0420\u043E\u0434\u0438\u0442\u0435\u043B\u044C\u0441\u043A\u0430\u044F \u0433\u0440\u0443\u043F\u043F\u0430"))("placeholder",s(6,12,"\u041D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u043E")))},dependencies:[T,y,S,v,N,E,w,B,L],encapsulation:2,changeDetection:0}),r);P=o([I()],P);export{u as a,P as b};
//# sourceMappingURL=chunk-AGZ35MOZ.js.map
