1import{a as le}from"./chunk-OXTKRM5K.js";import{a as re}from"./chunk-XDHRQJQE.js";import{h as ie,i as oe,o as ne}from"./chunk-AAFN2Q3B.js";import{A as W,B as X,C as Z,D as ee,J as te,N as ue,P as se,i as L,l as z,n as F,p as H,q as Y,s as D,v as _,x as J,z as Q}from"./chunk-WRA4FD3B.js";import"./chunk-4GMZBVGA.js";import{b as ae}from"./chunk-D26SGMSW.js";import"./chunk-GKXGYBRO.js";import"./chunk-YVZ7DYLL.js";import{A as y}from"./chunk-HF53JBD4.js";import"./chunk-SILL6BFZ.js";import"./chunk-MWCWNYZC.js";import{e as x,f as C}from"./chunk-S6S4XSAE.js";import{s as K}from"./chunk-INNSHJOD.js";import{a as U,c as q}from"./chunk-BBYWTA5D.js";import{g as G,h as j,tb as E,v as R,vb as $}from"./chunk-F2DOYJOY.js";import{Eb as w,F as M,Fa as p,Ga as d,J as B,Jb as V,Jc as a,L as I,Na as P,Q as v,Qb as b,Yb as l,ha as T,ic as o,jc as n,kc as O,na as N,oc as S,sa as k,ta as g,uc as h,wb as s,wc as A}from"./chunk-PXR2MR6T.js";import"./chunk-TSRGIXR5.js";var ce=(()=>{class r{constructor(e,t){this._httpClient=e,this._store=t,this.urlApi=$.urlApi}get onCategoriesChanged(){return this._store.pipe(C(ie))}resolveCategories(){return new Promise((e,t)=>{this._store.pipe(C(oe),v(),T(u=>{u||this._store.dispatch(new y)}),M(u=>u),I(1)).subscribe(()=>{e()},t)})}addCategory(e){return new Promise((t,u)=>{let i={title:e.title};this._httpClient.post(`${this.urlApi}/max/categories`,i).subscribe(()=>{t()},u)})}updateCategory(e){return new Promise((t,u)=>{let i={title:e.title};this._httpClient.put(`${this.urlApi}/max/categories/`+e.groups_category_id,i).subscribe(()=>{t()},u)})}deleteCategory(e){return new Promise((t,u)=>{this._httpClient.delete(`${this.urlApi}/max/categories/`+e).subscribe(()=>{t()},u)})}static{this.\u0275fac=function(t){return new(t||r)(k(R),k(x))}}static{this.\u0275prov=N({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();function pe(r,f){r&1&&(o(0,"mat-error"),a(1,"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435"),n())}function de(r,f){r&1&&(o(0,"div",13),a(1," \u041F\u043E\u043A\u0430 \u043D\u0435\u0442 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0439. \u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043F\u0435\u0440\u0432\u0443\u044E \u0447\u0435\u0440\u0435\u0437 \u043F\u043E\u043B\u0435 \u0432\u044B\u0448\u0435. "),n())}function ge(r,f){r&1&&(o(0,"mat-error"),a(1,"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u0435"),n())}function fe(r,f){if(r&1){let e=S();o(0,"div",14)(1,"div",15)(2,"div",16)(3,"mat-icon"),a(4,"bookmarks"),n()(),o(5,"div",17)(6,"div",18),a(7,"\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438:"),n(),o(8,"mat-form-field",1),O(9,"input",19),b(10,ge,2,0,"mat-error",8),n()(),o(11,"button",20),h("click",function(){let u=p(e).index,i=A();return d(i.delete(u))}),o(12,"mat-icon"),a(13,"delete"),n()()()()}if(r&2){let e=f.$implicit,t=f.index,u=A();s(),l("formGroupName",t),s(9),l("ngIf",e.get("title").touched&&e.get("title").invalid),s(),l("disabled",u.deletingIndex()===t)("matTooltipDisabled",u.deletingIndex()===t)}}var qe=(()=>{class r{constructor(){this.profile=w(null),this.newCategoryControl=new _("",F.required),this.creatingNow=w(!1),this.deletingIndex=w(null),this.categoryService=g(ce),this.store=g(x),this.destroyRef=g(P),this.matSnackBar=g(K),this.layoutService=g(le)}get categoriesArray(){return this.categoriesGroup.get("categories")}ngOnInit(){this.categoriesGroup=new D({categories:new te([])}),this.layoutService.setConfig({title:{value:"\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F\u043C\u0438 \u043A\u0430\u043D\u0430\u043B\u043E\u0432",icon:{name:"arrow_back",routerLink:"/apps/max/channels"}},buttons:[]}),this.categoryService.resolveCategories(),this.categoryService.onCategoriesChanged.pipe(E(this.destroyRef)).subscribe(e=>{let t=this.categoriesGroup.get("categories");for(;t.length!==0;)t.removeAt(0);e.map(u=>{let i=new D({title:new _(u.title,F.required),groups_category_id:new _(u.groups_category_id),users_id:new _(u.users_id)});t.push(i),this.attachAutosave(i)})}),this.store.pipe(C(ne)).pipe(E(this.destroyRef)).subscribe(e=>{this.profile.set(e)})}quickAdd(){let e=(this.newCategoryControl.value||"").trim();if(!e){this.newCategoryControl.markAsTouched();return}this.creatingNow()||(this.creatingNow.set(!0),this.categoryService.addCategory({title:e}).then(()=>{this.newCategoryControl.reset(""),this.saveSuccessMessage(),this.store.dispatch(new y)}).catch(()=>this.errorMessage()).finally(()=>this.creatingNow.set(!1)))}onEnter(e){e.preventDefault(),e.stopPropagation(),this.quickAdd()}attachAutosave(e){let t=e.get("title"),u=e.get("groups_category_id");t&&t.valueChanges.pipe(B(600),v(),E(this.destroyRef)).subscribe(i=>{let c=u?.value;
1!c||!i||e.invalid||this.categoryService.updateCategory({groups_category_id:c,title:i}).then(()=>this.saveSuccessMessage()).catch(()=>this.errorMessage())})}delete(e){let t=this.categoriesGroup.get("categories").controls;this.deletingIndex.set(e),t[e].value.groups_category_id&&this.categoryService.deleteCategory(t[e].value.groups_category_id).then(()=>{this.deleteSuccessMessage(),this.store.dispatch(new y)}).catch(()=>this.errorMessage()).finally(()=>this.deletingIndex.set(null)),t.splice(e,1)}errorMessage(){this.matSnackBar.open("\u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043E\u0448\u0438\u0431\u043A\u0430. \u041E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443 VK Panel","OK",{verticalPosition:"top",duration:2e3})}deleteSuccessMessage(){this.matSnackBar.open("\u0423\u0441\u043F\u0435\u0448\u043D\u043E \u0443\u0434\u0430\u043B\u0435\u043D\u043E","OK",{verticalPosition:"top",duration:2e3})}saveSuccessMessage(){this.matSnackBar.open("\u0423\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E","OK",{verticalPosition:"top",duration:2e3})}trackByCategory(e,t){return t?.value?.groups_category_id??`new-${e}`}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=V({type:r,selectors:[["app-max-category"]],decls:21,vars:7,consts:[["newCatInput",""],[1,"w-full"],[1,"w-full","p-6"],[1,"rounded-xl","border","dark:bg-[#424242]","bg-white","p-6",3,"keydown.enter","submit","formGroup"],[1,"mb-4","text-sm","opacity-80"],[1,"hidden","md:inline"],[1,"mb-6","flex","flex-col","gap-x-3","md:items-center","md:flex-row","items-start"],["matInput","","placeholder","\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 Enter","type","text","enterkeyhint","done",3,"keydown.enter","keyup.enter","formControl"],[4,"ngIf"],["type","button","color","primary rounded md:-mt-4","mat-raised-button","","matTooltip","\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u0443\u044E \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E",3,"click","disabled"],["formArrayName","categories",1,"grid","grid-cols-1","gap-3","md:grid-cols-2"],["class","mb-4 rounded bg-gray-50 p-4 text-sm dark:bg-[#303030]",4,"ngIf"],["class","category-card rounded-xl border p-3",4,"ngFor","ngForOf","ngForTrackBy"],[1,"mb-4","rounded","bg-gray-50","p-4","text-sm","dark:bg-[#303030]"],[1,"category-card","rounded-xl","border","p-3"],[1,"flex","w-full","items-center","gap-3",3,"formGroupName"],[1,"category-icon","mt-1","flex","h-8","w-8","shrink-0","items-center","justify-center","rounded-full","bg-indigo-50","text-indigo-600","dark:bg-[#2d2d2d]"],[1,"flex","min-w-0","flex-1","flex-col"],[1,"mb-1","text-xs","opacity-70"],["formControlName","title","matInput","","placeholder","\u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435 \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438","type","text"],["type","button","mat-icon-button","","color","warn","aria-label","\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E","matTooltip","\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E","matTooltipPosition","above",1,"shrink-0",3,"click","disabled","matTooltipDisabled"]],template:function(t,u){if(t&1){let i=S();o(0,"div",1)(1,"div",2)(2,"form",3),h("keydown.enter",function(m){return p(i),d(m.preventDefault())})("submit",function(m){return p(i),d(m.preventDefault())}),o(3,"div",4),a(4," \u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u0438 \u043F\u043E\u043C\u043E\u0433\u0430\u044E\u0442 \u0431\u044B\u0441\u0442\u0440\u043E \u0444\u0438\u043B\u044C\u0442\u0440\u043E\u0432\u0430\u0442\u044C \u0438 \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0432\u0430\u0448\u0438 \u0441\u043E\u043E\u0431\u0449\u0435\u0441\u0442\u0432\u0430. "),o(5,"span",5),a(6,"\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u043D\u043E\u0432\u0443\u044E \u043A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044E \u0447\u0435\u0440\u0435\u0437 \u043F\u043E\u043B\u0435 \u043D\u0438\u0436\u0435 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 Enter \u0438\u043B\u0438 \u043A\u043D\u043E\u043F\u043A\u0443 \xAB\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C\xBB."),n(),a(7," \u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043D\u0430\u0437\u0432\u0430\u043D\u0438\u044F \u043F\u0440\u044F\u043C\u043E \u0432 \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0430\u0445 \u2014 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u044F\u044E\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438. "),n(),o(8,"div",6)(9,"mat-form-field",1)(10,"input",7,0),h("key
1down.enter",function(m){return p(i),d(u.onEnter(m))})("keyup.enter",function(m){return p(i),d(u.onEnter(m))}),n(),b(12,pe,2,0,"mat-error",8),n(),o(13,"button",9),h("click",function(){return p(i),d(u.quickAdd())}),o(14,"mat-icon"),a(15,"add"),n(),o(16,"span"),a(17,"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C"),n()()(),o(18,"div",10),b(19,de,2,0,"div",11)(20,fe,14,4,"div",12),n()()()()}t&2&&(s(2),l("formGroup",u.categoriesGroup),s(8),l("formControl",u.newCategoryControl),s(2),l("ngIf",u.newCategoryControl.touched&&u.newCategoryControl.invalid),s(),l("disabled",u.creatingNow()),s(6),l("ngIf",!u.categoriesGroup.controls.categories.value.length),s(),l("ngForOf",u.categoriesArray.controls)("ngForTrackBy",u.trackByCategory))},dependencies:[ue,J,z,H,Y,Q,W,ee,X,Z,L,se,U,G,ae,re,j,q],styles:['.header[_ngcontent-%COMP%]{min-height:120px;position:relative;background:url(/assets/images/backgrounds/user_bg1.png) 0 45%/cover no-repeat}.header[_ngcontent-%COMP%]:before{width:100%;content:" ";background-color:#00000040;position:absolute;left:0;top:0;height:100%}.category-card[_ngcontent-%COMP%]{transition:box-shadow .15s ease,transform .15s ease}.category-card[_ngcontent-%COMP%]:hover{transform:translateY(-1px);box-shadow:0 6px 20px #00000014}.category-card[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper[_ngcontent-%COMP%]{margin-top:2px}.category-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;height:18px;width:18px;line-height:18px}']})}}return r})();export{qe as CategoryComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.