1import{a as te}from"./chunk-GYV3MJ2C.js";import{a as ie}from"./chunk-DJNFQKX5.js";import{a as Z,b as ee}from"./chunk-EU7ES2XX.js";import{a as Y}from"./chunk-RKVTYMQO.js";import"./chunk-MNOHV5BD.js";import{a as K,b as Q,h as X}from"./chunk-HL7ZPE67.js";import"./chunk-5CQW3ENY.js";import{a as H,b as J}from"./chunk-AFUMR4XN.js";import{d as q}from"./chunk-7CHM7E4X.js";import"./chunk-ZPFBRAXZ.js";import"./chunk-K5Z5JDZA.js";import{a as D,b as E,e as O,f as k,g as w,h as F}from"./chunk-WLTDZ3DG.js";import{j as T,k as R}from"./chunk-EQ55S6M7.js";import"./chunk-OGLR77SS.js";import"./chunk-ZR22GKHN.js";import"./chunk-TXT32OC6.js";import"./chunk-S4JDOR7E.js";import{g as I}from"./chunk-4FONNUUI.js";import"./chunk-GB7GYFPZ.js";import{a as A,b as N}from"./chunk-4MEHE3YC.js";import"./chunk-2H7TRYTK.js";import{A as U,C as W,e as M,h as L,i as z,m as G,q as V,r as $,x as B}from"./chunk-AVVUPC4U.js";import{a as h}from"./chunk-MXJEMLNA.js";import"./chunk-OHGAKBXO.js";import"./chunk-QPWLRHUH.js";import"./chunk-DHEY2U5O.js";import{x as j}from"./chunk-KT3MDBFJ.js";import{$b as S,Ac as r,Bb as v,Cc as _,Da as x,Hb as g,Na as p,Sb as s,Yb as f,ac as P,bc as i,cc as t,dc as y,la as d,lc as u,mc as b,nb as l,sb as C}from"./chunk-ZYY6ZGPJ.js";import"./chunk-O44YI6V6.js";var ne=(o,m)=>m.user_id;function re(o,m){o&1&&(i(0,"div",1),y(1,"mat-spinner",6),i(2,"p"),r(3,"Loading workspace members..."),t()())}function ae(o,m){o&1&&(i(0,"div",2)(1,"mat-icon"),r(2,"info"),t(),i(3,"p"),r(4,"All workspace members are already on this project, or no members are available."),t()())}function le(o,m){if(o&1&&(i(0,"mat-option",11),r(1),t()),o&2){let e=m.$implicit,a=b(2);s("value",e.user_id),l(),_(" ",a.memberLabel(e)," ")}}function me(o,m){o&1&&(i(0,"mat-error"),r(1,"Please select a member"),t())}function de(o,m){if(o&1&&(i(0,"div",7)(1,"p"),r(2,"Select a workspace member and assign their project role."),t()(),i(3,"form",8)(4,"mat-form-field",9)(5,"mat-label"),r(6,"Select Member"),t(),i(7,"mat-select",10),S(8,le,2,2,"mat-option",11,ne),t(),g(10,me,2,0,"mat-error"),t(),i(11,"mat-form-field",9)(12,"mat-label"),r(13,"Project Role"),t(),i(14,"mat-select",12)(15,"mat-option",13),r(16,"Contributor"),t(),i(17,"mat-option",14),r(18,"Leader"),t(),i(19,"mat-option",15),r(20,"Viewer"),t()()()()),o&2){let e,a=b();l(3),s("formGroup",a.form),l(5),P(a.candidates()),l(2),f((e=a.form.get("userId"))!=null&&e.hasError("required")?10:-1)}}var Te=(()=>{class o{constructor(e){this.data=e,this.destroyRef=d(x),this.fb=d(U),this.dialogRef=d(D),this.projectService=d(ie),this.workspaceService=d(te),this.notification=d(I),this.candidates=p([]),this.loading=p(!0),this.submitting=p(!1),this.form=this.fb.group({userId:["",M.required],role:["contributor",M.required]})}ngOnInit(){this.workspaceService.getMembers(this.data.workspaceId).pipe(h(this.destroyRef)).subscribe({next:e=>{let a=new Set(this.data.existingMemberUserIds);this.candidates.set(e.filter(n=>!a.has(n.user_id))),this.loading.set(!1)},error:()=>{this.notification.error("Failed to load workspace members"),this.loading.set(!1)}})}memberLabel(e){let a=e.user_name||e.user_email||e.user_id;return e.user_email&&e.user_name?`${e.user_name} (${e.user_email})`:a}onSubmit(){if(this.form.invalid||this.submitting())return;this.submitting.set(!0);let{userId:e,role:a}=this.form.value;this.projectService.addMember(this.data.projectId,e,a).pipe(h(this.destroyRef)).subscribe({next:n=>{this.notification.success("Member added to project"),this.dialogRef.close(n)},error:n=>{console.error("Error adding project member:",n);let c=n.error?.detail,oe=typeof c=="string"?c:"Failed to add member to project";this.notification.error(oe),this.submitting.set(!1)}})}onCancel(){this.dialogRef.close()}static{this.\u0275fac=function(a){return new(a||o)(C(E))}}static{this.\u0275cmp=v({type:o,selectors:[["cognicube-invite-project-member-dialog"]],decls:15,vars:4,consts:[["mat-dialog-title",""],[1,"loading-container"],[1,"empty-state"],["align","end",1,"cc-dialog-actions"],["mat-button","","type","button",3,"click","disabled"],["mat-raised-button","","color","primary","type","button",3,"click","disabled"],["diameter","40"],[1,"dialog-info"],[1,"cc-dialog-form",3,"formGroup"],["appearance","outline","subscriptSizing","dynamic"],["formControlName","userId","required",""],[3,"value"],["formControlName","role","required",""],["value","contributor"],["value","leader"],["value","viewer"]],template:function(a,n){a&1&&(i(0,"h2",0)(1,"mat-icon"),r(2,"person_add"),t(),r(3,` Add Project Member 2`),t(),i(4,"mat-dialog-content"),g(5,re,4,0,"div",1)(6,ae,5,0,"div",2)(7,de,21,2),t(),i(8,"mat-dialog-actions",3)(9,"button",4),u("click",function(){return n.onCancel()}),r(10,"Cancel"),t(),i(11,"button",5),u("click",function(){return n.onSubmit()}),i(12,"mat-icon"),r(13,"person_add"),t(),r(14),t()()),a&2&&(l(5),f(n.loading()?5:n.candidates().length===0?6:7),l(4),s("disabled",n.submitting()),l(2),s("disabled",!n.form.valid||n.submitting()||n.loading()||n.candidates().length===0),l(3),_(" ",n.submitting()?"Adding...":"Add Member"," "))},dependencies:[j,W,G,L,z,B,V,$,F,O,w,k,R,T,Y,X,K,Q,ee,Z,q,J,H,N,A],styles:["[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;color:#1e293b}h2[mat-dialog-title][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#3b82f6;font-size:24px;width:24px;height:24px}mat-dialog-content[_ngcontent-%COMP%]{padding:0 24px 8px!important;min-width:0;box-sizing:border-box;overflow-x:hidden}.dialog-info[_ngcontent-%COMP%]{background:#f0f9ff;border-left:4px solid #3b82f6;padding:12px 16px;margin-bottom:16px;border-radius:4px}.dialog-info[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;color:#1e40af;font-size:14px;line-height:1.45}.loading-container[_ngcontent-%COMP%], .empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:40px 20px;gap:16px;text-align:center;color:#64748b}.loading-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;max-width:320px;line-height:1.5}.empty-state[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:48px;width:48px;height:48px;color:#94a3b8}.cc-dialog-form[_ngcontent-%COMP%]{padding-top:0;min-width:0;width:100%}"],changeDetection:0})}}return o}
2)();export{Te as InviteProjectMemberDialogComponent};
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.