(self.webpackChunk=self.webpackChunk||[]).push([[33953],{523545:(e,t,n)=>{var i=n(197141),r=n(972889);e.exports=function e(t,n,o,a,s){var u=-1,c=t.length;for(o||(o=r),s||(s=[]);++u<c;){var l=t[u];n>0&&o(l)?n>1?e(l,n-1,o,a,s):i(s,l):a||(s[s.length]=l)}return s}},196638:(e,t,n)=>{var i=n(552485),r=n(358095),o=n(321796),a=n(66070),s=n(739334),u=n(765581),c=Math.min;e.exports=function(e,t,n){for(var l=n?o:r,d=e[0].length,g=e.length,m=g,f=Array(g),h=1/0,_=[];m--;){var v=e[m];m&&t&&(v=a(v,s(t))),h=c(v.length,h),f[m]=!n&&(t||d>=120&&v.length>=120)?new i(m&&v):void 0}v=e[0];var E=-1,I=f[0];e:for(;++E<d&&_.length<h;){var p=v[E],S=t?t(p):p;if(p=n||0!==p?p:0,!(I?u(I,S):l(_,S,n))){for(m=g;--m;){var A=f[m];if(!(A?u(A,S):l(e[m],S,n)))continue e}I&&I.push(S),_.push(p)}}return _}},960923:(e,t,n)=>{var i=n(536468);e.exports=function(e){return i(e)?e:[]}},972889:(e,t,n)=>{var i=n(896539),r=n(802900),o=n(719785),a=i?i.isConcatSpreadable:void 0;e.exports=function(e){return o(e)||r(e)||!!(a&&e&&e[a])}},922346:(e,t,n)=>{var i=n(11005),r=n(523545),o=n(401197),a=n(536468),s=o((function(e,t){return a(e)?i(e,r(t,1,a,!0)):[]}));e.exports=s},827921:(e,t,n)=>{var i=n(66070),r=n(196638),o=n(401197),a=n(960923),s=o((function(e){var t=i(e,a);return t.length&&t[0]===e[0]?r(t):[]}));e.exports=s},342467:(e,t,n)=>{"use strict";n.d(t,{default:()=>r});var i=n(759312);const r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.__extends)(t,e),t}(n(684693).default)},371678:(e,t,n)=>{"use strict";n.d(t,{default:()=>r});var i=n(759312);const r=function(e){function t(t,n){void 0===n&&(n="PromiseCancel");var i=e.call(this,t,n)||this;return i.message=t,i.name=n,i}return(0,i.__extends)(t,e),t}(n(342467).default)},799098:(e,t,n)=>{"use strict";n.d(t,{makeAttemptId:()=>s,statAutoClose:()=>h,statCancel:()=>f,statDeactivatedAction:()=>p,statModalShown:()=>c,statNotInAllowlistAction:()=>R,statRequestLicenseForFreeRestrictedAction:()=>C,statResult:()=>l,statSeatsAction:()=>S,statSeatsUnlimitedAction:()=>A,statSubmit:()=>d,statValidationCustomErrorApi:()=>E,statValidationErrorApi:()=>v,statValidationErrorStatic:()=>I,trackSharingIntentAdded:()=>m,trackSharingIntentShown:()=>g});var i=n(759312),r=n(980534),o=n(481081),a=n(73773);function s(){return"".concat((0,r.default)().getAnonymousId(),"-").concat((new Date).getTime())}var u;function c(e){var t=e.attempt_id,n=e.initiator,i=e.target;(function(e){return["board","dashboard","settings"].includes(e)})(n)&&(0,r.default)().sendApiEvent("invite_modal_shown",{attempt_id:t,initiator:n,target:i})}function l(e){(0,r.default)().sendApiEvent("invite_modal_result",e)}function d(e){var t,n="auto"===(t=e.license).license?t.readonlyLicenseForNewUsers?o.UserOrganizationLicense.FREE_RESTRICTED:o.UserOrganizationLicense.FREE:t.license||"unknown";(0,r.default)().sendApiEvent("invite_modal_interaction",(0,i.__assign)((0,i.__assign)({},e),{license:n,type:"submit"}))}function g(){(0,r.default)().sendApiEvent("sharing_intent_shown",{})}function m(e){var t=e.sharingIntent,n=e.sharingType,i=e.messageCreated,o=e.interactionsCount;(0,r.default)().sendApiEvent("sharing_intent_added",{sharing_intent_type:t,sharing_type:n,custom_message_created:i,number_of_sharing_intent_interactions:o})}function f(e){var t=e.attempt_id,n=e.invitee_count,i=e.team_count;(0,r.default)().sendApiEvent("invite_modal_interaction",{attempt_id:t,invitee_count:n,team_count:i,type:"cancel"}),l({attempt_id:t,invitee_count:n,invited_count:0,team_count:i,result:"cancelled"})}function h(e){l({attempt_id:e.attempt_id,invitee_count:e.invitee_count,invited_count:0,team_count:e.team_count,result:"cancelled"})}!function(e){e.NoEmails="no_emails",e.NoTeams="no_teams",e.InvalidEmails="invalid_emails",e.NotRecognized="not_recognized"}(u||(u={}));var _=function(e){var t,n;return e.name?e.name:(null===(n=null===(t=e.responseJSON)||void 0===t?void 0:t.error)||void 0===n?void 0:n.reason)?e.responseJSON.error.reason:e.statName?e.statName:"not_recognized"};function v(e){var t=e.attempt_id,n=e.err,i=e.invitee_count,o=e.team_count;(0,r.default)().sendApiEvent("invite_modal_validation_error",{attempt_id:t,invitee_count:i,team_count:o,validation_type:"api",validation_error:_(n),validation_error_count:n.validationErrorCount})}function E(e){var t=e.attempt_id,n=e.error_count,i=e.error_name,o=e.invitee_count,a=e.team_count;(0,r.default)().sendApiEvent("invite_modal_validation_error",{attempt_id:t,invitee_count:o,team_count:a,validation_type:"api",validation_error:i,validation_error_count:n})}function I(e){var t=e.attempt_id,n=e.emails,o=e.team_count,s={validation_error:u.NotRecognized};0===n.length?s.validation_error=u.NoEmails:0===o?s.validation_error=u.NoTeams:(s.validation_error=u.InvalidEmails,s.validation_error_count=n.filter((function(e){return!(0,a.validateEmail)(e)})).length),(0,r.default)().sendApiEvent("invite_modal_validation_error",(0,i.__assign)({attempt_id:t,invitee_count:n.length,team_count:o,validation_type:"static"},s))}function p(e){(0,r.default)().sendApiEvent("invite_modal_validation_action",(0,i.__assign)({action_type:"deactivated_invitee"},e))}function S(e){var t=e.action,n=e.action_count,i=e.attempt_id,o=e.invitee_count;(0,r.default)().sendApiEvent("invite_modal_validation_action",{action:t,action_count:n,action_type:"not_enough_seats",attempt_id:i,invitee_count:o})}function A(e){var t;(0,r.default)().sendApiEvent("invite_modal_validation_action",{action:"confirmation_unlimited",action_type:"not_enough_seats",attempt_id:null!==(t=e.attemptId)&&void 0!==t?t:"",invitee_count:e.emails.length})}function R(e){(0,r.default)().sendApiEvent("invite_modal_validation_action",(0,i.__assign)({action_type:"not_in_allowlist"},e))}function C(e){(0,r.default)().sendApiEvent("invite_modal_validation_action",(0,i.__assign)({action_type:"request_license_for_free_restricted"},e))}},610150:(e,t,n)=>{"use strict";n.d(t,{BoardLockedChecker:()=>r,BoardLockedReason:()=>i});var i,r={};function o(e){return!!e&&(e.lockedByAccountExpired||e.lockedByUsersPerBoardLimitExceeded||e.lockedByUsersPerAccountLimitExceeded||e.lockedByBoardsPerAccountLimitExceeded||e.lockedByActiveBoardsPerAccountLimitExceeded)}function a(e){return e.lockedByAccountExpired?i.ACCOUNT_EXPIRED:e.lockedByUsersPerBoardLimitExceeded||e.lockedByUsersPerAccountLimitExceeded||e.lockedByBoardsPerAccountLimitExceeded?i.ACCOUNT_LIMITS_EXCEEDED:e.lockedByActiveBoardsPerAccountLimitExceeded?i.ACCOUNT_ACTIVE_BOARD_LIMIT_EXCEEDED:null}n.r(r),n.d(r,{getLockedReason:()=>a,isLocked:()=>o}),function(e){e[e.ACCOUNT_EXPIRED=0]="ACCOUNT_EXPIRED",e[e.ACCOUNT_LIMITS_EXCEEDED=1]="ACCOUNT_LIMITS_EXCEEDED",e[e.ACCOUNT_ACTIVE_BOARD_LIMIT_EXCEEDED=2]="ACCOUNT_ACTIVE_BOARD_LIMIT_EXCEEDED"}(i||(i={}))},823444:(e,t,n)=>{"use strict";n.d(t,{InviteAccountInfoDesc:()=>i,InviteExtendedAccountInfoDesc:()=>a,InviteOrganizationInfoDesc:()=>o,attemptInviteWithSharingIntentSignal:()=>s.attemptInviteWithSharingIntentSignal,getDayPassesIfNeed:()=>s.getDayPassesIfNeed,inviteEditorAsExternalEnabled:()=>s.inviteEditorAsExternalEnabled,isCoOwnerAvailableInShare:()=>s.isCoOwnerAvailableInShare,isCoOwnerRole:()=>s.isCoOwnerRole,isEditorRole:()=>s.isEditorRole,isFreeRestrictedNonTeam:()=>s.isFreeRestrictedNonTeam,isFreeRestrictedOrgMember:()=>s.isFreeRestrictedOrgMember,loadBoardInfo:()=>s.loadBoardInfo,loadBoardUserConnections:()=>s.loadBoardUserConnections,onInvitationsSent:()=>s.onInvitationsSent,onLinkCopied:()=>s.onLinkCopied,onShareModalCanceled:()=>s.onShareModalCanceled,onUpgradePricingModalCanceled:()=>s.onUpgradePricingModalCanceled,prepareSharingInfo:()=>s.prepareSharingInfo,splitEmailsByTakenSeats:()=>s.splitEmailsByTakenSeats,startViewChangedSignal:()=>s.startViewChangedSignal,startViewClosedSignal:()=>s.startViewClosedSignal,startViewOpenedSignal:()=>s.startViewOpenedSignal});n(610150);var i={id:{},usersNumber:{},limits:{},title:{},permissions:{},participantPostInvitationPaymentTest:{},type:{},trial:{},features:{},expired:{},expirationDate:{},boardsNumber:{},role:{},invitationLink:{}},r=n(759312),o={id:{},title:{},type:{},sharingPolicySettings:{domains:{},whiteListDomainsEnabled:{},sharingViaPublicLinkEnabled:{},editingViaPublicLinkEnabled:{},sharingWithExternalUsersEnabled:{}},remainingFullLicenseNumber:{},features:{},currentUserPermission:{deactivated:{},permissions:{},role:{},user:{}},fullUsersLimit:{},security:{}},a=(0,r.__assign)((0,r.__assign)({},i),{organization:o}),s=(n(197130),n(637788),n(758516))},637788:(e,t,n)=>{"use strict";n.d(t,{runInvitationTree:()=>C});var i=n(759312),r=n(922346),o=n.n(r),a=n(896097),s=n(742658),u=n(512351),c=n(395893),l=n(555690),d=n(576163),g=n(978040),m=n(225995),f=n(319409),h=n(336),_=n(610150),v=n(227072),E=n(758516),I=n(182774),p=n(799098),S=n(371678);n(335887);function A(e){return function(e){switch(e){case u.UserBoardRole.OWNER:return"Owner";case u.UserBoardRole.COOWNER:return"Co-owner";case u.UserBoardRole.EDITOR:return"Editor";case u.UserBoardRole.COMMENTATOR:return"Commenter";case u.UserBoardRole.VIEWER:return"Viewer";default:return e}}(e)+"s"}var R=n(197130);function C(e,t,n,r,C,O,b,N,U,y,w,B){var F=r.map((function(e){return e.toLowerCase()})),P={attemptId:N,emails:F,handlers:t,boardInfo:n,onCloseWithoutOpeningChildWindows:b,from:"",notification:U,isSilentMode:y,boardsAPI:e,sharingIntent:w,inviteContext:B};return function(e){var t=e.boardInfo,n=e.handlers;if(_.BoardLockedChecker.isLocked(t))return n.showBoardIsLocked(t),Promise.reject(new S.default("Board is locked"));return Promise.resolve()}(P).then((function(){return(0,E.fetchOrganizationFieldsIfNeeded)(n.account)})).then((function(e){return e&&P.boardInfo.account.organization&&Object.assign(P.boardInfo.account.organization,e),Promise.resolve()})).then((function(){return function(e,t,n){var r,o,c,g,m;return(0,i.__awaiter)(this,void 0,Promise,(function(){var f,_,v,E,I,p,S,R,C,O;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return f=e.boardInfo,_=e.handlers,v=e.onCloseWithoutOpeningChildWindows,E=e.isSilentMode,!(0,d.accountBelongsToOrg)(f.account)||(0,h.isFreeTeamOrg)(f.account.organization)||(0,h.isDevTeamOrg)(f.account.organization)?[2,t]:function(e,t){var n;if(!(null===(n=e.account)||void 0===n?void 0:n.inviteExternalUsersEnabled))return!1;if((0,h.hasFeature)(e.account.organization,s.OrganizationFeatures.GUEST_USERS_FREE_OF_CHARGE))return!0;return!(t===u.UserBoardRole.EDITOR||t===u.UserBoardRole.COOWNER)}(f,n)?[2,t]:(I=(null===(o=null===(r=e.boardInfo.account.organization)||void 0===r?void 0:r.invitationRights)||void 0===o?void 0:o.whoCanInvite)===l.InviteNewMembersPermissionLevel.CompanyAdmins,p=(null===(g=null===(c=e.boardInfo.account.organization)||void 0===c?void 0:c.invitationRights)||void 0===g?void 0:g.whoCanInvite)===l.InviteNewMembersPermissionLevel.Admins,I&&!(0,d.isOrgAdmin)(e.boardInfo.account.organization)||p&&!(0,d.isAdmin)(e.boardInfo.account)?[4,a.default.organizations.selectById(null===(m=e.boardInfo.account.organization)||void 0===m?void 0:m.id).checkEmailStatus(t,{organizationConnection:{deactivated:{},role:{}}})]:[2,t]);case 1:for(O in S=i.sent(),R=[],C=[],S)T(S[O])?C.push(O):R.push(O);return R.length>0?[4,_.showCanNotAddUsersOutsideTeamModal({boardInfo:f,emails:R,from:"",attemptId:e.attemptId,isSilentMode:E,onCloseWithoutOpeningChildWindows:v},f.account,A(n).toLowerCase())]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2,C]}}))}))}(P,F,C)})).then((function(e){return function(e,t){var n=e.boardInfo,r=e.handlers,u=e.onCloseWithoutOpeningChildWindows,c=e.isSilentMode,l=e.sharingIntent;if(!(0,d.accountBelongsToOrg)(n.account)||!(0,h.hasFeature)(n.account.organization,s.OrganizationFeatures.DEACTIVATED_USERS))return Promise.resolve(t);var m=n.account.organization;return a.default.organizations.selectById(m.id).checkEmailStatus(t,g.DEFAULT_EMAIL_USER_FIELDS).then((function(a){var s=t.filter((function(e){var t=a[e];return t.organizationConnection&&t.organizationConnection.deactivated}));if(0===s.length)return t;var d=o()(t,s),g=s.map((function(e){return a[e].organizationConnection.user}));return r.showSkipDeactivatedUsersModal({boardInfo:n,emails:t,from:"",attemptId:e.attemptId,isSilentMode:c,onCloseWithoutOpeningChildWindows:u,sharingIntent:l},g).then((function(){return e.attemptId&&(0,p.statDeactivatedAction)({action:"skip",action_count:t.length-d.length,attempt_id:e.attemptId,invitee_count:e.emails.length}),d})).catch((function(n){return e.attemptId&&!n&&(0,p.statDeactivatedAction)({action:"cancel",action_count:t.length-d.length,attempt_id:e.attemptId,invitee_count:e.emails.length}),n?n instanceof S.default?Promise.reject(n):Promise.reject((0,i.__assign)((0,i.__assign)({},n),{statName:"DeactivatedEmailsInvitationError"})):Promise.reject(new Error("DeactivatedEmailsInvitationError"))}))}))}(P,e)})).then((function(e){return function(e,t,n,r){return(0,i.__awaiter)(this,void 0,Promise,(function(){var l,g,f,_,v,I,A,R,C,T,O,b,N,U,y,w,B,F;return(0,i.__generator)(this,(function(P){switch(P.label){case 0:if(l=e.attemptId,g=e.boardInfo,f=e.handlers,_=e.onCloseWithoutOpeningChildWindows,v=e.isSilentMode,I=e.sharingIntent,A=g.account,!(0,d.accountBelongsToOrg)(A)||(0,h.isFreeTeamOrg)(A.organization)||(0,h.isDevTeamOrg)(A.organization))return[2,t];R=(0,h.hasFeature)(g.account.organization,s.OrganizationFeatures.ORGANIZATION_TEAM_LEVEL_WHITELIST),C=g.account.organization,P.label=1;case 1:return P.trys.push([1,3,,4]),[4,a.default.organizations.selectById(C.id).checkEmailsByWhiteList({emails:t,accountIds:R?[A.id]:void 0})];case 2:return T=P.sent(),[3,4];case 3:return O=P.sent(),l&&(0,p.statAutoClose)({attempt_id:l,invitee_count:e.emails.length,team_count:0}),[2,Promise.reject(O)];case 4:return 0===T.length?[2,t]:[4,(0,E.getDayPassesIfNeed)(A)];case 5:if(b=P.sent(),n===u.UserBoardRole.EDITOR&&!(0,E.inviteEditorAsExternalEnabled)(A,b))throw l&&(0,p.statValidationCustomErrorApi)({attempt_id:l,invitee_count:e.emails.length,error_name:"InviteEditorAsExternalNotEnabled",error_count:T.length,team_count:0}),void f.showCollaboratorCantShareBecauseUnableToShare({boardInfo:g,emails:t,from:"",attemptId:l,isSilentMode:v,onCloseWithoutOpeningChildWindows:_,sharingIntent:I},T);return N=o()(t,T),U=(0,m.hasPermission)(g,c.UserBoardPermission.SHARE_BOARD_FOR_NON_TEAM_USERS),y=(0,d.sharingWithExternalUsersEnabled)(A),R?[4,a.default.accounts.selectById(A.id).get({fields:E.SHARING_POLICY_ACCOUNT_INFO_FIELDS}).then((function(e){return e.sharingPolicy}))]:[3,7];case 6:(w=P.sent()).whiteListDomainsEnabled&&(y=w.sharingWithExternalUsersEnabled&&!!(null===A||void 0===A?void 0:A.inviteExternalUsersEnabled)),P.label=7;case 7:if(!y||!U)return[3,13];P.label=8;case 8:return P.trys.push([8,11,,12]),[4,f.showAddUsersOutsideWhitelistModal({boardInfo:g,emails:(0,i.__spreadArray)((0,i.__spreadArray)([],T,!0),N,!0),from:"",attemptId:l,onCloseWithoutOpeningChildWindows:_,isSilentMode:v,sharingIntent:I},T)];case 9:return B=P.sent(),l&&(0,p.statNotInAllowlistAction)({action:"share_anyway",attempt_id:l,invitee_count:e.emails.length,action_count:T.length}),[4,f.sendInvites(g,{emails:B,role:n,message:r,notification:e.notification,sharingIntent:e.sharingIntent},e.isSilentMode)];case 10:return P.sent(),[3,12];case 11:return F=P.sent(),l&&!F&&(0,p.statNotInAllowlistAction)({action:"cancel",attempt_id:l,invitee_count:e.emails.length,action_count:T.length}),F?F instanceof S.default?[2,Promise.reject(F)]:[2,Promise.reject((0,i.__assign)((0,i.__assign)({},F),{statName:"AddUsersOutsideWhitelistError"}))]:[2,Promise.reject(new Error("AddUsersOutsideWhitelistError"))];case 12:return[2,N];case 13:throw l&&(0,p.statValidationCustomErrorApi)({attempt_id:l,invitee_count:e.emails.length,error_name:"CheckEmailsByWhiteListInvitationError",error_count:T.length,team_count:0}),void f.showCollaboratorCantShareBecauseUnableToShare({boardInfo:g,emails:t,from:"",attemptId:l,isSilentMode:v,onCloseWithoutOpeningChildWindows:_},T)}}))}))}(P,e,C,O)})).then((function(e){return function(e,t,n){return(0,i.__awaiter)(this,void 0,Promise,(function(){var r,o,s,u,c,l,d,g,m;return(0,i.__generator)(this,(function(h){switch(h.label){case 0:return r=e.attemptId,o=e.boardInfo,s=e.handlers,u=e.onCloseWithoutOpeningChildWindows,c=e.isSilentMode,l=e.sharingIntent,(0,f.needRequestLicense)(n,o.account)&&o.account.organization?[4,a.default.organizations.selectById(o.account.organization.id).checkEmailStatus(t,E.EMAIL_USER_FIELD_DESC)]:[2,t];case 1:if(d=h.sent(),0===(g=(0,R.filterInviteesThatRequireLicense)({emails:t,emailMap:d,organization:o.account.organization})).length)return[2,t];h.label=2;case 2:return h.trys.push([2,4,,5]),[4,s.showSendRequestAndInviteForFreeRestrictedUsersModal({boardInfo:o,emails:t,from:"",attemptId:r,isSilentMode:c,onCloseWithoutOpeningChildWindows:u,sharingIntent:l},g)];case 3:return h.sent(),r&&(0,p.statRequestLicenseForFreeRestrictedAction)({attempt_id:r,action:"invite_and_request",action_count:g.length,invitee_count:e.emails.length}),[2,t];case 4:return(m=h.sent())?[2,Promise.reject((0,i.__assign)((0,i.__assign)({},m),{statName:"SendRequestAndInviteForFreeRestrictedUsersError"}))]:(r&&(0,p.statRequestLicenseForFreeRestrictedAction)({attempt_id:r,action:"cancel",action_count:g.length,invitee_count:e.emails.length}),[2,Promise.reject(m)]);case 5:return[2]}}))}))}(P,e,C)})).then((function(e){return function(e,t,n,i){return(0,E.splitEmailsByTakenSeats)(e.boardInfo.account,t).then((function(t){return(0,I.default)(e,t,n,i)})).then((function(){return(0,v.saveEmailsToLocalSuggestions)(t,(0,h.isSharingFromMentionsEnabled)(e.boardInfo.account.organization))})).then((function(){return t}))}(P,e,C,O)}))}function T(e){return e.organizationConnection&&(0,d.isInternalOrgMemberRole)(e.organizationConnection.role)}},182774:(e,t,n)=>{"use strict";n.d(t,{default:()=>E});var i=n(759312),r=n(896097),o=n(512351),a=n(742658),s=n(661529),u=n(957608),c=n(924348),l=n(576163),d=n(336),g=n(758516),m=n(922346),f=n.n(m),h=n(371678),_=n(943153),v=n(556091);function E(e,t,n,a){var s=e.boardInfo.account;return(0,l.isPersonalAccount)(s)?function(e,t,n,r){v.log("share","personal account strategy");var o=(0,i.__spreadArray)((0,i.__spreadArray)([],t.membersEmailsTakenSeats,!0),t.membersEmailsNoTakenSeats,!0),a=e.boardInfo,s=e.boardInfo.account,u=e.handlers,c=e.attemptId,l=e.onCloseWithoutOpeningChildWindows,d=e.isSilentMode;return(0,g.updateSeatsAndLimitsInfo)(s).then((function(){return(0,g.canInviteCollaboratorsToPersonalBoard)(a,o.length)?C(e,{emails:o,role:n,message:r}):(u.onCollaboratorsLimitReachedForPersonalBoard(e.boardsAPI,{boardInfo:a,emails:o,from:"",attemptId:c,isSilentMode:d,onCloseWithoutOpeningChildWindows:l}),Promise.reject(new h.default("personalAccountStrategy")))}))}(e,t,n,a):(0,l.canAddUsers)(s)?(0,l.isFreeAccount)(s)?function(e,t,n,i){return v.log("share","free account without trial with ADD_USERS strategy"),C(e,{emails:t.membersEmailsTakenSeats,role:n,message:i}).then((function(){return b(e,{emails:t.membersEmailsNoTakenSeats,inviteAsExternal:!1,inviteAsCommenters:!1},n,i)}))}(e,t,n,a):function(e,t,n,a){return(0,i.__awaiter)(this,void 0,Promise,(function(){var s,u,c,m,f,h=this;return(0,i.__generator)(this,(function(_){return v.log("share","paid account without trial with ADD_USERS strategy"),s=t.membersEmailsTakenSeats,u=t.membersEmailsNoTakenSeats,c=(0,i.__spreadArray)((0,i.__spreadArray)([],s,!0),u,!0),m=T(e),f=O(e,m),m||f&&(n===o.UserBoardRole.EDITOR||n===o.UserBoardRole.COOWNER)?[2,C(e,{emails:s,role:n,message:a}).then((function(){return(0,i.__awaiter)(h,void 0,void 0,(function(){var t,o,s,c,d;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return e.boardInfo.account.organization&&(0,l.isSelfServedOrganization)(e.boardInfo.account.organization)&&((0,g.isEditorRole)(n)||(0,g.isCoOwnerRole)(n))?[2,S(e,u,n,a)]:[3,1];case 1:return e.boardInfo.account.organization&&e.boardInfo.account.inviteExternalUsersEnabled&&!(0,l.canActorInviteToOrganization)(e.boardInfo.account)?[4,r.default.organizations.selectById(null===(d=e.boardInfo.account.organization)||void 0===d?void 0:d.id).checkEmailStatus(u,{organizationConnection:{deactivated:{},role:{}}})]:[3,3];case 2:for(c in t=i.sent(),o=[],s=[],t)I(t[c])?s.push(c):o.push(c);return[2,C(e,{emails:o,role:n,message:a}).then((function(){return p(e,s,n,a)}))];case 3:return[2,p(e,u,n,a)]}}))}))}))]:(v.log("share","add COMMENTERS and VIEWERS to paid team"),(0,d.areFreeExternalEditorsAvailableOnSelfServe)(e.boardInfo.account.organization)?[2,C(e,{emails:s,role:n,message:a}).then((function(){return R(e,u,n,a)}))]:[2,C(e,{emails:c,role:n,message:a})])}))}))}(e,t,n,a):function(e,t,n,r){var a=this;v.log("share","without ADD_USERS strategy");var s=t.membersEmailsTakenSeats,u=t.membersEmailsNoTakenSeats,c=(0,i.__spreadArray)((0,i.__spreadArray)([],t.membersEmailsTakenSeats,!0),t.membersEmailsNoTakenSeats,!0),m=e.attemptId,f=e.boardInfo,h=e.boardInfo.account,_=e.handlers,E=e.onCloseWithoutOpeningChildWindows,I=e.isSilentMode;return C(e,{emails:s,role:n,message:r}).then((function(){return(0,i.__awaiter)(a,void 0,void 0,(function(){var t,a,s,p,S;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:if(0===u.length)return v.log("share","membersEmailsNoTakenSeats.length === 0"),[2,Promise.resolve()];switch(t="viewers",n){case o.UserBoardRole.COOWNER:t="co-owners";break;case o.UserBoardRole.EDITOR:t="editors";break;case o.UserBoardRole.COMMENTATOR:t="commenters"}return a=T(e),s=O(e,a),(0,l.amITeamGuest)(f.account)?[2,_.showCanNotAddUsersOutsideTeamModal({boardInfo:e.boardInfo,emails:u,from:"",attemptId:m,isSilentMode:I,onCloseWithoutOpeningChildWindows:E},h,t)]:h.organization&&(0,d.areFreeExternalEditorsAvailableOnSelfServe)(h.organization)&&n===o.UserBoardRole.EDITOR?[2,R(e,u,n,r)]:a?[2,_.showCanNotInviteUsersToFreeTeamModal({boardInfo:e.boardInfo,emails:u,from:"",attemptId:m,isSilentMode:I,onCloseWithoutOpeningChildWindows:E},h,t)]:s&&n===o.UserBoardRole.EDITOR?[4,(0,g.getDayPassesIfNeed)(h)]:[3,2];case 1:return p=i.sent(),(0,g.inviteEditorAsExternalEnabled)(h,p)?[2,C(e,{emails:c,role:n,message:r})]:[2,_.showInviteAsCommentersModal({boardInfo:f,emails:u,from:"",attemptId:m,isSilentMode:I,onCloseWithoutOpeningChildWindows:E},t).then((function(t){return C(e,{emails:t.emails,role:o.UserBoardRole.COMMENTATOR,message:r})}))];case 2:return n!==o.UserBoardRole.COOWNER?[3,5]:h.organization&&(0,l.isSelfServedOrganization)(h.organization)&&_.showInviteCoOwnerModal?[4,(0,g.getDayPassesIfNeed)(h)]:[3,4];case 3:return S=i.sent(),[2,_.showInviteCoOwnerModal(h.organization,u,!0,h.inviteExternalUsersEnabled).then((function(t){var n=(null===S||void 0===S?void 0:S.selfServeEnabled)?o.UserBoardRole.EDITOR:o.UserBoardRole.COMMENTATOR;return C(e,{emails:t.emails,role:n,message:r})}))];case 4:if((0,l.isEnterprise)(h.organization))return[2,_.showInviteAsCommentersModal({boardInfo:f,emails:u,from:"",attemptId:m,onCloseWithoutOpeningChildWindows:E},t).then((function(t){return C(e,{emails:t.emails,role:o.UserBoardRole.COMMENTATOR,message:r})}))];i.label=5;case 5:return[2,C(e,{emails:c,role:n,message:r})]}}))}))}))}(e,t,n,a)}function I(e){return e.organizationConnection&&(0,l.isInternalOrgMemberRole)(e.organizationConnection.role)}function p(e,t,n,i){var o=e.boardInfo.account;return(0,g.updateSeatsAndLimitsInfo)(o).then((function(){return function(e,t,n){var i=e.handlers,r=e.boardInfo,o=e.attemptId,a=e.isSilentMode,s=e.onCloseWithoutOpeningChildWindows;if(!t||!t.length)return Promise.resolve({emails:[],inviteAsExternal:!1,inviteAsCommenters:!1});return i.selectUsersToAddThemToTeam({boardInfo:r,emails:t,from:"",attemptId:o,onCloseWithoutOpeningChildWindows:s,isSilentMode:a},t,n)}(e,t,n)})).then((function(n){return function(e,t,n){var i=e.handlers,o=e.boardInfo,u=e.onCloseWithoutOpeningChildWindows,c=e.isSilentMode,l=o.account.organization;if(!l||!function(e,t,n){return!n.inviteAsExternal&&t.length>0&&(0,d.isFreeRestrictedLicenseMembersPriorityEnabled)(e)&&!(0,d.hasFeature)(e,a.OrganizationFeatures.SUPPORT_TEAM_GUEST)}(l,t,n))return Promise.resolve(n);function m(e){return r.default.organizations.selectById(e).checkEmailStatus(t,g.EMAIL_USER_FIELD_DESC).then((function(e){return Object.keys(e).filter((function(t){return!e[t].organizationConnection}))}))}return m(l.id).then((function(n){if(n.length){var r=n.map((function(e){return{email:e,name:e,state:s.UserState.NOT_REGISTERED}}));return i.showSendRequestAndInviteForFreeRestrictedUsersModal({boardInfo:e.boardInfo,emails:t,from:"",attemptId:e.attemptId,isSilentMode:c,onCloseWithoutOpeningChildWindows:u},r)}})).then((function(){return n}))}(e,t,n)})).then((function(t){return b(e,t,n,i)}))}function S(e,t,n,i){var r=e.boardInfo.account.organization;return r&&(0,l.isSelfServedOrganization)(r)?n===o.UserBoardRole.COOWNER?A(e,t,n,i):(0,g.checkWhoCanBeGuestEditor)(e.boardInfo.account,t).then((function(r){var o=f()(t,r);return R(e,r,n,i).then((function(){return A(e,o,n,i)}))})):Promise.resolve()}function A(e,t,n,i){if(!t.length)return Promise.resolve();var r=e.boardInfo.account,o=e.handlers,a=r.organization;return a&&(0,l.isSelfServedOrganization)(a)?(0,g.updateSeatsAndLimitsInfo)(r).then((function(){return o.selectUsersToAddThemToTeam(e,t,n)})).then((function(t){return b(e,t,n,i)})):Promise.resolve()}function R(e,t,n,i){if(!t.length)return Promise.resolve();var r=e.boardInfo,o=e.handlers,a=r.account.organization;return a&&(0,l.isSelfServedOrganization)(a)?(0,g.loadBoardInfo)(e.boardsAPI,r.id).then((function(e){return o.showInviteGuestsDialog({boardInfo:e},t,n)})).then((function(t){return b(e,t,n,i)})):Promise.resolve()}function C(e,t){var n,r=(0,i.__assign)((0,i.__assign)({},t),{notification:e.notification,sharingIntent:e.sharingIntent});return(null===(n=t.emails)||void 0===n?void 0:n.length)?e.handlers.sendInvites(e.boardInfo,r,e.isSilentMode):Promise.resolve()}function T(e){return e.boardInfo.account.features.includes(c.AccountFeatures.ANY_BOARD_PARTICIPANT_MUST_HAVE_USER_ROLE)}function O(e,t){return e.boardInfo.account.features.includes(c.AccountFeatures.EDITOR_AND_OWNERS_MUST_HAVE_USER_ROLE)||t}function b(e,t,n,i){var s=e.boardInfo,c=e.handlers;if(!t.emails.length)return Promise.resolve();var l={emails:t.emails,role:n};return t.inviteAsCommenters?C(e,{emails:l.emails,role:o.UserBoardRole.COMMENTATOR,message:i}):t.inviteAsEditors?C(e,{emails:l.emails,role:o.UserBoardRole.EDITOR,message:i,askAdminToAddToTheTeam:t.askAdminToAddToTheTeam,messageToAdmin:t.messageToAdmin}):t.inviteAsExternal?C(e,{emails:l.emails,role:l.role,message:i}):function(e,t,n,i,o,s){var c,l=e.boardInfo,g=e.handlers,m=e.notification,f=e.sharingIntent;if(g.addUsersToTeam)return g.addUsersToTeam(t,n,i,o);var h={emails:i,boardId:n,message:o,boardRole:s,sharingIntent:f};(0,d.hasFeature)(null===(c=l.account)||void 0===c?void 0:c.organization,a.OrganizationFeatures.SHARING_FROM_MENTIONS)&&(h.notification=m);return h.membersFlowContext=(0,_.createInviteContext)(i,u.InviteInitiator.BOARD,e.inviteContext),r.default.accounts.selectById(t).invite(h)}(e,s.account.id,s.id,l.emails,i,n).then((function(){return c.onUsersAddedToTeam(l.emails.length,s)})).then((function(){return C(e,{emails:l.emails,role:l.role,message:i})}))}},943153:(e,t,n)=>{"use strict";n.d(t,{createInviteContext:()=>s,shouldAddMembersFlowContext:()=>a});var i=n(520574),r=n(818487),o=n(115361);function a(){return(0,r.default)().isEnabled(o.FeatureNames.EMAIL_INVITE_SEND_LICENSE_CHANGE_CONTEXT)}function s(e,t,n,r,o){if(void 0===r&&(r=i.MembersFlowContextType.INVITE),void 0===o&&(o=i.MembersFlowContextFeature.EMAIL),a()){var s={};return n&&Object.keys(n).forEach((function(t){e.includes(t)&&(s[t]=n[t])})),e.forEach((function(e){s[e]||(s[e]={entryPoint:t,type:r,feature:o})})),s}}},197130:(e,t,n)=>{"use strict";n.d(t,{filterInviteesThatRequireLicense:()=>u});n(182774);var i=n(115361),r=n(818487),o=n(336),a=n(73773),s=n(758516);function u(e){var t,n=e.emails,u=e.emailMap,c=e.organization;return t=(0,r.default)().isEnabled(i.FeatureNames.ROLLOUT_GUEST_FREE_RESTRICTED_INVITE)?function(e){return(0,s.doesUserRequireLicense)(e,c)}:(0,o.shouldRequestLicenseForNonTeamFreeRestricted)(c)?s.isFreeRestricted:s.isFreeRestrictedOrgMember,n.map((function(e){return u[e]})).filter((0,a.hasNotNullableFieldsPredicate)("organizationConnection")).filter((function(e){return t(e.organizationConnection)})).map((function(e){return e.organizationConnection.user}))}},758516:(e,t,n)=>{"use strict";n.d(t,{EMAIL_USER_FIELD_DESC:()=>I,SHARING_POLICY_ACCOUNT_INFO_FIELDS:()=>i.SHARING_POLICY_ACCOUNT_INFO_FIELDS,attemptInviteWithSharingIntentSignal:()=>D,canInviteCollaboratorsToPersonalBoard:()=>A,checkWhoCanBeGuestEditor:()=>S,doesUserRequireLicense:()=>b,fetchOrganizationFieldsIfNeeded:()=>r.fetchOrganizationFieldsIfNeeded,getDayPassesIfNeed:()=>R,inviteEditorAsExternalEnabled:()=>W,isCoOwnerAvailableInShare:()=>C,isCoOwnerRole:()=>y,isEditorRole:()=>U,isFreeRestricted:()=>T,isFreeRestrictedNonTeam:()=>N,isFreeRestrictedOrgMember:()=>O,loadBoardInfo:()=>r.loadBoardInfo,loadBoardUserConnections:()=>r.loadBoardUserConnections,onInvitationsSent:()=>w,onLinkCopied:()=>F,onShareModalCanceled:()=>B,onUpgradePricingModalCanceled:()=>P,prepareSharingInfo:()=>r.prepareSharingInfo,splitEmailsByTakenSeats:()=>p,startViewChangedSignal:()=>L,startViewClosedSignal:()=>M,startViewOpenedSignal:()=>z,updateSeatsAndLimitsInfo:()=>k});var i=n(828695),r=n(158832),o=n(285087),a=n(896097),s=n(742658),u=n(576163),c=n(922346),l=n.n(c),d=n(827921),g=n.n(d),m=n(337189),f=n(481081),h=n(872426),_=n(512351),v=n(350526),E=n(336),I={organizationConnection:{user:{name:{},email:{},state:{}},license:{},role:{}}};function p(e,t){return a.default.accounts.selectById(e.id).checkWhoTakenSeats({emails:t}).then((function(e){return{membersEmailsTakenSeats:g()(t.map((function(e){return e.toLowerCase()})),e),membersEmailsNoTakenSeats:l()(t.map((function(e){return e.toLowerCase()})),e)}}))}function S(e,t){return a.default.accounts.selectById(e.id).checkWhoCanBeGuestEditor({emails:t})}function A(e,t){return t+e.participantsNumber<=e.account.limits.usersPerBoard}function R(e){if((0,u.accountBelongsToOrg)(e)&&(0,u.canUseDayPasses)(e.organization))return a.default.organizations.selectById(e.organization.id).dayPasses()}function C(e){var t,n,i,r;return!(0,E.isFreeTeamOrg)(null===(t=null===e||void 0===e?void 0:e.account)||void 0===t?void 0:t.organization)&&!(0,E.isDevTeamOrg)(null===(n=null===e||void 0===e?void 0:e.account)||void 0===n?void 0:n.organization)&&((0,m.canSetCoOwners)(e)&&((0,u.isSelfServedOrganization)(null===(i=null===e||void 0===e?void 0:e.account)||void 0===i?void 0:i.organization)||(0,u.isEducationAccount)(null===e||void 0===e?void 0:e.account)||(0,u.isEnterprise)(null===(r=null===e||void 0===e?void 0:e.account)||void 0===r?void 0:r.organization)))}function T(e){return e.license===f.UserOrganizationLicense.FREE_RESTRICTED}function O(e){return e.license===f.UserOrganizationLicense.FREE_RESTRICTED&&e.role!==h.UserOrganizationRoles.ORGANIZATION_EXTERNAL_USER}function b(e,t){switch(e.role){case h.UserOrganizationRoles.ORGANIZATION_EXTERNAL_USER:case h.UserOrganizationRoles.ORGANIZATION_TEAM_GUEST_USER:return(0,E.isFreeRestrictedLicenseMembersPriorityEnabled)(t);case h.UserOrganizationRoles.ORGANIZATION_INTERNAL_ADMIN:case h.UserOrganizationRoles.ORGANIZATION_INTERNAL_USER:return e.license===f.UserOrganizationLicense.FREE_RESTRICTED;default:return!1}}function N(e){return e.license===f.UserOrganizationLicense.FREE_RESTRICTED&&e.role===h.UserOrganizationRoles.ORGANIZATION_EXTERNAL_USER}function U(e){return e===_.UserBoardRole.EDITOR}function y(e){return e===_.UserBoardRole.COOWNER}var w=new o.default.Signal,B=new o.default.Signal,F=new o.default.Signal,P=new o.default.Signal,L=new o.default.Signal,z=new o.default.Signal,M=new o.default.Signal,D=new o.default.Signal;function k(e){return(0,v.getSeatsAndLimitsInfo)(e.id).then((function(t){e.organization&&Object.assign(e.organization,t.organization),e.usersNumber=t.usersNumber,e.limits=t.limits}))}function W(e,t){return(0,u.accountBelongsToOrg)(e)&&e.inviteExternalUsersEnabled&&((0,E.hasFeature)(e.organization,s.OrganizationFeatures.GUEST_USERS_FREE_OF_CHARGE)||(0,u.dayPassesActivated)(t))}},828695:(e,t,n)=>{"use strict";n.d(t,{BOARD_CONNECTION_FIELDS:()=>u,ORGANIZATION_FIELDS:()=>o,SHARE_BOARD_INFO_FIELDS:()=>s,SHARING_POLICY_ACCOUNT_INFO_FIELDS:()=>c});var i=n(502009),r={id:{},title:{},features:{},type:{},currentUserPermission:{},sharingPolicySettings:{},security:{accountsVisibilityRestrictionEnabled:{}},remainingFullLicenseNumber:{},fullUsersLimit:{},invitationRights:{whoCanInvite:{}},accessRequestsManagement:{},dataClassification:{}},o=i.FieldType.createFieldStr(r),a={id:{},title:{},ownerConnection:{accountConnection:{organizationConnection:{license:{},deactivated:{}}},user:{id:{},name:{},email:{},picture:{size44:{}}}},picture:{},ownerName:{},ownerEmail:{},currentUserContext:{user:{id:{}},role:{},permissions:{}},sharingPolicy:{},sharingPolicyOnAccount:{},sharingPolicyOnOrganization:{},lockedByAccountExpired:{},lockedByUsersPerBoardLimitExceeded:{},lockedByUsersPerAccountLimitExceeded:{},lockedByBoardsPerAccountLimitExceeded:{},lockedByActiveBoardsPerAccountLimitExceeded:{},inviteToAccountAndBoardLink:{},hasPublicAccessPassword:{},copyAccessLevel:{},project:{id:{},title:{}},participantsNumber:{},account:{id:{},role:{},type:{},title:{},name:{},features:{},expired:{},expirationDate:{},limits:{},whoCanInvite:{},permissions:{},creatorId:{},trial:{},invitationLink:{},inviteExternalUsersEnabled:{},participantPostInvitationPaymentTest:{},organization:r,collaborationSettings:{},domainProps:{array:!0,fields:{domainName:{},email:{},confirmed:{}}},usersNumber:{},boardsNumber:{}},whoChangedPassword:{},dataClassification:{},personalBoard:{}},s=i.FieldType.createFieldStr(a),u=i.FieldType.createFieldStr({user:{name:{},id:{},email:{},state:{},picture:{size44:{}}},id:{},role:{}}),c=i.FieldType.createFieldStr({sharingPolicy:{}})},227072:(e,t,n)=>{"use strict";n.d(t,{createSuggestionsProvider:()=>_,saveEmailsToLocalSuggestions:()=>h});var i=n(941496),r=n(863037),o=n(247111),a=n(689628),s=n(683304),u=n(729818),c=n(336),l=new u.default("SuggestionProvider"),d=new a.default,g=new o.default("SharingSuggestionProvider"),m=new s.default;m.configure([new r.default,l,d],i.isSuggestionMatchedString,i.suggestionsDuplicatesCleanerWithHigherAvatarPriority);var f=new s.default;function h(e,t){e.forEach((function(e){r.default.addEmail(e),t?f.appendSuggestionToCache((0,i.createLocalUserSuggestion)(e)):m.appendSuggestionToCache((0,i.createLocalUserSuggestion)(e))}))}function _(e,t,n,i){return(0,c.isSharingFromMentionsEnabled)(n.organization)?(f.clearCachedResults(),d.setAuthChecker(i),g.reset(),g.configureBoardsAPI(e),g.setBoardId(t),g.setAccount(n),f):(m.clearCachedResults(),d.setAuthChecker(i),l.setAccount(n),m)}f.configure([new r.default,g,d],i.isMentionMatchedString,i.suggestionsDuplicatesCleanerWithHigherAvatarPriority,void 0,i.suggestionsRanker,i.suggestionsComparator)},158832:(e,t,n)=>{"use strict";n.d(t,{createSuggestionsProvider:()=>i.createSuggestionsProvider,fetchOrganizationFieldsIfNeeded:()=>a,loadBoardInfo:()=>s,loadBoardUserConnections:()=>u,prepareSharingInfo:()=>d});var i=n(227072),r=n(896097),o=n(828695);function a(e){return e.organization?r.default.organizations.selectById(e.organization.id).get({fields:o.ORGANIZATION_FIELDS}):Promise.resolve(e.organization)}function s(e,t){return e.selectById(t).get({fields:o.SHARE_BOARD_INFO_FIELDS})}function u(e,t,n,i){return e.selectById(t).userConnections({}).get({limit:n,offset:i,fields:o.BOARD_CONNECTION_FIELDS})}var c=n(576163),l=n(337189);function d(e,t,n){return s(e,t).then((function(e){var t,i;return(0,l.canViewShareModal)(e)||null===(t=n.showErrorThatUserCannotShare)||void 0===t||t.call(n),(0,c.isTeamAccountAndIAmNotTeamMember)(e.account)&&!(0,l.canEditUsers)(e)?(null===(i=n.showWarningForTeamBoardsIfUserNotTeamMember)||void 0===i||i.call(n,e.account.name),Promise.reject(new Error("!isTeamAccountAndIAmNotTeamMember"))):Promise.resolve(e)})).then(n.sharePersonalBoardWithTeam).then(n.changeDefaultBoardTitle).then(n.preloadReceiverIfNeed)}},319409:(e,t,n)=>{"use strict";n.d(t,{isEditingRole:()=>c,needRequestLicense:()=>l});var i=n(512351),r=n(742658),o=n(576163),a=n(336),s=[i.UserBoardRole.OWNER,i.UserBoardRole.COOWNER,i.UserBoardRole.EDITOR],u=[r.OrganizationFeatures.FREE_RESTRICTED_LICENSE_MEMBERS,r.OrganizationFeatures.FREE_RESTRICTED_EXPANSION],c=function(e){return s.includes(e)},l=function(e,t){return c(e)&&(0,o.accountBelongsToOrg)(t)&&(n=t.organization,u.some((function(e){return(0,a.hasFeature)(n,e)})));var n}},247111:(e,t,n)=>{"use strict";n.d(t,{default:()=>v});var i=n(759312),r=n(502009),o=n(872426),a=n(742658),s=n(941496),u=n(994689),c=n(896097),l=n(248459),d=n(729818),g=n(576163),m=n(336),f=n(818487),h=n(115361),_=r.FieldType.createFieldStr({id:{},email:{},name:{},picture:{size44:{},size210:{}}});const v=function(e){function t(t){var n=e.call(this)||this;return n.users=[],n.allSuggestionsLoaded=!1,n.place=t,n}return(0,i.__extends)(t,e),t.prototype.configureBoardsAPI=function(e){this.getBoardsAPI=e},t.prototype.setBoardId=function(e){this.boardId=e},t.prototype.setAccount=function(e){this.account=e},t.prototype.getSuggestions=function(e,t){if(!this.boardId)return Promise.reject(new Error("OrganizationUsersSuggestionsSource requires boardId to be set."));if(!this.account)return Promise.reject(new Error("OrganizationUsersSuggestionsSource requires account to be set."));e=e.toLowerCase();var n=(0,l.globalTracer)().startSpan(e?"BoardOrgSuggestions":"AllBoardOrgSuggestions");n.setTag("place",this.place);var r=this.sendRequestForUsers(t,e,n),o=this.sendRequestForTeamGuestsFromAccount(t,e,n);return Promise.all([r,o]).then((function(e){var t=e[0],n=e[1];return(0,i.__spreadArray)((0,i.__spreadArray)([],t,!0),n,!0)})).catch((function(){return[]})).finally((function(){return n.finish()}))},t.prototype.getAllSuggestions=function(){var e=this;if(!this.boardId)return Promise.reject(new Error("OrganizationUsersSuggestionsSource requires boardId to be set."));if(!this.account)return Promise.reject(new Error("OrganizationUsersSuggestionsSource requires account to be set."));if(this.allSuggestionsLoaded)return Promise.resolve(this.users);var t=(0,l.globalTracer)().startSpan("AllBoardOrgSuggestions");return t.setTag("preload",!0),t.setTag("place",this.place),this.getSuggestions("",10).then((function(t){return e.users=t,e.allSuggestionsLoaded=!0,e.users})).finally((function(){return t.finish()}))},t.prototype.sendRequestForUsers=function(e,t,n){return void 0===t&&(t=""),this.getBoardsAPI().selectById(this.boardId).suggestions({fields:_,deactivated:!1,orgRoles:[o.UserOrganizationRoles.ORGANIZATION_INTERNAL_ADMIN,o.UserOrganizationRoles.ORGANIZATION_INTERNAL_USER]},t).get({limit:e,sort:"name"},n).then((function(e){return e.data.map((function(e){return(0,s.createCompanyUserSuggestion)(e)}))}))},t.prototype.sendRequestForTeamGuestsFromAccount=function(e,t,n){if(void 0===t&&(t=""),!(0,m.hasFeature)(this.account.organization,a.OrganizationFeatures.SUPPORT_TEAM_GUEST))return Promise.resolve([]);var i=(0,f.default)().isEnabled(h.FeatureNames.SEARCH_BY_NAME_SHORT_TERM)&&(0,m.hasFeature)(this.account.organization,a.OrganizationFeatures.USE_ACCOUNT_USERS_LIST_ENDPOINT),r=c.default.accounts.selectById(this.account.id),o={fields:d.ACCOUNT_USERS_FIELD,roles:g.accountMembersAndTeamGuestRoles};return i&&(null===n||void 0===n||n.setTag("team-endpoint","users-list")),(i?r.usersList(o,n):r.userConnections(o,n)).get({limit:e,sort:"name",search:t},n).then((function(e){return e.data.map((function(e){return(0,s.createUserSuggestion)(e.user)}))}))},t.prototype.reset=function(){this.users=[],this.allSuggestionsLoaded=!1},t}(u.default)},689628:(e,t,n)=>{"use strict";n.d(t,{default:()=>s});var i=n(759312),r=n(896097),o=n(994689),a=n(248459);const s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.__extends)(t,e),t.prototype.getSuggestions=function(e,t){var n=this;return new Promise((function(i){if(n.isUserAuthorized&&n.isUserAuthorized()){var o=(0,a.globalTracer)().startSpan(e?"SocialContactsSuggestions":"AllSocialContactsSuggestions");r.default.social.searchContacts(e,t,o).then(i).catch((function(){return i([])})).finally((function(){return o.finish()}))}else i([])}))},t.prototype.getAllSuggestions=function(){return Promise.resolve([])},t.prototype.setAuthChecker=function(e){this.isUserAuthorized=e},t}(o.default)},683304:(e,t,n)=>{"use strict";n.d(t,{default:()=>c});var i=n(759312),r=n(530454),o=n.n(r),a=n(941496),s=0,u=function(e,t){return-1!=e.indexOf(t)};const c=function(){function e(){this.cachedResultsByQuery={},this.sources=[],this.cacheEnabled=!0,this.sourceLimit=10,this.suggestionsLimit=5}return e.prototype.configure=function(e,t,n,i,r,o){void 0===i&&(i=u),this.comparer=i,this.validator=t,this.duplicatesCleaner=n,this.ranker=r,this.sortComparator=o,this.setSources(e)},e.prototype.setSources=function(e){var t=this;this.sources=e,this.sources.forEach((function(e){return e.validator=t.validator}))},e.prototype.setSuggestionsLimit=function(e){this.suggestionsLimit=e},e.prototype.getSuggestions=function(e){var t=this;if(e=e.toLowerCase().trim(),0==this.sources.length)return Promise.reject(new Error("SuggestionsProvider must have at least one source"));if(0==e.length)return Promise.resolve(this.wrapSuggestions([]));if(this.cacheEnabled){var n=this.findCachedResult(e);return n&&n.query==e?Promise.resolve(this.wrapSuggestions(n.data)):n&&n.allSourcesExhausted?Promise.resolve(this.wrapSuggestions(this.findSuggestionsInResult(e,n))):this.getSuggestionsFromSources(e).then((function(e){return t.wrapSuggestions(e)}))}return this.getSuggestionsFromSources(e).then((function(e){return t.wrapSuggestions(e)}))},e.prototype.getAllSuggestions=function(e){var t=this;void 0===e&&(e=!0);var n=this.sources.map((function(e){return e.getAllSuggestions()}));return Promise.all(n).then((function(e){return t.removeDuplicates([].concat.apply([],e))})).then((function(n){return t.wrapSuggestions(n,e)}))},e.prototype.clearCachedResults=function(){this.cacheEnabled&&(this.cachedResultsByQuery={})},e.prototype.appendSuggestionToCache=function(e){for(var t in this.cachedResultsByQuery)this.validator(e,t)&&this.cachedResultsByQuery[t].data.push(e)},e.prototype.findCachedResult=function(e){var t="";for(var n in this.cachedResultsByQuery)this.comparer(e,n)&&n.length>t.length&&(t=n);return""==t?null:this.cachedResultsByQuery[t]},e.prototype.findSuggestionsInResult=function(e,t){var n=this;return o()(t.data).filter((function(t){return n.validator(t,e)}))},e.prototype.wrapSuggestions=function(e,t){void 0===t&&(t=!0);var n=t?e.slice(0,this.suggestionsLimit):e;return{id:++s,data:o()(n)}},e.prototype.getSuggestionsFromSources=function(e){var t=this,n=this.sources.map((function(n){return n.getSuggestions(e,t.sourceLimit)}));return Promise.all(n).then((function(n){var r=t.removeDuplicates([].concat.apply([],n));t.ranker&&(r=r.map((function(n){var r;return(0,i.__assign)((0,i.__assign)({},n),((r={})[a.RANK_KEY]=t.ranker(n,e),r))}))),t.sortComparator&&(r=r.sort(t.sortComparator));var o={query:e,allSourcesExhausted:n.every((function(e){return e.length<t.sourceLimit})),data:r};return t.cacheResult(o),r}))},e.prototype.cacheResult=function(e){this.cacheEnabled&&(this.cachedResultsByQuery[e.query]=e)},e.prototype.removeDuplicates=function(e){return this.duplicatesCleaner(e)},e}()},729818:(e,t,n)=>{"use strict";n.d(t,{ACCOUNT_USERS_FIELD:()=>h,default:()=>_});var i=n(759312),r=n(941496),o=n(994689),a=n(896097),s=n(576163),u=n(336),c=n(742658),l=n(661529),d=n(248459),g=n(502009),m=n(818487),f=n(115361),h=g.FieldType.createFieldStr({id:{},user:{id:{},email:{},name:{},picture:{size44:{},size210:{}}}});const _=function(e){function t(t){var n=e.call(this)||this;return n.withInvites=!0,n.users=[],n._teamUsersNumber=0,n.place=t,n}return(0,i.__extends)(t,e),Object.defineProperty(t.prototype,"teamUsersNumber",{get:function(){return this._teamUsersNumber},enumerable:!1,configurable:!0}),t.prototype.getSuggestions=function(e,t){e=e.toLowerCase();var n=(0,d.globalTracer)().startSpan(e?"TeamUsersSuggestions":"AllTeamUsersSuggestions");return n.setTag("place",this.place),this.sendRequestForUsers(this.account.id,t,e,n).catch((function(){return[]})).finally((function(){return n.finish()}))},t.prototype.sendRequestForUsers=function(e,t,n,i){var o=this,d=(0,u.hasFeature)(this.account.organization,c.OrganizationFeatures.SUPPORT_TEAM_GUEST)?s.accountMembersAndTeamGuestRoles:s.accountMemberRoles,g=(0,m.default)().isEnabled(f.FeatureNames.SEARCH_BY_NAME_SHORT_TERM)&&(0,u.hasFeature)(this.account.organization,c.OrganizationFeatures.USE_ACCOUNT_USERS_LIST_ENDPOINT),_=a.default.accounts.selectById(e),v={fields:h,roles:d,filter:this.withInvites?void 0:l.UserState.REGISTERED};return g&&(null===i||void 0===i||i.setTag("endpoint","users-list")),(g?_.usersList(v,i):_.userConnections(v,i)).get({search:n,limit:t},i).then((function(e){return n&&""!==n||(o._teamUsersNumber=e.size,(0,s.amIAccountMember)(o.account)&&o._teamUsersNumber--),e.data.map((function(e){return(0,r.createUserSuggestion)(e.user)}))}))},t.prototype.getAllSuggestions=function(){var e=this;if(0===this.users.length){var t=(0,d.globalTracer)().startSpan("AllTeamUsersSuggestions");return t.setTag("place",this.place),t.setTag("preload",!0),this.sendRequestForUsers(this.account.id,10,void 0,t).then((function(t){return e.users=t,e.users})).finally((function(){return t.finish()}))}return Promise.resolve(this.users)},t.prototype.setAccount=function(e,t){void 0===t&&(t=!0),this.account=e,this.withInvites=t},t.prototype.reset=function(){this.users=[]},t}(o.default)},520574:(e,t,n)=>{"use strict";var i,r;n.d(t,{MembersFlowContextFeature:()=>i,MembersFlowContextType:()=>r}),function(e){e.ACCESS_BOARD="access_board",e.EMAIL="email",e.JOIN_TEAM_ACCESS_DENIED="join_team_access_denied",e.JOIN_TEAM_SIDEBAR="join_team_sidebar",e.JOIN_TEAM_PERMISSIONS="join_team_permissions",e.CREATE_BOARD="create_board",e.TEAM_DISCOVERY="team_discovery",e.MEMBER_ASK="member_ask",e.EDIT_COMMENT_BOARD="edit_comment_board",e.JOIN_TEAM_CREATE_BOARD="join_team_create_board",e.GUEST_BANNER="guest_banner",e.BULK_ACTION="bulk_action",e.TRIPLE_DOTS="triple_dots"}(i||(i={})),function(e){e.INVITE="invite",e.REQUEST="request",e.UPGRADE="upgrade"}(r||(r={}))}}]);
//# sourceMappingURL=https://miro.com/app/static/cmn~Billing~Board~Dashboa.desktop~Invitat~ShareAndInvite~TeamDiscove~Welcome~lazyTabletAppConnect.f540ead768b6465d.js.map