import{r as t,c as s,h as i,H as a}from"./p-1ea36ff3.js";import"./p-7e860896.js";import"./p-944da115.js";import"./p-d343a062.js";import{c as e,I as p,M as r,C as o,a as m}from"./p-d49099be.js";import{m as n}from"./p-d4bb09bf.js";import{g as c}from"./p-8dfe8365.js";import"./p-eebad85b.js";import"./p-28c66a78.js";import"./p-6eb29778.js";import"./p-681f800a.js";import"./p-3b35e507.js";import"./p-240d1ae7.js";import"./p-35267d98.js";import"./p-70e54631.js";import"./p-d50d0ec8.js";import"./p-fac8edcc.js";import"./p-48f43f2a.js";import"./p-d27cb594.js";import"./p-56d4255d.js";import"./p-73aa5f56.js";import"./p-7957afd8.js";import"./p-814af281.js";import"./p-e929429b.js";let d=class{constructor(i){t(this,i),this.acceptApplication=s(this,"acceptApplication",7),this.isProgressing=!1,this.isInvitationSent=!1,this.onInviteClick=async()=>{const{context:{organisationId:t},headers:s}=c(),i=this.item,{role:a,firstName:d,lastName:l,email:j,language:f}=i,h=function(t,s){var i={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&s.indexOf(a)<0&&(i[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(a=Object.getOwnPropertySymbols(t);e<a.length;e++)s.indexOf(a[e])<0&&Object.prototype.propertyIsEnumerable.call(t,a[e])&&(i[a[e]]=t[a[e]])}return i}(i,["role","firstName","lastName","email","language","_id","applicationStatus","createdAt"]);this.isProgressing=!0;const b=e(n,s),g=await b.importUser(t,a,{email:j,firstName:d,lastName:l,metadata:{data:h}}).catch((t=>{this.error=t,this.isProgressing=!1}));g&&await b.createInvitation(new p({accountType:a,firstName:d,invitee:new r(g._id,o.Users),issuedFor:j,language:f,lastName:l,organisation:new r(t,o.Organisations),skills:[],status:m.Pending})).catch((t=>{this.error=t,this.isProgressing=!1}))&&(this.isInvitationSent=!0,this.isProgressing=!1,this.acceptApplication.emit())}}render(){const t="invited"===this.item.applicationStatus||this.isInvitationSent;return i(a,{class:"d-flex align-items-center",style:{height:"30px"}},i("dvn-button",{leaned:!0,scale:"small",tagMode:t,tint:t?"secondary":"primary",view:t?"ghost":"solid",onClick:this.onInviteClick,progressing:this.isProgressing,disabled:this.isProgressing},t?"Invited":"Accept & Invite"))}};export{d as mentornity_accept_application_button}