nullpointerecho.notion.site Open in urlscan Pro
2606:4700:4400::6812:2009  Public Scan

URL: https://nullpointerecho.notion.site/5830-b37578cd217e5e62294d.js
Submission: On September 23 via api from LU — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

"use strict";(self.webpackChunknotion_next=self.webpackChunknotion_next||[]).push([[5830],{48298:(e,t,s)=>{s.d(t,{kn:()=>p,kj:()=>g,Tr:()=>h});var i=s(58129),o=s(90468),n=s(19889),r=s(50906),a=s(54642),l=s(76464),d=s(9953),u=s(30149),m=s(87082),c=s(98905);const p=async e=>{const{environment:t,store:s,accessRequestStore:i,forActor:o,status:a,from:m}=e,c=t.currentUser.id;if("approved"===a){const e={type:"existingUser",value:o,spaceRole:"read_and_write"};if(!(await l.n_({environment:t,store:s,inviteTargets:[e],inviteRole:"read_and_write",isOnboarding:!1,invite:{inviteOrigin:"membership_request"}})).success)return}u.createAndCommit({userAction:"GrantAccessActivityAction.handleGrantAccess",environment:t,perform:e=>{d.sW({store:i,transaction:e,data:{granted_time:Date.now(),granted_by_table:n.KJ,granted_by_id:c,resolved_time:Date.now(),resolved_by_table:n.KJ,resolved_by_id:c,status:a}})}}),r.O8I(t,{status:a,request_id:i.id,from:m,for_actor_id:o.id,space_role:s.getRole()})};async function g(e){if(c.Z.reset(),!e.canAdmin)return;const{environment:t,spaceId:s}=e,i=await a.getUnreadAccessRequestCount(t,{parentTable:o.bx,parentId:s,size:1});"success"===i.type&&c.Z.setState({spaceId:s,count:i.data.count})}function h(e,t){const s=new Map;for(const o of t){const t=(0,m.Kv)(e,{table:i.J8,id:o}),r=t.getValue();if(!r)continue;if(r.for_actor_table!==n.KJ||r.created_by_table!==n.KJ)continue;const a=(0,m.Kv)(e,{table:r.for_actor_table,id:r.for_actor_id}).getValue();if(!a)continue;const l=(0,m.Kv)(e,{table:r.created_by_table,id:r.created_by_id}).getValue();if(l)if(s.has(r.for_actor_id)){const e=s.get(r.for_actor_id);if(!e)continue;r.created_time>e.latestRequestTime?s.set(r.for_actor_id,{...e,createdByActorsWithReason:[{actor:l,reason:r.message},...e.createdByActorsWithReason],accessRequest:r,accessRequestStore:t,latestRequestTime:r.created_time}):s.set(r.for_actor_id,{...e,createdByActorsWithReason:[...e.createdByActorsWithReason,{actor:l,reason:r.message}]})}else s.set(r.for_actor_id,{forActor:a,createdByActorsWithReason:[{actor:l,reason:r.message}],accessRequest:r,accessRequestStore:t,latestRequestTime:r.created_time})}return Array.from(s.values())}},95209:(e,t,s)=>{s.d(t,{zK:()=>C,Mr:()=>k,eH:()=>I,qg:()=>Z,kL:()=>_,PV:()=>P,Vu:()=>F,M5:()=>x,jC:()=>R,XC:()=>G,jL:()=>B});var i=s(96486),o=s.n(i),n=s(33728),r=s(27006),a=s(29477),l=s(21202),d=s(90468),u=s(97880),m=s(76464),c=s(31299),p=s(79817),g=s(75472),h=s(65598),v=s(23537),f=s(79315),b=s(85834),y=s(29677),S=s(50906),M=s(54642),w=s(57688),T=s(93678);const C=async e=>{const{environment:t,store:s,sudoModeStore:i,permissionsInviteStore:o,onInviteStart:a,contextualInviteStore:c,inviteOrigin:p}=e,{tokenQuery:v}=o.state;if((0,n.oH)(v.trim())&&(o.state.isInviteTargetsEmpty||!(0,y.ow)(o.state))){const e={type:"newUser",value:{email:v.trim()},source:"email"};g.Nd({target:e,permissionsInviteStore:o})||o.setState({...o.state,inviteTargets:[...o.state.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:""})}if(!o.state.isInviteTargetsEmpty&&o.state.inviteTargets.length>0){null==a||a();const e=o.state;if((0,y.ow)(e)){if(e.table===l.iU){if(!(0,h.NZ)(s))throw new Error("Table mismatch.");const{inviteTargets:n,flowId:r,emailMessage:a}=e;o.reset();return(await m.n_({environment:t,store:s,sudoModeStore:i,inviteTargets:n,inviteRole:void 0,isOnboarding:!1,invite:{inviteFlowId:r,inviteMessage:a,inviteOrigin:p}})).success}if(e.table===d.bx){if(!(0,h.Mm)(s))throw new Error("Table mismatch.");const{inviteTargets:n,inviteRole:r,flowId:a}=e;o.reset();return(await m.n_({environment:t,store:s,sudoModeStore:i,inviteTargets:n,inviteRole:r,isOnboarding:!1,invite:{inviteFlowId:a,inviteOrigin:p}})).success}(0,u.t1)(e)}else{const{inviteRole:n,flowId:a,emailMessage:l}=e;o.reset();const d=function(e,t){const s=new Set;var i;(0,h.Y)(e)?null===(i=e.getPermissionItems())||void 0===i||i.forEach((e=>{(0,r.jg)(e)&&s.add(e.user_id)})):e.getPermissionItems().forEach((e=>{(0,r.jg)(e)&&s.add(e.user_id)}));return t.filter((e=>"existingUser"!==e.type||!s.has(e.value.id)))}(s,e.inviteTargets);if((0,r.iC)(n)){const e=await m.n_({environment:t,store:s,sudoModeStore:i,inviteTargets:d,inviteRole:n,isOnboarding:!1,invite:{inviteFlowId:a,inviteMessage:l,inviteOrigin:p}});return e.success&&(null==c||c.setState({...null==c?void 0:c.state,invitedEmailToUserIdMap:e.invitedUsers})),e.success}if((0,h.Y)(s)&&(0,y.Db)(e))return await m.GQ({environment:t,store:s,inviteTargets:e.inviteTargets,inviteRole:n,createNewTeamFlowId:a})}}return!0};const k=e=>{e.permissionsInviteStore.setState({...e.permissionsInviteStore.state,modalOpen:!1,flowId:void 0})},I=e=>{const{permissionsInviteStore:t,contextualInviteStore:s}=e;if(!s)return;const i=[];t.state.inviteTargets.forEach((e=>{if("newUser"===e.type)i.push({email:e.value.email,isGuest:!0});else if("existingUser"===e.type){const t={...e.value,email:e.value.email,isGuest:"none"===e.spaceRole||"not_in_space"===e.spaceRole};i.push(t)}})),s.setState({...s.state,invitedUsers:i})},Z=async e=>{const{environment:t,store:s,sudoModeStore:i,permissionsInviteStore:o,contextualInviteStore:n,onInviteClick:r,onInviteComplete:a,inviteOrigin:l,intl:d}=e,{currentSpaceStore:u}=f.default.state;if((0,v.$)(t)&&(null==n?void 0:n.state.selection)===b.uq.workspace_member&&u){if(!(await w.HD({environment:t,flowId:o.state.flowId||"",trackCreateTeamComplete:!1})))return;I({permissionsInviteStore:o,contextualInviteStore:n}),await(0,p.j_)({environment:t,spaceStore:u,contextualInviteStore:n,from:"share_menu",intl:d})}else I({permissionsInviteStore:o,contextualInviteStore:n});let m=!1;try{m=await C({environment:t,store:s,sudoModeStore:i,permissionsInviteStore:o,contextualInviteStore:n,onInviteStart:()=>{null==r||r()},inviteOrigin:l})}catch(c){}finally{null==a||a(m)}},_=async e=>{const{environment:t,permissionsInviteStore:s,from:i}=e;await g.Aw({environment:t,permissionsInviteStoreState:s.state,from:i})||s.reset()},P=e=>{const{permissionsInviteStore:t,targetToRemove:s,defaultRoleForNonBot:i}=e;if(!t.state.isInviteTargetsEmpty)if((0,y.ow)(t.state))if((0,y.ow)(t.state)){const e=t.state.inviteTargets.filter((e=>e!==s));0===e.length?t.setState({...t.state,inviteTargets:[],inviteRole:i,isInviteTargetsEmpty:!0}):t.setState({...t.state,inviteTargets:e})}else(0,u.t1)(t.state);else{const e=t.state.inviteTargets.filter((e=>e!==s));0===e.length?t.setState({...t.state,inviteTargets:[],inviteRole:i,isInviteTargetsEmpty:!0}):t.setState({...t.state,inviteTargets:e})}},F=e=>{const{environment:t,onUpgradeButtonClick:s,upgradeButtonName:i}=e;T.y(t,{from:i,for:"plus"}),null==s||s()};async function x(e,t){const s=new Set(t),i=Array.from(s).map((async t=>{const s=await M.findUser(e,{email:t});if("success"===s.type){const e=s.data;if(e.value){return{type:"existingUser",value:e.value.value}}}return{type:"newUser",value:{email:t},source:"email"}}));return await Promise.all(i)}const R=async e=>{const t="invitee",{environment:s,permissionsInviteStore:i,event:o}=e;if(!i.state.isInviteTargetsEmpty&&(0,y.ow)(i.state)){const e=o.target.value;i.setState({...i.state,inputFocus:t,tokenQuery:e})}else{const e=o.target.value,{extractedEmails:r,newInputValue:a}=(0,n.zI)(e),l=(await x(s,r)).filter((e=>!g.Nd({target:e,permissionsInviteStore:i}))),d=[...i.state.inviteTargets,...l];d.length>0?i.setState({...i.state,inviteTargets:d,isInviteTargetsEmpty:!1,inputFocus:t,tokenQuery:a}):i.setState({...i.state,inviteTargets:[],isInviteTargetsEmpty:!0,inputFocus:t,tokenQuery:a})}},G=e=>{const{environment:t,newRole:s,permissionsInviteStore:i}=e,{state:o}=i;S.TCs(t,{...g.a_(t,o),invite_updated_role:s}),!o.isInviteTargetsEmpty&&(0,y.ow)(o)||i.setState({...o,inviteRole:s})},B=async e=>{const{query:t,environment:s,sectionLimit:i,intl:n,membersOnly:r}=e,{currentSpaceStore:l}=f.default.state;if(!l)return{inviteUsers:[],inviteBots:[],inviteGroups:[]};const{userLimit:d,botLimit:u,groupLimit:m,importContactLimit:p}=i,[g,h,v,{user:b,email:y},S]=await Promise.all([d>0?c.Yu({environment:s,query:t,membersOnly:r}):[],u>0?c.RF({environment:s,query:t}):[],m>0?c.$w({query:t,intl:n}):[],c.yy(s,t),p>0?Promise.race([M.searchContacts(s,{spaceId:l.id,limit:p,query:t}),(0,a.Xb)(1500,void 0)]):void 0]),w=g.slice(0,d).map((e=>({type:"existingUser",value:e}))),T=h.slice(0,u).map((e=>({type:"bot",value:e}))),C=v.slice(0,m).map((e=>({type:"group",value:e})));b&&w.unshift({type:"existingUser",value:b}),y&&w.unshift({type:"newUser",value:{email:y},source:"email"});let k=[];return S&&"success"===S.type&&(k=S.data.contacts.map((e=>({type:"newUser",value:{email:e.email,name:e.name,avatar_url:e.profile_photo},source:e.type})))),{inviteUsers:o().uniqBy(w,(e=>e.value.email)),inviteBots:T,inviteGroups:C,importedContacts:k}}},21752:(e,t,s)=>{s.d(t,{K:()=>f,Z:()=>b});var i=s(77094),o=s.n(i),n=(s(67294),s(81954)),r=s(54368),a=s(77420),l=s(19889),d=s(97880),u=s(5366),m=s(86125),c=s(88198),p=s(70301),g=s(64369),h=s(45653);function v(e){const{actorStore:t,avatar:s,isLarge:i}=e,n=i?32:28;return t?t.table===a.cZ?o()(p.Z,{botStore:t,size:n}):t.table===l.KJ?o()(h.Z,{userStore:t,size:n}):t.table===r.y?o()(h.Z,{userStore:void 0,size:n}):void(0,d.t1)(t):o()(h.Z,s?{avatar:s,size:n}:{userStore:void 0,size:n})}function f(e){return"membership_admin"===e?"membership_admin":"editor"===e||"admin"===e?"admin":"none"===e||"guest"===e?"guest":"team_level_guest"===e?"team_level_guest":void("member"!==e&&"read_and_write"!==e&&"no_access"!==e&&"not_in_space"!==e&&e&&(0,d.t1)(e))}const b=function(e){window.__c={n:"CellMemberAvatar"};const t=(0,u.useIntl)(),{actorStore:s,avatar:i,containerStyle:r,id:a,spaceRole:l,avatarBadge:d,caption:p,isLarge:h}=e,f="admin"===l||"membership_admin"===l,b="guest"===l||"team_level_guest"===l,y=(0,n.VK)((()=>s?s.getDisplayName(t):null==i?void 0:i.name),[s,i,t]),S=(0,n.VK)((()=>Boolean(p)?p:s?s.getDetail():null==i?void 0:i.email),[p,s,i]);return o()("div",{style:{display:"flex",alignItems:"center",maxWidth:h?"unset":300,marginLeft:h?2:0,...r}},void 0,o()("div",{style:{position:"relative",...!h&&{height:28,width:28}}},void 0,o()(v,{actorStore:s,avatar:i,isLarge:h}),d),o()("div",{style:{minWidth:0,marginLeft:h?10:6,marginRight:h?10:6}},void 0,o()("div",{id:a,style:{display:"flex",gap:4}},void 0,o()(g.Z,{className:"notranslate"},void 0,y),f&&o()(m.Z,{role:l}),b&&o()(c.b,{labelType:l})),o()(g.Z,{isSmall:!0,style:{display:"flex"}},void 0,o()(g.Z,{isSmall:!0},void 0,S))))}},85215:(e,t,s)=>{s.d(t,{l:()=>h});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(81954),d=s(5366),u=s(16639),m=s(79315),c=s(52275),p=s(12793),g=s(31278);function h(e){window.__c={n:"GroupMenuItem"};const{group:t,menuListItemProps:s}=e,i=(0,l.VK)((()=>{const e=m.default.state.currentSpaceStore;if(e&&t.icon)return{pointer:{table:e.table,id:e.id},icon:t.icon}}),[t]),n=(0,d.useIntl)(),h=(0,u.kF)({intl:n,group:t});return a.createElement(c.Z,o()({},s,{icon:i?r()(g.Z,{disabled:!0,size:22,icon:i,isEmptyPage:!1,title:h}):r()(p.Z,{size:22}),title:h}))}},64131:(e,t,s)=>{s.d(t,{Z:()=>q});var i=s(77094),o=s.n(i),n=s(97464),r=s.n(n),a=s(67294),l=s(480),d=s(81954),u=s(24405),m=s(8848),c=s(53397),p=s(70203),g=s(82990),h=s(5366),v=s(50906),f=s(98724),b=s(87279),y=s(98742),S=s(89086),M=s(52689),w=s(63334),T=s(24666),C=s(41216),k=s(64921),I=s(31945),Z=s(56940),_=s(58261),P=s(78140),F=s(32163),x=s(40721),R=s(72495),G=s(58032);const B=a.Fragment;const q=function(e){window.__c={n:"HighlightSelectionButton"};const{disabled:t,style:s}=e,i=(0,d.qz)(e.ignoreSelectionAreaStore,w.Z),n=(0,l.O7)(),q=(0,h.useIntl)(),A=(0,u.Fg)(),U=(0,a.useCallback)((()=>{f.aS({environment:n,annotation:["h",M.Z.state.color]}),v.mt_(n,{action:"h",color:M.Z.state.color})}),[n]),E=(0,a.useCallback)((e=>{v.mt_(n,{action:"h"})}),[n]),D=(0,a.useCallback)((()=>{T.default.emit()}),[]),L=(0,a.useCallback)((e=>{f.mX({environment:n,annotationType:"h"}),"default"!==e&&(M.Z.setHighlightColor(e),U())}),[n,U]),O=(0,a.useCallback)(((e,t,s,i)=>({key:t||e,action:()=>{s(),L(e),i.close()},render:s=>a.createElement(C.Z,r()({},s,{color:e,overrideDisplayName:t}))})),[L]),N=(0,d.VK)((()=>{const e=(0,S.Ld)("h");return e?p.zI(e):"default"}),[]),K=(0,u.yK)((e=>({colorIcon:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:18,textAlign:"center",fontSize:15,borderRadius:2,...!n.device.isMobile&&{width:18,fontWeight:g.Z.fontWeight.medium,marginBottom:2},...(0,m.A_)(N,e)}})),[n.device.isMobile,N]);return o()(I.ZP,{popupType:n.device.isMobile?I.Z4.SlideUp:I.Z4.Popup,originGap:4,onClose:D,onClick:E,renderOrigin:e=>o()(G.Z,{renderTooltip:()=>o()(B,{},void 0,o()("div",{},void 0,o()(h.FormattedMessage,{defaultMessage:"Text color",id:"highlightSelectionButton.textColor.tooltip"})),o()("div",{},void 0,o()(_.Z,{style:{color:A.mediumInvertedTextColor},name:"toggleHighlight"}))),render:i=>a.createElement(k.Z,r()({style:{display:"flex",alignItems:"center",paddingLeft:7,paddingRight:6,whiteSpace:"nowrap",...s},disabled:t,disabledFeedback:t},(0,y.Z)(e,i)),o()("div",{style:K.colorIcon},void 0,n.device.isMobile?o()(h.FormattedMessage,{defaultMessage:"Color",id:"highlightSelectionButton.mobileColorIcon.label"}):"A"),c.Z.chevronDown({width:10,marginLeft:n.device.isMobile?4:3,fill:"dark"===A.mode?m.ZP.white:A.lightIconColor}))}),render:e=>{let t;return t=n.device.isMobile?{menuType:b.og.Modal,title:o()(h.FormattedMessage,{defaultMessage:"Text color",id:"highlightSelectionButton.mobileTextColor.label"}),right:o()(x.CancelMenuText,{}),onClickRight:()=>{e.close()}}:{menuType:b.og.Popup},a.createElement(P.Z,t,o()(Z.Z,{capture:n.device.isMobile,store:i,ignoreBlockSelection:!1,restoreSelection:!0,focusOffscreenInput:!1,render:t=>{const s=m.CY.map((s=>O(s,void 0,t,e))),i=[O("default",q.formatMessage({defaultMessage:"Default background",id:"highlightSelectionButton.defaultBackground.label"}),t,e),...m._K.map((s=>O(s,void 0,t,e)))],n=M.Z.state.color;return o()(F.Z,{type:F.i.Vertical,sections:[{key:0,items:[{key:0,action:()=>{t(),L(n),e.close()},render:e=>a.createElement(C.Z,r()({},e,{color:n,shortcuts:["toggleHighlight"]}))}],render:e=>a.createElement(R.Z,r()({},e,{title:o()(h.FormattedMessage,{defaultMessage:"Last used",id:"highlightSelectionButton.lastUsedSection.label"}),isTitleUppercase:!0}))},{key:1,items:s,render:e=>a.createElement(R.Z,r()({},e,{title:o()(h.FormattedMessage,{defaultMessage:"Color",id:"highlightSelectionButton.colorSection.label"}),isTitleUppercase:!0}))},{key:2,items:i,render:e=>a.createElement(R.Z,r()({},e,{title:o()(h.FormattedMessage,{defaultMessage:"Background",id:"highlightSelectionButton.backgroundSection.label"}),isTitleUppercase:!0}))}],initialFocus:void 0})}}))}})}},82945:(e,t,s)=>{s.d(t,{Z:()=>y});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(83355),d=s(53397),u=s(5366),m=s(50906),c=s(7476),p=s(77505),g=s(24666),h=s(64921),v=s(58261),f=s(58032);class b extends l.Z{constructor(){super(...arguments),this.handleClick=e=>{let t;const s=g.default.state;"empty"!==s.mode&&(t=p.UQ(),c.WD({environment:this.environment,blockStore:this.props.blockStore,multiSelection:s.multiSelection})),m.mt_(this.environment,{action:"comment",from:t?"simple_table_cell":void 0})}}renderComponent(){const{device:e}=this.environment,t=e.isMobile;return r()(f.Z,{renderTooltip:()=>r()(a.Fragment,{},void 0,r()("div",{},void 0,r()(u.FormattedMessage,{defaultMessage:"Comment on selected text",id:"inlineCommentButton.tooltip"})),r()("div",{},void 0,r()(v.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"comment"}))),render:e=>a.createElement(h.Z,o()({style:{display:"flex",alignItems:"center",padding:"0 10px",whiteSpace:"nowrap",...this.props.style},disabled:this.props.disabled,disabledFeedback:this.props.disabled,onClick:this.handleClick},e),d.Z.speechBubbleThin({width:t?18:16,height:t?18:16,marginTop:t?0:1,marginRight:4}),!t&&r()(u.FormattedMessage,{defaultMessage:"Comment",id:"inlineCommentButton.commentLabel"}))})}}b.displayName="InlineCommentButton";const y=b},24145:(e,t,s)=>{s.d(t,{Z:()=>b});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(480),d=s(81954),u=s(5366),m=s(75472),c=s(65598),p=s(26781),g=s(25464),h=s(58032),v=s(91487),f=s(47082);const b=function(e){window.__c={n:"PermissionsInviteInput"};const{origin:t,permissionsInviteStore:s,store:i,handleClickRemoveToken:n,handleInputChange:b,handleInputSubmit:y,defaultRoleForNonBot:S,isTeamsEnabled:M,right:w,focus:T,handleFocus:C}=e,k="share_menu"===t||"add_members"===t,I="add_members"===t,[Z,_]=(0,d.AF)(s),P=(0,l.O7)(),{device:F}=P,x=(0,u.useIntl)(),{tokenQuery:R}=Z,G=(0,p.i)(i),B=Z.inviteTargets.map((e=>{const t="newUser"===e.type?e.value.email:`${e.type}-${e.value.id}`,s=(0,m.OA)(e),i="newUser"===e.type||"existingUser"===e.type?e.value.email:void 0,l=s?G:void 0,d={key:t,target:e,onClickRemove:n,role:Z.inviteRole,shouldWrap:k,showInfoIcon:Boolean(l)};return k&&i?r()(h.Z,{placement:g.u.Top,disableTooltip:I,renderTooltip:()=>s?l||r()(u.FormattedMessage,{defaultMessage:"{email} will be invited as a guest",id:"ContextualInvite.permissions_invites.guest.tooltip",description:"Tooltip for inviting a guest",values:{email:i}}):i,render:s=>a.createElement("span",o()({},s,{key:t}),a.createElement(v.Z,o()({},d,{backgroundColor:(0,m.gQ)(e)})))}):a.createElement(v.Z,d)}));return a.createElement(f.Z,o()({focus:F.isMobile?void 0:T,focusInitial:F.isMobile,focusAfterAnimation:!0,onClick:()=>{F.isMobile||null==C||C()},format:f.Z.Format.Share,value:R,onChange:b,type:"email",tokens:B,disabled:!1,autoComplete:"off",placeholder:k?M?x.formatMessage({defaultMessage:"Add people, groups, or emails…",id:"ContexualInvites.inviteUserModal.searchInput.placeholderWithTeams",description:"Placeholder text for the search input in the invite user modal"}):x.formatMessage({defaultMessage:"Add emails or people",id:"ContexualInvites.inviteUserModal.searchInput.placeholderWithoutBots",description:"Placeholder text for the search input in the invite user modal"}):(0,c.Mm)(i)?x.formatMessage({id:"inviteUserModal.searchInput.placeholder",defaultMessage:"Search name or emails"}):x.formatMessage({id:"permissionsInvite.searchInput.placeholder",defaultMessage:"Search emails, names, or groups"}),onRemoveLastToken:()=>{const e={...Z};e.inviteTargets=e.inviteTargets.slice(0,-1),0===e.inviteTargets.length&&(e.isInviteTargetsEmpty=!0,e.inviteRole=S),_(Z)},right:w,inputAndTokenWrapRightStyle:{paddingTop:P.device.isMobile?0:Z.isInviteTargetsEmpty?5:6,paddingBottom:P.device.isMobile||k?0:4},onEmptySubmit:()=>y(),dontShowBorderBottom:F.isAndroid,showBorder:k},k&&{style:{borderRadius:3,paddingTop:Z.isInviteTargetsEmpty?3:0,paddingBottom:0,...T&&{background:"none"}}}))}},43579:(e,t,s)=>{s.d(t,{Z:()=>A});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(480),d=s(81954),u=s(24405),m=s(66897),c=s(33728),p=s(53397),g=s(5366),h=s(82990),v=s(7928),f=s(50906),b=s(95209),y=s(4708),S=s(75472),M=s(65598),w=s(21115),T=s(29677),C=s(78291),k=s(52275),I=s(32163),Z=s(43765),_=s(77137),P=s(72495),F=s(58032),x=s(85215),R=s(69507),G=s(97680);const B=(0,g.defineMessages)({invited_page:{id:"PermissionsInviteSearchRequest.userTooltip.invited_page",defaultMessage:"{userNameAndEmail} is invited to this page already",description:"A label that shows the user is invited to the page already"},invited_space:{id:"PermissionsInviteSearchRequest.userTooltip.invited_space",defaultMessage:"{userNameAndEmail} is invited to this workspace already",description:"A label that shows the user is invited to the workspace already"},invited_team:{id:"PermissionsInviteSearchRequest.userTooltip.invited_team",defaultMessage:"{userNameAndEmail} is invited to this team already",description:"A label that shows the user is invited to the team already"},not_in_space:{id:"PermissionsInviteSearchRequest.userTooltip.admin",defaultMessage:"Click to invite {userNameAndEmail}",description:"A tooltip explains that the user has not been invited, therefore they have no access to the workspace"}});function q(e,t){return e.filter(((e,s)=>s<t))}const A=function(e){window.__c={n:"PermissionsInviteSearchRequest"};const{store:t,shouldShowBots:s,shouldShowGroups:i,sectionRenderLimit:n,membersOnly:A,hideUserTypeToken:U,disableInvitedUsers:E}=e,[D,L,O]=(0,d.AF)(e.permissionsInviteStore),N=(0,l.O7)(),{device:K}=N,V=(0,g.useIntl)(),{tokenQuery:W}=D,z=(0,a.useMemo)((()=>S.ZK({environment:{device:K}})),[K]),H=(0,u.yK)((e=>({roleBadge:{...z},invitedBadge:{...z,backgroundColor:e.defaultBadgeBackground}})),[z]),j=(0,d.VK)((()=>(0,y._6)(N)?"invitee-popup-closed":"invitee"),[N]),Q={request:W,performRequest:e=>b.jL({query:e,sectionLimit:{userLimit:10,botLimit:s?10:0,groupLimit:i?10:0,importContactLimit:0},membersOnly:A,environment:N,intl:V}),render:(e,s,l)=>{if(e)return r()(R.l,{loading:!l},void 0,r()(Z.Z,{title:r()(g.FormattedMessage,{id:"inviteUserModal.searchInput.errorMessage",defaultMessage:"Something went wrong"})}));const d=s&&{...s,importedContacts:(0,S.Bu)(s.inviteUsers,s.importedContacts)},u=d&&(null==W?void 0:W.length)>0,{inviteUsers:b,inviteGroups:y,importedContacts:_=[]}=u?d:(0,S.NN)({currentInviteActors:d,permissionsInviteStore:O,targetStore:t}),A=[...q(b,n),...q(_,10)].map(((e,s)=>{const i="newUser"===e.type?e.value.email:e.value.id,n=function(e){if("existingUser"!==e.type)return;const{data:t}=C.default.state,s=(t?w.CM(t):[]).find((t=>t.userId===e.value.id));return s?s.role:"not_in_space"}(e),l=Boolean(u&&(0,S.cm)({permissionsInviteStore:O,userTarget:e,targetStore:t}));return{key:i,render:s=>{const{tooltip:i,userTypeToken:d}=function(e){const{userTarget:t,targetStore:s,isInvited:i,userSpaceRole:o,styles:n,intl:a}=e,l="newUser"!==t.type&&t.value.name?`${t.value.name} (${t.value.email})`:t.value.email,d=o&&"not_in_space"!==o;if(i)return{tooltip:(0,M.Mm)(s)?a.formatMessage(B.invited_space,{userNameAndEmail:l}):(0,M.NZ)(s)?a.formatMessage(B.invited_page,{userNameAndEmail:l}):a.formatMessage(B.invited_team,{userNameAndEmail:l}),userTypeToken:r()("div",{style:{...n.invitedBadge}},void 0,r()(g.FormattedMessage,{id:"inviteUserModal.userRole.invitedBadge.label",defaultMessage:"Invited",description:"A label that shows the user is invited already"}))};if(d){const e=S.Ji({role:o,intl:a,nameOrEmail:l});return{tooltip:e.tooltip,userTypeToken:r()("div",{style:{...n.roleBadge}},void 0,e.userRoleBadge)}}return{tooltip:a.formatMessage(B.not_in_space,{userNameAndEmail:l}),userTypeToken:void 0}}({userTarget:e,targetStore:t,userSpaceRole:n,isInvited:l,styles:H,intl:V});return"existingUser"===e.type?a.createElement(G.Z,o()({},s,{actor:(0,m.dp)(e.value),right:U?void 0:d,tooltip:i,tooltipPlacement:F.Z.Placement.Left,disabled:E&&l})):r()(F.Z,{placement:F.Z.Placement.Left,alignment:F.Z.Alignment.Start,textWrap:!0,render:t=>a.createElement(k.Z,o()({},s,t,{icon:p.Z.mailRound({width:24,height:24}),right:d,title:e.value.email.trim(),disabled:E&&l})),disableTooltip:!i,renderTooltip:()=>i})},action:()=>{if(l)return;if(!D.isInviteTargetsEmpty&&(0,T.ow)(D))return;const t={...e,..."existingUser"===e.type&&{spaceRole:n}};f.hEo(N,{...S.a_(N,D),invite_token_query:W,selected_user_token:e,selected_user_token_rank:s}),O.setState({...D,inviteTargets:[...D.inviteTargets,t],isInviteTargetsEmpty:!1,tokenQuery:"",inputFocus:j})}}})),L=q(y,n).map((e=>{const{value:t}=e;return{key:t.id,render:e=>r()(x.l,{group:t,menuListItemProps:e}),action:()=>{!D.isInviteTargetsEmpty&&(0,T.ow)(D)||O.setState({...D,inviteTargets:[...D.inviteTargets,e],isInviteTargetsEmpty:!1,tokenQuery:"",inputFocus:j})}}})),K=[],z=D.isInviteTargetsEmpty||!(0,T.ow)(D);if(A.length>0&&z&&K.push({key:"user results",render:e=>a.createElement(R.l,o()({},e,{loading:!l})),items:A}),i&&L.length>0&&z&&K.push({key:"group results",render:e=>a.createElement(P.Z,o()({},e,{title:r()(g.FormattedMessage,{id:"inviteUserModal.searchDropdown.selectGroupTitle",defaultMessage:"Select a group"}),loading:!l})),items:L}),0===K.length&&z){const e=(0,c.H3)(D.tokenQuery);if((0,c.oH)(e)){const i={type:"newUser",value:{email:e},source:"email"},o=(0,S.Nd)({target:i,permissionsInviteStore:O});if(!o)return;if(o)return r()(R.l,{loading:!l},void 0,r()(Z.Z,{title:r()(g.FormattedMessage,{id:"inviteUserModal.userAlreadyInvitedMessage",defaultMessage:"Already inviting {user}.",values:{user:r()("span",{style:{fontWeight:h.Z.fontWeight.bold}},void 0,(0,S.DF)({intl:V,target:o}))}})}));const n=(s&&s.inviteUsers||[]).find((t=>"existingUser"===t.type&&t.value.email===e));if(n&&"existingUser"===n.type&&(0,S.Zp)({store:t,target:n}))return r()(R.l,{loading:!l},void 0,r()(Z.Z,{title:r()(g.FormattedMessage,{id:"inviteUserModal.userAlreadyHasPermissionMessage",defaultMessage:"{user} already has permission.",values:{user:r()("span",{style:{fontWeight:h.Z.fontWeight.bold}},void 0,(0,v.Nz)(V,n.value))}})}))}else{if(!D.tokenQuery)return r()(R.l,{loading:!l},void 0,r()(Z.Z,{title:r()(g.FormattedMessage,{id:"inviteUserModal.searchPersonDropdown.noSearchResultsMessage",defaultMessage:"Type or paste in emails above, separated by commas."})}));K.push({key:"user results",render:e=>a.createElement(R.l,o()({},e,{loading:!l,title:r()(g.FormattedMessage,{id:"inviteUserModal.searchDropdown.addPeople",description:"Header in invite menu, asking user to add a people's email.",defaultMessage:"Keep typing to invite email"})})),items:[{key:D.tokenQuery,render:e=>a.createElement(k.Z,o()({icon:p.Z.mailRound({width:24,height:24}),title:D.tokenQuery},e)),action:()=>{}}]})}}return r()(I.Z,{type:I.i.Vertical,initialFocus:W.length>0?0:void 0,sections:K})}};return a.createElement(_.Z,Q)}},40464:(e,t,s)=>{s.d(t,{Z:()=>b});var i=s(77094),o=s.n(i),n=s(97464),r=s.n(n),a=s(67294),l=s(480),d=s(81954),u=s(24405),m=s(8848),c=s(50906),p=s(98724),g=s(89086),h=s(24666),v=s(64921),f=s(58032);const b=function(e){window.__c={n:"SelectionAnnotationButton"};const{disabled:t,type:s,tooltipLabel:i,children:n,style:b,onClick:y}=e,S=(0,l.O7)(),M=(0,a.useCallback)((e=>{p.aS({environment:S,annotation:[s]}),y&&y(),c.mt_(S,{action:s})}),[S,s,y]),w=(0,d.VK)((()=>t||"editing"!==h.default.state.mode),[t]),T=(0,d.VK)((()=>Boolean((0,g.Ld)(s))),[s]),C=(0,u.yK)((e=>({button:{display:"flex",alignItems:"center",padding:"0 8px",color:T?m.ZP.blue:e.regularTextColor,...b}})),[T,b]);return o()(f.Z,{renderTooltip:()=>i,render:e=>a.createElement(v.Z,r()({style:C.button,disabled:w,disabledFeedback:w,onClick:M},e),n)})}},32404:(e,t,s)=>{s.d(t,{Z:()=>y});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(83355),d=s(70203),u=s(5366),m=s(36280),c=s(89086),p=s(66949),g=s(24666),h=s(64921),v=s(58261),f=s(58032);class b extends l.Z{constructor(){super(...arguments),this.renderMenuTooltip=()=>{const e=this.getThemeColors();return r()(a.Fragment,{},void 0,r()("div",{},void 0,r()(u.FormattedMessage,{id:"richTextMenu.equationButton.tooltip",defaultMessage:"Create equation"})),r()("div",{},void 0,r()(v.Z,{style:e.keyboardShortcut,name:"openEquationMenu"})))},this.handleButtonPopupClick=e=>{const{onClick:t}=this.props;m.qn({environment:this.environment,analyticsFrom:"rich_text_menu"}),t&&t(e)},this.isSelected=()=>(0,c.Ld)(d.GK.Equation),this.isDisabled=()=>{const{disabled:e}=this.props;if(e)return!0;if("editing"!==g.default.state.mode&&!p.Z.isOpen())return!0;const t={[d.GK.User]:d.GK.User,[d.GK.Page]:d.GK.Page,[d.GK.Comment]:d.GK.Comment,[d.GK.Bot]:d.GK.Bot,[d.GK.Date]:d.GK.Date,[d.GK.ExternalObjectInstance]:d.GK.ExternalObjectInstance,[d.GK.TemporaryPage]:d.GK.TemporaryPage,[d.GK.TemplateVariable]:d.GK.TemplateVariable,[d.GK.FormulaPageProperty]:d.GK.FormulaPageProperty,[d.GK.FormulaUserProperty]:d.GK.FormulaUserProperty,[d.GK.FormulaContextValue]:d.GK.FormulaContextValue,[d.GK.Group]:d.GK.Group};for(const s of Object.values(t))if((0,c.J6)(s))return!0;return!1},this.styles={equationButton:{display:"flex",alignItems:"center",borderRadius:0,paddingLeft:7,paddingRight:8}}}renderComponent(){const{style:e,children:t}=this.props,s=this.getThemeColors(),i=this.isDisabled();return r()(f.Z,{renderTooltip:this.renderMenuTooltip,render:n=>a.createElement(h.Z,o()({style:{...this.styles.equationButton,...s.equationButton,...e},disabled:i,disabledFeedback:i,onClick:this.handleButtonPopupClick},n),t)})}getThemeColors(){return{equationButton:{color:this.isSelected()?this.theme.blueColor:this.theme.regularTextColor},keyboardShortcut:{color:this.theme.mediumInvertedTextColor}}}}b.displayName="SelectionEquationButton";const y=(0,u.injectIntl)(b)},73383:(e,t,s)=>{s.d(t,{Z:()=>S});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(83355),d=s(70203),u=s(5366),m=s(50906),c=s(45990),p=s(89086),g=s(23178),h=s(24666),v=s(64921),f=s(58261),b=s(58032);class y extends l.Z{constructor(){super(...arguments),this.handleButtonPopupClick=()=>{c.dz({type:"focusOnly",focus:!0}),m.mt_(this.environment,{action:d.GK.Link})}}renderComponent(){const e=(0,p.Ld)(d.GK.Link),t=this.isDisabled();return r()(b.Z,{renderTooltip:()=>r()(a.Fragment,{},void 0,r()("div",{},void 0,r()(u.FormattedMessage,{defaultMessage:"Add link",id:"selectionLinkButton.addLink.tooltip",description:"Prompt for the user to add a URL to link to from the selected text."})),r()("div",{},void 0,r()(f.Z,{style:{color:this.theme.mediumInvertedTextColor},name:"openLinkMenu"}))),render:s=>a.createElement(v.Z,o()({style:{display:"flex",alignItems:"center",borderRadius:0,paddingLeft:7,paddingRight:8,...e&&{color:this.theme.blueColor},whiteSpace:"nowrap",...this.props.style},disabled:t,disabledFeedback:t},s,{onClick:this.handleButtonPopupClick}),this.props.children)})}isDisabled(){return!!this.props.disabled||("editing"!==h.default.state.mode&&!g.Z.state.open||!!((0,p.J6)(d.GK.User)||(0,p.J6)(d.GK.Bot)||(0,p.J6)(d.GK.Date)||(0,p.J6)(d.GK.Page)))}}y.displayName="SelectionLinkButton";const S=(0,u.injectIntl)(y)},40141:(e,t,s)=>{s.d(t,{Z:()=>Ps});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(96486),l=s.n(a),d=s(67294),u=s(83355),m=s(49085),c=s(8848),p=s(58573),g=s(53397),h=s(27006),v=s(90468),f=s(19889),b=s(2438),y=s(97880),S=s(82990),M=s(7928),w=s(5366),T=s(48298),C=s(50906),k=s(54642),I=s(43132),Z=s(47307),_=s(92625),P=s(76464),F=s(29974),x=s(15010),R=s(64964),G=s(21325),B=s(30149);const q=(0,w.defineMessages)({removingGuest:{id:"convertGuestToMember.removeGuest.updatingMessage",defaultMessage:"Updating…",description:"The message shown while waiting to remvoe a guest"},convertingGuest:{id:"convertGuestToMember.convertingGuest.updatingMessage",defaultMessage:"Updating…",description:"The message shown while waiting to converting a guest to a member"}});async function A(e){const{environment:t,store:s,role:i,guestUserStore:o}=e,n=o.id,a=o.getEmail();try{_.j({message:q.convertingGuest});const e=[{type:"user_permission",role:i,user_id:n}],{serverCommitResult:o}=B.createAndCommit({userAction:"spacePerimssionGuestActions.convertGuestToMember",environment:t,perform:i=>{P.ep({environment:t,store:s,permissionItems:e,transaction:i,from:"convert_to_member"})}});await o,C.Rbv(t,{member_user_id:n}),C.jBu(t,{role:i,is_space:!0,invite_targets:[{type:"existingUser",value:{id:n,version:0,email:""},spaceRole:"none"}],is_onboarding:!1,invite_origin:"convert_to_member",permission_items:e,invite_message_length:0,domainType:(0,x.JF)()})}catch(l){R.oV({label:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.snackbar.failure",defaultMessage:"Failed to convert {email} to workspace member",description:"Snackbar message shown after failing to convert a page guest or teamspace guest into a workspace member.",values:{email:a}})})}finally{await G.bi(t),_.x()}}async function U(e){const{environment:t,store:s,guestUserStore:i}=e,o=i.id,n=i.getEmail();try{_.j({message:q.removingGuest});if("success"!==(await k.removeUsersFromSpace(t,{userIds:[o],spaceId:s.id,removePagePermissions:!0,revokeUserTokens:!1})).type)throw new Error("Failed to remove guest");C.bwR(t)}catch(a){R.oV({label:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.removeFromWorkspace.snackbar.failure",defaultMessage:"Failed to remove {email} from workspace",description:"Snackbar message shown after failing to remove a page guest or teamspace guest.",values:{email:n}})})}finally{await G.bi(t),_.x()}}var E=s(79315),D=s(37181);var L=s(4708),O=s(87279),N=s(67669),K=s(33665),V=s(38755),W=s(89837);var z=s(62216),H=s(21115),j=s(8323),Q=s(23537),J=s(77907),Y=s(88632),$=s(87082),X=s(72087),ee=s(64404),te=s(92083),se=s(78291),ie=s(98905),oe=s(21752),ne=s(42922),re=s(64921),ae=s(52275),le=s(31945),de=s(61519),ue=s(73063),me=s(74194),ce=s(68785),pe=s(78140),ge=s(32163),he=s(63296),ve=s(77137),fe=s(72495),be=s(62385),ye=s(24006),Se=s(58032),Me=s(64369),we=s(24405),Te=s(16639),Ce=s(31278),ke=s(53695);function Ie(e){let{spaceStore:t,groups:s,onGroupClick:i}=e;window.__c={n:"GroupsDowndownForMember"};const n=(0,w.useIntl)(),a=s.length,l=(0,we.yK)((e=>({title:{marginRight:8,color:0===a?e.lightTextColor:void 0},defaultGroupIconPill:{height:14,width:14,color:e.mediumTextColor,fill:"currentColor"},untitled:{color:e.lightTextColor}})),[a]),u=s.map((e=>({key:e.id,render:s=>{var i;const a=Te.kF({intl:n,group:e});return d.createElement(ae.Z,o()({icon:r()(Ce.Z,{disabled:!0,icon:e.icon&&t?{pointer:t.pointer,icon:e.icon}:void 0,size:18,isEmptyPage:!1,title:a,defaultIcon:g.Z.typesPerson(l.defaultGroupIconPill)}),title:r()(Me.Z,{style:e.name?void 0:l.untitled},void 0,a),caption:r()(w.FormattedMessage,{defaultMessage:"{numMembers} {numMembers, plural, one {member} other {members}}",id:"groupsDropdownForMember.numMembers",description:"Number of members in a permission group, displayed in a popup showing the permission groups that this member is part of.",values:{numMembers:(null===(i=e.user_ids)||void 0===i?void 0:i.length)||0}}),inline:!0},s))},action:i})));return r()(ke.N,{title:r()(Me.Z,{style:l.title},void 0,r()(w.FormattedMessage,0===a?{id:"groupsDropdownForMember.groupsCountNone.label",defaultMessage:"None",description:"Message to show a member is not part of any groups."}:{id:"groupsDropdownForMember.groupsCount.label",defaultMessage:"{numberOfGroups, plural, one {{numberOfGroups} group} other {{numberOfGroups} groups}}",description:"Number of groups that a member is part of.",values:{numberOfGroups:a}})),items:u,disabled:0===a})}var Ze=s(15145),_e=s(21202),Pe=s(5978),Fe=s(84210),xe=s(61766),Re=s(28992),Ge=s(43765),Be=s(89728),qe=s(11470);class Ae extends u.Z{constructor(){super(...arguments),this.storeTypes={buttonPopupStore:xe.Z},this.renderPopup=()=>{const{device:e}=this.environment,{store:t,guest:s,hideActionButtons:i}=this.props,n=t.canEditMembership(),a=s.guestPageIds.map((e=>{const s=$.G.createChildStore(t,{table:_e.iU,id:e});return{key:e,render:e=>d.createElement(qe.Z,o()({},e,{store:s,placeholder:r()(w.FormattedMessage,{id:"guestPagesPopup.privatePagePlaceholder",defaultMessage:"Private page"})})),action:()=>{const s=$.G.createChildStore(t,{table:_e.iU,id:e}),i=(0,Fe.ZP)({store:s,fullyQualified:!1,pageVisitSource:Ze.tY.LinkInPage});Pe.navigate({environment:this.environment,url:i,openInNew:"tab"})}}}));let l,u;l=e.isMobile?{menuType:O.og.ActionSheet}:{menuType:O.og.Popup,width:300},(0,H.qF)(this.environment)&&(u=r()(Se.Z,{renderTooltip:()=>this.isSubscribed()?r()(w.FormattedMessage,{id:"guestPagesPopup.addMemberPermissionButton.tooltip",defaultMessage:"This guest will become a member of this workspace."}):r()(w.FormattedMessage,{id:"guestPagesPopup.addAdminPermissionButton.tooltip",defaultMessage:"This guest will become an admin of this workspace."}),render:e=>d.createElement(he.Z,o()({isLarge:!0,onClick:this.handleConvertToMemberClick},e),this.isSubscribed()?r()(w.FormattedMessage,{id:"guestPagesPopup.addMemberPermissionButton.label",defaultMessage:"Convert to member"}):r()(w.FormattedMessage,{id:"guestPagesPopup.addAdminPermissionButton.label",defaultMessage:"Convert to admin"}))}));const m=!i&&n;return d.createElement(pe.Z,l,m&&r()(Re.Z,{title:r()("div",{style:{paddingTop:12,paddingBottom:8,display:"flex",alignItems:"flex-start"}},void 0,u,r()(Se.Z,{renderTooltip:()=>r()(w.FormattedMessage,{id:"guestPagesPopup.removeGuestButton.tooltip",defaultMessage:"This guest will be removed from all pages in this Workspace."}),render:e=>d.createElement(he.Z,o()({isLarge:!0,isRed:!0,style:{marginLeft:u?8:0},onClick:this.handleRemoveClick},e),r()(w.FormattedMessage,{id:"guestPagesPopup.removeGuestButton.label",defaultMessage:"Remove"}))}))}),m&&r()(Ge.Z,{title:r()(w.FormattedMessage,{id:"guestPagesPopup.guestAccessiblePagesCaption",defaultMessage:"This guest can access these pages"})}),r()(ge.Z,{type:ge.i.Vertical,initialFocus:0,sections:[{key:"pages",render:e=>d.createElement(fe.Z,e),items:a}]}))},this.handleRemoveClick=()=>{Z.showDialog({showCancel:!0,keepFocus:!1,message:r()(w.FormattedMessage,{id:"guestPagesPopup.removeGuestModal.confirmationMessage",defaultMessage:"Are you sure you want to remove this person? They will lose access to all shared pages."}),items:[{label:r()(w.FormattedMessage,{id:"guestPagesPopup.removeGuestModal.removeButton.label",defaultMessage:"Remove"}),color:"red",onAccept:async()=>{const{store:e,guestStore:t}=this.props;this.stores.buttonPopupStore.setState({...this.stores.buttonPopupStore.state,open:!1}),await U({environment:this.environment,guestUserStore:t,store:e})}}]})},this.handleConvertToMemberClick=async()=>{const{store:e,guestStore:t,isSubscribed:s}=this.props,i=s?"read_and_write":"editor";this.stores.buttonPopupStore.setState({...this.stores.buttonPopupStore.state,open:!1}),await A({environment:this.environment,guestUserStore:t,role:i,store:e})}}renderComponent(){const{device:e}=this.environment,{buttonPopupStore:t}=this.stores,{store:s,guest:i}=this.props;return i.guestPageIds.map((e=>{$.G.createChildStore(s,{table:_e.iU,id:e}).load()})),0===i.guestPageIds.length?r()(Be.Z,{disabled:!0},void 0,r()(w.FormattedMessage,{id:"guestPagesPopup.permissionsForUserGuest.label",defaultMessage:"Guest"})):r()(le.ZP,{popupType:e.isMobile?le.Z4.SlideUp:le.Z4.Popup,renderOrigin:e=>d.createElement(Be.Z,e,r()(w.FormattedMessage,{id:"guestPagesButton.label",defaultMessage:"{numberOfAccessiblePages, plural, one {{numberOfAccessiblePages} page} other {{numberOfAccessiblePages} pages}}",values:{numberOfAccessiblePages:i.guestPageIds.length}}),g.Z.chevronDown({width:10,marginLeft:4,fill:this.theme.lightIconColor})),buttonPopupStore:t,render:this.renderPopup})}isSubscribed(){const{data:e}=se.default.state;return Boolean(e&&(0,H.YK)(e))}}Ae.displayName="GuestPagesPopup";const Ue=(0,w.injectIntl)(Ae);var Ee=s(74523),De=s(42402),Le=s(7567),Oe=s(480),Ne=s(81954),Ke=s(5851),Ve=s(53680),We=s(93963),ze=s(40235),He=s(42875),je=s(61784),Qe=s(29302),Je=s(45653);function Ye(e){window.__c={n:"SpaceSettingsRequestRow"};const{store:t,request:s}=e,{forActor:i,accessRequestStore:o}=s,n=(0,Oe.O7)(),[a,l]=(0,d.useState)(!1),u=(0,we.yK)((e=>({actionButtons:{display:"flex",alignItems:"center",gap:12},email:{display:"flex",gap:4},requestMetadata:{minWidth:0,marginLeft:6,marginRight:6},tooltip:{marginBottom:2},tooltipHeader:{color:e.mediumInvertedTextColor,fontSize:10,textTransform:"uppercase",letterSpacing:"0.015em",marginBottom:2},viewReasonsButton:{marginLeft:28,marginTop:2,border:"none"},tooltipUserRow:{display:"flex",justifyContent:"space-between",marginBottom:4},tooltipUserRowEmail:{marginLeft:5}})),[]),m=(0,w.useIntl)(),c=(0,Ne.VK)((()=>{var e;const t=[],i=new Set;return null===(e=s.createdByActorsWithReason)||void 0===e||e.forEach((e=>{i.has(e.actor.id)||t.push(e.actor),i.add(e.actor.id)})),t}),[s.createdByActorsWithReason]);if(!s||!s.forActor||!s.createdByActorsWithReason.length)return null;const p=W.CQ(s.latestRequestTime,(0,He.r)()),g=(0,je.ZV)({value:p,date_format:"relative",userTimeZone:(0,He.r)(),intl:m,allowRelativeDates:!0}),h={environment:n,store:t,accessRequestStore:o,forActor:i},v=c.filter((e=>e.email!==s.forActor.email)),f=v.length!==c.length,b=()=>1===c.length?r()(w.FormattedMessage,f?{defaultMessage:"Guest self request",id:"spaceSettingsRequests.requestRowAction.requestedBySingularGuestSelfRequest",description:"Describes that a request came from a guest self request."}:{defaultMessage:"From {actorName}",id:"spaceSettingsRequests.requestRowAction.requestedBySingular",description:"Describes the user that a request came from",values:{actorName:c[0].name}}):r()(w.FormattedMessage,f?{defaultMessage:"{numberOfOtherActors, plural, one {Guest self request and from {secondActorName}} other {Guest self request and from {numberOfOtherActors} more}}",id:"spaceSettingsRequests.requestRowAction.requestedByPluralIncludingGuestSelfRequest",description:"Describes the guest self request and the multiple users that a request came from",values:{secondActorName:v[0].name,numberOfOtherActors:v.length}}:{defaultMessage:"{numberOfOtherActors, plural, one {From {firstActorName} and {secondActorName}} other {From {firstActorName} and {numberOfOtherActors} more}}",id:"spaceSettingsRequests.requestRowAction.requestedByPlural",description:"Describes multiple users that a request came from",values:{firstActorName:c[0].name,secondActorName:c[1].name,numberOfOtherActors:c.length-1}});return r()("div",{style:{width:"100%"}},void 0,r()("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},void 0,r()("div",{},void 0,r()("div",{style:{display:"flex",alignItems:"center"}},void 0,r()(Je.Z,{userValue:s.forActor,size:28,borderStyle:"dashed"}),r()("div",{style:u.requestMetadata},void 0,r()("div",{style:u.email},void 0,r()(Me.Z,{className:"notranslate"},void 0,s.forActor.email)),r()(Me.Z,{isSmall:!0},void 0,r()(Se.Z,{renderTooltip:()=>r()("div",{style:u.tooltip},void 0,r()(Me.Z,{style:u.tooltipHeader},void 0,r()(w.FormattedMessage,{defaultMessage:"Requested by",id:"spaceSettingsRequests.requestRowAction.requestedByMoreThanTwo.tooltip",description:"Describes multiple user emails that a request came from"})),c.map((e=>r()("div",{style:u.tooltipUserRow},e.id,r()(Qe.Z,{avatarSize:18,userValue:e}),r()("div",{style:u.tooltipUserRowEmail},void 0,e.email))))),render:e=>d.createElement("span",e,r()(b,{}))})," · ",g)))),r()("div",{style:u.actionButtons},void 0,r()(Be.Z,{isGray:!0,onClick:async()=>{await T.kn({...h,status:"rejected",from:"requests_center"})}},void 0,r()(w.FormattedMessage,{defaultMessage:"Decline",id:"spaceSettingsRequests.requestRowAction.declineButton.label",description:"Label for button that allows user to reject a pending membership request"})),r()(he.Z,{isBlue:!0,onClick:async()=>{await T.kn({...h,status:"approved",from:"requests_center"})}},void 0,r()(w.FormattedMessage,{defaultMessage:"Approve",id:"spaceSettingsRequests.requestRowAction.acceptButton.label",description:"Label for button that allows user to approve a pending membership request"})))),s.createdByActorsWithReason.some((e=>{let{reason:t}=e;return Boolean(t)}))&&r()(he.Z,{isSmall:!0,isBlue:!0,style:u.viewReasonsButton,onClick:()=>l(!a)},void 0,r()(w.FormattedMessage,a?{id:"spaceSettingsRequests.requestRowAction.closeReasonsButton.label",defaultMessage:"Close reasons",description:"Button to collapse reasons in view for a membership request."}:{id:"spaceSettingsRequests.requestRowAction.viewReasonsButton.label",defaultMessage:"View reasons",description:"Button to expand reasons for a membership request."})),a&&r()("div",{style:{marginLeft:34,marginTop:2,fontSize:S.Z.fontSize.UIRegular.desktop}},void 0,s.createdByActorsWithReason.filter((e=>{let{reason:t}=e;return Boolean(t)})).map(((e,t)=>r()("div",{},t,e.actor.name," · ",e.reason)))))}function $e(e){window.__c={n:"SpaceSettingsRequestsTable"};const{spaceStore:t,accessRequestRenderValues:s,lastOpenedRequestCenterTime:i}=e,o=(0,Ne.VK)((()=>s.filter((e=>"pending"===e.accessRequestStore.getKeyStore("status").getValue())).sort(((e,t)=>t.latestRequestTime-e.latestRequestTime))),[s]),n=(0,we.yK)((e=>({requestColumn:{width:"100%"},zeroStateContainer:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:40,color:e.mediumTextColor,borderStyle:"solid",borderColor:e.regularDividerColor,borderWidth:1,borderRadius:3},mailIcon:{height:12,width:17,color:e.mediumIconColor,marginRight:6}})),[]),a={key:"request",header:void 0,style:n.requestColumn};return 0===o.length?r()("div",{style:n.zeroStateContainer},void 0,g.Z.mailRound(n.mailIcon),r()(w.FormattedMessage,{id:"spaceSettingsRequests.emptyRequests.message",defaultMessage:"No invite requests yet",description:"Message in requests inbox telling user there are no requests yet."})):r()(ze.Z,{hideHeader:!0,columns:[a],rows:o.map(((e,s)=>({key:`request${s.toString()}`,columns:[r()("div",{style:{display:"flex",alignItems:"center"}},e.accessRequest.id,i<e.accessRequest.created_time&&r()("div",{style:{marginLeft:-18,marginRight:10}},void 0,r()(We.z,{size:8})),r()(Ye,{store:t,request:e}))]})))})}function Xe(e){window.__c={n:"SpaceSettingsRequests"};const{spaceStore:t,accessRequestsStore:s}=e,i=(0,Oe.O7)(),[o,n]=(0,d.useState)(Date.now()),[,,a]=(0,Ne.AF)(void 0,Ve.Z),l=(0,Ne.VK)((()=>a.getValueForSpace(t)),[t,a]),u=Boolean(null==l?void 0:l.disableMembershipRequests),m=Boolean(null==l?void 0:l.disableGuestMembershipRequests),c=(0,Ne.VK)((()=>t.getKeyStore("settings").getKeyStore("seen_guest_membership_requests").getValue()&&(0,L.Ye)(i)),[i,t]),[p,,]=(0,Ne.AF)(s),g=(0,we.yK)((e=>({errorContainer:{display:"flex",justifyContent:"center",alignItems:"center",padding:40,color:e.mediumTextColor}})),[]);(0,d.useEffect)((()=>{const{currentSpaceViewStore:e}=E.default.state;if(!e)return;const t=e.getKeyStore("settings").getKeyStore("last_opened_request_center").getValue();t&&n(t),B.createAndCommit({userAction:"SpaceSettingsRequests.updateLastOpened",environment:i,perform:t=>{B.applyOperation({store:e,operation:{pointer:e.pointer,path:["settings","last_opened_request_center"],command:"set",args:Date.now()},transaction:t})}})}),[]);return h=p.error,v=p.result,p.ready?h||!v?r()("div",{style:g.errorContainer},void 0,r()(w.FormattedMessage,{defaultMessage:"Something went wrong.",id:"notificationUpdates.unknownErrorMessage"})):d.createElement(d.Fragment,null,r()(et,{spaceStore:t,securitySettingsStoreState:l,disabled:u}),c&&r()(tt,{spaceStore:t,securitySettingsStoreState:l,disabled:m}),r()($e,{spaceStore:t,accessRequestRenderValues:v,lastOpenedRequestCenterTime:o})):r()("div",{style:g.errorContainer},void 0,r()(ce.Z,{}));var h,v}function et(e){window.__c={n:"AllowMembershipRequestsToggle"};const t=(0,Oe.O7)(),{spaceStore:s,securitySettingsStoreState:i,disabled:o}=e,n=(0,we.yK)((()=>({toggleContainer:{display:"flex",alignItems:"center",cursor:"pointer",marginBottom:14},titleDescription:{fontSize:14,marginRight:8,flexGrow:1},description:{marginTop:2,width:"80%"}})),[]);return r()("div",{style:n.toggleContainer,onClick:function(){i&&Ke.n(t,{securitySettingsState:{...i,disableMembershipRequests:!i.disableMembershipRequests},spaceStore:s})}},void 0,r()("div",{style:n.titleDescription},void 0,r()(w.FormattedMessage,{id:"spaceSettingsRequests.allowMembersToRequestMembers.title",description:"Title for a setting that, when on, will allow workspace members to request users to become workspace members.",defaultMessage:"Allow members to request adding other members"}),r()(Me.Z,{isSmall:!0,isMultiline:!0,style:n.description},void 0,r()(w.FormattedMessage,{id:"spaceSettingsRequests.allowMembersToRequestMembers.description",description:"Description for a setting that, when on, will allow workspace members to request users to become workspace members.",defaultMessage:"Members can submit requests to admins to add more members"}))),r()(ye.Z,{on:!o}))}function tt(e){window.__c={n:"AllowGuestMembershipRequestsToggle"};const t=(0,Oe.O7)(),{spaceStore:s,securitySettingsStoreState:i,disabled:o}=e,n=(0,we.yK)((()=>({toggleContainer:{display:"flex",alignItems:"center",cursor:"pointer",marginBottom:14},titleDescription:{fontSize:14,marginRight:8,flexGrow:1},description:{marginTop:2,width:"80%"}})),[]);return r()("div",{style:n.toggleContainer,onClick:function(){i&&Ke.n(t,{securitySettingsState:{...i,disableGuestMembershipRequests:!i.disableGuestMembershipRequests},spaceStore:s})}},void 0,r()("div",{style:n.titleDescription},void 0,r()(w.FormattedMessage,{id:"spaceSettingsRequests.allowGuestsToSelfRequest.title",description:"Title label for workspace toggle that enables guest self-request membership feature.",defaultMessage:"Allow page guests to request to be added as members to the workspace"}),r()(Me.Z,{isSmall:!0,isMultiline:!0,style:n.description},void 0,r()(w.FormattedMessage,{id:"spaceSettingsRequests.allowGuestsToSelfRequest.description",description:"Description of label for workspace toggle that enables guest self-request membership feature.",defaultMessage:"Guests of the workspace can submit requests to admins to be added as members"}))),r()(ye.Z,{on:!o}))}var st=s(95209),it=s(79817),ot=s(75472),nt=s(52878),rt=s(1743),at=s(9019),lt=s(44532),dt=s(24145),ut=s(43579);const mt=(0,w.defineMessages)({reason_placeholder:{id:"RequestMembersModal.reason.placeholder",defaultMessage:"Add a reason (optional)",description:"The message that's used in an input placeholder asking the inviter to provide a reason why the invitee should be added."}});const ct=function(e){window.__c={n:"RequestMembersModal"};const t=(0,Oe.O7)(),{store:s,origin:i,analyticsFrom:n}=e,[a,l]=(0,d.useState)(!1),[u,m]=(0,d.useState)("none"),p=(0,Ne.qz)(void 0,nt.Z),g=(0,w.useIntl)(),h=(0,we.yK)((()=>({modalStyle:{alignSelf:"center",overflow:"visible",top:0,width:420},container:{padding:20},title:{fontWeight:S.Z.fontWeight.medium,marginBottom:10},reasonTitle:{color:c.ZP.mediumTextColor,marginTop:10,marginBottom:5},footer:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:15},requestInvitesButton:{marginLeft:20}})),[]),v=e=>{e.currentTarget===e.target&&m("none")},f=async()=>{C.cir(t,{...it.Oh(t,p.state.contextualInviteStore),from:n}),st.eH({permissionsInviteStore:p.state.permissionsInviteStore,contextualInviteStore:p.state.contextualInviteStore}),p.state.contextualInviteStore.startRequestMembership();const e=p.state.contextualInviteStore.state.invitedUsers;l(!1);const i=await it.fC({environment:t,spaceStore:s,originId:void 0,originType:n,reasonMessage:p.state.permissionsInviteStore.state.emailMessage,contextualInviteStore:p.state.contextualInviteStore,intl:g});b({success:i,intl:g,users:e}),p.reset()},b=e=>{const{success:t,intl:s,users:i}=e;0!==i.length&&(t?R.oV({label:s.formatMessage({id:"requestMembersModal.requestSuccess.toast",defaultMessage:"Successfully requested membership for {users} to your workspace admins.",description:"Client side message shown when the membership request succeeds on the server side."},{users:it.uJ(i,s)})}):R.oV({label:s.formatMessage({id:"requestMembersModal.requestFail.toast",defaultMessage:"Failed to invite {users} to the workspace.",description:"Client side message shown when the membership request fails on the server side."},{users:it.uJ(i,s)})}))};return r()(at.Z,{modalStyle:h.modalStyle,open:a,onDismiss:async()=>{await(0,ot.Aw)({environment:t,permissionsInviteStoreState:p.state.permissionsInviteStore.state,from:"space_settings_add_members"})||(l(!1),p.reset()),m("none")},renderContent:()=>r()("div",{style:h.container,onClick:v},void 0,r()("div",{style:h.title,onClick:v},void 0,r()(w.FormattedMessage,{id:"requestMembersModal.title",defaultMessage:"Request to invite members",description:"Title for form where you are prompted to input emails to request to be members."})),r()(lt.ZP,{popupType:lt.kQ.Popup,alignmentToOrigin:lt.ZP.Alignment.Start,placementToOrigin:lt.ZP.Placement.Bottom,open:"invites"===u,sameWidthAsOrigin:!0,originGap:10,disableMouseCapture:!0,origin:r()(dt.Z,{permissionsInviteStore:p.state.permissionsInviteStore,store:s,handleClickRemoveToken:e=>{st.PV({targetToRemove:e,permissionsInviteStore:p.state.permissionsInviteStore,defaultRoleForNonBot:"read_and_write"})},handleInputChange:async e=>{m("invites"),await st.jC({environment:t,event:e,permissionsInviteStore:p.state.permissionsInviteStore})},handleInputSubmit:async()=>{},origin:"add_members",defaultRoleForNonBot:"read_and_write",isTeamsEnabled:!1,right:r()("div",{}),focus:"invites"===u,handleFocus:()=>m("invites")}),onDismiss:()=>m("none"),render:()=>{const e=r()(ut.Z,{permissionsInviteStore:p.state.permissionsInviteStore,store:s,defaultRoleForSpaceBot:"editor",shouldShowBots:!1,shouldShowGroups:!1,sectionRenderLimit:10,membersOnly:!1}),t={menuType:O.og.Popup,disableScroller:!1};return r()("div",{},void 0,d.createElement(pe.Z,o()({},t,{width:380}),e))},style:{width:"100%"}}),r()("div",{style:h.reasonTitle,onClick:v},void 0,r()(w.FormattedMessage,{id:"requestMembersModal.reasonForRequest.title",defaultMessage:"Reason for request",description:"Title for the reason section of the form."})),r()(rt.Z,{capture:!0,allowEsc:!0},void 0,r()(me.Z,{textarea:!0,style:{padding:8},value:p.state.permissionsInviteStore.state.emailMessage,focus:"reason"===u,onFocus:()=>m("reason"),onChange:e=>{p.state.permissionsInviteStore.setState({...p.state.permissionsInviteStore.state,emailMessage:e.target.value})},placeholder:g.formatMessage(mt.reason_placeholder)})),r()("div",{style:h.footer,onClick:v},void 0,r()(Me.Z,{isSecondaryColor:!0,isSmall:!0,isMultiline:!0},void 0,r()(w.FormattedMessage,{id:"RequestMembersModal.caption",defaultMessage:"Your admins will approve or decline your request.",description:"Caption explaining the user will get notified once the invite they requested is resolved."})),r()(ne.Z,{isLarge:!0,style:h.requestInvitesButton,onClick:f},void 0,r()(w.FormattedMessage,{id:"requestMembersModal.requestInvitesButton.label",defaultMessage:"Request invites",description:"Button to request admin to send invites to the users selected."})))),origin:r()("div",{onClick:()=>{C.HmE(t,{...it.Oh(t,p.state.contextualInviteStore)}),l(!0)}},void 0,i)})};var pt=s(83890),gt=s(98707),ht=s(27386),vt=s(23189),ft=s(40394),bt=s(57688),yt=s(33929),St=s(33846),Mt=s(31194),wt=s(48690),Tt=s(30397),Ct=s(48019),kt=s(68894),It=s(93686);const Zt=(0,w.defineMessages)({filterTeams:{defaultMessage:"Filter teamspaces…",id:"teamsDropdownForGroupMenu.filterForTeams.placeholder",description:"Placeholder text for filtering teamspaces within a group."}});function _t(e){window.__c={n:"TeamsPopup"};const t=(0,Oe.O7)(),s=(0,we.yK)((()=>({teamMenuItem:{fontWeight:400}})),[]),[i,n]=(0,Ne.AF)(void 0,St.Z),a=(0,d.useCallback)((e=>bt.RF({environment:t,teamId:e,tab:wt.a.Members,from:"teams_dropdown_for_group"})),[t]),l=(0,Ne.VK)((()=>[{key:"teams for group",render:e=>d.createElement(fe.Z,e),actions:e.teamStores.map((e=>({key:e.id,displayName:e.getName(),analyticsName:e.getName()||"team_unknown",searchName:e.getName(),render:t=>d.createElement(ae.Z,o()({icon:r()(It.p,{disabled:!0,store:e}),title:r()(Me.Z,{style:s.teamMenuItem},void 0,e.getName()),right:r()(w.FormattedMessage,{defaultMessage:"{numMembers} {numMembers, plural, one {member} other {members}}",id:"teamsInGroupMenu.filterForTeams.numMembers",description:"Number of members in a teamspace, displayed in a popup showing teamspaces connected to a group.",values:{numMembers:e.getUserIdsInTeam().length}})},t)),action:()=>{a(e.id)},closeParentMenu:!0})))}]),[s,e.teamStores,a]),u=i.inputValue,m=r()(Ct.Z,{filter:u,context:{blocks:[],environment:t,publicEditMode:void 0},sections:l,initialFocus:0}),c=r()(fe.Z,{isInput:!0},void 0,r()(kt.ZP,{value:u,onChange:(0,d.useCallback)((e=>{n({inputValue:e.target.value,focus:!1})}),[n]),focus:!0,focusAfterAnimation:!0,placeholder:yt.default.formatMessage(Zt.filterTeams)})),p={menuType:O.og.Popup,width:280,maxHeight:"50vh",header:e.teamStores.length>5?c:void 0};return d.createElement(pe.Z,p,m)}const Pt=function(e){window.__c={n:"TeamsDropdownForGroup"};const t=(0,Ne.qz)(void 0,xe.Z),[s]=(0,Ne.AF)(Tt.Z),i=(0,we.yK)((e=>({button:{marginRight:8},noTeams:{marginRight:8,color:e.lightTextColor},chevron:{width:10,marginLeft:4,fill:e.lightIconColor}})),[]),n=(0,Ne.VK)((()=>s.teams.filter((t=>t.getMembers().some((t=>"group"===t.entity_type&&t.group_id===e.group.id))))),[s,e.group]);return r()(le.ZP,{popupType:le.Z4.Popup,renderOrigin:e=>d.createElement(Be.Z,o()({disabled:0===n.length,style:0===n.length?i.noTeams:i.button},e),0===n.length?r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.userGroup.teamsCountNone",defaultMessage:"None",description:"Button for displaying that this group is not part of any teamspaces."}):r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.userGroup.teamsCount",defaultMessage:"{numberOfTeams, plural, one {{numberOfTeams} teamspace} other {{numberOfTeams} teamspaces}}",description:"Button for displaying how many teamspaces this group is a part of.",values:{numberOfTeams:n.length}}),n.length>0&&g.Z.chevronDown(i.chevron)),buttonPopupStore:t,placementToOrigin:Mt.Iw.Bottom,render:e=>r()(_t,{parent:e,teamStores:n}),onClose:(0,d.useCallback)((()=>{t.reset()}),[t])})};var Ft=s(19522),xt=s(93405);function Rt(e){window.__c={n:"GroupActionMenu"};const{group:t,spaceStore:s,settingsStore:i}=e,n=(0,Ne.qz)(void 0,xe.Z);return r()(le.ZP,{popupType:lt.kQ.Popup,render:()=>r()(Gt,{group:t,spaceStore:s,popupStore:n,settingsStore:i}),buttonPopupStore:n,renderOrigin:e=>d.createElement(ue.Z,o()({icon:g.Z.dots},e))})}function Gt(e){window.__c={n:"ActionMenu"};const{group:t,spaceStore:s,popupStore:i,settingsStore:n}=e,a=(0,Q.Gc)(),u=(0,Ne.VK)((()=>s.canAdmin()),[s]),m=(0,Oe.O7)(),c=(0,we.yK)((e=>({deleteButton:{color:e.redBadgeBackground}})),[]),p=(0,d.useCallback)((async()=>{i.setState({open:!1});await Z.confirmUserAction({message:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.deleteGroupModal.confirmationMessage",defaultMessage:"Are you sure you want to delete this group? Any pages that are private to this group will be transferred to you."}),acceptLabel:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.deleteGroupModal.confirmationButton.label",defaultMessage:"Yes"})})&&(await B.createAndCommitAsync({environment:m,userAction:"SpacePermissionGroup.handleDelete",waitForServerCommit:!1,perform:async e=>{await F.Xv({environment:m,spaceStore:s,group:t,transaction:e})}}),C.dan(m))}),[t,m,s,i]),g=(0,d.useCallback)((()=>{n.setState({...n.state,editingNameGroupId:t.id,groupNameInputValue:t.name||""}),i.setState({open:!1}),C.XbW(m)}),[t,m,i,n]),h=(0,d.useCallback)((()=>{Ft.Z.setState({...Ft.Z.state,name:t.name||"",defaultInviteTargets:[{type:"group",value:t}]}),bt.lo("group_settings")}),[t]),v={key:"action_menu",render:e=>d.createElement(fe.Z,e),items:l().compact([{key:"rename",render:e=>d.createElement(xt.Z,o()({},e,{title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupList.actionMenu.renameItem",defaultMessage:"Rename"})})),action:g},a?{key:"create_team_from_group",render:e=>d.createElement(xt.Z,o()({},e,{title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupList.actionMenu.createTeamFromGroup",defaultMessage:"Create teamspace from group",description:"Button text shown when you click on the three-dot menu of a group in group settings. Clicking on it allows you to create a teamspace using the group's information."})})),action:h}:void 0,u&&{key:"delete",render:e=>d.createElement(xt.Z,o()({},e,{title:r()("div",{style:c.deleteButton},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupList.actionMenu.deleteItem",defaultMessage:"Delete"}))})),action:p}])};return r()(pe.Z,{menuType:O.og.Popup},void 0,r()(ge.Z,{type:ge.i.Vertical,initialFocus:0,sections:[v],onAccept:()=>{i.setState({open:!1})}}))}class Bt extends m.default{getInitialState(){return{userInputValue:"",temporaryUserIds:[],limitUsers:!0}}}const qt=Bt;var At=s(86125),Ut=s(66897),Et=s(33728),Dt=s(31299),Lt=s(92864),Ot=s(47082),Nt=s(97680);function Kt(e){window.__c={n:"GroupAddMembersButton"};const{group:t,spaceStore:s,groupStore:i}=e,n=(0,Ne.qz)(void 0,xe.Z),a=(0,we.yK)((()=>({popup:{width:400},button:{marginTop:4}})),[]);return r()(le.ZP,{popupType:lt.kQ.Popup,render:()=>r()(Vt,{spaceStore:s,group:t,popupStore:n,groupStore:i}),buttonPopupStore:n,onClose:()=>i.setState({userInputValue:"",temporaryUserIds:[],limitUsers:!0}),style:a.popup,renderOrigin:e=>r()("div",{},void 0,d.createElement(Be.Z,o()({isGray:!0,icon:g.Z.plus,style:a.button},e),r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupList.addMemberButton.label",defaultMessage:"Add members"})))})}function Vt(e){window.__c={n:"AddMemberMenu"};const t=(0,Oe.O7)(),s=(0,w.useIntl)(),{group:i,spaceStore:o,popupStore:n,groupStore:a}=e,u=(0,Ne.VK)((()=>a.state.temporaryUserIds.map((e=>{const t=o.getRecordValue({table:f.KJ,id:e});return r()(Lt.vw,{userValue:t,format:Lt.vw.Format.Medium,showRemoveButton:!0,onClickRemove:()=>{const t=a.state.temporaryUserIds.filter((t=>t!==e));a.setState({...a.state,temporaryUserIds:t})},shouldShrink:!0,isSingle:!1},e)}))),[o,a]),m=(0,Ne.VK)((()=>()=>{const{temporaryUserIds:e}=a.state,s=i.user_ids||[],r=l().union(s,e),d={...i,user_ids:r,last_edited_time:Date.now()};B.createAndCommit({userAction:"SpacePermissionGroup.handleAddDoneClick",environment:t,perform:e=>{F.jF({spaceStore:o,group:d,transaction:e})}}),a.setState({userInputValue:"",temporaryUserIds:[],limitUsers:!0}),n.setState({open:!1}),C.Kf$(t,{add_member_count:e.length})}),[i,t,a,n,o]),c=(0,d.useCallback)((()=>{const{temporaryUserIds:e}=a.state,t=e.slice(0,e.length-1);a.setState({...a.state,temporaryUserIds:t})}),[a]),p=(0,d.useCallback)((e=>{const t=e.target.value,{extractedEmails:s,newInputValue:i}=(0,Et.zI)(t),{currentSpaceStore:o}=E.default.state,{data:n}=se.default.state;if(!n||!o)return;const r=(0,H.CM)(n).map((e=>e.userId)),d=l().compact(r.map((e=>$.U6.createChildStore(o,{table:f.KJ,id:e}).getValue()))).filter((e=>s.includes(e.email)&&!a.state.temporaryUserIds.includes(e.id)));a.setState({...a.state,temporaryUserIds:[...a.state.temporaryUserIds,...d.map((e=>e.id))],userInputValue:i})}),[a]),g=(0,Ne.VK)((()=>a.state.userInputValue),[a]),h=(0,Ne.VK)((()=>a.state.temporaryUserIds),[a]);return r()(pe.Z,{menuType:O.og.Popup,tokenInputHeader:!0,header:r()(Ot.Z,{focus:!0,disabled:!1,focusAfterAnimation:!0,format:Ot.Z.Format.Group,tokens:u,placeholder:s.formatMessage({id:"spacePermissionsSettings.groupsTab.userGroup.userSearchInput.placeholder",defaultMessage:"Search for a person…"}),onRemoveLastToken:c,value:g,onChange:p,inputAndTokenWrapRightStyle:{paddingTop:t.device.isMobile?0:6,paddingBottom:t.device.isMobile?0:6},right:r()(ne.Z,{isLarge:!0,onClick:m},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.userGroup.addUserButton.label",defaultMessage:"Add"}))})},void 0,r()(ve.Z,{request:{query:g,temporaryUserIds:h},performRequest:async s=>{let{query:i,temporaryUserIds:o}=s;const n=e.group.user_ids||[];return(await Dt.Yu({environment:t,query:i,membersOnly:!0})).filter((e=>n.indexOf(e.id)<0&&o.indexOf(e.id)<0)).slice(0,20)},render:(e,t)=>r()(Wt,{results:t,spaceStore:o,groupStore:a})}))}function Wt(e){window.__c={n:"AddMemberResults"};const{spaceStore:t,groupStore:s}=e,[i,n]=(0,Ne.AF)(s,qt),a=(e.results||[]).map((e=>{let{id:t}=e;return t})),l=(0,Ne.VK)((()=>a.map((e=>{const s=$.U6.createChildStore(t,{table:f.KJ,id:e}).getValue();return{key:e,render:e=>d.createElement(Nt.Z,o()({},e,{actor:(0,Ut.m3)(s),useEmailAsTooltip:!0})),action:()=>{const t=[...i.temporaryUserIds,e];n({...i,temporaryUserIds:t,userInputValue:""})}}}))),[t,n,i,a]);if(0===a.length)return r()(fe.Z,{},void 0,r()(Ge.Z,{title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.userGroup.searchUserDropdown.noResultsMessage",defaultMessage:"No results"})}));{const e={key:"user_menu",render:e=>d.createElement(fe.Z,e),items:l};return r()(ge.Z,{type:ge.i.Vertical,initialFocus:0,sections:[e]})}}function zt(e){window.__c={n:"GroupMembers"};const{group:t,canEdit:s,spaceStore:i,settingsStore:n}=e,a=(0,w.useIntl)(),l=(0,Ne.qz)(void 0,qt),{groupMembers:u,remainingMembers:m}=(0,Ne.VK)((()=>{const{countRemainingUsers:e,totalNumberMembers:s,limitedUserStores:o}=(0,Te.rm)({group:t,spaceStore:i,limit:l.state.limitUsers&&!n.state.groupsFilter?10:void 0});return{groupMembers:(0,Te.N5)({userStores:o,spaceStore:i,intl:a}),remainingMembers:e,totalMembers:s}}),[t,i,n,l,a]);return r()("div",{style:{padding:"4px 42px 8px"}},void 0,u.map((t=>d.createElement(Ht,o()({key:t.id,userStore:t},e)))),m>0&&r()(Be.Z,{isGray:!0,style:{marginTop:4},onClick:()=>{l.setState({...l.state,limitUsers:!1})}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.showMoreUsersButton.label",defaultMessage:"{numberOfHiddenUsers, plural, one {Show {numberOfHiddenUsers} more} other {Show {numberOfHiddenUsers} more}}",values:{numberOfHiddenUsers:m}})),s?r()(Kt,{group:t,spaceStore:i,groupStore:l}):u.length<1&&r()(Be.Z,{disabled:!0,isGray:!0},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupList.noMembersInside",defaultMessage:"No members inside",description:"A label saying that there are no members inside this group."})))}function Ht(e){window.__c={n:"GroupMember"};const{spaceStore:t,userStore:s,group:i,canEdit:o}=e,n=(0,Oe.O7)(),a=(0,Ne.VK)((()=>t.isDefined()?(0,N.su)(t.getPermissionItems(),s.id):"none"),[t,s]);return r()("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},s.id,r()("div",{style:{display:"flex"}},void 0,r()(Qe.Z,{userStore:s,style:{fontSize:14,fontWeight:400,lineHeight:"17px",paddingRight:6,minHeight:34,width:"100%"},avatarSize:22}),(0,h.Bc)(a)&&r()(At.Z,{role:"membership_admin"===a?"membership_admin":"admin"})),o&&r()(Be.Z,{isGray:!0,hoveredStyle:{color:c.ZP.red},onClick:async()=>{if(await Z.confirmUserAction({message:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.removeMemberFromGroupDialog.confirmationMessage",defaultMessage:"Are you sure you want to remove this member?"}),acceptLabel:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.removeMemberFromGroupDialog.confirmationButton.label",defaultMessage:"Yes"})})){const e=(i.user_ids||[]).filter((e=>e!==s.id)),o={...i,user_ids:e,last_edited_time:Date.now()};B.createAndCommit({userAction:"SpacePermissionGroup.renderUser",environment:n,perform:e=>{F.jF({spaceStore:t,group:o,transaction:e})}}),C.xtf(n)}}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.removeMemberFromGroupButton.label",defaultMessage:"Remove"})))}var jt=s(13991),Qt=s(22808),Jt=s(49312),Yt=s(12793),$t=s(3386),Xt=s(5210);function es(e){window.__c={n:"GroupNameToggle"};const{row:t,canEdit:s,open:i,toggleOpenState:n,spaceStore:a,settingsStore:l}=e,u=t.group,m=(0,w.useIntl)(),c=(0,we.Fg)(),p=(0,Oe.O7)(),h=Te.kF({intl:m,group:u}),v=(0,we.yK)((e=>({container:{display:"flex",justifyContent:"flex-start",alignItems:"center",width:"100%"},toggle:{flexShrink:0,marginRight:2},chevron:{width:12,height:12,transition:"transform 200ms ease-out",transform:`rotateZ(${i?0:-90}deg)`,fill:"inherit",opacity:.5,marginRight:4},name:{fontFamily:S.Z.getCompositeFontFamily(jt.SP).sans,fontSize:14,lineHeight:"17px",marginRight:4},input:{fontWeight:S.Z.fontWeight.medium,padding:"4px 6px",background:e.contentBackgroundTransparent},icon:{marginRight:9}})),[i]),f=(0,d.useCallback)((e=>{const t={...u,icon:e,last_edited_time:Date.now()};B.createAndCommit({userAction:"SpacePermissionGroup.handleIconChange",environment:p,perform:e=>{F.jF({spaceStore:a,group:t,transaction:e})}}),C.zUE(p,{is_emoji:(0,Qt.Z)(e)})}),[u,a,p]),b=(0,d.useCallback)((()=>{l.setState({...l.state,editingNameGroupId:void 0,groupNameInputValue:""})}),[l]),y=(0,d.useCallback)((e=>{l.setState({...l.state,groupNameInputValue:e.target.value})}),[l]),M=(0,d.useCallback)((()=>{const{editingNameGroupId:e,groupNameInputValue:t}=l.state,s=t.trim();if(e===u.id){if(s!==u.name){const e={...u,name:s,last_edited_time:Date.now()};B.createAndCommit({userAction:"SpacePermissionGroup.handleNameAccept",environment:p,perform:t=>{F.jF({spaceStore:a,group:e,transaction:t})}})}l.setState({...l.state,editingNameGroupId:void 0,groupNameInputValue:""})}}),[u,p,a,l]),T=(0,Ne.VK)((()=>l.state.editingNameGroupId===u.id),[u,l]),k=(0,Ne.VK)((()=>l.state.groupNameInputValue),[l]);function I(e){const t={width:e-4,height:e-4,fill:c.mediumIconColor},s={width:12,height:12,fill:c.mediumIconColor};return r()("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"}},void 0,g.Z.random(t),g.Z.plusThick(s))}return r()("div",{style:v.container},void 0,r()(Xt.Z,{isSidebar:!1,fill:!0,icon:"chevron",open:i,color:c.mediumIconColor,onClick:()=>n(u.id),style:v.toggle}),r()(Yt.Z,{size:28,style:v.icon}),T?r()($t.Z,{capture:!0,onEsc:b},void 0,r()(me.Z,{disabled:!s,type:Jt.Z.Type.Inline,style:v.input,placeholder:m.formatMessage({id:"spacePermissionsSettings.groupsTab.userGroup.groupNameInput.placeholder",defaultMessage:"Untitled"}),focus:!0,value:k,onChange:y,onBlur:M,onSubmit:M})):r()(Me.Z,{style:v.name,showTooltipWhenTruncated:!0},void 0,h),(Z=t.isRowHovered,u.icon?r()(Ce.Z,s?{disabled:!1,bucket:"public",icon:u.icon?{pointer:a.pointer,icon:u.icon}:void 0,size:18,isEmptyPage:!1,title:h,onChange:f,style:v.icon}:{disabled:!0,bucket:"public",icon:u.icon?{pointer:a.pointer,icon:u.icon}:void 0,size:18,isEmptyPage:!1,title:h,style:v.icon}):Z&&s?r()(Se.Z,{renderTooltip:()=>r()(w.FormattedMessage,{defaultMessage:"Add icon",id:"spacePermissionsSettings.groupsTab.userGroup.groupIcon.tooltip",description:"Tooltip explaining that user can add an icon for a group"}),render:e=>d.createElement(Ce.Z,o()({disabled:!1,bucket:"public",icon:u.icon?{pointer:a.pointer,icon:u.icon}:void 0,size:18,isEmptyPage:!1,title:h,onChange:f,style:{...v.icon,width:30},defaultIcon:I(18)},e))}):void 0));var Z}function ts(e){let{groups:t,canEdit:s,spaceStore:i,permissionsSettingsStore:o}=e;window.__c={n:"SpaceGroupsTable"};const[n,a]=(0,d.useState)([]),l=(0,we.Fg)(),u=(0,Q.Gc)(),m=(0,Ne.VK)((()=>(0,p.ZP)(o.state.groupsFilter,t,(e=>e.name||""))),[o,t]),c=(0,d.useCallback)((e=>{a((t=>t.includes(e)?t.filter((t=>t!==e)):t.concat(e)))}),[a]),g=(0,d.useMemo)((()=>function(e){return e.map((e=>({id:e.id,group:e,isClickable:!1})))}(m)),[m]),h=(0,d.useMemo)((()=>function(e){let{openRowIds:t,toggleOpenRowId:s,canEdit:i,spaceStore:o,settingsStore:n,isTeamEnabled:a}=e;const l={id:"title",headerTitle:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.spaceGroupsTable.groups",defaultMessage:"Group",description:"Title of the groups column of the groups table."}),renderCell:e=>r()(es,{row:e,open:t.includes(e.id),toggleOpenState:s,canEdit:i,spaceStore:o,settingsStore:n}),widthData:{width:120},hasClickableContents:!1,sortable:!1},d={id:"teams",headerTitle:r()("div",{style:{paddingLeft:8}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.spaceGroupsTable.teams",defaultMessage:"Teamspaces",description:"Title of the teamspaces column of the groups table."})),renderCell:e=>r()("div",{style:S.Z.textOverflowStyle},void 0,r()(Pt,{group:e.group})),widthData:{width:40},hasClickableContents:!1,sortable:!1},u={id:"members",headerTitle:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.spaceGroupsTable.member",defaultMessage:"Members",description:"Title of the members column of the groups table."}),renderCell:e=>{var t;return r()("div",{style:S.Z.textOverflowStyle},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.userGroup.memberCount",defaultMessage:"{numberOfGroupMembers, plural, one {{numberOfGroupMembers} member} other {{numberOfGroupMembers} members}}",values:{numberOfGroupMembers:(null===(t=e.group.user_ids)||void 0===t?void 0:t.length)||0}}))},widthData:{width:40},hasClickableContents:!1,sortable:!1},m={id:"menu",headerTitle:null,renderCell:e=>r()(Rt,{group:e.group,spaceStore:o,settingsStore:n}),widthData:{width:20},hasClickableContents:!0,sortable:!1};return[l,...a?[d]:[],u,...i?[m]:[]]}({openRowIds:n,toggleOpenRowId:c,canEdit:s,spaceStore:i,settingsStore:o,isTeamEnabled:u})),[n,c,s,i,o,u]),v=(0,ft.b)({columnRenderInfo:h,theme:l});return r()(ft.D,{showRowBorders:!0,hideHeaderRowPadding:!0,columnRenderInfo:h,rows:g,styles:v,renderNoRowsComponent:()=>r()(Me.Z,{isSmall:!0,style:{marginLeft:5,marginTop:10,marginBottom:20}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.spaceGroupsTable.noGroupsFound",defaultMessage:"No groups found.",description:"Message displayed on the groups table in space settings when there are no groups matching the user's search query."})),renderRowChild:e=>n.includes(e.id)?r()(zt,{group:e.group,canEdit:s,spaceStore:i,settingsStore:o}):void 0})}var ss=s(43768);function is(e){window.__c={n:"ButtonStack"};const{items:t,clickHandlerContext:s}=e,i=os(),o=function(){const e=os();return(0,d.useMemo)((()=>({destructive:{default:e.destructiveButtonDefault,hovered:e.destructiveButtonHovered,pressed:e.destructiveButtonPressed},primary:{default:e.primaryButtonDefault,hovered:e.primaryButtonHovered,pressed:e.primaryButtonPressed},secondary:{default:e.secondaryButtonDefault}})),[e.destructiveButtonDefault,e.destructiveButtonHovered,e.destructiveButtonPressed,e.primaryButtonDefault,e.primaryButtonHovered,e.primaryButtonPressed,e.secondaryButtonDefault])}();return r()("div",{style:i.wrapper},void 0,t.map((e=>{const t=e.combinedStyles??o[e.buttonType];return r()(re.Z,{style:null==t?void 0:t.default,hoveredStyle:null==t?void 0:t.hovered,pressedStyle:null==t?void 0:t.pressed,onClick:()=>e.onClick(e,s)},e.key,e.label)})))}function os(){return(0,we.yK)((e=>{const t={alignItems:"center",borderRadius:3,boxShadow:void 0,display:"inline-flex",flexShrink:0,fontSize:14,fontWeight:S.Z.fontWeight.medium,height:28,justifyContent:"center",lineHeight:1.2,paddingLeft:12,paddingRight:12,whiteSpace:"nowrap",width:"100%"};return{destructiveButtonDefault:{...t,background:e.redBadgeBackground,color:c.ZP.white,fill:c.ZP.lightTextColor},destructiveButtonHovered:{background:c.ZP.redWithAlpha(.8)},destructiveButtonPressed:{background:c.ZP.red},primaryButtonDefault:{...t,background:c.ZP.blue,color:c.ZP.white,fill:c.ZP.lightTextColor,height:32},primaryButtonHovered:{background:e.blueButtonHoveredBackground},primaryButtonPressed:{background:e.blueButtonPressedBackground},secondaryButtonDefault:{...t,background:e.whiteButtonBackground,color:e.mediumTextColor,fill:c.ZP.lightTextColor},wrapper:{display:"flex",flexDirection:"column",gap:4}}}),[])}function ns(e){window.__c={n:"BillingModalStackLayout"};const t=(0,we.yK)((()=>({wrapper:{display:"flex",flexDirection:"column",gap:24,marginTop:20}})),[]);return r()("div",{style:{...t.wrapper,...e.styles}},void 0,e.children)}function rs(e){window.__c={n:"SmallModalHeader"};const{icon:t,title:s,description:i,customIcon:o}=e,n=(0,we.yK)((e=>({description:{color:e.text.secondary,fontSize:14,lineHeight:"18px",letterSpacing:-.154,textAlign:"center"},icon:{display:"inline",height:34,fill:"#8E8B87"},title:{color:e.text.primary,textAlign:"center",fontSize:16,lineHeight:"1.3",fontWeight:S.Z.fontWeight.medium,letterSpacing:-.32,textWrap:"balance"},wrapper:{display:"flex",flexDirection:"column",gap:8}})),[]);return r()("div",{style:n.wrapper},void 0,t?t(n.icon):o||null,r()("div",{style:n.title},void 0,s),i?r()("div",{style:n.description},void 0,i):null)}function as(e){window.__c={n:"ContractionConfirmation"};const{onFinished:t,userId:s,userContractionMessages:i}=e,o=(0,we.yK)((e=>({highlights:{color:e.text.secondary,fontSize:14,lineHeight:"18px",letterSpacing:-.154,textAlign:"left",marginTop:-28,marginBottom:-20,marginLeft:-16},customIcon:{alignSelf:"center"},wrapper:{marginTop:4}})),[]),n=(0,w.useIntl)(),a=(0,d.useCallback)((e=>{"submit"!==e.key?t(!1):t(!0)}),[t]),l=(0,Ne.VK)((()=>E.default.state.currentSpaceStore),[]),u=(0,Ne.VK)((()=>{if(!l)return;const e=$.U6.createChildStore(l,{id:s,table:f.KJ});return e.isDefined()&&!e.getIsDeleted()?e:void 0}),[l,s]),m=(0,Ne.VK)((()=>null==u?void 0:u.getDisplayName(n)),[u,n]);return r()(ns,{styles:o.wrapper},void 0,r()(rs,{customIcon:r()(Je.Z,{userStore:u,size:34,style:o.customIcon}),title:ms(m),description:ds(i)}),r()("div",{style:o.highlights},void 0,r()("ul",{},void 0,i.map(((e,t)=>r()("li",{},`contraction_highlight_${t}`,e))))),r()(is,{items:[{key:"submit",buttonType:"destructive",label:us(m),onClick:a},{key:"cancel",buttonType:"secondary",label:r()(w.FormattedMessage,{id:"contractionConfirmation.cancel",defaultMessage:"Cancel",description:"Cancellation button message to exit out of the flow to remove a member from a workspace."}),onClick:a}]}))}function ls(e){return r()(w.FormattedMessage,e>2e3?{id:"contractionConfirmation.amount.2000",defaultMessage:"2000+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>1500?{id:"contractionConfirmation.amount.1500",defaultMessage:"1500+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>1e3?{id:"contractionConfirmation.amount.1000",defaultMessage:"1000+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>500?{id:"contractionConfirmation.amount.500",defaultMessage:"500+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>250?{id:"contractionConfirmation.amount.250",defaultMessage:"250+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>100?{id:"contractionConfirmation.amount.100",defaultMessage:"100+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>75?{id:"contractionConfirmation.amount.75",defaultMessage:"75+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>50?{id:"contractionConfirmation.amount.50",defaultMessage:"50+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>25?{id:"contractionConfirmation.amount.25",defaultMessage:"25+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>10?{id:"contractionConfirmation.amount.10",defaultMessage:"10+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:e>5?{id:"contractionConfirmation.amount.5",defaultMessage:"5+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."}:{id:"contractionConfirmation.amount.2",defaultMessage:"2+",description:"Shows the number of times a user has done an action in Notion in the last 28 days."})}function ds(e){return e.length>0?r()(w.FormattedMessage,{id:"contractionConfirmation.description.withName",defaultMessage:"They have been an active Notion member. Removing them may cause permanent loss of their private pages.",description:"Shown when a customer removes a member."}):r()(w.FormattedMessage,{id:"contractionConfirmation.description",defaultMessage:"They will immediately lose access to this workspace and no one will be able to access their private pages.",description:"Shown when a customer removes a member."})}function us(e){return e&&e.length<16?r()(w.FormattedMessage,{id:"contractionConfirmation.remove.withName",defaultMessage:"Remove {name}",description:"Confirmation button for the button to remove a member from a workspace.",values:{name:e}}):r()(w.FormattedMessage,{id:"contractionConfirmation.remove",defaultMessage:"Remove member",description:"Confirmation button for the button to remove a member from a workspace."})}function ms(e){return r()(w.FormattedMessage,e?{id:"contractionConfirmation.title.withName",defaultMessage:"Are you sure you want to remove {name}?",description:"Shown when a customer tries to remove a member.",values:{name:e}}:{id:"contractionConfirmation.title",defaultMessage:"Are you sure you want to remove this member?",description:"Shown when a customer tries to remove a member."})}async function cs(e,t,s){let i=[],o={};if(s){const n=await k.getUserContractionData(e,{userId:t,spaceId:s});"success"===n.type&&(o=n.data,i=function(e){const t=[];if(!("l28_active"in e))return t;const s=Number(e.l28_active);s>1&&t.push(r()(w.FormattedMessage,{id:"contractionConfirmation.activity",defaultMessage:"Visited <bold>{activeDays} days</bold> in the past month",description:"Shows the number of times a user has used Notion in the last 28 days.",values:{activeDays:ls(s),bold:e=>r()("b",{},void 0,e)}}));const i=Number(e.num_comments);i>1&&t.push(r()(w.FormattedMessage,{id:"contractionConfirmation.numberOfComments",defaultMessage:"Made <bold>{numberOfComments} comments</bold> in their lifetime",description:"Shows the number of comments a user has made in Notion in the last 28 days.",values:{numberOfComments:ls(i),bold:e=>r()("b",{},void 0,e)}}));const o=Number(e.num_pages_created);return o>1&&t.push(r()(w.FormattedMessage,{id:"contractionConfirmation.numberOfPages",defaultMessage:"Created <bold>{numberOfPages} pages</bold> in their lifetime",description:"Shows the number of pages a user has created in Notion in the last 28 days.",values:{numberOfPages:ls(o),bold:e=>r()("b",{},void 0,e)}})),t}(o))}return C.b9E({environment:e,userContractionData:o}),await ss.Z.showModal((s=>{const n=t=>{t?C.oIe({environment:e,userContractionData:o}):C.vwI({environment:e,userContractionData:o}),s(t)};return{dismissUsing:"onlyEscape",onDismiss:()=>n(!1),content:r()(as,{onFinished:n,userId:t,userContractionMessages:i})}}))}var ps=s(4615),gs=s(12508);const hs="other";function vs(e){window.__c={n:"BillingSurvey"};const{buttons:t,description:s,icon:i,options:o,otherOptionPlaceholder:n,randomizeOrder:a,title:l}=e,u=function(e,t){return(0,d.useMemo)((()=>{if(!t)return e;const s=e.find((e=>e.optionName===hs)),i=e.filter((e=>e!==s)).sort((()=>Math.random()-.5));return s&&i.push(s),i}),[t,JSON.stringify(e)])}(o,a),[m,c]=function(){const[e,t]=(0,d.useState)(new Set),s=(0,d.useCallback)((e=>{t((t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s}))}),[t]);return[e,s]}(),[p,g]=(0,d.useState)({}),h=(0,d.useMemo)((()=>({selectedOptionNames:Array.from(m),selectedOptionIndexes:u.map(((e,t)=>({option:e,index:t}))).filter((e=>{let{option:t}=e;return m.has(t.optionName)})).map((e=>{let{index:t}=e;return t})),customTextByOptionName:p})),[m,JSON.stringify(p)]);return r()(ns,{},void 0,r()(rs,{icon:i,title:l,description:s}),r()("div",{},void 0,u.map((e=>{const{type:t,optionName:s}=e,i=m.has(s);switch(t){case"checkbox":return r()(bs,{isChecked:i,option:e,toggleValue:c},s);case"checkboxAndInput":return r()(ys,{inputText:p[s]??"",isChecked:i,option:e,placeholderText:n,setInputText:e=>{g((t=>({...t,[s]:e})))},toggleValue:c},s);default:(0,y.t1)(t)}}))),r()(is,{items:t,clickHandlerContext:h}))}function fs(){return(0,we.yK)((()=>({checkbox:{marginTop:4},inlineInput:{margin:"0 12px 12px 12px",width:"calc(100% - 24px)"},row:{alignItems:"flex-start",cursor:"pointer",display:"flex",fontSize:14,gap:11,padding:"4px 20px 4px 12px"}})),[])}function bs(e){window.__c={n:"BillingSurveyCheckbox"};const{option:t,isChecked:s,toggleValue:i}=e,o=fs();return r()("div",{style:o.row,onClick:()=>i(t.optionName)},void 0,r()("div",{style:o.checkbox},void 0,r()(gs.Z,{checked:s,size:14})),r()("div",{},void 0,t.label))}function ys(e){window.__c={n:"BillingSurveyCheckboxAndInput"};const{inputText:t,isChecked:s,option:i,placeholderText:o,setInputText:n,toggleValue:a}=e,l=fs();return d.createElement(d.Fragment,null,r()(bs,{option:i,isChecked:s,toggleValue:a}),s?r()(me.Z,{style:l.inlineInput,autoFocus:!0,value:t,placeholder:o,onChange:e=>n(e.target.value)}):null)}function Ss(e){window.__c={n:"ContractionSurvey"};const{contractionSurveyId:t,onFinished:s}=e,i=(0,d.useCallback)(((e,i)=>{s(i?{contractionSurveyId:t,reasons:i.selectedOptionNames,reasonIndexes:i.selectedOptionIndexes,reasonOther:i.customTextByOptionName.other}:void 0)}),[t,s]),o=(0,d.useMemo)((()=>[{optionName:"not_using_enough",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.notUsingEnough",defaultMessage:"Not using it enough",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:"switching",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.switching",defaultMessage:"Switching to another tool",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:"no_longer_work_together",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.noLongerWorksHere",defaultMessage:"No longer works here",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:"no_longer_need_access",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.noLongerNeedAccess",defaultMessage:"No longer need access to Notion",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:"too_expensive",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.tooExpensive",defaultMessage:"Too expensive",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:"switching_to_another_workspace",type:"checkbox",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.switchingToAnotherWorkspace",defaultMessage:"Switching to another Notion workspace",description:"Shown as a checkbox option when asked why a customer is removing a member."})},{optionName:hs,type:"checkboxAndInput",label:r()(w.FormattedMessage,{id:"contractionSurvey.options.other",defaultMessage:"Other",description:"Shown as a checkbox option when asked why a customer is removing a member."})}]),[]);return r()(vs,{icon:g.Z.pencil,title:r()(w.FormattedMessage,{id:"contractionSurvey.title",defaultMessage:"Why are you removing this member from your workspace?",description:"Shown when a customer removes a member."}),description:r()(w.FormattedMessage,{id:"contractionSurvey.description",defaultMessage:"We'd love your input to make Notion better",description:"Shown when a customer attempts to downgrade from a paid plan."}),options:o,randomizeOrder:!0,buttons:[{key:"submit",buttonType:"primary",label:r()(w.FormattedMessage,{id:"contractionSurvey.continue",defaultMessage:"Continue",description:"Label on the continue button"}),onClick:i},{key:"cancel",buttonType:"secondary",label:r()(w.FormattedMessage,{id:"contractionSurvey.cancel",defaultMessage:"Cancel",description:"Label on the cancel button"}),onClick:i}]})}var Ms=s(66957);const ws=(0,w.defineMessages)({filterTeams:{defaultMessage:"Filter teamspaces…",id:"teamsDropdownForMember.filterForTeams.placeholder",description:"Placeholder text for filtering teamspaces within a group."}});function Ts(e){window.__c={n:"TeamGuestPageContent"};const{teamGuest:t}=e,s=(0,Oe.O7)(),i=(0,Ne.VK)((()=>E.default.state.currentSpaceStore),[]);if(!i)return null;if(0===t.guestPageIds.length)return null;const n=[{key:"pages",render:e=>d.createElement(fe.Z,e),items:t.guestPageIds.map((e=>{const t=$.G.createChildStore(i,{table:_e.iU,id:e});return{key:e,render:e=>d.createElement(qe.Z,o()({},e,{store:t,placeholder:r()(w.FormattedMessage,{id:"guestPagesPopup.privatePagePlaceholder",defaultMessage:"Private page"})})),action:()=>{const t=$.G.createChildStore(i,{table:_e.iU,id:e}),o=(0,Fe.ZP)({store:t,fullyQualified:!1,pageVisitSource:Ze.tY.LinkInPage});Pe.navigate({environment:s,url:o,openInNew:"tab"})}}}))}],a={menuType:O.og.Popup,minWidth:300,maxWidth:350,maxHeight:300,header:t.guestPageIds.length>0&&r()(Me.Z,{isSmall:!0,style:{color:c.ZP.regularTextColor,marginLeft:15,marginRight:15,paddingTop:6}},void 0,r()(w.FormattedMessage,{id:"guestpagesforteamguest.header",defaultMessage:"Pages",description:"Title for section of popup of pages the teamspace guest has access to."}))};return d.createElement(pe.Z,a,r()(ge.Z,{type:ge.i.Vertical,initialFocus:void 0,sections:n}))}function Cs(e){window.__c={n:"TeamGuestTeamContent"};const t=(0,Oe.O7)(),s=(0,Ne.qz)(void 0,St.Z),i=(0,Ne.VK)((()=>s.state.inputValue),[s]),n=(0,d.useCallback)((e=>bt.RF({environment:t,teamId:e,tab:wt.a.Members,from:"teams_dropdown_for_team_guest"})),[t]),a=(0,we.yK)((()=>({teamMenuItem:{fontWeight:400,maxWidth:180}})),[]),l=(0,Ne.VK)((()=>[{key:"teams for team guest",render:e=>d.createElement(fe.Z,e),actions:e.teamStores.map((e=>({key:e.id,displayName:e.getName(),analyticsName:e.getName()||"team_unknown",searchName:e.getName(),render:t=>d.createElement(ae.Z,o()({icon:r()(It.p,{disabled:!0,store:e}),title:r()(Me.Z,{style:a.teamMenuItem},void 0,e.getName()),caption:r()(w.FormattedMessage,{defaultMessage:"{numMembers} {numMembers, plural, one {member} other {members}}",id:"teamsDropdownForMember.numMembers",description:"Number of members in a teamspace, displayed in a popup showing teamspaces that a member is part of.",values:{numMembers:e.getUserIdsInTeam().length}}),inline:!0},t)),action:()=>{n(e.id)},closeParentMenu:!1})))}]),[e.teamStores,a.teamMenuItem,n]),u=r()(fe.Z,{isInput:!0},void 0,r()(kt.ZP,{value:i,onChange:(0,d.useCallback)((e=>{s.setState({inputValue:e.target.value,focus:!1})}),[s]),focus:!0,focusAfterAnimation:!0,placeholder:yt.default.formatMessage(ws.filterTeams)})),m={menuType:O.og.Popup,maxWidth:350,maxHeight:300,header:e.teamStores.length>5?u:void 0};return d.createElement(pe.Z,m,r()(Ct.Z,{filter:i,context:{blocks:[],environment:t,publicEditMode:void 0},initialFocus:0,sections:l}))}const ks=function(e){window.__c={n:"TeamsAndPagesDropdownForTeamGuest"};const{teamGuest:t}=e,s=(0,Ne.VK)((()=>Tt.Z.state.teams),[]),i=(0,Ne.VK)((()=>s.filter((e=>e.getMembers().some((e=>"user"===e.entity_type&&e.user_id===t.userId))))),[s,t]),n=(0,we.yK)((e=>({button:{marginRight:8},noTeams:{marginRight:8,color:e.lightTextColor},chevron:{width:10,marginLeft:4,fill:e.lightIconColor}})),[]),a=i.length??0;return r()(le.ZP,{popupType:le.Z4.Popup,renderOrigin:e=>d.createElement(Be.Z,o()({disabled:0===a,style:0===a?n.noTeams:n.button},e),0===a?r()(w.FormattedMessage,{id:"teamsDropdownForTeamGuest.teamsCountNone.label",defaultMessage:"No access",description:"Message to show a member is not part of any teamspaces."}):d.createElement(d.Fragment,null,r()(w.FormattedMessage,{id:"teamsDropdownForMember.teamsCount.label",defaultMessage:"{numberOfTeams, plural, one {{numberOfTeams} teamspace} other {{numberOfTeams} teamspaces}}",description:"Number of teamspaces that a member is part of.",values:{numberOfTeams:a}}),g.Z.chevronDown(n.chevron))),render:()=>d.createElement(d.Fragment,null,r()(Cs,{teamGuest:t,teamStores:i}),r()(de.Z,{size:"100%"}),r()(Ts,{teamGuest:t}))})};var Is=s(88775),Zs=s(69435);class _s extends u.Z{constructor(){super(...arguments),this.storeTypes={spacePermissionsSettingsStore:ee.Z,getRecoverableSpaceUserContentRequestStore:X.Z,accessRequestsStore:X.Z,isPageGuestsOpen:m.default.createClass(!0),isTeamGuestsOpen:m.default.createClass(!0)},this.userIdsWithContentBeingReprovisioned=m.default.createValue([]),this.isTeamGuestsEnabled=this.createComputedStore((()=>(0,L.F$)())),this.renderReprovisioningData=(e,t,s)=>t?r()(ze.Z,{columns:[{key:"user",header:r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.userColumn.header",defaultMessage:"User"}),style:{width:"50%"}},{key:"count",header:r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.pageCountColumn.header",defaultMessage:"Private pages",description:"Column header for number of private pages each user has"}),style:{width:"25%"}},{key:"action",header:r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.actionLevelColumn.header",defaultMessage:"Action"}),style:{width:"25%"}}],rows:this.getSpaceRecoverRows(t.recentSpaceRecoverPages)}):!s&&r()(ce.Z,{}),this.handleUpdateClick=()=>{const e=(0,w.defineMessages)({updatingPermissions:{id:"spacePermissionsSettings.updatePermissionsMessage",defaultMessage:"Updating…"}});_.j({message:e.updatingPermissions})},this.handleUpdateComplete=()=>{_.x()},this.handleTabClick=(e,t)=>{const s=this.getCurrentTabs(t)[e];switch(s){case ee.Q.Members:C.qTS(this.environment,{tab:"members"});break;case ee.Q.Groups:C.qTS(this.environment,{tab:"groups"});break;case ee.Q.Guests:C.qTS(this.environment,{tab:"guests"});break;case ee.Q.Reprovisioning:C.qTS(this.environment,{tab:"reprovisioning"});break;case ee.Q.Requests:C.qTS(this.environment,{tab:"requests"});break;default:(0,y.t1)(s)}this.stores.spacePermissionsSettingsStore.state.currentTab===ee.Q.Requests&&s!==ee.Q.Requests&&ie.Z.reset(),this.navigateToTab(s)},this.navigateToTab=e=>{this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,currentTab:e})},this.handleCreateGroupClick=()=>{B.createAndCommit({userAction:"SpacePermissionsSettings.handleCreateGroupClick",environment:this.environment,perform:e=>{const t=F.mo({environment:this.environment,spaceStore:this.props.store,transaction:e});t&&this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,editingNameGroupId:t.id,groupNameInputValue:""})}}),C.O8v(this.environment)},this.handleFilterChange=e=>{this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,groupsFilter:e.target.value})},this.handleMembersShowMoreClick=()=>{this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,limitMembers:!1})},this.handleGuestsShowMoreClick=()=>{this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,limitGuests:!1})},this.handleTeamGuestsShowMoreClick=()=>{this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,limitTeamGuests:!1})},this.handleInviteLinkClick=()=>{const e=!this.getInviteLinkEnabled();C.eoz(this.environment,{enabled:e}),B.createAndCommit({userAction:"SpacePermissionsSettings.handleInviteLinkClick",environment:this.environment,perform:t=>{F.ys({transaction:t,spaceStore:this.props.store,inviteLinkEnabled:Boolean(e)})}})},this.handleSortClick=(e,t)=>{const s=this.stores.spacePermissionsSettingsStore.state.sorts[e];let i;i=!(!s||s.by!==t)&&s.asc,this.stores.spacePermissionsSettingsStore.update((s=>({...s,sorts:{...s.sorts,[e]:{by:t,asc:!i}}})))},this.handleMemberPermissionRoleChange=async(e,t,s)=>{const{store:i}=this.props,o=this.environment.currentUser.id;if(e.userId!==o||"none"!==t)this.handleUpdateClick(),"none"===t?(await k.removeUsersFromSpace(this.environment,{userIds:[e.userId],spaceId:i.id,removePagePermissions:!0,revokeUserTokens:!0}),await G.bi(this.environment)):B.createAndCommit({userAction:"SpacePermissionsSettings.handleMemberPermissionRoleChange",environment:this.environment,perform:s=>P.ep({environment:this.environment,store:i,permissionItems:[{type:"user_permission",role:t,user_id:e.userId}],transaction:s,from:"space_permission_setting_table"})}),this.handleUpdateComplete();else{await F.bf({environment:this.environment,spaceId:i.id,userSettingsStore:s})&&te.Z.setState({...te.Z.state,open:!1})}},this.handleReprovisionToUserChange=async(e,t)=>{if(!(await Z.confirmUserAction({message:r()("span",{},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.reprovisionPrivatePagesConfirmationDialog.confirmationMessage",defaultMessage:"Are you sure you want to transfer their private pages? This action cannot be undone."})),acceptLabel:r()(w.FormattedMessage,{id:"spacePermissionsSettings.reprovisionPrivatePagesConfirmationDialog.confirmButton.label",defaultMessage:"Transfer private pages"})})))return;this.userIdsWithContentBeingReprovisioned.setState([...this.userIdsWithContentBeingReprovisioned.state,e]);const s=await k.transferSpaceUserContent(this.environment,{spaceId:this.props.store.id,fromUserId:e,toUserId:t});"failed"===s.type&&Z.showError(s),await this.stores.getRecoverableSpaceUserContentRequestStore.refresh(),this.userIdsWithContentBeingReprovisioned.setState(this.userIdsWithContentBeingReprovisioned.state.filter((t=>t!==e)))}}willMount(){this.setInitialSubtabOnMount()}renderComponent(){const{store:e,isMobile:t}=this.props;if(!Y.Z.state.online)return this.renderOfflineMessage();const{data:s}=se.default.state;if(!s)return this.renderLoadingSpinner();const i=H.CM(s);if(!l().every(i.map((t=>$.U6.createChildStore(e,{table:f.KJ,id:t.userId}).isReady()))))return this.renderLoadingSpinner();const o=i.filter(b.CF),n=i.filter(b.du),a=this.isTeamGuestsEnabled.state?n.length:n.filter((e=>!e.isTeamGuest&&e.isPageGuest)).length,{currentTab:u}=this.stores.spacePermissionsSettingsStore.state;if(t)return r()(d.Fragment,{},void 0,this.canEditMembership()&&r()(fe.Z,{shouldShowBottomDivider:!0},void 0,this.renderMobileInviteButton(),r()("div",{style:this.mobileMenuItemStyle()},void 0,this.renderInviteLink())),r()(fe.Z,{},void 0,this.renderSpaceMembers(o)));const m={[ee.Q.Members]:d.createElement(d.Fragment,null,r()(w.FormattedMessage,{id:"spacePermissionsSettings.membersTab.title",defaultMessage:"Members"}),r()("span",{},void 0," "),r()("span",{style:{color:this.theme.lightTextColor}},void 0,o.length)),[ee.Q.Groups]:r()(w.FormattedMessage,{id:"spaceBasicSettings.groupsTab.title",defaultMessage:"Groups"}),[ee.Q.Guests]:d.createElement(d.Fragment,null,this.isTeamGuestsEnabled.state?r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.title",defaultMessage:"External",description:"External tab in People section of settings title."}):r()(w.FormattedMessage,{id:"spacePermissionsSettings.guestsTab.title",defaultMessage:"Guests",description:"Guests tab in Members section of settings title."}),r()("span",{},void 0," "),r()("span",{style:{color:this.theme.lightTextColor}},void 0,a)),[ee.Q.Reprovisioning]:r()(w.FormattedMessage,{id:"spaceBasicSettings.reprovisioningTab.title",defaultMessage:"Recently left"}),[ee.Q.Requests]:d.createElement(d.Fragment,null,r()(w.FormattedMessage,{id:"spaceBasicSettings.requestsTab.title",defaultMessage:"Requests",description:"Label for a tab that shows a list of requests waiting for approval"}),r()("span",{},void 0," "),r()("span",{style:{color:this.theme.lightTextColor}},void 0,this.renderNumberOfRequests()),this.renderUnreadRequestDot())},c=this.getCurrentTabs(n),p=c.map((e=>m[e]));return r()(ht.Z,{},void 0,this.isTeamGuestsEnabled.state&&r()("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20}},void 0,r()("div",{style:{display:"flex",alignItems:"center",gap:7}},void 0,r()(Me.Z,{style:{fontWeight:S.Z.fontWeight.medium,fontSize:17}},void 0,r()(w.FormattedMessage,{id:"spaceBasicSettings.people.title",defaultMessage:"People",description:"People tab title."})),r()(Ee.Z,{href:(0,K.UY)("guides.members"),analyticsFrom:"members_settings"})),r()(Me.Z,{isSecondaryColor:!0,style:{fontSize:15}},void 0,r()(w.FormattedMessage,{id:"spaceBasicSettings.people.subtitle",defaultMessage:"Manage members, external guests, groups and permissions.",description:"subtitle for section explaining what this section of the settings tab covers."}))),r()(Ms.Z,{tabs:p,selectedIndex:c.indexOf(u),onChange:e=>this.handleTabClick(e,n),style:{paddingLeft:0,paddingRight:0,marginTop:-6,marginBottom:14},tabTitleStyle:{fontSize:16}}),this.renderTab(u,o,n))}renderLoadingSpinner(){return r()(ce.Z,{style:{margin:"calc(50% - 1em) auto"}})}renderOfflineMessage(){return r()(ht.Z,{},void 0,r()(Me.Z,{isSmall:!0,style:{textAlign:"center"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.offlineMessage",defaultMessage:"Please go online to manage members."})))}renderHelp(){return r()("div",{style:{marginTop:24,marginBottom:24}},void 0,r()(Ee.Z,{title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.helpButton.caption",defaultMessage:"Learn about adding members to your workspace"}),href:(0,K.UY)("guides.members"),analyticsFrom:"members_settings"}))}renderTab(e,t,s){return e===ee.Q.Members?r()(d.Fragment,{},void 0,this.renderSpaceMembers(t)):e===ee.Q.Guests?d.createElement(d.Fragment,null,this.isTeamGuestsEnabled.state?this.renderExternalTab(s):this.renderSpaceGuests(s)):e===ee.Q.Groups?this.renderGroupsTab():e===ee.Q.Reprovisioning?this.renderReprovisioning():e===ee.Q.Requests?this.renderRequestsTab():void(0,y.t1)(e)}renderExternalTab(e){const{store:t}=this.props,s=!Boolean(t.getSettingsStore().getKeyStore("disable_team_guests").getValue());return r()("div",{style:{display:"flex",flexDirection:"column",gap:8}},void 0,s&&d.createElement(d.Fragment,null,r()("div",{style:{display:"flex"}},void 0,r()(Xt.Z,{open:this.stores.isTeamGuestsOpen.state,onClick:()=>this.stores.isTeamGuestsOpen.setState(!this.stores.isTeamGuestsOpen.state),isSidebar:!1,fill:!0,style:{marginLeft:-27}}),r()("div",{style:{marginLeft:3}},void 0,r()("div",{style:{display:"flex",alignItems:"center",height:24}},void 0,r()(Me.Z,{style:{fontSize:15}},void 0,r()(w.FormattedMessage,{id:"spacePermissionSettings.teamGuests.title",defaultMessage:"Teamspace guests",description:"Title for dropdown header for team guests members table."})),r()("span",{},void 0," "),r()(Me.Z,{isSecondaryColor:!0,style:{fontSize:15}},void 0,e.filter((e=>e.isTeamGuest)).length)),r()(Me.Z,{isSecondaryColor:!0,style:{fontSize:15}},void 0,r()(w.FormattedMessage,{id:"spacePermissionSettings.teamGuests.subtitle",defaultMessage:"Teamspace guests are billed as members and can access all pages in teamspaces they've been invited to.",description:"Subtitle for dropdown header for teamspace guests table explaining what page guests are."})))),this.stores.isTeamGuestsOpen.state&&this.renderTeamGuests(e)),r()("div",{style:{display:"flex"}},void 0,r()(Xt.Z,{open:this.stores.isPageGuestsOpen.state,onClick:()=>this.stores.isPageGuestsOpen.setState(!this.stores.isPageGuestsOpen.state),isSidebar:!1,fill:!0,style:{marginLeft:-27}}),r()("div",{style:{marginLeft:3}},void 0,r()("div",{style:{display:"flex",alignItems:"center",height:24}},void 0,r()(Me.Z,{style:{fontSize:15}},void 0,r()(w.FormattedMessage,{id:"spacePermissionSettings.pageGuests.title",defaultMessage:"Page guests",description:"Title for dropdown header for page guests members table."})),r()("span",{},void 0," "),r()(Me.Z,{isSecondaryColor:!0,style:{fontSize:15}},void 0,e.filter((e=>e.isPageGuest&&!e.isTeamGuest)).length)),r()(Me.Z,{isSecondaryColor:!0,style:{fontSize:15}},void 0,r()(w.FormattedMessage,{id:"spacePermissionSettings.pageGuests.subtitle",defaultMessage:"Page guests are free but can only access pages they've been invited to.",description:"Subtitle for dropdown header for page guests table explaining what page guests are."})))),this.stores.isPageGuestsOpen.state&&this.renderSpaceGuests(e))}renderUnreadRequestDot(){if(this.props.unreadAccessRequests&&this.props.unreadAccessRequests>0)return r()(We.z,{color:this.theme.redBadgeBackground,style:{marginLeft:6}})}renderGroupsTab(){const{store:e}=this.props,{groupsFilter:t}=this.stores.spacePermissionsSettingsStore.state,s=this.canUseGroups(),i=this.canEditMembership(),n=r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.groupCreationInsufficientPermissions",defaultMessage:"Only membership admins and workspace owners can add a permission group.",description:"Caption that restricts groups creation to membership admins and workspace owners"});if(e.isDefined()){const a=e.getPermissionGroups();return r()("div",{},void 0,s?r()(Me.Z,{isMultiline:!0,style:{width:"80%"}},void 0,(0,Q.bq)()?r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.captionWithTeamsV2",defaultMessage:"Set up groups to streamline page permissions from the share menu and manage teamspace members in bulk.",description:"Describes the purpose of groups with the context of teamspaces."}):r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.caption",defaultMessage:"Set up groups to conveniently control page permissions from the share menu.",description:"Describes the purpose of groups."})):r()(Zs.Z,{for:"plus",from:"permission_groups",icon:g.Z.group,title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.upgradeTitle",defaultMessage:"Upgrade to create groups"}),caption:r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.upgradeCaption.plus",defaultMessage:"Upgrade to the Plus Plan to set up groups and control permissions from the share menu.",description:"Shown as an upsell if user wants more permission control from the share menu."}),learnMoreRoute:"guides.groups"}),r()(de.Z,{size:24,isHidden:!0}),r()("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},void 0,s&&r()(Se.Z,{renderTooltip:()=>!i&&n,render:e=>d.createElement(ne.Z,o()({isLarge:!0,onClick:this.handleCreateGroupClick,disabled:!i},i?void 0:e),r()(w.FormattedMessage,{id:"spacePermissionsSettings.groupsTab.createGroupButton.label",defaultMessage:"Create a group"}))}),a.length>0&&r()(me.Z,{placeholder:this.props.intl.formatMessage({id:"spacePermissionsSettings.groupsTab.filterGroupNamesInput.placeholder",defaultMessage:"Filter by group name…",description:"Search input placeholder shown above a table that displays all groups."}),left:g.Z.search(this.getSearchIconStyle()),showClearButton:!0,format:me.Z.Format.Small,value:t,style:{..._s.filterStyle,marginRight:0},onChange:this.handleFilterChange})),a.length>0&&r()(ts,{spaceStore:e,permissionsSettingsStore:this.stores.spacePermissionsSettingsStore,groups:a,canEdit:this.canEditGroups()}))}}renderSpaceMembers(e){return this.props.isMobile?this.renderMobileMemberList(e):r()("div",{},void 0,this.renderHelp(),this.renderInviteLink(),this.renderDesktopMemberList(e))}renderInviteLink(){if(!this.canUseInviteLink())return;const e=this.getInviteLink(),t=this.getInviteLinkEnabled();if(!e)return;const{spacePermissionsSettingsStore:s}=this.stores;return r()("div",{},void 0,r()("div",{style:{display:"flex",alignItems:"flex-start",cursor:"pointer"}},void 0,r()("div",{style:{marginRight:8,flexGrow:1}},void 0,r()(vt.Z,{},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.spaceMembers.inviteLink.title",defaultMessage:"Invite link"})),r()(Me.Z,{isSmall:!0,isMultiline:!0,style:{marginTop:2,width:"85%"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionSettings.spaceMembers.inviteLink.caption",defaultMessage:"Share this secret link to invite people to this workspace. Only users who can invite members can see this.",description:"Label that is shown above the invite link."})," ",!this.props.isMobile&&this.renderInviteLinkReset())),r()("div",{style:{marginTop:5}},void 0,r()(ye.Z,{on:t,onClick:this.handleInviteLinkClick}))),s&&t&&e&&this.renderInviteLinkUrl(e),r()(de.Z,{size:40}))}renderInviteLinkReset(){const{store:e}=this.props;if(e.isDefined())return r()(w.FormattedMessage,{id:"spacePermissionSettings.spaceMembers.inviteLink.resetLink",defaultMessage:"You can <resetlink>reset the link</resetlink> for all space members to generate a new invite link.",values:{resetlink:t=>r()(De.Z,{onClick:()=>{Z.showDialog({message:r()(w.FormattedMessage,{id:"spacePermissionsSettings.inviteLinkRefreshModal.description",defaultMessage:"Are you sure you want to reset the invite link for all space members? Your old one will no longer be able to be used."}),showCancel:!0,keepFocus:!1,handleCancel:Z.dismissDialog,items:[{label:r()(w.FormattedMessage,{id:"spacePermissionsSettings.inviteLinkRefreshModal.accept",defaultMessage:"Reset"}),color:"red",onAccept:async()=>{await k.refreshInviteLink(this.environment,{spaceId:e.id}),G.bi(this.environment)}}]})}},void 0,t)}})}renderInviteLinkUrl(e){const{mobileNative:t}=this.environment,s=r()(w.FormattedMessage,{id:"spacePermissionsSettings.spaceMembers.inviteLink.copyButton",defaultMessage:"Copy link"}),i=()=>{I.RD({environment:this.environment,stringValue:e,copiedMessage:I.tq.copiedLinkToClipboard}),C.nlj(this.environment)},o=()=>{t&&t.share(e),C.nlj(this.environment)};return this.props.isMobile?r()("div",{},void 0,r()(me.Z,{type:"text",format:me.B.Default,value:e,disabled:!0}),t?r()(he.Z,{onClick:o,style:{marginTop:10,width:"100%"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.spaceMembers.inviteLink.shareButton",defaultMessage:"Share link"})):r()(he.Z,{onClick:i,style:{marginTop:10,width:"100%"}},void 0,s)):r()("div",{},void 0,r()("div",{style:{display:"flex",alignItems:"flex-start",marginTop:12}},void 0,r()(me.Z,{type:"text",format:me.B.Default,value:e,disabled:!0,style:{borderTopRightRadius:0,borderBottomRightRadius:0,width:"calc(100% - 90px)",height:32}}),r()(ne.Z,{onClick:i,style:{borderTopLeftRadius:0,borderBottomLeftRadius:0},isLarge:!0},void 0,s)))}renderMobileMemberList(e){const{store:t}=this.props;return r()(d.Fragment,{},void 0,e.map((e=>{const s=$.U6.createChildStore(t,{table:f.KJ,id:e.userId});return r()("div",{style:{display:"flex",alignItems:"center",padding:10,borderBottom:`1px solid ${this.theme.lightDividerColor}`,background:this.theme.cardContentBackground}},e.userId,this.renderMember(s),r()("div",{style:{textAlign:"center",marginLeft:"auto"}},void 0,this.renderUserPermission("members",e,s)))})))}renderDesktopMemberList(e){const{spacePermissionsSettingsStore:t}=this.stores,{membersFilter:s,limitMembers:i}=t.state,o=this.getFilteredMembers(e,s),n=this.sortUsers("members",o),a=i?n.slice(0,_s.defaultLimit):n;return r()(d.Fragment,{},void 0,r()("div",{style:{marginRight:8,flexGrow:1}},void 0,r()(vt.Z,{},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.spaceMembers.members.title",defaultMessage:"Members"}))),this.renderInviteViaDomainCaption(),r()(de.Z,{size:16,isHidden:!0}),r()("div",{},void 0,r()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16}},void 0,this.renderInviteButton(),r()(me.Z,{placeholder:this.props.intl.formatMessage({id:"spacePermissionsSettings.membersTab.filterMembersInput.placeholder",defaultMessage:"Filter by email or name…"}),left:g.Z.search(this.getSearchIconStyle()),showClearButton:!0,format:me.Z.Format.Small,value:s,style:_s.filterStyle,onChange:e=>{t.setState({...t.state,membersFilter:e.target.value,limitMembers:!0})}})),this.renderUserTable("members",a),n.length>_s.defaultLimit&&i&&r()(be.Z,{style:_s.showMoreButtonStyle,onClick:this.handleMembersShowMoreClick},void 0,r()(w.FormattedMessage,{defaultMessage:"Show {moreMembersCount} more",id:"spacePermissionsSettings.membersTab.showMore.message",values:{moreMembersCount:n.length-_s.defaultLimit}}))))}renderTeamGuests(e){const{spacePermissionsSettingsStore:t}=this.stores,{teamGuestsFilter:s,limitTeamGuests:i}=t.state,o=e.filter((e=>e.isTeamGuest)),n=this.getFilteredMembers(o,s),a=this.sortUsers("team_guests",n),l=i?a.slice(0,5):a;return r()("div",{style:{marginBottom:5}},void 0,r()("div",{},void 0,r()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16}},void 0,r()(me.Z,{placeholder:this.props.intl.formatMessage({id:"spacePermissionsSettings.membersTab.filterTeamGuestsInput.placeholder",defaultMessage:"Filter by email or name…",description:"Placeholder in the search bar for teamspace guests."}),left:g.Z.search(this.getSearchIconStyle()),showClearButton:!0,format:me.Z.Format.Small,value:s,style:_s.filterStyle,onChange:e=>{t.setState({...t.state,teamGuestsFilter:e.target.value,limitTeamGuests:!0})}})),this.renderUserTable("team_guests",l),a.length>5&&i&&r()(be.Z,{style:_s.showMoreButtonStyle,onClick:this.handleTeamGuestsShowMoreClick},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.membersTab.showMoreGuestsButton.label",defaultMessage:"{numberOfHiddenGuests, plural, one {Show {numberOfHiddenGuests} more} other {Show {numberOfHiddenGuests} more}}",values:{numberOfHiddenGuests:a.length-5}}))))}renderSpaceGuests(e){const{spacePermissionsSettingsStore:t}=this.stores,{guestsFilter:s,limitGuests:i}=t.state,o=e.filter((e=>!e.isTeamGuest&&e.isPageGuest)),n=this.getFilteredMembers(o,s),a=this.sortUsers("guests",n),l=this.isTeamGuestsEnabled.state?5:_s.defaultLimit,d=i?a.slice(0,l):a;return r()("div",{},void 0,r()("div",{},void 0,r()("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16}},void 0,r()(me.Z,{placeholder:this.props.intl.formatMessage({id:"spacePermissionsSettings.membersTab.filterGuestsInput.placeholder",defaultMessage:"Filter by email or name…"}),left:g.Z.search(this.getSearchIconStyle()),showClearButton:!0,format:me.Z.Format.Small,value:s,style:_s.filterStyle,onChange:e=>{t.setState({...t.state,guestsFilter:e.target.value,limitGuests:!0})}})),this.renderUserTable("guests",d),a.length>l&&i&&r()(be.Z,{style:_s.showMoreButtonStyle,onClick:this.handleGuestsShowMoreClick},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.membersTab.showMoreGuestsButton.label",defaultMessage:"{numberOfHiddenGuests, plural, one {Show {numberOfHiddenGuests} more} other {Show {numberOfHiddenGuests} more}}",values:{numberOfHiddenGuests:a.length-l}}))))}renderMobileInviteButton(){return r()(d.Fragment,{},void 0,r()("div",{style:this.mobileMenuItemStyle()},void 0,this.renderInviteButton({flex:1})),r()("div",{style:{borderBottom:`1px solid ${this.theme.regularDividerColor}`}}))}renderInviteButton(e){const{store:t}=this.props;return t.canEditMembership()||t.getDisableMembershipRequests()||!(0,L.p1)()?r()(J.LazyPermissionsInviteWithModal,{disabled:!this.canEditMembership(),store:t,onInviteClick:this.handleUpdateClick,onInviteComplete:this.handleUpdateComplete,isSubscribed:this.isSubscribed(),membersOnly:!1,upgradeButtonName:"space_permission_settings",shouldGrow:!1,buttonStyle:e}):r()(ct,{store:t,analyticsFrom:"space_settings_add_members",origin:r()(ne.Z,{isLarge:!0},void 0,r()(w.FormattedMessage,{id:"inviteUserButton.requestMemberLabel",defaultMessage:"Add members",description:"Button to invite new users to the workspace."}))})}renderInviteViaDomainCaption(){const{store:e}=this.props;return F.LV(e)?r()(Me.Z,{isSmall:!0,isMultiline:!0,style:{width:"80%"}},void 0,r()(w.FormattedMessage,{id:"spaceBasicSettings.membersTab.manageMembersWithLinkCaption",defaultMessage:"Manage members here."})):r()("div",{},void 0,r()(Me.Z,{isSmall:!0,isMultiline:!0,style:{width:"80%",marginBottom:6}},void 0,r()(w.FormattedMessage,{id:"spaceBasicSettings.membersTab.manageMembersWithoutLinkCaption",defaultMessage:"Manage members here, or <setupdomainlink>set up a domain</setupdomainlink>, so everyone with allowed email domains can join the workspace automatically.",values:{setupdomainlink:e=>r()(De.Z,{onClick:()=>{te.Z.setState({...te.Z.state,currentTab:"settings",defaultSubtab:void 0})}},void 0,e)}})),r()(Me.Z,{isSmall:!0,isMultiline:!0,style:{width:"80%"}},void 0,r()(w.FormattedMessage,{id:"spaceBasicSettings.membersTab.payPerMemberCaption",defaultMessage:"You will be charged for each member added. Visit <billingguidelink>our guide</billingguidelink> for more information on how we bill.",values:{billingguidelink:e=>r()(De.Z,{href:(0,K.UY)("guides.billingGuide")},void 0,e)}})))}getFilteredMembers(e,t){const{store:s,intl:i}=this.props;return t&&t.length>0?(0,p.ZP)(t,e,(e=>{const t=$.U6.createChildStore(s,{table:f.KJ,id:e.userId});return t.isDefined()?t.getSearchName(i):""})):e}sortUsers(e,t){const s=this.stores.spacePermissionsSettingsStore.state.sorts[e];if(!s)return t;const{store:i}=this.props;switch(s.by){case"role":return t.sort(((e,t)=>(h.xm[t.role]-h.xm[e.role])*(s.asc?-1:1)));case"name":return t.map((e=>({user:e,store:$.U6.createChildStore(i,{table:f.KJ,id:e.userId})}))).sort(((e,t)=>{const i=e.store.getValue(),o=t.store.getValue(),n=(0,M.Nz)(this.props.intl,i),r=(0,M.Nz)(this.props.intl,o);return n.localeCompare(r)*(s.asc?1:-1)})).map((e=>e.user))}}renderSmallArrow(e){const{up:t}=e,s={width:10,height:10,marginLeft:4};return t?g.Z.arrowDownSmall({...s,transform:"rotate(180deg)"}):g.Z.arrowDownSmall(s)}renderUserTable(e,t){const{store:s}=this.props,i=this.stores.spacePermissionsSettingsStore.state.sorts[e],o=s.getPermissionGroups().reduce(((e,t)=>{const s=t.user_ids||[];for(const i of s)e[i]=e[i]?e[i].concat(t):[t];return e}),{}),n={key:"user",header:r()(re.Z,{disabled:!1,ignoreLocalHoverState:!0,onClick:()=>{this.handleSortClick(e,"name")},style:{display:"flex",alignItems:"center"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.userColumn.header",defaultMessage:"User"}),i&&"name"===i.by&&this.renderSmallArrow({up:i.asc})),style:{width:"45%"}},a={key:"groups",header:r()(re.Z,{disabled:!0,ignoreLocalHoverState:!0,style:{display:"flex",alignItems:"center",paddingLeft:8}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.groupsColumn.header",description:"Label for a column shows the groups that a user is part of.",defaultMessage:"Groups"})),style:{width:"15%"}},l={key:"teams",header:r()("div",{style:{display:"flex",alignItems:"center",paddingLeft:8}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.teamsColumn.header",defaultMessage:"Teamspaces",description:"Label for a column shows the teamspaces that a user is part of."})),style:{width:"20%",textAlign:"center"}},u={key:"access_level",header:r()(re.Z,{disabled:!1,ignoreLocalHoverState:!0,onClick:()=>{this.handleSortClick(e,"role")},style:{display:"flex",alignItems:"center",paddingLeft:8}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.accessLevelColumn.header",defaultMessage:"Access level"}),i&&"role"===i.by&&this.renderSmallArrow({up:i.asc})),style:{width:"20%",textAlign:"center"}},m={key:"pages",header:r()("div",{style:{display:"flex",alignItems:"center",paddingLeft:8}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.userTable.pagesColumn.header",defaultMessage:"Pages",description:"Header for label listing the pages that a guest has access to."})),style:{width:"20%",textAlign:"center"}},c={key:"three_dot",header:r()(re.Z,{disabled:!0,ignoreLocalHoverState:!0})},p=this.canUseGroups()&&"team_guests"!==e&&"guests"!==e,g=("team_guests"===e||"guests"===e)&&this.isTeamGuestsEnabled.state&&this.canEditMembership();let h="members"===e&&(0,Q.bq)()?[n,l,u]:g?[n,m,c]:[n,m];return p&&(h=[...h.slice(0,1),a,...h.slice(1)]),r()(ze.Z,{columns:h,rows:t.map((e=>({member:e,store:$.U6.createChildStore(s,{table:f.KJ,id:e.userId})}))).filter((e=>void 0!==e.store.getValue())).map((t=>{const{member:s,store:i}=t,n=o[s.userId]?o[s.userId]:[],r=[this.renderMember(i)];return p&&r.push(d.createElement(d.Fragment,null,this.renderGroups(n))),"members"===e&&(0,Q.bq)()&&r.push(d.createElement(d.Fragment,null,this.renderTeams(s))),r.push(d.createElement(d.Fragment,null,this.renderUserPermission(e,s,i))),g&&r.push(d.createElement(d.Fragment,null,this.renderPageGuestOrTeamGuestThreeDotMenu(e,s,i))),{key:s.userId,columns:r}}))})}renderMember(e){return r()(oe.Z,{actorStore:e})}renderGroups(e){return r()(Ie,{spaceStore:this.props.store,groups:e,onGroupClick:()=>{this.navigateToTab(ee.Q.Groups)}})}renderTeams(e){if("none"!==e.role)return r()(Is.Z,{member:e})}renderUserPermission(e,t,s){return"none"===t.role?this.isTeamGuestsEnabled.state&&"team_guests"===e?r()(ks,{teamGuest:t}):r()(Ue,{store:this.props.store,guest:t,guestStore:s,isSubscribed:this.isSubscribed(),hideActionButtons:this.isTeamGuestsEnabled.state}):this.renderMemberRoleSelect(t)}renderPageGuestOrTeamGuestThreeDotMenu(e,t,s){return r()(le.ZP,{popupType:le.Z4.Popup,renderOrigin:e=>d.createElement(ue.Z,o()({},e,{icon:g.Z.dots,iconStyle:{height:14,width:14}})),render:i=>{const n=[{key:"team section",render:e=>d.createElement(fe.Z,e),items:[{key:"convertToMember",render:t=>d.createElement(ae.Z,o()({},t,{icon:g.Z.settingsUpgrade({height:17,width:17}),title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.title",defaultMessage:"Convert to member",description:"Title for button to convert a page guest or teamspace guest to a workspace member."}),shouldWrapCaption:!0,caption:"team_guests"===e&&r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.caption",defaultMessage:"Workspace members are not restricted to specific teamspaces",description:"Explains teamspace guests are limited to specific teamspaces."})})),action:()=>this.handleConvertGuestToMember({user:t,userStore:s,parent:i})},{key:"removeFromWorkspace",render:e=>d.createElement(ae.Z,o()({},e,{icon:g.Z.handWave({height:17,width:17,color:c.ZP.red}),title:r()("span",{style:{color:c.ZP.red}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.removeFromWorkspace.title",defaultMessage:"Remove from workspace",description:"Button that when clicked removes the user from the workspace entirely."}))})),action:()=>this.handleRemoveGuestFromWorkspace({user:t,userStore:s,parent:i})}]}];return r()(pe.Z,{menuType:O.og.Popup},void 0,r()(ge.Z,{type:ge.i.Vertical,sections:n,initialFocus:void 0,style:{minWidth:265}}))}})}renderMemberRoleSelect(e){const t=this.environment.currentUser.id,{currentUserSettingsStore:s,currentSpaceStore:i}=E.default.state;if(!s)return;const o=this.getAvailableRoleItems();let n=!0;return(this.canAdmin()||this.canEditMembership()&&(h.RN(e.role)||e.userId===t))&&(n=!1),r()(Le.ZP,{role:e.role,table:v.bx,type:"user_permission",disabled:n,isUserPermission:e.userId===t,upgradeButtonName:"space_permission_item",availableRoleItems:o,onChange:async t=>{await this.handleMemberPermissionRoleChange(e,t,s)},onRemoveMemberClick:async()=>{const t=async()=>(0,z.Mk)()?await cs(this.environment,e.userId,null==i?void 0:i.id):await(0,Le.jV)({message:(0,Le.QH)(!0)}),o=async t=>{await this.handleMemberPermissionRoleChange(e,"none",s),C.SwX(this.environment,{member_user_id:e.userId,member_role:e.role,contraction_survey_id:t})};if(z.YE()){let e;if(function(){const e=E.default.state.currentUserSettingsStore;if(!e)return!1;const t=e.getSettings();return!!t&&(!t.seen_contraction_survey_at||Date.now()>(0,W.Xz)({date:t.seen_contraction_survey_at,daysToAdd:1}))}()&&(e=await async function(e){const t=(0,ps.ZP)();return C.wjW({environment:e,contractionSurveyId:t}),await ss.Z.showModal((s=>{const i=i=>{i?C.OK8({environment:e,contractionSurveyId:t,reasons:i.reasons,reasonIndexes:i.reasonIndexes,reasonOther:i.reasonOther}):C.Wr9({environment:e,contractionSurveyId:t}),s(i)};return{dismissUsing:"closeButtonOrEscape",onDismiss:()=>i(void 0),content:r()(Ss,{contractionSurveyId:t,onFinished:i})}}))}(this.environment),!e))return;var n;if(await t())await o(null===(n=e)||void 0===n?void 0:n.contractionSurveyId),e&&function(e){const t=E.default.state.currentUserSettingsStore;t&&B.createAndCommit({userAction:"saveContractionSurveySeenDate",environment:e,perform:e=>{D.d2({userSettingsStore:t,transaction:e,data:{seen_contraction_survey_at:(new Date).getTime()}})}})}(this.environment)}else{await t()&&await o()}}})}renderReprovisioning(){return d.createElement(d.Fragment,null,r()(Me.Z,{isMultiline:!0,style:{width:"80%"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.reprovisioningTab.workspaceOwner.caption",defaultMessage:"View users that were previously part of the workspace in the past 30 days. Only workspace owners can see this.",description:"Description that shows on the transfer content tab in settings"})),r()(Me.Z,{isMultiline:!0,style:{width:"80%"}},void 0,r()(w.FormattedMessage,{id:"spacePermissionsSettings.reprovisioningTab.workspaceOwner.caption.disclaimer",defaultMessage:"Only users who had private pages will appear here.",description:"Disclaimer that shows under the caption describing the reprovisioning tab in the members panel in settings."})),r()(de.Z,{size:24,isHidden:!0}),r()(ve.Z,{requestStore:this.stores.getRecoverableSpaceUserContentRequestStore,request:{spaceId:this.props.store.id},performRequest:async e=>{const t=await k.getRecoverableSpaceUserContent(this.environment,{spaceId:e.spaceId});if("failed"===t.type)throw Z.showError(t),t;return t.data},render:this.renderReprovisioningData}))}renderRequestsTab(){return r()(Xe,{spaceStore:this.props.store,accessRequestsStore:this.stores.accessRequestsStore})}renderNumberOfRequests(){return r()(ve.Z,{throttle:1e3,request:{parentTable:"space",parentId:this.props.store.id,size:100,status:"pending"},requestStore:this.stores.accessRequestsStore,performRequest:async e=>{const t=await k.getAccessRequests(this.environment,e);if("failed"===t.type)throw t.error;const s=t.data.accessRequestIds;return T.Tr(this.props.store,s)},render:(e,t,s)=>e||!t?r()("span",{}):t?r()("span",{},void 0,t.filter((e=>"pending"===e.accessRequestStore.getKeyStore("status").getValue())).length):void 0})}handleConvertGuestToMember(e){const{userStore:t,parent:s}=e,{store:i}=this.props,o=this.isSubscribed()?"read_and_write":"editor";Z.showDialog({message:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.confirmationDialog.message",defaultMessage:"Are you sure you want to convert this user into a workspace member?",description:"Message to confirm converting user into a workspace member."}),description:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.confirmationDialog.description",defaultMessage:"This is a billable event.",description:"Additional description explaining this user will be charged after this conversion."}),showCancel:!0,keepFocus:!1,handleCancel:()=>{Z.dismissDialog(),s.close()},items:[{label:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.convertToMember.confirmationDialog.confirm",defaultMessage:"Convert to workspace member",description:"Label for button to confirm converting the teamspace or page guest into a workspace member."}),color:"blue",onAccept:async()=>{s.close(),await A({environment:this.environment,guestUserStore:t,role:o,store:i})}}]})}handleRemoveGuestFromWorkspace(e){const{userStore:t,parent:s}=e;Z.showDialog({message:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.removeFromWorkspace.confirmationDialog.message",defaultMessage:"Are you sure you want to remove this user from the workspace?",description:"Message to confirm removal of user from the workspace."}),description:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.removeFromWorkspace.confirmationDialog.description",defaultMessage:"This action will completely remove the user from the workspace, including any teamspaces and pages they have access to.",description:"Additional description explaining the action will completely remove the user from the space."}),showCancel:!0,keepFocus:!1,handleCancel:()=>{Z.dismissDialog(),s.close()},items:[{label:r()(w.FormattedMessage,{id:"spacePermissionsSettings.externalTab.userThreeDotMenu.removeFromWorkspace.confirmationDialog.confirm",defaultMessage:"Remove from workspace",description:"Label for button to confirm removal of user from the workspace."}),color:"red",onAccept:async()=>{s.close(),await U({environment:this.environment,guestUserStore:t,store:this.props.store})}}]})}getSpaceRecoverRows(e){const t=[];for(const{userId:s,privatePagesCount:i}of e){if(i<1)continue;const e=$.U6.createChildStore(this.props.store,{table:f.KJ,id:s});t.push({key:s,columns:[this.renderMember(e),i,this.userIdsWithContentBeingReprovisioned.state.includes(s)?r()(ce.Z,{}):r()("div",{style:{marginLeft:-4}},void 0,r()(pt.Z,{mode:gt.z.Button,focused:!1,title:r()(w.FormattedMessage,{id:"spacePermissionsSettings.reprovision.toUser.title",defaultMessage:"Transfer private pages"}),parentStore:this.props.store,userIds:this.userIdsWithContentBeingReprovisioned.state,onChange:e=>{let[t]=e;this.handleReprovisionToUserChange(s,t)}}))]})}return t}setInitialSubtabOnMount(){te.Z.state.open&&"members"===te.Z.state.currentTab&&te.Z.state.defaultSubtab&&(this.stores.spacePermissionsSettingsStore.setState({...this.stores.spacePermissionsSettingsStore.state,currentTab:te.Z.state.defaultSubtab}),te.Z.setState({...te.Z.state,defaultSubtab:void 0}))}getAvailableRoleItems(){const e=this.props.intl.formatMessage({id:"spacePermissionSettings.memberRoleSelect.permissionitem.roleUpgradeDisabled",defaultMessage:"Cannot upgrade to a higher role than member",description:"Tooltip shown over disabled role upgrades"}),t=(0,N.U7)();return l().compact(h.an.map((s=>{if(t||"membership_admin"!==s)return{role:s,disabledInfo:!this.canAdmin()&&h.Bc(s)?{isDisabled:!0,disabledMessage:e}:void 0}})))}getCurrentTabs(e){return[ee.Q.Members,ee.Q.Groups,...e.length>0?[ee.Q.Guests]:[],...this.canReprovisionContent()?[ee.Q.Reprovisioning]:[],...this.shouldShowRequestsTab()?[ee.Q.Requests]:[]]}isSubscribed(){const{data:e}=se.default.state;return Boolean(e&&H.YK(e))}canAdmin(){return this.props.store.canAdmin()}canEditMembership(){return this.props.store.canEditMembership()}canUseGroups(){return H.qF(this.environment)&&this.isSubscribed()}canEditGroups(){return this.canUseGroups()&&this.canEditMembership()}canUseInviteLink(){return this.canEditMembership()&&H.qF(this.environment)}canReprovisionContent(){return this.canAdmin()&&j.wP()}shouldShowRequestsTab(){return this.canEditMembership()&&(0,L.p1)()}getInviteLinkEnabled(){return Boolean(this.props.store.getKeyStore("invite_link_enabled").getValue())}getInviteLink(){if(!this.canEditMembership())return;const e=se.default.state.data,t=this.props.store.id,s=e&&("subscribed_admin"===e.type||"unsubscribed_admin"===e.type||"subscribed_membership_admin"===e.type)&&e.inviteLinkCode;return s?(0,V.cJ)(this.environment,t,s):void 0}getSearchIconStyle(){return{width:14,height:14,marginRight:6,flexGrow:0,flexShrink:0,fill:this.theme.mediumIconColor}}mobileMenuItemStyle(){const{WindowSizeStore:e}=this.environment;return{display:"flex",paddingTop:14,paddingBottom:14,paddingLeft:14,paddingRight:e.getSafePaddingRightCSS(14),background:this.theme.cardContentBackground}}}_s.displayName="SpacePermissionsSettings",_s.defaultLimit=50,_s.filterStyle={maxWidth:275,borderRadius:30},_s.showMoreButtonStyle={marginTop:8};const Ps=(0,w.injectIntl)(_s)},88775:(e,t,s)=>{s.d(t,{Z:()=>F});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(480),d=s(81954),u=s(24405),m=s(53397),c=s(5366),p=s(57688),g=s(33929),h=s(87279),v=s(33846),f=s(48690),b=s(30397),y=s(48019),S=s(52275),M=s(31945),w=s(68894),T=s(78140),C=s(89728),k=s(72495),I=s(64369),Z=s(93686);const _=(0,c.defineMessages)({filterTeams:{defaultMessage:"Filter teamspaces…",id:"teamsDropdownForMember.filterForTeams.placeholder",description:"Placeholder text for filtering teamspaces within a group."}});function P(e){window.__c={n:"MemberTeamContent"};const t=(0,l.O7)(),s=(0,u.yK)((()=>({teamMenuItem:{fontWeight:400,maxWidth:180}})),[]),[i,n]=(0,d.AF)(void 0,v.Z),m=(0,a.useCallback)((e=>p.RF({environment:t,teamId:e,tab:f.a.Members,from:"teams_dropdown_for_team_member"})),[t]),b=(0,d.VK)((()=>[{key:"teams for member",render:e=>a.createElement(k.Z,e),actions:e.teamStores.map((e=>({key:e.id,displayName:e.getName(),analyticsName:e.getName()||"team_unknown",searchName:e.getName(),render:t=>a.createElement(S.Z,o()({icon:r()(Z.p,{disabled:!0,store:e}),title:r()(I.Z,{style:s.teamMenuItem},void 0,e.getName()),caption:r()(c.FormattedMessage,{defaultMessage:"{numMembers} {numMembers, plural, one {member} other {members}}",id:"teamsDropdownForMember.numMembers",description:"Number of members in a teamspace, displayed in a popup showing teamspaces that a member is part of.",values:{numMembers:e.getUserIdsInTeam().length}}),inline:!0},t)),action:()=>{m(e.id)},closeParentMenu:!1})))}]),[e.teamStores,s.teamMenuItem,m]),M=i.inputValue,C=r()(k.Z,{isInput:!0},void 0,r()(w.ZP,{value:M,onChange:(0,a.useCallback)((e=>{n({inputValue:e.target.value,focus:!1})}),[n]),focus:!0,focusAfterAnimation:!0,placeholder:g.default.formatMessage(_.filterTeams)})),P={menuType:h.og.Popup,maxWidth:350,maxHeight:300,header:e.teamStores.length>5?C:void 0};return a.createElement(T.Z,P,r()(y.Z,{filter:M,context:{blocks:[],environment:t,publicEditMode:void 0},initialFocus:0,sections:b}))}const F=function(e){window.__c={n:"TeamsDropdownForMember"};const[t]=(0,d.AF)(b.Z),s=(0,u.yK)((e=>({button:{marginRight:8},noTeams:{marginRight:8,color:e.lightTextColor},chevron:{width:10,marginLeft:4,fill:e.lightIconColor}})),[]),i=(0,d.VK)((()=>t.teams.filter((t=>t.getMembers().some((t=>"user"===t.entity_type&&t.user_id===e.member.userId))))),[t,e.member]),n=i.length;return r()(M.ZP,{popupType:M.Z4.Popup,renderOrigin:e=>a.createElement(C.Z,o()({disabled:0===n,style:0===n?s.noTeams:s.button},e),0===n?r()(c.FormattedMessage,{id:"teamsDropdownForMember.teamsCountNone.label",defaultMessage:"No access",description:"Message to show a member is not part of any teamspaces."}):a.createElement(a.Fragment,null,r()(c.FormattedMessage,{id:"teamsDropdownForMember.teamsCount.label",defaultMessage:"{numberOfTeams, plural, one {{numberOfTeams} teamspace} other {{numberOfTeams} teamspaces}}",description:"Number of teamspaces that a member is part of.",values:{numberOfTeams:n}}),m.Z.chevronDown(s.chevron))),render:()=>r()(P,{member:e.member,teamStores:i})})}},69435:(e,t,s)=>{s.d(t,{Z:()=>h});var i=s(77094),o=s.n(i),n=(s(67294),s(83355)),r=s(82990),a=s(5366),l=s(50906),d=s(5978),u=s(93678),m=s(33665),c=s(42922),p=s(63296);class g extends n.Z{constructor(){super(...arguments),this.handleUpgradeClick=e=>{const{from:t,for:s,onUpgradeClick:i}=this.props;u.y(this.environment,{from:t,for:s}),i&&i(e)},this.handleLearnMoreClick=()=>{const{from:e,learnMoreRoute:t}=this.props;d.navigateToExternalURL({environment:this.environment,url:(0,m.UY)(t)}),l.Fsx(this.environment,{from:e})}}renderComponent(){return o()("section",{style:this.getWrapStyle()},void 0,this.renderIcon(),this.renderTitle(),this.renderCaption(),this.renderActions())}renderIcon(){const{icon:e}=this.props;if(e)return e(this.getIconStyle())}renderTitle(){const{title:e}=this.props;return o()("header",{style:this.getTitleStyle()},void 0,e)}renderCaption(){const{caption:e}=this.props;return o()("p",{style:this.getCaptionStyle()},void 0,e)}renderActions(){return o()("footer",{style:this.getFooterStyle()},void 0,this.renderUpgradeButton(),this.renderLearnMoreButton())}renderUpgradeButton(){const{upgradeMessage:e}=this.props;return o()(c.Z,{onClick:this.handleUpgradeClick,isLarge:!0},void 0,e||o()(a.FormattedMessage,{defaultMessage:"Upgrade",id:"upsellCallout.upgradeButton.text"}))}renderLearnMoreButton(){return o()(p.Z,{onClick:this.handleLearnMoreClick},void 0,o()(a.FormattedMessage,{defaultMessage:"Learn more",id:"upsellCallout.learnMoreButton.text"}))}getWrapStyle(){const{device:e}=this.environment;return{...this.props.style,fontSize:14,...!e.isMobile&&{maxWidth:340}}}getIconStyle(){return{width:32,height:"auto",fill:this.theme.mediumIconColor,marginBottom:8}}getTitleStyle(){return{fontWeight:r.Z.fontWeight.semibold}}getCaptionStyle(){return{color:this.theme.mediumTextColor,marginTop:4,marginBottom:16}}getFooterStyle(){return{display:"flex",flexWrap:"wrap",gap:"8px 12px"}}}g.displayName="UpsellCallout";const h=g},22715:(e,t,s)=>{s.d(t,{Z:()=>r});s(77094);var i=s(67294),o=s(480),n=s(24405);s(58047);function r(){window.__c={n:"WebComponentNotSupportedInMobileNativeWarning"};(0,o.O7)(),(0,n.yK)((e=>({container:{margin:"8px 16px",background:e.accentColors.yellow[100],borderRadius:8,height:"fit-content"}})),[]);return i.createElement(i.Fragment,null)}},88198:(e,t,s)=>{s.d(t,{b:()=>p});var i=s(77094),o=s.n(i),n=s(67294),r=s(81954),a=s(24405),l=s(53397),d=s(26825),u=s(5366),m=s(4708),c=s(74136);function p(e){window.__c={n:"GuestPill"};const{style:t,labelType:s}=e,{label:i,icon:p}=(0,r.VK)((()=>(0,m.F$)()?"team_level_guest"===s?{label:d.mq.teamGuestLabel,icon:l.Z.openTeam}:{label:d.mq.pageGuestLabel,icon:l.Z.pageEmpty}:{label:d.mq.guestLabel,icon:l.Z.globe2}),[s]),g=(0,a.yK)((()=>({container:{display:"flex",alignItems:"center",color:"#CF8807",background:"rgba(246, 192, 80, 0.26)"}})),[]);return o()(c.Z,{innerStyle:{...g.container,...t}},void 0,p({width:9,fill:"#CF8807",display:"inline",verticalAlign:"middle",marginRight:2}),n.createElement(u.FormattedMessage,i))}},58047:(e,t,s)=>{s.d(t,{N:()=>m});var i=s(77094),o=s.n(i),n=(s(67294),s(24405)),r=s(53397),a=s(82990),l=s(42922),d=s(89728),u=s(64369);function m(e){let{title:t,description:s,onDismiss:i,icon:m,primaryAction:c,secondaryAction:p}=e;window.__c={n:"Prompt"};const g=(0,n.yK)((e=>({container:{position:"relative",width:"100%",padding:16},multiIconsRow:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:12},singleIconRow:{position:"absolute",top:10,right:16},dismissButton:{marginTop:-7,marginRight:-7},title:{fontWeight:a.Z.fontWeight.medium,fontSize:a.Z.fontSize.UIRegular.desktop,lineHeight:1.2,color:e.darkTextColor,marginBottom:8},description:{fontWeight:a.Z.fontWeight.regular,fontSize:a.Z.fontSize.UISmall.desktop,color:e.lightTextColor},primaryActionButton:{width:"100%",margin:"12px auto 0"},secondaryActionButton:{width:"100%",margin:"8px auto 0",justifyContent:"center",fontWeight:a.Z.fontWeight.regular,fontSize:a.Z.fontSize.UISmall.desktop,color:e.lightTextColor},secondaryActionIcon:{width:12,height:12,marginRight:4},icon:{width:14,height:14,color:e.regularIconColor}})),[]);return o()("div",{style:g.container},void 0,m?o()("div",{style:g.multiIconsRow},void 0,o()("div",{},void 0,m),o()(d.Z,{isSmall:!0,style:g.dismissButton,onClick:i},void 0,r.Z.closeSmall(g.icon))):o()("div",{style:g.singleIconRow},void 0,o()(d.Z,{isSmall:!0,style:g.dismissButton,onClick:i},void 0,r.Z.closeSmall(g.icon))),o()(u.Z,{style:g.title,isMultiline:!0},void 0,t),o()(u.Z,{style:g.description,isMultiline:!0,isSmall:!0},void 0,s),c?o()(l.Z,{isLarge:!0,style:g.primaryActionButton,onClick:e=>c.onClick(e)},void 0,c.text):null,p?o()(d.Z,{style:g.secondaryActionButton,onClick:e=>p.onClick(e)},void 0,p.icon?p.icon(g.secondaryActionIcon):null,p.text):null)}},83890:(e,t,s)=>{s.d(t,{Z:()=>w});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(83355),d=s(66897),u=s(53397),m=s(19889),c=s(7928),p=s(5366),g=s(31299),h=s(87082),v=s(92864),f=s(93044),b=s(255),y=s(97680),S=s(98707);class M extends l.Z{constructor(){super(...arguments),this.renderFilterListItem=(e,t)=>{let{disabled:s,onRemove:i,onClick:o}=t;const n=this.styles,a=this.getUserValue(e),l=r()(b.Z,{disabled:s,onClick:i});return r()(y.Z,{disabled:s,focused:!1,actor:(0,d.m3)(a),right:l,style:n.menuItem,desktopTitleStyle:n.menuItemTitle,onClick:o},e)},this.renderItemForSummary=e=>(0,c.Nz)(this.props.intl,this.getUserValue(e)),this.renderToken=(e,t)=>{const{userIds:s}=this.props,i=1===s.length,o=this.getUserValue(e);if(o)return r()(v.ZP,{format:this.environment.device.isMobile?f.lP.Large:f.lP.Small,showRemoveButton:!0,isSingle:i,onClickRemove:t.onRemove,actor:(0,d.m3)(o),shouldShrink:!0,style:{background:"transparent"}},e)},this.renderResultMenuItem=(e,t)=>{const s=this.getUserValue(e);return a.createElement(y.Z,o()({},t,{key:e,actor:(0,d.m3)(s)}))},this.performRequest=async e=>{let{query:t,current:s}=e;const i=new Set(s);return(await g.Yu({environment:this.environment,query:t,membersOnly:!1})).filter((e=>!i.has(e.id))).slice(0,20).map((e=>e.id))},this.getUserValue=e=>this.createUserStore(e).getValue(),this.createUserStore=e=>{const{parentStore:t}=this.props;return h.U6.createChildStore(t,{table:m.KJ,id:e})},this.styles={menuItem:{minHeight:void 0,paddingTop:this.environment.device.isMobile?12:4,paddingBottom:this.environment.device.isMobile?12:4},menuItemTitle:{width:"100%"},labeledMenuItemTitle:{display:"inline-flex",alignItems:"center"},menuItemLabel:{marginRight:12},recordIcon:{marginRight:2,fill:"currentColor"}}}renderComponent(){const{mode:e,title:t,userIds:s,onChange:i,disabled:o,focused:n,onMenuDismiss:a,intl:l}=this.props;return r()(S.Z,{mode:e,title:t,icon:u.Z.person,iconStyles:this.styles.recordIcon,items:s,onChange:i,disabled:o,focused:n,renderFilter:this.renderFilterListItem,renderToken:this.renderToken,renderItemForSummary:this.renderItemForSummary,addItemLabel:r()(p.FormattedMessage,{defaultMessage:"Add a person",id:"search.filterMenu.addAPersonButton.label"}),labelText:{title:t,tokenInputPlaceholder:l.formatMessage({defaultMessage:"Search people",id:"search.filterMenu.searchPeople.placeholder"}),componentDebugName:"SearchPersonFilter"},performRequest:this.performRequest,renderResultMenuItem:this.renderResultMenuItem,onMenuDismiss:a,hasItemsSelected:(null==s?void 0:s.length)>0})}}M.displayName="SearchPersonFilter";const w=(0,p.injectIntl)(M)},69507:(e,t,s)=>{s.d(t,{l:()=>m});var i=s(97464),o=s.n(i),n=s(77094),r=s.n(n),a=s(67294),l=s(83355),d=s(5366),u=s(72495);class m extends l.Z{renderComponent(){return a.createElement(u.Z,o()({title:r()(d.FormattedMessage,{id:"inviteUserModal.searchDropdown.selectPersonTitle",defaultMessage:"Select a person"})},this.props))}}m.displayName="SearchPersonDropdown"},79817:(e,t,s)=>{s.d(t,{fr:()=>f,x5:()=>S,j_:()=>M,fC:()=>w,uJ:()=>Z,Oh:()=>_,Si:()=>P,$s:()=>F});var i=s(33728),o=s(65917),n=s(24211),r=s(27006),a=s(97880),l=s(54642),d=s(76464),u=s(64964),m=s(33929),c=s(85834),p=s(4708),g=s(19306),h=s(21115),v=s(8323);const f=e=>{const{environment:t,spaceStore:s,contextualInviteStore:i}=e;b({environment:t,spaceStore:s,contextualInviteStore:i})?i.startRequestMembership():y({environment:t,spaceStore:s,contextualInviteStore:i})?i.startWorkspaceInvite():i.setState({...i.state,inviteStage:c.TG.closed})},b=e=>{const{spaceStore:t,contextualInviteStore:s}=e,i=t.getRole();return!(!i||!(0,r.RN)(i))&&(!!s.hasGuests()&&(!t.getDisableMembershipRequests()&&(0,p.p1)()))},y=e=>{const{spaceStore:t,contextualInviteStore:s}=e,i=t.getRole();return!(!i||!(0,r.dy)(i))&&(!!s.hasGuests()&&(0,v.Mk)())},S=e=>{const{success:t,intl:s,contextualInviteStore:i}=e,o=i.state.invitedUsers;0!==o.length&&(t?u.oV({label:s.formatMessage({id:"contextual_invite.permission_invite_success3",defaultMessage:"Successfully sent invites to {users}",description:"Client side message shown when the page invite succeeds on the server side."},{users:Z(o,s)})}):(u.oV({label:s.formatMessage({id:"contextual_invite.permission_invite_failure",defaultMessage:"Failed to send invites to {users}",description:"Client side message shown when the page invite fails on the server side."},{users:Z(o,s)})}),i.reset()))},M=async e=>{const{environment:t,spaceStore:s,contextualInviteStore:i,from:n,intl:r}=e,{selection:a,flowId:l}=i.state;if("page_guest"===a||!i.hasGuests())return i.reset(),!1;const{inviteTargets:u,unknownEmails:m}=await T({environment:t,contextualInviteStore:i}),c={...i.state};i.reset();const p=(0,v.zt)(),g=p&&(0,h.o9)(p)?"editor":e.inviteRole??"read_and_write";try{await d.n_({environment:t,store:s,inviteTargets:u,inviteRole:g,isOnboarding:!1,invite:{inviteOrigin:n,inviteFlowId:l}})}catch(f){return I(r,c.invitedUsers),o.log({level:"error",from:"contextualInviteHelpers",type:"inviteMembers.inviteTargets",data:{miscDataToConvertToString:{...c,inviteTargets:u}}}),!1}finally{m.length&&o.log({level:"error",from:"contextualInviteHelpers",type:"inviteMembers.unknownUserId",data:{miscDataToConvertToString:{...c,unknownEmails:m}}})}return!0},w=async e=>{const{environment:t,spaceStore:s,originId:i,originType:n,reasonMessage:r,contextualInviteStore:a,intl:d}=e,{selection:u}=a.state;if("page_guest"===u||!a.hasGuests())return a.reset(),!1;const{inviteTargets:m,unknownEmails:c}=await T({environment:t,contextualInviteStore:a}),p={...a.state};a.reset();const g=[];try{const e=m.map((e=>l.requestAccess(t,{type:"actor-to-space",forActorId:e.value.id,spaceId:s.id,message:r,attributes:{origin_id:i,origin_type:n,origin_table:"share_menu"===n?"block":"space",add_permissions_on_approval:!1}}).catch((()=>g.push(e)))));await Promise.all(e)}catch(h){return k(d,p.invitedUsers),o.log({level:"error",from:"contextualInviteHelpers",type:"requestMembers.inviteTargets",data:{miscDataToConvertToString:{...p,inviteTargetsWithErrors:g}}}),!1}finally{c.length&&o.log({level:"error",from:"contextualInviteHelpers",type:"requestMembers.unknownUserId",data:{miscDataToConvertToString:{...p,unknownEmails:c}}})}return!0},T=async e=>{const{environment:t,contextualInviteStore:s}=e,{invitedEmailToUserIdMap:i}=s.state,o=[],n=[];for(const r of s.state.invitedUsers){if(!r.isGuest)continue;const e=await C(t,r,i);e?o.push({type:"existingUser",value:{id:e,email:r.email,version:1}}):n.push(r.email)}return{inviteTargets:o,unknownEmails:n}},C=async(e,t,s)=>{const i=await(async(e,t,s)=>{let i=t.id;if(i||(i=s[t.email]),!i){const s=await l.findUser(e,{email:t.email});if("failed"!==s.type){const e=s.data;e.value&&(i=e.value.value.id)}}return i})(e,t,s);if(i)return i;const o=(0,n.E2)(m.default.getIntl()),r=await l.createEmailUser(e,{email:t.email,preferredLocaleOrigin:"inferred_from_inviter",preferredLocale:o});return"failed"!==r.type?r.data.userId:void 0},k=(e,t)=>{0!==t.length&&u.oV({label:e.formatMessage({id:"contextual_invite.request_members_failure",defaultMessage:"Failed to request {users} to become members",description:"Client side message shown when the request invitees to become members fails on the server side."},{users:Z(t,e)})})},I=(e,t)=>{0!==t.length&&u.oV({label:e.formatMessage({id:"contextual_invite.contextual_invite_failure",defaultMessage:"Failed to invite to {users} as members",description:"Client side message shown when the invite guests as members fails on the server side."},{users:Z(t,e)})})},Z=(e,t)=>(0,g.W)(e.flatMap((e=>e.email||[]))),_=(e,t)=>{const{state:s}=t,i=(0,v.zt)(),o=t.getGuestEmails();return{invite_flow_id:s.flowId,user_count:o.length,user_emails:o,invite_space_role_selection:s.selection,is_bot:!1,subscription_tier:i}};function P(e){const{type:t}=e;switch(t){case"newUser":return{email:e.value.email,isGuest:!0};case"existingUser":return{...e.value,email:e.value.email,isGuest:"none"===e.spaceRole||"not_in_space"===e.spaceRole};case"group":return;default:(0,a.t1)(t)}}function F(e){const{contextualInviteUser:t,allowedDomains:s}=e,{email:o,isGuest:n}=t;if(n){const e=(0,i.Gd)(o);if(!e)return!1;if(s.has(e))return!0}return!1}},53353:(e,t,s)=>{s.d(t,{Z:()=>r});var i=s(81954),o=s(98165),n=s(65598);const r=function(e){return(0,i.VK)((()=>{if(!(0,n.NZ)(e))return{isStoreInTeam:!1,spaceAllowsGuests:!0};const t=(0,o.VP)(e),s=(0,o.Pj)(e),i=!(null!=s&&s.getDisableGuests());return t?{isStoreInTeam:!0,teamAllowsGuests:!t.getDisableGuests(),spaceAllowsGuests:i}:{isStoreInTeam:!1,spaceAllowsGuests:i}}),[e])}},26781:(e,t,s)=>{s.d(t,{i:()=>l});var i=s(77094),o=s.n(i),n=s(67294),r=s(5366),a=s(53353);function l(e){const t=(0,a.Z)(e);return t.isStoreInTeam?t.teamAllowsGuests?void 0:n.createElement(n.Fragment,null,o()("div",{},void 0,o()(r.FormattedMessage,{id:"contextualInvite.buttonAndTokenTooltip.teamDisablesGuestsAlertLine1",defaultMessage:"This teamspace doesn't allow guests.",description:"Tooltip message shown when hovering above the guest invitee or invite button when guests are disabled on the teamspace"})),o()("div",{},void 0,o()(r.FormattedMessage,{id:"contextualInvite.buttonAndTokenTooltip.teamDisablesGuestsAlertLine2",defaultMessage:"Remove any guests to continue.",description:"Tooltip message telling the user the action needed to continue with invite form."}))):t.spaceAllowsGuests?void 0:n.createElement(n.Fragment,null,o()("div",{},void 0,o()(r.FormattedMessage,{id:"contextualInvite.buttonAndTokenTooltip.spaceDisablesGuestsAlertLine1",defaultMessage:"This workspace doesn't allow guests.",description:"Tooltip message shown when hovering above the guest invitee or invite button when guests are disabled on the teamspace"})),o()("div",{},void 0,o()(r.FormattedMessage,{id:"contextualInvite.buttonAndTokenTooltip.spaceDisablesGuestsAlertLine2",defaultMessage:"Remove any guests to continue.",description:"Tooltip message telling the user the action needed to continue with invite form."})))}},53680:(e,t,s)=>{s.d(t,{Z:()=>n});var i=s(49085);class o extends i.default{getInitialState(){return{disablePublicAccess:!1,disableGuests:!1,disableMoveToSpace:!1,disableExport:!1,disableSpacePageEdits:!1,disablePublicAccessRequests:!1,disableTeamCreation:!1,disableMembershipRequests:!1,disableGuestMembershipRequests:!1,enableAiFeature:!1,disableTeamGuests:!1}}getValueForSpace(e){if(e.isDefined())return{disablePublicAccess:Boolean(e.getDisablePublicAccess()),disableGuests:Boolean(e.getDisableGuests()),disableMoveToSpace:Boolean(e.getDisableMoveToSpace()),disableExport:Boolean(e.getDisableExport()),disableSpacePageEdits:Boolean(e.getDisableSpacePageEdits()),disablePublicAccessRequests:Boolean(e.getDisablePublicAccessRequests()),disableTeamCreation:Boolean(e.getDisableTeamCreation()),disableMembershipRequests:Boolean(e.getKeyStore("settings").getKeyStore("disable_membership_requests").getValue()),disableGuestMembershipRequests:Boolean(e.getKeyStore("settings").getKeyStore("disable_guest_membership_requests").getValue()),enableAiFeature:Boolean(e.getKeyStore("settings").getKeyStore("enable_ai_feature").getValue()),disableTeamGuests:Boolean(e.getKeyStore("settings").getKeyStore("disable_team_guests").getValue())}}}const n=o},98905:(e,t,s)=>{s.d(t,{Z:()=>n});var i=s(49085);class o extends i.default{getInitialState(){return{count:0}}}const n=new o}}]);